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