Commit 63b3a10e authored by Cosimo Cecchi's avatar Cosimo Cecchi Committed by Sjoerd Simons

Add private struct and responses to first page

parent 91feedc5
......@@ -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"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment