[Xfce4-commits] r26788 - xfconf/trunk/xfconf-query
Stephan Arts
stephan at xfce.org
Mon Apr 7 22:30:43 CEST 2008
Author: stephan
Date: 2008-04-07 20:30:43 +0000 (Mon, 07 Apr 2008)
New Revision: 26788
Modified:
xfconf/trunk/xfconf-query/main.c
Log:
Add read-support to xfconf-query
Modified: xfconf/trunk/xfconf-query/main.c
===================================================================
--- xfconf/trunk/xfconf-query/main.c 2008-04-07 19:47:16 UTC (rev 26787)
+++ xfconf/trunk/xfconf-query/main.c 2008-04-07 20:30:43 UTC (rev 26788)
@@ -107,7 +107,43 @@
/** Check if the value is specified */
if(!value)
{
+ /**
+ * Read the property value
+ */
+ if (xfconf_channel_has_property(channel, property_name))
+ {
+ GValue tmp_value = {0, };
+ xfconf_channel_get_property(channel, property_name, &tmp_value);
+ GType prop_type = G_VALUE_TYPE(&tmp_value);
+ switch(prop_type)
+ {
+ case G_TYPE_INT:
+ {
+ gint val = g_value_get_int(&tmp_value);
+ g_print("%d\n", val);
+ }
+ break;
+ case G_TYPE_STRING:
+ {
+ const gchar *val = g_value_get_string(&tmp_value);
+ g_print("%s\n", val);
+ }
+ break;
+ case G_TYPE_BOOLEAN:
+ {
+ gboolean val = g_value_get_boolean(&tmp_value);
+ g_print("%d\n", val);
+ }
+ break;
+ }
+ g_value_unset(&tmp_value);
+ }
+ else
+ {
+ g_print("[ERROR] Property doesn't exist\n");
+ return 1;
+ }
}
else
{
More information about the Xfce4-commits
mailing list