diff options
author | Cosimo Cecchi <cosimoc@gnome.org> | 2009-08-03 17:32:19 +0800 |
---|---|---|
committer | Sjoerd Simons <sjoerd.simons@collabora.co.uk> | 2009-08-22 21:13:12 +0800 |
commit | 63b3a10e4b442ef9865885f590f3d251ac006f04 (patch) | |
tree | 2f089143e6618550cee54e16e92ddd119bec146a /src | |
parent | 91feedc5c6b02468fc029f83157445a9c6d8b7d4 (diff) | |
download | gsoc2013-empathy-63b3a10e4b442ef9865885f590f3d251ac006f04.tar gsoc2013-empathy-63b3a10e4b442ef9865885f590f3d251ac006f04.tar.gz gsoc2013-empathy-63b3a10e4b442ef9865885f590f3d251ac006f04.tar.bz2 gsoc2013-empathy-63b3a10e4b442ef9865885f590f3d251ac006f04.tar.lz gsoc2013-empathy-63b3a10e4b442ef9865885f590f3d251ac006f04.tar.xz gsoc2013-empathy-63b3a10e4b442ef9865885f590f3d251ac006f04.tar.zst gsoc2013-empathy-63b3a10e4b442ef9865885f590f3d251ac006f04.zip |
Add private struct and responses to first page
Diffstat (limited to 'src')
-rw-r--r-- | src/empathy-account-assistant.c | 62 |
1 files changed, 59 insertions, 3 deletions
diff --git a/src/empathy-account-assistant.c b/src/empathy-account-assistant.c index 4c23ca8b0..5b7535bd3 100644 --- a/src/empathy-account-assistant.c +++ b/src/empathy-account-assistant.c @@ -23,13 +23,43 @@ #include <glib/gi18n.h> #include "empathy-account-assistant.h" + +#include <libempathy/empathy-utils.h> + #include <libempathy-gtk/empathy-ui-utils.h> G_DEFINE_TYPE (EmpathyAccountAssistant, empathy_account_assistant, GTK_TYPE_ASSISTANT) +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountAssistant) + +typedef enum { + RESPONSE_IMPORT = 1, + RESPONSE_ENTER_ACCOUNT = 2, + RESPONSE_CREATE_ACCOUNT = 3, + RESPONSE_SALUT_ONLY = 4 +} FirstPageResponse; + +typedef struct { + FirstPageResponse first_resp; +} EmpathyAccountAssistantPriv; + +static void +account_assistant_radio_choice_toggled_cb (GtkToggleButton *button, + EmpathyAccountAssistant *self) +{ + FirstPageResponse response; + EmpathyAccountAssistantPriv *priv = GET_PRIV (self); + + response = GPOINTER_TO_INT (g_object_get_data + (G_OBJECT (button), "response")); + + g_print ("choice %d toggled\n", response); + priv->first_resp = response; +} + static GtkWidget * -account_assistant_build_introduction_page (void) +account_assistant_build_introduction_page (EmpathyAccountAssistant *self) { GtkWidget *main_vbox, *hbox_1, *w, *radio, *vbox_1; GdkPixbuf *pix; @@ -72,42 +102,68 @@ account_assistant_build_introduction_page (void) 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); + g_signal_connect (radio, "clicked", + G_CALLBACK (account_assistant_radio_choice_toggled_cb), self); + 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)); gtk_widget_show (w); + g_signal_connect (w, "clicked", + G_CALLBACK (account_assistant_radio_choice_toggled_cb), self); + w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("No, I want a new account")); gtk_box_pack_start (GTK_BOX (vbox_1), w, TRUE, TRUE, 0); + g_object_set_data (G_OBJECT (w), "response", + GINT_TO_POINTER (RESPONSE_CREATE_ACCOUNT)); gtk_widget_show (w); + g_signal_connect (w, "clicked", + G_CALLBACK (account_assistant_radio_choice_toggled_cb), self); + w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("No, I just want to see people online nearby for 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_SALUT_ONLY)); gtk_widget_show (w); + g_signal_connect (w, "clicked", + G_CALLBACK (account_assistant_radio_choice_toggled_cb), self); + return main_vbox; } static void empathy_account_assistant_class_init (EmpathyAccountAssistantClass *klass) { - + g_type_class_add_private (klass, sizeof (EmpathyAccountAssistantPriv)); } static void empathy_account_assistant_init (EmpathyAccountAssistant *self) { + EmpathyAccountAssistantPriv *priv; GtkWidget *page; + priv = G_TYPE_INSTANCE_GET_PRIVATE (self, EMPATHY_TYPE_ACCOUNT_ASSISTANT, + EmpathyAccountAssistantPriv); + self->priv = priv; + /* first page */ - page = account_assistant_build_introduction_page (); + page = account_assistant_build_introduction_page (self); gtk_assistant_append_page (GTK_ASSISTANT (self), page); gtk_assistant_set_page_title (GTK_ASSISTANT (self), page, _("Welcome to Empathy")); |