[glib] GDBus: Hide instance structures for classes we don't want to be subclassed
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GDBus: Hide instance structures for classes we don't want to be subclassed
- Date: Wed, 7 Jul 2010 20:37:47 +0000 (UTC)
commit abc65b233ccb14366fbd07bbed3ee3cacd5e79ea
Author: David Zeuthen <davidz redhat com>
Date: Wed Jul 7 16:35:17 2010 -0400
GDBus: Hide instance structures for classes we don't want to be subclassed
This also allows us to nuke the priv-> pointers and save a couple of
indirections.
Signed-off-by: David Zeuthen <davidz redhat com>
gio/gdbusauthobserver.c | 21 ++-
gio/gdbusauthobserver.h | 20 --
gio/gdbusconnection.c | 431 ++++++++++++++++++++++---------------------
gio/gdbusconnection.h | 21 --
gio/gdbusmessage.c | 166 +++++++++--------
gio/gdbusmessage.h | 21 --
gio/gdbusmethodinvocation.c | 81 +++++----
gio/gdbusmethodinvocation.h | 21 --
gio/gdbusserver.c | 186 ++++++++++---------
gio/gdbusserver.h | 21 --
10 files changed, 459 insertions(+), 530 deletions(-)
---
diff --git a/gio/gdbusauthobserver.c b/gio/gdbusauthobserver.c
index 450bf22..0645152 100644
--- a/gio/gdbusauthobserver.c
+++ b/gio/gdbusauthobserver.c
@@ -100,6 +100,8 @@
* </programlisting></example>
*/
+typedef struct _GDBusAuthObserverClass GDBusAuthObserverClass;
+
/**
* GDBusAuthObserverClass:
* @authorize_authenticated_peer: Signal class handler for the #GDBusAuthObserver::authorize-authenticated-peer signal.
@@ -121,9 +123,17 @@ struct _GDBusAuthObserverClass
GCredentials *credentials);
};
-struct _GDBusAuthObserverPrivate
+/**
+ * GDBusAuthObserver:
+ *
+ * The #GDBusAuthObserver structure contains only private data and
+ * should only be accessed using the provided API.
+ *
+ * Since: 2.26
+ */
+struct _GDBusAuthObserver
{
- gint foo;
+ GObject parent_instance;
};
enum
@@ -202,18 +212,11 @@ g_dbus_auth_observer_class_init (GDBusAuthObserverClass *klass)
2,
G_TYPE_IO_STREAM,
G_TYPE_CREDENTIALS);
-
-
- g_type_class_add_private (klass, sizeof (GDBusAuthObserverPrivate));
}
static void
g_dbus_auth_observer_init (GDBusAuthObserver *observer)
{
- /* not used for now */
- observer->priv = G_TYPE_INSTANCE_GET_PRIVATE (observer,
- G_TYPE_DBUS_AUTH_OBSERVER,
- GDBusAuthObserverPrivate);
}
/**
diff --git a/gio/gdbusauthobserver.h b/gio/gdbusauthobserver.h
index 1489aac..fb709cd 100644
--- a/gio/gdbusauthobserver.h
+++ b/gio/gdbusauthobserver.h
@@ -33,27 +33,7 @@ G_BEGIN_DECLS
#define G_TYPE_DBUS_AUTH_OBSERVER (g_dbus_auth_observer_get_type ())
#define G_DBUS_AUTH_OBSERVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_AUTH_OBSERVER, GDBusAuthObserver))
-#define G_DBUS_AUTH_OBSERVER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_AUTH_OBSERVER, GDBusAuthObserverClass))
-#define G_DBUS_AUTH_OBSERVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_AUTH_OBSERVER, GDBusAuthObserverClass))
#define G_IS_DBUS_AUTH_OBSERVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_AUTH_OBSERVER))
-#define G_IS_DBUS_AUTH_OBSERVER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_AUTH_OBSERVER))
-
-typedef struct _GDBusAuthObserverClass GDBusAuthObserverClass;
-typedef struct _GDBusAuthObserverPrivate GDBusAuthObserverPrivate;
-
-/**
- * GDBusAuthObserver:
- *
- * The #GDBusAuthObserver structure contains only private data and
- * should only be accessed using the provided API.
- *
- * Since: 2.26
- */
-struct _GDBusAuthObserver
-{
- GObject parent_instance;
- GDBusAuthObserverPrivate *priv;
-};
GType g_dbus_auth_observer_get_type (void) G_GNUC_CONST;
GDBusAuthObserver *g_dbus_auth_observer_new (void);
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index 211f306..1cdabc2 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -157,6 +157,8 @@
/* ---------------------------------------------------------------------------------------------------- */
+typedef struct _GDBusConnectionClass GDBusConnectionClass;
+
/**
* GDBusConnectionClass:
* @closed: Signal class handler for the #GDBusConnection::closed signal.
@@ -205,7 +207,7 @@ _g_strv_has_string (const gchar* const *haystack,
#else
// TODO: for some reason this doesn't work on Windows
#define CONNECTION_ENSURE_LOCK(obj) do { \
- if (G_UNLIKELY (g_mutex_trylock((obj)->priv->lock))) \
+ if (G_UNLIKELY (g_mutex_trylock((obj)->lock))) \
{ \
g_assertion_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
"CONNECTION_ENSURE_LOCK: GDBusConnection object lock is not locked"); \
@@ -214,15 +216,26 @@ _g_strv_has_string (const gchar* const *haystack,
#endif
#define CONNECTION_LOCK(obj) do { \
- g_mutex_lock ((obj)->priv->lock); \
+ g_mutex_lock ((obj)->lock); \
} while (FALSE)
#define CONNECTION_UNLOCK(obj) do { \
- g_mutex_unlock ((obj)->priv->lock); \
+ g_mutex_unlock ((obj)->lock); \
} while (FALSE)
-struct _GDBusConnectionPrivate
+/**
+ * GDBusConnection:
+ *
+ * The #GDBusConnection structure contains only private data and
+ * should only be accessed using the provided API.
+ *
+ * Since: 2.26
+ */
+struct _GDBusConnection
{
+ /*< private >*/
+ GObject parent_instance;
+
/* ------------------------------------------------------------------------ */
/* -- General object state ------------------------------------------------ */
/* ------------------------------------------------------------------------ */
@@ -380,10 +393,10 @@ g_dbus_connection_dispose (GObject *object)
{
the_system_bus = NULL;
}
- if (connection->priv->worker != NULL)
+ if (connection->worker != NULL)
{
- _g_dbus_worker_stop (connection->priv->worker);
- connection->priv->worker = NULL;
+ _g_dbus_worker_stop (connection->worker);
+ connection->worker = NULL;
}
G_UNLOCK (message_bus_lock);
@@ -396,55 +409,55 @@ g_dbus_connection_finalize (GObject *object)
{
GDBusConnection *connection = G_DBUS_CONNECTION (object);
- if (connection->priv->authentication_observer != NULL)
- g_object_unref (connection->priv->authentication_observer);
+ if (connection->authentication_observer != NULL)
+ g_object_unref (connection->authentication_observer);
- if (connection->priv->auth != NULL)
- g_object_unref (connection->priv->auth);
+ if (connection->auth != NULL)
+ g_object_unref (connection->auth);
//g_debug ("finalizing %p", connection);
- if (connection->priv->stream != NULL)
+ if (connection->stream != NULL)
{
/* We don't really care if closing the stream succeeds or not */
- g_io_stream_close_async (connection->priv->stream,
+ g_io_stream_close_async (connection->stream,
G_PRIORITY_DEFAULT,
NULL, /* GCancellable */
NULL, /* GAsyncReadyCallback */
NULL); /* userdata */
- g_object_unref (connection->priv->stream);
- connection->priv->stream = NULL;
+ g_object_unref (connection->stream);
+ connection->stream = NULL;
}
- g_free (connection->priv->address);
+ g_free (connection->address);
- g_free (connection->priv->guid);
- g_free (connection->priv->bus_unique_name);
+ g_free (connection->guid);
+ g_free (connection->bus_unique_name);
- if (connection->priv->initialization_error != NULL)
- g_error_free (connection->priv->initialization_error);
+ if (connection->initialization_error != NULL)
+ g_error_free (connection->initialization_error);
- g_hash_table_unref (connection->priv->map_method_serial_to_send_message_data);
+ g_hash_table_unref (connection->map_method_serial_to_send_message_data);
purge_all_signal_subscriptions (connection);
- g_hash_table_unref (connection->priv->map_rule_to_signal_data);
- g_hash_table_unref (connection->priv->map_id_to_signal_data);
- g_hash_table_unref (connection->priv->map_sender_unique_name_to_signal_data_array);
+ g_hash_table_unref (connection->map_rule_to_signal_data);
+ g_hash_table_unref (connection->map_id_to_signal_data);
+ g_hash_table_unref (connection->map_sender_unique_name_to_signal_data_array);
- g_hash_table_unref (connection->priv->map_id_to_ei);
- g_hash_table_unref (connection->priv->map_object_path_to_eo);
- g_hash_table_unref (connection->priv->map_id_to_es);
- g_hash_table_unref (connection->priv->map_object_path_to_es);
+ g_hash_table_unref (connection->map_id_to_ei);
+ g_hash_table_unref (connection->map_object_path_to_eo);
+ g_hash_table_unref (connection->map_id_to_es);
+ g_hash_table_unref (connection->map_object_path_to_es);
purge_all_filters (connection);
- g_ptr_array_unref (connection->priv->filters);
+ g_ptr_array_unref (connection->filters);
- if (connection->priv->main_context_at_construction != NULL)
- g_main_context_unref (connection->priv->main_context_at_construction);
+ if (connection->main_context_at_construction != NULL)
+ g_main_context_unref (connection->main_context_at_construction);
- g_free (connection->priv->machine_id);
+ g_free (connection->machine_id);
- g_mutex_free (connection->priv->init_lock);
- g_mutex_free (connection->priv->lock);
+ g_mutex_free (connection->init_lock);
+ g_mutex_free (connection->lock);
G_OBJECT_CLASS (g_dbus_connection_parent_class)->finalize (object);
}
@@ -500,19 +513,19 @@ g_dbus_connection_set_property (GObject *object,
switch (prop_id)
{
case PROP_STREAM:
- connection->priv->stream = g_value_dup_object (value);
+ connection->stream = g_value_dup_object (value);
break;
case PROP_GUID:
- connection->priv->guid = g_value_dup_string (value);
+ connection->guid = g_value_dup_string (value);
break;
case PROP_ADDRESS:
- connection->priv->address = g_value_dup_string (value);
+ connection->address = g_value_dup_string (value);
break;
case PROP_FLAGS:
- connection->priv->flags = g_value_get_flags (value);
+ connection->flags = g_value_get_flags (value);
break;
case PROP_EXIT_ON_CLOSE:
@@ -520,7 +533,7 @@ g_dbus_connection_set_property (GObject *object,
break;
case PROP_AUTHENTICATION_OBSERVER:
- connection->priv->authentication_observer = g_value_dup_object (value);
+ connection->authentication_observer = g_value_dup_object (value);
break;
default:
@@ -534,7 +547,7 @@ g_dbus_connection_real_closed (GDBusConnection *connection,
gboolean remote_peer_vanished,
GError *error)
{
- if (remote_peer_vanished && connection->priv->exit_on_close)
+ if (remote_peer_vanished && connection->exit_on_close)
{
g_print ("%s: Remote peer vanished. Exiting.\n", G_STRFUNC);
raise (SIGTERM);
@@ -546,8 +559,6 @@ g_dbus_connection_class_init (GDBusConnectionClass *klass)
{
GObjectClass *gobject_class;
- g_type_class_add_private (klass, sizeof (GDBusConnectionPrivate));
-
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = g_dbus_connection_finalize;
@@ -794,43 +805,41 @@ g_dbus_connection_class_init (GDBusConnectionClass *klass)
static void
g_dbus_connection_init (GDBusConnection *connection)
{
- connection->priv = G_TYPE_INSTANCE_GET_PRIVATE (connection, G_TYPE_DBUS_CONNECTION, GDBusConnectionPrivate);
-
- connection->priv->lock = g_mutex_new ();
- connection->priv->init_lock = g_mutex_new ();
+ connection->lock = g_mutex_new ();
+ connection->init_lock = g_mutex_new ();
- connection->priv->map_method_serial_to_send_message_data = g_hash_table_new (g_direct_hash, g_direct_equal);
+ connection->map_method_serial_to_send_message_data = g_hash_table_new (g_direct_hash, g_direct_equal);
- connection->priv->map_rule_to_signal_data = g_hash_table_new (g_str_hash,
- g_str_equal);
- connection->priv->map_id_to_signal_data = g_hash_table_new (g_direct_hash,
- g_direct_equal);
- connection->priv->map_sender_unique_name_to_signal_data_array = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- NULL);
+ connection->map_rule_to_signal_data = g_hash_table_new (g_str_hash,
+ g_str_equal);
+ connection->map_id_to_signal_data = g_hash_table_new (g_direct_hash,
+ g_direct_equal);
+ connection->map_sender_unique_name_to_signal_data_array = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ g_free,
+ NULL);
- connection->priv->map_object_path_to_eo = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- NULL,
- (GDestroyNotify) exported_object_free);
+ connection->map_object_path_to_eo = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ NULL,
+ (GDestroyNotify) exported_object_free);
- connection->priv->map_id_to_ei = g_hash_table_new (g_direct_hash,
- g_direct_equal);
+ connection->map_id_to_ei = g_hash_table_new (g_direct_hash,
+ g_direct_equal);
- connection->priv->map_object_path_to_es = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- NULL,
- (GDestroyNotify) exported_subtree_free);
+ connection->map_object_path_to_es = g_hash_table_new_full (g_str_hash,
+ g_str_equal,
+ NULL,
+ (GDestroyNotify) exported_subtree_free);
- connection->priv->map_id_to_es = g_hash_table_new (g_direct_hash,
- g_direct_equal);
+ connection->map_id_to_es = g_hash_table_new (g_direct_hash,
+ g_direct_equal);
- connection->priv->main_context_at_construction = g_main_context_get_thread_default ();
- if (connection->priv->main_context_at_construction != NULL)
- g_main_context_ref (connection->priv->main_context_at_construction);
+ connection->main_context_at_construction = g_main_context_get_thread_default ();
+ if (connection->main_context_at_construction != NULL)
+ g_main_context_ref (connection->main_context_at_construction);
- connection->priv->filters = g_ptr_array_new ();
+ connection->filters = g_ptr_array_new ();
}
/**
@@ -847,7 +856,7 @@ GIOStream *
g_dbus_connection_get_stream (GDBusConnection *connection)
{
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
- return connection->priv->stream;
+ return connection->stream;
}
/**
@@ -865,7 +874,7 @@ void
g_dbus_connection_start_message_processing (GDBusConnection *connection)
{
g_return_if_fail (G_IS_DBUS_CONNECTION (connection));
- _g_dbus_worker_unfreeze (connection->priv->worker);
+ _g_dbus_worker_unfreeze (connection->worker);
}
/**
@@ -882,7 +891,7 @@ gboolean
g_dbus_connection_is_closed (GDBusConnection *connection)
{
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), FALSE);
- return connection->priv->closed;
+ return connection->closed;
}
/**
@@ -899,7 +908,7 @@ GDBusCapabilityFlags
g_dbus_connection_get_capabilities (GDBusConnection *connection)
{
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), G_DBUS_CAPABILITY_FLAGS_NONE);
- return connection->priv->capabilities;
+ return connection->capabilities;
}
/* ---------------------------------------------------------------------------------------------------- */
@@ -1031,7 +1040,7 @@ g_dbus_connection_flush_sync (GDBusConnection *connection,
ret = FALSE;
- if (connection->priv->closed)
+ if (connection->closed)
{
g_set_error_literal (error,
G_IO_ERROR,
@@ -1040,7 +1049,7 @@ g_dbus_connection_flush_sync (GDBusConnection *connection,
goto out;
}
- ret = _g_dbus_worker_flush_sync (connection->priv->worker,
+ ret = _g_dbus_worker_flush_sync (connection->worker,
cancellable,
error);
@@ -1093,9 +1102,9 @@ set_closed_unlocked (GDBusConnection *connection,
CONNECTION_ENSURE_LOCK (connection);
- g_assert (!connection->priv->closed);
+ g_assert (!connection->closed);
- connection->priv->closed = TRUE;
+ connection->closed = TRUE;
data = g_new0 (EmitClosedData, 1);
data->connection = g_object_ref (connection);
@@ -1108,7 +1117,7 @@ set_closed_unlocked (GDBusConnection *connection,
emit_closed_in_idle,
data,
(GDestroyNotify) emit_closed_data_free);
- g_source_attach (idle_source, connection->priv->main_context_at_construction);
+ g_source_attach (idle_source, connection->main_context_at_construction);
g_source_unref (idle_source);
}
@@ -1139,13 +1148,13 @@ g_dbus_connection_close (GDBusConnection *connection)
g_return_if_fail (G_IS_DBUS_CONNECTION (connection));
CONNECTION_LOCK (connection);
- if (!connection->priv->closed)
+ if (!connection->closed)
{
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_debug ("closing connection %p's stream %p", connection, connection->stream);
+ if (!g_io_stream_close (connection->stream, NULL, &error))
{
g_warning ("Error closing stream: %s", error->message);
g_error_free (error);
@@ -1182,7 +1191,7 @@ g_dbus_connection_send_message_unlocked (GDBusConnection *connection,
if (out_serial != NULL)
*out_serial = 0;
- if (connection->priv->closed)
+ if (connection->closed)
{
g_set_error_literal (error,
G_IO_ERROR,
@@ -1193,7 +1202,7 @@ g_dbus_connection_send_message_unlocked (GDBusConnection *connection,
blob = g_dbus_message_to_blob (message,
&blob_size,
- connection->priv->capabilities,
+ connection->capabilities,
error);
if (blob == NULL)
goto out;
@@ -1201,7 +1210,7 @@ g_dbus_connection_send_message_unlocked (GDBusConnection *connection,
serial_to_use = g_dbus_message_get_serial (message);
if (serial_to_use == 0)
{
- serial_to_use = ++connection->priv->last_serial; /* TODO: handle overflow */
+ serial_to_use = ++connection->last_serial; /* TODO: handle overflow */
}
switch (blob[0])
@@ -1225,14 +1234,14 @@ g_dbus_connection_send_message_unlocked (GDBusConnection *connection,
g_printerr ("----\n");
#endif
- /* TODO: use connection->priv->auth to encode the blob */
+ /* TODO: use connection->auth to encode the blob */
if (out_serial != NULL)
*out_serial = 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->worker,
message,
(gchar*) blob,
blob_size);
@@ -1364,7 +1373,7 @@ send_message_with_reply_deliver (SendMessageData *data)
data->cancellable_handler_id = 0;
}
- g_warn_if_fail (g_hash_table_remove (data->connection->priv->map_method_serial_to_send_message_data,
+ g_warn_if_fail (g_hash_table_remove (data->connection->map_method_serial_to_send_message_data,
GUINT_TO_POINTER (data->serial)));
send_message_data_unref (data);
@@ -1498,7 +1507,7 @@ g_dbus_connection_send_message_with_reply_unlocked (GDBusConnection *connect
goto out;
}
- if (connection->priv->closed)
+ if (connection->closed)
{
g_simple_async_result_set_error (simple,
G_IO_ERROR,
@@ -1549,7 +1558,7 @@ g_dbus_connection_send_message_with_reply_unlocked (GDBusConnection *connect
g_source_attach (data->timeout_source, data->main_context);
g_source_unref (data->timeout_source);
- g_hash_table_insert (connection->priv->map_method_serial_to_send_message_data,
+ g_hash_table_insert (connection->map_method_serial_to_send_message_data,
GUINT_TO_POINTER (*out_serial),
data);
@@ -1809,11 +1818,11 @@ on_worker_message_received (GDBusWorker *worker,
/* First collect the set of callback functions */
CONNECTION_LOCK (connection);
- num_filters = connection->priv->filters->len;
+ num_filters = connection->filters->len;
filters = g_new0 (FilterCallback, num_filters);
for (n = 0; n < num_filters; n++)
{
- FilterData *data = connection->priv->filters->pdata[n];
+ FilterData *data = connection->filters->pdata[n];
filters[n].func = data->filter_function;
filters[n].user_data = data->user_data;
}
@@ -1844,7 +1853,7 @@ on_worker_message_received (GDBusWorker *worker,
reply_serial = g_dbus_message_get_reply_serial (message);
CONNECTION_LOCK (connection);
- send_message_data = g_hash_table_lookup (connection->priv->map_method_serial_to_send_message_data,
+ send_message_data = g_hash_table_lookup (connection->map_method_serial_to_send_message_data,
GUINT_TO_POINTER (reply_serial));
if (send_message_data != NULL)
{
@@ -1893,11 +1902,11 @@ on_worker_message_about_to_be_sent (GDBusWorker *worker,
/* First collect the set of callback functions */
CONNECTION_LOCK (connection);
- num_filters = connection->priv->filters->len;
+ num_filters = connection->filters->len;
filters = g_new0 (FilterCallback, num_filters);
for (n = 0; n < num_filters; n++)
{
- FilterData *data = connection->priv->filters->pdata[n];
+ FilterData *data = connection->filters->pdata[n];
filters[n].func = data->filter_function;
filters[n].user_data = data->user_data;
}
@@ -1933,7 +1942,7 @@ on_worker_closed (GDBusWorker *worker,
//g_debug ("in on_worker_closed: %s", error->message);
CONNECTION_LOCK (connection);
- if (!connection->priv->closed)
+ if (!connection->closed)
set_closed_unlocked (connection, remote_peer_vanished, error);
CONNECTION_UNLOCK (connection);
}
@@ -1947,7 +1956,7 @@ get_offered_capabilities_max (GDBusConnection *connection)
GDBusCapabilityFlags ret;
ret = G_DBUS_CAPABILITY_FLAGS_NONE;
#ifdef G_OS_UNIX
- if (G_IS_UNIX_CONNECTION (connection->priv->stream))
+ if (G_IS_UNIX_CONNECTION (connection->stream))
ret |= G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING;
#endif
return ret;
@@ -1969,19 +1978,19 @@ initable_init (GInitable *initable,
* callbacks above needs the lock during initialization (for message
* bus connections we do a synchronous Hello() call on the bus).
*/
- g_mutex_lock (connection->priv->init_lock);
+ g_mutex_lock (connection->init_lock);
ret = FALSE;
- if (connection->priv->is_initialized)
+ if (connection->is_initialized)
{
- if (connection->priv->stream != NULL)
+ if (connection->stream != NULL)
ret = TRUE;
else
- g_assert (connection->priv->initialization_error != NULL);
+ g_assert (connection->initialization_error != NULL);
goto out;
}
- g_assert (connection->priv->initialization_error == NULL);
+ g_assert (connection->initialization_error == NULL);
/* The user can pass multiple (but mutally exclusive) construct
* properties:
@@ -1990,14 +1999,14 @@ initable_init (GInitable *initable,
* - address (of type gchar*)
*
* At the end of the day we end up with a non-NULL GIOStream
- * object in connection->priv->stream.
+ * object in connection->stream.
*/
- if (connection->priv->address != NULL)
+ if (connection->address != NULL)
{
- g_assert (connection->priv->stream == NULL);
+ g_assert (connection->stream == NULL);
- if ((connection->priv->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER) ||
- (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS))
+ if ((connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER) ||
+ (connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS))
{
g_set_error_literal (error,
G_IO_ERROR,
@@ -2006,14 +2015,14 @@ initable_init (GInitable *initable,
goto out;
}
- connection->priv->stream = g_dbus_address_get_stream_sync (connection->priv->address,
- NULL, /* TODO: out_guid */
- cancellable,
- &connection->priv->initialization_error);
- if (connection->priv->stream == NULL)
+ connection->stream = g_dbus_address_get_stream_sync (connection->address,
+ NULL, /* TODO: out_guid */
+ cancellable,
+ &connection->initialization_error);
+ if (connection->stream == NULL)
goto out;
}
- else if (connection->priv->stream != NULL)
+ else if (connection->stream != NULL)
{
/* nothing to do */
}
@@ -2023,45 +2032,45 @@ initable_init (GInitable *initable,
}
/* Authenticate the connection */
- if (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER)
- {
- g_assert (!(connection->priv->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT));
- g_assert (connection->priv->guid != NULL);
- connection->priv->auth = _g_dbus_auth_new (connection->priv->stream);
- if (!_g_dbus_auth_run_server (connection->priv->auth,
- connection->priv->authentication_observer,
- connection->priv->guid,
- (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS),
+ if (connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER)
+ {
+ g_assert (!(connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT));
+ g_assert (connection->guid != NULL);
+ connection->auth = _g_dbus_auth_new (connection->stream);
+ if (!_g_dbus_auth_run_server (connection->auth,
+ connection->authentication_observer,
+ connection->guid,
+ (connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS),
get_offered_capabilities_max (connection),
- &connection->priv->capabilities,
- &connection->priv->crendentials,
+ &connection->capabilities,
+ &connection->crendentials,
cancellable,
- &connection->priv->initialization_error))
+ &connection->initialization_error))
goto out;
}
- else if (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT)
- {
- g_assert (!(connection->priv->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER));
- g_assert (connection->priv->guid == NULL);
- connection->priv->auth = _g_dbus_auth_new (connection->priv->stream);
- connection->priv->guid = _g_dbus_auth_run_client (connection->priv->auth,
- get_offered_capabilities_max (connection),
- &connection->priv->capabilities,
- cancellable,
- &connection->priv->initialization_error);
- if (connection->priv->guid == NULL)
+ else if (connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT)
+ {
+ g_assert (!(connection->flags & G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER));
+ g_assert (connection->guid == NULL);
+ connection->auth = _g_dbus_auth_new (connection->stream);
+ connection->guid = _g_dbus_auth_run_client (connection->auth,
+ get_offered_capabilities_max (connection),
+ &connection->capabilities,
+ cancellable,
+ &connection->initialization_error);
+ if (connection->guid == NULL)
goto out;
}
- if (connection->priv->authentication_observer != NULL)
+ if (connection->authentication_observer != NULL)
{
- g_object_unref (connection->priv->authentication_observer);
- connection->priv->authentication_observer = NULL;
+ g_object_unref (connection->authentication_observer);
+ connection->authentication_observer = NULL;
}
- //g_output_stream_flush (G_SOCKET_CONNECTION (connection->priv->stream)
+ //g_output_stream_flush (G_SOCKET_CONNECTION (connection->stream)
- //g_debug ("haz unix fd passing powers: %d", connection->priv->capabilities & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING);
+ //g_debug ("haz unix fd passing powers: %d", connection->capabilities & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING);
#ifdef G_OS_UNIX
/* Hack used until
@@ -2070,29 +2079,29 @@ initable_init (GInitable *initable,
*
* has been resolved
*/
- if (G_IS_SOCKET_CONNECTION (connection->priv->stream))
+ if (G_IS_SOCKET_CONNECTION (connection->stream))
{
- g_socket_set_blocking (g_socket_connection_get_socket (G_SOCKET_CONNECTION (connection->priv->stream)), FALSE);
+ g_socket_set_blocking (g_socket_connection_get_socket (G_SOCKET_CONNECTION (connection->stream)), FALSE);
}
#endif
- connection->priv->worker = _g_dbus_worker_new (connection->priv->stream,
- connection->priv->capabilities,
- (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING),
- on_worker_message_received,
- on_worker_message_about_to_be_sent,
- on_worker_closed,
- connection);
+ connection->worker = _g_dbus_worker_new (connection->stream,
+ connection->capabilities,
+ (connection->flags & G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING),
+ on_worker_message_received,
+ on_worker_message_about_to_be_sent,
+ on_worker_closed,
+ connection);
/* if a bus connection, call org.freedesktop.DBus.Hello - this is how we're getting a name */
- if (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION)
+ if (connection->flags & G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION)
{
GVariant *hello_result;
/* we could lift this restriction by adding code in gdbusprivate.c */
- if (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING)
+ if (connection->flags & G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING)
{
- g_set_error_literal (&connection->priv->initialization_error,
+ g_set_error_literal (&connection->initialization_error,
G_IO_ERROR,
G_IO_ERROR_FAILED,
"Cannot use DELAY_MESSAGE_PROCESSING with MESSAGE_BUS_CONNECTION");
@@ -2109,26 +2118,26 @@ initable_init (GInitable *initable,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL, /* TODO: cancellable */
- &connection->priv->initialization_error);
+ &connection->initialization_error);
if (hello_result == NULL)
goto out;
- g_variant_get (hello_result, "(s)", &connection->priv->bus_unique_name);
+ g_variant_get (hello_result, "(s)", &connection->bus_unique_name);
g_variant_unref (hello_result);
- //g_debug ("unique name is `%s'", connection->priv->bus_unique_name);
+ //g_debug ("unique name is `%s'", connection->bus_unique_name);
}
- connection->priv->is_initialized = TRUE;
+ connection->is_initialized = TRUE;
ret = TRUE;
out:
if (!ret)
{
- g_assert (connection->priv->initialization_error != NULL);
- g_propagate_error (error, g_error_copy (connection->priv->initialization_error));
+ g_assert (connection->initialization_error != NULL);
+ g_propagate_error (error, g_error_copy (connection->initialization_error));
}
- g_mutex_unlock (connection->priv->init_lock);
+ g_mutex_unlock (connection->init_lock);
return ret;
}
@@ -2424,7 +2433,7 @@ g_dbus_connection_set_exit_on_close (GDBusConnection *connection,
gboolean exit_on_close)
{
g_return_if_fail (G_IS_DBUS_CONNECTION (connection));
- connection->priv->exit_on_close = exit_on_close;
+ connection->exit_on_close = exit_on_close;
}
/**
@@ -2444,7 +2453,7 @@ gboolean
g_dbus_connection_get_exit_on_close (GDBusConnection *connection)
{
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), FALSE);
- return connection->priv->exit_on_close;
+ return connection->exit_on_close;
}
/**
@@ -2463,7 +2472,7 @@ const gchar *
g_dbus_connection_get_guid (GDBusConnection *connection)
{
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
- return connection->priv->guid;
+ return connection->guid;
}
/**
@@ -2484,7 +2493,7 @@ const gchar *
g_dbus_connection_get_unique_name (GDBusConnection *connection)
{
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
- return connection->priv->bus_unique_name;
+ return connection->bus_unique_name;
}
/**
@@ -2510,7 +2519,7 @@ GCredentials *
g_dbus_connection_get_peer_credentials (GDBusConnection *connection)
{
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
- return connection->priv->crendentials;
+ return connection->crendentials;
}
/* ---------------------------------------------------------------------------------------------------- */
@@ -2569,7 +2578,7 @@ g_dbus_connection_add_filter (GDBusConnection *connection,
data->filter_function = filter_function;
data->user_data = user_data;
data->user_data_free_func = user_data_free_func;
- g_ptr_array_add (connection->priv->filters, data);
+ g_ptr_array_add (connection->filters, data);
CONNECTION_UNLOCK (connection);
return data->id;
@@ -2580,9 +2589,9 @@ static void
purge_all_filters (GDBusConnection *connection)
{
guint n;
- for (n = 0; n < connection->priv->filters->len; n++)
+ for (n = 0; n < connection->filters->len; n++)
{
- FilterData *data = connection->priv->filters->pdata[n];
+ FilterData *data = connection->filters->pdata[n];
if (data->user_data_free_func != NULL)
data->user_data_free_func (data->user_data);
g_free (data);
@@ -2609,12 +2618,12 @@ g_dbus_connection_remove_filter (GDBusConnection *connection,
CONNECTION_LOCK (connection);
to_destroy = NULL;
- for (n = 0; n < connection->priv->filters->len; n++)
+ for (n = 0; n < connection->filters->len; n++)
{
- FilterData *data = connection->priv->filters->pdata[n];
+ FilterData *data = connection->filters->pdata[n];
if (data->id == filter_id)
{
- g_ptr_array_remove_index (connection->priv->filters, n);
+ g_ptr_array_remove_index (connection->filters, n);
to_destroy = data;
break;
}
@@ -2828,7 +2837,7 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
*/
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), 0);
- g_return_val_if_fail (sender == NULL || (g_dbus_is_name (sender) && (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION)), 0);
+ g_return_val_if_fail (sender == NULL || (g_dbus_is_name (sender) && (connection->flags & G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION)), 0);
g_return_val_if_fail (interface_name == NULL || g_dbus_is_interface_name (interface_name), 0);
g_return_val_if_fail (member == NULL || g_dbus_is_member_name (member), 0);
g_return_val_if_fail (object_path == NULL || g_variant_is_object_path (object_path), 0);
@@ -2852,7 +2861,7 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
g_main_context_ref (subscriber.context);
/* see if we've already have this rule */
- signal_data = g_hash_table_lookup (connection->priv->map_rule_to_signal_data, rule);
+ signal_data = g_hash_table_lookup (connection->map_rule_to_signal_data, rule);
if (signal_data != NULL)
{
g_array_append_val (signal_data->subscribers, subscriber);
@@ -2871,7 +2880,7 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
signal_data->subscribers = g_array_new (FALSE, FALSE, sizeof (SignalSubscriber));
g_array_append_val (signal_data->subscribers, subscriber);
- g_hash_table_insert (connection->priv->map_rule_to_signal_data,
+ g_hash_table_insert (connection->map_rule_to_signal_data,
signal_data->rule,
signal_data);
@@ -2880,25 +2889,25 @@ g_dbus_connection_signal_subscribe (GDBusConnection *connection,
* Avoid adding match rules for NameLost and NameAcquired messages - the bus will
* always send such messages to us.
*/
- if (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION)
+ if (connection->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);
}
- signal_data_array = g_hash_table_lookup (connection->priv->map_sender_unique_name_to_signal_data_array,
+ signal_data_array = g_hash_table_lookup (connection->map_sender_unique_name_to_signal_data_array,
signal_data->sender_unique_name);
if (signal_data_array == NULL)
{
signal_data_array = g_ptr_array_new ();
- g_hash_table_insert (connection->priv->map_sender_unique_name_to_signal_data_array,
+ g_hash_table_insert (connection->map_sender_unique_name_to_signal_data_array,
g_strdup (signal_data->sender_unique_name),
signal_data_array);
}
g_ptr_array_add (signal_data_array, signal_data);
out:
- g_hash_table_insert (connection->priv->map_id_to_signal_data,
+ g_hash_table_insert (connection->map_id_to_signal_data,
GUINT_TO_POINTER (subscriber.id),
signal_data);
@@ -2919,7 +2928,7 @@ unsubscribe_id_internal (GDBusConnection *connection,
GPtrArray *signal_data_array;
guint n;
- signal_data = g_hash_table_lookup (connection->priv->map_id_to_signal_data,
+ signal_data = g_hash_table_lookup (connection->map_id_to_signal_data,
GUINT_TO_POINTER (subscription_id));
if (signal_data == NULL)
{
@@ -2935,31 +2944,31 @@ unsubscribe_id_internal (GDBusConnection *connection,
if (subscriber->id != subscription_id)
continue;
- g_warn_if_fail (g_hash_table_remove (connection->priv->map_id_to_signal_data,
+ g_warn_if_fail (g_hash_table_remove (connection->map_id_to_signal_data,
GUINT_TO_POINTER (subscription_id)));
g_array_append_val (out_removed_subscribers, *subscriber);
g_array_remove_index (signal_data->subscribers, n);
if (signal_data->subscribers->len == 0)
{
- g_warn_if_fail (g_hash_table_remove (connection->priv->map_rule_to_signal_data, signal_data->rule));
+ g_warn_if_fail (g_hash_table_remove (connection->map_rule_to_signal_data, signal_data->rule));
- signal_data_array = g_hash_table_lookup (connection->priv->map_sender_unique_name_to_signal_data_array,
+ signal_data_array = g_hash_table_lookup (connection->map_sender_unique_name_to_signal_data_array,
signal_data->sender_unique_name);
g_warn_if_fail (signal_data_array != NULL);
g_warn_if_fail (g_ptr_array_remove (signal_data_array, signal_data));
if (signal_data_array->len == 0)
{
- g_warn_if_fail (g_hash_table_remove (connection->priv->map_sender_unique_name_to_signal_data_array,
+ g_warn_if_fail (g_hash_table_remove (connection->map_sender_unique_name_to_signal_data_array,
signal_data->sender_unique_name));
}
/* remove the match rule from the bus unless NameLost or NameAcquired (see subscribe()) */
- if (connection->priv->flags & G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION)
+ if (connection->flags & G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION)
{
if (!is_signal_data_for_name_lost_or_acquired (signal_data))
- if (!connection->priv->closed)
+ if (!connection->closed)
remove_match_rule (connection, signal_data->rule);
}
signal_data_free (signal_data);
@@ -3066,7 +3075,7 @@ emit_signal_instance_in_idle_cb (gpointer data)
/* Careful here, don't do the callback if we no longer has the subscription */
CONNECTION_LOCK (signal_instance->connection);
has_subscription = FALSE;
- if (g_hash_table_lookup (signal_instance->connection->priv->map_id_to_signal_data,
+ if (g_hash_table_lookup (signal_instance->connection->map_id_to_signal_data,
GUINT_TO_POINTER (signal_instance->subscription_id)) != NULL)
has_subscription = TRUE;
CONNECTION_UNLOCK (signal_instance->connection);
@@ -3209,13 +3218,13 @@ distribute_signals (GDBusConnection *connection,
/* collect subscribers that match on sender */
if (sender != NULL)
{
- signal_data_array = g_hash_table_lookup (connection->priv->map_sender_unique_name_to_signal_data_array, sender);
+ signal_data_array = g_hash_table_lookup (connection->map_sender_unique_name_to_signal_data_array, sender);
if (signal_data_array != NULL)
schedule_callbacks (connection, signal_data_array, message, sender);
}
/* collect subscribers not matching on sender */
- signal_data_array = g_hash_table_lookup (connection->priv->map_sender_unique_name_to_signal_data_array, "");
+ signal_data_array = g_hash_table_lookup (connection->map_sender_unique_name_to_signal_data_array, "");
if (signal_data_array != NULL)
schedule_callbacks (connection, signal_data_array, message, sender);
}
@@ -3233,7 +3242,7 @@ purge_all_signal_subscriptions (GDBusConnection *connection)
guint n;
ids = g_array_new (FALSE, FALSE, sizeof (guint));
- g_hash_table_iter_init (&iter, connection->priv->map_id_to_signal_data);
+ g_hash_table_iter_init (&iter, connection->map_id_to_signal_data);
while (g_hash_table_iter_next (&iter, &key, NULL))
{
guint subscription_id = GPOINTER_TO_UINT (key);
@@ -3335,12 +3344,12 @@ has_object_been_unregistered (GDBusConnection *connection,
ret = FALSE;
CONNECTION_LOCK (connection);
- if (registration_id != 0 && g_hash_table_lookup (connection->priv->map_id_to_ei,
+ if (registration_id != 0 && g_hash_table_lookup (connection->map_id_to_ei,
GUINT_TO_POINTER (registration_id)) == NULL)
{
ret = TRUE;
}
- else if (subtree_registration_id != 0 && g_hash_table_lookup (connection->priv->map_id_to_es,
+ else if (subtree_registration_id != 0 && g_hash_table_lookup (connection->map_id_to_es,
GUINT_TO_POINTER (subtree_registration_id)) == NULL)
{
ret = TRUE;
@@ -3953,11 +3962,11 @@ g_dbus_connection_list_registered_unlocked (GDBusConnection *connection,
set = g_hash_table_new (g_str_hash, g_str_equal);
- g_hash_table_iter_init (&hash_iter, connection->priv->map_object_path_to_eo);
+ g_hash_table_iter_init (&hash_iter, connection->map_object_path_to_eo);
while (g_hash_table_iter_next (&hash_iter, (gpointer) &object_path, NULL))
maybe_add_path (path, path_len, object_path, set);
- g_hash_table_iter_init (&hash_iter, connection->priv->map_object_path_to_es);
+ g_hash_table_iter_init (&hash_iter, connection->map_object_path_to_es);
while (g_hash_table_iter_next (&hash_iter, (gpointer) &object_path, NULL))
maybe_add_path (path, path_len, object_path, set);
@@ -4329,7 +4338,7 @@ g_dbus_connection_register_object (GDBusConnection *connection,
CONNECTION_LOCK (connection);
- eo = g_hash_table_lookup (connection->priv->map_object_path_to_eo, object_path);
+ eo = g_hash_table_lookup (connection->map_object_path_to_eo, object_path);
if (eo == NULL)
{
eo = g_new0 (ExportedObject, 1);
@@ -4339,7 +4348,7 @@ g_dbus_connection_register_object (GDBusConnection *connection,
g_str_equal,
NULL,
(GDestroyNotify) exported_interface_free);
- g_hash_table_insert (connection->priv->map_object_path_to_eo, eo->object_path, eo);
+ g_hash_table_insert (connection->map_object_path_to_eo, eo->object_path, eo);
}
ei = g_hash_table_lookup (eo->map_if_name_to_ei, interface_info->name);
@@ -4369,7 +4378,7 @@ g_dbus_connection_register_object (GDBusConnection *connection,
g_hash_table_insert (eo->map_if_name_to_ei,
(gpointer) ei->interface_name,
ei);
- g_hash_table_insert (connection->priv->map_id_to_ei,
+ g_hash_table_insert (connection->map_id_to_ei,
GUINT_TO_POINTER (ei->id),
ei);
@@ -4406,18 +4415,18 @@ g_dbus_connection_unregister_object (GDBusConnection *connection,
CONNECTION_LOCK (connection);
- ei = g_hash_table_lookup (connection->priv->map_id_to_ei,
+ ei = g_hash_table_lookup (connection->map_id_to_ei,
GUINT_TO_POINTER (registration_id));
if (ei == NULL)
goto out;
eo = ei->eo;
- g_warn_if_fail (g_hash_table_remove (connection->priv->map_id_to_ei, GUINT_TO_POINTER (ei->id)));
+ g_warn_if_fail (g_hash_table_remove (connection->map_id_to_ei, GUINT_TO_POINTER (ei->id)));
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,
+ g_warn_if_fail (g_hash_table_remove (connection->map_object_path_to_eo,
eo->object_path));
ret = TRUE;
@@ -5435,7 +5444,7 @@ g_dbus_connection_register_subtree (GDBusConnection *connection,
CONNECTION_LOCK (connection);
- es = g_hash_table_lookup (connection->priv->map_object_path_to_es, object_path);
+ es = g_hash_table_lookup (connection->map_object_path_to_es, object_path);
if (es != NULL)
{
g_set_error (error,
@@ -5459,8 +5468,8 @@ g_dbus_connection_register_subtree (GDBusConnection *connection,
if (es->context != NULL)
g_main_context_ref (es->context);
- g_hash_table_insert (connection->priv->map_object_path_to_es, es->object_path, es);
- g_hash_table_insert (connection->priv->map_id_to_es,
+ g_hash_table_insert (connection->map_object_path_to_es, es->object_path, es);
+ g_hash_table_insert (connection->map_id_to_es,
GUINT_TO_POINTER (es->id),
es);
@@ -5498,13 +5507,13 @@ g_dbus_connection_unregister_subtree (GDBusConnection *connection,
CONNECTION_LOCK (connection);
- es = g_hash_table_lookup (connection->priv->map_id_to_es,
+ es = g_hash_table_lookup (connection->map_id_to_es,
GUINT_TO_POINTER (registration_id));
if (es == NULL)
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));
+ g_warn_if_fail (g_hash_table_remove (connection->map_id_to_es, GUINT_TO_POINTER (es->id)));
+ g_warn_if_fail (g_hash_table_remove (connection->map_object_path_to_es, es->object_path));
ret = TRUE;
@@ -5537,13 +5546,13 @@ handle_generic_get_machine_id_unlocked (GDBusConnection *connection,
GDBusMessage *reply;
reply = NULL;
- if (connection->priv->machine_id == NULL)
+ if (connection->machine_id == NULL)
{
GError *error;
error = NULL;
- connection->priv->machine_id = _g_dbus_get_machine_id (&error);
- if (connection->priv->machine_id == NULL)
+ connection->machine_id = _g_dbus_get_machine_id (&error);
+ if (connection->machine_id == NULL)
{
reply = g_dbus_message_new_method_error_literal (message,
"org.freedesktop.DBus.Error.Failed",
@@ -5555,7 +5564,7 @@ handle_generic_get_machine_id_unlocked (GDBusConnection *connection,
if (reply == NULL)
{
reply = g_dbus_message_new_method_reply (message);
- g_dbus_message_set_body (reply, g_variant_new ("(s)", connection->priv->machine_id));
+ g_dbus_message_set_body (reply, g_variant_new ("(s)", connection->machine_id));
}
g_dbus_connection_send_message_unlocked (connection, reply, NULL, NULL);
g_object_unref (reply);
@@ -5696,14 +5705,14 @@ distribute_method_call (GDBusConnection *connection,
object_path = g_dbus_message_get_path (message);
g_assert (object_path != NULL);
- eo = g_hash_table_lookup (connection->priv->map_object_path_to_eo, object_path);
+ eo = g_hash_table_lookup (connection->map_object_path_to_eo, object_path);
if (eo != NULL)
{
if (obj_message_func (connection, eo, message))
goto out;
}
- es = g_hash_table_lookup (connection->priv->map_object_path_to_es, object_path);
+ es = g_hash_table_lookup (connection->map_object_path_to_es, object_path);
if (es != NULL)
{
if (subtree_message_func (connection, es, message))
@@ -5712,7 +5721,7 @@ distribute_method_call (GDBusConnection *connection,
if (subtree_path != NULL)
{
- es = g_hash_table_lookup (connection->priv->map_object_path_to_es, subtree_path);
+ es = g_hash_table_lookup (connection->map_object_path_to_es, subtree_path);
if (es != NULL)
{
if (subtree_message_func (connection, es, message))
diff --git a/gio/gdbusconnection.h b/gio/gdbusconnection.h
index f6d36b8..b9f8dc1 100644
--- a/gio/gdbusconnection.h
+++ b/gio/gdbusconnection.h
@@ -33,28 +33,7 @@ G_BEGIN_DECLS
#define G_TYPE_DBUS_CONNECTION (g_dbus_connection_get_type ())
#define G_DBUS_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_CONNECTION, GDBusConnection))
-#define G_DBUS_CONNECTION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_CONNECTION, GDBusConnectionClass))
-#define G_DBUS_CONNECTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_CONNECTION, GDBusConnectionClass))
#define G_IS_DBUS_CONNECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_CONNECTION))
-#define G_IS_DBUS_CONNECTION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_CONNECTION))
-
-typedef struct _GDBusConnectionClass GDBusConnectionClass;
-typedef struct _GDBusConnectionPrivate GDBusConnectionPrivate;
-
-/**
- * GDBusConnection:
- *
- * The #GDBusConnection structure contains only private data and
- * should only be accessed using the provided API.
- *
- * Since: 2.26
- */
-struct _GDBusConnection
-{
- /*< private >*/
- GObject parent_instance;
- GDBusConnectionPrivate *priv;
-};
GType g_dbus_connection_get_type (void) G_GNUC_CONST;
diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
index 58a149f..effdd31 100644
--- a/gio/gdbusmessage.c
+++ b/gio/gdbusmessage.c
@@ -63,6 +63,7 @@
* on a #GDBusConnection.
*/
+typedef struct _GDBusMessageClass GDBusMessageClass;
/**
* GDBusMessageClass:
@@ -77,8 +78,19 @@ struct _GDBusMessageClass
GObjectClass parent_class;
};
-struct _GDBusMessagePrivate
+/**
+ * GDBusMessage:
+ *
+ * The #GDBusMessage structure contains only private data and should
+ * only be accessed using the provided API.
+ *
+ * Since: 2.26
+ */
+struct _GDBusMessage
{
+ /*< private >*/
+ GObject parent_instance;
+
GDBusMessageType type;
GDBusMessageFlags flags;
guchar major_protocol_version;
@@ -97,13 +109,13 @@ g_dbus_message_finalize (GObject *object)
{
GDBusMessage *message = G_DBUS_MESSAGE (object);
- if (message->priv->headers != NULL)
- g_hash_table_unref (message->priv->headers);
- if (message->priv->body != NULL)
- g_variant_unref (message->priv->body);
+ if (message->headers != NULL)
+ g_hash_table_unref (message->headers);
+ if (message->body != NULL)
+ g_variant_unref (message->body);
#ifdef G_OS_UNIX
- if (message->priv->fd_list != NULL)
- g_object_unref (message->priv->fd_list);
+ if (message->fd_list != NULL)
+ g_object_unref (message->fd_list);
#endif
if (G_OBJECT_CLASS (g_dbus_message_parent_class)->finalize != NULL)
@@ -115,8 +127,6 @@ g_dbus_message_class_init (GDBusMessageClass *klass)
{
GObjectClass *gobject_class;
- g_type_class_add_private (klass, sizeof (GDBusMessagePrivate));
-
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = g_dbus_message_finalize;
@@ -125,12 +135,10 @@ g_dbus_message_class_init (GDBusMessageClass *klass)
static void
g_dbus_message_init (GDBusMessage *message)
{
- message->priv = G_TYPE_INSTANCE_GET_PRIVATE (message, G_TYPE_DBUS_MESSAGE, GDBusMessagePrivate);
-
- message->priv->headers = g_hash_table_new_full (g_direct_hash,
- g_direct_equal,
- NULL,
- (GDestroyNotify) g_variant_unref);
+ message->headers = g_hash_table_new_full (g_direct_hash,
+ g_direct_equal,
+ NULL,
+ (GDestroyNotify) g_variant_unref);
}
/**
@@ -175,7 +183,7 @@ g_dbus_message_new_method_call (const gchar *name,
g_return_val_if_fail (interface_ == NULL || g_dbus_is_interface_name (interface_), NULL);
message = g_dbus_message_new ();
- message->priv->type = G_DBUS_MESSAGE_TYPE_METHOD_CALL;
+ message->type = G_DBUS_MESSAGE_TYPE_METHOD_CALL;
if (name != NULL)
g_dbus_message_set_destination (message, name);
@@ -211,8 +219,8 @@ g_dbus_message_new_signal (const gchar *path,
g_return_val_if_fail (interface_ == NULL || g_dbus_is_interface_name (interface_), NULL);
message = g_dbus_message_new ();
- message->priv->type = G_DBUS_MESSAGE_TYPE_SIGNAL;
- message->priv->flags = G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED;
+ message->type = G_DBUS_MESSAGE_TYPE_SIGNAL;
+ message->flags = G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED;
g_dbus_message_set_path (message, path);
g_dbus_message_set_member (message, signal);
@@ -246,8 +254,8 @@ g_dbus_message_new_method_reply (GDBusMessage *method_call_message)
g_return_val_if_fail (g_dbus_message_get_serial (method_call_message) != 0, NULL);
message = g_dbus_message_new ();
- message->priv->type = G_DBUS_MESSAGE_TYPE_METHOD_RETURN;
- message->priv->flags = G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED;
+ message->type = G_DBUS_MESSAGE_TYPE_METHOD_RETURN;
+ message->flags = G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED;
g_dbus_message_set_reply_serial (message, g_dbus_message_get_serial (method_call_message));
sender = g_dbus_message_get_sender (method_call_message);
@@ -318,8 +326,8 @@ g_dbus_message_new_method_error_literal (GDBusMessage *method_call_message,
g_return_val_if_fail (error_message != NULL, NULL);
message = g_dbus_message_new ();
- message->priv->type = G_DBUS_MESSAGE_TYPE_ERROR;
- message->priv->flags = G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED;
+ message->type = G_DBUS_MESSAGE_TYPE_ERROR;
+ message->flags = G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED;
g_dbus_message_set_reply_serial (message, g_dbus_message_get_serial (method_call_message));
g_dbus_message_set_error_name (message, error_name);
@@ -380,7 +388,7 @@ GDBusMessageType
g_dbus_message_get_message_type (GDBusMessage *message)
{
g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), G_DBUS_MESSAGE_TYPE_INVALID);
- return message->priv->type;
+ return message->type;
}
/**
@@ -398,7 +406,7 @@ g_dbus_message_set_message_type (GDBusMessage *message,
{
g_return_if_fail (G_IS_DBUS_MESSAGE (message));
g_return_if_fail (type >=0 && type < 256);
- message->priv->type = type;
+ message->type = type;
}
/* ---------------------------------------------------------------------------------------------------- */
@@ -419,7 +427,7 @@ GDBusMessageFlags
g_dbus_message_get_flags (GDBusMessage *message)
{
g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), G_DBUS_MESSAGE_FLAGS_NONE);
- return message->priv->flags;
+ return message->flags;
}
/**
@@ -438,7 +446,7 @@ g_dbus_message_set_flags (GDBusMessage *message,
{
g_return_if_fail (G_IS_DBUS_MESSAGE (message));
g_return_if_fail (flags >=0 && flags < 256);
- message->priv->flags = flags;
+ message->flags = flags;
}
/* ---------------------------------------------------------------------------------------------------- */
@@ -457,7 +465,7 @@ guint32
g_dbus_message_get_serial (GDBusMessage *message)
{
g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), 0);
- return message->priv->serial;
+ return message->serial;
}
/**
@@ -474,7 +482,7 @@ g_dbus_message_set_serial (GDBusMessage *message,
guint32 serial)
{
g_return_if_fail (G_IS_DBUS_MESSAGE (message));
- message->priv->serial = serial;
+ message->serial = serial;
}
/* ---------------------------------------------------------------------------------------------------- */
@@ -499,7 +507,7 @@ g_dbus_message_get_header (GDBusMessage *message,
{
g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), NULL);
g_return_val_if_fail (header_field >=0 && header_field < 256, NULL);
- return g_hash_table_lookup (message->priv->headers, GUINT_TO_POINTER (header_field));
+ return g_hash_table_lookup (message->headers, GUINT_TO_POINTER (header_field));
}
/**
@@ -523,11 +531,11 @@ g_dbus_message_set_header (GDBusMessage *message,
g_return_if_fail (header_field >=0 && header_field < 256);
if (value == NULL)
{
- g_hash_table_remove (message->priv->headers, GUINT_TO_POINTER (header_field));
+ g_hash_table_remove (message->headers, GUINT_TO_POINTER (header_field));
}
else
{
- g_hash_table_insert (message->priv->headers, GUINT_TO_POINTER (header_field), g_variant_ref_sink (value));
+ g_hash_table_insert (message->headers, GUINT_TO_POINTER (header_field), g_variant_ref_sink (value));
}
}
@@ -554,7 +562,7 @@ g_dbus_message_get_header_fields (GDBusMessage *message)
g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), NULL);
- keys = g_hash_table_get_keys (message->priv->headers);
+ keys = g_hash_table_get_keys (message->headers);
num_keys = g_list_length (keys);
ret = g_new (guchar, num_keys + 1);
for (l = keys, n = 0; l != NULL; l = l->next, n++)
@@ -582,7 +590,7 @@ GVariant *
g_dbus_message_get_body (GDBusMessage *message)
{
g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), NULL);
- return message->priv->body;
+ return message->body;
}
/**
@@ -605,11 +613,11 @@ g_dbus_message_set_body (GDBusMessage *message,
g_return_if_fail (G_IS_DBUS_MESSAGE (message));
g_return_if_fail ((body == NULL) || g_variant_is_of_type (body, G_VARIANT_TYPE_TUPLE));
- if (message->priv->body != NULL)
- g_variant_unref (message->priv->body);
+ if (message->body != NULL)
+ g_variant_unref (message->body);
if (body == NULL)
{
- message->priv->body = NULL;
+ message->body = NULL;
g_dbus_message_set_signature (message, NULL);
}
else
@@ -618,7 +626,7 @@ g_dbus_message_set_body (GDBusMessage *message,
gsize type_string_len;
gchar *signature;
- message->priv->body = g_variant_ref_sink (body);
+ message->body = g_variant_ref_sink (body);
type_string = g_variant_get_type_string (body);
type_string_len = strlen (type_string);
@@ -649,7 +657,7 @@ GUnixFDList *
g_dbus_message_get_unix_fd_list (GDBusMessage *message)
{
g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), NULL);
- return message->priv->fd_list;
+ return message->fd_list;
}
/**
@@ -672,16 +680,16 @@ g_dbus_message_set_unix_fd_list (GDBusMessage *message,
{
g_return_if_fail (G_IS_DBUS_MESSAGE (message));
g_return_if_fail (fd_list == NULL || G_IS_UNIX_FD_LIST (fd_list));
- if (message->priv->fd_list != NULL)
- g_object_unref (message->priv->fd_list);
+ if (message->fd_list != NULL)
+ g_object_unref (message->fd_list);
if (fd_list != NULL)
{
- message->priv->fd_list = g_object_ref (fd_list);
+ message->fd_list = g_object_ref (fd_list);
g_dbus_message_set_num_unix_fds (message, g_unix_fd_list_get_length (fd_list));
}
else
{
- message->priv->fd_list = NULL;
+ message->fd_list = NULL;
g_dbus_message_set_num_unix_fds (message, 0);
}
}
@@ -1405,8 +1413,8 @@ g_dbus_message_new_from_blob (guchar *blob,
}
g_data_input_stream_set_byte_order (dis, byte_order);
- message->priv->type = g_data_input_stream_read_byte (dis, NULL, NULL);
- message->priv->flags = g_data_input_stream_read_byte (dis, NULL, NULL);
+ message->type = g_data_input_stream_read_byte (dis, NULL, NULL);
+ message->flags = g_data_input_stream_read_byte (dis, NULL, NULL);
major_protocol_version = g_data_input_stream_read_byte (dis, NULL, NULL);
if (major_protocol_version != 1)
{
@@ -1418,7 +1426,7 @@ g_dbus_message_new_from_blob (guchar *blob,
goto out;
}
message_body_len = g_data_input_stream_read_uint32 (dis, NULL, NULL);
- message->priv->serial = g_data_input_stream_read_uint32 (dis, NULL, NULL);
+ message->serial = g_data_input_stream_read_uint32 (dis, NULL, NULL);
#ifdef DEBUG_SERIALIZER
g_print ("Parsing blob (blob_len = 0x%04x bytes)\n", (gint) blob_len);
@@ -1494,14 +1502,14 @@ g_dbus_message_new_from_blob (guchar *blob,
#ifdef DEBUG_SERIALIZER
g_print ("Parsing body (blob_len = 0x%04x bytes)\n", (gint) blob_len);
#endif /* DEBUG_SERIALIZER */
- message->priv->body = parse_value_from_blob (mis,
- dis,
- variant_type,
- FALSE,
- 2,
- error);
+ message->body = parse_value_from_blob (mis,
+ dis,
+ variant_type,
+ FALSE,
+ 2,
+ error);
g_variant_type_free (variant_type);
- if (message->priv->body == NULL)
+ if (message->body == NULL)
goto out;
}
}
@@ -1944,18 +1952,18 @@ g_dbus_message_to_blob (GDBusMessage *message,
/* Core header */
g_data_output_stream_put_byte (dos, byte_order == G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN ? 'l' : 'B', NULL, NULL);
- g_data_output_stream_put_byte (dos, message->priv->type, NULL, NULL);
- g_data_output_stream_put_byte (dos, message->priv->flags, NULL, NULL);
+ g_data_output_stream_put_byte (dos, message->type, NULL, NULL);
+ g_data_output_stream_put_byte (dos, message->flags, NULL, NULL);
g_data_output_stream_put_byte (dos, 1, NULL, NULL); /* major protocol version */
body_len_offset = g_memory_output_stream_get_data_size (mos);
/* body length - will be filled in later */
g_data_output_stream_put_uint32 (dos, 0xF00DFACE, NULL, NULL);
- g_data_output_stream_put_uint32 (dos, message->priv->serial, NULL, NULL);
+ g_data_output_stream_put_uint32 (dos, message->serial, NULL, NULL);
num_fds_in_message = 0;
#ifdef G_OS_UNIX
- if (message->priv->fd_list != NULL)
- num_fds_in_message = g_unix_fd_list_get_length (message->priv->fd_list);
+ if (message->fd_list != NULL)
+ num_fds_in_message = g_unix_fd_list_get_length (message->fd_list);
#endif
num_fds_according_to_header = g_dbus_message_get_num_unix_fds (message);
/* TODO: check we have all the right header fields and that they are the correct value etc etc */
@@ -1971,7 +1979,7 @@ g_dbus_message_to_blob (GDBusMessage *message,
}
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{yv}"));
- g_hash_table_iter_init (&hash_iter, message->priv->headers);
+ g_hash_table_iter_init (&hash_iter, message->headers);
while (g_hash_table_iter_next (&hash_iter, &key, (gpointer) &header_value))
{
g_variant_builder_add (&builder,
@@ -2001,7 +2009,7 @@ g_dbus_message_to_blob (GDBusMessage *message,
signature_str = NULL;
if (signature != NULL)
signature_str = g_variant_get_string (signature, NULL);
- if (message->priv->body != NULL)
+ if (message->body != NULL)
{
gchar *tupled_signature_str;
tupled_signature_str = g_strdup_printf ("(%s)", signature_str);
@@ -2015,18 +2023,18 @@ g_dbus_message_to_blob (GDBusMessage *message,
g_free (tupled_signature_str);
goto out;
}
- else if (g_strcmp0 (tupled_signature_str, g_variant_get_type_string (message->priv->body)) != 0)
+ else if (g_strcmp0 (tupled_signature_str, g_variant_get_type_string (message->body)) != 0)
{
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
_("Message body has type signature `%s' but signature in the header field is `%s'"),
- tupled_signature_str, g_variant_get_type_string (message->priv->body));
+ tupled_signature_str, g_variant_get_type_string (message->body));
g_free (tupled_signature_str);
goto out;
}
g_free (tupled_signature_str);
- if (!append_body_to_blob (message->priv->body, mos, dos, error))
+ if (!append_body_to_blob (message->body, mos, dos, error))
goto out;
}
else
@@ -2071,7 +2079,7 @@ get_uint32_header (GDBusMessage *message,
guint32 ret;
ret = 0;
- value = g_hash_table_lookup (message->priv->headers, GUINT_TO_POINTER (header_field));
+ value = g_hash_table_lookup (message->headers, GUINT_TO_POINTER (header_field));
if (value != NULL && g_variant_is_of_type (value, G_VARIANT_TYPE_UINT32))
ret = g_variant_get_uint32 (value);
@@ -2086,7 +2094,7 @@ get_string_header (GDBusMessage *message,
const gchar *ret;
ret = NULL;
- value = g_hash_table_lookup (message->priv->headers, GUINT_TO_POINTER (header_field));
+ value = g_hash_table_lookup (message->headers, GUINT_TO_POINTER (header_field));
if (value != NULL && g_variant_is_of_type (value, G_VARIANT_TYPE_STRING))
ret = g_variant_get_string (value, NULL);
@@ -2101,7 +2109,7 @@ get_object_path_header (GDBusMessage *message,
const gchar *ret;
ret = NULL;
- value = g_hash_table_lookup (message->priv->headers, GUINT_TO_POINTER (header_field));
+ value = g_hash_table_lookup (message->headers, GUINT_TO_POINTER (header_field));
if (value != NULL && g_variant_is_of_type (value, G_VARIANT_TYPE_OBJECT_PATH))
ret = g_variant_get_string (value, NULL);
@@ -2116,7 +2124,7 @@ get_signature_header (GDBusMessage *message,
const gchar *ret;
ret = NULL;
- value = g_hash_table_lookup (message->priv->headers, GUINT_TO_POINTER (header_field));
+ value = g_hash_table_lookup (message->headers, GUINT_TO_POINTER (header_field));
if (value != NULL && g_variant_is_of_type (value, G_VARIANT_TYPE_SIGNATURE))
ret = g_variant_get_string (value, NULL);
@@ -2486,10 +2494,10 @@ g_dbus_message_get_arg0 (GDBusMessage *message)
ret = NULL;
- if (message->priv->body != NULL && g_variant_is_of_type (message->priv->body, G_VARIANT_TYPE_TUPLE))
+ if (message->body != NULL && g_variant_is_of_type (message->body, G_VARIANT_TYPE_TUPLE))
{
GVariant *item;
- item = g_variant_get_child_value (message->priv->body, 0);
+ item = g_variant_get_child_value (message->body, 0);
if (g_variant_is_of_type (item, G_VARIANT_TYPE_STRING))
ret = g_variant_get_string (item, NULL);
g_variant_unref (item);
@@ -2563,7 +2571,7 @@ g_dbus_message_to_gerror (GDBusMessage *message,
g_return_val_if_fail (G_IS_DBUS_MESSAGE (message), FALSE);
ret = FALSE;
- if (message->priv->type != G_DBUS_MESSAGE_TYPE_ERROR)
+ if (message->type != G_DBUS_MESSAGE_TYPE_ERROR)
goto out;
error_name = g_dbus_message_get_error_name (message);
@@ -2720,17 +2728,17 @@ g_dbus_message_print (GDBusMessage *message,
str = g_string_new (NULL);
- s = _g_dbus_enum_to_string (G_TYPE_DBUS_MESSAGE_TYPE, message->priv->type);
+ s = _g_dbus_enum_to_string (G_TYPE_DBUS_MESSAGE_TYPE, message->type);
g_string_append_printf (str, "%*sType: %s\n", indent, "", s);
g_free (s);
- s = flags_to_string (G_TYPE_DBUS_MESSAGE_FLAGS, message->priv->flags);
+ s = flags_to_string (G_TYPE_DBUS_MESSAGE_FLAGS, message->flags);
g_string_append_printf (str, "%*sFlags: %s\n", indent, "", s);
g_free (s);
- g_string_append_printf (str, "%*sVersion: %d\n", indent, "", message->priv->major_protocol_version);
- g_string_append_printf (str, "%*sSerial: %d\n", indent, "", message->priv->serial);
+ g_string_append_printf (str, "%*sVersion: %d\n", indent, "", message->major_protocol_version);
+ g_string_append_printf (str, "%*sSerial: %d\n", indent, "", message->serial);
g_string_append_printf (str, "%*sHeaders:\n", indent, "");
- keys = g_hash_table_get_keys (message->priv->headers);
+ keys = g_hash_table_get_keys (message->headers);
keys = g_list_sort (keys, _sort_keys_func);
if (keys != NULL)
{
@@ -2740,7 +2748,7 @@ g_dbus_message_print (GDBusMessage *message,
GVariant *value;
gchar *value_str;
- value = g_hash_table_lookup (message->priv->headers, l->data);
+ value = g_hash_table_lookup (message->headers, l->data);
g_assert (value != NULL);
s = _g_dbus_enum_to_string (G_TYPE_DBUS_MESSAGE_HEADER_FIELD, key);
@@ -2755,9 +2763,9 @@ g_dbus_message_print (GDBusMessage *message,
g_string_append_printf (str, "%*s (none)\n", indent, "");
}
g_string_append_printf (str, "%*sBody: ", indent, "");
- if (message->priv->body != NULL)
+ if (message->body != NULL)
{
- g_variant_print_string (message->priv->body,
+ g_variant_print_string (message->body,
str,
TRUE);
}
@@ -2768,13 +2776,13 @@ g_dbus_message_print (GDBusMessage *message,
g_string_append (str, "\n");
#ifdef G_OS_UNIX
g_string_append_printf (str, "%*sUNIX File Descriptors:\n", indent, "");
- if (message->priv->fd_list != NULL)
+ if (message->fd_list != NULL)
{
gint num_fds;
const gint *fds;
gint n;
- fds = g_unix_fd_list_peek_fds (message->priv->fd_list, &num_fds);
+ fds = g_unix_fd_list_peek_fds (message->fd_list, &num_fds);
if (num_fds > 0)
{
for (n = 0; n < num_fds; n++)
diff --git a/gio/gdbusmessage.h b/gio/gdbusmessage.h
index ec56a2b..743baf5 100644
--- a/gio/gdbusmessage.h
+++ b/gio/gdbusmessage.h
@@ -33,28 +33,7 @@ G_BEGIN_DECLS
#define G_TYPE_DBUS_MESSAGE (g_dbus_message_get_type ())
#define G_DBUS_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_MESSAGE, GDBusMessage))
-#define G_DBUS_MESSAGE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_MESSAGE, GDBusMessageClass))
-#define G_DBUS_MESSAGE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_MESSAGE, GDBusMessageClass))
#define G_IS_DBUS_MESSAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_MESSAGE))
-#define G_IS_DBUS_MESSAGE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_MESSAGE))
-
-typedef struct _GDBusMessageClass GDBusMessageClass;
-typedef struct _GDBusMessagePrivate GDBusMessagePrivate;
-
-/**
- * GDBusMessage:
- *
- * The #GDBusMessage structure contains only private data and should
- * only be accessed using the provided API.
- *
- * Since: 2.26
- */
-struct _GDBusMessage
-{
- /*< private >*/
- GObject parent_instance;
- GDBusMessagePrivate *priv;
-};
GType g_dbus_message_get_type (void) G_GNUC_CONST;
GDBusMessage *g_dbus_message_new (void);
diff --git a/gio/gdbusmethodinvocation.c b/gio/gdbusmethodinvocation.c
index 335800c..62aeb21 100644
--- a/gio/gdbusmethodinvocation.c
+++ b/gio/gdbusmethodinvocation.c
@@ -49,6 +49,8 @@
* #GDBusInterfaceVTable that was passed to g_dbus_connection_register_object().
*/
+typedef struct _GDBusMethodInvocationClass GDBusMethodInvocationClass;
+
/**
* GDBusMethodInvocationClass:
*
@@ -62,8 +64,19 @@ struct _GDBusMethodInvocationClass
GObjectClass parent_class;
};
-struct _GDBusMethodInvocationPrivate
+/**
+ * GDBusMethodInvocation:
+ *
+ * The #GDBusMethodInvocation structure contains only private data and
+ * should only be accessed using the provided API.
+ *
+ * Since: 2.26
+ */
+struct _GDBusMethodInvocation
{
+ /*< private >*/
+ GObject parent_instance;
+
/* construct-only properties */
gchar *sender;
gchar *object_path;
@@ -83,13 +96,13 @@ g_dbus_method_invocation_finalize (GObject *object)
{
GDBusMethodInvocation *invocation = G_DBUS_METHOD_INVOCATION (object);
- g_free (invocation->priv->sender);
- g_free (invocation->priv->object_path);
- g_free (invocation->priv->interface_name);
- g_free (invocation->priv->method_name);
- g_object_unref (invocation->priv->connection);
- g_object_unref (invocation->priv->message);
- g_variant_unref (invocation->priv->parameters);
+ g_free (invocation->sender);
+ g_free (invocation->object_path);
+ g_free (invocation->interface_name);
+ g_free (invocation->method_name);
+ g_object_unref (invocation->connection);
+ g_object_unref (invocation->message);
+ g_variant_unref (invocation->parameters);
G_OBJECT_CLASS (g_dbus_method_invocation_parent_class)->finalize (object);
}
@@ -100,16 +113,11 @@ g_dbus_method_invocation_class_init (GDBusMethodInvocationClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = g_dbus_method_invocation_finalize;
-
- g_type_class_add_private (klass, sizeof (GDBusMethodInvocationPrivate));
}
static void
g_dbus_method_invocation_init (GDBusMethodInvocation *invocation)
{
- invocation->priv = G_TYPE_INSTANCE_GET_PRIVATE (invocation,
- G_TYPE_DBUS_METHOD_INVOCATION,
- GDBusMethodInvocationPrivate);
}
/**
@@ -126,7 +134,7 @@ const gchar *
g_dbus_method_invocation_get_sender (GDBusMethodInvocation *invocation)
{
g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
- return invocation->priv->sender;
+ return invocation->sender;
}
/**
@@ -143,7 +151,7 @@ const gchar *
g_dbus_method_invocation_get_object_path (GDBusMethodInvocation *invocation)
{
g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
- return invocation->priv->object_path;
+ return invocation->object_path;
}
/**
@@ -160,7 +168,7 @@ const gchar *
g_dbus_method_invocation_get_interface_name (GDBusMethodInvocation *invocation)
{
g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
- return invocation->priv->interface_name;
+ return invocation->interface_name;
}
/**
@@ -177,7 +185,7 @@ const GDBusMethodInfo *
g_dbus_method_invocation_get_method_info (GDBusMethodInvocation *invocation)
{
g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
- return invocation->priv->method_info;
+ return invocation->method_info;
}
/**
@@ -194,7 +202,7 @@ const gchar *
g_dbus_method_invocation_get_method_name (GDBusMethodInvocation *invocation)
{
g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
- return invocation->priv->method_name;
+ return invocation->method_name;
}
/**
@@ -211,7 +219,7 @@ GDBusConnection *
g_dbus_method_invocation_get_connection (GDBusMethodInvocation *invocation)
{
g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
- return invocation->priv->connection;
+ return invocation->connection;
}
/**
@@ -235,7 +243,7 @@ GDBusMessage *
g_dbus_method_invocation_get_message (GDBusMethodInvocation *invocation)
{
g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
- return invocation->priv->message;
+ return invocation->message;
}
/**
@@ -252,7 +260,7 @@ GVariant *
g_dbus_method_invocation_get_parameters (GDBusMethodInvocation *invocation)
{
g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
- return invocation->priv->parameters;
+ return invocation->parameters;
}
/**
@@ -269,7 +277,7 @@ gpointer
g_dbus_method_invocation_get_user_data (GDBusMethodInvocation *invocation)
{
g_return_val_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation), NULL);
- return invocation->priv->user_data;
+ return invocation->user_data;
}
/**
@@ -302,7 +310,6 @@ g_dbus_method_invocation_new (const gchar *sender,
gpointer user_data)
{
GDBusMethodInvocation *invocation;
- GDBusMethodInvocationPrivate *priv;
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);
@@ -313,17 +320,15 @@ g_dbus_method_invocation_new (const gchar *sender,
g_return_val_if_fail (g_variant_is_of_type (parameters, G_VARIANT_TYPE_TUPLE), NULL);
invocation = G_DBUS_METHOD_INVOCATION (g_object_new (G_TYPE_DBUS_METHOD_INVOCATION, NULL));
-
- priv = invocation->priv;
- priv->sender = g_strdup (sender);
- priv->object_path = g_strdup (object_path);
- priv->interface_name = g_strdup (interface_name);
- priv->method_name = g_strdup (method_name);
- priv->method_info = g_dbus_method_info_ref ((GDBusMethodInfo *)method_info);
- priv->connection = g_object_ref (connection);
- priv->message = g_object_ref (message);
- priv->parameters = g_variant_ref (parameters);
- priv->user_data = user_data;
+ invocation->sender = g_strdup (sender);
+ invocation->object_path = g_strdup (object_path);
+ invocation->interface_name = g_strdup (interface_name);
+ invocation->method_name = g_strdup (method_name);
+ invocation->method_info = g_dbus_method_info_ref ((GDBusMethodInfo *)method_info);
+ invocation->connection = g_object_ref (connection);
+ invocation->message = g_object_ref (message);
+ invocation->parameters = g_variant_ref (parameters);
+ invocation->user_data = user_data;
return invocation;
}
@@ -358,11 +363,11 @@ g_dbus_method_invocation_return_value (GDBusMethodInvocation *invocation,
parameters = g_variant_new_tuple (NULL, 0);
/* if we have introspection data, check that the signature of @parameters is correct */
- if (invocation->priv->method_info != NULL)
+ if (invocation->method_info != NULL)
{
GVariantType *type;
- type = _g_dbus_compute_complete_signature (invocation->priv->method_info->out_args);
+ type = _g_dbus_compute_complete_signature (invocation->method_info->out_args);
if (!g_variant_is_of_type (parameters, type))
{
@@ -377,7 +382,7 @@ g_dbus_method_invocation_return_value (GDBusMethodInvocation *invocation,
g_variant_type_free (type);
}
- reply = g_dbus_message_new_method_reply (invocation->priv->message);
+ reply = g_dbus_message_new_method_reply (invocation->message);
g_dbus_message_set_body (reply, parameters);
error = NULL;
if (!g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), reply, NULL, &error))
@@ -556,7 +561,7 @@ g_dbus_method_invocation_return_dbus_error (GDBusMethodInvocation *invocation,
g_return_if_fail (error_name != NULL && g_dbus_is_name (error_name));
g_return_if_fail (error_message != NULL);
- reply = g_dbus_message_new_method_error_literal (invocation->priv->message,
+ reply = g_dbus_message_new_method_error_literal (invocation->message,
error_name,
error_message);
g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), reply, NULL, NULL);
diff --git a/gio/gdbusmethodinvocation.h b/gio/gdbusmethodinvocation.h
index 5f6ba09..625d208 100644
--- a/gio/gdbusmethodinvocation.h
+++ b/gio/gdbusmethodinvocation.h
@@ -33,28 +33,7 @@ G_BEGIN_DECLS
#define G_TYPE_DBUS_METHOD_INVOCATION (g_dbus_method_invocation_get_type ())
#define G_DBUS_METHOD_INVOCATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_METHOD_INVOCATION, GDBusMethodInvocation))
-#define G_DBUS_METHOD_INVOCATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_METHOD_INVOCATION, GDBusMethodInvocationClass))
-#define G_DBUS_METHOD_INVOCATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_METHOD_INVOCATION, GDBusMethodInvocationClass))
#define G_IS_DBUS_METHOD_INVOCATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_METHOD_INVOCATION))
-#define G_IS_DBUS_METHOD_INVOCATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_METHOD_INVOCATION))
-
-typedef struct _GDBusMethodInvocationClass GDBusMethodInvocationClass;
-typedef struct _GDBusMethodInvocationPrivate GDBusMethodInvocationPrivate;
-
-/**
- * GDBusMethodInvocation:
- *
- * The #GDBusMethodInvocation structure contains only private data and
- * should only be accessed using the provided API.
- *
- * Since: 2.26
- */
-struct _GDBusMethodInvocation
-{
- /*< private >*/
- GObject parent_instance;
- GDBusMethodInvocationPrivate *priv;
-};
GType g_dbus_method_invocation_get_type (void) G_GNUC_CONST;
GDBusMethodInvocation *g_dbus_method_invocation_new (const gchar *sender,
diff --git a/gio/gdbusserver.c b/gio/gdbusserver.c
index b4bfb4d..5996b47 100644
--- a/gio/gdbusserver.c
+++ b/gio/gdbusserver.c
@@ -70,26 +70,18 @@
*/
/**
- * GDBusServerClass:
- * @new_connection: Signal class handler for the #GDBusServer::new-connection signal.
+ * GDBusServer:
*
- * Class structure for #GDBusServer.
+ * The #GDBusServer structure contains only private data and
+ * should only be accessed using the provided API.
*
* Since: 2.26
*/
-struct _GDBusServerClass
+struct _GDBusServer
{
/*< private >*/
- GObjectClass parent_class;
-
- /*< public >*/
- /* Signals */
- void (*new_connection) (GDBusServer *server,
- GDBusConnection *connection);
-};
+ GObject parent_instance;
-struct _GDBusServerPrivate
-{
GDBusServerFlags flags;
gchar *address;
gchar *guid;
@@ -113,6 +105,27 @@ struct _GDBusServerPrivate
GDBusAuthObserver *authentication_observer;
};
+typedef struct _GDBusServerClass GDBusServerClass;
+
+/**
+ * GDBusServerClass:
+ * @new_connection: Signal class handler for the #GDBusServer::new-connection signal.
+ *
+ * Class structure for #GDBusServer.
+ *
+ * Since: 2.26
+ */
+struct _GDBusServerClass
+{
+ /*< private >*/
+ GObjectClass parent_class;
+
+ /*< public >*/
+ /* Signals */
+ void (*new_connection) (GDBusServer *server,
+ GDBusConnection *connection);
+};
+
enum
{
PROP_0,
@@ -143,27 +156,27 @@ g_dbus_server_finalize (GObject *object)
{
GDBusServer *server = G_DBUS_SERVER (object);
- if (server->priv->authentication_observer != NULL)
- g_object_unref (server->priv->authentication_observer);
+ if (server->authentication_observer != NULL)
+ g_object_unref (server->authentication_observer);
- if (server->priv->listener != NULL)
- g_object_unref (server->priv->listener);
+ if (server->listener != NULL)
+ g_object_unref (server->listener);
- g_free (server->priv->address);
- g_free (server->priv->guid);
- g_free (server->priv->client_address);
- if (server->priv->nonce != NULL)
+ g_free (server->address);
+ g_free (server->guid);
+ g_free (server->client_address);
+ if (server->nonce != NULL)
{
- memset (server->priv->nonce, '\0', 16);
- g_free (server->priv->nonce);
+ memset (server->nonce, '\0', 16);
+ g_free (server->nonce);
}
/* we could unlink the nonce file but I don't
* think it's really worth the effort/risk
*/
- g_free (server->priv->nonce_file);
+ g_free (server->nonce_file);
- if (server->priv->main_context_at_construction != NULL)
- g_main_context_unref (server->priv->main_context_at_construction);
+ if (server->main_context_at_construction != NULL)
+ g_main_context_unref (server->main_context_at_construction);
G_OBJECT_CLASS (g_dbus_server_parent_class)->finalize (object);
}
@@ -179,27 +192,27 @@ g_dbus_server_get_property (GObject *object,
switch (prop_id)
{
case PROP_FLAGS:
- g_value_set_flags (value, server->priv->flags);
+ g_value_set_flags (value, server->flags);
break;
case PROP_GUID:
- g_value_set_string (value, server->priv->guid);
+ g_value_set_string (value, server->guid);
break;
case PROP_ADDRESS:
- g_value_set_string (value, server->priv->address);
+ g_value_set_string (value, server->address);
break;
case PROP_CLIENT_ADDRESS:
- g_value_set_string (value, server->priv->client_address);
+ g_value_set_string (value, server->client_address);
break;
case PROP_ACTIVE:
- g_value_set_boolean (value, server->priv->active);
+ g_value_set_boolean (value, server->active);
break;
case PROP_AUTHENTICATION_OBSERVER:
- g_value_set_object (value, server->priv->authentication_observer);
+ g_value_set_object (value, server->authentication_observer);
break;
default:
@@ -219,19 +232,19 @@ g_dbus_server_set_property (GObject *object,
switch (prop_id)
{
case PROP_FLAGS:
- server->priv->flags = g_value_get_flags (value);
+ server->flags = g_value_get_flags (value);
break;
case PROP_GUID:
- server->priv->guid = g_value_dup_string (value);
+ server->guid = g_value_dup_string (value);
break;
case PROP_ADDRESS:
- server->priv->address = g_value_dup_string (value);
+ server->address = g_value_dup_string (value);
break;
case PROP_AUTHENTICATION_OBSERVER:
- server->priv->authentication_observer = g_value_dup_object (value);
+ server->authentication_observer = g_value_dup_object (value);
break;
default:
@@ -403,19 +416,14 @@ g_dbus_server_class_init (GDBusServerClass *klass)
G_TYPE_NONE,
1,
G_TYPE_DBUS_CONNECTION);
-
-
- g_type_class_add_private (klass, sizeof (GDBusServerPrivate));
}
static void
g_dbus_server_init (GDBusServer *server)
{
- server->priv = G_TYPE_INSTANCE_GET_PRIVATE (server, G_TYPE_DBUS_SERVER, GDBusServerPrivate);
-
- server->priv->main_context_at_construction = g_main_context_get_thread_default ();
- if (server->priv->main_context_at_construction != NULL)
- g_main_context_ref (server->priv->main_context_at_construction);
+ server->main_context_at_construction = g_main_context_get_thread_default ();
+ if (server->main_context_at_construction != NULL)
+ g_main_context_ref (server->main_context_at_construction);
}
static gboolean
@@ -481,8 +489,8 @@ g_dbus_server_new_sync (const gchar *address,
if (server != NULL)
{
/* Right now we don't have any transport not using the listener... */
- g_assert (server->priv->is_using_listener);
- g_signal_connect (G_SOCKET_SERVICE (server->priv->listener),
+ g_assert (server->is_using_listener);
+ g_signal_connect (G_SOCKET_SERVICE (server->listener),
"run",
G_CALLBACK (on_run),
server);
@@ -507,7 +515,7 @@ const gchar *
g_dbus_server_get_client_address (GDBusServer *server)
{
g_return_val_if_fail (G_IS_DBUS_SERVER (server), NULL);
- return server->priv->client_address;
+ return server->client_address;
}
/**
@@ -524,7 +532,7 @@ const gchar *
g_dbus_server_get_guid (GDBusServer *server)
{
g_return_val_if_fail (G_IS_DBUS_SERVER (server), NULL);
- return server->priv->guid;
+ return server->guid;
}
/**
@@ -541,7 +549,7 @@ GDBusServerFlags
g_dbus_server_get_flags (GDBusServer *server)
{
g_return_val_if_fail (G_IS_DBUS_SERVER (server), G_DBUS_SERVER_FLAGS_NONE);
- return server->priv->flags;
+ return server->flags;
}
/**
@@ -558,7 +566,7 @@ gboolean
g_dbus_server_is_active (GDBusServer *server)
{
g_return_val_if_fail (G_IS_DBUS_SERVER (server), G_DBUS_SERVER_FLAGS_NONE);
- return server->priv->active;
+ return server->active;
}
/**
@@ -573,12 +581,12 @@ void
g_dbus_server_start (GDBusServer *server)
{
g_return_if_fail (G_IS_DBUS_SERVER (server));
- if (server->priv->active)
+ if (server->active)
return;
/* Right now we don't have any transport not using the listener... */
- g_assert (server->priv->is_using_listener);
- g_socket_service_start (G_SOCKET_SERVICE (server->priv->listener));
- server->priv->active = TRUE;
+ g_assert (server->is_using_listener);
+ g_socket_service_start (G_SOCKET_SERVICE (server->listener));
+ server->active = TRUE;
g_object_notify (G_OBJECT (server), "active");
}
@@ -594,12 +602,12 @@ void
g_dbus_server_stop (GDBusServer *server)
{
g_return_if_fail (G_IS_DBUS_SERVER (server));
- if (!server->priv->active)
+ if (!server->active)
return;
/* Right now we don't have any transport not using the listener... */
- g_assert (server->priv->is_using_listener);
- g_socket_service_stop (G_SOCKET_SERVICE (server->priv->listener));
- server->priv->active = FALSE;
+ g_assert (server->is_using_listener);
+ g_socket_service_stop (G_SOCKET_SERVICE (server->listener));
+ server->active = FALSE;
g_object_notify (G_OBJECT (server), "active");
}
@@ -667,7 +675,7 @@ try_unix (GDBusServer *server,
g_string_free (s, TRUE);
local_error = NULL;
- if (!g_socket_listener_add_address (server->priv->listener,
+ if (!g_socket_listener_add_address (server->listener,
address,
G_SOCKET_TYPE_STREAM,
G_SOCKET_PROTOCOL_DEFAULT,
@@ -705,7 +713,7 @@ try_unix (GDBusServer *server,
g_assert_not_reached ();
}
- if (!g_socket_listener_add_address (server->priv->listener,
+ if (!g_socket_listener_add_address (server->listener,
address,
G_SOCKET_TYPE_STREAM,
G_SOCKET_PROTOCOL_DEFAULT,
@@ -723,18 +731,18 @@ try_unix (GDBusServer *server,
/* Fill out client_address if the connection attempt worked */
if (ret)
{
- server->priv->is_using_listener = TRUE;
+ server->is_using_listener = TRUE;
switch (g_unix_socket_address_get_address_type (G_UNIX_SOCKET_ADDRESS (address)))
{
case G_UNIX_SOCKET_ADDRESS_ABSTRACT:
- server->priv->client_address = g_strdup_printf ("unix:abstract=%s",
- g_unix_socket_address_get_path (G_UNIX_SOCKET_ADDRESS (address)));
+ server->client_address = g_strdup_printf ("unix:abstract=%s",
+ g_unix_socket_address_get_path (G_UNIX_SOCKET_ADDRESS (address)));
break;
case G_UNIX_SOCKET_ADDRESS_PATH:
- server->priv->client_address = g_strdup_printf ("unix:path=%s",
- g_unix_socket_address_get_path (G_UNIX_SOCKET_ADDRESS (address)));
+ server->client_address = g_strdup_printf ("unix:path=%s",
+ g_unix_socket_address_get_path (G_UNIX_SOCKET_ADDRESS (address)));
break;
default:
@@ -809,7 +817,7 @@ try_tcp (GDBusServer *server,
GSocketAddress *effective_address;
socket_address = g_inet_socket_address_new (address, port_num);
- if (!g_socket_listener_add_address (server->priv->listener,
+ if (!g_socket_listener_add_address (server->listener,
socket_address,
G_SOCKET_TYPE_STREAM,
G_SOCKET_PROTOCOL_TCP,
@@ -835,15 +843,15 @@ try_tcp (GDBusServer *server,
gsize bytes_written;
gsize bytes_remaining;
- server->priv->nonce = g_new0 (guchar, 16);
+ server->nonce = g_new0 (guchar, 16);
for (n = 0; n < 16; n++)
- server->priv->nonce[n] = g_random_int_range (0, 256);
+ server->nonce[n] = g_random_int_range (0, 256);
fd = g_file_open_tmp ("gdbus-nonce-file-XXXXXX",
- &server->priv->nonce_file,
+ &server->nonce_file,
error);
if (fd == -1)
{
- g_socket_listener_close (server->priv->listener);
+ g_socket_listener_close (server->listener);
goto out;
}
again:
@@ -852,7 +860,7 @@ try_tcp (GDBusServer *server,
while (bytes_remaining > 0)
{
gssize ret;
- ret = write (fd, server->priv->nonce + bytes_written, bytes_remaining);
+ ret = write (fd, server->nonce + bytes_written, bytes_remaining);
if (ret == -1)
{
if (errno == EINTR)
@@ -861,7 +869,7 @@ try_tcp (GDBusServer *server,
G_IO_ERROR,
g_io_error_from_errno (errno),
_("Error writing nonce file at `%s': %s"),
- server->priv->nonce_file,
+ server->nonce_file,
strerror (errno));
goto out;
}
@@ -869,16 +877,16 @@ try_tcp (GDBusServer *server,
bytes_remaining -= ret;
}
close (fd);
- server->priv->client_address = g_strdup_printf ("nonce-tcp:host=%s,port=%d,noncefile=%s",
- host,
- port_num,
- server->priv->nonce_file);
+ server->client_address = g_strdup_printf ("nonce-tcp:host=%s,port=%d,noncefile=%s",
+ host,
+ port_num,
+ server->nonce_file);
}
else
{
- server->priv->client_address = g_strdup_printf ("tcp:host=%s,port=%d", host, port_num);
+ server->client_address = g_strdup_printf ("tcp:host=%s,port=%d", host, port_num);
}
- server->priv->is_using_listener = TRUE;
+ server->is_using_listener = TRUE;
ret = TRUE;
out:
@@ -930,7 +938,7 @@ on_run (GSocketService *service,
GDBusConnection *connection;
GDBusConnectionFlags connection_flags;
- if (server->priv->nonce != NULL)
+ if (server->nonce != NULL)
{
gchar buf[16];
gsize bytes_read;
@@ -946,26 +954,26 @@ on_run (GSocketService *service,
if (bytes_read != 16)
goto out;
- if (memcmp (buf, server->priv->nonce, 16) != 0)
+ if (memcmp (buf, server->nonce, 16) != 0)
goto out;
}
connection_flags =
G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER |
G_DBUS_CONNECTION_FLAGS_DELAY_MESSAGE_PROCESSING;
- if (server->priv->flags & G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS)
+ if (server->flags & G_DBUS_SERVER_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS)
connection_flags |= G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_ALLOW_ANONYMOUS;
connection = g_dbus_connection_new_sync (G_IO_STREAM (socket_connection),
- server->priv->guid,
+ server->guid,
connection_flags,
- server->priv->authentication_observer,
+ server->authentication_observer,
NULL, /* GCancellable */
NULL); /* GError */
if (connection == NULL)
goto out;
- if (server->priv->flags & G_DBUS_SERVER_FLAGS_RUN_IN_THREAD)
+ if (server->flags & G_DBUS_SERVER_FLAGS_RUN_IN_THREAD)
{
g_signal_emit (server,
_signals[NEW_CONNECTION_SIGNAL],
@@ -989,7 +997,7 @@ on_run (GSocketService *service,
emit_new_connection_in_idle,
data,
(GDestroyNotify) emit_idle_data_free);
- g_source_attach (idle_source, server->priv->main_context_at_construction);
+ g_source_attach (idle_source, server->main_context_at_construction);
g_source_unref (idle_source);
}
@@ -1011,19 +1019,19 @@ initable_init (GInitable *initable,
ret = FALSE;
last_error = NULL;
- if (!g_dbus_is_guid (server->priv->guid))
+ if (!g_dbus_is_guid (server->guid))
{
g_set_error (&last_error,
G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
_("The string `%s' is not a valid D-Bus GUID"),
- server->priv->guid);
+ server->guid);
goto out;
}
- server->priv->listener = G_SOCKET_LISTENER (g_threaded_socket_service_new (-1));
+ server->listener = G_SOCKET_LISTENER (g_threaded_socket_service_new (-1));
- addr_array = g_strsplit (server->priv->address, ";", 0);
+ addr_array = g_strsplit (server->address, ";", 0);
last_error = NULL;
for (n = 0; addr_array != NULL && addr_array[n] != NULL; n++)
{
diff --git a/gio/gdbusserver.h b/gio/gdbusserver.h
index 3b2b4d8..3d10c1b 100644
--- a/gio/gdbusserver.h
+++ b/gio/gdbusserver.h
@@ -33,28 +33,7 @@ G_BEGIN_DECLS
#define G_TYPE_DBUS_SERVER (g_dbus_server_get_type ())
#define G_DBUS_SERVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_SERVER, GDBusServer))
-#define G_DBUS_SERVER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_SERVER, GDBusServerClass))
-#define G_DBUS_SERVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_SERVER, GDBusServerClass))
#define G_IS_DBUS_SERVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_SERVER))
-#define G_IS_DBUS_SERVER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_SERVER))
-
-typedef struct _GDBusServerClass GDBusServerClass;
-typedef struct _GDBusServerPrivate GDBusServerPrivate;
-
-/**
- * GDBusServer:
- *
- * The #GDBusServer structure contains only private data and
- * should only be accessed using the provided API.
- *
- * Since: 2.26
- */
-struct _GDBusServer
-{
- /*< private >*/
- GObject parent_instance;
- GDBusServerPrivate *priv;
-};
GType g_dbus_server_get_type (void) G_GNUC_CONST;
GDBusServer *g_dbus_server_new_sync (const gchar *address,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]