From 7fa0c3b106c5d5d35cb86a75da047b8c7c5e2685 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 22 Sep 2010 16:51:05 +0200 Subject: add account widget for Ovi --- libempathy-gtk/empathy-account-widget-jabber.ui | 105 ++++++++++++++++++++++++ libempathy-gtk/empathy-account-widget.c | 47 ++++++++++- 2 files changed, 149 insertions(+), 3 deletions(-) diff --git a/libempathy-gtk/empathy-account-widget-jabber.ui b/libempathy-gtk/empathy-account-widget-jabber.ui index 6820eabd8..f7579bbb4 100644 --- a/libempathy-gtk/empathy-account-widget-jabber.ui +++ b/libempathy-gtk/empathy-account-widget-jabber.ui @@ -133,6 +133,20 @@ Use <a href="http://www.facebook.com/username/">this page</a> to cho 2 + + + 0 + 3 + <b>Example:</b> alice + True + + + + + + 1 + + 1 @@ -692,4 +706,95 @@ Use <a href="http://www.facebook.com/username/">this page</a> to cho + + True + vertical + + + True + 0 + What is your Ovi username? + + + 0 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.34999999403953552 + 6 + 3 + 12 + + + True + vertical + 4 + + + True + True + + + 0 + + + + + True + 0.10000000149011612 + <b>Example:</b> alice + True + + + + + + 1 + + + + + + + 1 + + + + + True + 0 + 6 + What is your Ovi password? + + + 2 + + + + + True + 0 + 0 + 0.34999999403953552 + 0.5 + 12 + + + True + True + False + + + + + 3 + + + + diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index 9a2b2c856..c14ca59a7 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -1260,6 +1260,15 @@ account_widget_is_facebook (EmpathyAccountWidget *self) "im-facebook"); } +static gboolean +account_widget_is_ovi (EmpathyAccountWidget *self) +{ + EmpathyAccountWidgetPriv *priv = GET_PRIV (self); + + return !tp_strdiff (empathy_account_settings_get_service (priv->settings), + "ovi-chat"); +} + static void suffix_id_widget_changed_cb (GtkWidget *entry, EmpathyAccountWidget *self) @@ -1342,17 +1351,19 @@ account_widget_build_jabber (EmpathyAccountWidget *self, GtkWidget *label_id, *label_password; GtkWidget *label_id_create, *label_password_create; GtkWidget *label_example_gtalk, *label_example_jabber, *label_example_fb; - gboolean is_gtalk, is_facebook; + GtkWidget *label_example_ovi; + gboolean is_gtalk, is_facebook, is_ovi; GtkWidget *expander_advanced; GtkWidget *entry_id; is_gtalk = account_widget_is_gtalk (self); is_facebook = account_widget_is_facebook (self); + is_ovi = account_widget_is_ovi (self); empathy_account_settings_set_regex (priv->settings, "account", ACCOUNT_REGEX_JABBER); - if (priv->simple && !is_gtalk && !is_facebook) + if (priv->simple && !is_gtalk && !is_facebook && !is_ovi) { /* Simple widget for XMPP */ self->ui_details->gui = empathy_builder_get_file (filename, @@ -1408,6 +1419,22 @@ account_widget_build_jabber (EmpathyAccountWidget *self, self->ui_details->default_focus = g_strdup ("entry_id_fb_simple"); } + else if (priv->simple && is_ovi) + { + /* Simple widget for Ovi */ + self->ui_details->gui = empathy_builder_get_file (filename, + "vbox_ovi_simple", &self->ui_details->widget, + "entry_id_ovi_simple", &entry_id, + NULL); + + empathy_account_widget_handle_params (self, + "entry_password_ovi_simple", "password", + NULL); + + setup_id_widget_with_suffix (self, entry_id, "@ovi.com"); + + self->ui_details->default_focus = g_strdup ("entry_id_ovi_simple"); + } else { /* Full widget for XMPP, Google Talk and Facebook*/ @@ -1419,6 +1446,7 @@ account_widget_build_jabber (EmpathyAccountWidget *self, "label_username_example", &label_example_jabber, "label_username_g_example", &label_example_gtalk, "label_username_f_example", &label_example_fb, + "label_username_ovi_example", &label_example_ovi, "expander_advanced", &expander_advanced, "entry_id", &entry_id, "label_id", &label_id, @@ -1443,6 +1471,12 @@ account_widget_build_jabber (EmpathyAccountWidget *self, * "@chat.facebook.com" part */ setup_id_widget_with_suffix (self, entry_id, "@chat.facebook.com"); } + else if (is_ovi) + { + gtk_label_set_label (GTK_LABEL (label_id), _("Username:")); + + setup_id_widget_with_suffix (self, entry_id, "@ovi.com"); + } else { empathy_account_widget_setup_widget (self, entry_id, "account"); @@ -1477,6 +1511,12 @@ account_widget_build_jabber (EmpathyAccountWidget *self, gtk_widget_show (label_example_fb); gtk_widget_hide (expander_advanced); } + else if (is_ovi) + { + gtk_widget_hide (label_example_jabber); + gtk_widget_show (label_example_ovi); + gtk_widget_hide (expander_advanced); + } } } @@ -1948,7 +1988,8 @@ add_register_buttons (EmpathyAccountWidget *self, if (!tp_connection_manager_protocol_can_register (protocol)) return; - if (account_widget_is_gtalk (self) || account_widget_is_facebook (self)) + if (account_widget_is_gtalk (self) || account_widget_is_facebook (self) || + account_widget_is_ovi (self)) return; if (priv->simple) -- cgit v1.2.3