TpAccount *account = TP_ACCOUNT (source_object);
EmpathyAccountWidget *widget = EMPATHY_ACCOUNT_WIDGET (user_data);
EmpathyAccountWidgetPriv *priv = GET_PRIV (widget);
- TpConnectionPresenceType presence;
- gchar *message = NULL;
- gchar *status = NULL;
tp_account_set_enabled_finish (account, res, &error);
}
else
{
- /* only force presence if presence was offline, unknown or unset */
- presence = tp_account_get_requested_presence (account, NULL, NULL);
- switch (presence)
- {
- case TP_CONNECTION_PRESENCE_TYPE_OFFLINE:
- case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN:
- case TP_CONNECTION_PRESENCE_TYPE_UNSET:
- presence = tp_account_manager_get_most_available_presence (
- priv->account_manager, &status, &message);
- tp_account_request_presence_async (account, presence,
- status, NULL, NULL, NULL);
- break;
- default:
- /* do nothing if the presence is not offline */
- break;
- }
+ empathy_connect_new_account (account, priv->account_manager);
}
/* unref widget - part of the workaround */
g_object_unref (widget);
- g_free (message);
- g_free (status);
}
static void
EmpathyAccountWidget *self)
{
EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ gboolean display_name_overridden;
if (priv->radiobutton_reuse != NULL)
{
empathy_account_settings_set_boolean (priv->settings, "register", !reuse);
}
+ g_object_get (priv->settings,
+ "display-name-overridden", &display_name_overridden, NULL);
+
+ if (priv->creating_account || !display_name_overridden)
+ {
+ gchar *display_name;
+
+ /* set default display name for new accounts or update if user didn't
+ * manually override it. */
+ display_name = empathy_account_widget_get_default_display_name (self);
+
+ empathy_account_settings_set_display_name_async (priv->settings,
+ display_name, NULL, NULL);
+
+ g_free (display_name);
+ }
+
/* workaround to keep widget alive during async call */
g_object_ref (self);
empathy_account_settings_apply_async (priv->settings,
EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
TpAccount *account;
const gchar *protocol, *cm_name;
+ const gchar *display_name, *default_display_name;
guint i = 0;
struct {
const gchar *cm_name;
empathy_builder_unref_and_keep_widget (self->ui_details->gui,
self->ui_details->widget);
self->ui_details->gui = NULL;
+
+ display_name = empathy_account_settings_get_display_name (priv->settings);
+ default_display_name = empathy_account_widget_get_default_display_name (self);
+
+ if (tp_strdiff (display_name, default_display_name))
+ {
+ /* The display name of the account is not the one that we'd assign by
+ * default; assume that the user changed it manually */
+ g_object_set (priv->settings, "display-name-overridden", TRUE, NULL);
+ }
}
static void
priv->dispose_run = TRUE;
- empathy_account_settings_is_ready (priv->settings);
-
if (priv->settings != NULL)
{
TpAccount *account;
signals[ACCOUNT_CREATED] =
g_signal_new ("account-created", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST, 0, NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
+ g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1, G_TYPE_OBJECT);