Cosmetic fixes

Use P_() for properties, fix up indentation, etc.
This commit is contained in:
Matthias Clasen 2010-05-09 22:13:18 -04:00
parent 0cf467c2ca
commit 25a8aa5d88
7 changed files with 405 additions and 482 deletions

View File

@ -175,8 +175,8 @@ _g_dbus_auth_class_init (GDBusAuthClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_STREAM, PROP_STREAM,
g_param_spec_object ("stream", g_param_spec_object ("stream",
_("IO Stream"), P_("IO Stream"),
_("The underlying GIOStream used for I/O"), P_("The underlying GIOStream used for I/O"),
G_TYPE_IO_STREAM, G_TYPE_IO_STREAM,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |

View File

@ -60,8 +60,7 @@ _g_dbus_auth_mechanism_finalize (GObject *object)
if (mechanism->priv->credentials != NULL) if (mechanism->priv->credentials != NULL)
g_object_unref (mechanism->priv->credentials); g_object_unref (mechanism->priv->credentials);
if (G_OBJECT_CLASS (_g_dbus_auth_mechanism_parent_class)->finalize != NULL) G_OBJECT_CLASS (_g_dbus_auth_mechanism_parent_class)->finalize (object);
G_OBJECT_CLASS (_g_dbus_auth_mechanism_parent_class)->finalize (object);
} }
static void static void
@ -127,8 +126,8 @@ _g_dbus_auth_mechanism_class_init (GDBusAuthMechanismClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_STREAM, PROP_STREAM,
g_param_spec_object ("stream", g_param_spec_object ("stream",
_("IO Stream"), P_("IO Stream"),
_("The underlying GIOStream used for I/O"), P_("The underlying GIOStream used for I/O"),
G_TYPE_IO_STREAM, G_TYPE_IO_STREAM,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -149,8 +148,8 @@ _g_dbus_auth_mechanism_class_init (GDBusAuthMechanismClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_CREDENTIALS, PROP_CREDENTIALS,
g_param_spec_object ("credentials", g_param_spec_object ("credentials",
_("Credentials"), P_("Credentials"),
_("The credentials of the remote peer"), P_("The credentials of the remote peer"),
G_TYPE_CREDENTIALS, G_TYPE_CREDENTIALS,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -193,7 +192,7 @@ _g_dbus_auth_mechanism_get_name (GType mechanism_type)
const gchar *name; const gchar *name;
GDBusAuthMechanismClass *klass; GDBusAuthMechanismClass *klass;
g_return_val_if_fail (g_type_is_a (mechanism_type, G_TYPE_DBUS_AUTH_MECHANISM), NULL); g_return_val_if_fail (g_type_is_a (mechanism_type, G_TYPE_DBUS_AUTH_MECHANISM), NULL);
klass = g_type_class_ref (mechanism_type); klass = g_type_class_ref (mechanism_type);
g_assert (klass != NULL); g_assert (klass != NULL);
@ -209,7 +208,7 @@ _g_dbus_auth_mechanism_get_priority (GType mechanism_type)
gint priority; gint priority;
GDBusAuthMechanismClass *klass; GDBusAuthMechanismClass *klass;
g_return_val_if_fail (g_type_is_a (mechanism_type, G_TYPE_DBUS_AUTH_MECHANISM), 0); g_return_val_if_fail (g_type_is_a (mechanism_type, G_TYPE_DBUS_AUTH_MECHANISM), 0);
klass = g_type_class_ref (mechanism_type); klass = g_type_class_ref (mechanism_type);
g_assert (klass != NULL); g_assert (klass != NULL);
@ -229,10 +228,10 @@ _g_dbus_auth_mechanism_is_supported (GDBusAuthMechanism *mechanism)
} }
gchar * gchar *
_g_dbus_auth_mechanism_encode_data (GDBusAuthMechanism *mechanism, _g_dbus_auth_mechanism_encode_data (GDBusAuthMechanism *mechanism,
const gchar *data, const gchar *data,
gsize data_len, gsize data_len,
gsize *out_data_len) gsize *out_data_len)
{ {
g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), NULL); g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), NULL);
return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->encode_data (mechanism, data, data_len, out_data_len); return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->encode_data (mechanism, data, data_len, out_data_len);
@ -240,10 +239,10 @@ _g_dbus_auth_mechanism_encode_data (GDBusAuthMechanism *mechanism,
gchar * gchar *
_g_dbus_auth_mechanism_decode_data (GDBusAuthMechanism *mechanism, _g_dbus_auth_mechanism_decode_data (GDBusAuthMechanism *mechanism,
const gchar *data, const gchar *data,
gsize data_len, gsize data_len,
gsize *out_data_len) gsize *out_data_len)
{ {
g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), NULL); g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), NULL);
return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->decode_data (mechanism, data, data_len, out_data_len); return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->decode_data (mechanism, data, data_len, out_data_len);
@ -252,47 +251,47 @@ _g_dbus_auth_mechanism_decode_data (GDBusAuthMechanism *mechanism,
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
GDBusAuthMechanismState GDBusAuthMechanismState
_g_dbus_auth_mechanism_server_get_state (GDBusAuthMechanism *mechanism) _g_dbus_auth_mechanism_server_get_state (GDBusAuthMechanism *mechanism)
{ {
g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), G_DBUS_AUTH_MECHANISM_STATE_INVALID); g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), G_DBUS_AUTH_MECHANISM_STATE_INVALID);
return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->server_get_state (mechanism); return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->server_get_state (mechanism);
} }
void void
_g_dbus_auth_mechanism_server_initiate (GDBusAuthMechanism *mechanism, _g_dbus_auth_mechanism_server_initiate (GDBusAuthMechanism *mechanism,
const gchar *initial_response, const gchar *initial_response,
gsize initial_response_len) gsize initial_response_len)
{ {
g_return_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism)); g_return_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism));
G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->server_initiate (mechanism, initial_response, initial_response_len); G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->server_initiate (mechanism, initial_response, initial_response_len);
} }
void void
_g_dbus_auth_mechanism_server_data_receive (GDBusAuthMechanism *mechanism, _g_dbus_auth_mechanism_server_data_receive (GDBusAuthMechanism *mechanism,
const gchar *data, const gchar *data,
gsize data_len) gsize data_len)
{ {
g_return_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism)); g_return_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism));
G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->server_data_receive (mechanism, data, data_len); G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->server_data_receive (mechanism, data, data_len);
} }
gchar * gchar *
_g_dbus_auth_mechanism_server_data_send (GDBusAuthMechanism *mechanism, _g_dbus_auth_mechanism_server_data_send (GDBusAuthMechanism *mechanism,
gsize *out_data_len) gsize *out_data_len)
{ {
g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), NULL); g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), NULL);
return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->server_data_send (mechanism, out_data_len); return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->server_data_send (mechanism, out_data_len);
} }
gchar * gchar *
_g_dbus_auth_mechanism_server_get_reject_reason (GDBusAuthMechanism *mechanism) _g_dbus_auth_mechanism_server_get_reject_reason (GDBusAuthMechanism *mechanism)
{ {
g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), NULL); g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), NULL);
return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->server_get_reject_reason (mechanism); return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->server_get_reject_reason (mechanism);
} }
void void
_g_dbus_auth_mechanism_server_shutdown (GDBusAuthMechanism *mechanism) _g_dbus_auth_mechanism_server_shutdown (GDBusAuthMechanism *mechanism)
{ {
g_return_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism)); g_return_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism));
G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->server_shutdown (mechanism); G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->server_shutdown (mechanism);
@ -301,15 +300,15 @@ _g_dbus_auth_mechanism_server_shutdown (GDBusAuthMechanism *mechanism)
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
GDBusAuthMechanismState GDBusAuthMechanismState
_g_dbus_auth_mechanism_client_get_state (GDBusAuthMechanism *mechanism) _g_dbus_auth_mechanism_client_get_state (GDBusAuthMechanism *mechanism)
{ {
g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), G_DBUS_AUTH_MECHANISM_STATE_INVALID); g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), G_DBUS_AUTH_MECHANISM_STATE_INVALID);
return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->client_get_state (mechanism); return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->client_get_state (mechanism);
} }
gchar * gchar *
_g_dbus_auth_mechanism_client_initiate (GDBusAuthMechanism *mechanism, _g_dbus_auth_mechanism_client_initiate (GDBusAuthMechanism *mechanism,
gsize *out_initial_response_len) gsize *out_initial_response_len)
{ {
g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), NULL); g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), NULL);
return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->client_initiate (mechanism, return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->client_initiate (mechanism,
@ -317,24 +316,24 @@ _g_dbus_auth_mechanism_client_initiate (GDBusAuthMechanism *mechanism,
} }
void void
_g_dbus_auth_mechanism_client_data_receive (GDBusAuthMechanism *mechanism, _g_dbus_auth_mechanism_client_data_receive (GDBusAuthMechanism *mechanism,
const gchar *data, const gchar *data,
gsize data_len) gsize data_len)
{ {
g_return_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism)); g_return_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism));
G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->client_data_receive (mechanism, data, data_len); G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->client_data_receive (mechanism, data, data_len);
} }
gchar * gchar *
_g_dbus_auth_mechanism_client_data_send (GDBusAuthMechanism *mechanism, _g_dbus_auth_mechanism_client_data_send (GDBusAuthMechanism *mechanism,
gsize *out_data_len) gsize *out_data_len)
{ {
g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), NULL); g_return_val_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism), NULL);
return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->client_data_send (mechanism, out_data_len); return G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->client_data_send (mechanism, out_data_len);
} }
void void
_g_dbus_auth_mechanism_client_shutdown (GDBusAuthMechanism *mechanism) _g_dbus_auth_mechanism_client_shutdown (GDBusAuthMechanism *mechanism)
{ {
g_return_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism)); g_return_if_fail (G_IS_DBUS_AUTH_MECHANISM (mechanism));
G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->client_shutdown (mechanism); G_DBUS_AUTH_MECHANISM_GET_CLASS (mechanism)->client_shutdown (mechanism);

