diff options
author | Bastien Nocera <hadess@hadess.net> | 2021-04-22 13:01:32 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2021-04-22 15:17:49 +0200 |
commit | f8b89ffd3a7396c08614b7ddb538fff4922f6948 (patch) | |
tree | a65083d18a382f75a18bbe194fa4cf467efc9d16 | |
parent | 06034e1411b8a10d677f683aabd3b4c1bb7d3dc4 (diff) | |
download | upower-f8b89ffd3a7396c08614b7ddb538fff4922f6948.tar.gz |
main: Remove Refresh() D-Bus method
The Refresh D-Bus method could be used by clients to force re-reading
the state of batteries in the upower backends. This is not needed as
all the backends should be sending events when their states changes,
removing the need for an explicit refresh.
This is also a potential security problem if applications keep on
refreshing their data.
This version of the removal changes the ABI by removing a function from
the client library.
-rw-r--r-- | dbus/org.freedesktop.UPower.Device.xml | 16 | ||||
-rw-r--r-- | libupower-glib/up-device.c | 22 | ||||
-rw-r--r-- | libupower-glib/up-device.h | 3 | ||||
-rw-r--r-- | src/up-device.c | 17 |
4 files changed, 0 insertions, 58 deletions
diff --git a/dbus/org.freedesktop.UPower.Device.xml b/dbus/org.freedesktop.UPower.Device.xml index 4f042c1..fa9b576 100644 --- a/dbus/org.freedesktop.UPower.Device.xml +++ b/dbus/org.freedesktop.UPower.Device.xml @@ -138,22 +138,6 @@ method return sender=:1.386 -> dest=:1.477 reply_serial=2 <!-- ************************************************************ --> - <method name="Refresh"> - <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> - <doc:doc> - <doc:description> - <doc:para> - Refreshes the data collected from the power source. - </doc:para> - </doc:description> - <doc:permission>Callers need the org.freedesktop.upower.refresh-power-source authorization</doc:permission> - <doc:errors> - <doc:error name="&ERROR_GENERAL;">if an error occured while refreshing</doc:error> - </doc:errors> - </doc:doc> - </method> - - <!-- ************************************************************ --> <method name="GetHistory"> <annotation name="org.freedesktop.DBus.GLib.Async" value=""/> <arg name="type" direction="in" type="s"> diff --git a/libupower-glib/up-device.c b/libupower-glib/up-device.c index 36fda27..9f619ab 100644 --- a/libupower-glib/up-device.c +++ b/libupower-glib/up-device.c @@ -395,28 +395,6 @@ up_device_to_text (UpDevice *device) } /** - * up_device_refresh_sync: - * @device: a #UpDevice instance. - * @cancellable: a #GCancellable or %NULL - * @error: a #GError, or %NULL. - * - * Refreshes properties on the device. - * This function is normally not required. - * - * Return value: #TRUE for success, else #FALSE and @error is used - * - * Since: 0.9.0 - **/ -gboolean -up_device_refresh_sync (UpDevice *device, GCancellable *cancellable, GError **error) -{ - g_return_val_if_fail (UP_IS_DEVICE (device), FALSE); - g_return_val_if_fail (device->priv->proxy_device != NULL, FALSE); - - return up_exported_device_call_refresh_sync (device->priv->proxy_device, cancellable, error); -} - -/** * up_device_get_history_sync: * @device: a #UpDevice instance. * @type: The type of history, known values are "rate" and "charge". diff --git a/libupower-glib/up-device.h b/libupower-glib/up-device.h index 22d168a..0eec849 100644 --- a/libupower-glib/up-device.h +++ b/libupower-glib/up-device.h @@ -69,9 +69,6 @@ UpDevice *up_device_new (void); gchar *up_device_to_text (UpDevice *device); /* sync versions */ -gboolean up_device_refresh_sync (UpDevice *device, - GCancellable *cancellable, - GError **error); gboolean up_device_set_object_path_sync (UpDevice *device, const gchar *object_path, GCancellable *cancellable, diff --git a/src/up-device.c b/src/up-device.c index 37ec129..53ce1a0 100644 --- a/src/up-device.c +++ b/src/up-device.c @@ -618,21 +618,6 @@ out: } /** - * up_device_refresh: - * - * Return %TRUE on success, %FALSE if we failed to refresh or no data - **/ -static gboolean -up_device_refresh (UpExportedDevice *skeleton, - GDBusMethodInvocation *invocation, - UpDevice *device) -{ - up_device_refresh_internal (device); - up_exported_device_complete_refresh (skeleton, invocation); - return TRUE; -} - -/** * up_device_register_display_device: **/ gboolean @@ -720,8 +705,6 @@ up_device_init (UpDevice *device) G_CALLBACK (up_device_get_history), device); g_signal_connect (device, "handle-get-statistics", G_CALLBACK (up_device_get_statistics), device); - g_signal_connect (device, "handle-refresh", - G_CALLBACK (up_device_refresh), device); } /** |