summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2009-02-27 13:18:57 +0000
committerRichard Hughes <richard@hughsie.com>2009-02-27 13:18:57 +0000
commit4fb78bb9f5b189780bda6f22ca53df6ec58b19bd (patch)
treec08e38d0238d544269b5eba5d4662ae9c1530b0d /tools
parent665523726ae43f08f2d5d9fe3ec9b327fe75c85d (diff)
trivial: add lots of GErrors to the gobject library, and avoid using egg_warning
Diffstat (limited to 'tools')
-rw-r--r--tools/dkp-tool.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/tools/dkp-tool.c b/tools/dkp-tool.c
index 72182e8..b399e9c 100644
--- a/tools/dkp-tool.c
+++ b/tools/dkp-tool.c
@@ -125,7 +125,7 @@ dkp_tool_do_monitor (DkpClient *client)
int
main (int argc, char **argv)
{
- gint ret = 1;
+ gint retval = 1;
guint i;
GOptionContext *context;
gboolean verbose = FALSE;
@@ -135,6 +135,8 @@ main (int argc, char **argv)
gboolean opt_monitor = FALSE;
gchar *opt_show_info = FALSE;
gboolean opt_version = FALSE;
+ gboolean ret;
+ GError *error = NULL;
DkpClient *client;
DkpDevice *device;
@@ -167,7 +169,7 @@ main (int argc, char **argv)
"DeviceKit-power daemon version %s\n",
PACKAGE_VERSION,
dkp_client_get_daemon_version (client));
- ret = 0;
+ retval = 0;
goto out;
}
@@ -191,7 +193,7 @@ main (int argc, char **argv)
g_ptr_array_free (array, TRUE);
} else if (opt_enumerate || opt_dump) {
GPtrArray *devices;
- devices = dkp_client_enumerate_devices (client);
+ devices = dkp_client_enumerate_devices (client, NULL);
if (devices == NULL)
goto out;
for (i=0; i < devices->len; i++) {
@@ -215,13 +217,19 @@ main (int argc, char **argv)
goto out;
} else if (opt_show_info != NULL) {
device = dkp_device_new ();
- dkp_device_set_object_path (device, opt_show_info);
- dkp_device_print (device);
+ ret = dkp_device_set_object_path (device, opt_show_info, &error);
+ if (!ret) {
+ g_print ("failed to set path: %s\n", error->message);
+ g_error_free (error);
+ } else {
+ dkp_device_print (device);
+ retval = 0;
+ }
g_object_unref (device);
}
- ret = 0;
+ retval = 0;
out:
g_object_unref (client);
- return ret;
+ return retval;
}