[Xfce4-commits] r26850 - xfconf/trunk/xfconf-query
Stephan Arts
stephan at xfce.org
Thu Apr 17 08:13:53 CEST 2008
Author: stephan
Date: 2008-04-17 06:13:52 +0000 (Thu, 17 Apr 2008)
New Revision: 26850
Modified:
xfconf/trunk/xfconf-query/main.c
Log:
Add --remove field to xfconf-query (usefull for xfconfd-database maintenance)
Modified: xfconf/trunk/xfconf-query/main.c
===================================================================
--- xfconf/trunk/xfconf-query/main.c 2008-04-17 05:44:46 UTC (rev 26849)
+++ xfconf/trunk/xfconf-query/main.c 2008-04-17 06:13:52 UTC (rev 26850)
@@ -45,6 +45,7 @@
static gboolean list = FALSE;
static gboolean verbose = FALSE;
static gboolean create = FALSE;
+static gboolean remove = FALSE;
static gchar *channel_name = NULL;
static gchar *property_name = NULL;
static gchar **set_value = NULL;
@@ -114,13 +115,17 @@
NULL
},
{ "create", 'n', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &create,
- N_("Create if missing"),
+ N_("Create new entry"),
NULL
},
{ "type", 't', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING, &type,
N_("Specify the property value type"),
NULL
},
+ { "remove", 'r', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &remove,
+ N_("Remove property"),
+ NULL
+ },
{ NULL }
};
@@ -164,6 +169,12 @@
return 1;
}
+ if (create && remove)
+ {
+ g_print("--create and --remove options can not be used together,\naborting...\n");
+ return 1;
+ }
+
channel = xfconf_channel_new(channel_name);
if (property_name)
@@ -176,11 +187,18 @@
if(prop_exists)
xfconf_channel_get_property(channel, property_name, &value);
+ /** Remove property */
+ if (remove)
+ {
+ g_value_unset(&value);
+ xfconf_channel_remove_property(channel, property_name);
+ }
/** Read value */
- if(set_value == NULL)
+ else if(set_value == NULL)
{
const gchar *str_val = _xfconf_string_from_gvalue(&value);
g_print("%s\n", str_val);
+ g_value_unset(&value);
}
/* Write value */
else
@@ -207,8 +225,8 @@
{
g_print(_("ERROR: Could not convert value\n"));
}
+ g_value_unset(&value);
}
- g_value_unset(&value);
}
else
{
More information about the Xfce4-commits
mailing list