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,
PROP_STREAM,
g_param_spec_object ("stream",
_("IO Stream"),
_("The underlying GIOStream used for I/O"),
P_("IO Stream"),
P_("The underlying GIOStream used for I/O"),
G_TYPE_IO_STREAM,
G_PARAM_READABLE |
G_PARAM_WRITABLE |

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -157,8 +157,7 @@ g_unix_credentials_message_finalize (GObject *object)
if (message->priv->credentials != NULL)
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
@ -252,8 +251,8 @@ g_unix_credentials_message_class_init (GUnixCredentialsMessageClass *class)
g_object_class_install_property (gobject_class,
PROP_CREDENTIALS,
g_param_spec_object ("credentials",
_("Credentials"),
_("The credentials stored in the message"),
P_("Credentials"),
P_("The credentials stored in the message"),
G_TYPE_CREDENTIALS,
G_PARAM_READABLE |
G_PARAM_WRITABLE |