Commit Graph

22 Commits

Author SHA1 Message Date
Dan Winship
dd2e751b07 tui: fix Wi-Fi section of "nmtui connect" list in non-UTF-8 locales
In locales where the Wi-Fi signal-strength characters couldn't be
represented (eg, LANG=C), the entire Wi-Fi SSID + signal strength
string would fail to convert, causing the Wi-Fi section of the
connection list to show up as a series of blank lines.

Fix this by testing beforehand whether the characters can convert, and
falling back to plain ASCII if not. (And also, fix the similar code in
nmt-newt-section.c, which got broken when nmt_newt_locale_from_utf8()
was changed to never return NULL.)

Also, for paranoia, represent the signal-strength strings via \nnn
escapes rather than actual UTF-8 data, to guarantee that they get
compiled to the expected values even if the source files get
re-encoded.

https://bugzilla.gnome.org/show_bug.cgi?id=733007
2014-07-16 12:05:44 -04:00
Dan Winship
30c74c6007 build: more srcdir!=builddir fixes
nm-version.h was getting disted, making srcdir!=builddir work for
tarball builds, but not for git builds.

Also, remove "-I${top_builddir}/include" from all Makefile.ams, since
there's nothing generated in include/ any more.
2014-07-15 11:37:19 -04:00
Dan Winship
aa1dce6da2 all: remove remaining GParamSpec name/blurb strings
Remove all remaining GParamSpec name and blurb strings (and fix
indentation while we're there), and add G_PARAM_STATIC_STRINGS to all
paramspecs that were lacking it.
2014-06-19 17:45:03 -04:00
Dan Winship
bea82ca98b all: set G_LOG_DOMAIN appropriately, for better g_log() messages 2014-04-23 10:19:17 -04:00
Dan Winship
ce26445b6f tui: allow ^Z to suspend the app
This way if we end up with bugs that make it otherwise impossible to
kill nmtui, you can at least ^Z and then kill it from the command
line.
2014-03-24 13:22:23 -04:00
Dan Winship
1bdc4ba948 tui: add nmt_newt_widget_get_realized(), realize forms properly
NmtNewtForm is an NmtNewtWidget, but previously it was only realizing
its child, not itself, which is technically wrong (though it had no
noticeable effect until get_realized() was added).
2014-03-24 13:16:12 -04:00
Dan Winship
f8b4ee04ba tui: add some comments to nmt-newt-form.c 2014-03-21 13:32:50 -04:00
Dan Winship
bbc6434e96 tui: fix selection bugs after deleting a connection
nmt_newt_listbox_clear() did not reset active and active_key, which in
the case of NmtEditConnectionList meant that after the connection list
was rebuilt, the selection would appear to be in the same place, but
active_key would still point to the connection that used to be in that
row, rather than the one currently in that row, so if you immediately
hit Edit or Delete, you'd get unexpected results. (It also meant that
it was possible for the selection to land on a header row instead of a
connection row.)

This was particularly bad in the case of the Delete button, since
active_key would be left pointing to a freed NMConnection in that
case.

Fix NmtNewtListbox, and then add code to NmtEditConnectionList to
preserve the selection itself when rebuilding the list.
2014-03-21 13:32:24 -04:00
Jiří Klimeš
a8f94e9ae0 trivial: fix a typo in a comment 2014-03-17 09:01:50 +01:00
Dan Winship
16cd4f6892 trivial: fix variable name in declaration 2014-02-27 13:39:20 -05:00
Dan Winship
fae47c1916 tui: don't expand editor form to fullscreen horizontally
The form doesn't make use of the extra horizontal space, so it looks
bad to expand it rather than centering it.
2014-02-17 15:30:04 -05:00
Dan Winship
6ee48dc964 tui: fix flickering with large windows
Use newtPopWindowNoRefresh() rather than newtPopWindow() when
destroying a form, since often we have to destroy and then almost
immediately after re-create the same form, and we don't want that to
be visible.
2014-02-17 15:30:04 -05:00
Dan Winship
5d581b0d08 tui: handle Esc correctly from toplevel windows
The main "connect" and "edit" windows set the "escape-exits" flag, but
that just closed the form without exiting the app, leaving the user
trapped. Fix this by emitting a signal when the form quits, and
catching that. (And now we don't need to watch the "clicked" signal on
the quit buttons, since they have the "exit-on-activate" flag set.)
2014-02-17 15:30:04 -05:00
Jiří Klimeš
4401fd4ac7 tui: fix srcdir != builddir build 2014-02-13 18:28:30 +01:00
Dan Winship
64c5395cb1 build: improve our use of glib's version macros to catch more bugs
We were setting GLIB_VERSION_MAX_ALLOWED to 2.34, since we provide
reimplementations of a few 2.34 functions in nm-glib-compat.h. But
this was turning off warnings for the 2.34+ APIs we *didn't* have
compat versions of too.

Fix this by setting MAX_ALLOWED to 2.32 (same as MIN_REQUIRED), and
defining macros to wrap calls to compat-ified functions and disable
deprecation warnings around them.

This points out several places where we were accidentally using 2.34
APIs without noticing, which need to be fixed now.
2014-02-13 11:24:37 -05:00
Dan Winship
54dab9caf9 tui: fix a crash when creating a new connection
Make all the signals RUN_FIRST instead of RUN_LAST. In particular,
this fixes a crash when creating a new connection and activating the
listbox directly, in which case nmt_newt_listbox_activated() was
running after NmtAddConnection:create_connection() had already quit
the form and unrealized the listbox.
2014-01-30 11:43:15 -05:00
Dan Winship
64cb43b3b2 tui: add nmt_newt_text_width()
We were using g_utf8_strlen() to measure strings for layout, but that
counts combining marks too, and also fails to deal with "fullwidth"
(ie, double-width) CJK characters.

Add a new utility function to do a better job of this (based on code
from vte), and use it everywhere.
2014-01-16 09:19:07 -05:00
Dan Winship
c1017d04df tui: rename nmt_newt_error_dialog() to nmt_newt_message_dialog() 2014-01-16 09:19:06 -05:00
Dan Winship
034d812433 tui: don't pop up a dialog on g_log messages
Unless NMTUI_DEBUG is set, don't pop up a dialog when a
g_warning/critical/etc occurs. Just hide the main screen briefly so
the error doesn't get printed over the UI, and restore it after; any
messages that get logged will be visible after nmtui exits.
2014-01-16 09:19:06 -05:00
Dan Winship
8c12177f78 tui: don't center the buttons in a button box
Since we can't align buttons to half-character positions, they end up
looking more random than centered:

  |   <Add>   |
  | <Edit...> |
  | <Delete>  |

So just let them be left-aligned instead. It looks better.
2014-01-16 09:19:06 -05:00
Dan Winship
33d544f472 tui: fix keyboard focus problem
The keyboard focus was getting reset to the first widget any time a
widget changed validity, because the form wasn't updating priv->focus
when it should have.
2014-01-16 09:19:06 -05:00
Dan Winship
3bda3fb60c nmtui: initial import of nmtui
nmtui is a TUI (curses-based Text User Interface) for NetworkManager
2013-12-13 16:00:51 +01:00