Re: Method "getActiveDevice" doesn't exist



On Fri, 2005-05-20 at 16:10 -0400, Dan Williams wrote:
> On Fri, 2005-05-20 at 20:32 +0100, Bastien Nocera wrote:
> > Hey Dan,
<snip>
> > How can I debug the notification icon, to know why it's saying I don't
> > have any devices?
> 
> First of all, you're sure you're running 'nm-applet' ?

Yup. I tried to though, and it just won't lock the vpn icon, or the
progress ones (patch for better error reporting below).

So, how do I debug the notification area stuff then?

> Second, the nmtest tool is actually wrong, I never fixed it up after the
> removal of getActiveDevice.  I'll have to do that.

Right, but still, it lists the devices and networks, and the
NetworkManagerInfo doesn't.

-- 
Bastien Nocera <hadess hadess net>
Index: applet.c
===================================================================
RCS file: /cvs/gnome/NetworkManager/gnome/applet/applet.c,v
retrieving revision 1.9
diff -u -p -u -r1.9 applet.c
--- applet.c	14 May 2005 21:54:29 -0000	1.9
+++ applet.c	20 May 2005 21:53:52 -0000
@@ -937,20 +937,21 @@ static void nmwa_start_redraw_timeout (N
  * pop up a warning or error dialog with certain text
  *
  */
-gboolean show_warning_dialog (char *mesg)
+gboolean show_warning_dialog (const char *mesg)
 {
 	GtkWidget	*	dialog;
 	guint32		timestamp;
 
 	dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, mesg, NULL);
 
+	gtk_widget_realize (dialog);
+
 	/* Bash focus-stealing prevention in the face */
 	timestamp = gdk_x11_get_server_time (dialog->window);
 	gdk_x11_window_set_user_time (dialog->window, timestamp);
 
 	gtk_dialog_run (GTK_DIALOG (dialog));
 	gtk_widget_destroy (dialog);
-	g_free (mesg);
 
 	return FALSE;
 }
@@ -2056,6 +2057,17 @@ static void nmwa_icons_free (NMWirelessA
 		g_object_unref (applet->wireless_connecting_icons[i]);
 }
 
+#define ICON_LOAD(x, y)	\
+	{		\
+		GError *err = NULL; \
+		x = gtk_icon_theme_load_icon (icon_theme, y, icon_size, 0, &err); \
+		if (x == NULL) { \
+			g_warning ("Icon %s missing: %s", y, err->message); \
+			g_error_free (err); \
+			goto out; \
+		} \
+	}
+
 static void
 nmwa_icons_load_from_disk (NMWirelessApplet *applet, GtkIconTheme *icon_theme)
 {
@@ -2066,47 +2078,36 @@ nmwa_icons_load_from_disk (NMWirelessApp
 	/* Assume icons are square */
 	gint icon_size = 22;
 
-	applet->no_connection_icon = gtk_icon_theme_load_icon (icon_theme, "nm-no-connection", icon_size, 0, NULL);
-	applet->wired_icon = gtk_icon_theme_load_icon (icon_theme, "nm-device-wired", icon_size, 0, NULL);
-	applet->adhoc_icon = gtk_icon_theme_load_icon (icon_theme, "nm-adhoc", icon_size, 0, NULL);
-	applet->vpn_lock_icon = gtk_icon_theme_load_icon (icon_theme, "nm-vpn-lock", icon_size, 0, NULL);
-
-	applet->wireless_00_icon = gtk_icon_theme_load_icon (icon_theme, "nm-signal-00", icon_size, 0, NULL);
-	applet->wireless_25_icon = gtk_icon_theme_load_icon (icon_theme, "nm-signal-25", icon_size, 0, NULL);
-	applet->wireless_50_icon = gtk_icon_theme_load_icon (icon_theme, "nm-signal-50", icon_size, 0, NULL);
-	applet->wireless_75_icon = gtk_icon_theme_load_icon (icon_theme, "nm-signal-75", icon_size, 0, NULL);
-	applet->wireless_100_icon = gtk_icon_theme_load_icon (icon_theme, "nm-signal-100", icon_size, 0, NULL);
-
-	if (!applet->no_connection_icon || !applet->wired_icon || !applet->adhoc_icon || !applet->vpn_lock_icon
-		|| !applet->wireless_00_icon || !applet->wireless_25_icon || !applet->wireless_50_icon || !applet->wireless_75_icon
-		|| !applet->wireless_100_icon)
-		goto out;
+	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->vpn_lock_icon, "nm-vpn-lock");
+
+	ICON_LOAD(applet->wireless_00_icon, "nm-signal-00");
+	ICON_LOAD(applet->wireless_25_icon, "nm-signal-25");
+	ICON_LOAD(applet->wireless_50_icon, "nm-signal-50");
+	ICON_LOAD(applet->wireless_75_icon, "nm-signal-75");
+	ICON_LOAD(applet->wireless_100_icon, "nm-signal-100");
 
 	for (i = 0; i < NUM_PROGRESS_FRAMES; i++)
 	{
 		name = g_strdup_printf ("nm-progress%02d", i+1);
-		applet->progress_icons[i] = gtk_icon_theme_load_icon (icon_theme, name, icon_size, 0, NULL);
+		ICON_LOAD(applet->progress_icons[i], name);
 		g_free (name);
-		if (!applet->progress_icons[i])
-			goto out;
 	}
 
 	for (i = 0; i < NUM_WIRED_CONNECTING_FRAMES; i++)
 	{
 		name = g_strdup_printf ("nm-connecting%02d", i+1);
-		applet->wired_connecting_icons[i] = gtk_icon_theme_load_icon (icon_theme, name, icon_size, 0, NULL);
+		ICON_LOAD(applet->wired_connecting_icons[i], name);
 		g_free (name);
-		if (!applet->wired_connecting_icons[i])
-			goto out;
 	}
 
 	for (i = 0; i < NUM_WIRELESS_CONNECTING_FRAMES; i++)
 	{
 		name = g_strdup_printf ("nm-connecting%02d", i+1);
-		applet->wireless_connecting_icons[i] = gtk_icon_theme_load_icon (icon_theme, name, icon_size, 0, NULL);
+		ICON_LOAD(applet->wireless_connecting_icons[i], name);
 		g_free (name);
-		if (!applet->wireless_connecting_icons[i])
-			goto out;
 	}
 
 	success = TRUE;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]