]> git.0d.be Git - empathy.git/blob - libempathy-gtk/empathy-account-widget.c
Updated Oriya Translation
[empathy.git] / libempathy-gtk / empathy-account-widget.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2006-2007 Imendio AB
4  * Copyright (C) 2007-2008 Collabora Ltd.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public
17  * License along with this program; if not, write to the
18  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19  * Boston, MA  02110-1301  USA
20  *
21  * Authors: Xavier Claessens <xclaesse@gmail.com>
22  *          Martyn Russell <martyn@imendio.com>
23  */
24
25 #include <config.h>
26
27 #include <string.h>
28
29 #include <gtk/gtk.h>
30 #include <glib/gi18n-lib.h>
31
32 #include <libmissioncontrol/mc-protocol.h>
33
34 #include <libempathy/empathy-utils.h>
35 #include <libempathy/empathy-account.h>
36
37 #include "empathy-account-widget.h"
38 #include "empathy-ui-utils.h"
39
40 #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT
41 #include <libempathy/empathy-debug.h>
42
43 static gboolean
44 account_widget_entry_focus_cb (GtkWidget     *widget,
45                                GdkEventFocus *event,
46                                EmpathyAccount     *account)
47 {
48         const gchar *str;
49         const gchar *param_name;
50
51         str = gtk_entry_get_text (GTK_ENTRY (widget));
52         param_name = g_object_get_data (G_OBJECT (widget), "param_name");
53
54         if (EMP_STR_EMPTY (str)) {
55                 gchar *value = NULL;
56
57                 empathy_account_unset_param (account, param_name);
58                 value = empathy_account_get_param_string (account, param_name);
59                 DEBUG ("Unset %s and restore to %s", param_name, value);
60                 gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
61                 g_free (value);
62         } else {
63                 McProfile   *profile;
64                 const gchar *domain = NULL;
65                 gchar       *dup_str = NULL;
66
67                 profile = empathy_account_get_profile (account);
68                 if (mc_profile_get_capabilities (profile) &
69                     MC_PROFILE_CAPABILITY_SPLIT_ACCOUNT) {
70                         domain = mc_profile_get_default_account_domain (profile);
71                 }
72
73                 if (domain && !strstr (str, "@") &&
74                     strcmp (param_name, "account") == 0) {
75                         DEBUG ("Adding @%s suffix to account", domain);
76                         str = dup_str = g_strconcat (str, "@", domain, NULL);
77                         gtk_entry_set_text (GTK_ENTRY (widget), str);
78                 }
79                 DEBUG ("Setting %s to %s", param_name,
80                         strstr (param_name, "password") ? "***" : str);
81                 empathy_account_set_param_string (account, param_name, str);
82                 g_free (dup_str);
83                 g_object_unref (profile);
84         }
85
86         return FALSE;
87 }
88
89 static void
90 account_widget_int_changed_cb (GtkWidget *widget,
91                                EmpathyAccount *account)
92 {
93         const gchar *param_name;
94         gint         value;
95
96         value = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
97         param_name = g_object_get_data (G_OBJECT (widget), "param_name");
98
99         if (value == 0) {
100                 empathy_account_unset_param (account, param_name);
101                 value = empathy_account_get_param_int (account, param_name);
102                 DEBUG ("Unset %s and restore to %d", param_name, value);
103                 gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
104         } else {
105                 DEBUG ("Setting %s to %d", param_name, value);
106                 empathy_account_set_param_int (account, param_name, value);
107         }
108 }
109
110 static void
111 account_widget_checkbutton_toggled_cb (GtkWidget *widget,
112                                        EmpathyAccount *account)
113 {
114         gboolean     value;
115         gboolean     default_value;
116         const gchar *param_name;
117
118         value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
119         param_name = g_object_get_data (G_OBJECT (widget), "param_name");
120
121         /* FIXME: This is ugly! checkbox don't have a "not-set" value so we
122          * always unset the param and set the value if different from the
123          * default value. */
124         empathy_account_unset_param (account, param_name);
125         default_value = empathy_account_get_param_boolean (account, param_name);
126
127         if (default_value == value) {
128                 DEBUG ("Unset %s and restore to %d", param_name, default_value);
129         } else {
130                 DEBUG ("Setting %s to %d", param_name, value);
131                 empathy_account_set_param_boolean (account, param_name, value);
132         }
133 }
134
135 static void
136 account_widget_forget_clicked_cb (GtkWidget *button,
137                                   GtkWidget *entry)
138 {
139         EmpathyAccount   *account;
140         const gchar *param_name;
141
142         param_name = g_object_get_data (G_OBJECT (entry), "param_name");
143         account = g_object_get_data (G_OBJECT (entry), "account");
144
145         DEBUG ("Unset %s", param_name);
146         empathy_account_unset_param (account, param_name);
147         gtk_entry_set_text (GTK_ENTRY (entry), "");
148 }
149
150 static void
151 account_widget_password_changed_cb (GtkWidget *entry,
152                                     GtkWidget *button)
153 {
154         const gchar *str;
155
156         str = gtk_entry_get_text (GTK_ENTRY (entry));
157         gtk_widget_set_sensitive (button, !EMP_STR_EMPTY (str));
158 }
159
160 static void
161 account_widget_jabber_ssl_toggled_cb (GtkWidget *checkbutton_ssl,
162                                       GtkWidget *spinbutton_port)
163 {
164         EmpathyAccount *account;
165         gboolean   value;
166         gint       port = 0;
167
168         value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton_ssl));
169         account = g_object_get_data (G_OBJECT (spinbutton_port), "account");
170         port = empathy_account_get_param_int (account, "port");
171
172         if (value) {
173                 if (port == 5222 || port == 0) {
174                         port = 5223;
175                 }
176         } else {
177                 if (port == 5223 || port == 0) {
178                         port = 5222;
179                 }
180         }
181
182         gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinbutton_port), port);
183 }
184
185 static void
186 account_widget_setup_widget (GtkWidget   *widget,
187                              EmpathyAccount   *account,
188                              const gchar *param_name)
189 {
190         g_object_set_data_full (G_OBJECT (widget), "param_name",
191                                 g_strdup (param_name), g_free);
192         g_object_set_data_full (G_OBJECT (widget), "account",
193                                 g_object_ref (account), g_object_unref);
194
195         if (GTK_IS_SPIN_BUTTON (widget)) {
196                 gint value = 0;
197
198                 value = empathy_account_get_param_int (account, param_name);
199                 gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
200
201                 g_signal_connect (widget, "value-changed",
202                                   G_CALLBACK (account_widget_int_changed_cb),
203                                   account);
204         }
205         else if (GTK_IS_ENTRY (widget)) {
206                 gchar *str = NULL;
207
208                 str = empathy_account_get_param_string (account, param_name);
209                 gtk_entry_set_text (GTK_ENTRY (widget), str ? str : "");
210                 g_free (str);
211
212                 if (strstr (param_name, "password")) {
213                         gtk_entry_set_visibility (GTK_ENTRY (widget), FALSE);
214                 }
215
216                 g_signal_connect (widget, "focus-out-event",
217                                   G_CALLBACK (account_widget_entry_focus_cb),
218                                   account);
219         }
220         else if (GTK_IS_TOGGLE_BUTTON (widget)) {
221                 gboolean value = FALSE;
222
223                 value = empathy_account_get_param_boolean (account, param_name);
224                 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);
225
226                 g_signal_connect (widget, "toggled",
227                                   G_CALLBACK (account_widget_checkbutton_toggled_cb),
228                                   account);
229         } else {
230                 DEBUG ("Unknown type of widget for param %s", param_name);
231         }
232 }
233
234 static gchar *
235 account_widget_generic_format_param_name (const gchar *param_name)
236 {
237         gchar *str;
238         gchar *p;
239
240         str = g_strdup (param_name);
241
242         if (str && g_ascii_isalpha (str[0])) {
243                 str[0] = g_ascii_toupper (str[0]);
244         }
245
246         while ((p = strchr (str, '-')) != NULL) {
247                 if (p[1] != '\0' && g_ascii_isalpha (p[1])) {
248                         p[0] = ' ';
249                         p[1] = g_ascii_toupper (p[1]);
250                 }
251
252                 p++;
253         }
254
255         return str;
256 }
257
258 static void
259 accounts_widget_generic_setup (EmpathyAccount *account,
260                                GtkWidget *table_common_settings,
261                                GtkWidget *table_advanced_settings)
262 {
263         McProtocol *protocol;
264         McProfile  *profile;
265         GSList     *params, *l;
266
267         profile = empathy_account_get_profile (account);
268         protocol = mc_profile_get_protocol (profile);
269
270         if (!protocol) {
271                 /* The CM is not installed, MC shouldn't list them
272                  * see SF bug #1688779
273                  * FIXME: We should display something asking the user to
274                  * install the CM
275                  */
276                 g_object_unref (profile);
277                 return;
278         }
279
280         params = mc_protocol_get_params (protocol);
281
282         for (l = params; l; l = l->next) {
283                 McProtocolParam *param;
284                 GtkWidget       *table_settings;
285                 guint            n_rows = 0;
286                 GtkWidget       *widget = NULL;
287                 gchar           *param_name_formatted;
288
289                 param = l->data;
290                 if (param->flags & MC_PROTOCOL_PARAM_REQUIRED) {
291                         table_settings = table_common_settings;
292                 } else {
293                         table_settings = table_advanced_settings;
294                 }
295                 param_name_formatted = account_widget_generic_format_param_name (param->name);
296                 g_object_get (table_settings, "n-rows", &n_rows, NULL);
297                 gtk_table_resize (GTK_TABLE (table_settings), ++n_rows, 2);
298
299                 if (param->signature[0] == 's') {
300                         gchar *str;
301
302                         str = g_strdup_printf (_("%s:"), param_name_formatted);
303                         widget = gtk_label_new (str);
304                         gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
305                         g_free (str);
306
307                         gtk_table_attach (GTK_TABLE (table_settings),
308                                           widget,
309                                           0, 1,
310                                           n_rows - 1, n_rows,
311                                           GTK_FILL, 0,
312                                           0, 0);
313                         gtk_widget_show (widget);
314
315                         widget = gtk_entry_new ();
316                         if (strcmp (param->name, "account") == 0) {
317                                 g_signal_connect (widget, "realize",
318                                         G_CALLBACK (gtk_widget_grab_focus),
319                                         NULL);
320                         }
321                         gtk_table_attach (GTK_TABLE (table_settings),
322                                           widget,
323                                           1, 2,
324                                           n_rows - 1, n_rows,
325                                           GTK_FILL | GTK_EXPAND, 0,
326                                           0, 0);
327                         gtk_widget_show (widget);
328                 }
329                 /* int types: ynqiuxt. double type is 'd' */
330                 else if (param->signature[0] == 'y' ||
331                          param->signature[0] == 'n' ||
332                          param->signature[0] == 'q' ||
333                          param->signature[0] == 'i' ||
334                          param->signature[0] == 'u' ||
335                          param->signature[0] == 'x' ||
336                          param->signature[0] == 't' ||
337                          param->signature[0] == 'd') {
338                         gchar   *str = NULL;
339                         gdouble  minint = 0;
340                         gdouble  maxint = 0;
341                         gdouble  step = 1;
342
343                         switch (param->signature[0]) {
344                         case 'y': minint = G_MININT8;  maxint = G_MAXINT8;   break;
345                         case 'n': minint = G_MININT16; maxint = G_MAXINT16;  break;
346                         case 'q': minint = 0;          maxint = G_MAXUINT16; break;
347                         case 'i': minint = G_MININT32; maxint = G_MAXINT32;  break;
348                         case 'u': minint = 0;          maxint = G_MAXUINT32; break;
349                         case 'x': minint = G_MININT64; maxint = G_MAXINT64;  break;
350                         case 't': minint = 0;          maxint = G_MAXUINT64; break;
351                         case 'd': minint = G_MININT32; maxint = G_MAXINT32; step = 0.1; break;
352                         }
353
354                         str = g_strdup_printf (_("%s:"), param_name_formatted);
355                         widget = gtk_label_new (str);
356                         gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
357                         g_free (str);
358
359                         gtk_table_attach (GTK_TABLE (table_settings),
360                                           widget,
361                                           0, 1,
362                                           n_rows - 1, n_rows,
363                                           GTK_FILL, 0,
364                                           0, 0);
365                         gtk_widget_show (widget);
366
367                         widget = gtk_spin_button_new_with_range (minint, maxint, step);
368                         gtk_table_attach (GTK_TABLE (table_settings),
369                                           widget,
370                                           1, 2,
371                                           n_rows - 1, n_rows,
372                                           GTK_FILL | GTK_EXPAND, 0,
373                                           0, 0);
374                         gtk_widget_show (widget);
375                 }
376                 else if (param->signature[0] == 'b') {
377                         widget = gtk_check_button_new_with_label (param_name_formatted);
378                         gtk_table_attach (GTK_TABLE (table_settings),
379                                           widget,
380                                           0, 2,
381                                           n_rows - 1, n_rows,
382                                           GTK_FILL | GTK_EXPAND, 0,
383                                           0, 0);
384                         gtk_widget_show (widget);
385                 } else {
386                         DEBUG ("Unknown signature for param %s: %s",
387                                 param_name_formatted, param->signature);
388                 }
389
390                 if (widget) {
391                         account_widget_setup_widget (widget, account, param->name);
392                 }
393
394                 g_free (param_name_formatted);
395         }
396
397         mc_protocol_free_params_list (params);
398         g_object_unref (profile);
399         g_object_unref (protocol);
400 }
401
402 static void
403 account_widget_handle_params_valist (EmpathyAccount   *account,
404                                      GtkBuilder  *gui,
405                                      const gchar *first_widget,
406                                      va_list      args)
407 {
408         GObject *object;
409         const gchar *name;
410
411         for (name = first_widget; name; name = va_arg (args, const gchar *)) {
412                 const gchar *param_name;
413
414                 param_name = va_arg (args, const gchar *);
415                 object = gtk_builder_get_object (gui, name);
416
417                 if (!object) {
418                         g_warning ("Builder is missing object '%s'.", name);
419                         continue;
420                 }
421
422                 account_widget_setup_widget (GTK_WIDGET (object), account, param_name);
423         }
424 }
425
426 void
427 empathy_account_widget_handle_params (EmpathyAccount   *account,
428                                       GtkBuilder  *gui,
429                                       const gchar *first_widget,
430                                       ...)
431 {
432         va_list args;
433
434         g_return_if_fail (GTK_IS_BUILDER (gui));
435
436         va_start (args, first_widget);
437         account_widget_handle_params_valist (account, gui, first_widget, args);
438         va_end (args);
439 }
440
441 void
442 empathy_account_widget_add_forget_button (EmpathyAccount   *account,
443                                           GtkBuilder  *gui,
444                                           const gchar *button,
445                                           const gchar *entry)
446 {
447         GtkWidget *button_forget;
448         GtkWidget *entry_password;
449         gchar   *password = NULL;
450
451         button_forget = GTK_WIDGET (gtk_builder_get_object (gui, button));
452         entry_password = GTK_WIDGET (gtk_builder_get_object (gui, entry));
453
454         password = empathy_account_get_param_string (account, "password");
455         gtk_widget_set_sensitive (button_forget, !EMP_STR_EMPTY (password));
456         g_free (password);
457
458         g_signal_connect (button_forget, "clicked",
459                           G_CALLBACK (account_widget_forget_clicked_cb),
460                           entry_password);
461         g_signal_connect (entry_password, "changed",
462                           G_CALLBACK (account_widget_password_changed_cb),
463                           button_forget);
464 }
465
466 void
467 empathy_account_widget_set_default_focus (GtkBuilder  *gui,
468                                           const gchar *entry)
469 {
470         GObject *default_focus_entry;
471
472         default_focus_entry = gtk_builder_get_object (gui, entry);
473         g_signal_connect (default_focus_entry, "realize",
474                           G_CALLBACK (gtk_widget_grab_focus),
475                           NULL);
476 }
477
478 GtkWidget *
479 empathy_account_widget_generic_new (EmpathyAccount *account)
480 {
481         GtkBuilder *gui;
482         GtkWidget *widget;
483         GtkWidget *table_common_settings;
484         GtkWidget *table_advanced_settings;
485         gchar     *filename;
486
487         filename = empathy_file_lookup ("empathy-account-widget-generic.ui",
488                                         "libempathy-gtk");
489         gui = empathy_builder_get_file (filename,
490                                         "vbox_generic_settings", &widget,
491                                         "table_common_settings", &table_common_settings,
492                                         "table_advanced_settings", &table_advanced_settings,
493                                         NULL);
494         g_free (filename);
495
496         accounts_widget_generic_setup (account, table_common_settings, table_advanced_settings);
497
498         return empathy_builder_unref_and_keep_widget (gui, widget);
499 }
500
501 GtkWidget *
502 empathy_account_widget_salut_new (EmpathyAccount *account)
503 {
504         GtkBuilder *gui;
505         GtkWidget *widget;
506         gchar     *filename;
507
508         filename = empathy_file_lookup ("empathy-account-widget-salut.ui",
509                                         "libempathy-gtk");
510         gui = empathy_builder_get_file (filename,
511                                         "vbox_salut_settings", &widget,
512                                         NULL);
513         g_free (filename);
514
515         empathy_account_widget_handle_params (account, gui,
516                         "entry_published", "published-name",
517                         "entry_nickname", "nickname",
518                         "entry_first_name", "first-name",
519                         "entry_last_name", "last-name",
520                         "entry_email", "email",
521                         "entry_jid", "jid",
522                         NULL);
523
524         empathy_account_widget_set_default_focus (gui, "entry_nickname");
525
526         return empathy_builder_unref_and_keep_widget (gui, widget);
527 }
528
529 GtkWidget *
530 empathy_account_widget_msn_new (EmpathyAccount *account)
531 {
532         GtkBuilder *gui;
533         GtkWidget *widget;
534         gchar     *filename;
535
536         filename = empathy_file_lookup ("empathy-account-widget-msn.ui",
537                                         "libempathy-gtk");
538         gui = empathy_builder_get_file (filename,
539                                         "vbox_msn_settings", &widget,
540                                         NULL);
541         g_free (filename);
542
543         empathy_account_widget_handle_params (account, gui,
544                         "entry_id", "account",
545                         "entry_password", "password",
546                         "entry_server", "server",
547                         "spinbutton_port", "port",
548                         NULL);
549
550         empathy_account_widget_add_forget_button (account, gui,
551                                                   "button_forget",
552                                                   "entry_password");
553
554         empathy_account_widget_set_default_focus (gui, "entry_id");
555
556         return empathy_builder_unref_and_keep_widget (gui, widget);
557 }
558
559 GtkWidget *
560 empathy_account_widget_jabber_new (EmpathyAccount *account)
561 {
562         GtkBuilder *gui;
563         GtkWidget *widget;
564         GtkWidget *spinbutton_port;
565         GtkWidget *checkbutton_ssl;
566         gchar     *filename;
567
568         filename = empathy_file_lookup ("empathy-account-widget-jabber.ui",
569                                         "libempathy-gtk");
570         gui = empathy_builder_get_file (filename,
571                                         "vbox_jabber_settings", &widget,
572                                         "spinbutton_port", &spinbutton_port,
573                                         "checkbutton_ssl", &checkbutton_ssl,
574                                         NULL);
575         g_free (filename);
576
577         empathy_account_widget_handle_params (account, gui,
578                         "entry_id", "account",
579                         "entry_password", "password",
580                         "entry_resource", "resource",
581                         "entry_server", "server",
582                         "spinbutton_port", "port",
583                         "spinbutton_priority", "priority",
584                         "checkbutton_ssl", "old-ssl",
585                         "checkbutton_ignore_ssl_errors", "ignore-ssl-errors",
586                         "checkbutton_encryption", "require-encryption",
587                         NULL);
588
589         empathy_account_widget_add_forget_button (account, gui,
590                                                   "button_forget",
591                                                   "entry_password");
592
593         empathy_account_widget_set_default_focus (gui, "entry_id");
594
595         g_signal_connect (checkbutton_ssl, "toggled",
596                           G_CALLBACK (account_widget_jabber_ssl_toggled_cb),
597                           spinbutton_port);
598
599         return empathy_builder_unref_and_keep_widget (gui, widget);
600 }
601
602 GtkWidget *
603 empathy_account_widget_icq_new (EmpathyAccount *account)
604 {
605         GtkBuilder *gui;
606         GtkWidget *widget;
607         GtkWidget *spinbutton_port;
608         gchar     *filename;
609
610         filename = empathy_file_lookup ("empathy-account-widget-icq.ui",
611                                         "libempathy-gtk");
612         gui = empathy_builder_get_file (filename,
613                                         "vbox_icq_settings", &widget,
614                                         "spinbutton_port", &spinbutton_port,
615                                         NULL);
616         g_free (filename);
617
618         empathy_account_widget_handle_params (account, gui,
619                         "entry_uin", "account",
620                         "entry_password", "password",
621                         "entry_server", "server",
622                         "spinbutton_port", "port",
623                         "entry_charset", "charset",
624                         NULL);
625
626         empathy_account_widget_add_forget_button (account, gui,
627                                                   "button_forget",
628                                                   "entry_password");
629
630         empathy_account_widget_set_default_focus (gui, "entry_uin");
631
632         return empathy_builder_unref_and_keep_widget (gui, widget);
633 }
634
635 GtkWidget *
636 empathy_account_widget_aim_new (EmpathyAccount *account)
637 {
638         GtkBuilder *gui;
639         GtkWidget *widget;
640         GtkWidget *spinbutton_port;
641         gchar     *filename;
642
643         filename = empathy_file_lookup ("empathy-account-widget-aim.ui",
644                                         "libempathy-gtk");
645         gui = empathy_builder_get_file (filename,
646                                         "vbox_aim_settings", &widget,
647                                         "spinbutton_port", &spinbutton_port,
648                                         NULL);
649         g_free (filename);
650
651         empathy_account_widget_handle_params (account, gui,
652                         "entry_screenname", "account",
653                         "entry_password", "password",
654                         "entry_server", "server",
655                         "spinbutton_port", "port",
656                         NULL);
657
658         empathy_account_widget_add_forget_button (account, gui,
659                                                   "button_forget",
660                                                   "entry_password");
661
662         empathy_account_widget_set_default_focus (gui, "entry_screenname");
663
664         return empathy_builder_unref_and_keep_widget (gui, widget);
665 }
666
667 GtkWidget *
668 empathy_account_widget_yahoo_new (EmpathyAccount *account)
669 {
670         GtkBuilder *gui;
671         GtkWidget *widget;
672         gchar     *filename;
673
674         filename = empathy_file_lookup ("empathy-account-widget-yahoo.ui",
675                                         "libempathy-gtk");
676         gui = empathy_builder_get_file (filename,
677                                         "vbox_yahoo_settings", &widget,
678                                         NULL);
679         g_free (filename);
680
681         empathy_account_widget_handle_params (account, gui,
682                         "entry_id", "account",
683                         "entry_password", "password",
684                         "entry_server", "server",
685                         "entry_locale", "room-list-locale",
686                         "entry_charset", "charset",
687                         "spinbutton_port", "port",
688                         "checkbutton_yahoojp", "yahoojp",
689                         "checkbutton_ignore_invites", "ignore-invites",
690                         NULL);
691
692         empathy_account_widget_add_forget_button (account, gui,
693                                                   "button_forget",
694                                                   "entry_password");
695
696         empathy_account_widget_set_default_focus (gui, "entry_id");
697
698         return empathy_builder_unref_and_keep_widget (gui, widget);
699 }
700
701 GtkWidget *
702 empathy_account_widget_groupwise_new (EmpathyAccount *account)
703 {
704         GtkBuilder *gui;
705         GtkWidget *widget;
706         gchar     *filename;
707
708         filename = empathy_file_lookup ("empathy-account-widget-groupwise.ui",
709                                         "libempathy-gtk");
710         gui = empathy_builder_get_file (filename,
711                                         "vbox_groupwise_settings", &widget,
712                                         NULL);
713         g_free (filename);
714
715         empathy_account_widget_handle_params (account, gui,
716                         "entry_id", "account",
717                         "entry_password", "password",
718                         "entry_server", "server",
719                         "spinbutton_port", "port",
720                         NULL);
721
722         empathy_account_widget_add_forget_button (account, gui,
723                                                   "button_forget",
724                                                   "entry_password");
725
726         empathy_account_widget_set_default_focus (gui, "entry_id");
727
728         return empathy_builder_unref_and_keep_widget (gui, widget);
729 }
730