mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-19 07:00:10 -05:00
Add object paths to introspection
Clean up headers, avoid exposing DBus api. Remove notify should not have property changes
This commit is contained in:
parent
e61cbb3931
commit
b0e4cb4288
13 changed files with 58 additions and 48 deletions
|
|
@ -21,7 +21,6 @@
|
|||
#define __PINOS_CONTEXT_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include <client/subscribe.h>
|
||||
#include <client/properties.h>
|
||||
|
|
|
|||
|
|
@ -87,6 +87,8 @@ daemon_fill_info (PinosDaemonInfo *info, GDBusProxy *proxy)
|
|||
GHashTable *changed = g_object_get_data (G_OBJECT (proxy), "pinos-changed-properties");
|
||||
|
||||
info->id = proxy;
|
||||
info->daemon_path = g_dbus_proxy_get_object_path (proxy);
|
||||
|
||||
info->change_mask = 0;
|
||||
SET_STRING ("UserName", user_name, 0);
|
||||
SET_STRING ("HostName", host_name, 1);
|
||||
|
|
@ -140,6 +142,8 @@ client_fill_info (PinosClientInfo *info, GDBusProxy *proxy)
|
|||
GHashTable *changed = g_object_get_data (G_OBJECT (proxy), "pinos-changed-properties");
|
||||
|
||||
info->id = proxy;
|
||||
info->client_path = g_dbus_proxy_get_object_path (proxy);
|
||||
|
||||
info->change_mask = 0;
|
||||
SET_STRING ("Name", name, 0);
|
||||
SET_PROPERTIES ("Properties", properties, 1);
|
||||
|
|
@ -327,6 +331,7 @@ source_output_fill_info (PinosSourceOutputInfo *info, GDBusProxy *proxy)
|
|||
GHashTable *changed = g_object_get_data (G_OBJECT (proxy), "pinos-changed-properties");
|
||||
|
||||
info->id = proxy;
|
||||
info->output_path = g_dbus_proxy_get_object_path (proxy);
|
||||
|
||||
info->change_mask = 0;
|
||||
SET_STRING ("Client", client_path, 0);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ G_BEGIN_DECLS
|
|||
/**
|
||||
* PinosDaemonInfo:
|
||||
* @id: generic id of the daemon
|
||||
* @daemon-path: unique path of the daemon
|
||||
* @change_mask: bitfield of changed fields since last call
|
||||
* @user_name: name of the user that started the daemon
|
||||
* @host_name: name of the machine the daemon is running on
|
||||
|
|
@ -44,6 +45,7 @@ G_BEGIN_DECLS
|
|||
*/
|
||||
typedef struct {
|
||||
gpointer id;
|
||||
const char *daemon_path;
|
||||
guint64 change_mask;
|
||||
const char *user_name;
|
||||
const char *host_name;
|
||||
|
|
@ -68,6 +70,7 @@ void pinos_context_get_daemon_info (PinosContext *context,
|
|||
/**
|
||||
* PinosClientInfo:
|
||||
* @id: generic id of the client
|
||||
* @client_path: unique path of the client
|
||||
* @change_mask: bitfield of changed fields since last call
|
||||
* @name: name of client
|
||||
* @properties: extra properties
|
||||
|
|
@ -77,6 +80,7 @@ void pinos_context_get_daemon_info (PinosContext *context,
|
|||
*/
|
||||
typedef struct {
|
||||
gpointer id;
|
||||
const char *client_path;
|
||||
guint64 change_mask;
|
||||
const char *name;
|
||||
PinosProperties *properties;
|
||||
|
|
@ -189,6 +193,7 @@ typedef enum {
|
|||
/**
|
||||
* PinosSourceOutputInfo:
|
||||
* @id: generic id of the output
|
||||
* @path: the unique path of the output
|
||||
* @change_mask: bitfield of changed fields since last call
|
||||
* @client_path: the owner client
|
||||
* @source_path: the source path
|
||||
|
|
@ -202,6 +207,7 @@ typedef enum {
|
|||
*/
|
||||
typedef struct {
|
||||
gpointer id;
|
||||
const char *output_path;
|
||||
guint64 change_mask;
|
||||
const char *client_path;
|
||||
const char *source_path;
|
||||
|
|
|
|||
|
|
@ -20,11 +20,8 @@
|
|||
#ifndef __PINOS_MAIN_LOOP_H__
|
||||
#define __PINOS_MAIN_LOOP_H__
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "context.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define PINOS_TYPE_MAIN_LOOP (pinos_main_loop_get_type ())
|
||||
|
|
|
|||
|
|
@ -42,3 +42,15 @@ struct _PinosContextPrivate
|
|||
GList *sources;
|
||||
GList *source_outputs;
|
||||
};
|
||||
|
||||
void pinos_subscribe_get_proxy (PinosSubscribe *subscribe,
|
||||
const gchar *name,
|
||||
const gchar *object_path,
|
||||
const gchar *interface_name,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
GDBusProxy * pinos_subscribe_get_proxy_finish (PinosSubscribe *subscribe,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,10 +20,9 @@
|
|||
#ifndef __PINOS_STREAM_H__
|
||||
#define __PINOS_STREAM_H__
|
||||
|
||||
#include <gio/gio.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "context.h"
|
||||
#include <client/context.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "client/pinos.h"
|
||||
#include "client/enumtypes.h"
|
||||
#include "client/private.h"
|
||||
|
||||
struct _PinosSubscribePrivate
|
||||
{
|
||||
|
|
@ -125,22 +126,18 @@ on_proxy_properties_changed (GDBusProxy *proxy,
|
|||
GVariant *value;
|
||||
gchar *key;
|
||||
GHashTable *props;
|
||||
gboolean need_notify = FALSE;
|
||||
|
||||
props = g_object_get_data (G_OBJECT (proxy), "pinos-changed-properties");
|
||||
if (props == NULL) {
|
||||
props = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
g_object_set_data_full (G_OBJECT (proxy),
|
||||
"pinos-changed-properties",
|
||||
props,
|
||||
(GDestroyNotify) g_hash_table_unref);
|
||||
}
|
||||
|
||||
g_variant_iter_init (&iter, changed_properties);
|
||||
while (g_variant_iter_loop (&iter, "{sv}", &key, &value)) {
|
||||
if (!g_hash_table_contains (props, key))
|
||||
g_hash_table_add (props, g_strdup (key));
|
||||
need_notify = TRUE;
|
||||
}
|
||||
notify_event (data->subscribe, data, PINOS_SUBSCRIPTION_EVENT_CHANGE);
|
||||
if (need_notify)
|
||||
notify_event (data->subscribe, data, PINOS_SUBSCRIPTION_EVENT_CHANGE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -161,6 +158,9 @@ remove_data (PinosSubscribe *subscribe,
|
|||
if (data->pending) {
|
||||
data->removed = TRUE;
|
||||
} else {
|
||||
GHashTable *props = g_object_get_data (G_OBJECT (data->proxy), "pinos-changed-properties");
|
||||
|
||||
g_hash_table_remove_all (props);
|
||||
notify_event (subscribe, data, PINOS_SUBSCRIPTION_EVENT_REMOVE);
|
||||
object_data_free (data);
|
||||
}
|
||||
|
|
@ -209,6 +209,11 @@ on_proxy_created (GObject *source_object,
|
|||
|
||||
notify_event (subscribe, data, PINOS_SUBSCRIPTION_EVENT_NEW);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (data->proxy),
|
||||
"pinos-changed-properties",
|
||||
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL),
|
||||
(GDestroyNotify) g_hash_table_unref);
|
||||
|
||||
for (walk = data->tasks; walk; walk = g_list_next (walk)) {
|
||||
GTask *task = walk->data;
|
||||
g_task_return_pointer (task, g_object_ref (data->proxy), g_object_unref);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#ifndef __PINOS_SUBSCRIBE_H__
|
||||
#define __PINOS_SUBSCRIBE_H__
|
||||
|
||||
#include <glib.h>
|
||||
#include <glib-object.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
|
@ -87,19 +87,6 @@ PinosSubscribe * pinos_subscribe_new (void);
|
|||
PinosSubscriptionState pinos_subscribe_get_state (PinosSubscribe *subscribe);
|
||||
GError * pinos_subscribe_get_error (PinosSubscribe *subscribe);
|
||||
|
||||
void pinos_subscribe_get_proxy (PinosSubscribe *subscribe,
|
||||
const gchar *name,
|
||||
const gchar *object_path,
|
||||
const gchar *interface_name,
|
||||
GCancellable *cancellable,
|
||||
GAsyncReadyCallback callback,
|
||||
gpointer user_data);
|
||||
GDBusProxy * pinos_subscribe_get_proxy_finish (PinosSubscribe *subscribe,
|
||||
GAsyncResult *res,
|
||||
GError **error);
|
||||
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __PINOS_SUBSCRIBE_H__ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue