[empathy/next] Modify McpAccountStorage implementations for GVariant-based dup_identifier



commit fcee8c3df9c46f48be0a7d63225d855659e6d49c
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Mon Apr 7 17:21:10 2014 +0100

    Modify McpAccountStorage implementations for GVariant-based dup_identifier

 goa-mc-plugin/mcp-account-manager-goa.c            |   17 ++++++++---------
 .../mc-plugin/mcp-account-manager-uoa.c            |   12 +++++-------
 2 files changed, 13 insertions(+), 16 deletions(-)
---
diff --git a/goa-mc-plugin/mcp-account-manager-goa.c b/goa-mc-plugin/mcp-account-manager-goa.c
index af17958..42504c7 100644
--- a/goa-mc-plugin/mcp-account-manager-goa.c
+++ b/goa-mc-plugin/mcp-account-manager-goa.c
@@ -702,23 +702,22 @@ mcp_account_manager_goa_get_restrictions (McpAccountStorage *self,
 }
 
 
-static void
-mcp_account_manager_goa_get_identifier (McpAccountStorage *self,
-    const gchar *acc,
-    GValue *identifier)
+static GVariant *
+mcp_account_manager_goa_dup_identifier (McpAccountStorage *self,
+    const gchar *acc)
 {
   McpAccountManagerGoaPrivate *priv = GET_PRIVATE (self);
   GoaObject *object;
   GoaAccount *account;
 
   object = g_hash_table_lookup (priv->accounts, acc);
-  g_return_if_fail (object != NULL);
+  g_return_val_if_fail (object != NULL, NULL);
 
   account = goa_object_peek_account (object);
-  g_return_if_fail (account != NULL);
+  g_return_val_if_fail (account != NULL, NULL);
 
-  g_value_init (identifier, G_TYPE_STRING);
-  g_value_set_string (identifier, goa_account_get_id (account));
+  return g_variant_ref_sink (g_variant_new_string (
+        goa_account_get_id (account)));
 }
 
 
@@ -735,7 +734,7 @@ account_storage_iface_init (McpAccountStorageIface *iface)
   IMPLEMENT (list);
   IMPLEMENT (commit);
   IMPLEMENT (get_restrictions);
-  IMPLEMENT (get_identifier);
+  IMPLEMENT (dup_identifier);
   IMPLEMENT (delete_async);
   IMPLEMENT (delete_finish);
   IMPLEMENT (get_attribute);
diff --git a/ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c 
b/ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c
index 0607b9e..0d1dbf5 100644
--- a/ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c
+++ b/ubuntu-online-accounts/mc-plugin/mcp-account-manager-uoa.c
@@ -751,16 +751,15 @@ account_manager_uoa_ready (const McpAccountStorage *storage,
       G_CALLBACK (failure_removed_cb), self);
 }
 
-static void
-account_manager_uoa_get_identifier (const McpAccountStorage *storage,
-    const gchar *account_name,
-    GValue *identifier)
+static GVariant *
+account_manager_uoa_dup_identifier (const McpAccountStorage *storage,
+    const gchar *account_name)
 {
   McpAccountManagerUoa *self = (McpAccountManagerUoa *) storage;
   AgAccountService *service;
   AgAccount *account;
 
-  g_return_if_fail (self->priv->manager != NULL);
+  g_return_val_if_fail (self->priv->manager != NULL, NULL);
 
   service = g_hash_table_lookup (self->priv->accounts, account_name);
   if (service == NULL)
@@ -768,8 +767,7 @@ account_manager_uoa_get_identifier (const McpAccountStorage *storage,
 
   account = ag_account_service_get_account (service);
 
-  g_value_init (identifier, G_TYPE_UINT);
-  g_value_set_uint (identifier, account->id);
+  return g_variant_ref_sink (g_variant_new_uint32 (account->id));
 }
 
 static guint


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