]> git.0d.be Git - empathy.git/blob - src/empathy-account-assistant.c
Move back the account assistant to src/
[empathy.git] / src / empathy-account-assistant.c
1 /*
2  * Copyright (C) 2009 Collabora Ltd.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  *
18  * Authors: Cosimo Cecchi <cosimo.cecchi@collabora.co.uk>
19  */
20
21 /* empathy-account-assistant.c */
22
23 #include <glib/gi18n.h>
24
25 #include "empathy-account-assistant.h"
26 #include <libempathy-gtk/empathy-ui-utils.h>
27
28 G_DEFINE_TYPE (EmpathyAccountAssistant, empathy_account_assistant,
29     GTK_TYPE_ASSISTANT)
30
31 static GtkWidget *
32 account_assistant_build_introduction_page (void)
33 {
34   GtkWidget *main_vbox, *hbox_1, *w, *radio, *vbox_1;
35   GdkPixbuf *pix;
36
37   main_vbox = gtk_vbox_new (FALSE, 12);
38   gtk_widget_show (main_vbox);
39   gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
40
41   hbox_1 = gtk_hbox_new (FALSE, 12);
42   gtk_box_pack_start (GTK_BOX (main_vbox), hbox_1, TRUE, TRUE, 0);
43   gtk_widget_show (hbox_1);
44
45   w = gtk_label_new (_("With Empathy you can chat with people \nonline nearby "
46           "and with friends and colleagues \nwho use Google Talk, AIM, "
47           "Windows Live \nand many other chat programs. With a microphone \n"
48           "or a webcam you can also have audio or video calls."));
49   gtk_misc_set_alignment (GTK_MISC (w), 0, 0.5);
50   gtk_box_pack_start (GTK_BOX (hbox_1), w, TRUE, TRUE, 0);
51   gtk_widget_show (w);
52
53   pix = empathy_pixbuf_from_icon_name_sized ("empathy", 96);
54   w = gtk_image_new_from_pixbuf (pix);
55   gtk_box_pack_start (GTK_BOX (hbox_1), w, TRUE, TRUE, 6);
56   gtk_widget_show (w);
57
58   g_object_unref (pix);
59
60   w = gtk_label_new (_("Do you have an account you've been using with another "
61           "chat program?"));
62   gtk_misc_set_alignment (GTK_MISC (w), 0, 0);
63   gtk_box_pack_start (GTK_BOX (main_vbox), w, FALSE, FALSE, 0);
64   gtk_widget_show (w);
65
66   w = gtk_alignment_new (0, 0, 0, 0);
67   gtk_alignment_set_padding (GTK_ALIGNMENT (w), 0, 0, 12, 0);
68   gtk_box_pack_start (GTK_BOX (main_vbox), w, TRUE, TRUE, 0);
69   gtk_widget_show (w);
70
71   vbox_1 = gtk_vbox_new (FALSE, 6);
72   gtk_container_add (GTK_CONTAINER (w), vbox_1);
73   gtk_widget_show (vbox_1);
74
75   radio = gtk_radio_button_new_with_label (NULL, _("Yes, import my account details from "));
76   gtk_box_pack_start (GTK_BOX (vbox_1), radio, TRUE, TRUE, 0);
77   gtk_widget_show (radio);
78
79   w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("Yes, I'll enter my account details now"));
80   gtk_box_pack_start (GTK_BOX (vbox_1), w, TRUE, TRUE, 0);
81   gtk_widget_show (w);
82
83   w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("No, I want a new account"));
84   gtk_box_pack_start (GTK_BOX (vbox_1), w, TRUE, TRUE, 0);
85   gtk_widget_show (w);
86
87   w = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radio), _("No, I just want to see people online nearby for now"));
88   gtk_box_pack_start (GTK_BOX (vbox_1), w, TRUE, TRUE, 0);
89   gtk_widget_show (w);
90
91   return main_vbox;
92 }
93
94 static void
95 empathy_account_assistant_class_init (EmpathyAccountAssistantClass *klass)
96 {
97
98 }
99
100 static void
101 empathy_account_assistant_init (EmpathyAccountAssistant *self)
102 {
103   GtkWidget *page;
104
105   page = account_assistant_build_introduction_page ();
106   gtk_assistant_append_page (GTK_ASSISTANT (self), page);
107   gtk_assistant_set_page_title (GTK_ASSISTANT (self), page, _("Welcome to Empathy"));
108   gtk_assistant_set_page_type (GTK_ASSISTANT (self), page, GTK_ASSISTANT_PAGE_INTRO);
109   gtk_assistant_set_page_complete (GTK_ASSISTANT (self), page, TRUE);
110 }
111
112 GtkWidget *
113 empathy_account_assistant_new (void)
114 {
115   return g_object_new (EMPATHY_TYPE_ACCOUNT_ASSISTANT, NULL);
116 }