mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-03 21:48:20 +02:00
all: Remove *changed signals
Now that we send out PropertiesChanged signals (on the daemon side) and "notify" signals (on the client side), there's no need for the all encompassing DeviceChanged and Changed signals. They would have woken up any client, even if they were not interested in receiving the signals.
This commit is contained in:
parent
8453da5014
commit
0010e93251
8 changed files with 2 additions and 172 deletions
|
|
@ -59,9 +59,7 @@ struct _UpClientPrivate
|
|||
|
||||
enum {
|
||||
UP_CLIENT_DEVICE_ADDED,
|
||||
UP_CLIENT_DEVICE_CHANGED,
|
||||
UP_CLIENT_DEVICE_REMOVED,
|
||||
UP_CLIENT_CHANGED,
|
||||
UP_CLIENT_LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
|
@ -307,18 +305,6 @@ up_device_added_cb (UpClientGlue *proxy, const gchar *object_path, UpClient *cli
|
|||
up_client_add (client, object_path);
|
||||
}
|
||||
|
||||
/*
|
||||
* up_client_changed_cb:
|
||||
*/
|
||||
static void
|
||||
up_device_changed_cb (UpClientGlue *proxy, const gchar *object_path, UpClient *client)
|
||||
{
|
||||
UpDevice *device;
|
||||
device = up_client_get_device (client, object_path);
|
||||
if (device != NULL)
|
||||
g_signal_emit (client, signals [UP_CLIENT_DEVICE_CHANGED], 0, device);
|
||||
}
|
||||
|
||||
/*
|
||||
* up_client_removed_cb:
|
||||
*/
|
||||
|
|
@ -333,15 +319,6 @@ up_device_removed_cb (UpClientGlue *proxy, const gchar *object_path, UpClient *c
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* up_client_changed_cb:
|
||||
*/
|
||||
static void
|
||||
up_client_changed_cb (UpClientGlue *proxy, UpClient *client)
|
||||
{
|
||||
g_signal_emit (client, signals [UP_CLIENT_CHANGED], 0);
|
||||
}
|
||||
|
||||
static void
|
||||
up_client_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
|
|
@ -489,37 +466,6 @@ up_client_class_init (UpClientClass *klass)
|
|||
NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, UP_TYPE_DEVICE);
|
||||
|
||||
/**
|
||||
* UpClient::device-changed:
|
||||
* @client: the #UpClient instance that emitted the signal
|
||||
* @device: the #UpDevice that was changed.
|
||||
*
|
||||
* The ::device-changed signal is emitted when a power device is changed.
|
||||
*
|
||||
* Since: 0.9.0
|
||||
**/
|
||||
signals [UP_CLIENT_DEVICE_CHANGED] =
|
||||
g_signal_new ("device-changed",
|
||||
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (UpClientClass, device_changed),
|
||||
NULL, NULL, g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1, UP_TYPE_DEVICE);
|
||||
|
||||
/**
|
||||
* UpClient::changed:
|
||||
* @client: the #UpClient instance that emitted the signal
|
||||
*
|
||||
* The ::changed signal is emitted when properties may have changed.
|
||||
*
|
||||
* Since: 0.9.0
|
||||
**/
|
||||
signals [UP_CLIENT_CHANGED] =
|
||||
g_signal_new ("changed",
|
||||
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (UpClientClass, changed),
|
||||
NULL, NULL, g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_type_class_add_private (klass, sizeof (UpClientPrivate));
|
||||
}
|
||||
|
||||
|
|
@ -595,11 +541,6 @@ up_client_init (UpClient *client)
|
|||
G_CALLBACK (up_device_added_cb), client);
|
||||
g_signal_connect (client->priv->proxy, "device-removed",
|
||||
G_CALLBACK (up_device_removed_cb), client);
|
||||
g_signal_connect (client->priv->proxy, "device-changed",
|
||||
G_CALLBACK (up_device_changed_cb), client);
|
||||
g_signal_connect (client->priv->proxy, "changed",
|
||||
G_CALLBACK (up_client_changed_cb), client);
|
||||
|
||||
g_signal_connect (client->priv->proxy, "notify",
|
||||
G_CALLBACK (up_client_notify_cb), client);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,11 +55,8 @@ typedef struct
|
|||
GObjectClass parent_class;
|
||||
void (*device_added) (UpClient *client,
|
||||
UpDevice *device);
|
||||
void (*device_changed) (UpClient *client,
|
||||
UpDevice *device);
|
||||
void (*device_removed) (UpClient *client,
|
||||
UpDevice *device);
|
||||
void (*changed) (UpClient *client);
|
||||
/*< private >*/
|
||||
/* Padding for future expansion */
|
||||
void (*_up_client_reserved1) (void);
|
||||
|
|
|
|||
|
|
@ -94,13 +94,6 @@ enum {
|
|||
PROP_LAST
|
||||
};
|
||||
|
||||
enum {
|
||||
SIGNAL_CHANGED,
|
||||
SIGNAL_LAST
|
||||
};
|
||||
|
||||
static guint signals [SIGNAL_LAST] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE (UpDevice, up_device, G_TYPE_OBJECT)
|
||||
|
||||
/*
|
||||
|
|
@ -109,8 +102,6 @@ G_DEFINE_TYPE (UpDevice, up_device, G_TYPE_OBJECT)
|
|||
static void
|
||||
up_device_changed_cb (UpDeviceGlue *proxy, GParamSpec *pspec, UpDevice *device)
|
||||
{
|
||||
g_return_if_fail (UP_IS_DEVICE (device));
|
||||
g_signal_emit (device, signals [SIGNAL_CHANGED], 0);
|
||||
g_object_notify (device, pspec->name);
|
||||
}
|
||||
|
||||
|
|
@ -790,21 +781,6 @@ up_device_class_init (UpDeviceClass *klass)
|
|||
object_class->set_property = up_device_set_property;
|
||||
object_class->get_property = up_device_get_property;
|
||||
|
||||
/**
|
||||
* UpDevice::changed:
|
||||
* @device: the #UpDevice instance that emitted the signal
|
||||
*
|
||||
* The ::changed signal is emitted when the device data has changed.
|
||||
*
|
||||
* Since: 0.9.0
|
||||
**/
|
||||
signals [SIGNAL_CHANGED] =
|
||||
g_signal_new ("changed",
|
||||
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
|
||||
G_STRUCT_OFFSET (UpDeviceClass, changed),
|
||||
NULL, NULL, g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* UpDevice:update-time:
|
||||
*
|
||||
|
|
|
|||
|
|
@ -53,8 +53,6 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
void (*changed) (UpDevice *device,
|
||||
gpointer *obj);
|
||||
/*< private >*/
|
||||
/* Padding for future expansion */
|
||||
void (*_up_device_reserved1) (void);
|
||||
|
|
|
|||
|
|
@ -153,17 +153,6 @@ method return sender=:1.386 -> dest=:1.477 reply_serial=2
|
|||
</doc:doc>
|
||||
</method>
|
||||
|
||||
<!-- ************************************************************ -->
|
||||
<signal name="Changed">
|
||||
<doc:doc>
|
||||
<doc:description>
|
||||
<doc:para>
|
||||
Some value on the power source changed.
|
||||
</doc:para>
|
||||
</doc:description>
|
||||
</doc:doc>
|
||||
</signal>
|
||||
|
||||
<!-- ************************************************************ -->
|
||||
<method name="GetHistory">
|
||||
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
|
||||
|
|
|
|||
|
|
@ -166,34 +166,6 @@ method return sender=:1.386 -> dest=:1.451 reply_serial=2
|
|||
|
||||
<!-- ************************************************************ -->
|
||||
|
||||
<signal name="DeviceChanged">
|
||||
<arg name="device" type="o">
|
||||
<doc:doc><doc:summary>Object path of device that was changed.</doc:summary></doc:doc>
|
||||
</arg>
|
||||
|
||||
<doc:doc>
|
||||
<doc:description>
|
||||
<doc:para>
|
||||
Emitted when a device changed.
|
||||
</doc:para>
|
||||
</doc:description>
|
||||
</doc:doc>
|
||||
</signal>
|
||||
|
||||
<!-- ************************************************************ -->
|
||||
|
||||
<signal name="Changed">
|
||||
<doc:doc>
|
||||
<doc:description>
|
||||
<doc:para>
|
||||
Emitted when one or more properties on the object changes.
|
||||
</doc:para>
|
||||
</doc:description>
|
||||
</doc:doc>
|
||||
</signal>
|
||||
|
||||
<!-- ************************************************************ -->
|
||||
|
||||
<property name="DaemonVersion" type="s" access="read">
|
||||
<doc:doc><doc:description><doc:para>
|
||||
Version of the running daemon, e.g. <doc:tt>002</doc:tt>.
|
||||
|
|
|
|||
|
|
@ -57,8 +57,6 @@ enum
|
|||
{
|
||||
SIGNAL_DEVICE_ADDED,
|
||||
SIGNAL_DEVICE_REMOVED,
|
||||
SIGNAL_DEVICE_CHANGED,
|
||||
SIGNAL_CHANGED,
|
||||
SIGNAL_LAST,
|
||||
};
|
||||
|
||||
|
|
@ -642,10 +640,6 @@ changed_props_idle_cb (gpointer user_data)
|
|||
{
|
||||
UpDaemon *daemon = user_data;
|
||||
|
||||
/* GObject */
|
||||
g_debug ("emitting changed");
|
||||
g_signal_emit (daemon, signals[SIGNAL_CHANGED], 0);
|
||||
|
||||
/* D-Bus */
|
||||
up_daemon_emit_properties_changed (daemon->priv->connection,
|
||||
"/org/freedesktop/UPower",
|
||||
|
|
@ -889,7 +883,7 @@ up_daemon_poll_battery_devices_for_a_little_bit (UpDaemon *daemon)
|
|||
* up_daemon_device_changed_cb:
|
||||
**/
|
||||
static void
|
||||
up_daemon_device_changed_cb (UpDevice *device, UpDaemon *daemon)
|
||||
up_daemon_device_changed_cb (UpDevice *device, GParamSpec *pspec, UpDaemon *daemon)
|
||||
{
|
||||
const gchar *object_path;
|
||||
UpDeviceKind type;
|
||||
|
|
@ -928,7 +922,6 @@ up_daemon_device_changed_cb (UpDevice *device, UpDaemon *daemon)
|
|||
g_warning ("INTERNAL STATE CORRUPT: not sending NULL, device:%p", device);
|
||||
return;
|
||||
}
|
||||
g_signal_emit (daemon, signals[SIGNAL_DEVICE_CHANGED], 0, object_path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -949,7 +942,7 @@ up_daemon_device_added_cb (UpBackend *backend, GObject *native, UpDevice *device
|
|||
up_device_list_insert (priv->power_devices, native, G_OBJECT (device));
|
||||
|
||||
/* connect, so we get changes */
|
||||
g_signal_connect (device, "changed",
|
||||
g_signal_connect (device, "notify",
|
||||
G_CALLBACK (up_daemon_device_changed_cb), daemon);
|
||||
|
||||
/* refresh after a short delay */
|
||||
|
|
@ -1169,22 +1162,6 @@ up_daemon_class_init (UpDaemonClass *klass)
|
|||
g_cclosure_marshal_generic,
|
||||
G_TYPE_NONE, 1, DBUS_TYPE_G_OBJECT_PATH);
|
||||
|
||||
signals[SIGNAL_DEVICE_CHANGED] =
|
||||
g_signal_new ("device-changed",
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_generic,
|
||||
G_TYPE_NONE, 1, DBUS_TYPE_G_OBJECT_PATH);
|
||||
|
||||
signals[SIGNAL_CHANGED] =
|
||||
g_signal_new ("changed",
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_DAEMON_VERSION,
|
||||
g_param_spec_string ("daemon-version",
|
||||
|
|
|
|||
|
|
@ -119,13 +119,6 @@ enum {
|
|||
PROP_LAST
|
||||
};
|
||||
|
||||
enum {
|
||||
SIGNAL_CHANGED,
|
||||
SIGNAL_LAST,
|
||||
};
|
||||
|
||||
static guint signals[SIGNAL_LAST] = { 0 };
|
||||
|
||||
G_DEFINE_TYPE (UpDevice, up_device, G_TYPE_OBJECT)
|
||||
#define UP_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UP_TYPE_DEVICE, UpDevicePrivate))
|
||||
#define UP_DBUS_STRUCT_UINT_DOUBLE_UINT (dbus_g_type_get_struct ("GValueArray", \
|
||||
|
|
@ -1005,11 +998,6 @@ up_device_perhaps_changed_cb (GObject *object, GParamSpec *pspec, UpDevice *devi
|
|||
up_history_set_rate_data (device->priv->history, device->priv->energy_rate);
|
||||
up_history_set_time_full_data (device->priv->history, device->priv->time_to_full);
|
||||
up_history_set_time_empty_data (device->priv->history, device->priv->time_to_empty);
|
||||
|
||||
/* The order here matters; we want Device::Changed() before
|
||||
* the DeviceChanged() signal on the main object */
|
||||
g_debug ("emitting changed on %s", device->priv->native_path);
|
||||
g_signal_emit (device, signals[SIGNAL_CHANGED], 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1071,14 +1059,6 @@ up_device_class_init (UpDeviceClass *klass)
|
|||
|
||||
g_type_class_add_private (klass, sizeof (UpDevicePrivate));
|
||||
|
||||
signals[SIGNAL_CHANGED] =
|
||||
g_signal_new ("changed",
|
||||
G_OBJECT_CLASS_TYPE (klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
|
||||
0, NULL, NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
dbus_g_object_type_install_info (UP_TYPE_DEVICE, &dbus_glib_up_device_object_info);
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue