]> git.0d.be Git - empathy.git/commitdiff
goa-mc-plugin: support enabling or disabling accounts
authorDebarshi Ray <debarshir@src.gnome.org>
Sat, 31 Mar 2012 21:37:53 +0000 (23:37 +0200)
committerDebarshi Ray <debarshir@src.gnome.org>
Mon, 7 May 2012 13:20:46 +0000 (15:20 +0200)
Bumped the required version of GOA to 3.5.0.

Fixes: https://bugzilla.gnome.org/673263
configure.ac
goa-mc-plugin/mcp-account-manager-goa.c

index 1739b6a43ba63570ce0589ad67ae18f457bce5eb..1cce7ab16a3b19800cd3b4c1a513e5d80536ae35 100644 (file)
@@ -61,7 +61,7 @@ TELEPATHY_FARSTREAM_REQUIRED=0.2.1
 TELEPATHY_GLIB_REQUIRED=0.17.6
 TELEPATHY_LOGGER=0.2.13
 WEBKIT_REQUIRED=1.3.13
-GOA_REQUIRED=3.3.0
+GOA_REQUIRED=3.5.1
 
 # Optional deps
 ENCHANT_REQUIRED=1.2.0
index 911b2d6ca162574788800a17ed6f84354d9b76d7..377155baa9ade1b61fe181f4ae840c29c2679ed2 100644 (file)
@@ -355,10 +355,10 @@ static void
 get_enabled (const McpAccountStorage *self,
     const McpAccountManager *am,
     const gchar *acc,
-    GoaObject *object)
+    GoaAccount *account)
 {
   mcp_account_manager_set_value (am, acc, "Enabled",
-      goa_object_peek_chat (object) != NULL ? "true" : "false");
+      goa_account_get_chat_disabled (account) == FALSE ? "true" : "false");
 }
 
 
@@ -418,11 +418,11 @@ mcp_account_manager_goa_get (const McpAccountStorage *self,
       g_strfreev (keys);
 
       /* Enabled */
-      get_enabled (self, am, acc, object);
+      get_enabled (self, am, acc, account);
     }
   else if (!tp_strdiff (key, "Enabled"))
     {
-      get_enabled (self, am, acc, object);
+      get_enabled (self, am, acc, account);
     }
   else
     {
@@ -467,18 +467,33 @@ mcp_account_manager_goa_set (const McpAccountStorage *self,
   if (!account_is_in_goa (self, account))
     return FALSE;
 
-  /* No need to save Enabled, it's up to the GOA configuration if the account
-   * is configured or not. */
+  DEBUG ("%s: (%s, %s, %s)", G_STRFUNC, account, key, val);
+
   if (!tp_strdiff (key, "Enabled"))
-    return TRUE;
+    {
+      GoaObject *object;
+      GoaAccount *acc;
 
-  DEBUG ("%s: (%s, %s, %s)", G_STRFUNC, account, key, val);
+      object = g_hash_table_lookup (priv->accounts, account);
+
+      if (object == NULL)
+        return FALSE;
+
+      acc = goa_object_peek_account (object);
+
+      if (acc == NULL)
+        return FALSE;
+
+      goa_account_set_chat_disabled (acc, tp_strdiff (val, "true"));
+      goto out;
+    }
 
   if (val != NULL)
     g_key_file_set_value (priv->store, account, key, val);
   else
     g_key_file_remove_key (priv->store, account, key, NULL);
 
+ out:
   /* Pretend we save everything so MC won't save this in accounts.cfg */
   return TRUE;
 }
@@ -561,8 +576,7 @@ mcp_account_manager_goa_get_restrictions (const McpAccountStorage *self,
     const gchar *account)
 {
   return TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_PARAMETERS |
-         TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_SERVICE |
-         TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_ENABLED;
+         TP_STORAGE_RESTRICTION_FLAG_CANNOT_SET_SERVICE;
 }