diff options
author | Debarshi Ray <debarshir@src.gnome.org> | 2012-04-01 05:37:53 +0800 |
---|---|---|
committer | Debarshi Ray <debarshir@src.gnome.org> | 2012-05-07 21:20:46 +0800 |
commit | 9bc69fec76fb62000791b0b383ba15b508a7d7b6 (patch) | |
tree | c142c53df9981e13023441bd6025e923c8704c37 /goa-mc-plugin | |
parent | d0193ecc58b6eab69b4c4d3c9667c50bfc033b49 (diff) | |
download | gsoc2013-empathy-9bc69fec76fb62000791b0b383ba15b508a7d7b6.tar gsoc2013-empathy-9bc69fec76fb62000791b0b383ba15b508a7d7b6.tar.gz gsoc2013-empathy-9bc69fec76fb62000791b0b383ba15b508a7d7b6.tar.bz2 gsoc2013-empathy-9bc69fec76fb62000791b0b383ba15b508a7d7b6.tar.lz gsoc2013-empathy-9bc69fec76fb62000791b0b383ba15b508a7d7b6.tar.xz gsoc2013-empathy-9bc69fec76fb62000791b0b383ba15b508a7d7b6.tar.zst gsoc2013-empathy-9bc69fec76fb62000791b0b383ba15b508a7d7b6.zip |
goa-mc-plugin: support enabling or disabling accounts
Bumped the required version of GOA to 3.5.0.
Fixes: https://bugzilla.gnome.org/673263
Diffstat (limited to 'goa-mc-plugin')
-rw-r--r-- | goa-mc-plugin/mcp-account-manager-goa.c | 34 |
1 files changed, 24 insertions, 10 deletions
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; } |