[gnome-online-accounts/wip/rishi/port-to-g-declare] identity-service: Make it a final class



commit 32ff95434d93d3c05e010c01d3fbda18746d695c
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Dec 6 18:38:58 2019 +0100

    identity-service: Make it a final class
    
    https://gitlab.gnome.org/GNOME/gnome-online-accounts/merge_requests/40

 src/goaidentity/goaidentityservice.c | 206 +++++++++++------------------------
 src/goaidentity/goaidentityservice.h |  16 ---
 2 files changed, 66 insertions(+), 156 deletions(-)
---
diff --git a/src/goaidentity/goaidentityservice.c b/src/goaidentity/goaidentityservice.c
index abbbdbae..689b6308 100644
--- a/src/goaidentity/goaidentityservice.c
+++ b/src/goaidentity/goaidentityservice.c
@@ -36,8 +36,12 @@
 
 #include "goakerberosidentitymanager.h"
 
-struct _GoaIdentityServicePrivate
+#include "org.gnome.Identity.h"
+
+struct _GoaIdentityService
 {
+  GoaIdentityServiceManagerSkeleton  parent_instance;
+
   GDBusConnection          *connection;
   GDBusObjectManagerServer *object_manager_server;
   guint                     bus_id;
@@ -51,6 +55,11 @@ struct _GoaIdentityServicePrivate
   GoaClient                *client;
 };
 
+struct _GoaIdentityServiceClass
+{
+  GoaIdentityServiceManagerSkeletonClass  parent_class;
+};
+
 static void identity_service_manager_interface_init (GoaIdentityServiceManagerIface *interface);
 
 static void
