]> git.0d.be Git - empathy.git/blob - libempathy-gtk/empathy-account-widget.c
783a48a0a8cfff842e94edafbbf6bb0d995f1f0f
[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 <libempathy/empathy-utils.h>
33 #include <libempathy/empathy-account.h>
34
35 #include <telepathy-glib/connection-manager.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                 const 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         } else {
62                 DEBUG ("Setting %s to %s", param_name,
63                         strstr (param_name, "password") ? "***" : str);
64                 empathy_account_set_param_string (account, param_name, str);
65         }
66
67         return FALSE;
68 }
69
70 static void
71 account_widget_int_changed_cb (GtkWidget *widget,
72                                EmpathyAccount *account)
73 {
74         const gchar *param_name;
75         gint         value;
76
77         value = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget));
78         param_name = g_object_get_data (G_OBJECT (widget), "param_name");
79
80         if (value == 0) {
81                 empathy_account_unset_param (account, param_name);
82                 value = empathy_account_get_param_int (account, param_name);
83                 DEBUG ("Unset %s and restore to %d", param_name, value);
84                 gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
85         } else {
86                 DEBUG ("Setting %s to %d", param_name, value);
87                 empathy_account_set_param_int (account, param_name, value);
88         }
89 }
90
91 static void
92 account_widget_checkbutton_toggled_cb (GtkWidget *widget,
93                                        EmpathyAccount *account)
94 {
95         gboolean     value;
96         gboolean     default_value;
97         const gchar *param_name;
98
99         value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
100         param_name = g_object_get_data (G_OBJECT (widget), "param_name");
101
102         /* FIXME: This is ugly! checkbox don't have a "not-set" value so we
103          * always unset the param and set the value if different from the
104          * default value. */
105         empathy_account_unset_param (account, param_name);
106         default_value = empathy_account_get_param_boolean (account, param_name);
107
108         if (default_value == value) {
109                 DEBUG ("Unset %s and restore to %d", param_name, default_value);
110         } else {
111                 DEBUG ("Setting %s to %d", param_name, value);
112                 empathy_account_set_param_boolean (account, param_name, value);
113         }
114 }
115
116 static void
117 account_widget_forget_clicked_cb (GtkWidget *button,
118                                   GtkWidget *entry)
119 {
120         EmpathyAccount   *account;
121         const gchar *param_name;
122
123         param_name = g_object_get_data (G_OBJECT (entry), "param_name");
124         account = g_object_get_data (G_OBJECT (entry), "account");
125
126         DEBUG ("Unset %s", param_name);
127         empathy_account_unset_param (account, param_name);
128         gtk_entry_set_text (GTK_ENTRY (entry), "");
129 }
130
131 static void
132 account_widget_password_changed_cb (GtkWidget *entry,
133                                     GtkWidget *button)
134 {
135         const gchar *str;
136
137         str = gtk_entry_get_text (GTK_ENTRY (entry));
138         gtk_widget_set_sensitive (button, !EMP_STR_EMPTY (str));
139 }
140
141 static void
142 account_widget_jabber_ssl_toggled_cb (GtkWidget *checkbutton_ssl,
143                                       GtkWidget *spinbutton_port)
144 {
145         EmpathyAccount *account;
146         gboolean   value;
147         gint       port = 0;
148
149         value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton_ssl));
150         account = g_object_get_data (G_OBJECT (spinbutton_port), "account");
151         port = empathy_account_get_param_int (account, "port");
152
153         if (value) {
154                 if (port == 5222 || port == 0) {
155                         port = 5223;
156                 }
157         } else {
158                 if (port == 5223 || port == 0) {
159                         port = 5222;
160                 }
161         }
162
163         gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinbutton_port), port);
164 }
165
166 static void
167 account_widget_setup_widget (GtkWidget   *widget,
168                              EmpathyAccount   *account,
169                              const gchar *param_name)
170 {
171         g_object_set_data_full (G_OBJECT (widget), "param_name",
172                                 g_strdup (param_name), g_free);
173         g_object_set_data_full (G_OBJECT (widget), "account",
174                                 g_object_ref (account), g_object_unref);
175
176         if (GTK_IS_SPIN_BUTTON (widget)) {
177                 gint value = 0;
178
179                 value = empathy_account_get_param_int (account, param_name);
180                 gtk_spin_button_set_value (GTK_SPIN_BUTTON (widget), value);
181
182                 g_signal_connect (widget, "value-changed",
183                                   G_CALLBACK (account_widget_int_changed_cb),
184                                   account);
185         }
186         else if (GTK_IS_ENTRY (widget)) {
187                 const gchar *str = NULL;
188
189                 str = empathy_account_get_param_string (account, param_name);
190                 gtk_entry_set_text (GTK_ENTRY (widget), str ? str : "");
191
192                 if (strstr (param_name, "password")) {
193                         gtk_entry_set_visibility (GTK_ENTRY (widget), FALSE);
194                 }
195
196                 g_signal_connect (widget, "focus-out-event",
197                                   G_CALLBACK (account_widget_entry_focus_cb),
198                                   account);
199         }
200         else if (GTK_IS_TOGGLE_BUTTON (widget)) {
201                 gboolean value = FALSE;
202
203                 value = empathy_account_get_param_boolean (account, param_name);
204                 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value);
205
206                 g_signal_connect (widget, "toggled",
207                                   G_CALLBACK (account_widget_checkbutton_toggled_cb),
208                                   account);
209         } else {
210                 DEBUG ("Unknown type of widget for param %s", param_name);
211         }
212 }
213
214 static gchar *
215 account_widget_generic_format_param_name (const gchar *param_name)
216 {
217         gchar *str;
218         gchar *p;
219
220         str = g_strdup (param_name);
221
222         if (str && g_ascii_isalpha (str[0])) {
223                 str[0] = g_ascii_toupper (str[0]);
224         }
225
226         while ((p = strchr (str, '-')) != NULL) {
227                 if (p[1] != '\0' && g_ascii_isalpha (p[1])) {
228                         p[0] = ' ';
229                         p[1] = g_ascii_toupper (p[1]);
230                 }
231
232                 p++;
233         }
234
235         return str;
236 }
237
238 static void
239 accounts_widget_generic_setup (EmpathyAccount *account,
240                                TpConnectionManagerParam *params,
241                                GtkWidget *table_common_settings,
242                                GtkWidget *table_advanced_settings)
243 {
244         TpConnectionManagerParam *param;
245
246         for (param = params; param != NULL; param++) {
247                 GtkWidget       *table_settings;
248                 guint            n_rows = 0;
249                 GtkWidget       *widget = NULL;
250                 gchar           *param_name_formatted;
251
252                 if (param->flags & TP_CONN_MGR_PARAM_FLAG_REQUIRED) {
253                         table_settings = table_common_settings;
254                 } else {
255                         table_settings = table_advanced_settings;
256                 }
257                 param_name_formatted = account_widget_generic_format_param_name (param->name);
258                 g_object_get (table_settings, "n-rows", &n_rows, NULL);
259                 gtk_table_resize (GTK_TABLE (table_settings), ++n_rows, 2);
260
261                 if (param->dbus_signature[0] == 's') {
262                         gchar *str;
263
264                         str = g_strdup_printf (_("%s:"), param_name_formatted);
265                         widget = gtk_label_new (str);
266                         gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
267                         g_free (str);
268
269                         gtk_table_attach (GTK_TABLE (table_settings),
270                                           widget,
271                                           0, 1,
272                                           n_rows - 1, n_rows,
273                                           GTK_FILL, 0,
274                                           0, 0);
275                         gtk_widget_show (widget);
276
277                         widget = gtk_entry_new ();
278                         if (strcmp (param->name, "account") == 0) {
279                                 g_signal_connect (widget, "realize",
280                                         G_CALLBACK (gtk_widget_grab_focus),
281                                         NULL);
282                         }
283                         gtk_table_attach (GTK_TABLE (table_settings),
284                                           widget,
285                                           1, 2,
286                                           n_rows - 1, n_rows,
287                                           GTK_FILL | GTK_EXPAND, 0,
288                                           0, 0);
289                         gtk_widget_show (widget);
290                 }
291                 /* int types: ynqiuxt. double type is 'd' */
292                 else if (param->dbus_signature[0] == 'y' ||
293                          param->dbus_signature[0] == 'n' ||
294                          param->dbus_signature[0] == 'q' ||
295                          param->dbus_signature[0] == 'i' ||
296                          param->dbus_signature[0] == 'u' ||
297                          param->dbus_signature[0] == 'x' ||
298                          param->dbus_signature[0] == 't' ||
299                          param->dbus_signature[0] == 'd') {
300                         gchar   *str = NULL;
301                         gdouble  minint = 0;
302                         gdouble  maxint = 0;
303                         gdouble  step = 1;
304
305                         switch (param->dbus_signature[0]) {
306                         case 'y': minint = G_MININT8;  maxint = G_MAXINT8;   break;
307                         case 'n': minint = G_MININT16; maxint = G_MAXINT16;  break;
308                         case 'q': minint = 0;          maxint = G_MAXUINT16; break;
309                         case 'i': minint = G_MININT32; maxint = G_MAXINT32;  break;
310                         case 'u': minint = 0;          maxint = G_MAXUINT32; break;
311                         case 'x': minint = G_MININT64; maxint = G_MAXINT64;  break;
312                         case 't': minint = 0;          maxint = G_MAXUINT64; break;
313                         case 'd': minint = G_MININT32; maxint = G_MAXINT32; step = 0.1; break;
314                         }
315
316                         str = g_strdup_printf (_("%s:"), param_name_formatted);
317                         widget = gtk_label_new (str);
318                         gtk_misc_set_alignment (GTK_MISC (widget), 0, 0.5);
319                         g_free (str);
320
321                         gtk_table_attach (GTK_TABLE (table_settings),
322                                           widget,
323                                           0, 1,
324                                           n_rows - 1, n_rows,
325                                           GTK_FILL, 0,
326                                           0, 0);
327                         gtk_widget_show (widget);
328
329                         widget = gtk_spin_button_new_with_range (minint, maxint, step);
330                         gtk_table_attach (GTK_TABLE (table_settings),
331                                           widget,
332                                           1, 2,
333                                           n_rows - 1, n_rows,
334                                           GTK_FILL | GTK_EXPAND, 0,
335                                           0, 0);
336                         gtk_widget_show (widget);
337                 }
338                 else if (param->dbus_signature[0] == 'b') {
339                         widget = gtk_check_button_new_with_label (param_name_formatted);
340                         gtk_table_attach (GTK_TABLE (table_settings),
341                                           widget,
342                                           0, 2,
343                                           n_rows - 1, n_rows,
344                                           GTK_FILL | GTK_EXPAND, 0,
345                                           0, 0);
346                         gtk_widget_show (widget);
347                 } else {
348                         DEBUG ("Unknown signature for param %s: %s",
349                                 param_name_formatted, param->dbus_signature);
350                 }
351
352                 if (widget) {
353                         account_widget_setup_widget (widget, account, param->name);
354                 }
355
356                 g_free (param_name_formatted);
357         }
358 }
359
360 static void
361 account_widget_handle_params_valist (EmpathyAccount   *account,
362                                      GtkBuilder  *gui,
363                                      const gchar *first_widget,
364                                      va_list      args)
365 {
366         GObject *object;
367         const gchar *name;
368
369         for (name = first_widget; name; name = va_arg (args, const gchar *)) {
370                 const gchar *param_name;
371
372                 param_name = va_arg (args, const gchar *);
373                 object = gtk_builder_get_object (gui, name);
374
375                 if (!object) {
376                         g_warning ("Builder is missing object '%s'.", name);
377                         continue;
378                 }
379
380                 account_widget_setup_widget (GTK_WIDGET (object), account, param_name);
381         }
382 }
383
384 void
385 empathy_account_widget_handle_params (EmpathyAccount   *account,
386                                       GtkBuilder  *gui,
387                                       const gchar *first_widget,
388                                       ...)
389 {
390         va_list args;
391
392         g_return_if_fail (GTK_IS_BUILDER (gui));
393
394         va_start (args, first_widget);
395         account_widget_handle_params_valist (account, gui, first_widget, args);
396         va_end (args);
397 }
398
399 void
400 empathy_account_widget_add_forget_button (EmpathyAccount   *account,
401                                           GtkBuilder  *gui,
402                                           const gchar *button,
403                                           const gchar *entry)
404 {
405         GtkWidget *button_forget;
406         GtkWidget *entry_password;
407         const gchar   *password = NULL;
408
409         button_forget = GTK_WIDGET (gtk_builder_get_object (gui, button));
410         entry_password = GTK_WIDGET (gtk_builder_get_object (gui, entry));
411
412         password = empathy_account_get_param_string (account, "password");
413         gtk_widget_set_sensitive (button_forget, !EMP_STR_EMPTY (password));
414
415         g_signal_connect (button_forget, "clicked",
416                           G_CALLBACK (account_widget_forget_clicked_cb),
417                           entry_password);
418         g_signal_connect (entry_password, "changed",
419                           G_CALLBACK (account_widget_password_changed_cb),
420                           button_forget);
421 }
422
423 void
424 empathy_account_widget_set_default_focus (GtkBuilder  *gui,
425                                           const gchar *entry)
426 {
427         GObject *default_focus_entry;
428
429         default_focus_entry = gtk_builder_get_object (gui, entry);
430         g_signal_connect (default_focus_entry, "realize",
431                           G_CALLBACK (gtk_widget_grab_focus),
432                           NULL);
433 }
434
435 static void
436 account_widget_tp_cm_ready_cb (TpConnectionManager *cm, const GError *error,
437                 gpointer user_data, GObject *weak_object)
438 {
439         GtkBuilder *builder;
440         EmpathyAccount *account;
441         GtkWidget *table_common_settings;
442         GtkWidget *table_advanced_settings;
443         const TpConnectionManagerProtocol *protocol;
444
445         if (error != NULL) {
446                 DEBUG ("CM wasn't happy: %s", error->message);
447                 return;
448         }
449
450         account = EMPATHY_ACCOUNT (user_data);
451         builder = GTK_BUILDER (weak_object);
452
453         table_common_settings = GTK_WIDGET (gtk_builder_get_object (builder,
454                 "table_common_settings"));
455         table_advanced_settings = GTK_WIDGET (gtk_builder_get_object (builder,
456                 "table_advanced_settings"));
457
458         protocol = tp_connection_manager_get_protocol (cm,
459                 empathy_account_get_protocol (account));
460
461         accounts_widget_generic_setup (account, protocol->params,
462                 table_common_settings, table_advanced_settings);
463 }
464
465 GtkWidget *
466 empathy_account_widget_generic_new (EmpathyAccount *account)
467 {
468         GtkBuilder *gui;
469         GtkWidget *widget;
470         gchar     *filename;
471
472         filename = empathy_file_lookup ("empathy-account-widget-generic.ui",
473                                         "libempathy-gtk");
474         gui = empathy_builder_get_file (filename,
475                                         "vbox_generic_settings", &widget,
476                                         NULL);
477
478         /* If the profile isn't installed get_protocol will return NULL with MC4 */
479         if (empathy_account_get_protocol (account) != NULL) {
480                 TpDBusDaemon *dbus;
481                 TpConnectionManager *cm;
482                 GError *error;
483
484                 dbus = tp_dbus_daemon_dup (NULL);
485
486                 cm = tp_connection_manager_new (dbus,
487                         empathy_account_get_connection_manager (account), NULL, &error);
488
489                 if (cm == NULL) {
490                         DEBUG ("failed to get the cm: %s", error->message);
491                         g_error_free (error);
492                         g_object_unref (gui);
493                         return NULL;
494                 }
495
496                 tp_connection_manager_call_when_ready (cm, account_widget_tp_cm_ready_cb,
497                         account, g_object_unref, G_OBJECT (gui));
498
499                 g_object_unref (dbus);
500         } else {
501                 /* no protocol information available :(( */
502                 return empathy_builder_unref_and_keep_widget (gui, widget);
503         }
504
505         return g_object_ref (widget);
506 }
507
508 GtkWidget *
509 empathy_account_widget_salut_new (EmpathyAccount *account)
510 {
511         GtkBuilder *gui;
512         GtkWidget *widget;
513         gchar     *filename;
514
515         filename = empathy_file_lookup ("empathy-account-widget-salut.ui",
516                                         "libempathy-gtk");
517         gui = empathy_builder_get_file (filename,
518                                         "vbox_salut_settings", &widget,
519                                         NULL);
520         g_free (filename);
521
522         empathy_account_widget_handle_params (account, gui,
523                         "entry_published", "published-name",
524                         "entry_nickname", "nickname",
525                         "entry_first_name", "first-name",
526                         "entry_last_name", "last-name",
527                         "entry_email", "email",
528                         "entry_jid", "jid",
529                         NULL);
530
531         empathy_account_widget_set_default_focus (gui, "entry_nickname");
532
533         return empathy_builder_unref_and_keep_widget (gui, widget);
534 }
535
536 GtkWidget *
537 empathy_account_widget_msn_new (EmpathyAccount *account)
538 {
539         GtkBuilder *gui;
540         GtkWidget *widget;
541         gchar     *filename;
542
543         filename = empathy_file_lookup ("empathy-account-widget-msn.ui",
544                                         "libempathy-gtk");
545         gui = empathy_builder_get_file (filename,
546                                         "vbox_msn_settings", &widget,
547                                         NULL);
548         g_free (filename);
549
550         empathy_account_widget_handle_params (account, gui,
551                         "entry_id", "account",
552                         "entry_password", "password",
553                         "entry_server", "server",
554                         "spinbutton_port", "port",
555                         NULL);
556
557         empathy_account_widget_add_forget_button (account, gui,
558                                                   "button_forget",
559                                                   "entry_password");
560
561         empathy_account_widget_set_default_focus (gui, "entry_id");
562
563         return empathy_builder_unref_and_keep_widget (gui, widget);
564 }
565
566 GtkWidget *
567 empathy_account_widget_jabber_new (EmpathyAccount *account)
568 {
569         GtkBuilder *gui;
570         GtkWidget *widget;
571         GtkWidget *spinbutton_port;
572         GtkWidget *checkbutton_ssl;
573         gchar     *filename;
574
575         filename = empathy_file_lookup ("empathy-account-widget-jabber.ui",
576                                         "libempathy-gtk");
577         gui = empathy_builder_get_file (filename,
578                                         "vbox_jabber_settings", &widget,
579                                         "spinbutton_port", &spinbutton_port,
580                                         "checkbutton_ssl", &checkbutton_ssl,
581                                         NULL);
582         g_free (filename);
583
584         empathy_account_widget_handle_params (account, gui,
585                         "entry_id", "account",
586                         "entry_password", "password",
587                         "entry_resource", "resource",
588                         "entry_server", "server",
589                         "spinbutton_port", "port",
590                         "spinbutton_priority", "priority",
591                         "checkbutton_ssl", "old-ssl",
592                         "checkbutton_ignore_ssl_errors", "ignore-ssl-errors",
593                         "checkbutton_encryption", "require-encryption",
594                         NULL);
595
596         empathy_account_widget_add_forget_button (account, gui,
597                                                   "button_forget",
598                                                   "entry_password");
599
600         empathy_account_widget_set_default_focus (gui, "entry_id");
601
602         g_signal_connect (checkbutton_ssl, "toggled",
603                           G_CALLBACK (account_widget_jabber_ssl_toggled_cb),
604                           spinbutton_port);
605
606         return empathy_builder_unref_and_keep_widget (gui, widget);
607 }
608
609 GtkWidget *
610 empathy_account_widget_icq_new (EmpathyAccount *account)
611 {
612         GtkBuilder *gui;
613         GtkWidget *widget;
614         GtkWidget *spinbutton_port;
615         gchar     *filename;
616
617         filename = empathy_file_lookup ("empathy-account-widget-icq.ui",
618                                         "libempathy-gtk");
619         gui = empathy_builder_get_file (filename,
620                                         "vbox_icq_settings", &widget,
621                                         "spinbutton_port", &spinbutton_port,
622                                         NULL);
623         g_free (filename);
624
625         empathy_account_widget_handle_params (account, gui,
626                         "entry_uin", "account",
627                         "entry_password", "password",
628                         "entry_server", "server",
629                         "spinbutton_port", "port",
630                         "entry_charset", "charset",
631                         NULL);
632
633         empathy_account_widget_add_forget_button (account, gui,
634                                                   "button_forget",
635                                                   "entry_password");
636
637         empathy_account_widget_set_default_focus (gui, "entry_uin");
638
639         return empathy_builder_unref_and_keep_widget (gui, widget);
640 }
641
642 GtkWidget *
643 empathy_account_widget_aim_new (EmpathyAccount *account)
644 {
645         GtkBuilder *gui;
646         GtkWidget *widget;
647         GtkWidget *spinbutton_port;
648         gchar     *filename;
649
650         filename = empathy_file_lookup ("empathy-account-widget-aim.ui",
651                                         "libempathy-gtk");
652         gui = empathy_builder_get_file (filename,
653                                         "vbox_aim_settings", &widget,
654                                         "spinbutton_port", &spinbutton_port,
655                                         NULL);
656         g_free (filename);
657
658         empathy_account_widget_handle_params (account, gui,
659                         "entry_screenname", "account",
660                         "entry_password", "password",
661                         "entry_server", "server",
662                         "spinbutton_port", "port",
663                         NULL);
664
665         empathy_account_widget_add_forget_button (account, gui,
666                                                   "button_forget",
667                                                   "entry_password");
668
669         empathy_account_widget_set_default_focus (gui, "entry_screenname");
670
671         return empathy_builder_unref_and_keep_widget (gui, widget);
672 }
673
674 GtkWidget *
675 empathy_account_widget_yahoo_new (EmpathyAccount *account)
676 {
677         GtkBuilder *gui;
678         GtkWidget *widget;
679         gchar     *filename;
680
681         filename = empathy_file_lookup ("empathy-account-widget-yahoo.ui",
682                                         "libempathy-gtk");
683         gui = empathy_builder_get_file (filename,
684                                         "vbox_yahoo_settings", &widget,
685                                         NULL);
686         g_free (filename);
687
688         empathy_account_widget_handle_params (account, gui,
689                         "entry_id", "account",
690                         "entry_password", "password",
691                         "entry_server", "server",
692                         "entry_locale", "room-list-locale",
693                         "entry_charset", "charset",
694                         "spinbutton_port", "port",
695                         "checkbutton_yahoojp", "yahoojp",
696                         "checkbutton_ignore_invites", "ignore-invites",
697                         NULL);
698
699         empathy_account_widget_add_forget_button (account, gui,
700                                                   "button_forget",
701                                                   "entry_password");
702
703         empathy_account_widget_set_default_focus (gui, "entry_id");
704
705         return empathy_builder_unref_and_keep_widget (gui, widget);
706 }
707
708 GtkWidget *
709 empathy_account_widget_groupwise_new (EmpathyAccount *account)
710 {
711         GtkBuilder *gui;
712         GtkWidget *widget;
713         gchar     *filename;
714
715         filename = empathy_file_lookup ("empathy-account-widget-groupwise.ui",
716                                         "libempathy-gtk");
717         gui = empathy_builder_get_file (filename,
718                                         "vbox_groupwise_settings", &widget,
719                                         NULL);
720         g_free (filename);
721
722         empathy_account_widget_handle_params (account, gui,
723                         "entry_id", "account",
724                         "entry_password", "password",
725                         "entry_server", "server",
726                         "spinbutton_port", "port",
727                         NULL);
728
729         empathy_account_widget_add_forget_button (account, gui,
730                                                   "button_forget",
731                                                   "entry_password");
732
733         empathy_account_widget_set_default_focus (gui, "entry_id");
734
735         return empathy_builder_unref_and_keep_widget (gui, widget);
736 }
737