mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-13 03:51:41 +00:00
Emit a FwupdClient::changed when the daemon emits this signal
This commit is contained in:
parent
c8a60c9073
commit
ac97288ddb
@ -49,6 +49,7 @@ typedef struct {
|
|||||||
} FwupdClientPrivate;
|
} FwupdClientPrivate;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
SIGNAL_CHANGED,
|
||||||
SIGNAL_STATUS_CHANGED,
|
SIGNAL_STATUS_CHANGED,
|
||||||
SIGNAL_LAST
|
SIGNAL_LAST
|
||||||
};
|
};
|
||||||
@ -103,14 +104,15 @@ fwupd_client_helper_new (void)
|
|||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FwupdClientHelper, fwupd_client_helper_free)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(FwupdClientHelper, fwupd_client_helper_free)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fwupd_client_status_changed_cb:
|
* fwupd_client_properties_changed_cb:
|
||||||
**/
|
**/
|
||||||
static void
|
static void
|
||||||
fwupd_client_status_changed_cb (GDBusProxy *proxy, GVariant *changed_properties,
|
fwupd_client_properties_changed_cb (GDBusProxy *proxy,
|
||||||
GStrv invalidated_properties, gpointer user_data)
|
GVariant *changed_properties,
|
||||||
|
GStrv invalidated_properties,
|
||||||
|
FwupdClient *client)
|
||||||
{
|
{
|
||||||
g_autoptr(GVariant) val = NULL;
|
g_autoptr(GVariant) val = NULL;
|
||||||
FwupdClient *client = FWUPD_CLIENT (user_data);
|
|
||||||
FwupdClientPrivate *priv = GET_PRIVATE (client);
|
FwupdClientPrivate *priv = GET_PRIVATE (client);
|
||||||
|
|
||||||
/* print to the console */
|
/* print to the console */
|
||||||
@ -122,6 +124,20 @@ fwupd_client_status_changed_cb (GDBusProxy *proxy, GVariant *changed_properties,
|
|||||||
g_signal_emit (client, signals[SIGNAL_STATUS_CHANGED], 0, priv->status);
|
g_signal_emit (client, signals[SIGNAL_STATUS_CHANGED], 0, priv->status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fwupd_client_signal_cb:
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
fwupd_client_signal_cb (GDBusProxy *proxy,
|
||||||
|
const gchar *sender_name,
|
||||||
|
const gchar *signal_name,
|
||||||
|
GVariant *parameters,
|
||||||
|
FwupdClient *client)
|
||||||
|
{
|
||||||
|
g_debug ("Emitting ::changed()");
|
||||||
|
g_signal_emit (client, signals[SIGNAL_CHANGED], 0);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fwupd_client_startup:
|
* fwupd_client_startup:
|
||||||
**/
|
**/
|
||||||
@ -151,7 +167,9 @@ fwupd_client_startup (FwupdClient *client, GCancellable *cancellable, GError **e
|
|||||||
if (priv->proxy == NULL)
|
if (priv->proxy == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
g_signal_connect (priv->proxy, "g-properties-changed",
|
g_signal_connect (priv->proxy, "g-properties-changed",
|
||||||
G_CALLBACK (fwupd_client_status_changed_cb), client);
|
G_CALLBACK (fwupd_client_properties_changed_cb), client);
|
||||||
|
g_signal_connect (priv->proxy, "g-signal",
|
||||||
|
G_CALLBACK (fwupd_client_signal_cb), client);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -809,13 +827,29 @@ fwupd_client_class_init (FwupdClientClass *klass)
|
|||||||
object_class->get_property = fwupd_client_get_property;
|
object_class->get_property = fwupd_client_get_property;
|
||||||
object_class->set_property = fwupd_client_set_property;
|
object_class->set_property = fwupd_client_set_property;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* AsStore::changed:
|
||||||
|
* @client: the #FwupdClient instance that emitted the signal
|
||||||
|
*
|
||||||
|
* The ::changed signal is emitted when the daemon internal has
|
||||||
|
* changed, for instance when a device has been added or removed.
|
||||||
|
*
|
||||||
|
* Since: 0.7.0
|
||||||
|
**/
|
||||||
|
signals [SIGNAL_CHANGED] =
|
||||||
|
g_signal_new ("changed",
|
||||||
|
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
|
||||||
|
G_STRUCT_OFFSET (FwupdClientClass, changed),
|
||||||
|
NULL, NULL, g_cclosure_marshal_VOID__VOID,
|
||||||
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AsStore::state-changed:
|
* AsStore::state-changed:
|
||||||
* @client: the #FwupdClient instance that emitted the signal
|
* @client: the #FwupdClient instance that emitted the signal
|
||||||
* @status: the #FwupdStatus
|
* @status: the #FwupdStatus
|
||||||
*
|
*
|
||||||
* The ::state-changed signal is emitted when the daemon state has
|
* The ::state-changed signal is emitted when the daemon status has
|
||||||
* changed.
|
* changed, e.g. going from %FWUPD_STATUS_IDLE to %FWUPD_STATUS_DEVICE_WRITE.
|
||||||
*
|
*
|
||||||
* Since: 0.7.0
|
* Since: 0.7.0
|
||||||
**/
|
**/
|
||||||
|
@ -36,6 +36,7 @@ G_DECLARE_DERIVABLE_TYPE (FwupdClient, fwupd_client, FWUPD, CLIENT, GObject)
|
|||||||
struct _FwupdClientClass
|
struct _FwupdClientClass
|
||||||
{
|
{
|
||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
|
void (*changed) (FwupdClient *client);
|
||||||
void (*status_changed) (FwupdClient *client,
|
void (*status_changed) (FwupdClient *client,
|
||||||
FwupdStatus status);
|
FwupdStatus status);
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
|
Loading…
Reference in New Issue
Block a user