NetworkManager r3430 - in trunk: . src



Author: dcbw
Date: Wed Mar 12 17:01:24 2008
New Revision: 3430
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3430&view=rev

Log:
2008-03-12  Dan Williams  <dcbw redhat com>

	* src/nm-properties-changed-signal.c
		- (add_to_string): better handling of NULL objects



Modified:
   trunk/ChangeLog
   trunk/src/nm-properties-changed-signal.c

Modified: trunk/src/nm-properties-changed-signal.c
==============================================================================
--- trunk/src/nm-properties-changed-signal.c	(original)
+++ trunk/src/nm-properties-changed-signal.c	Wed Mar 12 17:01:24 2008
@@ -55,9 +55,21 @@
 	GValue str_val = { 0, };
 
 	g_value_init (&str_val, G_TYPE_STRING);
-	g_value_transform ((GValue *) value, &str_val);
-
-	sprintf (buf + strlen (buf), "{%s: %s}, ", (const char *) key, g_value_get_string (&str_val));
+	if (!g_value_transform ((GValue *) value, &str_val)) {
+		if (G_VALUE_HOLDS_OBJECT (value)) {
+			GObject *obj = g_value_get_object (value);
+
+			if (g_value_get_object (value)) {
+				sprintf (buf + strlen (buf), "{%s: %p (%s)}, ",
+				         (const char *) key, obj, G_OBJECT_TYPE_NAME (obj));
+			} else {
+				sprintf (buf + strlen (buf), "{%s: %p}, ", (const char *) key, obj);
+			}
+		} else
+			sprintf (buf + strlen (buf), "{%s: <transform error>}, ", (const char *) key);
+	} else {
+		sprintf (buf + strlen (buf), "{%s: %s}, ", (const char *) key, g_value_get_string (&str_val));
+	}
 	g_value_unset (&str_val);
 }
 #endif



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