From 63b3a10e4b442ef9865885f590f3d251ac006f04 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 3 Aug 2009 11:32:19 +0200 Subject: [PATCH] Add private struct and responses to first page --- src/empathy-account-assistant.c | 62 +++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/src/empathy-account-assistant.c b/src/empathy-account-assistant.c index 4c23ca8b..5b7535bd 100644 --- a/src/empathy-account-assistant.c +++ b/src/empathy-account-assistant.c @@ -23,13 +23,43 @@ #include #include "empathy-account-assistant.h" + +#include + #include 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")); -- 2.39.2