summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDebarshi Ray <debarshir@src.gnome.org>2012-03-31 23:37:53 +0200
committerDebarshi Ray <debarshir@src.gnome.org>2012-05-07 15:20:46 +0200
commit9bc69fec76fb62000791b0b383ba15b508a7d7b6 (patch)
treec142c53df9981e13023441bd6025e923c8704c37
parentd0193ecc58b6eab69b4c4d3c9667c50bfc033b49 (diff)
downloadempathy-9bc69fec76fb62000791b0b383ba15b508a7d7b6.tar.gz
goa-mc-plugin: support enabling or disabling accounts
Bumped the required version of GOA to 3.5.0. Fixes: https://bugzilla.gnome.org/673263
-rw-r--r--configure.ac2
-rw-r--r--goa-mc-plugin/mcp-account-manager-goa.c34
2 files changed, 25 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index 1739b6a43..1cce7ab16 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/goa-mc-plugin/mcp-account-manager-goa.c b/goa-mc-plugin/mcp-account-manager-goa.c
index 911b2d6ca..377155baa 100644
--- a/goa-mc-plugin/mcp-account-manager-goa.c
+++ b/goa-mc-plugin/mcp-account-manager-goa.c
@@ -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;
}