telepathy-mission-control: Migrate from Butterfly to Haze even if Butterfly is no longer installed
Simon McVittie
smcv at kemper.freedesktop.org
Thu Sep 6 10:18:05 PDT 2012
Module: telepathy-mission-control
Branch: master
Commit: 3ae49c706e93d06131cabf5b4a0421869948ec62
URL: http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=3ae49c706e93d06131cabf5b4a0421869948ec62
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Thu Sep 6 16:43:19 2012 +0100
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 at collabora.co.uk>
Reviewed-by: Xavier Claessens <xavier.claessens at collabora.co.uk>
---
src/mcd-account-manager.c | 4 +++-
src/mcd-account.c | 18 +++++++++++++++---
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 4d93220..a13ba03 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 192d8d9..1864e7d 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 6b0dd60..90e429a 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);
More information about the telepathy-commits
mailing list