mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
introspect: improve instrospection
Pass changed properties around so that we can print them
This commit is contained in:
parent
51f18b540a
commit
8361f74646
8 changed files with 110 additions and 59 deletions
|
|
@ -92,26 +92,27 @@ subscription_set_state (PinosSubscribe *subscribe,
|
|||
static void
|
||||
notify_event (PinosSubscribe *subscribe,
|
||||
PinosObjectData *data,
|
||||
PinosSubscriptionEvent event)
|
||||
PinosSubscriptionEvent event,
|
||||
GStrv properties)
|
||||
{
|
||||
const gchar *interface_name;
|
||||
PinosSubscriptionFlags flags = 0;
|
||||
|
||||
interface_name = g_dbus_proxy_get_interface_name (data->proxy);
|
||||
if (g_strcmp0 (interface_name, "org.pinos.Daemon1") == 0) {
|
||||
flags = PINOS_SUBSCRIPTION_FLAGS_DAEMON;
|
||||
flags = PINOS_SUBSCRIPTION_FLAG_DAEMON;
|
||||
}
|
||||
else if (g_strcmp0 (interface_name, "org.pinos.Client1") == 0) {
|
||||
flags = PINOS_SUBSCRIPTION_FLAGS_CLIENT;
|
||||
flags = PINOS_SUBSCRIPTION_FLAG_CLIENT;
|
||||
}
|
||||
else if (g_strcmp0 (interface_name, "org.pinos.Source1") == 0) {
|
||||
flags = PINOS_SUBSCRIPTION_FLAGS_SOURCE;
|
||||
flags = PINOS_SUBSCRIPTION_FLAG_SOURCE;
|
||||
}
|
||||
else if (g_strcmp0 (interface_name, "org.pinos.SourceOutput1") == 0) {
|
||||
flags = PINOS_SUBSCRIPTION_FLAGS_SOURCE_OUTPUT;
|
||||
flags = PINOS_SUBSCRIPTION_FLAG_SOURCE_OUTPUT;
|
||||
}
|
||||
g_signal_emit (subscribe, signals[SIGNAL_SUBSCRIPTION_EVENT], 0,
|
||||
event, flags, data->proxy);
|
||||
event, flags, data->proxy, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -121,8 +122,22 @@ on_proxy_properties_changed (GDBusProxy *proxy,
|
|||
gpointer user_data)
|
||||
{
|
||||
PinosObjectData *data = user_data;
|
||||
GPtrArray *ptr;
|
||||
GVariantIter iter;
|
||||
GVariant *value;
|
||||
gchar *key;
|
||||
|
||||
notify_event (data->subscribe, data, PINOS_SUBSCRIPTION_EVENT_CHANGE);
|
||||
ptr = g_ptr_array_new_with_free_func (g_free);
|
||||
g_variant_iter_init (&iter, changed_properties);
|
||||
while (g_variant_iter_loop (&iter, "{sv}", &key, &value)) {
|
||||
g_ptr_array_add (ptr, g_strdup (key));
|
||||
}
|
||||
g_ptr_array_add (ptr, NULL);
|
||||
|
||||
notify_event (data->subscribe, data, PINOS_SUBSCRIPTION_EVENT_CHANGE,
|
||||
(gchar **) ptr->pdata);
|
||||
|
||||
g_ptr_array_free (ptr, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -143,7 +158,7 @@ remove_data (PinosSubscribe *subscribe,
|
|||
if (data->pending) {
|
||||
data->removed = TRUE;
|
||||
} else {
|
||||
notify_event (subscribe, data, PINOS_SUBSCRIPTION_EVENT_REMOVE);
|
||||
notify_event (subscribe, data, PINOS_SUBSCRIPTION_EVENT_REMOVE, NULL);
|
||||
object_data_free (data);
|
||||
}
|
||||
}
|
||||
|
|
@ -189,7 +204,7 @@ on_proxy_created (GObject *source_object,
|
|||
(GCallback) on_proxy_properties_changed,
|
||||
data);
|
||||
|
||||
notify_event (subscribe, data, PINOS_SUBSCRIPTION_EVENT_NEW);
|
||||
notify_event (subscribe, data, PINOS_SUBSCRIPTION_EVENT_NEW, NULL);
|
||||
|
||||
for (walk = data->tasks; walk; walk = g_list_next (walk)) {
|
||||
GTask *task = walk->data;
|
||||
|
|
@ -636,6 +651,8 @@ pinos_subscribe_class_init (PinosSubscribeClass * klass)
|
|||
* @event: A #PinosSubscriptionEvent
|
||||
* @flags: #PinosSubscriptionFlags indicating the object
|
||||
* @id: the unique and opaque object id
|
||||
* @properties: extra properties that changed or %NULL when all properties
|
||||
* are affected (new or remove)
|
||||
*
|
||||
* Notify about a new object that was added/removed/modified.
|
||||
*/
|
||||
|
|
@ -647,10 +664,11 @@ pinos_subscribe_class_init (PinosSubscribeClass * klass)
|
|||
NULL,
|
||||
g_cclosure_marshal_generic,
|
||||
G_TYPE_NONE,
|
||||
3,
|
||||
4,
|
||||
PINOS_TYPE_SUBSCRIPTION_EVENT,
|
||||
PINOS_TYPE_SUBSCRIPTION_FLAGS,
|
||||
G_TYPE_POINTER);
|
||||
G_TYPE_POINTER,
|
||||
G_TYPE_STRV);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue