/* 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;
};
g_signal_new ("password-retrieved",
G_TYPE_FROM_CLASS (empathy_account_settings_class),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
+ g_cclosure_marshal_generic,
G_TYPE_NONE, 0);
}
g_list_free (priv->required_params);
}
- g_hash_table_destroy (priv->parameters);
- g_hash_table_destroy (priv->param_regexps);
+ g_hash_table_unref (priv->parameters);
+ g_hash_table_unref (priv->param_regexps);
empathy_account_settings_free_unset_parameters (self);
- g_array_free (priv->unset_parameters, TRUE);
+ g_array_unref (priv->unset_parameters);
G_OBJECT_CLASS (empathy_account_settings_parent_class)->finalize (object);
}
priv->password_original = g_strdup (password);
}
-static gboolean
-account_has_uri_scheme_tel (TpAccount *account)
-{
- const gchar * const * uri_schemes;
- guint i;
-
- uri_schemes = tp_account_get_uri_schemes (account);
- if (uri_schemes == NULL)
- return FALSE;
-
- for (i = 0; uri_schemes[i] != NULL; i++)
- {
- if (!tp_strdiff (uri_schemes[i], "tel"))
- return TRUE;
- }
-
- return FALSE;
-}
-
static void
empathy_account_settings_check_readyness (EmpathyAccountSettings *self)
{
priv->icon_name =
g_strdup (tp_account_get_icon_name (priv->account));
- priv->uri_scheme_tel = account_has_uri_scheme_tel (priv->account);
+ priv->uri_scheme_tel = empathy_account_has_uri_scheme_tel (priv->account);
}
tp_protocol = tp_connection_manager_get_protocol (priv->manager,
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)
{
priv->password = g_strdup (priv->password_original);
if (priv->account != NULL)
- priv->uri_scheme_tel = account_has_uri_scheme_tel (priv->account);
+ priv->uri_scheme_tel = empathy_account_has_uri_scheme_tel (priv->account);
else
priv->uri_scheme_tel = FALSE;
}
{
EmpathyAccountSettingsPriv *priv = GET_PRIV (self);
- if (priv->uri_scheme_tel == account_has_uri_scheme_tel (priv->account))
+ if (priv->uri_scheme_tel == empathy_account_has_uri_scheme_tel (
+ priv->account))
return;
tp_account_set_uri_scheme_association_async (priv->account, "tel",
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,
}
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);
TpAccountManager *account_manager = TP_ACCOUNT_MANAGER (source_object);
GError *error = NULL;
- if (!tp_account_manager_prepare_finish (account_manager, result, &error))
+ if (!tp_proxy_prepare_finish (account_manager, result, &error))
{
DEBUG ("Failed to prepare account manager: %s", error->message);
g_error_free (error);
if (priv->account == NULL)
{
- tp_account_manager_prepare_async (priv->account_manager, NULL,
+ tp_proxy_prepare_async (priv->account_manager, NULL,
empathy_account_settings_manager_ready_cb, settings);
}
else