diff options
author | Dan Williams <dcbw@redhat.com> | 2016-03-17 16:26:56 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2016-03-17 16:26:56 -0500 |
commit | 21f54cc112316a1d442ca051d23f348f5a5c79b8 (patch) | |
tree | e324016534d2044b6f05841057a66ad9b72e666c | |
parent | b648b4bfcecabd68b64b1079069e8b7f388d9044 (diff) | |
download | network-manager-applet-21f54cc112316a1d442ca051d23f348f5a5c79b8.tar.gz |
applet: fix some visual ugliness and ensure available connections show in indicator modedcbw/indicator-cleanups
Remove the separator after the active connection, and put a new separator
between devices. Also ensure that connection items show themselves, otherwise
they don't get picked up by dbusmenu-gtk.
-rw-r--r-- | src/applet.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/applet.c b/src/applet.c index bab980b3..c423f49b 100644 --- a/src/applet.c +++ b/src/applet.c @@ -493,33 +493,31 @@ applet_menu_item_add_complex_separator_helper (GtkWidget *menu, NMApplet *applet, const gchar *label) { - GtkWidget *menu_item; + GtkWidget *menu_item, *box, *xlabel; if (INDICATOR_ENABLED (applet)) { /* Indicator doesn't draw complex separators */ - menu_item = gtk_separator_menu_item_new (); - } else { - GtkWidget *box, *xlabel; - - menu_item = gtk_menu_item_new (); - box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + return; + } - if (label) { - xlabel = gtk_label_new (NULL); - gtk_label_set_markup (GTK_LABEL (xlabel), label); + menu_item = gtk_menu_item_new (); + box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_pack_start (GTK_BOX (box), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (box), xlabel, FALSE, FALSE, 2); - } + if (label) { + xlabel = gtk_label_new (NULL); + gtk_label_set_markup (GTK_LABEL (xlabel), label); gtk_box_pack_start (GTK_BOX (box), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), TRUE, TRUE, 0); - - g_object_set (G_OBJECT (menu_item), - "child", box, - "sensitive", FALSE, - NULL); + gtk_box_pack_start (GTK_BOX (box), xlabel, FALSE, FALSE, 2); } + gtk_box_pack_start (GTK_BOX (box), gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), TRUE, TRUE, 0); + + g_object_set (G_OBJECT (menu_item), + "child", box, + "sensitive", FALSE, + NULL); + gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); } @@ -1363,6 +1361,9 @@ add_device_items (NMDeviceType type, const GPtrArray *all_devices, dclass->add_menu_item (device, n_devices > 1, connections, active, menu, applet); g_ptr_array_unref (connections); + + if (INDICATOR_ENABLED (applet)) + gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_separator_menu_item_new ()); } g_slist_free (devices); @@ -1956,6 +1957,7 @@ applet_add_connection_items (NMDevice *device, item = applet_new_menu_item_helper (connection, active, (flag & NMA_ADD_ACTIVE)); gtk_widget_set_sensitive (item, sensitive); + gtk_widget_show_all (item); info = g_slice_new0 (AppletMenuItemInfo); info->applet = applet; |