View File

@ -131,8 +131,8 @@ static GDBusConnection *the_system_bus = NULL;
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
static gboolean static gboolean
_g_strv_has_string (const gchar* const * haystack, _g_strv_has_string (const gchar* const *haystack,
const gchar *needle) const gchar *needle)
{ {
guint n; guint n;
@ -303,7 +303,7 @@ static void purge_all_filters (GDBusConnection *connection);
static guint signals[LAST_SIGNAL] = { 0 }; static guint signals[LAST_SIGNAL] = { 0 };
static void initable_iface_init (GInitableIface *initable_iface); static void initable_iface_init (GInitableIface *initable_iface);
static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface); static void async_initable_iface_init (GAsyncInitableIface *async_initable_iface);
G_DEFINE_TYPE_WITH_CODE (GDBusConnection, g_dbus_connection, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GDBusConnection, g_dbus_connection, G_TYPE_OBJECT,
@ -392,8 +392,7 @@ g_dbus_connection_finalize (GObject *object)
g_mutex_free (connection->priv->init_lock); g_mutex_free (connection->priv->init_lock);
g_mutex_free (connection->priv->lock); g_mutex_free (connection->priv->lock);
if (G_OBJECT_CLASS (g_dbus_connection_parent_class)->finalize != NULL) G_OBJECT_CLASS (g_dbus_connection_parent_class)->finalize (object);
G_OBJECT_CLASS (g_dbus_connection_parent_class)->finalize (object);
} }
static void static void
@ -514,8 +513,8 @@ g_dbus_connection_class_init (GDBusConnectionClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_STREAM, PROP_STREAM,
g_param_spec_object ("stream", g_param_spec_object ("stream",
_("IO Stream"), P_("IO Stream"),
_("The underlying streams used for I/O"), P_("The underlying streams used for I/O"),
G_TYPE_IO_STREAM, G_TYPE_IO_STREAM,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -535,8 +534,8 @@ g_dbus_connection_class_init (GDBusConnectionClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_ADDRESS, PROP_ADDRESS,
g_param_spec_string ("address", g_param_spec_string ("address",
_("Address"), P_("Address"),
_("D-Bus address specifying potential socket endpoints"), P_("D-Bus address specifying potential socket endpoints"),
NULL, NULL,
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY | G_PARAM_CONSTRUCT_ONLY |
@ -554,8 +553,8 @@ g_dbus_connection_class_init (GDBusConnectionClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_FLAGS, PROP_FLAGS,
g_param_spec_flags ("flags", g_param_spec_flags ("flags",
_("Flags"), P_("Flags"),
_("Flags"), P_("Flags"),
G_TYPE_DBUS_CONNECTION_FLAGS, G_TYPE_DBUS_CONNECTION_FLAGS,
G_DBUS_CONNECTION_FLAGS_NONE, G_DBUS_CONNECTION_FLAGS_NONE,
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -586,8 +585,8 @@ g_dbus_connection_class_init (GDBusConnectionClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_GUID, PROP_GUID,
g_param_spec_string ("guid", g_param_spec_string ("guid",
_("GUID"), P_("GUID"),
_("GUID of the server peer"), P_("GUID of the server peer"),
NULL, NULL,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -607,8 +606,8 @@ g_dbus_connection_class_init (GDBusConnectionClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_UNIQUE_NAME, PROP_UNIQUE_NAME,
g_param_spec_string ("unique-name", g_param_spec_string ("unique-name",
_("unique-name"), P_("unique-name"),
_("Unique name of bus connection"), P_("Unique name of bus connection"),
NULL, NULL,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NAME |
@ -625,8 +624,8 @@ g_dbus_connection_class_init (GDBusConnectionClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_CLOSED, PROP_CLOSED,
g_param_spec_boolean ("closed", g_param_spec_boolean ("closed",
_("Closed"), P_("Closed"),
_("Whether the connection is closed"), P_("Whether the connection is closed"),
FALSE, FALSE,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NAME |
@ -645,8 +644,8 @@ g_dbus_connection_class_init (GDBusConnectionClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_EXIT_ON_CLOSE, PROP_EXIT_ON_CLOSE,
g_param_spec_boolean ("exit-on-close", g_param_spec_boolean ("exit-on-close",
_("Exit on close"), P_("Exit on close"),
_("Whether the process is terminated when the connection is closed"), P_("Whether the process is terminated when the connection is closed"),
FALSE, FALSE,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -665,8 +664,8 @@ g_dbus_connection_class_init (GDBusConnectionClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_CAPABILITY_FLAGS, PROP_CAPABILITY_FLAGS,
g_param_spec_flags ("capabilities", g_param_spec_flags ("capabilities",
_("Capabilities"), P_("Capabilities"),
_("Capabilities"), P_("Capabilities"),
G_TYPE_DBUS_CAPABILITY_FLAGS, G_TYPE_DBUS_CAPABILITY_FLAGS,
G_DBUS_CAPABILITY_FLAGS_NONE, G_DBUS_CAPABILITY_FLAGS_NONE,
G_PARAM_READABLE | G_PARAM_READABLE |
@ -684,8 +683,8 @@ g_dbus_connection_class_init (GDBusConnectionClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_AUTHENTICATION_OBSERVER, PROP_AUTHENTICATION_OBSERVER,
g_param_spec_object ("authentication-observer", g_param_spec_object ("authentication-observer",
_("Authentication Observer"), P_("Authentication Observer"),
_("Object used to assist in the authentication process"), P_("Object used to assist in the authentication process"),
G_TYPE_DBUS_AUTH_OBSERVER, G_TYPE_DBUS_AUTH_OBSERVER,
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY | G_PARAM_CONSTRUCT_ONLY |
@ -860,8 +859,8 @@ emit_closed_in_idle (gpointer user_data)
/* Can be called from any thread, must hold lock */ /* Can be called from any thread, must hold lock */
static void static void
set_closed_unlocked (GDBusConnection *connection, set_closed_unlocked (GDBusConnection *connection,
gboolean remote_peer_vanished, gboolean remote_peer_vanished,
GError *error) GError *error)
{ {
GSource *idle_source; GSource *idle_source;
EmitClosedData *data; EmitClosedData *data;
@ -908,29 +907,29 @@ g_dbus_connection_close (GDBusConnection *connection)
CONNECTION_LOCK (connection); CONNECTION_LOCK (connection);
if (!connection->priv->closed) if (!connection->priv->closed)
{ {
GError *error = NULL; GError *error = NULL;
/* TODO: do this async */ /* TODO: do this async */
//g_debug ("closing connection %p's stream %p", connection, connection->priv->stream); //g_debug ("closing connection %p's stream %p", connection, connection->priv->stream);
if (!g_io_stream_close (connection->priv->stream, NULL, &error)) if (!g_io_stream_close (connection->priv->stream, NULL, &error))
{ {
g_warning ("Error closing stream: %s", error->message); g_warning ("Error closing stream: %s", error->message);
g_error_free (error); g_error_free (error);
} }
set_closed_unlocked (connection, FALSE, NULL); set_closed_unlocked (connection, FALSE, NULL);
} }
CONNECTION_UNLOCK (connection); CONNECTION_UNLOCK (connection);
} }
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
static gboolean static gboolean
g_dbus_connection_send_message_unlocked (GDBusConnection *connection, g_dbus_connection_send_message_unlocked (GDBusConnection *connection,
GDBusMessage *message, GDBusMessage *message,
volatile guint32 *out_serial, volatile guint32 *out_serial,
GError **error) GError **error)
{ {
guchar *blob; guchar *blob;
gsize blob_size; gsize blob_size;
@ -991,9 +990,8 @@ g_dbus_connection_send_message_unlocked (GDBusConnection *connection,
/* TODO: use connection->priv->auth to encode the blob */ /* TODO: use connection->priv->auth to encode the blob */
if (out_serial != NULL) if (out_serial != NULL)
{ *out_serial = serial_to_use;
*out_serial = serial_to_use;
}
g_dbus_message_set_serial (message, serial_to_use); g_dbus_message_set_serial (message, serial_to_use);
_g_dbus_worker_send_message (connection->priv->worker, _g_dbus_worker_send_message (connection->priv->worker,
@ -1038,10 +1036,10 @@ g_dbus_connection_send_message_unlocked (GDBusConnection *connection,
* Since: 2.26 * Since: 2.26
*/ */
gboolean gboolean
g_dbus_connection_send_message (GDBusConnection *connection, g_dbus_connection_send_message (GDBusConnection *connection,
GDBusMessage *message, GDBusMessage *message,
volatile guint32 *out_serial, volatile guint32 *out_serial,
GError **error) GError **error)
{ {
gboolean ret; gboolean ret;
@ -1398,9 +1396,9 @@ g_dbus_connection_send_message_with_reply (GDBusConnection *connection,
* Since: 2.26 * Since: 2.26
*/ */
GDBusMessage * GDBusMessage *
g_dbus_connection_send_message_with_reply_finish (GDBusConnection *connection, g_dbus_connection_send_message_with_reply_finish (GDBusConnection *connection,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res); GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
GDBusMessage *reply; GDBusMessage *reply;
@ -1487,12 +1485,12 @@ send_message_with_reply_sync_cb (GDBusConnection *connection,
* Since: 2.26 * Since: 2.26
*/ */
GDBusMessage * GDBusMessage *
g_dbus_connection_send_message_with_reply_sync (GDBusConnection *connection, g_dbus_connection_send_message_with_reply_sync (GDBusConnection *connection,
GDBusMessage *message, GDBusMessage *message,
gint timeout_msec, gint timeout_msec,
volatile guint32 *out_serial, volatile guint32 *out_serial,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
SendMessageSyncData *data; SendMessageSyncData *data;
GDBusMessage *reply; GDBusMessage *reply;
@ -1663,11 +1661,10 @@ get_offered_capabilities_max (GDBusConnection *connection)
return ret; return ret;
} }
static gboolean static gboolean
initable_init (GInitable *initable, initable_init (GInitable *initable,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GDBusConnection *connection = G_DBUS_CONNECTION (initable); GDBusConnection *connection = G_DBUS_CONNECTION (initable);
gboolean ret; gboolean ret;
@ -1841,8 +1838,8 @@ initable_iface_init (GInitableIface *initable_iface)
static void static void
async_init_thread (GSimpleAsyncResult *res, async_init_thread (GSimpleAsyncResult *res,
GObject *object, GObject *object,
GCancellable *cancellable) GCancellable *cancellable)
{ {
GError *error = NULL; GError *error = NULL;
@ -1865,9 +1862,9 @@ async_initable_init_async (GAsyncInitable *initable,
g_return_if_fail (G_IS_INITABLE (initable)); g_return_if_fail (G_IS_INITABLE (initable));
res = g_simple_async_result_new (G_OBJECT (initable), callback, user_data, res = g_simple_async_result_new (G_OBJECT (initable), callback, user_data,
async_initable_init_async); async_initable_init_async);
g_simple_async_result_run_in_thread (res, async_init_thread, g_simple_async_result_run_in_thread (res, async_init_thread,
io_priority, cancellable); io_priority, cancellable);
g_object_unref (res); g_object_unref (res);
} }
@ -1919,13 +1916,13 @@ async_initable_iface_init (GAsyncInitableIface *async_initable_iface)
* Since: 2.26 * Since: 2.26
*/ */
void void
g_dbus_connection_new (GIOStream *stream, g_dbus_connection_new (GIOStream *stream,
const gchar *guid, const gchar *guid,
GDBusConnectionFlags flags, GDBusConnectionFlags flags,
GDBusAuthObserver *authentication_observer, GDBusAuthObserver *authentication_observer,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
g_return_if_fail (G_IS_IO_STREAM (stream)); g_return_if_fail (G_IS_IO_STREAM (stream));
g_async_initable_new_async (G_TYPE_DBUS_CONNECTION, g_async_initable_new_async (G_TYPE_DBUS_CONNECTION,
@ -1952,8 +1949,8 @@ g_dbus_connection_new (GIOStream *stream,
* Since: 2.26 * Since: 2.26
*/ */
GDBusConnection * GDBusConnection *
g_dbus_connection_new_finish (GAsyncResult *res, g_dbus_connection_new_finish (GAsyncResult *res,
GError **error) GError **error)
{ {
GObject *object; GObject *object;
GObject *source_object; GObject *source_object;
@ -1997,12 +1994,12 @@ g_dbus_connection_new_finish (GAsyncResult *res,
* Since: 2.26 * Since: 2.26
*/ */
GDBusConnection * GDBusConnection *
g_dbus_connection_new_sync (GIOStream *stream, g_dbus_connection_new_sync (GIOStream *stream,
const gchar *guid, const gchar *guid,
GDBusConnectionFlags flags, GDBusConnectionFlags flags,
GDBusAuthObserver *authentication_observer, GDBusAuthObserver *authentication_observer,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
g_return_val_if_fail (G_IS_IO_STREAM (stream), NULL); g_return_val_if_fail (G_IS_IO_STREAM (stream), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL);
@ -2047,11 +2044,11 @@ g_dbus_connection_new_sync (GIOStream *stream,
* Since: 2.26 * Since: 2.26
*/ */
void void
g_dbus_connection_new_for_address (const gchar *address, g_dbus_connection_new_for_address (const gchar *address,
GDBusConnectionFlags flags, GDBusConnectionFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
g_return_if_fail (address != NULL); g_return_if_fail (address != NULL);
g_async_initable_new_async (G_TYPE_DBUS_CONNECTION, g_async_initable_new_async (G_TYPE_DBUS_CONNECTION,
@ -2076,8 +2073,8 @@ g_dbus_connection_new_for_address (const gchar *address,
* Since: 2.26 * Since: 2.26
*/ */
GDBusConnection * GDBusConnection *
g_dbus_connection_new_for_address_finish (GAsyncResult *res, g_dbus_connection_new_for_address_finish (GAsyncResult *res,
GError **error) GError **error)
{ {
GObject *object; GObject *object;
GObject *source_object; GObject *source_object;
@ -2122,10 +2119,10 @@ g_dbus_connection_new_for_address_finish (GAsyncResult *res,
* Since: 2.26 * Since: 2.26
*/ */
GDBusConnection * GDBusConnection *
g_dbus_connection_new_for_address_sync (const gchar *address, g_dbus_connection_new_for_address_sync (const gchar *address,
GDBusConnectionFlags flags, GDBusConnectionFlags flags,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
g_return_val_if_fail (address != NULL, NULL); g_return_val_if_fail (address != NULL, NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL);
@ -2314,8 +2311,8 @@ purge_all_filters (GDBusConnection *connection)
} }
void void
g_dbus_connection_remove_filter (GDBusConnection *connection, g_dbus_connection_remove_filter (GDBusConnection *connection,
guint filter_id) guint filter_id)
{ {
guint n; guint n;
FilterData *to_destroy; FilterData *to_destroy;
@ -2385,11 +2382,11 @@ signal_data_free (SignalData *data)
} }
static gchar * static gchar *
args_to_rule (const gchar *sender, args_to_rule (const gchar *sender,
const gchar *interface_name, const gchar *interface_name,
const gchar *member, const gchar *member,
const gchar *object_path, const gchar *object_path,
const gchar *arg0) const gchar *arg0)
{ {
GString *rule; GString *rule;
@ -2474,10 +2471,10 @@ static gboolean
is_signal_data_for_name_lost_or_acquired (SignalData *signal_data) is_signal_data_for_name_lost_or_acquired (SignalData *signal_data)
{ {
return g_strcmp0 (signal_data->sender, "org.freedesktop.DBus") == 0 && return g_strcmp0 (signal_data->sender, "org.freedesktop.DBus") == 0 &&
g_strcmp0 (signal_data->interface_name, "org.freedesktop.DBus") == 0 && g_strcmp0 (signal_data->interface_name, "org.freedesktop.DBus") == 0 &&
g_strcmp0 (signal_data->object_path, "/org/freedesktop/DBus") == 0 && g_strcmp0 (signal_data->object_path, "/org/freedesktop/DBus") == 0 &&
(g_strcmp0 (signal_data->member, "NameLost") == 0 || (g_strcmp0 (signal_data->member, "NameLost") == 0 ||
g_strcmp0 (signal_data->member, "NameAcquired") == 0); g_strcmp0 (signal_data->member, "NameAcquired") == 0);
} }
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
@ -2594,9 +2591,7 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
if (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION) if (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION)
{ {
if (!is_signal_data_for_name_lost_or_acquired (signal_data)) if (!is_signal_data_for_name_lost_or_acquired (signal_data))
{ add_match_rule (connection, signal_data->rule);
add_match_rule (connection, signal_data->rule);
}
} }
out: out:
@ -2624,9 +2619,9 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
/* must hold lock when calling this */ /* must hold lock when calling this */
static void static void
unsubscribe_id_internal (GDBusConnection *connection, unsubscribe_id_internal (GDBusConnection *connection,
guint subscription_id, guint subscription_id,
GArray *out_removed_subscribers) GArray *out_removed_subscribers)
{ {
SignalData *signal_data; SignalData *signal_data;
GPtrArray *signal_data_array; GPtrArray *signal_data_array;
@ -2669,9 +2664,7 @@ unsubscribe_id_internal (GDBusConnection *connection,
if (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION) if (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION)
{ {
if (!is_signal_data_for_name_lost_or_acquired (signal_data)) if (!is_signal_data_for_name_lost_or_acquired (signal_data))
{ remove_match_rule (connection, signal_data->rule);
remove_match_rule (connection, signal_data->rule);
}
} }
signal_data_free (signal_data); signal_data_free (signal_data);
@ -2696,8 +2689,8 @@ unsubscribe_id_internal (GDBusConnection *connection,
* Since: 2.26 * Since: 2.26
*/ */
void void
g_dbus_connection_signal_unsubscribe (GDBusConnection *connection, g_dbus_connection_signal_unsubscribe (GDBusConnection *connection,
guint subscription_id) guint subscription_id)
{ {
GArray *subscribers; GArray *subscribers;
guint n; guint n;
@ -2783,16 +2776,15 @@ emit_signal_instance_in_idle_cb (gpointer data)
CONNECTION_UNLOCK (signal_instance->connection); CONNECTION_UNLOCK (signal_instance->connection);
if (has_subscription) if (has_subscription)
{ signal_instance->callback (signal_instance->connection,
signal_instance->callback (signal_instance->connection, signal_instance->sender,
signal_instance->sender, signal_instance->path,
signal_instance->path, signal_instance->interface,
signal_instance->interface, signal_instance->member,
signal_instance->member, parameters,
parameters, signal_instance->user_data);
signal_instance->user_data);
} if (parameters != NULL)
if (parameters != NULL)
g_variant_unref (parameters); g_variant_unref (parameters);
return FALSE; return FALSE;
@ -2889,8 +2881,8 @@ schedule_callbacks (GDBusConnection *connection,
/* called in message handler thread with lock held */ /* called in message handler thread with lock held */
static void static void
distribute_signals (GDBusConnection *connection, distribute_signals (GDBusConnection *connection,
GDBusMessage *message) GDBusMessage *message)
{ {
GPtrArray *signal_data_array; GPtrArray *signal_data_array;
const gchar *sender; const gchar *sender;
@ -2901,17 +2893,14 @@ distribute_signals (GDBusConnection *connection,
if (sender != NULL) if (sender != NULL)
{ {
signal_data_array = g_hash_table_lookup (connection->priv->map_sender_to_signal_data_array, sender); signal_data_array = g_hash_table_lookup (connection->priv->map_sender_to_signal_data_array, sender);
if (signal_data_array != NULL) { if (signal_data_array != NULL)
schedule_callbacks (connection, signal_data_array, message, sender); schedule_callbacks (connection, signal_data_array, message, sender);
}
} }
/* collect subcsribers not matching on sender */ /* collect subcsribers not matching on sender */
signal_data_array = g_hash_table_lookup (connection->priv->map_sender_to_signal_data_array, ""); signal_data_array = g_hash_table_lookup (connection->priv->map_sender_to_signal_data_array, "");
if (signal_data_array != NULL) if (signal_data_array != NULL)
{ schedule_callbacks (connection, signal_data_array, message, sender);
schedule_callbacks (connection, signal_data_array, message, sender);
}
} }
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
@ -2997,14 +2986,12 @@ static void
exported_interface_free (ExportedInterface *ei) exported_interface_free (ExportedInterface *ei)
{ {
if (ei->user_data_free_func != NULL) if (ei->user_data_free_func != NULL)
{ /* TODO: push to thread-default mainloop */
/* TODO: push to thread-default mainloop */ ei->user_data_free_func (ei->user_data);
ei->user_data_free_func (ei->user_data);
}
if (ei->context != NULL) if (ei->context != NULL)
{ g_main_context_unref (ei->context);
g_main_context_unref (ei->context);
}
g_free (ei->interface_name); g_free (ei->interface_name);
g_free (ei); g_free (ei);
} }
@ -3544,22 +3531,14 @@ maybe_add_path (const gchar *path, gsize path_len, const gchar *object_path, GHa
end = strchr (begin, '/'); end = strchr (begin, '/');
if (end != NULL) if (end != NULL)
{ s = g_strndup (begin, end - begin);
s = g_strndup (begin, end - begin);
}
else else
{ s = g_strdup (begin);
s = g_strdup (begin);
}
if (g_hash_table_lookup (set, s) == NULL) if (g_hash_table_lookup (set, s) == NULL)
{ g_hash_table_insert (set, s, GUINT_TO_POINTER (1));
g_hash_table_insert (set, s, GUINT_TO_POINTER (1));
}
else else
{ g_free (s);
g_free (s);
}
} }
} }
@ -3596,9 +3575,7 @@ g_dbus_connection_list_registered_unlocked (GDBusConnection *connection,
p = g_ptr_array_new (); p = g_ptr_array_new ();
keys = g_hash_table_get_keys (set); keys = g_hash_table_get_keys (set);
for (l = keys; l != NULL; l = l->next) for (l = keys; l != NULL; l = l->next)
{ g_ptr_array_add (p, l->data);
g_ptr_array_add (p, l->data);
}
g_hash_table_unref (set); g_hash_table_unref (set);
g_list_free (keys); g_list_free (keys);
@ -3641,16 +3618,12 @@ handle_introspect (GDBusConnection *connection,
/* then include the registered interfaces */ /* then include the registered interfaces */
g_hash_table_iter_init (&hash_iter, eo->map_if_name_to_ei); g_hash_table_iter_init (&hash_iter, eo->map_if_name_to_ei);
while (g_hash_table_iter_next (&hash_iter, NULL, (gpointer) &ei)) while (g_hash_table_iter_next (&hash_iter, NULL, (gpointer) &ei))
{ g_dbus_interface_info_generate_xml (ei->introspection_data, 2, s);
g_dbus_interface_info_generate_xml (ei->introspection_data, 2, s);
}
/* finally include nodes registered below us */ /* finally include nodes registered below us */
registered = g_dbus_connection_list_registered_unlocked (connection, eo->object_path); registered = g_dbus_connection_list_registered_unlocked (connection, eo->object_path);
for (n = 0; registered != NULL && registered[n] != NULL; n++) for (n = 0; registered != NULL && registered[n] != NULL; n++)
{ g_string_append_printf (s, " <node name=\"%s\"/>\n", registered[n]);
g_string_append_printf (s, " <node name=\"%s\"/>\n", registered[n]);
}
g_strfreev (registered); g_strfreev (registered);
g_string_append (s, introspect_tail); g_string_append (s, introspect_tail);
@ -3781,7 +3754,6 @@ validate_and_maybe_schedule_method_call (GDBusConnection *connection,
handled = TRUE; handled = TRUE;
out: out:
return handled; return handled;
} }
@ -4008,9 +3980,7 @@ g_dbus_connection_unregister_object (GDBusConnection *connection,
ei = g_hash_table_lookup (connection->priv->map_id_to_ei, ei = g_hash_table_lookup (connection->priv->map_id_to_ei,
GUINT_TO_POINTER (registration_id)); GUINT_TO_POINTER (registration_id));
if (ei == NULL) if (ei == NULL)
{ goto out;
goto out;
}
eo = ei->eo; eo = ei->eo;
@ -4018,10 +3988,8 @@ g_dbus_connection_unregister_object (GDBusConnection *connection,
g_warn_if_fail (g_hash_table_remove (eo->map_if_name_to_ei, ei->interface_name)); g_warn_if_fail (g_hash_table_remove (eo->map_if_name_to_ei, ei->interface_name));
/* unregister object path if we have no more exported interfaces */ /* unregister object path if we have no more exported interfaces */
if (g_hash_table_size (eo->map_if_name_to_ei) == 0) if (g_hash_table_size (eo->map_if_name_to_ei) == 0)
{ g_warn_if_fail (g_hash_table_remove (connection->priv->map_object_path_to_eo,
g_warn_if_fail (g_hash_table_remove (connection->priv->map_object_path_to_eo, eo->object_path));
eo->object_path));
}
ret = TRUE; ret = TRUE;
@ -4052,13 +4020,13 @@ g_dbus_connection_unregister_object (GDBusConnection *connection,
* Since: 2.26 * Since: 2.26
*/ */
gboolean gboolean
g_dbus_connection_emit_signal (GDBusConnection *connection, g_dbus_connection_emit_signal (GDBusConnection *connection,
const gchar *destination_bus_name, const gchar *destination_bus_name,
const gchar *object_path, const gchar *object_path,
const gchar *interface_name, const gchar *interface_name,
const gchar *signal_name, const gchar *signal_name,
GVariant *parameters, GVariant *parameters,
GError **error) GError **error)
{ {
GDBusMessage *message; GDBusMessage *message;
gboolean ret; gboolean ret;
@ -4078,11 +4046,9 @@ g_dbus_connection_emit_signal (GDBusConnection *connection,
signal_name); signal_name);
if (destination_bus_name != NULL) if (destination_bus_name != NULL)
{ g_dbus_message_set_header (message,
g_dbus_message_set_header (message, G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION,
G_DBUS_MESSAGE_HEADER_FIELD_DESTINATION, g_variant_new_string (destination_bus_name));
g_variant_new_string (destination_bus_name));
}
if (parameters != NULL) if (parameters != NULL)
g_dbus_message_set_body (message, parameters); g_dbus_message_set_body (message, parameters);
@ -4094,8 +4060,8 @@ g_dbus_connection_emit_signal (GDBusConnection *connection,
} }
static void static void
add_invoke_method_flags (GDBusMessage *message, add_invoke_method_flags (GDBusMessage *message,
GDBusInvokeMethodFlags flags) GDBusInvokeMethodFlags flags)
{ {
if (flags & G_DBUS_INVOKE_METHOD_FLAGS_NO_AUTO_START) if (flags & G_DBUS_INVOKE_METHOD_FLAGS_NO_AUTO_START)
g_dbus_message_set_flags (message, G_DBUS_MESSAGE_FLAGS_NO_AUTO_START); g_dbus_message_set_flags (message, G_DBUS_MESSAGE_FLAGS_NO_AUTO_START);
@ -4136,17 +4102,17 @@ add_invoke_method_flags (GDBusMessage *message,
* Since: 2.26 * Since: 2.26
*/ */
void void
g_dbus_connection_invoke_method (GDBusConnection *connection, g_dbus_connection_invoke_method (GDBusConnection *connection,
const gchar *bus_name, const gchar *bus_name,
const gchar *object_path, const gchar *object_path,
const gchar *interface_name, const gchar *interface_name,
const gchar *method_name, const gchar *method_name,
GVariant *parameters, GVariant *parameters,
GDBusInvokeMethodFlags flags, GDBusInvokeMethodFlags flags,
gint timeout_msec, gint timeout_msec,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GDBusMessage *message; GDBusMessage *message;
@ -4174,12 +4140,13 @@ g_dbus_connection_invoke_method (GDBusConnection *connection,
callback, callback,
user_data); user_data);
if (message != NULL) if (message != NULL)
g_object_unref (message); g_object_unref (message);
} }
static GVariant * static GVariant *
decode_method_reply (GDBusMessage *reply, GError **error) decode_method_reply (GDBusMessage *reply,
GError **error)
{ {
GVariant *result; GVariant *result;
@ -4198,6 +4165,7 @@ decode_method_reply (GDBusMessage *reply, GError **error)
g_variant_ref (result); g_variant_ref (result);
} }
break; break;
case G_DBUS_MESSAGE_TYPE_ERROR: case G_DBUS_MESSAGE_TYPE_ERROR:
g_dbus_message_to_gerror (reply, error); g_dbus_message_to_gerror (reply, error);
break; break;
@ -4224,9 +4192,9 @@ decode_method_reply (GDBusMessage *reply, GError **error)
* Since: 2.26 * Since: 2.26
*/ */
GVariant * GVariant *
g_dbus_connection_invoke_method_finish (GDBusConnection *connection, g_dbus_connection_invoke_method_finish (GDBusConnection *connection,
GAsyncResult *res, GAsyncResult *res,
GError **error) GError **error)
{ {
GDBusMessage *reply; GDBusMessage *reply;
GVariant *result; GVariant *result;
@ -4284,16 +4252,16 @@ g_dbus_connection_invoke_method_finish (GDBusConnection *connection,
* Since: 2.26 * Since: 2.26
*/ */
GVariant * GVariant *
g_dbus_connection_invoke_method_sync (GDBusConnection *connection, g_dbus_connection_invoke_method_sync (GDBusConnection *connection,
const gchar *bus_name, const gchar *bus_name,
const gchar *object_path, const gchar *object_path,
const gchar *interface_name, const gchar *interface_name,
const gchar *method_name, const gchar *method_name,
GVariant *parameters, GVariant *parameters,
GDBusInvokeMethodFlags flags, GDBusInvokeMethodFlags flags,
gint timeout_msec, gint timeout_msec,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GDBusMessage *message; GDBusMessage *message;
GDBusMessage *reply; GDBusMessage *reply;
@ -4359,23 +4327,21 @@ static void
exported_subtree_free (ExportedSubtree *es) exported_subtree_free (ExportedSubtree *es)
{ {
if (es->user_data_free_func != NULL) if (es->user_data_free_func != NULL)
{ /* TODO: push to thread-default mainloop */
/* TODO: push to thread-default mainloop */ es->user_data_free_func (es->user_data);
es->user_data_free_func (es->user_data);
}
if (es->context != NULL) if (es->context != NULL)
{ g_main_context_unref (es->context);
g_main_context_unref (es->context);
}
g_free (es->object_path); g_free (es->object_path);
g_free (es); g_free (es);
} }
/* called without lock held */ /* called without lock held */
static gboolean static gboolean
handle_subtree_introspect (GDBusConnection *connection, handle_subtree_introspect (GDBusConnection *connection,
ExportedSubtree *es, ExportedSubtree *es,
GDBusMessage *message) GDBusMessage *message)
{ {
GString *s; GString *s;
gboolean handled; gboolean handled;
@ -4445,17 +4411,13 @@ handle_subtree_introspect (GDBusConnection *connection,
if (is_root) if (is_root)
{ {
for (n = 0; children != NULL && children[n] != NULL; n++) for (n = 0; children != NULL && children[n] != NULL; n++)
{ g_string_append_printf (s, " <node name=\"%s\"/>\n", children[n]);
g_string_append_printf (s, " <node name=\"%s\"/>\n", children[n]);
}
} }
/* finally include nodes registered below us */ /* finally include nodes registered below us */
subnode_paths = g_dbus_connection_list_registered (es->connection, requested_object_path); subnode_paths = g_dbus_connection_list_registered (es->connection, requested_object_path);
for (n = 0; subnode_paths != NULL && subnode_paths[n] != NULL; n++) for (n = 0; subnode_paths != NULL && subnode_paths[n] != NULL; n++)
{ g_string_append_printf (s, " <node name=\"%s\"/>\n", subnode_paths[n]);
g_string_append_printf (s, " <node name=\"%s\"/>\n", subnode_paths[n]);
}
g_strfreev (subnode_paths); g_strfreev (subnode_paths);
g_string_append (s, "</node>\n"); g_string_append (s, "</node>\n");
@ -4475,9 +4437,9 @@ handle_subtree_introspect (GDBusConnection *connection,
/* called without lock held */ /* called without lock held */
static gboolean static gboolean
handle_subtree_method_invocation (GDBusConnection *connection, handle_subtree_method_invocation (GDBusConnection *connection,
ExportedSubtree *es, ExportedSubtree *es,
GDBusMessage *message) GDBusMessage *message)
{ {
gboolean handled;; gboolean handled;;
const gchar *sender; const gchar *sender;
@ -4513,17 +4475,11 @@ handle_subtree_method_invocation (GDBusConnection *connection,
if (g_strcmp0 (interface_name, "org.freedesktop.DBus.Properties") == 0) if (g_strcmp0 (interface_name, "org.freedesktop.DBus.Properties") == 0)
{ {
if (g_strcmp0 (member, "Get") == 0 && g_strcmp0 (signature, "ss") == 0) if (g_strcmp0 (member, "Get") == 0 && g_strcmp0 (signature, "ss") == 0)
{ is_property_get = TRUE;
is_property_get = TRUE;
}
else if (g_strcmp0 (member, "Set") == 0 && g_strcmp0 (signature, "ssv") == 0) else if (g_strcmp0 (member, "Set") == 0 && g_strcmp0 (signature, "ssv") == 0)
{ is_property_set = TRUE;
is_property_set = TRUE;
}
else if (g_strcmp0 (member, "GetAll") == 0 && g_strcmp0 (signature, "s") == 0) else if (g_strcmp0 (member, "GetAll") == 0 && g_strcmp0 (signature, "s") == 0)
{ is_property_get_all = TRUE;
is_property_get_all = TRUE;
}
} }
children = es->vtable->enumerate (es->connection, children = es->vtable->enumerate (es->connection,
@ -4557,9 +4513,7 @@ handle_subtree_method_invocation (GDBusConnection *connection,
{ {
const GDBusInterfaceInfo *id_n = (const GDBusInterfaceInfo *) interfaces->pdata[n]; const GDBusInterfaceInfo *id_n = (const GDBusInterfaceInfo *) interfaces->pdata[n];
if (g_strcmp0 (id_n->name, interface_name) == 0) if (g_strcmp0 (id_n->name, interface_name) == 0)
{ introspection_data = id_n;
introspection_data = id_n;
}
} }
/* dispatch the call if the user wants to handle it */ /* dispatch the call if the user wants to handle it */
@ -4603,9 +4557,7 @@ handle_subtree_method_invocation (GDBusConnection *connection,
{ {
const GDBusInterfaceInfo *id_n = (const GDBusInterfaceInfo *) interfaces->pdata[n]; const GDBusInterfaceInfo *id_n = (const GDBusInterfaceInfo *) interfaces->pdata[n];
if (g_strcmp0 (id_n->name, interface_name) == 0) if (g_strcmp0 (id_n->name, interface_name) == 0)
{ introspection_data = id_n;
introspection_data = id_n;
}
} }
/* Fail with org.freedesktop.DBus.Error.InvalidArgs if the user-code /* Fail with org.freedesktop.DBus.Error.InvalidArgs if the user-code
@ -4693,18 +4645,13 @@ process_subtree_vtable_message_in_idle_cb (gpointer _data)
if (g_strcmp0 (g_dbus_message_get_interface (data->message), "org.freedesktop.DBus.Introspectable") == 0 && if (g_strcmp0 (g_dbus_message_get_interface (data->message), "org.freedesktop.DBus.Introspectable") == 0 &&
g_strcmp0 (g_dbus_message_get_member (data->message), "Introspect") == 0 && g_strcmp0 (g_dbus_message_get_member (data->message), "Introspect") == 0 &&
g_strcmp0 (g_dbus_message_get_signature (data->message), "") == 0) g_strcmp0 (g_dbus_message_get_signature (data->message), "") == 0)
{ handled = handle_subtree_introspect (data->es->connection,
handled = handle_subtree_introspect (data->es->connection, data->es,
data->es, data->message);
data->message);
}
else else
{ handled = handle_subtree_method_invocation (data->es->connection,
handled = handle_subtree_method_invocation (data->es->connection, data->es,
data->es, data->message);
data->message);
}
if (!handled) if (!handled)
{ {
@ -4808,13 +4755,13 @@ subtree_message_func (GDBusConnection *connection,
* Since: 2.26 * Since: 2.26
*/ */
guint guint
g_dbus_connection_register_subtree (GDBusConnection *connection, g_dbus_connection_register_subtree (GDBusConnection *connection,
const gchar *object_path, const gchar *object_path,
const GDBusSubtreeVTable *vtable, const GDBusSubtreeVTable *vtable,
GDBusSubtreeFlags flags, GDBusSubtreeFlags flags,
gpointer user_data, gpointer user_data,
GDestroyNotify user_data_free_func, GDestroyNotify user_data_free_func,
GError **error) GError **error)
{ {
guint ret; guint ret;
ExportedSubtree *es; ExportedSubtree *es;
@ -4894,9 +4841,7 @@ g_dbus_connection_unregister_subtree (GDBusConnection *connection,
es = g_hash_table_lookup (connection->priv->map_id_to_es, es = g_hash_table_lookup (connection->priv->map_id_to_es,
GUINT_TO_POINTER (registration_id)); GUINT_TO_POINTER (registration_id));
if (es == NULL) if (es == NULL)
{ goto out;
goto out;
}
g_warn_if_fail (g_hash_table_remove (connection->priv->map_id_to_es, GUINT_TO_POINTER (es->id))); g_warn_if_fail (g_hash_table_remove (connection->priv->map_id_to_es, GUINT_TO_POINTER (es->id)));
g_warn_if_fail (g_hash_table_remove (connection->priv->map_object_path_to_es, es->object_path)); g_warn_if_fail (g_hash_table_remove (connection->priv->map_object_path_to_es, es->object_path));
@ -4913,9 +4858,9 @@ g_dbus_connection_unregister_subtree (GDBusConnection *connection,
/* must be called with lock held */ /* must be called with lock held */
static void static void
handle_generic_ping_unlocked (GDBusConnection *connection, handle_generic_ping_unlocked (GDBusConnection *connection,
const gchar *object_path, const gchar *object_path,
GDBusMessage *message) GDBusMessage *message)
{ {
GDBusMessage *reply; GDBusMessage *reply;
reply = g_dbus_message_new_method_reply (message); reply = g_dbus_message_new_method_reply (message);
@ -4925,9 +4870,9 @@ handle_generic_ping_unlocked (GDBusConnection *connection,
/* must be called with lock held */ /* must be called with lock held */
static void static void
handle_generic_get_machine_id_unlocked (GDBusConnection *connection, handle_generic_get_machine_id_unlocked (GDBusConnection *connection,
const gchar *object_path, const gchar *object_path,
GDBusMessage *message) GDBusMessage *message)
{ {
GDBusMessage *reply; GDBusMessage *reply;
@ -4966,9 +4911,9 @@ handle_generic_get_machine_id_unlocked (GDBusConnection *connection,
/* must be called with lock held */ /* must be called with lock held */
static void static void
handle_generic_introspect_unlocked (GDBusConnection *connection, handle_generic_introspect_unlocked (GDBusConnection *connection,
const gchar *object_path, const gchar *object_path,
GDBusMessage *message) GDBusMessage *message)
{ {
guint n; guint n;
GString *s; GString *s;
@ -4981,9 +4926,7 @@ handle_generic_introspect_unlocked (GDBusConnection *connection,
registered = g_dbus_connection_list_registered_unlocked (connection, object_path); registered = g_dbus_connection_list_registered_unlocked (connection, object_path);
for (n = 0; registered != NULL && registered[n] != NULL; n++) for (n = 0; registered != NULL && registered[n] != NULL; n++)
{
g_string_append_printf (s, " <node name=\"%s\"/>\n", registered[n]); g_string_append_printf (s, " <node name=\"%s\"/>\n", registered[n]);
}
g_strfreev (registered); g_strfreev (registered);
g_string_append (s, "</node>\n"); g_string_append (s, "</node>\n");
@ -5043,8 +4986,8 @@ handle_generic_unlocked (GDBusConnection *connection,
/* called in message handler thread with lock held */ /* called in message handler thread with lock held */
static void static void
distribute_method_call (GDBusConnection *connection, distribute_method_call (GDBusConnection *connection,
GDBusMessage *message) GDBusMessage *message)
{ {
ExportedObject *eo; ExportedObject *eo;
ExportedSubtree *es; ExportedSubtree *es;
@ -5131,10 +5074,6 @@ message_bus_get_singleton (GBusType bus_type,
switch (bus_type) switch (bus_type)
{ {
default:
g_assert_not_reached ();
break;
case G_BUS_TYPE_SESSION: case G_BUS_TYPE_SESSION:
ret = &the_session_bus; ret = &the_session_bus;
break; break;
@ -5176,15 +5115,20 @@ message_bus_get_singleton (GBusType bus_type,
} }
} }
break; break;
default:
g_assert_not_reached ();
break;
} }
out: out:
return ret; return ret;
} }
static GDBusConnection * static GDBusConnection *
get_uninitialized_connection (GBusType bus_type, get_uninitialized_connection (GBusType bus_type,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GDBusConnection **singleton; GDBusConnection **singleton;
GDBusConnection *ret; GDBusConnection *ret;
@ -5249,9 +5193,9 @@ get_uninitialized_connection (GBusType bus_type,
* Since: 2.26 * Since: 2.26
*/ */
GDBusConnection * GDBusConnection *
g_bus_get_sync (GBusType bus_type, g_bus_get_sync (GBusType bus_type,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GDBusConnection *connection; GDBusConnection *connection;

View File

@ -92,8 +92,7 @@ g_dbus_method_invocation_finalize (GObject *object)
g_object_unref (invocation->priv->message); g_object_unref (invocation->priv->message);
g_variant_unref (invocation->priv->parameters); g_variant_unref (invocation->priv->parameters);
if (G_OBJECT_CLASS (g_dbus_method_invocation_parent_class)->finalize != NULL) G_OBJECT_CLASS (g_dbus_method_invocation_parent_class)->finalize (object);
G_OBJECT_CLASS (g_dbus_method_invocation_parent_class)->finalize (object);
} }
static void static void
@ -220,8 +219,8 @@ g_dbus_method_invocation_class_init (GDBusMethodInvocationClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_SENDER, PROP_SENDER,
g_param_spec_string ("sender", g_param_spec_string ("sender",
_("Sender"), P_("Sender"),
_("The bus name that invoked the method."), P_("The bus name that invoked the method."),
NULL, NULL,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -240,8 +239,8 @@ g_dbus_method_invocation_class_init (GDBusMethodInvocationClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_OBJECT_PATH, PROP_OBJECT_PATH,
g_param_spec_string ("object-path", g_param_spec_string ("object-path",
_("Object Path"), P_("Object Path"),
_("The object path the method was invoked on."), P_("The object path the method was invoked on."),
NULL, NULL,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -260,8 +259,8 @@ g_dbus_method_invocation_class_init (GDBusMethodInvocationClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_INTERFACE_NAME, PROP_INTERFACE_NAME,
g_param_spec_string ("interface-name", g_param_spec_string ("interface-name",
_("Interface Name"), P_("Interface Name"),
_("The name of the D-Bus interface the method was invoked on."), P_("The name of the D-Bus interface the method was invoked on."),
NULL, NULL,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -280,8 +279,8 @@ g_dbus_method_invocation_class_init (GDBusMethodInvocationClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_METHOD_NAME, PROP_METHOD_NAME,
g_param_spec_string ("method-name", g_param_spec_string ("method-name",
_("Method Name"), P_("Method Name"),
_("The name of the method that was invoked."), P_("The name of the method that was invoked."),
NULL, NULL,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -300,8 +299,8 @@ g_dbus_method_invocation_class_init (GDBusMethodInvocationClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_METHOD_INFO, PROP_METHOD_INFO,
g_param_spec_boxed ("method-info", g_param_spec_boxed ("method-info",
_("Method Info"), P_("Method Info"),
_("Information about the method that was invoked, if any."), P_("Information about the method that was invoked, if any."),
G_TYPE_DBUS_METHOD_INFO, G_TYPE_DBUS_METHOD_INFO,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -320,8 +319,8 @@ g_dbus_method_invocation_class_init (GDBusMethodInvocationClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_CONNECTION, PROP_CONNECTION,
g_param_spec_object ("connection", g_param_spec_object ("connection",
_("Connection"), P_("Connection"),
_("The #GDBusConnection the method was invoked on."), P_("The #GDBusConnection the method was invoked on."),
G_TYPE_DBUS_CONNECTION, G_TYPE_DBUS_CONNECTION,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -340,8 +339,8 @@ g_dbus_method_invocation_class_init (GDBusMethodInvocationClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_MESSAGE, PROP_MESSAGE,
g_param_spec_object ("message", g_param_spec_object ("message",
_("Message"), P_("Message"),
_("The D-Bus Message."), P_("The D-Bus Message."),
G_TYPE_DBUS_MESSAGE, G_TYPE_DBUS_MESSAGE,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -360,8 +359,8 @@ g_dbus_method_invocation_class_init (GDBusMethodInvocationClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_PARAMETERS, PROP_PARAMETERS,
g_param_spec_boxed ("parameters", g_param_spec_boxed ("parameters",
_("Parameters"), P_("Parameters"),
_("The parameters as a #GVariant tuple."), P_("The parameters as a #GVariant tuple."),
G_TYPE_VARIANT, G_TYPE_VARIANT,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -380,14 +379,14 @@ g_dbus_method_invocation_class_init (GDBusMethodInvocationClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_USER_DATA, PROP_USER_DATA,
g_param_spec_pointer ("user-data", g_param_spec_pointer ("user-data",
_("User Data"), P_("User Data"),
_("The gpointer passed to g_dbus_connection_register_object()."), P_("The gpointer passed to g_dbus_connection_register_object()."),
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
G_PARAM_CONSTRUCT_ONLY | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NAME |
G_PARAM_STATIC_BLURB | G_PARAM_STATIC_BLURB |
G_PARAM_STATIC_NICK)); G_PARAM_STATIC_NICK));
g_type_class_add_private (klass, sizeof (GDBusMethodInvocationPrivate)); g_type_class_add_private (klass, sizeof (GDBusMethodInvocationPrivate));
} }
@ -579,15 +578,15 @@ g_dbus_method_invocation_get_user_data (GDBusMethodInvocation *invocation)
* Since: 2.26 * Since: 2.26
*/ */
GDBusMethodInvocation * GDBusMethodInvocation *
g_dbus_method_invocation_new (const gchar *sender, g_dbus_method_invocation_new (const gchar *sender,
const gchar *object_path, const gchar *object_path,
const gchar *interface_name, const gchar *interface_name,
const gchar *method_name, const gchar *method_name,
const GDBusMethodInfo *method_info, const GDBusMethodInfo *method_info,
GDBusConnection *connection, GDBusConnection *connection,
GDBusMessage *message, GDBusMessage *message,
GVariant *parameters, GVariant *parameters,
gpointer user_data) gpointer user_data)
{ {
g_return_val_if_fail (sender == NULL || g_dbus_is_name (sender), NULL); g_return_val_if_fail (sender == NULL || g_dbus_is_name (sender), NULL);
g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);

View File

@ -110,16 +110,12 @@ g_dbus_proxy_finalize (GObject *object)
GDBusProxy *proxy = G_DBUS_PROXY (object); GDBusProxy *proxy = G_DBUS_PROXY (object);
if (proxy->priv->properties_changed_subscriber_id > 0) if (proxy->priv->properties_changed_subscriber_id > 0)
{ g_dbus_connection_signal_unsubscribe (proxy->priv->connection,
g_dbus_connection_signal_unsubscribe (proxy->priv->connection, proxy->priv->properties_changed_subscriber_id);
proxy->priv->properties_changed_subscriber_id);
}
if (proxy->priv->signals_subscriber_id > 0) if (proxy->priv->signals_subscriber_id > 0)
{ g_dbus_connection_signal_unsubscribe (proxy->priv->connection,
g_dbus_connection_signal_unsubscribe (proxy->priv->connection, proxy->priv->signals_subscriber_id);
proxy->priv->signals_subscriber_id);
}
g_object_unref (proxy->priv->connection); g_object_unref (proxy->priv->connection);
g_free (proxy->priv->unique_bus_name); g_free (proxy->priv->unique_bus_name);
@ -131,8 +127,7 @@ g_dbus_proxy_finalize (GObject *object)
if (proxy->priv->expected_interface != NULL) if (proxy->priv->expected_interface != NULL)
g_dbus_interface_info_unref (proxy->priv->expected_interface); g_dbus_interface_info_unref (proxy->priv->expected_interface);
if (G_OBJECT_CLASS (g_dbus_proxy_parent_class)->finalize != NULL) G_OBJECT_CLASS (g_dbus_proxy_parent_class)->finalize (object);
G_OBJECT_CLASS (g_dbus_proxy_parent_class)->finalize (object);
} }
static void static void
@ -250,8 +245,8 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_G_INTERFACE_INFO, PROP_G_INTERFACE_INFO,
g_param_spec_boxed ("g-interface-info", g_param_spec_boxed ("g-interface-info",
_("Interface Information"), P_("Interface Information"),
_("Interface Information"), P_("Interface Information"),
G_TYPE_DBUS_INTERFACE_INFO, G_TYPE_DBUS_INTERFACE_INFO,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -269,8 +264,8 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_G_CONNECTION, PROP_G_CONNECTION,
g_param_spec_object ("g-connection", g_param_spec_object ("g-connection",
_("g-connection"), P_("g-connection"),
_("The connection the proxy is for"), P_("The connection the proxy is for"),
G_TYPE_DBUS_CONNECTION, G_TYPE_DBUS_CONNECTION,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -289,8 +284,8 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_G_FLAGS, PROP_G_FLAGS,
g_param_spec_flags ("g-flags", g_param_spec_flags ("g-flags",
_("g-flags"), P_("g-flags"),
_("Flags for the proxy"), P_("Flags for the proxy"),
G_TYPE_DBUS_PROXY_FLAGS, G_TYPE_DBUS_PROXY_FLAGS,
G_DBUS_PROXY_FLAGS_NONE, G_DBUS_PROXY_FLAGS_NONE,
G_PARAM_READABLE | G_PARAM_READABLE |
@ -310,8 +305,8 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_G_UNIQUE_BUS_NAME, PROP_G_UNIQUE_BUS_NAME,
g_param_spec_string ("g-unique-bus-name", g_param_spec_string ("g-unique-bus-name",
_("g-unique-bus-name"), P_("g-unique-bus-name"),
_("The unique bus name the proxy is for"), P_("The unique bus name the proxy is for"),
NULL, NULL,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -330,8 +325,8 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_G_OBJECT_PATH, PROP_G_OBJECT_PATH,
g_param_spec_string ("g-object-path", g_param_spec_string ("g-object-path",
_("g-object-path"), P_("g-object-path"),
_("The object path the proxy is for"), P_("The object path the proxy is for"),
NULL, NULL,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -350,8 +345,8 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_G_INTERFACE_NAME, PROP_G_INTERFACE_NAME,
g_param_spec_string ("g-interface-name", g_param_spec_string ("g-interface-name",
_("g-interface-name"), P_("g-interface-name"),
_("The D-Bus interface name the proxy is for"), P_("The D-Bus interface name the proxy is for"),
NULL, NULL,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -377,8 +372,8 @@ g_dbus_proxy_class_init (GDBusProxyClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_G_DEFAULT_TIMEOUT, PROP_G_DEFAULT_TIMEOUT,
g_param_spec_int ("g-default-timeout", g_param_spec_int ("g-default-timeout",
_("Default Timeout"), P_("Default Timeout"),
_("Timeout for remote method invocation"), P_("Timeout for remote method invocation"),
-1, -1,
G_MAXINT, G_MAXINT,
-1, -1,
@ -459,8 +454,8 @@ g_dbus_proxy_init (GDBusProxy *proxy)
* Since: 2.26 * Since: 2.26
*/ */
gchar ** gchar **
g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy, g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy,
GError **error) GError **error)
{ {
gchar **names; gchar **names;
GPtrArray *p; GPtrArray *p;
@ -485,9 +480,7 @@ g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy,
g_hash_table_iter_init (&iter, proxy->priv->properties); g_hash_table_iter_init (&iter, proxy->priv->properties);
while (g_hash_table_iter_next (&iter, (gpointer) &key, NULL)) while (g_hash_table_iter_next (&iter, (gpointer) &key, NULL))
{ g_ptr_array_add (p, g_strdup (key));
g_ptr_array_add (p, g_strdup (key));
}
g_ptr_array_sort (p, (GCompareFunc) g_strcmp0); g_ptr_array_sort (p, (GCompareFunc) g_strcmp0);
g_ptr_array_add (p, NULL); g_ptr_array_add (p, NULL);
@ -519,9 +512,9 @@ g_dbus_proxy_get_cached_property_names (GDBusProxy *proxy,
* Since: 2.26 * Since: 2.26
*/ */
GVariant * GVariant *
g_dbus_proxy_get_cached_property (GDBusProxy *proxy, g_dbus_proxy_get_cached_property (GDBusProxy *proxy,
const gchar *property_name, const gchar *property_name,
GError **error) GError **error)
{ {
GVariant *value; GVariant *value;
@ -560,13 +553,13 @@ g_dbus_proxy_get_cached_property (GDBusProxy *proxy,
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
static void static void
on_signal_received (GDBusConnection *connection, on_signal_received (GDBusConnection *connection,
const gchar *sender_name, const gchar *sender_name,
const gchar *object_path, const gchar *object_path,
const gchar *interface_name, const gchar *interface_name,
const gchar *signal_name, const gchar *signal_name,
GVariant *parameters, GVariant *parameters,
gpointer user_data) gpointer user_data)
{ {
GDBusProxy *proxy = G_DBUS_PROXY (user_data); GDBusProxy *proxy = G_DBUS_PROXY (user_data);
@ -581,13 +574,13 @@ on_signal_received (GDBusConnection *connection,
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
static void static void
on_properties_changed (GDBusConnection *connection, on_properties_changed (GDBusConnection *connection,
const gchar *sender_name, const gchar *sender_name,
const gchar *object_path, const gchar *object_path,
const gchar *interface_name, const gchar *interface_name,
const gchar *signal_name, const gchar *signal_name,
GVariant *parameters, GVariant *parameters,
gpointer user_data) gpointer user_data)
{ {
GDBusProxy *proxy = G_DBUS_PROXY (user_data); GDBusProxy *proxy = G_DBUS_PROXY (user_data);
GError *error; GError *error;
@ -746,9 +739,9 @@ process_get_all_reply (GDBusProxy *proxy,
} }
static gboolean static gboolean
initable_init (GInitable *initable, initable_init (GInitable *initable,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GDBusProxy *proxy = G_DBUS_PROXY (initable); GDBusProxy *proxy = G_DBUS_PROXY (initable);
GVariant *result; GVariant *result;
@ -823,11 +816,11 @@ get_all_cb (GDBusConnection *connection,
} }
static void static void
async_initable_init_async (GAsyncInitable *initable, async_initable_init_async (GAsyncInitable *initable,
gint io_priority, gint io_priority,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GDBusProxy *proxy = G_DBUS_PROXY (initable); GDBusProxy *proxy = G_DBUS_PROXY (initable);
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
@ -1248,9 +1241,9 @@ g_dbus_proxy_set_interface_info (GDBusProxy *proxy,
/* ---------------------------------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------------------------------------- */
static gboolean static gboolean
maybe_split_method_name (const gchar *method_name, maybe_split_method_name (const gchar *method_name,
gchar **out_interface_name, gchar **out_interface_name,
const gchar **out_method_name) const gchar **out_method_name)
{ {
gboolean was_split; gboolean was_split;
@ -1310,8 +1303,8 @@ reply_cb (GDBusConnection *connection,
} }
static const GDBusMethodInfo * static const GDBusMethodInfo *
lookup_method_info_or_warn (GDBusProxy *proxy, lookup_method_info_or_warn (GDBusProxy *proxy,
const char *method_name) const gchar *method_name)
{ {
const GDBusMethodInfo *info; const GDBusMethodInfo *info;
@ -1400,14 +1393,14 @@ validate_method_return (const char *method_name,
* Since: 2.26 * Since: 2.26
*/ */
void void
g_dbus_proxy_invoke_method (GDBusProxy *proxy, g_dbus_proxy_invoke_method (GDBusProxy *proxy,
const gchar *method_name, const gchar *method_name,
GVariant *parameters, GVariant *parameters,
GDBusInvokeMethodFlags flags, GDBusInvokeMethodFlags flags,
gint timeout_msec, gint timeout_msec,
GCancellable *cancellable, GCancellable *cancellable,
GAsyncReadyCallback callback, GAsyncReadyCallback callback,
gpointer user_data) gpointer user_data)
{ {
GSimpleAsyncResult *simple; GSimpleAsyncResult *simple;
gboolean was_split; gboolean was_split;
@ -1536,21 +1529,21 @@ g_dbus_proxy_invoke_method_finish (GDBusProxy *proxy,
* Since: 2.26 * Since: 2.26
*/ */
GVariant * GVariant *
g_dbus_proxy_invoke_method_sync (GDBusProxy *proxy, g_dbus_proxy_invoke_method_sync (GDBusProxy *proxy,
const gchar *method_name, const gchar *method_name,
GVariant *parameters, GVariant *parameters,
GDBusInvokeMethodFlags flags, GDBusInvokeMethodFlags flags,
gint timeout_msec, gint timeout_msec,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GVariant *ret; GVariant *ret;
gboolean was_split; gboolean was_split;
gchar *split_interface_name; gchar *split_interface_name;
const gchar *split_method_name; const gchar *split_method_name;
const GDBusMethodInfo *expected_method_info; const GDBusMethodInfo *expected_method_info;
const char *target_method_name; const gchar *target_method_name;
const char *target_interface_name; const gchar *target_interface_name;
g_return_val_if_fail (G_IS_DBUS_PROXY (proxy), NULL); g_return_val_if_fail (G_IS_DBUS_PROXY (proxy), NULL);
g_return_val_if_fail (g_dbus_is_member_name (method_name) || g_dbus_is_interface_name (method_name), NULL); g_return_val_if_fail (g_dbus_is_member_name (method_name) || g_dbus_is_interface_name (method_name), NULL);

View File

@ -134,8 +134,7 @@ g_dbus_server_finalize (GObject *object)
if (server->priv->main_context_at_construction != NULL) if (server->priv->main_context_at_construction != NULL)
g_main_context_unref (server->priv->main_context_at_construction); g_main_context_unref (server->priv->main_context_at_construction);
if (G_OBJECT_CLASS (g_dbus_server_parent_class)->finalize != NULL) G_OBJECT_CLASS (g_dbus_server_parent_class)->finalize (object);
G_OBJECT_CLASS (g_dbus_server_parent_class)->finalize (object);
} }
static void static void
@ -229,8 +228,8 @@ g_dbus_server_class_init (GDBusServerClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_FLAGS, PROP_FLAGS,
g_param_spec_flags ("flags", g_param_spec_flags ("flags",
_("Flags"), P_("Flags"),
_("Flags for the server"), P_("Flags for the server"),
G_TYPE_DBUS_SERVER_FLAGS, G_TYPE_DBUS_SERVER_FLAGS,
G_DBUS_SERVER_FLAGS_NONE, G_DBUS_SERVER_FLAGS_NONE,
G_PARAM_READABLE | G_PARAM_READABLE |
@ -250,8 +249,8 @@ g_dbus_server_class_init (GDBusServerClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_GUID, PROP_GUID,
g_param_spec_string ("guid", g_param_spec_string ("guid",
_("GUID"), P_("GUID"),
_("The guid of the server"), P_("The guid of the server"),
NULL, NULL,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -270,8 +269,8 @@ g_dbus_server_class_init (GDBusServerClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_ADDRESS, PROP_ADDRESS,
g_param_spec_string ("address", g_param_spec_string ("address",
_("Address"), P_("Address"),
_("The address to listen on"), P_("The address to listen on"),
NULL, NULL,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -290,8 +289,8 @@ g_dbus_server_class_init (GDBusServerClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_CLIENT_ADDRESS, PROP_CLIENT_ADDRESS,
g_param_spec_string ("client-address", g_param_spec_string ("client-address",
_("Client Address"), P_("Client Address"),
_("The address clients can use"), P_("The address clients can use"),
NULL, NULL,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NAME |
@ -308,8 +307,8 @@ g_dbus_server_class_init (GDBusServerClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_ACTIVE, PROP_ACTIVE,
g_param_spec_string ("active", g_param_spec_string ("active",
_("Active"), P_("Active"),
_("Whether the server is currently active"), P_("Whether the server is currently active"),
NULL, NULL,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_STATIC_NAME | G_PARAM_STATIC_NAME |
@ -326,8 +325,8 @@ g_dbus_server_class_init (GDBusServerClass *klass)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_AUTHENTICATION_OBSERVER, PROP_AUTHENTICATION_OBSERVER,
g_param_spec_object ("authentication-observer", g_param_spec_object ("authentication-observer",
_("Authentication Observer"), P_("Authentication Observer"),
_("Object used to assist in the authentication process"), P_("Object used to assist in the authentication process"),
G_TYPE_DBUS_AUTH_OBSERVER, G_TYPE_DBUS_AUTH_OBSERVER,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |
@ -422,12 +421,12 @@ on_run (GSocketService *service,
* Since: 2.26 * Since: 2.26
*/ */
GDBusServer * GDBusServer *
g_dbus_server_new_sync (const gchar *address, g_dbus_server_new_sync (const gchar *address,
GDBusServerFlags flags, GDBusServerFlags flags,
const gchar *guid, const gchar *guid,
GDBusAuthObserver *observer, GDBusAuthObserver *observer,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GDBusServer *server; GDBusServer *server;
@ -764,9 +763,8 @@ try_tcp (GDBusServer *server,
NULL, NULL,
error); error);
if (resolved_addresses == NULL) if (resolved_addresses == NULL)
{ goto out;
goto out;
}
/* TODO: handle family */ /* TODO: handle family */
for (l = resolved_addresses; l != NULL; l = l->next) for (l = resolved_addresses; l != NULL; l = l->next)
{ {
@ -787,10 +785,9 @@ try_tcp (GDBusServer *server,
goto out; goto out;
} }
if (port_num == 0) if (port_num == 0)
{ /* make sure we allocate the same port number for other listeners */
/* make sure we allocate the same port number for other listeners */ port_num = g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (effective_address));
port_num = g_inet_socket_address_get_port (G_INET_SOCKET_ADDRESS (effective_address));
}
g_object_unref (effective_address); g_object_unref (effective_address);
g_object_unref (socket_address); g_object_unref (socket_address);
} }
@ -961,9 +958,9 @@ on_run (GSocketService *service,
} }
static gboolean static gboolean
initable_init (GInitable *initable, initable_init (GInitable *initable,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
GDBusServer *server = G_DBUS_SERVER (initable); GDBusServer *server = G_DBUS_SERVER (initable);
gboolean ret; gboolean ret;
@ -1009,26 +1006,18 @@ initable_init (GInitable *initable,
} }
#ifdef G_OS_UNIX #ifdef G_OS_UNIX
else if (g_strcmp0 (transport_name, "unix") == 0) else if (g_strcmp0 (transport_name, "unix") == 0)
{ ret = try_unix (server, address_entry, key_value_pairs, &this_error);
ret = try_unix (server, address_entry, key_value_pairs, &this_error);
}
#endif #endif
else if (g_strcmp0 (transport_name, "tcp") == 0) else if (g_strcmp0 (transport_name, "tcp") == 0)
{ ret = try_tcp (server, address_entry, key_value_pairs, FALSE, &this_error);
ret = try_tcp (server, address_entry, key_value_pairs, FALSE, &this_error);
}
else if (g_strcmp0 (transport_name, "nonce-tcp") == 0) else if (g_strcmp0 (transport_name, "nonce-tcp") == 0)
{ ret = try_tcp (server, address_entry, key_value_pairs, TRUE, &this_error);
ret = try_tcp (server, address_entry, key_value_pairs, TRUE, &this_error);
}
else else
{ g_set_error (&this_error,
g_set_error (&this_error, G_IO_ERROR,
G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
G_IO_ERROR_INVALID_ARGUMENT, _("Cannot listen on unsupported transport `%s'"),
_("Cannot listen on unsupported transport `%s'"), transport_name);
transport_name);
}
g_free (transport_name); g_free (transport_name);
if (key_value_pairs != NULL) if (key_value_pairs != NULL)

View File

@ -157,8 +157,7 @@ g_unix_credentials_message_finalize (GObject *object)
if (message->priv->credentials != NULL) if (message->priv->credentials != NULL)
g_object_unref (message->priv->credentials); g_object_unref (message->priv->credentials);
if (G_OBJECT_CLASS (g_unix_credentials_message_parent_class)->finalize != NULL) G_OBJECT_CLASS (g_unix_credentials_message_parent_class)->finalize (object);
G_OBJECT_CLASS (g_unix_credentials_message_parent_class)->finalize (object);
} }
static void static void
@ -252,8 +251,8 @@ g_unix_credentials_message_class_init (GUnixCredentialsMessageClass *class)
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_CREDENTIALS, PROP_CREDENTIALS,
g_param_spec_object ("credentials", g_param_spec_object ("credentials",
_("Credentials"), P_("Credentials"),
_("The credentials stored in the message"), P_("The credentials stored in the message"),
G_TYPE_CREDENTIALS, G_TYPE_CREDENTIALS,
G_PARAM_READABLE | G_PARAM_READABLE |
G_PARAM_WRITABLE | G_PARAM_WRITABLE |