diff options
-rw-r--r-- | devkit-power-gobject/Makefile.am | 7 | ||||
-rw-r--r-- | devkit-power-gobject/dkp-client.c | 17 | ||||
-rw-r--r-- | devkit-power-gobject/dkp-client.h | 3 | ||||
-rw-r--r-- | devkit-power-gobject/dkp-device.c | 113 | ||||
-rw-r--r-- | devkit-power-gobject/dkp-device.h | 13 | ||||
-rw-r--r-- | devkit-power-gobject/dkp-enum.c | 1 | ||||
-rw-r--r-- | devkit-power-gobject/dkp-history-obj.c | 3 | ||||
-rw-r--r-- | devkit-power-gobject/dkp-qos-obj.c | 2 | ||||
-rw-r--r-- | devkit-power-gobject/dkp-stats-obj.c | 3 | ||||
-rw-r--r-- | devkit-power-gobject/dkp-wakeups-obj.c | 1 | ||||
-rw-r--r-- | devkit-power-gobject/dkp-wakeups.c | 9 | ||||
l--------- | devkit-power-gobject/egg-debug.c | 1 | ||||
l--------- | devkit-power-gobject/egg-debug.h | 1 | ||||
-rw-r--r-- | tools/dkp-tool.c | 22 |
14 files changed, 103 insertions, 93 deletions
diff --git a/devkit-power-gobject/Makefile.am b/devkit-power-gobject/Makefile.am index 52011e7..4dc17af 100644 --- a/devkit-power-gobject/Makefile.am +++ b/devkit-power-gobject/Makefile.am @@ -4,10 +4,7 @@ INCLUDES = \ -I$(top_srcdir) \ -I$(top_srcdir)/devkit-power-gobject \ -DDKP_COMPILATION \ - -DEGG_LOG_FILE=\""$(DKP_LOG_DIR)/DeviceKit-power"\" \ - -DEGG_VERBOSE="\"DKP_VERBOSE\"" \ - -DEGG_LOGGING="\"DKP_LOGGING\"" \ - -DEGG_CONSOLE="\"DKP_CONSOLE\"" \ + -DG_LOG_DOMAIN=\"devkit-power-gobject\" \ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" @@ -26,8 +23,6 @@ libdevkit_power_include_HEADERS = \ dkp-enum.h libdevkit_power_gobject_la_SOURCES = \ - egg-debug.c \ - egg-debug.h \ devicekit-power.h \ dkp-client.c \ dkp-client.h \ diff --git a/devkit-power-gobject/dkp-client.c b/devkit-power-gobject/dkp-client.c index 91d4a09..e36f008 100644 --- a/devkit-power-gobject/dkp-client.c +++ b/devkit-power-gobject/dkp-client.c @@ -26,7 +26,6 @@ #include <glib.h> #include <dbus/dbus-glib.h> -#include "egg-debug.h" #include "dkp-client.h" #include "dkp-device.h" @@ -83,7 +82,7 @@ dkp_client_get_device (DkpClient *client, const gchar *object_path) * to be freed **/ GPtrArray * -dkp_client_enumerate_devices (DkpClient *client) +dkp_client_enumerate_devices (DkpClient *client, GError **error) { guint i; GPtrArray *array; @@ -115,7 +114,7 @@ dkp_client_enumerate_devices_private (DkpClient *client, GError **error) g_type_array, &devices, G_TYPE_INVALID); if (!ret) { - egg_warning ("Couldn't enumerate devices: %s", error_local->message); + g_warning ("Couldn't enumerate devices: %s", error_local->message); if (error != NULL) *error = g_error_new (1, 0, "%s", error_local->message); g_error_free (error_local); @@ -138,7 +137,7 @@ dkp_client_suspend (DkpClient *client, GError **error) ret = dbus_g_proxy_call (client->priv->proxy, "Suspend", &error_local, G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { - egg_warning ("Couldn't suspend: %s", error_local->message); + g_warning ("Couldn't suspend: %s", error_local->message); if (error != NULL) *error = g_error_new (1, 0, "%s", error_local->message); g_error_free (error_local); @@ -161,7 +160,7 @@ dkp_client_hibernate (DkpClient *client, GError **error) ret = dbus_g_proxy_call (client->priv->proxy, "Hibernate", &error_local, G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { - egg_warning ("Couldn't hibernate: %s", error_local->message); + g_warning ("Couldn't hibernate: %s", error_local->message); if (error != NULL) *error = g_error_new (1, 0, "%s", error_local->message); g_error_free (error_local); @@ -306,7 +305,7 @@ dkp_client_add (DkpClient *client, const gchar *object_path) /* create new device */ device = dkp_device_new (); - dkp_device_set_object_path (device, object_path); + dkp_device_set_object_path (device, object_path, NULL); g_ptr_array_add (client->priv->array, device); g_hash_table_insert (client->priv->hash, g_strdup (object_path), device); @@ -432,7 +431,7 @@ dkp_client_init (DkpClient *client) /* get on the bus */ client->priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); if (client->priv->bus == NULL) { - egg_warning ("Couldn't connect to system bus: %s", error->message); + g_warning ("Couldn't connect to system bus: %s", error->message); g_error_free (error); goto out; } @@ -443,7 +442,7 @@ dkp_client_init (DkpClient *client) "/org/freedesktop/DeviceKit/Power", "org.freedesktop.DeviceKit.Power"); if (client->priv->proxy == NULL) { - egg_warning ("Couldn't connect to proxy"); + g_warning ("Couldn't connect to proxy"); goto out; } @@ -452,7 +451,7 @@ dkp_client_init (DkpClient *client) "/org/freedesktop/DeviceKit/Power", "org.freedesktop.DBus.Properties"); if (client->priv->prop_proxy == NULL) { - egg_warning ("Couldn't connect to proxy"); + g_warning ("Couldn't connect to proxy"); goto out; } diff --git a/devkit-power-gobject/dkp-client.h b/devkit-power-gobject/dkp-client.h index 74a3bcb..bb65f40 100644 --- a/devkit-power-gobject/dkp-client.h +++ b/devkit-power-gobject/dkp-client.h @@ -73,7 +73,8 @@ typedef struct GType dkp_client_get_type (void); DkpClient *dkp_client_new (void); -GPtrArray *dkp_client_enumerate_devices (DkpClient *client); +GPtrArray *dkp_client_enumerate_devices (DkpClient *client, + GError **error); gboolean dkp_client_suspend (DkpClient *client, GError **error); gboolean dkp_client_hibernate (DkpClient *client, diff --git a/devkit-power-gobject/dkp-device.c b/devkit-power-gobject/dkp-device.c index c0e2ad2..31e5058 100644 --- a/devkit-power-gobject/dkp-device.c +++ b/devkit-power-gobject/dkp-device.c @@ -27,8 +27,6 @@ #include <dbus/dbus-glib.h> #include <string.h> -#include "egg-debug.h" - #include "dkp-device.h" #include "dkp-stats-obj.h" #include "dkp-history-obj.h" @@ -114,21 +112,22 @@ G_DEFINE_TYPE (DkpDevice, dkp_device, G_TYPE_OBJECT) * dkp_device_get_device_properties: **/ static GHashTable * -dkp_device_get_device_properties (DkpDevice *device) +dkp_device_get_device_properties (DkpDevice *device, GError **error) { gboolean ret; - GError *error = NULL; + GError *error_local = NULL; GHashTable *hash_table = NULL; - ret = dbus_g_proxy_call (device->priv->proxy_props, "GetAll", &error, + ret = dbus_g_proxy_call (device->priv->proxy_props, "GetAll", &error_local, G_TYPE_STRING, "org.freedesktop.DeviceKit.Power.Device", G_TYPE_INVALID, dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE), &hash_table, G_TYPE_INVALID); if (!ret) { - egg_debug ("Couldn't call GetAll() to get properties for %s: %s", device->priv->object_path, error->message); - g_error_free (error); + if (error != NULL) + *error = g_error_new (1, 0, "Couldn't call GetAll() to get properties for %s: %s", device->priv->object_path, error_local->message); + g_error_free (error_local); goto out; } out: @@ -141,8 +140,6 @@ out: static void dkp_device_collect_props_cb (const char *key, const GValue *value, DkpDevice *device) { - gboolean handled = TRUE; - if (g_strcmp0 (key, "native-path") == 0) device->priv->native_path = g_strdup (g_value_get_string (value)); else if (g_strcmp0 (key, "vendor") == 0) @@ -191,25 +188,27 @@ dkp_device_collect_props_cb (const char *key, const GValue *value, DkpDevice *de device->priv->capacity = g_value_get_double (value); else if (g_strcmp0 (key, "state") == 0) device->priv->state = g_value_get_uint (value); - else - handled = FALSE; - - if (!handled) - egg_warning ("unhandled property '%s'", key); + else { + g_warning ("unhandled property '%s'", key); + g_assert_not_reached (); + } } /** * dkp_device_refresh_internal: **/ static gboolean -dkp_device_refresh_internal (DkpDevice *device) +dkp_device_refresh_internal (DkpDevice *device, GError **error) { GHashTable *hash; + GError *error_local = NULL; /* get all the properties */ - hash = dkp_device_get_device_properties (device); + hash = dkp_device_get_device_properties (device, &error_local); if (hash == NULL) { - egg_warning ("Cannot get device properties for %s", device->priv->object_path); + if (error != NULL) + *error = g_error_new (1, 0, "Cannot get device properties for %s: %s", device->priv->object_path, error_local->message); + g_error_free (error_local); return FALSE; } g_hash_table_foreach (hash, (GHFunc) dkp_device_collect_props_cb, device); @@ -224,17 +223,17 @@ static void dkp_device_changed_cb (DBusGProxy *proxy, DkpDevice *device) { g_return_if_fail (DKP_IS_DEVICE (device)); - dkp_device_refresh_internal (device); - g_signal_emit (device, signals [DKP_DEVICE_CHANGED], 0, NULL); //TODO + dkp_device_refresh_internal (device, NULL); + g_signal_emit (device, signals [DKP_DEVICE_CHANGED], 0, NULL); //TODO xxx } /** * dkp_device_set_object_path: **/ gboolean -dkp_device_set_object_path (DkpDevice *device, const gchar *object_path) +dkp_device_set_object_path (DkpDevice *device, const gchar *object_path, GError **error) { - GError *error = NULL; + GError *error_local = NULL; gboolean ret = FALSE; DBusGProxy *proxy_device; DBusGProxy *proxy_props; @@ -247,10 +246,11 @@ dkp_device_set_object_path (DkpDevice *device, const gchar *object_path) return FALSE; /* connect to the bus */ - device->priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); + device->priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error_local); if (device->priv->bus == NULL) { - egg_warning ("Couldn't connect to system bus: %s", error->message); - g_error_free (error); + if (error != NULL) + *error = g_error_new (1, 0, "Couldn't connect to system bus: %s", error_local->message); + g_error_free (error_local); goto out; } @@ -258,7 +258,8 @@ dkp_device_set_object_path (DkpDevice *device, const gchar *object_path) proxy_props = dbus_g_proxy_new_for_name (device->priv->bus, "org.freedesktop.DeviceKit.Power", object_path, "org.freedesktop.DBus.Properties"); if (proxy_props == NULL) { - egg_warning ("Couldn't connect to proxy"); + if (error != NULL) + *error = g_error_new (1, 0, "Couldn't connect to proxy"); goto out; } @@ -266,7 +267,8 @@ dkp_device_set_object_path (DkpDevice *device, const gchar *object_path) proxy_device = dbus_g_proxy_new_for_name (device->priv->bus, "org.freedesktop.DeviceKit.Power", object_path, "org.freedesktop.DeviceKit.Power.Device"); if (proxy_device == NULL) { - egg_warning ("Couldn't connect to proxy"); + if (error != NULL) + *error = g_error_new (1, 0, "Couldn't connect to proxy"); goto out; } @@ -276,15 +278,17 @@ dkp_device_set_object_path (DkpDevice *device, const gchar *object_path) G_CALLBACK (dkp_device_changed_cb), device, NULL); /* yay */ - egg_debug ("using object_path: %s", object_path); device->priv->proxy_device = proxy_device; device->priv->proxy_props = proxy_props; device->priv->object_path = g_strdup (object_path); /* coldplug */ - ret = dkp_device_refresh_internal (device); - if (!ret) - egg_warning ("cannot refresh"); + ret = dkp_device_refresh_internal (device, &error_local); + if (!ret) { + if (error != NULL) + *error = g_error_new (1, 0, "cannot refresh: %s", error_local->message); + g_error_free (error_local); + } out: return ret; } @@ -311,7 +315,7 @@ dkp_device_print_history (const DkpDevice *device, const gchar *type) gboolean ret = FALSE; /* get a fair chunk of data */ - array = dkp_device_get_history (device, type, 120, 10); + array = dkp_device_get_history (device, type, 120, 10, NULL); if (array == NULL) goto out; @@ -452,20 +456,21 @@ dkp_device_print (const DkpDevice *device) * dkp_device_refresh: **/ gboolean -dkp_device_refresh (DkpDevice *device) +dkp_device_refresh (DkpDevice *device, GError **error) { - GError *error = NULL; + GError *error_local = NULL; gboolean ret; g_return_val_if_fail (DKP_IS_DEVICE (device), FALSE); g_return_val_if_fail (device->priv->proxy_device != NULL, FALSE); /* just refresh the device */ - ret = dbus_g_proxy_call (device->priv->proxy_device, "Refresh", &error, + ret = dbus_g_proxy_call (device->priv->proxy_device, "Refresh", &error_local, G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { - egg_debug ("Refresh() on %s failed: %s", device->priv->object_path, error->message); - g_error_free (error); + if (error != NULL) + *error = g_error_new (1, 0, "Refresh() on %s failed: %s", device->priv->object_path, error_local->message); + g_error_free (error_local); goto out; } out: @@ -478,9 +483,9 @@ out: * Returns an array of %DkpHistoryObj's **/ GPtrArray * -dkp_device_get_history (const DkpDevice *device, const gchar *type, guint timespec, guint resolution) +dkp_device_get_history (const DkpDevice *device, const gchar *type, guint timespec, guint resolution, GError **error) { - GError *error = NULL; + GError *error_local = NULL; GType g_type_gvalue_array; GPtrArray *gvalue_ptr_array = NULL; GValueArray *gva; @@ -501,7 +506,7 @@ dkp_device_get_history (const DkpDevice *device, const gchar *type, guint timesp G_TYPE_INVALID)); /* get compound data */ - ret = dbus_g_proxy_call (device->priv->proxy_device, "GetHistory", &error, + ret = dbus_g_proxy_call (device->priv->proxy_device, "GetHistory", &error_local, G_TYPE_STRING, type, G_TYPE_UINT, timespec, G_TYPE_UINT, resolution, @@ -509,15 +514,19 @@ dkp_device_get_history (const DkpDevice *device, const gchar *type, guint timesp g_type_gvalue_array, &gvalue_ptr_array, G_TYPE_INVALID); if (!ret) { - egg_debug ("GetHistory(%s,%i) on %s failed: %s", type, timespec, - device->priv->object_path, error->message); - g_error_free (error); + if (error != NULL) + *error = g_error_new (1, 0, "GetHistory(%s,%i) on %s failed: %s", type, timespec, + device->priv->object_path, error_local->message); + g_error_free (error_local); goto out; } /* no data */ - if (gvalue_ptr_array->len == 0) + if (gvalue_ptr_array->len == 0) { + if (error != NULL) + *error = g_error_new (1, 0, "no data"); goto out; + } /* convert */ array = g_ptr_array_new (); @@ -553,9 +562,9 @@ out: * Returns an array of %DkpStatsObj's **/ GPtrArray * -dkp_device_get_statistics (const DkpDevice *device, const gchar *type) +dkp_device_get_statistics (const DkpDevice *device, const gchar *type, GError **error) { - GError *error = NULL; + GError *error_local = NULL; GType g_type_gvalue_array; GPtrArray *gvalue_ptr_array = NULL; GValueArray *gva; @@ -575,21 +584,25 @@ dkp_device_get_statistics (const DkpDevice *device, const gchar *type) G_TYPE_INVALID)); /* get compound data */ - ret = dbus_g_proxy_call (device->priv->proxy_device, "GetStatistics", &error, + ret = dbus_g_proxy_call (device->priv->proxy_device, "GetStatistics", &error_local, G_TYPE_STRING, type, G_TYPE_INVALID, g_type_gvalue_array, &gvalue_ptr_array, G_TYPE_INVALID); if (!ret) { - egg_debug ("GetStatistics(%s) on %s failed: %s", type, - device->priv->object_path, error->message); - g_error_free (error); + if (error != NULL) + *error = g_error_new (1, 0, "GetStatistics(%s) on %s failed: %s", type, + device->priv->object_path, error_local->message); + g_error_free (error_local); goto out; } /* no data */ - if (gvalue_ptr_array->len == 0) + if (gvalue_ptr_array->len == 0) { + if (error != NULL) + *error = g_error_new (1, 0, "no data"); goto out; + } /* convert */ array = g_ptr_array_new (); diff --git a/devkit-power-gobject/dkp-device.h b/devkit-power-gobject/dkp-device.h index 8ad219c..a7956b9 100644 --- a/devkit-power-gobject/dkp-device.h +++ b/devkit-power-gobject/dkp-device.h @@ -70,16 +70,19 @@ DkpDevice *dkp_device_new (void); const gchar *dkp_device_get_object_path (const DkpDevice *device); gboolean dkp_device_set_object_path (DkpDevice *device, - const gchar *object_path); - + const gchar *object_path, + GError **error); gboolean dkp_device_print (const DkpDevice *device); -gboolean dkp_device_refresh (DkpDevice *device); +gboolean dkp_device_refresh (DkpDevice *device, + GError **error); GPtrArray *dkp_device_get_history (const DkpDevice *device, const gchar *type, guint timespec, - guint resolution); + guint resolution, + GError **error); GPtrArray *dkp_device_get_statistics (const DkpDevice *device, - const gchar *type); + const gchar *type, + GError **error); G_END_DECLS diff --git a/devkit-power-gobject/dkp-enum.c b/devkit-power-gobject/dkp-enum.c index f2954f1..0db6662 100644 --- a/devkit-power-gobject/dkp-enum.c +++ b/devkit-power-gobject/dkp-enum.c @@ -21,7 +21,6 @@ #include <glib.h> #include <string.h> -#include "egg-debug.h" #include "dkp-enum.h" diff --git a/devkit-power-gobject/dkp-history-obj.c b/devkit-power-gobject/dkp-history-obj.c index 5727cb9..33a56a7 100644 --- a/devkit-power-gobject/dkp-history-obj.c +++ b/devkit-power-gobject/dkp-history-obj.c @@ -23,7 +23,6 @@ #include <string.h> #include <stdlib.h> -#include "egg-debug.h" #include "dkp-enum.h" #include "dkp-history-obj.h" @@ -146,7 +145,7 @@ dkp_history_obj_from_string (const gchar *text) parts = g_strsplit (text, "\t", 0); length = g_strv_length (parts); if (length != 3) { - egg_warning ("invalid string: '%s'", text); + g_warning ("invalid string: '%s'", text); goto out; } diff --git a/devkit-power-gobject/dkp-qos-obj.c b/devkit-power-gobject/dkp-qos-obj.c index 914c144..82fa16c 100644 --- a/devkit-power-gobject/dkp-qos-obj.c +++ b/devkit-power-gobject/dkp-qos-obj.c @@ -23,8 +23,6 @@ #include <string.h> #include <stdlib.h> -#include "egg-debug.h" - #include "dkp-enum.h" #include "dkp-qos-obj.h" diff --git a/devkit-power-gobject/dkp-stats-obj.c b/devkit-power-gobject/dkp-stats-obj.c index dbb3841..7818f29 100644 --- a/devkit-power-gobject/dkp-stats-obj.c +++ b/devkit-power-gobject/dkp-stats-obj.c @@ -23,7 +23,6 @@ #include <string.h> #include <stdlib.h> -#include "egg-debug.h" #include "dkp-stats-obj.h" /** @@ -94,7 +93,7 @@ dkp_stats_obj_from_string (const gchar *text) parts = g_strsplit (text, "\t", 0); length = g_strv_length (parts); if (length != 2) { - egg_warning ("invalid string: '%s'", text); + g_warning ("invalid string: '%s'", text); goto out; } diff --git a/devkit-power-gobject/dkp-wakeups-obj.c b/devkit-power-gobject/dkp-wakeups-obj.c index fcbaa94..a20c800 100644 --- a/devkit-power-gobject/dkp-wakeups-obj.c +++ b/devkit-power-gobject/dkp-wakeups-obj.c @@ -23,7 +23,6 @@ #include <string.h> #include <stdlib.h> -#include "egg-debug.h" #include "dkp-enum.h" #include "dkp-wakeups-obj.h" diff --git a/devkit-power-gobject/dkp-wakeups.c b/devkit-power-gobject/dkp-wakeups.c index de48ac8..4c39c25 100644 --- a/devkit-power-gobject/dkp-wakeups.c +++ b/devkit-power-gobject/dkp-wakeups.c @@ -26,7 +26,6 @@ #include <glib.h> #include <dbus/dbus-glib.h> -#include "egg-debug.h" #include "dkp-wakeups.h" static void dkp_wakeups_class_init (DkpWakeupsClass *klass); @@ -69,7 +68,7 @@ dkp_wakeups_get_total (DkpWakeups *wakeups, GError **error) G_TYPE_UINT, &total, G_TYPE_INVALID); if (!ret) { - egg_warning ("Couldn't get total: %s", error_local->message); + g_warning ("Couldn't get total: %s", error_local->message); if (error != NULL) *error = g_error_new (1, 0, "%s", error_local->message); g_error_free (error_local); @@ -113,7 +112,7 @@ dkp_wakeups_get_data (DkpWakeups *wakeups, GError **error) g_type_gvalue_array, &gvalue_ptr_array, G_TYPE_INVALID); if (!ret) { - egg_debug ("GetData on failed: %s", error_local->message); + g_warning ("GetData on failed: %s", error_local->message); if (error != NULL) *error = g_error_new (1, 0, "%s", error_local->message); g_error_free (error_local); @@ -223,7 +222,7 @@ dkp_wakeups_init (DkpWakeups *wakeups) /* get on the bus */ wakeups->priv->bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); if (wakeups->priv->bus == NULL) { - egg_warning ("Couldn't connect to system bus: %s", error->message); + g_warning ("Couldn't connect to system bus: %s", error->message); g_error_free (error); goto out; } @@ -234,7 +233,7 @@ dkp_wakeups_init (DkpWakeups *wakeups) "/org/freedesktop/DeviceKit/Power/Wakeups", "org.freedesktop.DeviceKit.Power.Wakeups"); if (wakeups->priv->proxy == NULL) { - egg_warning ("Couldn't connect to proxy"); + g_warning ("Couldn't connect to proxy"); goto out; } dbus_g_proxy_add_signal (wakeups->priv->proxy, "TotalChanged", G_TYPE_UINT, G_TYPE_INVALID); diff --git a/devkit-power-gobject/egg-debug.c b/devkit-power-gobject/egg-debug.c deleted file mode 120000 index 0a3eb62..0000000 --- a/devkit-power-gobject/egg-debug.c +++ /dev/null @@ -1 +0,0 @@ -../src/egg-debug.c
\ No newline at end of file diff --git a/devkit-power-gobject/egg-debug.h b/devkit-power-gobject/egg-debug.h deleted file mode 120000 index db811d2..0000000 --- a/devkit-power-gobject/egg-debug.h +++ /dev/null @@ -1 +0,0 @@ -../src/egg-debug.h
\ No newline at end of file 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; } |