network-manager-applet r465 - in trunk: . src



Author: dcbw
Date: Mon Jan 21 01:05:29 2008
New Revision: 465
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=465&view=rev

Log:
2008-01-20  Dan Williams  <dcbw redhat com>

	* src/applet.c
		- (nma_menu_add_devices, foo_device_added_cb,
		   applet_get_device_icon_for_state,
		   applet_settings_new_secrets_requested_cb): handle unknown device
			types



Modified:
   trunk/ChangeLog
   trunk/src/applet.c

Modified: trunk/src/applet.c
==============================================================================
--- trunk/src/applet.c	(original)
+++ trunk/src/applet.c	Mon Jan 21 01:05:29 2008
@@ -571,8 +571,8 @@
 		active = find_active_connection_for_device (device, applet);
 
 		dclass = get_device_class (device, applet);
-		g_assert (dclass);
-		dclass->add_menu_item (device, n_devices, active, menu, applet);
+		if (dclass)
+			dclass->add_menu_item (device, n_devices, active, menu, applet);
 	}
 
 	if (n_wireless_interfaces > 0 && nm_client_wireless_get_enabled (applet->nm_client)) {
@@ -1047,7 +1047,7 @@
 	NMADeviceClass *dclass;
 
 	dclass = get_device_class (device, applet);
-	g_assert (dclass);
+	g_return_if_fail (dclass != NULL);
 
 	if (dclass->device_added)
 		dclass->device_added (device, applet);
@@ -1192,8 +1192,8 @@
 	state = nm_device_get_state (device);
 
 	dclass = get_device_class (device, applet);
-	g_assert (dclass);
-	pixbuf = dclass->get_icon (device, state, tip, applet);
+	if (dclass)
+		pixbuf = dclass->get_icon (device, state, tip, applet);
 
 out:
 	if (!pixbuf)
@@ -1385,7 +1385,12 @@
 	}
 
 	dclass = get_device_class (device, applet);
-	g_assert (dclass);
+	if (!dclass) {
+		g_set_error (&error, NM_SETTINGS_ERROR, 1,
+		             "%s.%d (%s): device type unknown",
+		             __FILE__, __LINE__, __func__);
+		goto error;
+	}
 
 	if (!dclass->get_secrets) {
 		g_set_error (&error, NM_SETTINGS_ERROR, 1,



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