[empathy/mc5] Hook the import UI in the assistant
- From: Sjoerd Simons <sjoerds src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [empathy/mc5] Hook the import UI in the assistant
- Date: Sat, 22 Aug 2009 18:53:43 +0000 (UTC)
commit 5f31f7e68a4d8e132aa9c1d0c6305e1546368666
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Fri Aug 7 17:24:06 2009 +0200
Hook the import UI in the assistant
src/empathy-account-assistant.c | 92 +++++++++++++++++++++++++++++---------
1 files changed, 70 insertions(+), 22 deletions(-)
---
diff --git a/src/empathy-account-assistant.c b/src/empathy-account-assistant.c
index f5ef3c7..0b30bb8 100644
--- a/src/empathy-account-assistant.c
+++ b/src/empathy-account-assistant.c
@@ -24,6 +24,8 @@
#include <telepathy-glib/util.h>
#include "empathy-account-assistant.h"
+#include "empathy-import-dialog.h"
+#include "empathy-import-widget.h"
#include <libempathy/empathy-account-settings.h>
#include <libempathy/empathy-utils.h>
@@ -68,6 +70,9 @@ typedef struct {
EmpathyAccountSettings *settings;
gboolean is_creating;
+ /* import page */
+ EmpathyImportWidget *iw;
+
GtkWindow *parent_window;
gboolean dispose_run;
@@ -396,15 +401,17 @@ account_assistant_page_forward_func (gint current_page,
if (priv->first_resp == RESPONSE_ENTER_ACCOUNT ||
priv->first_resp == RESPONSE_CREATE_ACCOUNT)
retval = PAGE_ENTER_CREATE;
+ if (priv->first_resp == RESPONSE_IMPORT)
+ retval = PAGE_IMPORT;
}
- if (current_page == PAGE_ENTER_CREATE)
+ if (current_page == PAGE_ENTER_CREATE ||
+ current_page == PAGE_IMPORT)
{
/* don't forward anymore */
retval = -1;
}
- g_print ("retval = %d\n", retval);
return retval;
}
@@ -435,8 +442,10 @@ account_assistant_radio_choice_toggled_cb (GtkToggleButton *button,
static GtkWidget *
account_assistant_build_introduction_page (EmpathyAccountAssistant *self)
{
- GtkWidget *main_vbox, *hbox_1, *w, *radio, *vbox_1;
+ GtkWidget *main_vbox, *hbox_1, *w, *vbox_1;
+ GtkWidget *radio = NULL;
GdkPixbuf *pix;
+ const gchar *str;
main_vbox = gtk_vbox_new (FALSE, 12);
gtk_widget_show (main_vbox);
@@ -474,23 +483,46 @@ account_assistant_build_introduction_page (EmpathyAccountAssistant *self)
gtk_box_pack_start (GTK_BOX (main_vbox), w, TRUE, TRUE, 0);
gtk_widget_show (w);
- vbox_1 = gtk_vbox_new (FALSE, 6);
+ vbox_1 = gtk_vbox_new (TRUE, 0);
gtk_container_add (GTK_CONTAINER (w), vbox_1);
gtk_widget_show (vbox_1);
- /* TODO: this will have to be updated when kutio's branch have landed */
- radio = gtk_radio_button_new_with_label (NULL,
- _("Yes, import my account details from "));
- gtk_box_pack_start (GTK_BOX (vbox_1), radio, TRUE, TRUE, 0);
- g_object_set_data (G_OBJECT (radio), "response",
- GINT_TO_POINTER (RESPONSE_IMPORT));
- gtk_widget_show (radio);
+ if (empathy_import_dialog_accounts_to_import ())
+ {
+ hbox_1 = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX (vbox_1), hbox_1, TRUE, TRUE, 0);
+ gtk_widget_show (hbox_1);
+
+ radio = gtk_radio_button_new_with_label (NULL,
+ _("Yes, import my account details from "));
+ gtk_box_pack_start (GTK_BOX (hbox_1), radio, TRUE, TRUE, 0);
+ g_object_set_data (G_OBJECT (radio), "response",
+ GINT_TO_POINTER (RESPONSE_IMPORT));
+ gtk_widget_show (radio);
+
+ w = gtk_combo_box_new_text ();
+ gtk_combo_box_append_text (GTK_COMBO_BOX (w), "Pidgin");
+ gtk_box_pack_start (GTK_BOX (hbox_1), w, TRUE, TRUE, 0);
+ gtk_combo_box_set_active (GTK_COMBO_BOX (w), 0);
+ gtk_widget_show (w);
+
+ g_signal_connect (radio, "clicked",
+ G_CALLBACK (account_assistant_radio_choice_toggled_cb), self);
+ }
- g_signal_connect (radio, "clicked",
- G_CALLBACK (account_assistant_radio_choice_toggled_cb), self);
+ str = _("Yes, I'll enter my account details now");
+
+ if (radio == NULL)
+ {
+ radio = gtk_radio_button_new_with_label (NULL, str);
+ w = radio;
+ }
+ else
+ {
+ w = gtk_radio_button_new_with_label_from_widget (
+ GTK_RADIO_BUTTON (radio), str);
+ }
- w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio),
- _("Yes, I'll enter my account details now"));
gtk_box_pack_start (GTK_BOX (vbox_1), w, TRUE, TRUE, 0);
g_object_set_data (G_OBJECT (w), "response",
GINT_TO_POINTER (RESPONSE_ENTER_ACCOUNT));
@@ -525,14 +557,29 @@ account_assistant_build_introduction_page (EmpathyAccountAssistant *self)
static GtkWidget *
account_assistant_build_import_page (EmpathyAccountAssistant *self)
{
- /* TODO: import page */
- GtkWidget *main_vbox, *w;
+ GtkWidget *main_vbox, *w, *import;
+ EmpathyImportWidget *iw;
+ EmpathyAccountAssistantPriv *priv = GET_PRIV (self);
main_vbox = gtk_vbox_new (FALSE, 12);
- w = gtk_label_new ("Import your accounts!");
+ gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
+ w = gtk_label_new (_("Select the accounts you want to import:"));
+ gtk_misc_set_alignment (GTK_MISC (w), 0.0, 0.5);
gtk_widget_show (w);
gtk_box_pack_start (GTK_BOX (main_vbox), w, FALSE, FALSE, 6);
+ w = gtk_alignment_new (0, 0, 0, 0);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (w), 0, 0, 12, 0);
+ gtk_box_pack_start (GTK_BOX (main_vbox), w, FALSE, FALSE, 0);
+ gtk_widget_show (w);
+
+ iw = empathy_import_widget_new ();
+ import = empathy_import_widget_get_widget (iw);
+ gtk_container_add (GTK_CONTAINER (w), import);
+ gtk_widget_show (import);
+
+ priv->iw = iw;
+
gtk_widget_show (main_vbox);
return main_vbox;
@@ -602,14 +649,16 @@ static void
impl_signal_apply (GtkAssistant *assistant)
{
EmpathyAccountAssistant *self = EMPATHY_ACCOUNT_ASSISTANT (assistant);
- // EmpathyAccountAssistantPriv *priv = GET_PRIV (self);
+ EmpathyAccountAssistantPriv *priv = GET_PRIV (self);
gint current_page;
- g_print ("apply!!\n");
current_page = gtk_assistant_get_current_page (assistant);
if (current_page == RESPONSE_ENTER_ACCOUNT)
account_assistant_apply_account_and_finish (self);
+
+ if (current_page == RESPONSE_IMPORT)
+ empathy_import_widget_add_selected_accounts (priv->iw);
}
static void
@@ -628,8 +677,6 @@ impl_signal_prepare (GtkAssistant *assistant,
current_idx = gtk_assistant_get_current_page (assistant);
- g_print ("prepare, current idx = %d\n", current_idx);
-
if (current_idx == PAGE_ENTER_CREATE)
{
account_assistant_finish_enter_or_create_page (self,
@@ -768,6 +815,7 @@ empathy_account_assistant_init (EmpathyAccountAssistant *self)
gtk_assistant_set_page_title (assistant, page,
_("Import your existing accounts"));
gtk_assistant_set_page_complete (assistant, page, TRUE);
+ gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONFIRM);
/* third page (enter account details) */
page = account_assistant_build_enter_or_create_page (self, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]