diff options
author | Bastien Nocera <hadess@hadess.net> | 2013-10-10 11:17:45 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2013-10-14 10:42:55 +0200 |
commit | 030e2c9d3633e35e8beeecc1f41f6e0ff77b57dc (patch) | |
tree | 9c6a7e332fe70b46a18a8d48f673a25225f5cd93 | |
parent | 911727fbaa34a13897a87d71311f74646cd4a5ee (diff) |
lib: Remove deprecated features
All this is now handled by logind.
-rw-r--r-- | libupower-glib/Makefile.am | 1 | ||||
-rw-r--r-- | libupower-glib/up-client.c | 359 | ||||
-rw-r--r-- | libupower-glib/up-client.h | 25 | ||||
-rw-r--r-- | libupower-glib/up-types.c | 53 | ||||
-rw-r--r-- | libupower-glib/up-types.h | 15 |
5 files changed, 0 insertions, 453 deletions
diff --git a/libupower-glib/Makefile.am b/libupower-glib/Makefile.am index 5c03409..7444f54 100644 --- a/libupower-glib/Makefile.am +++ b/libupower-glib/Makefile.am @@ -5,7 +5,6 @@ AM_CPPFLAGS = \ -I$(top_srcdir) \ -I$(top_srcdir)/libupower-glib \ -DUP_COMPILATION \ - -DUPOWER_ENABLE_DEPRECATED \ -DG_LOG_DOMAIN=\"libupower-glib\" \ -DPACKAGE_DATA_DIR=\""$(datadir)"\" \ -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" diff --git a/libupower-glib/up-client.c b/libupower-glib/up-client.c index 26960fe..38a6a73 100644 --- a/libupower-glib/up-client.c +++ b/libupower-glib/up-client.c @@ -58,13 +58,10 @@ struct _UpClientPrivate GPtrArray *array; gboolean have_properties; gchar *daemon_version; - gboolean can_suspend; - gboolean can_hibernate; gboolean lid_is_closed; gboolean on_battery; gboolean on_low_battery; gboolean lid_is_present; - gboolean lid_force_sleep; gboolean is_docked; gboolean done_enumerate; }; @@ -74,21 +71,16 @@ enum { UP_CLIENT_DEVICE_CHANGED, UP_CLIENT_DEVICE_REMOVED, UP_CLIENT_CHANGED, - UP_CLIENT_NOTIFY_SLEEP, - UP_CLIENT_NOTIFY_RESUME, UP_CLIENT_LAST_SIGNAL }; enum { PROP_0, PROP_DAEMON_VERSION, - PROP_CAN_SUSPEND, - PROP_CAN_HIBERNATE, PROP_ON_BATTERY, PROP_ON_LOW_BATTERY, PROP_LID_IS_CLOSED, PROP_LID_IS_PRESENT, - PROP_LID_FORCE_SLEEP, PROP_IS_DOCKED, PROP_LAST }; @@ -165,140 +157,6 @@ up_client_get_devices_private (UpClient *client, GError **error) } /** - * up_client_suspend_sync: - * @client: a #UpClient instance. - * @cancellable: a #GCancellable or %NULL - * @error: a #GError, or %NULL. - * - * Puts the computer into a low power state, but state is not preserved if the - * power is lost. - * - * NOTE: The system is still consuming a small amount of power - * - * Return value: TRUE if system suspended okay, FALSE other wise. - * - * Since: 0.9.0 - **/ -gboolean -up_client_suspend_sync (UpClient *client, GCancellable *cancellable, GError **error) -{ - gboolean ret; - GError *error_local = NULL; - - g_return_val_if_fail (UP_IS_CLIENT (client), FALSE); - g_return_val_if_fail (client->priv->proxy != NULL, FALSE); - - ret = dbus_g_proxy_call (client->priv->proxy, "Suspend", &error_local, - G_TYPE_INVALID, G_TYPE_INVALID); - if (!ret) { - /* DBus might time out, which is okay */ - if (g_error_matches (error_local, DBUS_GERROR, DBUS_GERROR_NO_REPLY)) { - g_debug ("DBUS timed out, but recovering"); - ret = TRUE; - goto out; - } - - /* an actual error */ - g_warning ("Couldn't suspend: %s", error_local->message); - g_set_error (error, 1, 0, "%s", error_local->message); - } -out: - if (error_local != NULL) - g_error_free (error_local); - return ret; -} - -/** - * up_client_hibernate_sync: - * @client: a #UpClient instance. - * @cancellable: a #GCancellable or %NULL - * @error: a #GError. - * - * Puts the computer into a low power state, where state is preserved if the - * power is lost. - * - * Return value: TRUE if system suspended okay, FALSE other wise. - * - * Since: 0.9.0 - **/ -gboolean -up_client_hibernate_sync (UpClient *client, GCancellable *cancellable, GError **error) -{ - gboolean ret; - GError *error_local = NULL; - - g_return_val_if_fail (UP_IS_CLIENT (client), FALSE); - g_return_val_if_fail (client->priv->proxy != NULL, FALSE); - - ret = dbus_g_proxy_call (client->priv->proxy, "Hibernate", &error_local, - G_TYPE_INVALID, G_TYPE_INVALID); - if (!ret) { - /* DBus might time out, which is okay */ - if (g_error_matches (error_local, DBUS_GERROR, DBUS_GERROR_NO_REPLY)) { - g_debug ("DBUS timed out, but recovering"); - ret = TRUE; - goto out; - } - - /* an actual error */ - g_warning ("Couldn't hibernate: %s", error_local->message); - g_set_error (error, 1, 0, "%s", error_local->message); - } -out: - if (error_local != NULL) - g_error_free (error_local); - return ret; -} - -/** - * up_client_about_to_sleep_sync: - * @client: a #UpClient instance. - * @sleep_kind: a sleep type, e.g. %UP_SLEEP_KIND_SUSPEND - * @cancellable: a #GCancellable or %NULL - * @error: a #GError, or %NULL. - * - * Tells UPower that we are soon to reqest either Suspend() or Hibernate() - * and that session and system components should be notified of this. - * - * Return value: TRUE if system suspended okay, FALSE other wise. - * - * Since: 0.9.11 - **/ -gboolean -up_client_about_to_sleep_sync (UpClient *client, - UpSleepKind sleep_kind, - GCancellable *cancellable, - GError **error) -{ - gboolean ret; - GError *error_local = NULL; - - g_return_val_if_fail (UP_IS_CLIENT (client), FALSE); - g_return_val_if_fail (client->priv->proxy != NULL, FALSE); - - ret = dbus_g_proxy_call (client->priv->proxy, "AboutToSleep", &error_local, - G_TYPE_STRING, up_sleep_kind_to_string (sleep_kind), - G_TYPE_INVALID, - G_TYPE_INVALID); - if (!ret) { - /* DBus might time out, which is okay */ - if (g_error_matches (error_local, DBUS_GERROR, DBUS_GERROR_NO_REPLY)) { - g_debug ("DBUS timed out, but recovering"); - ret = TRUE; - goto out; - } - - /* an actual error */ - g_warning ("Couldn't sent that we were about to sleep: %s", error_local->message); - g_set_error (error, 1, 0, "%s", error_local->message); - } -out: - if (error_local != NULL) - g_error_free (error_local); - return ret; -} - -/** * up_client_get_properties_sync: * @client: a #UpClient instance. * @cancellable: a #GCancellable or %NULL @@ -317,9 +175,6 @@ up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GErr gboolean prop_val; GHashTable *props; GValue *value; -#ifdef ENABLE_DEPRECATED - gboolean allowed = FALSE; -#endif props = NULL; @@ -346,41 +201,6 @@ up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GErr g_free (client->priv->daemon_version); client->priv->daemon_version = g_strdup (g_value_get_string (value)); -#ifdef ENABLE_DEPRECATED - value = g_hash_table_lookup (props, "CanSuspend"); - if (value == NULL) { - g_warning ("No 'CanSuspend' property"); - goto out; - } - - ret = dbus_g_proxy_call (client->priv->proxy, "SuspendAllowed", error, - G_TYPE_INVALID, G_TYPE_BOOLEAN, &allowed, G_TYPE_INVALID); - if (!ret) - goto out; - - prop_val = g_value_get_boolean (value) && allowed; - if (prop_val != client->priv->can_suspend) { - client->priv->can_suspend = prop_val; - g_object_notify (G_OBJECT(client), "can-suspend"); - } - - value = g_hash_table_lookup (props, "CanHibernate"); - if (value == NULL) { - g_warning ("No 'CanHibernate' property"); - goto out; - } - ret = dbus_g_proxy_call (client->priv->proxy, "HibernateAllowed", error, - G_TYPE_INVALID, G_TYPE_BOOLEAN, &allowed, G_TYPE_INVALID); - if (!ret) - goto out; - - prop_val = g_value_get_boolean (value) && allowed; - if (prop_val != client->priv->can_hibernate) { - client->priv->can_hibernate = prop_val; - g_object_notify (G_OBJECT(client), "can-hibernate"); - } -#endif /* ENABLE_DEPRECATED */ - value = g_hash_table_lookup (props, "LidIsClosed"); if (value == NULL) { g_warning ("No 'LidIsClosed' property"); @@ -436,17 +256,6 @@ up_client_get_properties_sync (UpClient *client, GCancellable *cancellable, GErr g_object_notify (G_OBJECT(client), "is-docked"); } - value = g_hash_table_lookup (props, "LidForceSleep"); - if (value == NULL) { - g_warning ("No 'LidForceSleep' property"); - goto out; - } - prop_val = g_value_get_boolean (value); - if (prop_val != client->priv->lid_force_sleep) { - client->priv->lid_force_sleep = prop_val; - g_object_notify (G_OBJECT(client), "lid-force-sleep"); - } - /* cached */ client->priv->have_properties = TRUE; @@ -475,24 +284,6 @@ up_client_get_daemon_version (UpClient *client) } /** - * up_client_get_can_hibernate: - * @client: a #UpClient instance. - * - * Get whether the system is able to hibernate. - * - * Return value: TRUE if system can hibernate, FALSE other wise. - * - * Since: 0.9.0 - **/ -gboolean -up_client_get_can_hibernate (UpClient *client) -{ - g_return_val_if_fail (UP_IS_CLIENT (client), FALSE); - up_client_get_properties_sync (client, NULL, NULL); - return client->priv->can_hibernate; -} - -/** * up_client_get_lid_is_closed: * @client: a #UpClient instance. * @@ -529,24 +320,6 @@ up_client_get_lid_is_present (UpClient *client) } /** - * up_client_get_lid_force_sleep: - * @client: a #UpClient instance. - * - * Get whether the laptop has to sleep when the lid is closed. - * - * Return value: %TRUE if the session has to suspend - * - * Since: 0.9.9 - */ -gboolean -up_client_get_lid_force_sleep (UpClient *client) -{ - g_return_val_if_fail (UP_IS_CLIENT (client), FALSE); - up_client_get_properties_sync (client, NULL, NULL); - return client->priv->lid_force_sleep; -} - -/** * up_client_get_is_docked: * @client: a #UpClient instance. * @@ -565,24 +338,6 @@ up_client_get_is_docked (UpClient *client) } /** - * up_client_get_can_suspend: - * @client: a #UpClient instance. - * - * Get whether the system is able to suspend. - * - * Return value: TRUE if system can suspend, FALSE other wise. - * - * Since: 0.9.0 - **/ -gboolean -up_client_get_can_suspend (UpClient *client) -{ - g_return_val_if_fail (UP_IS_CLIENT (client), FALSE); - up_client_get_properties_sync (client, NULL, NULL); - return client->priv->can_suspend; -} - -/** * up_client_get_on_battery: * @client: a #UpClient instance. * @@ -671,26 +426,6 @@ up_device_changed_cb (DBusGProxy *proxy, const gchar *object_path, UpClient *cli } /* - * up_client_notify_sleep_cb: - */ -static void -up_client_notify_sleep_cb (DBusGProxy *proxy, const gchar *sleep_kind, UpClient *client) -{ - g_signal_emit (client, signals [UP_CLIENT_NOTIFY_SLEEP], 0, - up_sleep_kind_from_string (sleep_kind)); -} - -/* - * up_client_notify_resume_cb: - */ -static void -up_client_notify_resume_cb (DBusGProxy *proxy, const gchar *sleep_kind, UpClient *client) -{ - g_signal_emit (client, signals [UP_CLIENT_NOTIFY_RESUME], 0, - up_sleep_kind_from_string (sleep_kind)); -} - -/* * up_client_removed_cb: */ static void @@ -729,12 +464,6 @@ up_client_get_property (GObject *object, case PROP_DAEMON_VERSION: g_value_set_string (value, client->priv->daemon_version); break; - case PROP_CAN_SUSPEND: - g_value_set_boolean (value, client->priv->can_suspend); - break; - case PROP_CAN_HIBERNATE: - g_value_set_boolean (value, client->priv->can_hibernate); - break; case PROP_ON_BATTERY: g_value_set_boolean (value, client->priv->on_battery); break; @@ -747,9 +476,6 @@ up_client_get_property (GObject *object, case PROP_LID_IS_PRESENT: g_value_set_boolean (value, client->priv->lid_is_present); break; - case PROP_LID_FORCE_SLEEP: - g_value_set_boolean (value, client->priv->lid_force_sleep); - break; case PROP_IS_DOCKED: g_value_set_boolean (value, client->priv->is_docked); break; @@ -786,34 +512,6 @@ up_client_class_init (UpClientClass *klass) NULL, G_PARAM_READABLE)); /** - * UpClient:can-suspend: - * - * If the computer can suspend. - * - * Since: 0.9.0 - */ - g_object_class_install_property (object_class, - PROP_CAN_SUSPEND, - g_param_spec_boolean ("can-suspend", - "If the computer can suspend", - NULL, - FALSE, - G_PARAM_READABLE)); - /** - * UpClient:can-hibernate: - * - * If the computer can hibernate. - * - * Since: 0.9.0 - */ - g_object_class_install_property (object_class, - PROP_CAN_HIBERNATE, - g_param_spec_boolean ("can-hibernate", - "If the computer can hibernate", - NULL, - FALSE, - G_PARAM_READABLE)); - /** * UpClient:on-battery: * * If the computer is on battery power. @@ -871,21 +569,6 @@ up_client_class_init (UpClientClass *klass) G_PARAM_READABLE)); /** - * UpClient:lid-force-sleep: - * - * If a laptop has to sleep if the lid is closed. - * - * Since: 0.9.9 - */ - g_object_class_install_property (object_class, - PROP_LID_FORCE_SLEEP, - g_param_spec_boolean ("lid-force-sleep", - "If a laptop has to sleep on lid close", - NULL, - FALSE, - G_PARAM_READABLE)); - - /** * UpClient:is-docked: * * If the laptop is docked @@ -963,42 +646,6 @@ up_client_class_init (UpClientClass *klass) NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); - /** - * UpClient::notify-sleep: - * @client: the #UpClient instance that emitted the signal - * @sleep_kind: the #UpSleepKind - * - * The ::notify-sleep signal is emitted when system sleep is - * about to occur. Applications have about 1 second to do - * anything they need to do. There is no way to stop the sleep - * process. - * - * Since: 0.9.11 - **/ - signals [UP_CLIENT_NOTIFY_SLEEP] = - g_signal_new ("notify-sleep", - G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (UpClientClass, notify_sleep), - NULL, NULL, g_cclosure_marshal_VOID__UINT, - G_TYPE_NONE, 1, G_TYPE_UINT); - - /** - * UpClient::notify-resume: - * @client: the #UpClient instance that emitted the signal - * @sleep_kind: the #UpSleepKind - * - * The ::notify-resume signal is emitted when the system has - * resumed. - * - * Since: 0.9.11 - **/ - signals [UP_CLIENT_NOTIFY_RESUME] = - g_signal_new ("notify-resume", - G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (UpClientClass, notify_resume), - NULL, NULL, g_cclosure_marshal_VOID__UINT, - G_TYPE_NONE, 1, G_TYPE_UINT); - g_type_class_add_private (klass, sizeof (UpClientPrivate)); } @@ -1088,8 +735,6 @@ up_client_init (UpClient *client) dbus_g_proxy_add_signal (client->priv->proxy, "DeviceRemoved", G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_add_signal (client->priv->proxy, "DeviceChanged", G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_add_signal (client->priv->proxy, "Changed", G_TYPE_INVALID); - dbus_g_proxy_add_signal (client->priv->proxy, "NotifySleep", G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_add_signal (client->priv->proxy, "NotifyResume", G_TYPE_STRING, G_TYPE_INVALID); /* all callbacks */ dbus_g_proxy_connect_signal (client->priv->proxy, "DeviceAdded", @@ -1100,10 +745,6 @@ up_client_init (UpClient *client) G_CALLBACK (up_device_changed_cb), client, NULL); dbus_g_proxy_connect_signal (client->priv->proxy, "Changed", G_CALLBACK (up_client_changed_cb), client, NULL); - dbus_g_proxy_connect_signal (client->priv->proxy, "NotifySleep", - G_CALLBACK (up_client_notify_sleep_cb), client, NULL); - dbus_g_proxy_connect_signal (client->priv->proxy, "NotifyResume", - G_CALLBACK (up_client_notify_resume_cb), client, NULL); out: return; } diff --git a/libupower-glib/up-client.h b/libupower-glib/up-client.h index 17ec7ba..2da8c0c 100644 --- a/libupower-glib/up-client.h +++ b/libupower-glib/up-client.h @@ -60,12 +60,6 @@ typedef struct void (*device_removed) (UpClient *client, UpDevice *device); void (*changed) (UpClient *client); - /* FIXME: remove when we next break API */ - void (*notify_sleep) (UpClient *client, - UpSleepKind sleep_kind); - /* FIXME: remove when we next break API */ - void (*notify_resume) (UpClient *client, - UpSleepKind sleep_kind); /*< private >*/ /* Padding for future expansion */ void (*_up_client_reserved1) (void); @@ -89,32 +83,13 @@ gboolean up_client_get_properties_sync (UpClient *client, gboolean up_client_enumerate_devices_sync (UpClient *client, GCancellable *cancellable, GError **error); -#ifdef UPOWER_ENABLE_DEPRECATED -gboolean up_client_suspend_sync (UpClient *client, - GCancellable *cancellable, - GError **error); -gboolean up_client_about_to_sleep_sync (UpClient *client, - UpSleepKind sleep_kind, - GCancellable *cancellable, - GError **error); -gboolean up_client_hibernate_sync (UpClient *client, - GCancellable *cancellable, - GError **error); -#endif /* accessors */ GPtrArray *up_client_get_devices (UpClient *client); const gchar *up_client_get_daemon_version (UpClient *client); -#ifdef UPOWER_ENABLE_DEPRECATED -gboolean up_client_get_can_hibernate (UpClient *client); -#endif gboolean up_client_get_lid_is_closed (UpClient *client); gboolean up_client_get_lid_is_present (UpClient *client); -gboolean up_client_get_lid_force_sleep (UpClient *client); gboolean up_client_get_is_docked (UpClient *client); -#ifdef UPOWER_ENABLE_DEPRECATED -gboolean up_client_get_can_suspend (UpClient *client); -#endif gboolean up_client_get_on_battery (UpClient *client); gboolean up_client_get_on_low_battery (UpClient *client); diff --git a/libupower-glib/up-types.c b/libupower-glib/up-types.c index cc53391..4c063fb 100644 --- a/libupower-glib/up-types.c +++ b/libupower-glib/up-types.c @@ -270,56 +270,3 @@ up_qos_kind_from_string (const gchar *type) return UP_QOS_KIND_CPU_DMA; return UP_QOS_KIND_UNKNOWN; } - -/** - * up_sleep_kind_to_string: - * - * Converts a #UpSleepKind to a string. - * - * Return value: identifier string - * - * Since: 0.9.10 - **/ -const gchar * -up_sleep_kind_to_string (UpSleepKind sleep_kind_enum) -{ - const gchar *sleep_kind = NULL; - switch (sleep_kind_enum) { - case UP_SLEEP_KIND_SUSPEND: - sleep_kind = "suspend"; - break; - case UP_SLEEP_KIND_HIBERNATE: - sleep_kind = "hibernate"; - break; - case UP_SLEEP_KIND_HYBRID: - sleep_kind = "hybrid"; - break; - default: - sleep_kind = "unknown"; - break; - } - return sleep_kind; -} - -/** - * up_sleep_kind_from_string: - * - * Converts a string to a #UpSleepKind. - * - * Return value: enumerated value - * - * Since: 0.9.10 - **/ -UpSleepKind -up_sleep_kind_from_string (const gchar *sleep_kind) -{ - if (sleep_kind == NULL) - return UP_SLEEP_KIND_UNKNOWN; - if (g_strcmp0 (sleep_kind, "suspend") == 0) - return UP_SLEEP_KIND_SUSPEND; - if (g_strcmp0 (sleep_kind, "hibernate") == 0) - return UP_SLEEP_KIND_HIBERNATE; - if (g_strcmp0 (sleep_kind, "hybrid") == 0) - return UP_SLEEP_KIND_HYBRID; - return UP_SLEEP_KIND_UNKNOWN; -} diff --git a/libupower-glib/up-types.h b/libupower-glib/up-types.h index 083d3d9..01fd0b4 100644 --- a/libupower-glib/up-types.h +++ b/libupower-glib/up-types.h @@ -95,19 +95,6 @@ typedef enum { UP_QOS_KIND_LAST } UpQosKind; -/** - * UpSleepKind: - * - * The type of QOS request. - **/ -typedef enum { - UP_SLEEP_KIND_UNKNOWN, - UP_SLEEP_KIND_SUSPEND, - UP_SLEEP_KIND_HIBERNATE, - UP_SLEEP_KIND_HYBRID, - UP_SLEEP_KIND_LAST -} UpSleepKind; - const gchar *up_device_kind_to_string (UpDeviceKind type_enum); const gchar *up_device_state_to_string (UpDeviceState state_enum); const gchar *up_device_technology_to_string (UpDeviceTechnology technology_enum); @@ -116,8 +103,6 @@ UpDeviceState up_device_state_from_string (const gchar *state); UpDeviceTechnology up_device_technology_from_string (const gchar *technology); const gchar *up_qos_kind_to_string (UpQosKind type); UpQosKind up_qos_kind_from_string (const gchar *type); -const gchar *up_sleep_kind_to_string (UpSleepKind sleep_kind_enum); -UpSleepKind up_sleep_kind_from_string (const gchar *sleep_kind); G_END_DECLS |