From 2a7fa12bcf9c0ee5a9ff506bc88af2194990dabc Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 13 Jan 2012 14:56:41 +0100 Subject: account-settings: allow to change the service https://bugzilla.gnome.org/show_bug.cgi?id=667791 --- libempathy/empathy-account-settings.c | 44 +++++++++++++++++++++++++++++++++++ libempathy/empathy-account-settings.h | 3 +++ 2 files changed, 47 insertions(+) (limited to 'libempathy') diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c index 78d609685..cf269bdc8 100644 --- a/libempathy/empathy-account-settings.c +++ b/libempathy/empathy-account-settings.c @@ -103,6 +103,8 @@ struct _EmpathyAccountSettingsPriv /* If TRUE, the account should have 'tel' in its * Account.Interface.Addressing.URISchemes property. */ gboolean uri_scheme_tel; + /* If TRUE, Service property needs to be updated when applying changes */ + gboolean update_service; GSimpleAsyncResult *apply_result; }; @@ -743,6 +745,21 @@ empathy_account_settings_get_service (EmpathyAccountSettings *settings) return priv->service; } +void +empathy_account_settings_set_service (EmpathyAccountSettings *settings, + const gchar *service) +{ + EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + + if (!tp_strdiff (priv->service, service)) + return; + + g_free (priv->service); + priv->service = g_strdup (service); + g_object_notify (G_OBJECT (settings), "service"); + priv->update_service = TRUE; +} + gchar * empathy_account_settings_get_icon_name (EmpathyAccountSettings *settings) { @@ -1445,6 +1462,32 @@ update_account_uri_schemes (EmpathyAccountSettings *self) priv->uri_scheme_tel, NULL, NULL); } +static void +set_service_cb (GObject *source, + GAsyncResult *result, + gpointer user_data) +{ + GError *error = NULL; + + if (!tp_account_set_service_finish (TP_ACCOUNT (source), result, &error)) + { + DEBUG ("Failed to set Account.Service: %s", error->message); + g_error_free (error); + } +} + +static void +update_account_service (EmpathyAccountSettings *self) +{ + EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + + if (!priv->update_service) + return; + + tp_account_set_service_async (priv->account, + priv->service != NULL ? priv->service : "", set_service_cb, self); +} + static void empathy_account_settings_account_updated (GObject *source, GAsyncResult *result, @@ -1486,6 +1529,7 @@ empathy_account_settings_account_updated (GObject *source, } update_account_uri_schemes (settings); + update_account_service (settings); g_simple_async_result_set_op_res_gboolean (priv->apply_result, g_strv_length (reconnect_required) > 0); diff --git a/libempathy/empathy-account-settings.h b/libempathy/empathy-account-settings.h index ea0c5b048..10ed3684f 100644 --- a/libempathy/empathy-account-settings.h +++ b/libempathy/empathy-account-settings.h @@ -78,6 +78,9 @@ const gchar *empathy_account_settings_get_protocol ( const gchar *empathy_account_settings_get_service ( EmpathyAccountSettings *settings); +void empathy_account_settings_set_service (EmpathyAccountSettings *settings, + const gchar *service); + TpAccount *empathy_account_settings_get_account ( EmpathyAccountSettings *settings); -- cgit v1.2.3 From d59b7870dbd7afd1e63f94d953a35306d7b9909c Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 16 Jan 2012 14:32:55 +0100 Subject: coding style fix --- libempathy/empathy-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libempathy') diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index 55e23380c..cf64bc77d 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -393,7 +393,7 @@ empathy_account_get_error_message (TpAccount *account, { const gchar *dbus_error; const gchar *message; - const GHashTable *details = NULL; + const GHashTable *details = NULL; TpConnectionStatusReason reason; dbus_error = tp_account_get_detailed_error (account, &details); -- cgit v1.2.3 From b0919fe6aab968756a0a7feb072fc49764862709 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 16 Jan 2012 14:34:55 +0100 Subject: empathy_account_get_error_message: get the reason before displaying it --- libempathy/empathy-utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index cf64bc77d..4b5738b7a 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -410,11 +410,11 @@ empathy_account_get_error_message (TpAccount *account, if (message != NULL) return message; + tp_account_get_connection_status (account, &reason); + DEBUG ("Don't understand error '%s'; fallback to the status reason (%u)", dbus_error, reason); - tp_account_get_connection_status (account, &reason); - return empathy_status_reason_get_default_message (reason); } -- cgit v1.2.3 From 40aba36f8560ebbeae32c29f472576f80adec1e9 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Mon, 16 Jan 2012 15:38:37 +0100 Subject: don't free content of the list returned by empathy_connection_aggregator_get_all_groups() https://bugzilla.gnome.org/show_bug.cgi?id=667037 --- libempathy/empathy-connection-aggregator.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libempathy') diff --git a/libempathy/empathy-connection-aggregator.c b/libempathy/empathy-connection-aggregator.c index 22d5ab8b2..fde365c27 100644 --- a/libempathy/empathy-connection-aggregator.c +++ b/libempathy/empathy-connection-aggregator.c @@ -231,6 +231,7 @@ empathy_connection_aggregator_dup_singleton (void) return aggregator; } +/* (transfer container) */ GList * empathy_connection_aggregator_get_all_groups (EmpathyConnectionAggregator *self) { -- cgit v1.2.3 From 5c615ca9c2ffcff23925c154e36dfeccf416ec30 Mon Sep 17 00:00:00 2001 From: Danielle Madeley Date: Tue, 17 Jan 2012 14:30:06 +1100 Subject: client-factory: ensure alias, presence, capabilities and avatar are prepared Sometimes contacts are assumed to have these features prepared, but they don't always. Ensure they are prepared by the factory. --- libempathy/empathy-client-factory.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'libempathy') diff --git a/libempathy/empathy-client-factory.c b/libempathy/empathy-client-factory.c index 035c56956..294eaf5ff 100644 --- a/libempathy/empathy-client-factory.c +++ b/libempathy/empathy-client-factory.c @@ -169,15 +169,21 @@ empathy_client_factory_dup_contact_features (TpSimpleClientFactory *factory, TpConnection *connection) { GArray *features; - TpContactFeature feature; + TpContactFeature extra_features[] = { + TP_CONTACT_FEATURE_ALIAS, + TP_CONTACT_FEATURE_PRESENCE, + TP_CONTACT_FEATURE_AVATAR_TOKEN, + TP_CONTACT_FEATURE_AVATAR_DATA, + TP_CONTACT_FEATURE_CAPABILITIES, + /* Needed by empathy_individual_add_menu_item_new to check if a contact + * is already in the contact list. This feature is pretty cheap to + * prepare as it doesn't prepare the full roster. */ + TP_CONTACT_FEATURE_SUBSCRIPTION_STATES, + }; features = chainup->dup_contact_features (factory, connection); - /* Needed by empathy_individual_add_menu_item_new to check if a contact is - * already in the contact list. This feature is pretty cheap to prepare as - * it doesn't prepare the full roster. */ - feature = TP_CONTACT_FEATURE_SUBSCRIPTION_STATES; - g_array_append_val (features, feature); + g_array_append_vals (features, extra_features, G_N_ELEMENTS (extra_features)); return features; } -- cgit v1.2.3