diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-09-06 16:43:19 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-09-06 17:00:00 +0100 |
commit | 3ae49c706e93d06131cabf5b4a0421869948ec62 (patch) | |
tree | 3b3db2b4917881a83c2aaa696baf4d7550b3d0bf | |
parent | 1ce1e32bc7f83b5dfc3b75407e896c7bd7e6cbdb (diff) | |
download | telepathy-mission-control-3ae49c706e93d06131cabf5b4a0421869948ec62.tar.gz |
Migrate from Butterfly to Haze even if Butterfly is no longer installed
Mission Control has a bug/design flaw/whatever in which it doesn't
know the types of parameters without looking at the corresponding
connection manager, which doesn't work if that connection manager has
been uninstalled. This turns out to be bad for the upgrade from
Debian 6 to Debian 7, which upgrades MC to a version that will
perform the migration from Butterfly to Haze, but also uninstalls
Butterfly...
Since we know what the type of 'account' is, with a bit of refactoring
we can tell McdAccount that we know it's a string, get its value
anyway, and get on with our lives.
Bug-Debian: http://bugs.debian.org/686835
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Xavier Claessens <xavier.claessens@collabora.co.uk>
-rw-r--r-- | src/mcd-account-manager.c | 4 | ||||
-rw-r--r-- | src/mcd-account.c | 18 | ||||
-rw-r--r-- | src/mcd-account.h | 6 |
3 files changed, 24 insertions, 4 deletions
diff --git a/src/mcd-account-manager.c b/src/mcd-account-manager.c index 4d93220b..a13ba032 100644 --- a/src/mcd-account-manager.c +++ b/src/mcd-account-manager.c @@ -1222,7 +1222,9 @@ migrate_butterfly_haze_ready (McdManager *manager, } /* Parameters; we just care about 'account' */ - if (!mcd_account_get_parameter (ctx->account, "account", &v, NULL)) + if (!mcd_account_get_parameter_of_known_type (ctx->account, + "account", G_TYPE_STRING, + &v, NULL)) { _mcd_account_set_enabled (ctx->account, FALSE, TRUE, NULL); goto error; diff --git a/src/mcd-account.c b/src/mcd-account.c index 192d8d95..1864e7db 100644 --- a/src/mcd-account.c +++ b/src/mcd-account.c @@ -429,16 +429,28 @@ mcd_account_get_parameter (McdAccount *account, const gchar *name, GError **error) { McdAccountPrivate *priv = account->priv; - McdStorage *storage = priv->storage; - gchar key[MAX_KEY_LENGTH]; const TpConnectionManagerParam *param; GType type; - const gchar *account_name = mcd_account_get_unique_name (account); param = mcd_manager_get_protocol_param (priv->manager, priv->protocol_name, name); type = mc_param_type (param); + return mcd_account_get_parameter_of_known_type (account, name, + type, parameter, error); +} + +gboolean +mcd_account_get_parameter_of_known_type (McdAccount *account, + const gchar *name, + GType type, + GValue *parameter, + GError **error) +{ + const gchar *account_name = mcd_account_get_unique_name (account); + McdStorage *storage = account->priv->storage; + gchar key[MAX_KEY_LENGTH]; + g_snprintf (key, sizeof (key), "param-%s", name); if (mcd_storage_has_value (storage, account_name, key)) diff --git a/src/mcd-account.h b/src/mcd-account.h index 6b0dd605..90e429af 100644 --- a/src/mcd-account.h +++ b/src/mcd-account.h @@ -148,6 +148,12 @@ gboolean mcd_account_get_parameter (McdAccount *account, const gchar *name, GValue *parameter, GError **error); +gboolean mcd_account_get_parameter_of_known_type (McdAccount *account, + const gchar *name, + GType type, + GValue *parameter, + GError **error); + gchar * mcd_account_dup_icon (McdAccount *self); gchar * mcd_account_dup_nickname (McdAccount *self); |