[gnome-color-manager] Show each device setting when we use gcm-inspect --dump



commit 7cbb2b0874e7b97951fe40683d182889a836eb86
Author: Richard Hughes <richard hughsie com>
Date:   Tue Mar 23 18:22:02 2010 +0000

    Show each device setting when we use gcm-inspect --dump

 src/gcm-inspect.c |   50 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 49 insertions(+), 1 deletions(-)
---
diff --git a/src/gcm-inspect.c b/src/gcm-inspect.c
index 36efe39..e6e8044 100644
--- a/src/gcm-inspect.c
+++ b/src/gcm-inspect.c
@@ -248,6 +248,52 @@ out:
 }
 
 /**
+ * gcm_inspect_show_profiles_for_devices:
+ **/
+static gboolean
+gcm_inspect_show_profiles_for_devices (void)
+{
+	gboolean ret;
+	DBusGConnection *connection;
+	DBusGProxy *proxy;
+	GError *error = NULL;
+	guint i;
+	gchar **devices = NULL;
+
+	/* get a session bus connection */
+	connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
+
+	/* connect to the interface */
+	proxy = dbus_g_proxy_new_for_name (connection,
+					   "org.gnome.ColorManager",
+					   "/org/gnome/ColorManager",
+					   "org.gnome.ColorManager");
+
+	/* execute sync method */
+	ret = dbus_g_proxy_call (proxy, "GetDevices", &error,
+				 G_TYPE_INVALID,
+				 G_TYPE_STRV, &devices,
+				 G_TYPE_INVALID);
+	if (!ret) {
+		/* TRANSLATORS: the DBus method failed */
+		g_print ("%s: %s\n", _("The request failed"), error->message);
+		g_error_free (error);
+		goto out;
+	}
+
+	/* print each device */
+	for (i=0; devices[i] != NULL; i++) {
+		ret = gcm_inspect_show_profiles_for_device (devices[i]);
+		if (!ret)
+			goto out;
+	}
+out:
+	g_object_unref (proxy);
+	g_strfreev (devices);
+	return ret;
+}
+
+/**
  * gcm_inspect_show_profile_for_window:
  **/
 static gboolean
@@ -515,8 +561,10 @@ main (int argc, char **argv)
 			gcm_inspect_show_profiles_for_type (type);
 		}
 	}
-	if (dump)
+	if (dump) {
 		gcm_inspect_get_properties ();
+		gcm_inspect_show_profiles_for_devices ();
+	}
 
 	g_free (device_id);
 	g_free (type);



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