summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog22
-rw-r--r--icons/Makefile.am13
-rw-r--r--icons/nm-vpn-active-lock.png (renamed from icons/nm-vpn-lock.png)bin560 -> 560 bytes
-rw-r--r--icons/nm-vpn-standalone-lock.pngbin0 -> 595 bytes
-rw-r--r--src/applet.c4
-rw-r--r--src/connection-editor/main.c5
-rw-r--r--src/connection-editor/nm-connection-list.c133
7 files changed, 117 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index 2d809eb0..4d8cb816 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
2008-04-08 Dan Williams <dcbw@redhat.com>
+ * icons/Makefile.am
+ icons/nm-vpn-standalone-lock.png
+ icons/nm-vpn-active-lock.png
+ - Split VPN lock icons; add 16x16 centered icon for connection editor
+
+ * icons/nm-vpn-lock.png
+ - remove
+
+ * src/applet.c
+ - (nma_icons_load): use nm-vpn-active-lock.png
+
+ * src/connection-editor/nm-connection-list.c
+ - (new_connection_list): allow NULL icon pixbuf
+ - (nm_connection_list_init): don't init stuff here because it can fail
+ - (dispose): don't dispose of stuff that's not allocated
+ - (nm_connection_list_new): init stuff here and clean up if it fails
+
+ * src/connection-editor/main.c
+ - (main): exit cleanly on init failure
+
+2008-04-08 Dan Williams <dcbw@redhat.com>
+
* src/applet.c
- (periodic_update_active_connection_timestamps): new function; update
active connection timestamps every 5 minutes
diff --git a/icons/Makefile.am b/icons/Makefile.am
index 29112590..b33ce424 100644
--- a/icons/Makefile.am
+++ b/icons/Makefile.am
@@ -63,9 +63,16 @@ smallicon_DATA= \
nm-vpn-connecting12.png \
nm-vpn-connecting13.png \
nm-vpn-connecting14.png \
- nm-vpn-lock.png \
+ nm-vpn-active-lock.png \
+ $(NULL)
+
+smallericondir=${datadir}/icons/hicolor/16x16/apps
+smallericon_DATA= \
+ nm-vpn-standalone-lock.png \
$(NULL)
EXTRA_DIST=\
- $(largeicon_DATA) \
- $(smallicon_DATA)
+ $(largeicon_DATA) \
+ $(smallicon_DATA) \
+ $(smallericon_DATA)
+
diff --git a/icons/nm-vpn-lock.png b/icons/nm-vpn-active-lock.png
index 8a616968..8a616968 100644
--- a/icons/nm-vpn-lock.png
+++ b/icons/nm-vpn-active-lock.png
Binary files differ
diff --git a/icons/nm-vpn-standalone-lock.png b/icons/nm-vpn-standalone-lock.png
new file mode 100644
index 00000000..05241d75
--- /dev/null
+++ b/icons/nm-vpn-standalone-lock.png
Binary files differ
diff --git a/src/applet.c b/src/applet.c
index 93c86753..2a8e183e 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -1862,8 +1862,8 @@ nma_icons_load (NMApplet *applet)
ICON_LOAD(applet->no_connection_icon, "nm-no-connection");
ICON_LOAD(applet->wired_icon, "nm-device-wired");
ICON_LOAD(applet->adhoc_icon, "nm-adhoc");
- ICON_LOAD(applet->wwan_icon, "nm-device-wwan"); /* FIXME: Until there's no WWAN device icon */
- ICON_LOAD(applet->vpn_lock_icon, "nm-vpn-lock");
+ ICON_LOAD(applet->wwan_icon, "nm-device-wwan");
+ ICON_LOAD(applet->vpn_lock_icon, "nm-vpn-active-lock");
ICON_LOAD(applet->wireless_00_icon, "nm-signal-00");
ICON_LOAD(applet->wireless_25_icon, "nm-signal-25");
diff --git a/src/connection-editor/main.c b/src/connection-editor/main.c
index cd125894..07b94b18 100644
--- a/src/connection-editor/main.c
+++ b/src/connection-editor/main.c
@@ -94,6 +94,11 @@ main (int argc, char *argv[])
loop = g_main_loop_new (NULL, FALSE);
list = nm_connection_list_new ();
+ if (!list) {
+ g_warning ("Failed to initialize the UI, exiting...");
+ return 1;
+ }
+
g_signal_connect (G_OBJECT (list), "done", G_CALLBACK (list_done_cb), NULL);
nm_connection_list_run (list);
diff --git a/src/connection-editor/nm-connection-list.c b/src/connection-editor/nm-connection-list.c
index 3d622d6f..0198cb30 100644
--- a/src/connection-editor/nm-connection-list.c
+++ b/src/connection-editor/nm-connection-list.c
@@ -565,8 +565,10 @@ new_connection_list (NMConnectionList *list,
/* Tab label with icon */
hbox = gtk_hbox_new (FALSE, 6);
- image = gtk_image_new_from_pixbuf (pixbuf);
- gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+ if (pixbuf) {
+ image = gtk_image_new_from_pixbuf (pixbuf);
+ gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+ }
gtk_box_pack_start (GTK_BOX (hbox), gtk_label_new (label_text), FALSE, FALSE, 0);
gtk_widget_show_all (hbox);
@@ -675,48 +677,9 @@ dialog_response_cb (GtkDialog *dialog, guint response, gpointer user_data)
gtk_widget_hide (GTK_WIDGET (dialog));
}
-#define ICON_LOAD(x, y) \
- { \
- x = gtk_icon_theme_load_icon (list->icon_theme, y, 16, 0, &error); \
- if (x == NULL) { \
- g_warning ("Icon %s missing: %s", y, error->message); \
- g_error_free (error); \
- return; \
- } \
- }
-
static void
nm_connection_list_init (NMConnectionList *list)
{
- GError *error = NULL;
-
- /* load GUI */
- list->gui = glade_xml_new (GLADEDIR "/nm-connection-editor.glade", "NMConnectionList", NULL);
- if (!list->gui) {
- g_warning ("Could not load Glade file for connection list");
- return;
- }
-
- list->icon_theme = gtk_icon_theme_get_for_screen (gdk_screen_get_default ());
-
- /* Load icons */
- ICON_LOAD(list->wired_icon, "nm-device-wired");
- ICON_LOAD(list->wireless_icon, "nm-device-wireless");
- ICON_LOAD(list->wwan_icon, "nm-device-wwan");
- ICON_LOAD(list->vpn_icon, "lock");
- ICON_LOAD(list->unknown_icon, "nm-no-connection");
-
- list->client = gconf_client_get_default ();
-
- /* read connections */
- list->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
- load_connections (list);
- init_connection_lists (list);
-
- list->editors = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, g_object_unref);
-
- list->dialog = glade_xml_get_widget (list->gui, "NMConnectionList");
- g_signal_connect (G_OBJECT (list->dialog), "response", G_CALLBACK (dialog_response_cb), list);
}
static void
@@ -724,20 +687,31 @@ dispose (GObject *object)
{
NMConnectionList *list = NM_CONNECTION_LIST (object);
- gtk_widget_hide (list->dialog);
-
- g_hash_table_destroy (list->editors);
-
- g_object_unref (list->wired_icon);
- g_object_unref (list->wireless_icon);
- g_object_unref (list->wwan_icon);
- g_object_unref (list->vpn_icon);
- g_object_unref (list->unknown_icon);
-
- gtk_widget_destroy (list->dialog);
- g_object_unref (list->gui);
- g_hash_table_destroy (list->connections);
- g_object_unref (list->client);
+ if (list->dialog)
+ gtk_widget_hide (list->dialog);
+
+ if (list->editors)
+ g_hash_table_destroy (list->editors);
+
+ if (list->wired_icon)
+ g_object_unref (list->wired_icon);
+ if (list->wireless_icon)
+ g_object_unref (list->wireless_icon);
+ if (list->wwan_icon)
+ g_object_unref (list->wwan_icon);
+ if (list->vpn_icon)
+ g_object_unref (list->vpn_icon);
+ if (list->unknown_icon)
+ g_object_unref (list->unknown_icon);
+
+ if (list->dialog)
+ gtk_widget_destroy (list->dialog);
+ if (list->gui)
+ g_object_unref (list->gui);
+ if (list->connections)
+ g_hash_table_destroy (list->connections);
+ if (list->client)
+ g_object_unref (list->client);
G_OBJECT_CLASS (nm_connection_list_parent_class)->dispose (object);
}
@@ -761,14 +735,63 @@ nm_connection_list_class_init (NMConnectionListClass *klass)
G_TYPE_NONE, 1, G_TYPE_INT);
}
+#define ICON_LOAD(x, y) \
+ { \
+ x = gtk_icon_theme_load_icon (list->icon_theme, y, 16, 0, &error); \
+ if (x == NULL) { \
+ g_warning ("Icon %s missing: %s", y, error->message); \
+ g_error_free (error); \
+ goto error; \
+ } \
+ }
+
NMConnectionList *
nm_connection_list_new (void)
{
NMConnectionList *list;
+ GError *error = NULL;
list = g_object_new (NM_TYPE_CONNECTION_LIST, NULL);
+ if (!list)
+ return NULL;
+
+ /* load GUI */
+ list->gui = glade_xml_new (GLADEDIR "/nm-connection-editor.glade", "NMConnectionList", NULL);
+ if (!list->gui) {
+ g_warning ("Could not load Glade file for connection list");
+ goto error;
+ }
+
+ list->icon_theme = gtk_icon_theme_get_for_screen (gdk_screen_get_default ());
+
+ /* Load icons */
+ ICON_LOAD(list->wired_icon, "nm-device-wired");
+ ICON_LOAD(list->wireless_icon, "nm-device-wireless");
+ ICON_LOAD(list->wwan_icon, "nm-device-wwan");
+ ICON_LOAD(list->vpn_icon, "nm-vpn-standalone-lock");
+ ICON_LOAD(list->unknown_icon, "nm-no-connection");
+
+ list->client = gconf_client_get_default ();
+ if (!list->client)
+ goto error;
+
+ /* read connections */
+ list->connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+ load_connections (list);
+ init_connection_lists (list);
+
+ list->editors = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, g_object_unref);
+
+ list->dialog = glade_xml_get_widget (list->gui, "NMConnectionList");
+ if (!list->dialog)
+ goto error;
+ g_signal_connect (G_OBJECT (list->dialog), "response", G_CALLBACK (dialog_response_cb), list);
return list;
+
+error:
+ g_object_unref (list);
+ return NULL;
}
static void