mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-05 02:36:19 +01:00
GDBus: Add GDBusSignalFlags and use it in g_dbus_connection_signal_subscribe()
This is currently unused but will probably be useful in the future. For example, we could have a _ARG0_IS_PATH to specify that arg0 should be used for arg0path. This commit breaks API and ABI. Users of g_dbus_connection_signal_subscribe() will need to port to this new version. Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
parent
1a06bd8d3f
commit
4a1c5a1b98
@ -2379,6 +2379,7 @@ g_dbus_connection_call
|
|||||||
g_dbus_connection_call_finish
|
g_dbus_connection_call_finish
|
||||||
g_dbus_connection_call_sync
|
g_dbus_connection_call_sync
|
||||||
g_dbus_connection_emit_signal
|
g_dbus_connection_emit_signal
|
||||||
|
GDBusSignalFlags
|
||||||
GDBusSignalCallback
|
GDBusSignalCallback
|
||||||
g_dbus_connection_signal_subscribe
|
g_dbus_connection_signal_subscribe
|
||||||
g_dbus_connection_signal_unsubscribe
|
g_dbus_connection_signal_unsubscribe
|
||||||
|
@ -1398,6 +1398,7 @@ monitor_on_name_appeared (GDBusConnection *connection,
|
|||||||
NULL, /* any member */
|
NULL, /* any member */
|
||||||
opt_monitor_object_path,
|
opt_monitor_object_path,
|
||||||
NULL, /* arg0 */
|
NULL, /* arg0 */
|
||||||
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
monitor_signal_cb,
|
monitor_signal_cb,
|
||||||
NULL, /* user_data */
|
NULL, /* user_data */
|
||||||
NULL); /* user_data destroy notify */
|
NULL); /* user_data destroy notify */
|
||||||
|
@ -2901,6 +2901,7 @@ is_signal_data_for_name_lost_or_acquired (SignalData *signal_data)
|
|||||||
* @member: D-Bus signal name to match on or %NULL to match on all signals.
|
* @member: D-Bus signal name to match on or %NULL to match on all signals.
|
||||||
* @object_path: Object path to match on or %NULL to match on all object paths.
|
* @object_path: Object path to match on or %NULL to match on all object paths.
|
||||||
* @arg0: Contents of first string argument to match on or %NULL to match on all kinds of arguments.
|
* @arg0: Contents of first string argument to match on or %NULL to match on all kinds of arguments.
|
||||||
|
* @flags: Flags describing how to subscribe to the signal (currently unused).
|
||||||
* @callback: Callback to invoke when there is a signal matching the requested data.
|
* @callback: Callback to invoke when there is a signal matching the requested data.
|
||||||
* @user_data: User data to pass to @callback.
|
* @user_data: User data to pass to @callback.
|
||||||
* @user_data_free_func: Function to free @user_data with when subscription is removed or %NULL.
|
* @user_data_free_func: Function to free @user_data with when subscription is removed or %NULL.
|
||||||
@ -2932,6 +2933,7 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
|
|||||||
const gchar *member,
|
const gchar *member,
|
||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
const gchar *arg0,
|
const gchar *arg0,
|
||||||
|
GDBusSignalFlags flags,
|
||||||
GDBusSignalCallback callback,
|
GDBusSignalCallback callback,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GDestroyNotify user_data_free_func)
|
GDestroyNotify user_data_free_func)
|
||||||
|
@ -453,6 +453,7 @@ guint g_dbus_connection_signal_subscribe (GDBusConnection
|
|||||||
const gchar *member,
|
const gchar *member,
|
||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
const gchar *arg0,
|
const gchar *arg0,
|
||||||
|
GDBusSignalFlags flags,
|
||||||
GDBusSignalCallback callback,
|
GDBusSignalCallback callback,
|
||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GDestroyNotify user_data_free_func);
|
GDestroyNotify user_data_free_func);
|
||||||
|
@ -339,6 +339,7 @@ request_name_cb (GObject *source_object,
|
|||||||
"NameLost",
|
"NameLost",
|
||||||
"/org/freedesktop/DBus",
|
"/org/freedesktop/DBus",
|
||||||
client->name,
|
client->name,
|
||||||
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
on_name_lost_or_acquired,
|
on_name_lost_or_acquired,
|
||||||
client,
|
client,
|
||||||
NULL);
|
NULL);
|
||||||
@ -349,6 +350,7 @@ request_name_cb (GObject *source_object,
|
|||||||
"NameAcquired",
|
"NameAcquired",
|
||||||
"/org/freedesktop/DBus",
|
"/org/freedesktop/DBus",
|
||||||
client->name,
|
client->name,
|
||||||
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
on_name_lost_or_acquired,
|
on_name_lost_or_acquired,
|
||||||
client,
|
client,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -447,6 +447,7 @@ has_connection (Client *client)
|
|||||||
"NameOwnerChanged", /* signal */
|
"NameOwnerChanged", /* signal */
|
||||||
"/org/freedesktop/DBus", /* path */
|
"/org/freedesktop/DBus", /* path */
|
||||||
client->name,
|
client->name,
|
||||||
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
on_name_owner_changed,
|
on_name_owner_changed,
|
||||||
client,
|
client,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -1366,6 +1366,7 @@ async_initable_init_first (GAsyncInitable *initable)
|
|||||||
"PropertiesChanged",
|
"PropertiesChanged",
|
||||||
proxy->priv->object_path,
|
proxy->priv->object_path,
|
||||||
proxy->priv->interface_name,
|
proxy->priv->interface_name,
|
||||||
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
on_properties_changed,
|
on_properties_changed,
|
||||||
proxy,
|
proxy,
|
||||||
NULL);
|
NULL);
|
||||||
@ -1381,6 +1382,7 @@ async_initable_init_first (GAsyncInitable *initable)
|
|||||||
NULL, /* member */
|
NULL, /* member */
|
||||||
proxy->priv->object_path,
|
proxy->priv->object_path,
|
||||||
NULL, /* arg0 */
|
NULL, /* arg0 */
|
||||||
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
on_signal_received,
|
on_signal_received,
|
||||||
proxy,
|
proxy,
|
||||||
NULL);
|
NULL);
|
||||||
@ -1395,6 +1397,7 @@ async_initable_init_first (GAsyncInitable *initable)
|
|||||||
"NameOwnerChanged", /* signal name */
|
"NameOwnerChanged", /* signal name */
|
||||||
"/org/freedesktop/DBus", /* path */
|
"/org/freedesktop/DBus", /* path */
|
||||||
proxy->priv->name, /* arg0 */
|
proxy->priv->name, /* arg0 */
|
||||||
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
on_name_owner_changed,
|
on_name_owner_changed,
|
||||||
proxy,
|
proxy,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -1023,6 +1023,7 @@ g_dbus_message_header_field_get_type G_GNUC_CONST
|
|||||||
g_dbus_property_info_flags_get_type G_GNUC_CONST
|
g_dbus_property_info_flags_get_type G_GNUC_CONST
|
||||||
g_dbus_subtree_flags_get_type G_GNUC_CONST
|
g_dbus_subtree_flags_get_type G_GNUC_CONST
|
||||||
g_dbus_server_flags_get_type G_GNUC_CONST
|
g_dbus_server_flags_get_type G_GNUC_CONST
|
||||||
|
g_dbus_signal_flags_get_type G_GNUC_CONST
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1139,6 +1139,19 @@ typedef enum
|
|||||||
G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS = (1<<1)
|
G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS = (1<<1)
|
||||||
} GDBusServerFlags;
|
} GDBusServerFlags;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GDBusSignalFlags:
|
||||||
|
* @G_DBUS_SIGNAL_FLAGS_NONE: No flags set.
|
||||||
|
*
|
||||||
|
* Flags used when subscribing to signals via g_dbus_connection_signal_subscribe().
|
||||||
|
*
|
||||||
|
* Since: 2.26
|
||||||
|
*/
|
||||||
|
typedef enum /*< flags >*/
|
||||||
|
{
|
||||||
|
G_DBUS_SIGNAL_FLAGS_NONE = 0,
|
||||||
|
} GDBusSignalFlags;
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GIO_ENUMS_H__ */
|
#endif /* __GIO_ENUMS_H__ */
|
||||||
|
@ -415,6 +415,7 @@ test_connection_signals (void)
|
|||||||
"Foo",
|
"Foo",
|
||||||
"/org/gtk/GDBus/ExampleInterface",
|
"/org/gtk/GDBus/ExampleInterface",
|
||||||
NULL,
|
NULL,
|
||||||
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
test_connection_signal_handler,
|
test_connection_signal_handler,
|
||||||
&count_s1,
|
&count_s1,
|
||||||
NULL);
|
NULL);
|
||||||
@ -424,6 +425,7 @@ test_connection_signals (void)
|
|||||||
"Foo",
|
"Foo",
|
||||||
"/org/gtk/GDBus/ExampleInterface",
|
"/org/gtk/GDBus/ExampleInterface",
|
||||||
NULL,
|
NULL,
|
||||||
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
test_connection_signal_handler,
|
test_connection_signal_handler,
|
||||||
&count_s2,
|
&count_s2,
|
||||||
NULL);
|
NULL);
|
||||||
@ -433,6 +435,7 @@ test_connection_signals (void)
|
|||||||
"NameOwnerChanged", /* member */
|
"NameOwnerChanged", /* member */
|
||||||
"/org/freedesktop/DBus", /* path */
|
"/org/freedesktop/DBus", /* path */
|
||||||
NULL,
|
NULL,
|
||||||
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
test_connection_signal_handler,
|
test_connection_signal_handler,
|
||||||
&count_name_owner_changed,
|
&count_name_owner_changed,
|
||||||
NULL);
|
NULL);
|
||||||
@ -441,14 +444,15 @@ test_connection_signals (void)
|
|||||||
* subscriptions instead of just 1 call to each of the N subscriptions.
|
* subscriptions instead of just 1 call to each of the N subscriptions.
|
||||||
*/
|
*/
|
||||||
s1b = g_dbus_connection_signal_subscribe (c1,
|
s1b = g_dbus_connection_signal_subscribe (c1,
|
||||||
":1.2",
|
":1.2",
|
||||||
"org.gtk.GDBus.ExampleInterface",
|
"org.gtk.GDBus.ExampleInterface",
|
||||||
"Foo",
|
"Foo",
|
||||||
"/org/gtk/GDBus/ExampleInterface",
|
"/org/gtk/GDBus/ExampleInterface",
|
||||||
NULL,
|
NULL,
|
||||||
test_connection_signal_handler,
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
&count_s1b,
|
test_connection_signal_handler,
|
||||||
NULL);
|
&count_s1b,
|
||||||
|
NULL);
|
||||||
g_assert (s1 != 0);
|
g_assert (s1 != 0);
|
||||||
g_assert (s1b != 0);
|
g_assert (s1b != 0);
|
||||||
g_assert (s2 != 0);
|
g_assert (s2 != 0);
|
||||||
@ -712,6 +716,7 @@ test_connection_flush (void)
|
|||||||
"SomeSignal",
|
"SomeSignal",
|
||||||
"/org/gtk/GDBus/FlushObject",
|
"/org/gtk/GDBus/FlushObject",
|
||||||
NULL,
|
NULL,
|
||||||
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
test_connection_flush_signal_handler,
|
test_connection_flush_signal_handler,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -197,6 +197,7 @@ test_delivery_in_thread_func (gpointer _data)
|
|||||||
"NameOwnerChanged", /* member */
|
"NameOwnerChanged", /* member */
|
||||||
"/org/freedesktop/DBus", /* path */
|
"/org/freedesktop/DBus", /* path */
|
||||||
NULL,
|
NULL,
|
||||||
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
signal_handler,
|
signal_handler,
|
||||||
&data,
|
&data,
|
||||||
NULL);
|
NULL);
|
||||||
|
@ -553,6 +553,7 @@ test_change_action_on_application_appeared (void)
|
|||||||
"ActionsChanged",
|
"ActionsChanged",
|
||||||
"/org/gtk/test/app",
|
"/org/gtk/test/app",
|
||||||
NULL,
|
NULL,
|
||||||
|
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||||
actions_changed,
|
actions_changed,
|
||||||
loop,
|
loop,
|
||||||
NULL);
|
NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user