diff options
author | Richard Hughes <richard@hughsie.com> | 2010-01-18 12:35:47 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2010-01-18 12:35:47 +0000 |
commit | d2550b4c7854e970719b07b48ecdb61af9c01b6f (patch) | |
tree | 59ba56384fee7aaf7a25857556a6a3dec87c8758 | |
parent | 2562bc6aa6fe9b5f422e01c92aef9745bed5204f (diff) |
trivial: DkpDaemon -> UpDaemon (no ABI or API break)
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/dummy/up-backend.c | 8 | ||||
-rw-r--r-- | src/freebsd/up-backend.c | 8 | ||||
-rw-r--r-- | src/linux/up-backend.c | 8 | ||||
-rw-r--r-- | src/linux/up-device-supply.c | 4 | ||||
-rw-r--r-- | src/linux/up-input.c | 4 | ||||
-rw-r--r-- | src/linux/up-input.h | 2 | ||||
-rw-r--r-- | src/up-backend.h | 4 | ||||
-rw-r--r-- | src/up-daemon.c | 276 | ||||
-rw-r--r-- | src/up-daemon.h | 70 | ||||
-rw-r--r-- | src/up-device.c | 18 | ||||
-rw-r--r-- | src/up-device.h | 4 | ||||
-rw-r--r-- | src/up-main.c | 6 | ||||
-rw-r--r-- | src/up-polkit.c | 4 | ||||
-rw-r--r-- | src/up-qos.c | 18 | ||||
-rw-r--r-- | src/up-self-test.c | 2 | ||||
-rw-r--r-- | src/up-wakeups.c | 6 |
17 files changed, 222 insertions, 222 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 535af27..315b2d6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -45,7 +45,7 @@ up-marshal.c: up-marshal.list echo "#include \"up-marshal.h\"" > $@ && glib-genmarshal $< --prefix=dkp_marshal --body >> $@ up-daemon-glue.h: org.freedesktop.DeviceKit.Power.xml Makefile.am - dbus-binding-tool --prefix=dkp_daemon --mode=glib-server --output=up-daemon-glue.h org.freedesktop.DeviceKit.Power.xml + dbus-binding-tool --prefix=up_daemon --mode=glib-server --output=up-daemon-glue.h org.freedesktop.DeviceKit.Power.xml up-device-glue.h: org.freedesktop.DeviceKit.Power.Device.xml Makefile.am dbus-binding-tool --prefix=dkp_device --mode=glib-server --output=up-device-glue.h org.freedesktop.DeviceKit.Power.Device.xml diff --git a/src/dummy/up-backend.c b/src/dummy/up-backend.c index 1253c40..23e063c 100644 --- a/src/dummy/up-backend.c +++ b/src/dummy/up-backend.c @@ -42,7 +42,7 @@ static void up_backend_finalize (GObject *object); struct UpBackendPrivate { - DkpDaemon *daemon; + UpDaemon *daemon; DkpDevice *device; DkpDeviceList *device_list; /* unused */ GObject *native; @@ -103,7 +103,7 @@ out: /** * up_backend_coldplug: * @backend: The %UpBackend class instance - * @daemon: The %DkpDaemon controlling instance + * @daemon: The %UpDaemon controlling instance * * Finds all the devices already plugged in, and emits device-add signals for * each of them. @@ -111,10 +111,10 @@ out: * Return value: %TRUE for success **/ gboolean -up_backend_coldplug (UpBackend *backend, DkpDaemon *daemon) +up_backend_coldplug (UpBackend *backend, UpDaemon *daemon) { backend->priv->daemon = g_object_ref (daemon); - backend->priv->device_list = dkp_daemon_get_device_list (daemon); + backend->priv->device_list = up_daemon_get_device_list (daemon); /* small delay until first device is added */ g_timeout_add_seconds (1, (GSourceFunc) up_backend_add_cb, backend); diff --git a/src/freebsd/up-backend.c b/src/freebsd/up-backend.c index 382521a..18efb45 100644 --- a/src/freebsd/up-backend.c +++ b/src/freebsd/up-backend.c @@ -63,7 +63,7 @@ static gboolean up_backend_supports_sleep_state (const gchar *state); struct UpBackendPrivate { - DkpDaemon *daemon; + UpDaemon *daemon; DkpDeviceList *device_list; GHashTable *handle_map; guint poll_timer_id; @@ -239,7 +239,7 @@ up_backend_lid_coldplug (UpBackend *backend) /** * up_backend_coldplug: * @backend: The %UpBackend class instance - * @daemon: The %DkpDaemon controlling instance + * @daemon: The %UpDaemon controlling instance * * Finds all the devices already plugged in, and emits device-add signals for * each of them. @@ -247,13 +247,13 @@ up_backend_lid_coldplug (UpBackend *backend) * Return value: %TRUE for success **/ gboolean -up_backend_coldplug (UpBackend *backend, DkpDaemon *daemon) +up_backend_coldplug (UpBackend *backend, UpDaemon *daemon) { DkpAcpiNative *acnative; int i; backend->priv->daemon = g_object_ref (daemon); - backend->priv->device_list = dkp_daemon_get_device_list (daemon); + backend->priv->device_list = up_daemon_get_device_list (daemon); for (i = 0; i < (int) G_N_ELEMENTS (handlers); i++) { int j; diff --git a/src/linux/up-backend.c b/src/linux/up-backend.c index 2b0c814..0d14aee 100644 --- a/src/linux/up-backend.c +++ b/src/linux/up-backend.c @@ -49,7 +49,7 @@ static void up_backend_finalize (GObject *object); struct UpBackendPrivate { - DkpDaemon *daemon; + UpDaemon *daemon; DkpDeviceList *device_list; GUdevClient *gudev_client; DkpDeviceList *managed_devices; @@ -270,7 +270,7 @@ up_backend_uevent_signal_handler_cb (GUdevClient *client, const gchar *action, /** * up_backend_coldplug: * @backend: The %UpBackend class instance - * @daemon: The %DkpDaemon controlling instance + * @daemon: The %UpDaemon controlling instance * * Finds all the devices already plugged in, and emits device-add signals for * each of them. @@ -278,7 +278,7 @@ up_backend_uevent_signal_handler_cb (GUdevClient *client, const gchar *action, * Return value: %TRUE for success **/ gboolean -up_backend_coldplug (UpBackend *backend, DkpDaemon *daemon) +up_backend_coldplug (UpBackend *backend, UpDaemon *daemon) { GUdevDevice *native; GList *devices; @@ -287,7 +287,7 @@ up_backend_coldplug (UpBackend *backend, DkpDaemon *daemon) const gchar *subsystems[] = {"power_supply", "usb", "tty", "input", NULL}; backend->priv->daemon = g_object_ref (daemon); - backend->priv->device_list = dkp_daemon_get_device_list (daemon); + backend->priv->device_list = up_daemon_get_device_list (daemon); backend->priv->gudev_client = g_udev_client_new (subsystems); g_signal_connect (backend->priv->gudev_client, "uevent", G_CALLBACK (up_backend_uevent_signal_handler_cb), backend); diff --git a/src/linux/up-device-supply.c b/src/linux/up-device-supply.c index c7ca2e1..cd7c6cb 100644 --- a/src/linux/up-device-supply.c +++ b/src/linux/up-device-supply.c @@ -404,7 +404,7 @@ dkp_device_supply_refresh_battery (DkpDeviceSupply *supply) gboolean recall_notice; const gchar *recall_vendor = NULL; const gchar *recall_url = NULL; - DkpDaemon *daemon; + UpDaemon *daemon; gboolean on_battery; guint battery_count; @@ -600,7 +600,7 @@ dkp_device_supply_refresh_battery (DkpDeviceSupply *supply) NULL); /* only guess when we have more than one battery devices */ - battery_count = dkp_daemon_get_number_devices_of_type (daemon, DKP_DEVICE_TYPE_BATTERY); + battery_count = up_daemon_get_number_devices_of_type (daemon, DKP_DEVICE_TYPE_BATTERY); /* try to find a suitable icon depending on AC state */ if (battery_count > 1) { diff --git a/src/linux/up-input.c b/src/linux/up-input.c index 78194d6..c07d1dd 100644 --- a/src/linux/up-input.c +++ b/src/linux/up-input.c @@ -53,7 +53,7 @@ struct DkpInputPrivate struct input_event event; gsize offset; GIOChannel *channel; - DkpDaemon *daemon; + UpDaemon *daemon; }; G_DEFINE_TYPE (DkpInput, dkp_input, G_TYPE_OBJECT) @@ -164,7 +164,7 @@ out: * dkp_input_coldplug: **/ gboolean -dkp_input_coldplug (DkpInput *input, DkpDaemon *daemon, GUdevDevice *d) +dkp_input_coldplug (DkpInput *input, UpDaemon *daemon, GUdevDevice *d) { gboolean ret = FALSE; gchar *path; diff --git a/src/linux/up-input.h b/src/linux/up-input.h index c064d8f..3b7ee87 100644 --- a/src/linux/up-input.h +++ b/src/linux/up-input.h @@ -50,7 +50,7 @@ typedef struct GType dkp_input_get_type (void); DkpInput *dkp_input_new (void); gboolean dkp_input_coldplug (DkpInput *input, - DkpDaemon *daemon, + UpDaemon *daemon, GUdevDevice *d); G_END_DECLS diff --git a/src/up-backend.h b/src/up-backend.h index d413bb4..4d3aecd 100644 --- a/src/up-backend.h +++ b/src/up-backend.h @@ -23,8 +23,8 @@ #define __UP_BACKEND_H #include <glib-object.h> -#include <dkp-enum.h> +#include "up-enum.h" #include "up-device.h" #include "up-daemon.h" @@ -66,7 +66,7 @@ UpBackend *up_backend_new (void); void up_backend_test (gpointer user_data); gboolean up_backend_coldplug (UpBackend *backend, - DkpDaemon *daemon); + UpDaemon *daemon); G_END_DECLS diff --git a/src/up-daemon.c b/src/up-daemon.c index 8c4c351..d3f59d5 100644 --- a/src/up-daemon.c +++ b/src/up-daemon.c @@ -67,7 +67,7 @@ enum static guint signals[SIGNAL_LAST] = { 0 }; -struct DkpDaemonPrivate +struct UpDaemonPrivate { DBusGConnection *connection; DBusGProxy *proxy; @@ -87,27 +87,27 @@ struct DkpDaemonPrivate guint battery_poll_count; }; -static void dkp_daemon_finalize (GObject *object); -static gboolean dkp_daemon_get_on_battery_local (DkpDaemon *daemon); -static gboolean dkp_daemon_get_on_low_battery_local (DkpDaemon *daemon); -static gboolean dkp_daemon_get_on_ac_local (DkpDaemon *daemon); +static void up_daemon_finalize (GObject *object); +static gboolean up_daemon_get_on_battery_local (UpDaemon *daemon); +static gboolean up_daemon_get_on_low_battery_local (UpDaemon *daemon); +static gboolean up_daemon_get_on_ac_local (UpDaemon *daemon); -G_DEFINE_TYPE (DkpDaemon, dkp_daemon, G_TYPE_OBJECT) +G_DEFINE_TYPE (UpDaemon, up_daemon, G_TYPE_OBJECT) -#define DKP_DAEMON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DKP_TYPE_DAEMON, DkpDaemonPrivate)) +#define UP_DAEMON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DAEMON, UpDaemonPrivate)) /* if using more memory compared to usable swap, disable hibernate */ -#define DKP_DAEMON_SWAP_WATERLINE 80.0f /* % */ +#define UP_DAEMON_SWAP_WATERLINE 80.0f /* % */ /* refresh all the devices after this much time when on-battery has changed */ -#define DKP_DAEMON_ON_BATTERY_REFRESH_DEVICES_DELAY 1 /* seconds */ -#define DKP_DAEMON_POLL_BATTERY_NUMBER_TIMES 5 +#define UP_DAEMON_ON_BATTERY_REFRESH_DEVICES_DELAY 1 /* seconds */ +#define UP_DAEMON_POLL_BATTERY_NUMBER_TIMES 5 /** - * dkp_daemon_check_sleep_states: + * up_daemon_check_sleep_states: **/ static gboolean -dkp_daemon_check_sleep_states (DkpDaemon *daemon) +up_daemon_check_sleep_states (UpDaemon *daemon) { gchar *contents = NULL; GError *error = NULL; @@ -131,7 +131,7 @@ out: } /** - * dkp_daemon_check_encrypted_swap: + * up_daemon_check_encrypted_swap: * * user@local:~$ cat /proc/swaps * Filename Type Size Used Priority @@ -144,7 +144,7 @@ out: * Loop over the swap partitions in /proc/swaps, looking for matches in /etc/crypttab **/ static gboolean -dkp_daemon_check_encrypted_swap (DkpDaemon *daemon) +up_daemon_check_encrypted_swap (UpDaemon *daemon) { gchar *contents_swaps = NULL; gchar *contents_crypttab = NULL; @@ -238,10 +238,10 @@ out: } /** - * dkp_daemon_check_swap_space: + * up_daemon_check_swap_space: **/ static gfloat -dkp_daemon_check_swap_space (DkpDaemon *daemon) +up_daemon_check_swap_space (UpDaemon *daemon) { gchar *contents = NULL; gchar **lines = NULL; @@ -298,12 +298,12 @@ out: } /** - * dkp_daemon_get_on_battery_local: + * up_daemon_get_on_battery_local: * * As soon as _any_ battery goes discharging, this is true **/ static gboolean -dkp_daemon_get_on_battery_local (DkpDaemon *daemon) +up_daemon_get_on_battery_local (UpDaemon *daemon) { guint i; gboolean ret; @@ -327,10 +327,10 @@ dkp_daemon_get_on_battery_local (DkpDaemon *daemon) } /** - * dkp_daemon_get_number_devices_of_type: + * up_daemon_get_number_devices_of_type: **/ guint -dkp_daemon_get_number_devices_of_type (DkpDaemon *daemon, DkpDeviceType type) +up_daemon_get_number_devices_of_type (UpDaemon *daemon, DkpDeviceType type) { guint i; DkpDevice *device; @@ -353,12 +353,12 @@ dkp_daemon_get_number_devices_of_type (DkpDaemon *daemon, DkpDeviceType type) } /** - * dkp_daemon_get_on_low_battery_local: + * up_daemon_get_on_low_battery_local: * * As soon as _all_ batteries are low, this is true **/ static gboolean -dkp_daemon_get_on_low_battery_local (DkpDaemon *daemon) +up_daemon_get_on_low_battery_local (UpDaemon *daemon) { guint i; gboolean ret; @@ -382,12 +382,12 @@ dkp_daemon_get_on_low_battery_local (DkpDaemon *daemon) } /** - * dkp_daemon_get_on_ac_local: + * up_daemon_get_on_ac_local: * * As soon as _any_ ac supply goes online, this is true **/ static gboolean -dkp_daemon_get_on_ac_local (DkpDaemon *daemon) +up_daemon_get_on_ac_local (UpDaemon *daemon) { guint i; gboolean ret; @@ -411,12 +411,12 @@ dkp_daemon_get_on_ac_local (DkpDaemon *daemon) } /** - * dkp_daemon_set_pmutils_powersave: + * up_daemon_set_pmutils_powersave: * * Uses pm-utils to run scripts in power.d **/ static gboolean -dkp_daemon_set_pmutils_powersave (DkpDaemon *daemon, gboolean powersave) +up_daemon_set_pmutils_powersave (UpDaemon *daemon, gboolean powersave) { gboolean ret; gchar *command; @@ -437,10 +437,10 @@ out: } /** - * dkp_daemon_refresh_battery_devices: + * up_daemon_refresh_battery_devices: **/ static gboolean -dkp_daemon_refresh_battery_devices (DkpDaemon *daemon) +up_daemon_refresh_battery_devices (UpDaemon *daemon) { guint i; GPtrArray *array; @@ -464,10 +464,10 @@ dkp_daemon_refresh_battery_devices (DkpDaemon *daemon) } /** - * dkp_daemon_enumerate_devices: + * up_daemon_enumerate_devices: **/ gboolean -dkp_daemon_enumerate_devices (DkpDaemon *daemon, DBusGMethodInvocation *context) +up_daemon_enumerate_devices (UpDaemon *daemon, DBusGMethodInvocation *context) { guint i; GPtrArray *array; @@ -492,10 +492,10 @@ dkp_daemon_enumerate_devices (DkpDaemon *daemon, DBusGMethodInvocation *context) } /** - * dkp_daemon_suspend: + * up_daemon_suspend: **/ gboolean -dkp_daemon_suspend (DkpDaemon *daemon, DBusGMethodInvocation *context) +up_daemon_suspend (UpDaemon *daemon, DBusGMethodInvocation *context) { gboolean ret; GError *error; @@ -506,8 +506,8 @@ dkp_daemon_suspend (DkpDaemon *daemon, DBusGMethodInvocation *context) /* no kernel support */ if (!daemon->priv->kernel_can_suspend) { - error = g_error_new (DKP_DAEMON_ERROR, - DKP_DAEMON_ERROR_GENERAL, + error = g_error_new (UP_DAEMON_ERROR, + UP_DAEMON_ERROR_GENERAL, "No kernel support"); g_error_free (error_local); dbus_g_method_return_error (context, error); @@ -523,8 +523,8 @@ dkp_daemon_suspend (DkpDaemon *daemon, DBusGMethodInvocation *context) ret = g_spawn_command_line_sync ("/usr/sbin/pm-suspend", &stdout, &stderr, NULL, &error_local); if (!ret) { - error = g_error_new (DKP_DAEMON_ERROR, - DKP_DAEMON_ERROR_GENERAL, + error = g_error_new (UP_DAEMON_ERROR, + UP_DAEMON_ERROR_GENERAL, "Failed to spawn: %s, stdout:%s, stderr:%s", error_local->message, stdout, stderr); g_error_free (error_local); dbus_g_method_return_error (context, error); @@ -540,10 +540,10 @@ out: } /** - * dkp_daemon_hibernate: + * up_daemon_hibernate: **/ gboolean -dkp_daemon_hibernate (DkpDaemon *daemon, DBusGMethodInvocation *context) +up_daemon_hibernate (UpDaemon *daemon, DBusGMethodInvocation *context) { gboolean ret; GError *error; @@ -554,8 +554,8 @@ dkp_daemon_hibernate (DkpDaemon *daemon, DBusGMethodInvocation *context) /* no kernel support */ if (!daemon->priv->kernel_can_hibernate) { - error = g_error_new (DKP_DAEMON_ERROR, - DKP_DAEMON_ERROR_GENERAL, + error = g_error_new (UP_DAEMON_ERROR, + UP_DAEMON_ERROR_GENERAL, "No kernel support"); g_error_free (error_local); dbus_g_method_return_error (context, error); @@ -564,8 +564,8 @@ dkp_daemon_hibernate (DkpDaemon *daemon, DBusGMethodInvocation *context) /* enough swap? */ if (!daemon->priv->hibernate_has_swap_space) { - error = g_error_new (DKP_DAEMON_ERROR, - DKP_DAEMON_ERROR_GENERAL, + error = g_error_new (UP_DAEMON_ERROR, + UP_DAEMON_ERROR_GENERAL, "Not enough swap space"); g_error_free (error_local); dbus_g_method_return_error (context, error); @@ -574,8 +574,8 @@ dkp_daemon_hibernate (DkpDaemon *daemon, DBusGMethodInvocation *context) /* encrypted swap? */ if (daemon->priv->hibernate_has_encrypted_swap) { - error = g_error_new (DKP_DAEMON_ERROR, - DKP_DAEMON_ERROR_GENERAL, + error = g_error_new (UP_DAEMON_ERROR, + UP_DAEMON_ERROR_GENERAL, "Swap space is encrypted"); g_error_free (error_local); dbus_g_method_return_error (context, error); @@ -591,8 +591,8 @@ dkp_daemon_hibernate (DkpDaemon *daemon, DBusGMethodInvocation *context) ret = g_spawn_command_line_sync ("/usr/sbin/pm-hibernate", &stdout, &stderr, NULL, &error_local); if (!ret) { - error = g_error_new (DKP_DAEMON_ERROR, - DKP_DAEMON_ERROR_GENERAL, + error = g_error_new (UP_DAEMON_ERROR, + UP_DAEMON_ERROR_GENERAL, "Failed to spawn: %s, stdout:%s, stderr:%s", error_local->message, stdout, stderr); g_error_free (error_local); dbus_g_method_return_error (context, error); @@ -608,10 +608,10 @@ out: } /** - * dkp_daemon_register_power_daemon: + * up_daemon_register_power_daemon: **/ static gboolean -dkp_daemon_register_power_daemon (DkpDaemon *daemon) +up_daemon_register_power_daemon (UpDaemon *daemon) { GError *error = NULL; gboolean ret = FALSE; @@ -643,17 +643,17 @@ out: } /** - * dkp_daemon_startup: + * up_daemon_startup: **/ gboolean -dkp_daemon_startup (DkpDaemon *daemon) +up_daemon_startup (UpDaemon *daemon) { gboolean ret; gboolean on_battery; gboolean on_low_battery; /* register on bus */ - ret = dkp_daemon_register_power_daemon (daemon); + ret = up_daemon_register_power_daemon (daemon); if (!ret) { egg_warning ("failed to register"); goto out; @@ -672,9 +672,9 @@ dkp_daemon_startup (DkpDaemon *daemon) } /* get battery state */ - on_battery = (dkp_daemon_get_on_battery_local (daemon) && - !dkp_daemon_get_on_ac_local (daemon)); - on_low_battery = dkp_daemon_get_on_low_battery_local (daemon); + on_battery = (up_daemon_get_on_battery_local (daemon) && + !up_daemon_get_on_ac_local (daemon)); + on_low_battery = up_daemon_get_on_low_battery_local (daemon); g_object_set (daemon, "on-battery", on_battery, "on-low-battery", on_low_battery, @@ -686,25 +686,25 @@ dkp_daemon_startup (DkpDaemon *daemon) egg_debug ("daemon now not coldplug"); /* set pm-utils power policy */ - dkp_daemon_set_pmutils_powersave (daemon, daemon->priv->on_battery); + up_daemon_set_pmutils_powersave (daemon, daemon->priv->on_battery); out: return ret; } /** - * dkp_daemon_get_device_list: + * up_daemon_get_device_list: **/ DkpDeviceList * -dkp_daemon_get_device_list (DkpDaemon *daemon) +up_daemon_get_device_list (UpDaemon *daemon) { return g_object_ref (daemon->priv->power_devices); } /** - * dkp_daemon_refresh_battery_devices_cb: + * up_daemon_refresh_battery_devices_cb: **/ static gboolean -dkp_daemon_refresh_battery_devices_cb (DkpDaemon *daemon) +up_daemon_refresh_battery_devices_cb (UpDaemon *daemon) { /* no more left to do? */ if (daemon->priv->battery_poll_count-- == 0) { @@ -713,39 +713,39 @@ dkp_daemon_refresh_battery_devices_cb (DkpDaemon *daemon) } egg_debug ("doing the delayed refresh (%i)", daemon->priv->battery_poll_count); - dkp_daemon_refresh_battery_devices (daemon); + up_daemon_refresh_battery_devices (daemon); /* keep going until none left to do */ return TRUE; } /** - * dkp_daemon_poll_battery_devices_for_a_little_bit: + * up_daemon_poll_battery_devices_for_a_little_bit: **/ static void -dkp_daemon_poll_battery_devices_for_a_little_bit (DkpDaemon *daemon) +up_daemon_poll_battery_devices_for_a_little_bit (UpDaemon *daemon) { - daemon->priv->battery_poll_count = DKP_DAEMON_POLL_BATTERY_NUMBER_TIMES; + daemon->priv->battery_poll_count = UP_DAEMON_POLL_BATTERY_NUMBER_TIMES; /* already polling */ if (daemon->priv->battery_poll_id != 0) return; daemon->priv->battery_poll_id = - g_timeout_add_seconds (DKP_DAEMON_ON_BATTERY_REFRESH_DEVICES_DELAY, - (GSourceFunc) dkp_daemon_refresh_battery_devices_cb, daemon); + g_timeout_add_seconds (UP_DAEMON_ON_BATTERY_REFRESH_DEVICES_DELAY, + (GSourceFunc) up_daemon_refresh_battery_devices_cb, daemon); } /** - * dkp_daemon_device_changed_cb: + * up_daemon_device_changed_cb: **/ static void -dkp_daemon_device_changed_cb (DkpDevice *device, DkpDaemon *daemon) +up_daemon_device_changed_cb (DkpDevice *device, UpDaemon *daemon) { const gchar *object_path; DkpDeviceType type; gboolean ret; - g_return_if_fail (DKP_IS_DAEMON (daemon)); + g_return_if_fail (UP_IS_DAEMON (daemon)); g_return_if_fail (DKP_IS_DEVICE (device)); /* refresh battery devices when AC state changes */ @@ -754,19 +754,19 @@ dkp_daemon_device_changed_cb (DkpDevice *device, DkpDaemon *daemon) NULL); if (type == DKP_DEVICE_TYPE_LINE_POWER) { /* refresh now, and again in a little while */ - dkp_daemon_refresh_battery_devices (daemon); - dkp_daemon_poll_battery_devices_for_a_little_bit (daemon); + up_daemon_refresh_battery_devices (daemon); + up_daemon_poll_battery_devices_for_a_little_bit (daemon); } /* second, check if the on_battery and on_low_battery state has changed */ - ret = (dkp_daemon_get_on_battery_local (daemon) && !dkp_daemon_get_on_ac_local (daemon)); + ret = (up_daemon_get_on_battery_local (daemon) && !up_daemon_get_on_ac_local (daemon)); if (ret != daemon->priv->on_battery) { g_object_set (daemon, "on-battery", ret, NULL); /* set pm-utils power policy */ - dkp_daemon_set_pmutils_powersave (daemon, ret); + up_daemon_set_pmutils_powersave (daemon, ret); } - ret = dkp_daemon_get_on_low_battery_local (daemon); + ret = up_daemon_get_on_low_battery_local (daemon); if (ret != daemon->priv->on_low_battery) { g_object_set (daemon, "on-low-battery", ret, NULL); } @@ -786,15 +786,15 @@ dkp_daemon_device_changed_cb (DkpDevice *device, DkpDaemon *daemon) } /** - * dkp_daemon_device_added_cb: + * up_daemon_device_added_cb: **/ static void -dkp_daemon_device_added_cb (UpBackend *backend, GObject *native, DkpDevice *device, DkpDaemon *daemon) +up_daemon_device_added_cb (UpBackend *backend, GObject *native, DkpDevice *device, UpDaemon *daemon) { DkpDeviceType type; const gchar *object_path; - g_return_if_fail (DKP_IS_DAEMON (daemon)); + g_return_if_fail (UP_IS_DAEMON (daemon)); g_return_if_fail (DKP_IS_DEVICE (device)); g_return_if_fail (G_IS_OBJECT (native)); @@ -803,14 +803,14 @@ dkp_daemon_device_added_cb (UpBackend *backend, GObject *native, DkpDevice *devi /* connect, so we get changes */ g_signal_connect (device, "changed", - G_CALLBACK (dkp_daemon_device_changed_cb), daemon); + G_CALLBACK (up_daemon_device_changed_cb), daemon); /* refresh after a short delay */ g_object_get (device, "type", &type, NULL); if (type == DKP_DEVICE_TYPE_BATTERY) - dkp_daemon_poll_battery_devices_for_a_little_bit (daemon); + up_daemon_poll_battery_devices_for_a_little_bit (daemon); /* emit */ if (!daemon->priv->during_coldplug) { @@ -827,15 +827,15 @@ dkp_daemon_device_added_cb (UpBackend *backend, GObject *native, DkpDevice *devi } /** - * dkp_daemon_device_removed_cb: + * up_daemon_device_removed_cb: **/ static void -dkp_daemon_device_removed_cb (UpBackend *backend, GObject *native, DkpDevice *device, DkpDaemon *daemon) +up_daemon_device_removed_cb (UpBackend *backend, GObject *native, DkpDevice *device, UpDaemon *daemon) { DkpDeviceType type; const gchar *object_path; - g_return_if_fail (DKP_IS_DAEMON (daemon)); + g_return_if_fail (UP_IS_DAEMON (daemon)); g_return_if_fail (DKP_IS_DEVICE (device)); g_return_if_fail (G_IS_OBJECT (native)); @@ -847,7 +847,7 @@ dkp_daemon_device_removed_cb (UpBackend *backend, GObject *native, DkpDevice *de "type", &type, NULL); if (type == DKP_DEVICE_TYPE_BATTERY) - dkp_daemon_poll_battery_devices_for_a_little_bit (daemon); + up_daemon_poll_battery_devices_for_a_little_bit (daemon); /* emit */ if (!daemon->priv->during_coldplug) { @@ -867,12 +867,12 @@ dkp_daemon_device_removed_cb (UpBackend *backend, GObject *native, DkpDevice *de } /** - * dkp_daemon_properties_changed_cb: + * up_daemon_properties_changed_cb: **/ static void -dkp_daemon_properties_changed_cb (GObject *object, GParamSpec *pspec, DkpDaemon *daemon) +up_daemon_properties_changed_cb (GObject *object, GParamSpec *pspec, UpDaemon *daemon) { - g_return_if_fail (DKP_IS_DAEMON (daemon)); + g_return_if_fail (UP_IS_DAEMON (daemon)); /* emit */ if (!daemon->priv->during_coldplug) { @@ -882,14 +882,14 @@ dkp_daemon_properties_changed_cb (GObject *object, GParamSpec *pspec, DkpDaemon } /** - * dkp_daemon_init: + * up_daemon_init: **/ static void -dkp_daemon_init (DkpDaemon *daemon) +up_daemon_init (UpDaemon *daemon) { gfloat waterline; - daemon->priv = DKP_DAEMON_GET_PRIVATE (daemon); + daemon->priv = UP_DAEMON_GET_PRIVATE (daemon); daemon->priv->polkit = dkp_polkit_new (); daemon->priv->lid_is_present = FALSE; daemon->priv->lid_is_closed = FALSE; @@ -906,27 +906,27 @@ dkp_daemon_init (DkpDaemon *daemon) daemon->priv->backend = up_backend_new (); g_signal_connect (daemon->priv->backend, "device-added", - G_CALLBACK (dkp_daemon_device_added_cb), daemon); + G_CALLBACK (up_daemon_device_added_cb), daemon); g_signal_connect (daemon->priv->backend, "device-removed", - G_CALLBACK (dkp_daemon_device_removed_cb), daemon); + G_CALLBACK (up_daemon_device_removed_cb), daemon); /* watch when these properties change */ g_signal_connect (daemon, "notify::lid-is-present", - G_CALLBACK (dkp_daemon_properties_changed_cb), daemon); + G_CALLBACK (up_daemon_properties_changed_cb), daemon); g_signal_connect (daemon, "notify::lid-is-closed", - G_CALLBACK (dkp_daemon_properties_changed_cb), daemon); + G_CALLBACK (up_daemon_properties_changed_cb), daemon); g_signal_connect (daemon, "notify::on-battery", - G_CALLBACK (dkp_daemon_properties_changed_cb), daemon); + G_CALLBACK (up_daemon_properties_changed_cb), daemon); g_signal_connect (daemon, "notify::on-low-battery", - G_CALLBACK (dkp_daemon_properties_changed_cb), daemon); + G_CALLBACK (up_daemon_properties_changed_cb), daemon); /* check if we have support */ - dkp_daemon_check_sleep_states (daemon); + up_daemon_check_sleep_states (daemon); /* do we have enough swap? */ if (daemon->priv->kernel_can_hibernate) { - waterline = dkp_daemon_check_swap_space (daemon); - if (waterline < DKP_DAEMON_SWAP_WATERLINE) + waterline = up_daemon_check_swap_space (daemon); + if (waterline < UP_DAEMON_SWAP_WATERLINE) daemon->priv->hibernate_has_swap_space = TRUE; else egg_debug ("not enough swap to enable hibernate"); @@ -934,51 +934,51 @@ dkp_daemon_init (DkpDaemon *daemon) /* is the swap usable? */ if (daemon->priv->kernel_can_hibernate) - daemon->priv->hibernate_has_encrypted_swap = dkp_daemon_check_encrypted_swap (daemon); + daemon->priv->hibernate_has_encrypted_swap = up_daemon_check_encrypted_swap (daemon); } /** - * dkp_daemon_error_quark: + * up_daemon_error_quark: **/ GQuark -dkp_daemon_error_quark (void) +up_daemon_error_quark (void) { static GQuark ret = 0; if (ret == 0) - ret = g_quark_from_static_string ("dkp_daemon_error"); + ret = g_quark_from_static_string ("up_daemon_error"); return ret; } #define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC } /** - * dkp_daemon_error_get_type: + * up_daemon_error_get_type: **/ GType -dkp_daemon_error_get_type (void) +up_daemon_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { - ENUM_ENTRY (DKP_DAEMON_ERROR_GENERAL, "GeneralError"), - ENUM_ENTRY (DKP_DAEMON_ERROR_NOT_SUPPORTED, "NotSupported"), - ENUM_ENTRY (DKP_DAEMON_ERROR_NO_SUCH_DEVICE, "NoSuchDevice"), + ENUM_ENTRY (UP_DAEMON_ERROR_GENERAL, "GeneralError"), + ENUM_ENTRY (UP_DAEMON_ERROR_NOT_SUPPORTED, "NotSupported"), + ENUM_ENTRY (UP_DAEMON_ERROR_NO_SUCH_DEVICE, "NoSuchDevice"), { 0, 0, 0 } }; - g_assert (DKP_DAEMON_NUM_ERRORS == G_N_ELEMENTS (values) - 1); - etype = g_enum_register_static ("DkpDaemonError", values); + g_assert (UP_DAEMON_NUM_ERRORS == G_N_ELEMENTS (values) - 1); + etype = g_enum_register_static ("UpDaemonError", values); } return etype; } /** - * dkp_daemon_get_property: + * up_daemon_get_property: **/ static void -dkp_daemon_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) +up_daemon_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - DkpDaemon *daemon; - daemon = DKP_DAEMON (object); + UpDaemon *daemon; + daemon = UP_DAEMON (object); switch (prop_id) { case PROP_DAEMON_VERSION: g_value_set_string (value, PACKAGE_VERSION); @@ -1010,12 +1010,12 @@ dkp_daemon_get_property (GObject *object, guint prop_id, GValue *value, GParamSp } /** - * dkp_daemon_set_property: + * up_daemon_set_property: **/ static void -dkp_daemon_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) +up_daemon_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - DkpDaemon *daemon = DKP_DAEMON (object); + UpDaemon *daemon = UP_DAEMON (object); switch (prop_id) { case PROP_LID_IS_CLOSED: daemon->priv->lid_is_closed = g_value_get_boolean (value); @@ -1040,17 +1040,17 @@ dkp_daemon_set_property (GObject *object, guint prop_id, const GValue *value, GP } /** - * dkp_daemon_class_init: + * up_daemon_class_init: **/ static void -dkp_daemon_class_init (DkpDaemonClass *klass) +up_daemon_class_init (UpDaemonClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->finalize = dkp_daemon_finalize; - object_class->get_property = dkp_daemon_get_property; - object_class->set_property = dkp_daemon_set_property; + object_class->finalize = up_daemon_finalize; + object_class->get_property = up_daemon_get_property; + object_class->set_property = up_daemon_set_property; - g_type_class_add_private (klass, sizeof (DkpDaemonPrivate)); + g_type_class_add_private (klass, sizeof (UpDaemonPrivate)); signals[SIGNAL_DEVICE_ADDED] = g_signal_new ("device-added", @@ -1141,23 +1141,23 @@ dkp_daemon_class_init (DkpDaemonClass *klass) FALSE, G_PARAM_READWRITE)); - dbus_g_object_type_install_info (DKP_TYPE_DAEMON, &dbus_glib_dkp_daemon_object_info); + dbus_g_object_type_install_info (UP_TYPE_DAEMON, &dbus_glib_up_daemon_object_info); - dbus_g_error_domain_register (DKP_DAEMON_ERROR, NULL, DKP_DAEMON_TYPE_ERROR); + dbus_g_error_domain_register (UP_DAEMON_ERROR, NULL, UP_DAEMON_TYPE_ERROR); } /** - * dkp_daemon_finalize: + * up_daemon_finalize: **/ static void -dkp_daemon_finalize (GObject *object) +up_daemon_finalize (GObject *object) { - DkpDaemon *daemon; + UpDaemon *daemon; g_return_if_fail (object != NULL); - g_return_if_fail (DKP_IS_DAEMON (object)); + g_return_if_fail (UP_IS_DAEMON (object)); - daemon = DKP_DAEMON (object); + daemon = UP_DAEMON (object); g_return_if_fail (daemon->priv != NULL); @@ -1172,17 +1172,17 @@ dkp_daemon_finalize (GObject *object) g_object_unref (daemon->priv->polkit); g_object_unref (daemon->priv->backend); - G_OBJECT_CLASS (dkp_daemon_parent_class)->finalize (object); + G_OBJECT_CLASS (up_daemon_parent_class)->finalize (object); } /** - * dkp_daemon_new: + * up_daemon_new: **/ -DkpDaemon * -dkp_daemon_new (void) +UpDaemon * +up_daemon_new (void) { - DkpDaemon *daemon; - daemon = DKP_DAEMON (g_object_new (DKP_TYPE_DAEMON, NULL)); + UpDaemon *daemon; + daemon = UP_DAEMON (g_object_new (UP_TYPE_DAEMON, NULL)); return daemon; } @@ -1193,17 +1193,17 @@ dkp_daemon_new (void) #include "egg-test.h" void -dkp_daemon_test (gpointer user_data) +up_daemon_test (gpointer user_data) { EggTest *test = (EggTest *) user_data; - DkpDaemon *daemon; + UpDaemon *daemon; - if (!egg_test_start (test, "DkpDaemon")) + if (!egg_test_start (test, "UpDaemon")) return; /************************************************************/ egg_test_title (test, "get instance"); - daemon = dkp_daemon_new (); + daemon = up_daemon_new (); egg_test_assert (test, daemon != NULL); /* unref */ diff --git a/src/up-daemon.h b/src/up-daemon.h index 3452a0c..b295188 100644 --- a/src/up-daemon.h +++ b/src/up-daemon.h @@ -18,8 +18,8 @@ * */ -#ifndef __DKP_DAEMON_H__ -#define __DKP_DAEMON_H__ +#ifndef __UP_DAEMON_H__ +#define __UP_DAEMON_H__ #include <glib-object.h> #include <polkit/polkit.h> @@ -30,68 +30,68 @@ G_BEGIN_DECLS -#define DKP_TYPE_DAEMON (dkp_daemon_get_type ()) -#define DKP_DAEMON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), DKP_TYPE_DAEMON, DkpDaemon)) -#define DKP_DAEMON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), DKP_TYPE_DAEMON, DkpDaemonClass)) -#define DKP_IS_DAEMON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), DKP_TYPE_DAEMON)) -#define DKP_IS_DAEMON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), DKP_TYPE_DAEMON)) -#define DKP_DAEMON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DKP_TYPE_DAEMON, DkpDaemonClass)) +#define UP_TYPE_DAEMON (up_daemon_get_type ()) +#define UP_DAEMON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), UP_TYPE_DAEMON, UpDaemon)) +#define UP_DAEMON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), UP_TYPE_DAEMON, UpDaemonClass)) +#define UP_IS_DAEMON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), UP_TYPE_DAEMON)) +#define UP_IS_DAEMON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), UP_TYPE_DAEMON)) +#define UP_DAEMON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), UP_TYPE_DAEMON, UpDaemonClass)) -typedef struct DkpDaemonPrivate DkpDaemonPrivate; +typedef struct UpDaemonPrivate UpDaemonPrivate; typedef struct { GObject parent; - DkpDaemonPrivate *priv; -} DkpDaemon; + UpDaemonPrivate *priv; +} UpDaemon; typedef struct { GObjectClass parent_class; -} DkpDaemonClass; +} UpDaemonClass; typedef enum { - DKP_DAEMON_ERROR_GENERAL, - DKP_DAEMON_ERROR_NOT_SUPPORTED, - DKP_DAEMON_ERROR_NO_SUCH_DEVICE, - DKP_DAEMON_NUM_ERRORS -} DkpDaemonError; + UP_DAEMON_ERROR_GENERAL, + UP_DAEMON_ERROR_NOT_SUPPORTED, + UP_DAEMON_ERROR_NO_SUCH_DEVICE, + UP_DAEMON_NUM_ERRORS +} UpDaemonError; -#define DKP_DAEMON_ERROR dkp_daemon_error_quark () +#define UP_DAEMON_ERROR up_daemon_error_quark () -GType dkp_daemon_error_get_type (void); -#define DKP_DAEMON_TYPE_ERROR (dkp_daemon_error_get_type ()) +GType up_daemon_error_get_type (void); +#define UP_DAEMON_TYPE_ERROR (up_daemon_error_get_type ()) -GQuark dkp_daemon_error_quark (void); -GType dkp_daemon_get_type (void); -DkpDaemon *dkp_daemon_new (void); -void dkp_daemon_test (gpointer user_data); +GQuark up_daemon_error_quark (void); +GType up_daemon_get_type (void); +UpDaemon *up_daemon_new (void); +void up_daemon_test (gpointer user_data); /* private */ -guint dkp_daemon_get_number_devices_of_type (DkpDaemon *daemon, +guint up_daemon_get_number_devices_of_type (UpDaemon *daemon, DkpDeviceType type); -DkpDeviceList *dkp_daemon_get_device_list (DkpDaemon *daemon); -gboolean dkp_daemon_startup (DkpDaemon *daemon); +DkpDeviceList *up_daemon_get_device_list (UpDaemon *daemon); +gboolean up_daemon_startup (UpDaemon *daemon); /* exported */ -gboolean dkp_daemon_enumerate_devices (DkpDaemon *daemon, +gboolean up_daemon_enumerate_devices (UpDaemon *daemon, DBusGMethodInvocation *context); -gboolean dkp_daemon_get_on_battery (DkpDaemon *daemon, +gboolean up_daemon_get_on_battery (UpDaemon *daemon, DBusGMethodInvocation *context); -gboolean dkp_daemon_get_low_battery (DkpDaemon *daemon, +gboolean up_daemon_get_low_battery (UpDaemon *daemon, DBusGMethodInvocation *context); -gboolean dkp_daemon_suspend (DkpDaemon *daemon, +gboolean up_daemon_suspend (UpDaemon *daemon, DBusGMethodInvocation *context); -gboolean dkp_daemon_hibernate (DkpDaemon *daemon, +gboolean up_daemon_hibernate (UpDaemon *daemon, DBusGMethodInvocation *context); -gboolean dkp_daemon_can_suspend (DkpDaemon *daemon, +gboolean up_daemon_can_suspend (UpDaemon *daemon, gboolean interactive, DBusGMethodInvocation *context); -gboolean dkp_daemon_can_hibernate (DkpDaemon *daemon, +gboolean up_daemon_can_hibernate (UpDaemon *daemon, gboolean interactive, DBusGMethodInvocation *context); G_END_DECLS -#endif /* __DKP_DAEMON_H__ */ +#endif /* __UP_DAEMON_H__ */ diff --git a/src/up-device.c b/src/up-device.c index 2a5d0d6..e8b6e99 100644 --- a/src/up-device.c +++ b/src/up-device.c @@ -47,7 +47,7 @@ struct DkpDevicePrivate gchar *object_path; DBusGConnection *system_bus_connection; DBusGProxy *system_bus_proxy; - DkpDaemon *daemon; + UpDaemon *daemon; DkpHistory *history; GObject *native; gboolean has_ever_refresh; @@ -509,9 +509,9 @@ out: /** * dkp_device_get_daemon: * - * Returns a refcounted #DkpDaemon instance, or %NULL + * Returns a refcounted #UpDaemon instance, or %NULL **/ -DkpDaemon * +UpDaemon * dkp_device_get_daemon (DkpDevice *device) { if (device->priv->daemon == NULL) @@ -525,7 +525,7 @@ dkp_device_get_daemon (DkpDevice *device) * Return %TRUE on success, %FALSE if we failed to get data and should be removed **/ gboolean -dkp_device_coldplug (DkpDevice *device, DkpDaemon *daemon, GObject *native) +dkp_device_coldplug (DkpDevice *device, UpDaemon *daemon, GObject *native) { gboolean ret; const gchar *native_path; @@ -605,7 +605,7 @@ dkp_device_get_statistics (DkpDevice *device, const gchar *type, DBusGMethodInvo /* doesn't even try to support this */ if (!device->priv->has_statistics) { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "device does not support getting stats"); + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "device does not support getting stats"); dbus_g_method_return_error (context, error); goto out; } @@ -618,14 +618,14 @@ dkp_device_get_statistics (DkpDevice *device, const gchar *type, DBusGMethodInvo /* maybe the device doesn't support histories */ if (array == NULL) { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "device has no statistics"); + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "device has no statistics"); dbus_g_method_return_error (context, error); goto out; } /* always 101 items of data */ if (array->len != 101) { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "statistics invalid as have %i items", array->len); + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "statistics invalid as have %i items", array->len); dbus_g_method_return_error (context, error); goto out; } @@ -668,7 +668,7 @@ dkp_device_get_history (DkpDevice *device, const gchar *type_string, guint times /* doesn't even try to support this */ if (!device->priv->has_history) { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "device does not support getting history"); + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "device does not support getting history"); dbus_g_method_return_error (context, error); goto out; } @@ -689,7 +689,7 @@ dkp_device_get_history (DkpDevice *device, const gchar *type_string, guint times /* maybe the device doesn't have any history */ if (array == NULL) { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "device has no history"); + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "device has no history"); dbus_g_method_return_error (context, error); goto out; } diff --git a/src/up-device.h b/src/up-device.h index 9509417..4133aef 100644 --- a/src/up-device.h +++ b/src/up-device.h @@ -77,9 +77,9 @@ DkpDevice *dkp_device_new (void); void dkp_device_test (gpointer user_data); gboolean dkp_device_coldplug (DkpDevice *device, - DkpDaemon *daemon, + UpDaemon *daemon, GObject *native); -DkpDaemon *dkp_device_get_daemon (DkpDevice *device); +UpDaemon *dkp_device_get_daemon (DkpDevice *device); GObject *dkp_device_get_native (DkpDevice *device); const gchar *dkp_device_get_object_path (DkpDevice *device); gboolean dkp_device_get_on_battery (DkpDevice *device, diff --git a/src/up-main.c b/src/up-main.c index b3a9f12..aa10ea5 100644 --- a/src/up-main.c +++ b/src/up-main.c @@ -123,7 +123,7 @@ gint main (gint argc, gchar **argv) { GError *error = NULL; - DkpDaemon *daemon = NULL; + UpDaemon *daemon = NULL; DkpQos *qos = NULL; DkpWakeups *wakeups = NULL; GOptionContext *context; @@ -182,9 +182,9 @@ main (gint argc, gchar **argv) qos = dkp_qos_new (); wakeups = dkp_wakeups_new (); - daemon = dkp_daemon_new (); + daemon = up_daemon_new (); loop = g_main_loop_new (NULL, FALSE); - ret = dkp_daemon_startup (daemon); + ret = up_daemon_startup (daemon); if (!ret) { egg_warning ("Could not startup; bailing out"); goto out; diff --git a/src/up-polkit.c b/src/up-polkit.c index f2282a1..62dd5ec 100644 --- a/src/up-polkit.c +++ b/src/up-polkit.c @@ -75,7 +75,7 @@ dkp_polkit_check_auth (DkpPolkit *polkit, PolkitSubject *subject, const gchar *a /* check auth */ result = polkit_authority_check_authorization_sync (polkit->priv->authority, subject, action_id, NULL, POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION, NULL, &error_local); if (result == NULL) { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "failed to check authorisation: %s", error_local->message); + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "failed to check authorisation: %s", error_local->message); dbus_g_method_return_error (context, error); g_error_free (error_local); g_error_free (error); @@ -86,7 +86,7 @@ dkp_polkit_check_auth (DkpPolkit *polkit, PolkitSubject *subject, const gchar *a if (polkit_authorization_result_get_is_authorized (result)) { ret = TRUE; } else { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "not authorized"); + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "not authorized"); dbus_g_method_return_error (context, error); g_error_free (error); } diff --git a/src/up-qos.c b/src/up-qos.c index 271f79e..ad30e54 100644 --- a/src/up-qos.c +++ b/src/up-qos.c @@ -257,7 +257,7 @@ dkp_qos_request_latency (DkpQos *qos, const gchar *type_text, gint value, gboole /* get correct data */ type = dkp_qos_type_from_text (type_text); if (type == DKP_QOS_TYPE_UNKNOWN) { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "type invalid: %s", type_text); + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "type invalid: %s", type_text); dbus_g_method_return_error (context, error); goto out; } @@ -265,7 +265,7 @@ dkp_qos_request_latency (DkpQos *qos, const gchar *type_text, gint value, gboole /* as we are async, we can get the sender */ sender = dbus_g_method_get_sender (context); if (sender == NULL) { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "no DBUS sender"); + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "no DBUS sender"); dbus_g_method_return_error (context, error); goto out; } @@ -286,7 +286,7 @@ dkp_qos_request_latency (DkpQos *qos, const gchar *type_text, gint value, gboole /* get uid */ retval = dkp_polkit_get_uid (qos->priv->polkit, subject, &uid); if (!retval) { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "cannot get UID"); + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "cannot get UID"); dbus_g_method_return_error (context, error); goto out; } @@ -294,7 +294,7 @@ dkp_qos_request_latency (DkpQos *qos, const gchar *type_text, gint value, gboole /* get pid */ retval = dkp_polkit_get_pid (qos->priv->polkit, subject, &pid); if (!retval) { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "cannot get PID"); + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "cannot get PID"); dbus_g_method_return_error (context, error); goto out; } @@ -302,7 +302,7 @@ dkp_qos_request_latency (DkpQos *qos, const gchar *type_text, gint value, gboole /* get command line */ cmdline = dkp_qos_get_cmdline (pid); if (cmdline == NULL) { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "cannot get cmdline"); + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "cannot get cmdline"); dbus_g_method_return_error (context, error); goto out; } @@ -361,7 +361,7 @@ dkp_qos_cancel_request (DkpQos *qos, guint cookie, DBusGMethodInvocation *contex /* find the correct cookie */ obj = dkp_qos_find_from_cookie (qos, cookie); if (obj == NULL) { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "Cannot find request for #%i", cookie); dbus_g_method_return_error (context, error); goto out; @@ -370,7 +370,7 @@ dkp_qos_cancel_request (DkpQos *qos, guint cookie, DBusGMethodInvocation *contex /* get the sender? */ sender = dbus_g_method_get_sender (context); if (sender == NULL) { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "no DBUS sender"); + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "no DBUS sender"); dbus_g_method_return_error (context, error); goto out; } @@ -412,7 +412,7 @@ dkp_qos_get_latency (DkpQos *qos, const gchar *type_text, gint *value, GError ** /* get correct data */ type = dkp_qos_type_from_text (type_text); if (type == DKP_QOS_TYPE_UNKNOWN) { - g_set_error (error, DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "type invalid: %s", type_text); + g_set_error (error, UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "type invalid: %s", type_text); return FALSE; } @@ -433,7 +433,7 @@ dkp_qos_set_minimum_latency (DkpQos *qos, const gchar *type_text, gint value, DB /* type valid? */ type = dkp_qos_type_from_text (type_text); if (type == DKP_QOS_TYPE_UNKNOWN) { - error = g_error_new (DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "type invalid: %s", type_text); + error = g_error_new (UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "type invalid: %s", type_text); dbus_g_method_return_error (context, error); return; } diff --git a/src/up-self-test.c b/src/up-self-test.c index a6c8182..594f872 100644 --- a/src/up-self-test.c +++ b/src/up-self-test.c @@ -53,7 +53,7 @@ main (int argc, char **argv) dkp_polkit_test (test); dkp_qos_test (test); dkp_wakeups_test (test); - dkp_daemon_test (test); + up_daemon_test (test); return (egg_test_finish (test)); } diff --git a/src/up-wakeups.c b/src/up-wakeups.c index 8f88cef..c424058 100644 --- a/src/up-wakeups.c +++ b/src/up-wakeups.c @@ -171,7 +171,7 @@ dkp_wakeups_get_total (DkpWakeups *wakeups, guint *value, GError **error) /* no capability */ if (!wakeups->priv->has_capability) { - g_set_error_literal (error, DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "no hardware support"); + g_set_error_literal (error, UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "no hardware support"); return FALSE; } @@ -180,7 +180,7 @@ dkp_wakeups_get_total (DkpWakeups *wakeups, guint *value, GError **error) /* no data */ if (!ret) { - g_set_error_literal (error, DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "cannot enable timerstats"); + g_set_error_literal (error, UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "cannot enable timerstats"); return FALSE; } @@ -201,7 +201,7 @@ dkp_wakeups_get_data (DkpWakeups *wakeups, GPtrArray **data, GError **error) /* no capability */ if (!wakeups->priv->has_capability) { - g_set_error_literal (error, DKP_DAEMON_ERROR, DKP_DAEMON_ERROR_GENERAL, "no hardware support"); + g_set_error_literal (error, UP_DAEMON_ERROR, UP_DAEMON_ERROR_GENERAL, "no hardware support"); return FALSE; } |