mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-07 19:35:50 +01:00
GDBusObjectManagerClient: Add a GDestroyNotify to the user_data
For bindings, obviously. Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
parent
ea742e88e3
commit
affc6f7475
@ -142,6 +142,7 @@ struct _GDBusObjectManagerClientPrivate
|
|||||||
|
|
||||||
GDBusProxyTypeFunc get_proxy_type_func;
|
GDBusProxyTypeFunc get_proxy_type_func;
|
||||||
gpointer get_proxy_type_user_data;
|
gpointer get_proxy_type_user_data;
|
||||||
|
GDestroyNotify get_proxy_type_destroy_notify;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -154,7 +155,8 @@ enum
|
|||||||
PROP_NAME,
|
PROP_NAME,
|
||||||
PROP_NAME_OWNER,
|
PROP_NAME_OWNER,
|
||||||
PROP_GET_PROXY_TYPE_FUNC,
|
PROP_GET_PROXY_TYPE_FUNC,
|
||||||
PROP_GET_PROXY_TYPE_USER_DATA
|
PROP_GET_PROXY_TYPE_USER_DATA,
|
||||||
|
PROP_GET_PROXY_TYPE_DESTROY_NOTIFY
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@ -208,6 +210,9 @@ g_dbus_object_manager_client_finalize (GObject *object)
|
|||||||
g_free (manager->priv->name);
|
g_free (manager->priv->name);
|
||||||
g_free (manager->priv->name_owner);
|
g_free (manager->priv->name_owner);
|
||||||
|
|
||||||
|
if (manager->priv->get_proxy_type_destroy_notify != NULL)
|
||||||
|
manager->priv->get_proxy_type_destroy_notify (manager->priv->get_proxy_type_user_data);
|
||||||
|
|
||||||
if (G_OBJECT_CLASS (g_dbus_object_manager_client_parent_class)->finalize != NULL)
|
if (G_OBJECT_CLASS (g_dbus_object_manager_client_parent_class)->finalize != NULL)
|
||||||
G_OBJECT_CLASS (g_dbus_object_manager_client_parent_class)->finalize (object);
|
G_OBJECT_CLASS (g_dbus_object_manager_client_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
@ -295,6 +300,10 @@ g_dbus_object_manager_client_set_property (GObject *_object,
|
|||||||
manager->priv->get_proxy_type_user_data = g_value_get_pointer (value);
|
manager->priv->get_proxy_type_user_data = g_value_get_pointer (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_GET_PROXY_TYPE_DESTROY_NOTIFY:
|
||||||
|
manager->priv->get_proxy_type_destroy_notify = g_value_get_pointer (value);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (_object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (_object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@ -461,6 +470,23 @@ g_dbus_object_manager_client_class_init (GDBusObjectManagerClientClass *klass)
|
|||||||
G_PARAM_CONSTRUCT_ONLY |
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
G_PARAM_STATIC_STRINGS));
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GDBusObjectManagerClient:get-proxy-type-destroy-notify:
|
||||||
|
*
|
||||||
|
* A #GDestroyNotify for the #gpointer user_data in #GDBusObjectManagerClient:get-proxy-type-user-data.
|
||||||
|
*
|
||||||
|
* Since: 2.30
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_GET_PROXY_TYPE_DESTROY_NOTIFY,
|
||||||
|
g_param_spec_pointer ("get-proxy-type-destroy-notify",
|
||||||
|
"GDBusProxyTypeFunc user data free function",
|
||||||
|
"The GDBusProxyTypeFunc user data free function",
|
||||||
|
G_PARAM_READABLE |
|
||||||
|
G_PARAM_WRITABLE |
|
||||||
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GDBusObjectManagerClient::interface-proxy-signal:
|
* GDBusObjectManagerClient::interface-proxy-signal:
|
||||||
* @manager: The #GDBusObjectManagerClient emitting the signal.
|
* @manager: The #GDBusObjectManagerClient emitting the signal.
|
||||||
@ -559,6 +585,7 @@ g_dbus_object_manager_client_init (GDBusObjectManagerClient *manager)
|
|||||||
* @object_path: The object path of the control object.
|
* @object_path: The object path of the control object.
|
||||||
* @get_proxy_type_func: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
|
* @get_proxy_type_func: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
|
||||||
* @get_proxy_type_user_data: User data to pass to @get_proxy_type_func.
|
* @get_proxy_type_user_data: User data to pass to @get_proxy_type_func.
|
||||||
|
* @get_proxy_type_destroy_notify: (allow-none): Free function for @get_proxy_type_user_data or %NULL.
|
||||||
* @cancellable: A #GCancellable or %NULL
|
* @cancellable: A #GCancellable or %NULL
|
||||||
* @error: Return location for error or %NULL.
|
* @error: Return location for error or %NULL.
|
||||||
*
|
*
|
||||||
@ -581,6 +608,7 @@ g_dbus_object_manager_client_new_sync (GDBusConnection *connection
|
|||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
GDBusProxyTypeFunc get_proxy_type_func,
|
GDBusProxyTypeFunc get_proxy_type_func,
|
||||||
gpointer get_proxy_type_user_data,
|
gpointer get_proxy_type_user_data,
|
||||||
|
GDestroyNotify get_proxy_type_destroy_notify,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -601,6 +629,7 @@ g_dbus_object_manager_client_new_sync (GDBusConnection *connection
|
|||||||
"object-path", object_path,
|
"object-path", object_path,
|
||||||
"get-proxy-type-func", get_proxy_type_func,
|
"get-proxy-type-func", get_proxy_type_func,
|
||||||
"get-proxy-type-user-data", get_proxy_type_user_data,
|
"get-proxy-type-user-data", get_proxy_type_user_data,
|
||||||
|
"get-proxy-type-destroy-notify", get_proxy_type_destroy_notify,
|
||||||
NULL);
|
NULL);
|
||||||
if (initable != NULL)
|
if (initable != NULL)
|
||||||
return G_DBUS_OBJECT_MANAGER (initable);
|
return G_DBUS_OBJECT_MANAGER (initable);
|
||||||
@ -616,6 +645,7 @@ g_dbus_object_manager_client_new_sync (GDBusConnection *connection
|
|||||||
* @object_path: The object path of the control object.
|
* @object_path: The object path of the control object.
|
||||||
* @get_proxy_type_func: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
|
* @get_proxy_type_func: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
|
||||||
* @get_proxy_type_user_data: User data to pass to @get_proxy_type_func.
|
* @get_proxy_type_user_data: User data to pass to @get_proxy_type_func.
|
||||||
|
* @get_proxy_type_destroy_notify: (allow-none): Free function for @get_proxy_type_user_data or %NULL.
|
||||||
* @cancellable: A #GCancellable or %NULL
|
* @cancellable: A #GCancellable or %NULL
|
||||||
* @callback: A #GAsyncReadyCallback to call when the request is satisfied.
|
* @callback: A #GAsyncReadyCallback to call when the request is satisfied.
|
||||||
* @user_data: The data to pass to @callback.
|
* @user_data: The data to pass to @callback.
|
||||||
@ -638,6 +668,7 @@ g_dbus_object_manager_client_new (GDBusConnection *connection,
|
|||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
GDBusProxyTypeFunc get_proxy_type_func,
|
GDBusProxyTypeFunc get_proxy_type_func,
|
||||||
gpointer get_proxy_type_user_data,
|
gpointer get_proxy_type_user_data,
|
||||||
|
GDestroyNotify get_proxy_type_destroy_notify,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@ -658,6 +689,7 @@ g_dbus_object_manager_client_new (GDBusConnection *connection,
|
|||||||
"object-path", object_path,
|
"object-path", object_path,
|
||||||
"get-proxy-type-func", get_proxy_type_func,
|
"get-proxy-type-func", get_proxy_type_func,
|
||||||
"get-proxy-type-user-data", get_proxy_type_user_data,
|
"get-proxy-type-user-data", get_proxy_type_user_data,
|
||||||
|
"get-proxy-type-destroy-notify", get_proxy_type_destroy_notify,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,6 +737,7 @@ g_dbus_object_manager_client_new_finish (GAsyncResult *res,
|
|||||||
* @object_path: The object path of the control object.
|
* @object_path: The object path of the control object.
|
||||||
* @get_proxy_type_func: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
|
* @get_proxy_type_func: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
|
||||||
* @get_proxy_type_user_data: User data to pass to @get_proxy_type_func.
|
* @get_proxy_type_user_data: User data to pass to @get_proxy_type_func.
|
||||||
|
* @get_proxy_type_destroy_notify: (allow-none): Free function for @get_proxy_type_user_data or %NULL.
|
||||||
* @cancellable: A #GCancellable or %NULL
|
* @cancellable: A #GCancellable or %NULL
|
||||||
* @error: Return location for error or %NULL.
|
* @error: Return location for error or %NULL.
|
||||||
*
|
*
|
||||||
@ -728,6 +761,7 @@ g_dbus_object_manager_client_new_for_bus_sync (GBusType bu
|
|||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
GDBusProxyTypeFunc get_proxy_type_func,
|
GDBusProxyTypeFunc get_proxy_type_func,
|
||||||
gpointer get_proxy_type_user_data,
|
gpointer get_proxy_type_user_data,
|
||||||
|
GDestroyNotify get_proxy_type_destroy_notify,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
@ -747,6 +781,7 @@ g_dbus_object_manager_client_new_for_bus_sync (GBusType bu
|
|||||||
"object-path", object_path,
|
"object-path", object_path,
|
||||||
"get-proxy-type-func", get_proxy_type_func,
|
"get-proxy-type-func", get_proxy_type_func,
|
||||||
"get-proxy-type-user-data", get_proxy_type_user_data,
|
"get-proxy-type-user-data", get_proxy_type_user_data,
|
||||||
|
"get-proxy-type-destroy-notify", get_proxy_type_destroy_notify,
|
||||||
NULL);
|
NULL);
|
||||||
if (initable != NULL)
|
if (initable != NULL)
|
||||||
return G_DBUS_OBJECT_MANAGER (initable);
|
return G_DBUS_OBJECT_MANAGER (initable);
|
||||||
@ -762,6 +797,7 @@ g_dbus_object_manager_client_new_for_bus_sync (GBusType bu
|
|||||||
* @object_path: The object path of the control object.
|
* @object_path: The object path of the control object.
|
||||||
* @get_proxy_type_func: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
|
* @get_proxy_type_func: A #GDBusProxyTypeFunc function or %NULL to always construct #GDBusProxy proxies.
|
||||||
* @get_proxy_type_user_data: User data to pass to @get_proxy_type_func.
|
* @get_proxy_type_user_data: User data to pass to @get_proxy_type_func.
|
||||||
|
* @get_proxy_type_destroy_notify: (allow-none): Free function for @get_proxy_type_user_data or %NULL.
|
||||||
* @cancellable: A #GCancellable or %NULL
|
* @cancellable: A #GCancellable or %NULL
|
||||||
* @callback: A #GAsyncReadyCallback to call when the request is satisfied.
|
* @callback: A #GAsyncReadyCallback to call when the request is satisfied.
|
||||||
* @user_data: The data to pass to @callback.
|
* @user_data: The data to pass to @callback.
|
||||||
@ -785,6 +821,7 @@ g_dbus_object_manager_client_new_for_bus (GBusType bus_typ
|
|||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
GDBusProxyTypeFunc get_proxy_type_func,
|
GDBusProxyTypeFunc get_proxy_type_func,
|
||||||
gpointer get_proxy_type_user_data,
|
gpointer get_proxy_type_user_data,
|
||||||
|
GDestroyNotify get_proxy_type_destroy_notify,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
@ -804,6 +841,7 @@ g_dbus_object_manager_client_new_for_bus (GBusType bus_typ
|
|||||||
"object-path", object_path,
|
"object-path", object_path,
|
||||||
"get-proxy-type-func", get_proxy_type_func,
|
"get-proxy-type-func", get_proxy_type_func,
|
||||||
"get-proxy-type-user-data", get_proxy_type_user_data,
|
"get-proxy-type-user-data", get_proxy_type_user_data,
|
||||||
|
"get-proxy-type-destroy-notify", get_proxy_type_destroy_notify,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,6 +91,7 @@ void g_dbus_object_manager_client_new (G
|
|||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
GDBusProxyTypeFunc get_proxy_type_func,
|
GDBusProxyTypeFunc get_proxy_type_func,
|
||||||
gpointer get_proxy_type_user_data,
|
gpointer get_proxy_type_user_data,
|
||||||
|
GDestroyNotify get_proxy_type_destroy_notify,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
@ -102,6 +103,7 @@ GDBusObjectManager *g_dbus_object_manager_client_new_sync (G
|
|||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
GDBusProxyTypeFunc get_proxy_type_func,
|
GDBusProxyTypeFunc get_proxy_type_func,
|
||||||
gpointer get_proxy_type_user_data,
|
gpointer get_proxy_type_user_data,
|
||||||
|
GDestroyNotify get_proxy_type_destroy_notify,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
void g_dbus_object_manager_client_new_for_bus (GBusType bus_type,
|
void g_dbus_object_manager_client_new_for_bus (GBusType bus_type,
|
||||||
@ -110,6 +112,7 @@ void g_dbus_object_manager_client_new_for_bus (G
|
|||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
GDBusProxyTypeFunc get_proxy_type_func,
|
GDBusProxyTypeFunc get_proxy_type_func,
|
||||||
gpointer get_proxy_type_user_data,
|
gpointer get_proxy_type_user_data,
|
||||||
|
GDestroyNotify get_proxy_type_destroy_notify,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
@ -121,6 +124,7 @@ GDBusObjectManager *g_dbus_object_manager_client_new_for_bus_sync (G
|
|||||||
const gchar *object_path,
|
const gchar *object_path,
|
||||||
GDBusProxyTypeFunc get_proxy_type_func,
|
GDBusProxyTypeFunc get_proxy_type_func,
|
||||||
gpointer get_proxy_type_user_data,
|
gpointer get_proxy_type_user_data,
|
||||||
|
GDestroyNotify get_proxy_type_destroy_notify,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GError **error);
|
GError **error);
|
||||||
GDBusConnection *g_dbus_object_manager_client_get_connection (GDBusObjectManagerClient *manager);
|
GDBusConnection *g_dbus_object_manager_client_get_connection (GDBusObjectManagerClient *manager);
|
||||||
|
@ -1783,6 +1783,7 @@ check_object_manager (void)
|
|||||||
"/managed",
|
"/managed",
|
||||||
get_proxy_type,
|
get_proxy_type,
|
||||||
GUINT_TO_POINTER (42),
|
GUINT_TO_POINTER (42),
|
||||||
|
NULL, /* GDestroyNotify */
|
||||||
NULL, /* GCancellable */
|
NULL, /* GCancellable */
|
||||||
&error);
|
&error);
|
||||||
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
||||||
@ -1805,14 +1806,15 @@ check_object_manager (void)
|
|||||||
/* Now try to create the the proxy manager again - this time it should work */
|
/* Now try to create the the proxy manager again - this time it should work */
|
||||||
error = NULL;
|
error = NULL;
|
||||||
g_dbus_object_manager_client_new (c,
|
g_dbus_object_manager_client_new (c,
|
||||||
G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
|
G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
|
||||||
g_dbus_connection_get_unique_name (c),
|
g_dbus_connection_get_unique_name (c),
|
||||||
"/managed",
|
"/managed",
|
||||||
get_proxy_type,
|
get_proxy_type,
|
||||||
GUINT_TO_POINTER (42),
|
GUINT_TO_POINTER (42),
|
||||||
NULL, /* GCancellable */
|
NULL, /* GDestroyNotify */
|
||||||
(GAsyncReadyCallback) om_pm_start_cb,
|
NULL, /* GCancellable */
|
||||||
loop);
|
(GAsyncReadyCallback) om_pm_start_cb,
|
||||||
|
loop);
|
||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
error = NULL;
|
error = NULL;
|
||||||
pm = g_dbus_object_manager_client_new_finish (om_res, &error);
|
pm = g_dbus_object_manager_client_new_finish (om_res, &error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user