From 3fb373cb8ba027ffba1e44033a800fe750cddaa1 Mon Sep 17 00:00:00 2001 From: Ankit Date: Sat, 14 Mar 2015 22:01:35 +0530 Subject: [PATCH] Change DBus namespace to GClueDBus Change DBus namespace from GClue to GClueDBus. This is needed to avoid conflict with the GClueLocation class (subclass of GeocodeLocation) which will be added afterwards. https://bugs.freedesktop.org/show_bug.cgi?id=89395 --- src/Makefile.am | 2 +- src/gclue-service-client.c | 56 ++++++++++++++++++++++++-------------------- src/gclue-service-client.h | 4 ++-- src/gclue-service-location.c | 30 ++++++++++++------------ src/gclue-service-location.h | 4 ++-- src/gclue-service-manager.c | 46 +++++++++++++++++++----------------- src/gclue-service-manager.h | 4 ++-- 7 files changed, 77 insertions(+), 69 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index bb9ad39..485f989 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,7 +15,7 @@ geoclue-interface.c: geoclue-interface.h geoclue-interface.h: Makefile.am $(interface_DATA) $(AM_V_GEN)$(GDBUS_CODEGEN) \ --interface-prefix org.freedesktop.GeoClue2. \ - --c-namespace GClue \ + --c-namespace GClueDBus \ --generate-c-code geoclue-interface \ --generate-docbook=docs \ $(srcdir)/$(interface_DATA) diff --git a/src/gclue-service-client.c b/src/gclue-service-client.c index 0ff3e85..e6dffad 100644 --- a/src/gclue-service-client.c +++ b/src/gclue-service-client.c @@ -31,14 +31,14 @@ #define DEFAULT_ACCURACY_LEVEL GCLUE_ACCURACY_LEVEL_CITY static void -gclue_service_client_client_iface_init (GClueClientIface *iface); +gclue_service_client_client_iface_init (GClueDBusClientIface *iface); static void gclue_service_client_initable_iface_init (GInitableIface *iface); G_DEFINE_TYPE_WITH_CODE (GClueServiceClient, gclue_service_client, - GCLUE_TYPE_CLIENT_SKELETON, - G_IMPLEMENT_INTERFACE (GCLUE_TYPE_CLIENT, + GCLUE_DBUS_TYPE_CLIENT_SKELETON, + G_IMPLEMENT_INTERFACE (GCLUE_DBUS_TYPE_CLIENT, gclue_service_client_client_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, gclue_service_client_initable_iface_init)); @@ -180,7 +180,7 @@ on_locator_location_changed (GObject *gobject, else prev_path = "/"; - gclue_client_set_location (GCLUE_CLIENT (client), path); + gclue_dbus_client_set_location (GCLUE_DBUS_CLIENT (client), path); if (!emit_location_updated (client, prev_path, path, &error)) goto error_out; @@ -198,7 +198,7 @@ start_client (GClueServiceClient *client, GClueAccuracyLevel accuracy_level) { GClueServiceClientPrivate *priv = client->priv; - gclue_client_set_active (GCLUE_CLIENT (client), TRUE); + gclue_dbus_client_set_active (GCLUE_DBUS_CLIENT (client), TRUE); priv->locator = gclue_locator_new (accuracy_level); g_signal_connect (priv->locator, "notify::location", @@ -212,7 +212,7 @@ static void stop_client (GClueServiceClient *client) { g_clear_object (&client->priv->locator); - gclue_client_set_active (GCLUE_CLIENT (client), FALSE); + gclue_dbus_client_set_active (GCLUE_DBUS_CLIENT (client), FALSE); } static void @@ -222,6 +222,7 @@ on_agent_props_changed (GDBusProxy *agent_proxy, gpointer user_data) { GClueServiceClient *client = GCLUE_SERVICE_CLIENT (user_data); + GClueDBusClient *gdbus_client; GVariantIter *iter; GVariant *value; gchar *key; @@ -238,8 +239,9 @@ on_agent_props_changed (GDBusProxy *agent_proxy, if (strcmp (key, "MaxAccuracyLevel") != 0) continue; + gdbus_client = GCLUE_DBUS_CLIENT (client); config = gclue_config_get_singleton (); - id = gclue_client_get_desktop_id (GCLUE_CLIENT (client)); + id = gclue_dbus_client_get_desktop_id (gdbus_client); max_accuracy = g_variant_get_uint32 (value); /* FIXME: We should be handling all values of max accuracy * level here, not just 0 and non-0. @@ -248,14 +250,14 @@ on_agent_props_changed (GDBusProxy *agent_proxy, GClueAccuracyLevel accuracy; client->priv->agent_stopped = FALSE; - accuracy = gclue_client_get_requested_accuracy_level - (GCLUE_CLIENT (client)); + accuracy = gclue_dbus_client_get_requested_accuracy_level + (gdbus_client); accuracy = CLAMP (accuracy, 0, max_accuracy); start_client (client, accuracy); g_debug ("Re-started '%s'.", id); } else if (max_accuracy == 0 && - gclue_client_get_active (GCLUE_CLIENT (client)) && + gclue_dbus_client_get_active (gdbus_client) && !gclue_config_is_system_component (config, id)) { stop_client (client); client->priv->agent_stopped = TRUE; @@ -284,12 +286,13 @@ start_data_free (StartData *data) static void complete_start (StartData *data, GClueAccuracyLevel accuracy_level) { + GClueDBusClient *gdbus_client = GCLUE_DBUS_CLIENT (data->client); start_client (data->client, accuracy_level); - gclue_client_complete_start (GCLUE_CLIENT (data->client), - data->invocation); + gclue_dbus_client_complete_start (gdbus_client, + data->invocation); g_debug ("'%s' started.", - gclue_client_get_desktop_id (GCLUE_CLIENT (data->client))); + gclue_dbus_client_get_desktop_id (gdbus_client)); start_data_free (data); } @@ -303,8 +306,8 @@ on_authorize_app_ready (GObject *source_object, gboolean authorized = FALSE; GClueAccuracyLevel accuracy_level; - accuracy_level = gclue_client_get_requested_accuracy_level - (GCLUE_CLIENT (data->client)); + accuracy_level = gclue_dbus_client_get_requested_accuracy_level + (GCLUE_DBUS_CLIENT (data->client)); if (!gclue_agent_call_authorize_app_finish (GCLUE_AGENT (source_object), &authorized, &accuracy_level, @@ -330,7 +333,7 @@ error_out: } static gboolean -gclue_service_client_handle_start (GClueClient *client, +gclue_service_client_handle_start (GClueDBusClient *client, GDBusMethodInvocation *invocation) { GClueServiceClientPrivate *priv = GCLUE_SERVICE_CLIENT (client)->priv; @@ -345,7 +348,7 @@ gclue_service_client_handle_start (GClueClient *client, /* Already started */ return TRUE; - desktop_id = gclue_client_get_desktop_id (client); + desktop_id = gclue_dbus_client_get_desktop_id (client); if (desktop_id == NULL) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, @@ -374,7 +377,7 @@ gclue_service_client_handle_start (GClueClient *client, data->client = g_object_ref (client); data->invocation = g_object_ref (invocation); - accuracy_level = gclue_client_get_requested_accuracy_level (client); + accuracy_level = gclue_dbus_client_get_requested_accuracy_level (client); /* No agent == No authorization needed */ if (priv->agent_proxy == NULL || @@ -416,12 +419,12 @@ gclue_service_client_handle_start (GClueClient *client, } static gboolean -gclue_service_client_handle_stop (GClueClient *client, +gclue_service_client_handle_stop (GClueDBusClient *client, GDBusMethodInvocation *invocation) { stop_client (GCLUE_SERVICE_CLIENT (client)); - gclue_client_complete_stop (client, invocation); - g_debug ("'%s' stopped.", gclue_client_get_desktop_id (client)); + gclue_dbus_client_complete_stop (client, invocation); + g_debug ("'%s' stopped.", gclue_dbus_client_get_desktop_id (client)); return TRUE; } @@ -589,7 +592,7 @@ gclue_service_client_handle_set_property (GDBusConnection *connection, GError **error, gpointer user_data) { - GClueClient *client = GCLUE_CLIENT (user_data); + GClueDBusClient *client = GCLUE_DBUS_CLIENT (user_data); GClueServiceClientPrivate *priv = GCLUE_SERVICE_CLIENT (client)->priv; GDBusInterfaceSkeletonClass *skeleton_class; GDBusInterfaceVTable *skeleton_vtable; @@ -614,7 +617,8 @@ gclue_service_client_handle_set_property (GDBusConnection *connection, error, user_data); if (ret && strcmp (property_name, "DistanceThreshold") == 0) { - priv->threshold = gclue_client_get_distance_threshold (client); + priv->threshold = gclue_dbus_client_get_distance_threshold + (client); g_debug ("New distance threshold: %u", priv->threshold); } @@ -693,7 +697,7 @@ gclue_service_client_class_init (GClueServiceClientClass *klass) } static void -gclue_service_client_client_iface_init (GClueClientIface *iface) +gclue_service_client_client_iface_init (GClueDBusClientIface *iface) { iface->handle_start = gclue_service_client_handle_start; iface->handle_stop = gclue_service_client_handle_stop; @@ -726,8 +730,8 @@ gclue_service_client_init (GClueServiceClient *client) client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client, GCLUE_TYPE_SERVICE_CLIENT, GClueServiceClientPrivate); - gclue_client_set_requested_accuracy_level (GCLUE_CLIENT (client), - DEFAULT_ACCURACY_LEVEL); + gclue_dbus_client_set_requested_accuracy_level + (GCLUE_DBUS_CLIENT (client), DEFAULT_ACCURACY_LEVEL); } GClueServiceClient * diff --git a/src/gclue-service-client.h b/src/gclue-service-client.h index 6bd0618..758aa90 100644 --- a/src/gclue-service-client.h +++ b/src/gclue-service-client.h @@ -44,7 +44,7 @@ typedef struct _GClueServiceClientPrivate GClueServiceClientPrivate; struct _GClueServiceClient { - GClueClientSkeleton parent; + GClueDBusClientSkeleton parent; /*< private >*/ GClueServiceClientPrivate *priv; @@ -52,7 +52,7 @@ struct _GClueServiceClient struct _GClueServiceClientClass { - GClueClientSkeletonClass parent_class; + GClueDBusClientSkeletonClass parent_class; }; GType gclue_service_client_get_type (void) G_GNUC_CONST; diff --git a/src/gclue-service-location.c b/src/gclue-service-location.c index 939cd65..6bdbb41 100644 --- a/src/gclue-service-location.c +++ b/src/gclue-service-location.c @@ -29,7 +29,7 @@ gclue_service_location_initable_iface_init (GInitableIface *iface); G_DEFINE_TYPE_WITH_CODE (GClueServiceLocation, gclue_service_location, - GCLUE_TYPE_LOCATION_SKELETON, + GCLUE_DBUS_TYPE_LOCATION_SKELETON, G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, gclue_service_location_initable_iface_init)); @@ -72,7 +72,7 @@ gclue_service_location_get_property (GObject *object, GParamSpec *pspec) { GClueServiceLocation *self = GCLUE_SERVICE_LOCATION (object); - GClueLocation *location = GCLUE_LOCATION (object); + GClueDBusLocation *location = GCLUE_DBUS_LOCATION (object); switch (prop_id) { case PROP_CLIENT_INFO: @@ -93,11 +93,11 @@ gclue_service_location_get_property (GObject *object, gdouble altitude; loc = geocode_location_new_with_description - (gclue_location_get_latitude (location), - gclue_location_get_longitude (location), - gclue_location_get_accuracy (location), - gclue_location_get_description (location)); - altitude = gclue_location_get_altitude (location); + (gclue_dbus_location_get_latitude (location), + gclue_dbus_location_get_longitude (location), + gclue_dbus_location_get_accuracy (location), + gclue_dbus_location_get_description (location)); + altitude = gclue_dbus_location_get_altitude (location); if (altitude != GEOCODE_LOCATION_ALTITUDE_UNKNOWN) g_object_set (loc, "altitude", altitude, NULL); @@ -117,7 +117,7 @@ gclue_service_location_set_property (GObject *object, GParamSpec *pspec) { GClueServiceLocation *self = GCLUE_SERVICE_LOCATION (object); - GClueLocation *location = GCLUE_LOCATION (object); + GClueDBusLocation *location = GCLUE_DBUS_LOCATION (object); switch (prop_id) { case PROP_CLIENT_INFO: @@ -138,17 +138,17 @@ gclue_service_location_set_property (GObject *object, gdouble altitude; loc = g_value_get_object (value); - gclue_location_set_latitude + gclue_dbus_location_set_latitude (location, geocode_location_get_latitude (loc)); - gclue_location_set_longitude + gclue_dbus_location_set_longitude (location, geocode_location_get_longitude (loc)); - gclue_location_set_accuracy + gclue_dbus_location_set_accuracy (location, geocode_location_get_accuracy (loc)); - gclue_location_set_description + gclue_dbus_location_set_description (location, geocode_location_get_description (loc)); altitude = geocode_location_get_altitude (loc); if (altitude != GEOCODE_LOCATION_ALTITUDE_UNKNOWN) - gclue_location_set_altitude (location, altitude); + gclue_dbus_location_set_altitude (location, altitude); break; } @@ -333,8 +333,8 @@ gclue_service_location_init (GClueServiceLocation *location) location->priv = G_TYPE_INSTANCE_GET_PRIVATE (location, GCLUE_TYPE_SERVICE_LOCATION, GClueServiceLocationPrivate); - gclue_location_set_altitude (GCLUE_LOCATION (location), - GEOCODE_LOCATION_ALTITUDE_UNKNOWN); + gclue_dbus_location_set_altitude (GCLUE_DBUS_LOCATION (location), + GEOCODE_LOCATION_ALTITUDE_UNKNOWN); } static gboolean diff --git a/src/gclue-service-location.h b/src/gclue-service-location.h index aa74ca4..482b88c 100644 --- a/src/gclue-service-location.h +++ b/src/gclue-service-location.h @@ -44,7 +44,7 @@ typedef struct _GClueServiceLocationPrivate GClueServiceLocationPrivate; struct _GClueServiceLocation { - GClueLocationSkeleton parent; + GClueDBusLocationSkeleton parent; /*< private >*/ GClueServiceLocationPrivate *priv; @@ -52,7 +52,7 @@ struct _GClueServiceLocation struct _GClueServiceLocationClass { - GClueLocationSkeletonClass parent_class; + GClueDBusLocationSkeletonClass parent_class; }; GType gclue_service_location_get_type (void) G_GNUC_CONST; diff --git a/src/gclue-service-manager.c b/src/gclue-service-manager.c index d38b473..6813bd0 100644 --- a/src/gclue-service-manager.c +++ b/src/gclue-service-manager.c @@ -35,14 +35,14 @@ #define AGENT_WAIT_TIMEOUT_USEC 100000 /* microseconds */ static void -gclue_service_manager_manager_iface_init (GClueManagerIface *iface); +gclue_service_manager_manager_iface_init (GClueDBusManagerIface *iface); static void gclue_service_manager_initable_iface_init (GInitableIface *iface); G_DEFINE_TYPE_WITH_CODE (GClueServiceManager, gclue_service_manager, - GCLUE_TYPE_MANAGER_SKELETON, - G_IMPLEMENT_INTERFACE (GCLUE_TYPE_MANAGER, + GCLUE_DBUS_TYPE_MANAGER_SKELETON, + G_IMPLEMENT_INTERFACE (GCLUE_DBUS_TYPE_MANAGER, gclue_service_manager_manager_iface_init) G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, gclue_service_manager_initable_iface_init)) @@ -76,18 +76,19 @@ sync_in_use_property (GClueServiceManager *manager) { gboolean in_use = FALSE, active = FALSE; GList *clients, *l; + GClueDBusManager *gdbus_manager; clients = g_hash_table_get_values (manager->priv->clients); for (l = clients; l != NULL; l = l->next) { - GClueClient *client = GCLUE_CLIENT (l->data); + GClueDBusClient *client = GCLUE_DBUS_CLIENT (l->data); GClueConfig *config; const char *id; - id = gclue_client_get_desktop_id (client); + id = gclue_dbus_client_get_desktop_id (client); config = gclue_config_get_singleton (); - active |= gclue_client_get_active (client); - if (gclue_client_get_active (client) && + active |= gclue_dbus_client_get_active (client); + if (gclue_dbus_client_get_active (client) && !gclue_config_is_system_component (config, id)) { in_use = TRUE; @@ -100,8 +101,9 @@ sync_in_use_property (GClueServiceManager *manager) manager->priv->active = active; g_object_notify (G_OBJECT (manager), "active"); } - if (in_use != gclue_manager_get_in_use (GCLUE_MANAGER (manager))) - gclue_manager_set_in_use (GCLUE_MANAGER (manager), in_use); + gdbus_manager = GCLUE_DBUS_MANAGER (manager); + if (in_use != gclue_dbus_manager_get_in_use (gdbus_manager)) + gclue_dbus_manager_set_in_use (gdbus_manager, in_use); } static void @@ -119,7 +121,7 @@ on_peer_vanished (GClueClientInfo *info, typedef struct { - GClueManager *manager; + GClueDBusManager *manager; GDBusMethodInvocation *invocation; GClueClientInfo *client_info; } OnClientInfoNewReadyData; @@ -165,7 +167,9 @@ complete_get_client (OnClientInfoNewReadyData *data) G_CALLBACK (sync_in_use_property), data->manager); - gclue_manager_complete_get_client (data->manager, data->invocation, path); + gclue_dbus_manager_complete_get_client (data->manager, + data->invocation, + path); goto out; error_out: @@ -229,7 +233,7 @@ on_client_info_new_ready (GObject *source_object, } static gboolean -gclue_service_manager_handle_get_client (GClueManager *manager, +gclue_service_manager_handle_get_client (GClueDBusManager *manager, GDBusMethodInvocation *invocation) { GClueServiceManager *self = GCLUE_SERVICE_MANAGER (manager); @@ -244,9 +248,9 @@ gclue_service_manager_handle_get_client (GClueManager *manager, const gchar *existing_path; existing_path = gclue_service_client_get_path (client); - gclue_manager_complete_get_client (manager, - invocation, - existing_path); + gclue_dbus_manager_complete_get_client (manager, + invocation, + existing_path); return TRUE; } @@ -263,7 +267,7 @@ gclue_service_manager_handle_get_client (GClueManager *manager, typedef struct { - GClueManager *manager; + GClueDBusManager *manager; GDBusMethodInvocation *invocation; GClueClientInfo *info; char *desktop_id; @@ -313,7 +317,7 @@ on_agent_proxy_ready (GObject *source_object, G_CALLBACK (on_agent_vanished), data->manager); - gclue_manager_complete_add_agent (data->manager, data->invocation); + gclue_dbus_manager_complete_add_agent (data->manager, data->invocation); goto out; @@ -373,7 +377,7 @@ on_agent_info_new_ready (GObject *source_object, } static gboolean -gclue_service_manager_handle_add_agent (GClueManager *manager, +gclue_service_manager_handle_add_agent (GClueDBusManager *manager, GDBusMethodInvocation *invocation, const char *id) { @@ -460,8 +464,8 @@ on_avail_accuracy_level_changed (GObject *object, level = gclue_location_source_get_available_accuracy_level (GCLUE_LOCATION_SOURCE (priv->locator)); - gclue_manager_set_available_accuracy_level (GCLUE_MANAGER (user_data), - level); + gclue_dbus_manager_set_available_accuracy_level + (GCLUE_DBUS_MANAGER (user_data), level); } static void @@ -551,7 +555,7 @@ gclue_service_manager_initable_init (GInitable *initable, } static void -gclue_service_manager_manager_iface_init (GClueManagerIface *iface) +gclue_service_manager_manager_iface_init (GClueDBusManagerIface *iface) { iface->handle_get_client = gclue_service_manager_handle_get_client; iface->handle_add_agent = gclue_service_manager_handle_add_agent; diff --git a/src/gclue-service-manager.h b/src/gclue-service-manager.h index 6c524b8..aab7073 100644 --- a/src/gclue-service-manager.h +++ b/src/gclue-service-manager.h @@ -42,7 +42,7 @@ typedef struct _GClueServiceManagerPrivate GClueServiceManagerPrivate; struct _GClueServiceManager { - GClueManagerSkeleton parent; + GClueDBusManagerSkeleton parent; /*< private >*/ GClueServiceManagerPrivate *priv; @@ -50,7 +50,7 @@ struct _GClueServiceManager struct _GClueServiceManagerClass { - GClueManagerSkeletonClass parent_class; + GClueDBusManagerSkeletonClass parent_class; }; GType gclue_service_manager_get_type (void) G_GNUC_CONST; -- 2.1.0