@@ -66,7 +75,6 @@ sign_in (GoaIdentityService     *self,
 G_DEFINE_TYPE_WITH_CODE (GoaIdentityService,
                          goa_identity_service,
                          GOA_IDENTITY_SERVICE_TYPE_MANAGER_SKELETON,
-                         G_ADD_PRIVATE (GoaIdentityService)
                          G_IMPLEMENT_INTERFACE (GOA_IDENTITY_SERVICE_TYPE_MANAGER,
                                                 identity_service_manager_interface_init));
 
@@ -91,13 +99,10 @@ static char *
 export_identity (GoaIdentityService *self,
                  GoaIdentity        *identity)
 {
-  GoaIdentityServicePrivate *priv;
   char *object_path;
   GDBusObjectSkeleton *object;
   GDBusInterfaceSkeleton *interface;
 
-  priv = goa_identity_service_get_instance_private (self);
-
   object_path = get_object_path_for_identity (self, identity);
 
   object = G_DBUS_OBJECT_SKELETON (goa_identity_service_object_skeleton_new (object_path));
@@ -116,7 +121,7 @@ export_identity (GoaIdentityService *self,
   g_dbus_object_skeleton_add_interface (object, interface);
   g_object_unref (interface);
 
-  g_dbus_object_manager_server_export (priv->object_manager_server, object);
+  g_dbus_object_manager_server_export (self->object_manager_server, object);
   g_object_unref (object);
 
   return object_path;
@@ -126,14 +131,11 @@ static void
 unexport_identity (GoaIdentityService *self,
                    GoaIdentity        *identity)
 {
-  GoaIdentityServicePrivate *priv;
   char *object_path;
 
-  priv = goa_identity_service_get_instance_private (self);
-
   object_path = get_object_path_for_identity (self, identity);
 
-  g_dbus_object_manager_server_unexport (priv->object_manager_server, object_path);
+  g_dbus_object_manager_server_unexport (self->object_manager_server, object_path);
   g_free (object_path);
 }
 
@@ -173,14 +175,11 @@ find_object_with_principal (GoaIdentityService *self,
                             const char         *principal,
                             gboolean            must_be_enabled)
 {
-  GoaIdentityServicePrivate *priv;
   GList      *objects;
   GList      *node;
   GoaObject  *found_object = NULL;
 
-  priv = goa_identity_service_get_instance_private (self);
-
-  objects = goa_client_get_accounts (priv->client);
+  objects = goa_client_get_accounts (self->client);
   for (node = objects; node != NULL; node = node->next)
     {
       GoaObject *object = GOA_OBJECT (node->data);
@@ -340,7 +339,6 @@ goa_identity_service_handle_sign_in (GoaIdentityServiceManager *manager,
                                      GVariant                  *details)
 {
   GoaIdentityService     *self = GOA_IDENTITY_SERVICE (manager);
-  GoaIdentityServicePrivate *priv;
   GTask                  *operation_result;
   GoaIdentitySignInFlags  flags;
   char                   *secret_key = NULL;
@@ -348,8 +346,6 @@ goa_identity_service_handle_sign_in (GoaIdentityServiceManager *manager,
   gconstpointer           initial_password = NULL;
   GCancellable           *cancellable;
 
-  priv = goa_identity_service_get_instance_private (self);
-
   read_sign_in_details (manager, details, &flags, &secret_key, &preauth_source);
 
   if (secret_key != NULL)
@@ -361,7 +357,7 @@ goa_identity_service_handle_sign_in (GoaIdentityServiceManager *manager,
                              g_dbus_method_invocation_get_sender (invocation),
                              identifier);
 
-      secret_exchange = g_hash_table_lookup (priv->key_holders, key);
+      secret_exchange = g_hash_table_lookup (self->key_holders, key);
       g_free (key);
 
       if (secret_exchange == NULL)
@@ -507,13 +503,10 @@ goa_identity_service_handle_sign_out (GoaIdentityServiceManager *manager,
                                       const char                *identifier)
 {
   GoaIdentityService *self = GOA_IDENTITY_SERVICE (manager);
-  GoaIdentityServicePrivate *priv;
   GTask *task;
 
-  priv = goa_identity_service_get_instance_private (self);
-
   task = g_task_new (self, NULL, (GAsyncReadyCallback) on_sign_out_handled, g_object_ref (invocation));
-  goa_identity_manager_get_identity (priv->identity_manager,
+  goa_identity_manager_get_identity (self->identity_manager,
                                      identifier,
                                      NULL,
                                      (GAsyncReadyCallback)
@@ -557,14 +550,12 @@ on_caller_watched (GDBusConnection    *connection,
                    GTask              *operation_result)
 {
   GoaIdentityService    *self;
-  GoaIdentityServicePrivate *priv;
   GcrSecretExchange     *secret_exchange;
   const char            *identifier;
   const char            *input_key;
   char                  *output_key;
 
   self = GOA_IDENTITY_SERVICE (g_task_get_source_object (operation_result));
-  priv = goa_identity_service_get_instance_private (self);
 
   identifier = g_object_get_data (G_OBJECT (operation_result), "identifier");
   input_key = g_object_get_data (G_OBJECT (operation_result), "input-key");
@@ -581,7 +572,7 @@ on_caller_watched (GDBusConnection    *connection,
       return;
     }
 
-  g_hash_table_insert (priv->key_holders, g_strdup_printf ("%s %s", name_owner, identifier), 
secret_exchange);
+  g_hash_table_insert (self->key_holders, g_strdup_printf ("%s %s", name_owner, identifier), 
secret_exchange);
 
   output_key = gcr_secret_exchange_send (secret_exchange, NULL, 0);
   g_task_return_pointer (operation_result, output_key, g_free);
@@ -593,17 +584,15 @@ on_caller_vanished (GDBusConnection    *connection,
                     GTask              *operation_result)
 {
   GoaIdentityService *self;
-  GoaIdentityServicePrivate *priv;
   GCancellable       *cancellable;
 
   self = GOA_IDENTITY_SERVICE (g_task_get_source_object (operation_result));
-  priv = goa_identity_service_get_instance_private (self);
 
   cancellable = g_task_get_cancellable (operation_result);
   g_cancellable_cancel (cancellable);
 
-  g_hash_table_remove (priv->watched_client_connections, name);
-  g_hash_table_remove (priv->key_holders, name);
+  g_hash_table_remove (self->watched_client_connections, name);
+  g_hash_table_remove (self->key_holders, name);
 
 }
 
@@ -614,14 +603,11 @@ goa_identity_service_handle_exchange_secret_keys (GoaIdentityServiceManager *man
                                                   const char                *input_key)
 {
   GoaIdentityService     *self = GOA_IDENTITY_SERVICE (manager);
-  GoaIdentityServicePrivate *priv;
   GTask                  *operation_result;
   GCancellable           *cancellable;
   guint                   watch_id;
   const char             *sender;
 
-  priv = goa_identity_service_get_instance_private (self);
-
   cancellable = g_cancellable_new ();
   operation_result = g_task_new (self, cancellable, (GAsyncReadyCallback) on_secret_keys_exchanged, NULL);
   g_task_set_task_data (operation_result, g_object_ref (invocation), g_object_unref);
@@ -644,7 +630,7 @@ goa_identity_service_handle_exchange_secret_keys (GoaIdentityServiceManager *man
                                on_caller_vanished,
                                g_object_ref (operation_result),
                                g_object_unref);
-  g_hash_table_insert (priv->watched_client_connections, g_strdup (sender), GUINT_TO_POINTER (watch_id));
+  g_hash_table_insert (self->watched_client_connections, g_strdup (sender), GUINT_TO_POINTER (watch_id));
 
   g_object_unref (operation_result);
   return TRUE;
@@ -661,26 +647,21 @@ identity_service_manager_interface_init (GoaIdentityServiceManagerIface *interfa
 static void
 goa_identity_service_init (GoaIdentityService *self)
 {
-  GoaIdentityServicePrivate *priv;
-
-  priv = goa_identity_service_get_instance_private (self);
-
   g_debug ("GoaIdentityService: initializing");
-  priv->watched_client_connections = g_hash_table_new_full (g_str_hash,
+  self->watched_client_connections = g_hash_table_new_full (g_str_hash,
                                                             g_str_equal,
                                                             g_free,
                                                             (GDestroyNotify)
                                                             g_bus_unwatch_name);
 
-  priv->key_holders = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
-  priv->pending_temporary_account_results = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, 
g_object_unref);
+  self->key_holders = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+  self->pending_temporary_account_results = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, 
g_object_unref);
 }
 
 static void
 goa_identity_service_finalize (GObject *object)
 {
   GoaIdentityService *self;
-  GoaIdentityServicePrivate *priv;
 
   g_return_if_fail (object != NULL);
   g_return_if_fail (GOA_IS_IDENTITY_SERVICE (object));
@@ -688,15 +669,14 @@ goa_identity_service_finalize (GObject *object)
   g_debug ("GoaIdentityService: finalizing");
 
   self = GOA_IDENTITY_SERVICE (object);
-  priv = goa_identity_service_get_instance_private (self);
 
   goa_identity_service_deactivate (self);
 
-  g_clear_object (&priv->identity_manager);
-  g_clear_object (&priv->object_manager_server);
-  g_clear_pointer (&priv->watched_client_connections, g_hash_table_unref);
-  g_clear_pointer (&priv->key_holders, g_hash_table_unref);
-  g_clear_pointer (&priv->pending_temporary_account_results, g_hash_table_unref);
+  g_clear_object (&self->identity_manager);
+  g_clear_object (&self->object_manager_server);
+  g_clear_pointer (&self->watched_client_connections, g_hash_table_unref);
+  g_clear_pointer (&self->key_holders, g_hash_table_unref);
+  g_clear_pointer (&self->pending_temporary_account_results, g_hash_table_unref);
 
   G_OBJECT_CLASS (goa_identity_service_parent_class)->finalize (object);
 }
@@ -727,12 +707,9 @@ on_identity_needs_renewal (GoaIdentityManager *identity_manager,
                            GoaIdentity        *identity,
                            GoaIdentityService *self)
 {
-  GoaIdentityServicePrivate *priv;
   const char *principal;
   GoaObject  *object = NULL;
 
-  priv = goa_identity_service_get_instance_private (self);
-
   principal = goa_identity_get_identifier (identity);
 
   object = find_object_with_principal (self, principal, TRUE);
@@ -745,7 +722,7 @@ on_identity_needs_renewal (GoaIdentityManager *identity_manager,
 
   g_debug ("GoaIdentityService: identity %s needs renewal", principal);
 
-  goa_identity_manager_renew_identity (GOA_IDENTITY_MANAGER (priv->identity_manager),
+  goa_identity_manager_renew_identity (GOA_IDENTITY_MANAGER (self->identity_manager),
                                        identity,
                                        NULL,
                                        (GAsyncReadyCallback)
@@ -788,7 +765,6 @@ static void
 add_temporary_account_as_fedora_add_account (GObject *source_object, GAsyncResult *res, gpointer user_data)
 {
   GoaIdentityService *self;
-  GoaIdentityServicePrivate *priv;
   GDBusObjectManager *object_manager;
   GError *error;
   GTask *task = G_TASK (user_data);
@@ -797,7 +773,6 @@ add_temporary_account_as_fedora_add_account (GObject *source_object, GAsyncResul
   gchar *object_path = NULL;
 
   self = GOA_IDENTITY_SERVICE (g_task_get_source_object (task));
-  priv = goa_identity_service_get_instance_private (self);
 
   error = NULL;
   if (!goa_manager_call_add_account_finish (manager, &object_path, res, &error))
@@ -808,7 +783,7 @@ add_temporary_account_as_fedora_add_account (GObject *source_object, GAsyncResul
 
   g_debug ("Created account for identity with object path %s", object_path);
 
-  object_manager = goa_client_get_object_manager (priv->client);
+  object_manager = goa_client_get_object_manager (self->client);
   object = GOA_OBJECT (g_dbus_object_manager_get_object (object_manager, object_path));
   if (object == NULL)
     {
@@ -835,7 +810,6 @@ add_temporary_account_as_fedora (GoaIdentityService *self,
                                  GAsyncReadyCallback callback,
                                  gpointer user_data)
 {
-  GoaIdentityServicePrivate *priv;
   GTask *task = NULL;
   GVariantBuilder credentials;
   GVariantBuilder details;
@@ -843,8 +817,6 @@ add_temporary_account_as_fedora (GoaIdentityService *self,
   const gchar *principal;
   gchar *preauth_source = NULL;
 
-  priv = goa_identity_service_get_instance_private (self);
-
   task = g_task_new (self, cancellable, callback, user_data);
   g_task_set_source_tag (task, add_temporary_account_as_fedora);
   g_task_set_task_data (task, g_object_ref (identity), g_object_unref);
@@ -862,7 +834,7 @@ add_temporary_account_as_fedora (GoaIdentityService *self,
 
   g_variant_builder_add (&details, "{ss}", "TicketingEnabled", "true");
 
-  manager = goa_client_get_manager (priv->client);
+  manager = goa_client_get_manager (self->client);
   goa_manager_call_add_account (manager,
                                 GOA_FEDORA_NAME,
                                 principal,
@@ -897,7 +869,6 @@ static void
 add_temporary_account_as_kerberos_add_account (GObject *source_object, GAsyncResult *res, gpointer user_data)
 {
   GoaIdentityService *self;
-  GoaIdentityServicePrivate *priv;
   GDBusObjectManager *object_manager;
   GError *error;
   GTask *task = G_TASK (user_data);
@@ -906,7 +877,6 @@ add_temporary_account_as_kerberos_add_account (GObject *source_object, GAsyncRes
   gchar *object_path = NULL;
 
   self = GOA_IDENTITY_SERVICE (g_task_get_source_object (task));
-  priv = goa_identity_service_get_instance_private (self);
 
   error = NULL;
   if (!goa_manager_call_add_account_finish (manager, &object_path, res, &error))
@@ -917,7 +887,7 @@ add_temporary_account_as_kerberos_add_account (GObject *source_object, GAsyncRes
 
   g_debug ("Created account for identity with object path %s", object_path);
 
-  object_manager = goa_client_get_object_manager (priv->client);
+  object_manager = goa_client_get_object_manager (self->client);
   object = GOA_OBJECT (g_dbus_object_manager_get_object (object_manager, object_path));
   if (object == NULL)
     {
@@ -944,7 +914,6 @@ add_temporary_account_as_kerberos (GoaIdentityService *self,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data)
 {
-  GoaIdentityServicePrivate *priv;
   GTask *task = NULL;
   GVariantBuilder credentials;
   GVariantBuilder details;
@@ -953,8 +922,6 @@ add_temporary_account_as_kerberos (GoaIdentityService *self,
   gchar *preauth_source = NULL;
   gchar *realm = NULL;
 
-  priv = goa_identity_service_get_instance_private (self);
-
   task = g_task_new (self, cancellable, callback, user_data);
   g_task_set_source_tag (task, add_temporary_account_as_kerberos);
   g_task_set_task_data (task, g_object_ref (identity), g_object_unref);
@@ -974,7 +941,7 @@ add_temporary_account_as_kerberos (GoaIdentityService *self,
 
   g_variant_builder_add (&details, "{ss}", "TicketingEnabled", "true");
 
-  manager = goa_client_get_manager (priv->client);
+  manager = goa_client_get_manager (self->client);
   goa_manager_call_add_account (manager,
                                 GOA_KERBEROS_NAME,
                                 principal,
@@ -1010,7 +977,6 @@ static void
 on_temporary_account_added_as_kerberos (GObject *source_object, GAsyncResult *result, gpointer user_data)
 {
   GoaIdentityService *self = GOA_IDENTITY_SERVICE (source_object);
-  GoaIdentityServicePrivate *priv;
   GoaIdentity *identity = GOA_IDENTITY (user_data);
   const char *principal;
 
@@ -1019,10 +985,8 @@ on_temporary_account_added_as_kerberos (GObject *source_object, GAsyncResult *re
 
   error = NULL;
 
-  priv = goa_identity_service_get_instance_private (self);
-
   principal = goa_identity_get_identifier (identity);
-  g_hash_table_remove (priv->pending_temporary_account_results, principal);
+  g_hash_table_remove (self->pending_temporary_account_results, principal);
 
   object = add_temporary_account_as_kerberos_finish (self, result, &error);
   if (error != NULL)
@@ -1046,14 +1010,11 @@ static void
 on_temporary_account_added_as_fedora (GObject *source_object, GAsyncResult *result, gpointer user_data)
 {
   GoaIdentityService *self = GOA_IDENTITY_SERVICE (source_object);
-  GoaIdentityServicePrivate *priv;
   GError *error;
   GoaIdentity *identity = GOA_IDENTITY (user_data);
   GoaObject *object = NULL;
   const gchar *principal;
 
-  priv = goa_identity_service_get_instance_private (self);
-
   error = NULL;
   object = add_temporary_account_as_fedora_finish (self, result, &error);
   if (error != NULL)
@@ -1074,7 +1035,7 @@ on_temporary_account_added_as_fedora (GObject *source_object, GAsyncResult *resu
     }
 
   principal = goa_identity_get_identifier (identity);
-  g_hash_table_remove (priv->pending_temporary_account_results, principal);
+  g_hash_table_remove (self->pending_temporary_account_results, principal);
 
   ensure_account_credentials (self, object);
 
@@ -1087,14 +1048,11 @@ static void
 add_temporary_account (GoaIdentityService *self,
                        GoaIdentity        *identity)
 {
-  GoaIdentityServicePrivate *priv;
   const char *principal;
   gchar *realm = NULL;
 
-  priv = goa_identity_service_get_instance_private (self);
-
   principal = goa_identity_get_identifier (identity);
-  if (g_hash_table_contains (priv->pending_temporary_account_results, principal))
+  if (g_hash_table_contains (self->pending_temporary_account_results, principal))
     {
       g_debug ("GoaIdentityService: would add temporary identity %s, but it's already pending", principal);
       return;
@@ -1107,7 +1065,7 @@ add_temporary_account (GoaIdentityService *self,
 
   g_debug ("GoaIdentityService: asking to sign back in");
 
-  g_hash_table_insert (priv->pending_temporary_account_results, g_strdup (principal), g_object_ref 
(identity));
+  g_hash_table_insert (self->pending_temporary_account_results, g_strdup (principal), g_object_ref 
(identity));
 
   realm = goa_kerberos_identity_get_realm_name (GOA_KERBEROS_IDENTITY (identity));
   if (g_strcmp0 (realm, GOA_FEDORA_REALM) == 0)
@@ -1263,7 +1221,6 @@ on_password_system_prompt_answered (GcrPrompt           *prompt,
                                     SystemPromptRequest *request)
 {
   GoaIdentityService *self = request->service;
-  GoaIdentityServicePrivate *priv;
   GoaIdentityInquiry *inquiry = request->inquiry;
   GoaIdentity *identity = request->identity;
   GoaIdentityQuery *query = request->query;
@@ -1271,8 +1228,6 @@ on_password_system_prompt_answered (GcrPrompt           *prompt,
   GError *error;
   const char *password;
 
-  priv = goa_identity_service_get_instance_private (self);
-
   error = NULL;
   password = gcr_prompt_password_finish (prompt, result, &error);
 
@@ -1294,7 +1249,7 @@ on_password_system_prompt_answered (GcrPrompt           *prompt,
       goa_identity_inquiry_answer_query (inquiry, query, password);
     }
 
-  close_system_prompt (priv->identity_manager, identity, request);
+  close_system_prompt (self->identity_manager, identity, request);
   system_prompt_request_free (request);
 }
 
@@ -1306,7 +1261,6 @@ query_user (GoaIdentityService *self,
             GcrPrompt          *prompt,
             GCancellable       *cancellable)
 {
-  GoaIdentityServicePrivate *priv;
   SystemPromptRequest *request;
   char *prompt_text;
   GoaIdentityQueryMode query_mode;
@@ -1315,11 +1269,9 @@ query_user (GoaIdentityService *self,
 
   g_assert (GOA_IS_KERBEROS_IDENTITY (identity));
 
-  priv = goa_identity_service_get_instance_private (self);
-
   gcr_prompt_set_title (prompt, _("Log In to Realm"));
 
-  name = goa_identity_manager_name_identity (priv->identity_manager, identity);
+  name = goa_identity_manager_name_identity (self->identity_manager, identity);
 
   description =
     g_strdup_printf (_("The network realm %s needs some information to sign you in."),
@@ -1340,7 +1292,7 @@ query_user (GoaIdentityService *self,
                                        query,
                                        cancellable);
 
-  g_signal_connect (priv->identity_manager, "identity-refreshed", G_CALLBACK (close_system_prompt), request);
+  g_signal_connect (self->identity_manager, "identity-refreshed", G_CALLBACK (close_system_prompt), request);
 
   query_mode = goa_identity_query_get_mode (inquiry, query);
 
@@ -1479,19 +1431,16 @@ sign_in (GoaIdentityService     *self,
          GAsyncReadyCallback     callback,
          gpointer                user_data)
 {
-  GoaIdentityServicePrivate *priv;
   GTask *operation_result;
 
-  priv = goa_identity_service_get_instance_private (self);
-
   g_debug ("GoaIdentityService: asking to sign in");
 
   operation_result = g_task_new (self, cancellable, callback, user_data);
   g_task_set_task_data (operation_result, user_data, NULL);
 
-  g_signal_connect_object (priv->identity_manager, "identity-refreshed", G_CALLBACK (cancel_sign_in), 
operation_result, 0);
+  g_signal_connect_object (self->identity_manager, "identity-refreshed", G_CALLBACK (cancel_sign_in), 
operation_result, 0);
 
-  goa_identity_manager_sign_identity_in (priv->identity_manager,
+  goa_identity_manager_sign_identity_in (self->identity_manager,
                                          identifier,
                                          initial_password,
                                          preauth_source,
@@ -1669,7 +1618,6 @@ on_account_interface_removed (GDBusObjectManager *manager,
                               GDBusInterface     *interface,
                               GoaIdentityService *self)
 {
-  GoaIdentityServicePrivate *priv;
   GoaAccount         *account;
   GoaTicketing       *ticketing;
   GDBusInterfaceInfo *info;
@@ -1677,8 +1625,6 @@ on_account_interface_removed (GDBusObjectManager *manager,
   const char         *account_identity;
   GTask              *task;
 
-  priv = goa_identity_service_get_instance_private (self);
-
   account = goa_object_peek_account (object);
 
   if (account == NULL)
@@ -1710,7 +1656,7 @@ on_account_interface_removed (GDBusObjectManager *manager,
   g_debug ("Kerberos account %s was disabled and should now be signed out", account_identity);
 
   task = g_task_new (self, NULL, (GAsyncReadyCallback) on_sign_out_for_account_change_done, NULL);
-  goa_identity_manager_get_identity (priv->identity_manager,
+  goa_identity_manager_get_identity (self->identity_manager,
                                      account_identity,
                                      NULL,
                                      (GAsyncReadyCallback)
@@ -1725,18 +1671,15 @@ on_identities_listed (GoaIdentityManager *manager,
                       GAsyncResult       *result,
                       GoaIdentityService *self)
 {
-  GoaIdentityServicePrivate *priv;
   GError *error = NULL;
   GList *identities, *node;
 
-  priv = goa_identity_service_get_instance_private (self);
-
-  g_signal_connect (priv->identity_manager, "identity-added", G_CALLBACK (on_identity_added), self);
-  g_signal_connect (priv->identity_manager, "identity-removed", G_CALLBACK (on_identity_removed), self);
-  g_signal_connect (priv->identity_manager, "identity-refreshed", G_CALLBACK (on_identity_refreshed), self);
-  g_signal_connect (priv->identity_manager, "identity-needs-renewal", G_CALLBACK 
(on_identity_needs_renewal), self);
-  g_signal_connect (priv->identity_manager, "identity-expiring", G_CALLBACK (on_identity_expiring), self);
-  g_signal_connect (priv->identity_manager, "identity-expired", G_CALLBACK (on_identity_expired), self);
+  g_signal_connect (self->identity_manager, "identity-added", G_CALLBACK (on_identity_added), self);
+  g_signal_connect (self->identity_manager, "identity-removed", G_CALLBACK (on_identity_removed), self);
+  g_signal_connect (self->identity_manager, "identity-refreshed", G_CALLBACK (on_identity_refreshed), self);
+  g_signal_connect (self->identity_manager, "identity-needs-renewal", G_CALLBACK 
(on_identity_needs_renewal), self);
+  g_signal_connect (self->identity_manager, "identity-expiring", G_CALLBACK (on_identity_expiring), self);
+  g_signal_connect (self->identity_manager, "identity-expired", G_CALLBACK (on_identity_expired), self);
 
   identities = goa_identity_manager_list_identities_finish (manager, result, &error);
 
@@ -1778,19 +1721,16 @@ on_identities_listed (GoaIdentityManager *manager,
 static void
 ensure_credentials_for_accounts (GoaIdentityService *self)
 {
-  GoaIdentityServicePrivate *priv;
   GDBusObjectManager *object_manager;
   GList      *accounts;
   GList      *node;
 
-  priv = goa_identity_service_get_instance_private (self);
-
-  object_manager = goa_client_get_object_manager (priv->client);
+  object_manager = goa_client_get_object_manager (self->client);
 
   g_signal_connect (object_manager, "interface-added", G_CALLBACK (on_account_interface_added), self);
   g_signal_connect (object_manager, "interface-removed", G_CALLBACK (on_account_interface_removed), self);
 
-  accounts = goa_client_get_accounts (priv->client);
+  accounts = goa_client_get_accounts (self->client);
 
   for (node = accounts; node != NULL; node = node->next)
     {
@@ -1825,30 +1765,27 @@ on_got_client (GoaClient          *client,
                GAsyncResult       *result,
                GoaIdentityService *self)
 {
-  GoaIdentityServicePrivate *priv;
   GError *error;
 
   error = NULL;
 
-  priv = goa_identity_service_get_instance_private (self);
-
-  priv->client = goa_client_new_finish (result, &error);
+  self->client = goa_client_new_finish (result, &error);
 
-  if (priv->client == NULL)
+  if (self->client == NULL)
     {
       g_warning ("Could not create client: %s", error->message);
       goto out;
     }
 
-  priv->identity_manager = goa_kerberos_identity_manager_new (NULL, &error);
+  self->identity_manager = goa_kerberos_identity_manager_new (NULL, &error);
 
-  if (priv->identity_manager == NULL)
+  if (self->identity_manager == NULL)
     {
       g_warning ("Could not create identity manager: %s", error->message);
       goto out;
     }
 
-  goa_identity_manager_list_identities (priv->identity_manager,
+  goa_identity_manager_list_identities (self->identity_manager,
                                         NULL,
                                         (GAsyncReadyCallback)
                                         on_identities_listed,
@@ -1865,16 +1802,12 @@ on_session_bus_acquired (GDBusConnection    *connection,
                          const char         *unique_name,
                          GoaIdentityService *self)
 {
-  GoaIdentityServicePrivate *priv;
-
-  priv = goa_identity_service_get_instance_private (self);
-
   g_debug ("GoaIdentityService: Connected to session bus");
 
-  if (priv->connection == NULL)
+  if (self->connection == NULL)
   {
-    priv->connection = g_object_ref (connection);
-    g_dbus_object_manager_server_set_connection (priv->object_manager_server, priv->connection);
+    self->connection = g_object_ref (connection);
+    g_dbus_object_manager_server_set_connection (self->object_manager_server, self->connection);
     goa_client_new (NULL,
                     (GAsyncReadyCallback)
                     on_got_client,
@@ -1904,25 +1837,22 @@ gboolean
 goa_identity_service_activate (GoaIdentityService   *self,
                                GError              **error)
 {
-  GoaIdentityServicePrivate *priv;
   GoaIdentityServiceObjectSkeleton *object;
 
   g_return_val_if_fail (GOA_IS_IDENTITY_SERVICE (self), FALSE);
 
-  priv = goa_identity_service_get_instance_private (self);
-
   g_debug ("GoaIdentityService: Activating identity service");
 
-  priv->object_manager_server = g_dbus_object_manager_server_new ("/org/gnome/Identity");
+  self->object_manager_server = g_dbus_object_manager_server_new ("/org/gnome/Identity");
 
   object = goa_identity_service_object_skeleton_new ("/org/gnome/Identity/Manager");
   goa_identity_service_object_skeleton_set_manager (object,
                                                     GOA_IDENTITY_SERVICE_MANAGER (self));
 
-  g_dbus_object_manager_server_export (priv->object_manager_server, G_DBUS_OBJECT_SKELETON (object));
+  g_dbus_object_manager_server_export (self->object_manager_server, G_DBUS_OBJECT_SKELETON (object));
   g_object_unref (object);
 
-  priv->bus_id = g_bus_own_name (G_BUS_TYPE_SESSION,
+  self->bus_id = g_bus_own_name (G_BUS_TYPE_SESSION,
                                  "org.gnome.Identity",
                                  G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
                                  G_BUS_NAME_OWNER_FLAGS_REPLACE,
@@ -1938,23 +1868,19 @@ goa_identity_service_activate (GoaIdentityService   *self,
 void
 goa_identity_service_deactivate (GoaIdentityService *self)
 {
-  GoaIdentityServicePrivate *priv;
-
-  priv = goa_identity_service_get_instance_private (self);
-
   g_debug ("GoaIdentityService: Deactivating identity service");
 
-  if (priv->identity_manager != NULL)
+  if (self->identity_manager != NULL)
     {
       g_signal_handlers_disconnect_by_func (self, on_identity_needs_renewal, self);
       g_signal_handlers_disconnect_by_func (self, on_identity_expiring, self);
       g_signal_handlers_disconnect_by_func (self, on_identity_expired, self);
-      g_clear_object (&priv->identity_manager);
+      g_clear_object (&self->identity_manager);
     }
 
-  g_clear_object (&priv->object_manager_server);
-  g_clear_object (&priv->connection);
-  g_clear_object (&priv->client);
+  g_clear_object (&self->object_manager_server);
+  g_clear_object (&self->connection);
+  g_clear_object (&self->client);
 }
 
 static void
diff --git a/src/goaidentity/goaidentityservice.h b/src/goaidentity/goaidentityservice.h
index d3148891..1974f928 100644
--- a/src/goaidentity/goaidentityservice.h
+++ b/src/goaidentity/goaidentityservice.h
@@ -23,28 +23,12 @@
 #include <glib-object.h>
 #include <gio/gio.h>
 
-#include "org.gnome.Identity.h"
-
 G_BEGIN_DECLS
 #define GOA_TYPE_IDENTITY_SERVICE           (goa_identity_service_get_type ())
 #define GOA_IDENTITY_SERVICE(obj)           (G_TYPE_CHECK_INSTANCE_CAST (obj, GOA_TYPE_IDENTITY_SERVICE, 
GoaIdentityService))
-#define GOA_IDENTITY_SERVICE_CLASS(cls)     (G_TYPE_CHECK_CLASS_CAST (cls, GOA_TYPE_IDENTITY_SERVICE, 
GoaIdentityServiceClass))
 #define GOA_IS_IDENTITY_SERVICE(obj)        (G_TYPE_CHECK_INSTANCE_TYPE (obj, GOA_TYPE_IDENTITY_SERVICE))
-#define GOA_IS_IDENTITY_SERVICE_CLASS(obj)  (G_TYPE_CHECK_CLASS_TYPE (obj, GOA_TYPE_IDENTITY_SERVICE))
-#define GOA_IDENTITY_SERVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GOA_TYPE_IDENTITY_SERVICE, 
GoaIdentityServiceClass))
 typedef struct _GoaIdentityService GoaIdentityService;
 typedef struct _GoaIdentityServiceClass GoaIdentityServiceClass;
-typedef struct _GoaIdentityServicePrivate GoaIdentityServicePrivate;
-
-struct _GoaIdentityService
-{
-  GoaIdentityServiceManagerSkeleton  parent_instance;
-};
-
-struct _GoaIdentityServiceClass
-{
-  GoaIdentityServiceManagerSkeletonClass  parent_class;
-};
 
 GType goa_identity_service_get_type (void);
 GoaIdentityService *goa_identity_service_new (void);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]