Commit graph

58 commits

Author SHA1 Message Date
Dan Winship
d57795d474 tui: fix NmtMacEntry validation/display
NmtMacEntry would allow you to input 1 character more than it should
have. Fix that.

Also, the code to insert ":"s automatically was bumping against some
weirdness in NmtNewtEntry that made it so that the ":" didn't get
displayed until you typed one more character after the one where it
got inserted. Hack around that by manually requesting a redraw.

https://bugzilla.gnome.org/show_bug.cgi?id=731160
2014-06-03 16:06:35 +02:00
Dan Winship
5ee85fe46e tui: fix setting Clone MAC Address properties
NmtMacEntry wasn't notifying its mac-address property when it changed,
so the change never got saved to the NMSetting.

https://bugzilla.gnome.org/show_bug.cgi?id=731160
2014-06-03 16:06:35 +02:00
Jiří Klimeš
92898e84d6 tui: fix a crash when editing IPv6 routes 2014-06-03 14:08:38 +02:00
Jiří Klimeš
d7b8aeea33 tui: use 128 as the default prefix for IPv6 addresses 2014-06-02 17:39:51 +02:00
Jiří Klimeš
5378d7929e tui: fix a crash when editing an IPv6 address (rh #1103702)
https://bugzilla.redhat.com/show_bug.cgi?id=1103702
2014-06-02 17:39:46 +02:00
Thomas Haller
9ef23947cc all: fix various warnings detected with coverity
https://bugzilla.gnome.org/show_bug.cgi?id=728320

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-05-02 15:20:30 +02:00
Dan Winship
7f5b2f81b0 tui: fix route editing (rh #1090422)
NmtRouteTable's ip4-routes and ip6-routes properties have the
D-Bus-based route list types (like the corresponding NMSetting
properties) so we have to convert our GSList-of-NMIP[46]Route data
into those types when updating the property.

https://bugzilla.gnome.org/show_bug.cgi?id=728958
2014-04-29 10:36:54 -04:00
Dan Winship
0c2586a786 tui: fix title of "Edit Connection" form (rh #1090397)
Form titles should be in titlecase; this was the only one that wasn't.
2014-04-25 11:22:38 -04:00
Jiří Klimeš
f69842aa57 tui: fix a crash when connecting to a password-secured Wi-Fi (rh #1090773)
'dialog' and 'co' were swapped in maybe_save_input_and_exit().

https://bugzilla.redhat.com/show_bug.cgi?id=1090773
2014-04-24 13:56:47 +02: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
b4216ccb2d tui: allow Esc to cancel "nmtui connect" 2014-03-24 13:19:13 -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
96a5ad51c2 tui: fix using Escape from main menu
We weren't checking whether the form closed because the menu was
activated or because the user hit Escape
2014-03-21 13:32:50 -04:00
Jiří Klimeš
a3de4283ea tui: fix crashes in nmtui-connect (rh #1078281)
https://bugzilla.redhat.com/show_bug.cgi?id=1078281
2014-03-21 13:32:50 -04:00
Dan Winship
f6e2b6528f tui: fix binding of some int/uint properties (rh #1078281)
GLib registers number->string value transforms (meaning that
number-valued properties like NMSettingVlan:id or NMSettingWired:mtu
get loaded into their NmtNewtEntries correctly), but not the
corresponding string->number transforms (meaning changes made in the
entries don't get propagated back to the settings, and due to
http://bugzilla.gnome.org/show_bug.cgi?id=726574, there's no warning
about this). Fix this by registering our own transforms.
2014-03-21 13:32:50 -04:00
Dan Winship
941ce35238 tui: fix quitting from "nmtui edit CONN-ID"
If you launched nmtui directly into the editor for a specific
connection, it would hang with a blank screen when you quit.

Fix this by changing the way startup works a bit, and have the created
toplevel NmtNewtForm get returned all the way to nmtui.c, which can
then connect to the "quit" signal on it and quit (rather than having
the different subprograms trying to guess whether they're supposed to
quit-on-exit or not).
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
Dan Winship
12a2d64063 tui: handle Wi-Fi networks with multiple APs correctly 2014-02-17 15:30:04 -05:00
Jiří Klimeš
4401fd4ac7 tui: fix srcdir != builddir build 2014-02-13 18:28:30 +01:00
Jiří Klimeš
de15dafd1b tui: properly initialize InfiniBand transport-mode
We need to initialize transport-mode because default value is NULL,
which is not a valid mode.
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
9c4d86ee80 libnm-util, libnm-glib: add versioned deprecation/availability macros
Add versioned NM_DEPRECATED_IN_* and NM_AVAILABLE_IN_* macros, and tag
new/deprecated functions accordingly. (All currently-deprecated
functions are assumed to have been deprecated in 0.9.10.)

Add NM_VERSION_MIN_REQUIRED and NM_VERSION_MAX_ALLOWED macros which
can be set to determine which versions will cause warnings.

With the current settings, external consumers of the
libnm-util/libnm-glib APIs will have MIN_REQUIRED and MAX_ALLOWED both
set to NM_VERSION_0_9_8 by default, meaning they will get warnings
about functions added in 0.9.10. NM internally sets
NM_VERSION_MAX_ALLOWED to NM_VERSION_NEXT_STABLE to ensure that it is
always allowed to use all APIs.
2014-02-13 11:24:37 -05:00
Dan Winship
aa1b262091 tui: properly initialize the IP4 and IP6 settings on new connections
We need to initialize the methods.
2014-01-30 11:43:15 -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
Thomas Haller
0ee3f23534 tui: use nm_remote_settings_get_connection_by_id()
Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-01-27 15:39:51 -05:00
Dan Winship
36ed2e91bb tui: use the new libnm-util/libnm-glib device/connection utils
Use the new methods copied into libnm-util/libnm-glib from libnm-gtk,
and remove nmtui's local copies.
2014-01-27 15:39:51 -05:00
Dan Winship
6c332f33aa tui: add a (void) cast to avoid a coverity warning 2014-01-23 15:04:08 -05:00
Dan Williams
4478d86ea8 trivial: fix variable shadowing 2014-01-17 10:26:42 -06:00
Dan Winship
94c29932e2 tui: fix build 2014-01-16 14:54:39 -05:00
Dan Winship
e9fe63cdaa trivial: annotate/adjust some code to appease Coverity 2014-01-16 14:23:45 -05:00
Dan Winship
46ef9029bc tui: fix activation of "new" Wi-Fi networks
When activating a never-before-used Wi-Fi network, we need to call
nm_client_add_and_activate_connection(), not
nm_client_activate_connection(). (We still pass a NULL connection,
since NM will attempt to auto-fill it for us, and will succeed as long
as it's not an 802.1x connection.)
2014-01-16 09:19:07 -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
1d40b9f872 tui: implement deactivation in "nmtui connect" 2014-01-16 09:19:07 -05:00
Dan Winship
0fe46a5839 tui: reorganize "nmtui connect" code
Make NmtConnectConnectionList just a dumb connection list, and have
the actual connecting code be in nmtui-connect.c
2014-01-16 09:19:06 -05:00
Dan Winship
c0663e42d0 tui: correctly return errors from NmtSecretAgent 2014-01-16 09:19:06 -05:00
Dan Winship
4c0ac46a99 libnm-util: add a missing GValue transform needed by nmtui 2014-01-16 09:19:06 -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
eb9cd6da08 tui: reorganize the main dialog
"Cancel" didn't really make sense here, but changing it to "Quit" is
also weird because if you were going to use the "OK" button you'd have
to tab past "Quit" first... So make it be an option in the menu
instead.
2014-01-16 09:19:06 -05:00
Dan Winship
867c3cdae0 tui: fix the error-on-startup cases 2014-01-16 09:19:06 -05:00
Dan Winship
ed6b8f8c1d tui: localize startup/usage-related strings 2014-01-16 09:19:06 -05:00
Dan Winship
bbb416a6a7 tui: error out if NM is not running 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
9c8845c35d tui: don't bother making links (nmtui-edit, etc) in build tree
They end up not working right from the build tree anyway, because the
nmtui libtool wrapper doesn't pass its argv[0] on to the actual
binary.
2014-01-16 09:19:06 -05:00