2 * Copyright (C) 2007-2008 Guillaume Desmottes
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 * Authors: Guillaume Desmottes <gdesmott@gnome.org>
19 * Frederic Peters <fpeters@0d.be>
28 #include <glib/gi18n-lib.h>
31 #include <libempathy/empathy-utils.h>
33 #include "empathy-account-widget.h"
34 #include "empathy-account-widget-private.h"
35 #include "empathy-account-widget-sip.h"
36 #include "empathy-ui-utils.h"
39 EmpathyAccountWidget *self;
40 GtkWidget *vbox_settings;
42 GtkWidget *entry_stun_server;
43 GtkWidget *spinbutton_stun_part;
44 GtkWidget *checkbutton_discover_stun;
45 } EmpathyAccountWidgetSip;
48 account_widget_sip_destroy_cb (GtkWidget *widget,
49 EmpathyAccountWidgetSip *settings)
51 g_slice_free (EmpathyAccountWidgetSip, settings);
55 account_widget_sip_discover_stun_toggled_cb (
57 EmpathyAccountWidgetSip *settings)
61 active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
62 gtk_widget_set_sensitive (settings->entry_stun_server, !active);
63 gtk_widget_set_sensitive (settings->spinbutton_stun_part, !active);
67 empathy_account_widget_sip_build (EmpathyAccountWidget *self,
69 GtkWidget **table_common_settings)
71 EmpathyAccountWidgetSip *settings;
72 GtkWidget *vbox_settings;
75 g_object_get (self, "simple", &is_simple, NULL);
79 self->ui_details->gui = empathy_builder_get_file (filename,
80 "vbox_sip_simple", &vbox_settings,
83 empathy_account_widget_handle_params (self,
84 "entry_userid_simple", "account",
85 "entry_password_simple", "password",
88 self->ui_details->default_focus = g_strdup ("entry_userid_simple");
92 settings = g_slice_new0 (EmpathyAccountWidgetSip);
93 settings->self = self;
95 self->ui_details->gui = empathy_builder_get_file (filename,
96 "table_common_settings", table_common_settings,
97 "vbox_sip_settings", &vbox_settings,
98 "entry_stun-server", &settings->entry_stun_server,
99 "spinbutton_stun-port", &settings->spinbutton_stun_part,
100 "checkbutton_discover-stun", &settings->checkbutton_discover_stun,
102 settings->vbox_settings = vbox_settings;
104 empathy_account_widget_handle_params (self,
105 "entry_userid", "account",
106 "entry_password", "password",
107 "checkbutton_discover-stun", "discover-stun",
108 "entry_stun-server", "stun-server",
109 "spinbutton_stun-port", "stun-port",
112 account_widget_sip_discover_stun_toggled_cb (
113 settings->checkbutton_discover_stun,
116 empathy_builder_connect (self->ui_details->gui, settings,
117 "vbox_sip_settings", "destroy", account_widget_sip_destroy_cb,
118 "checkbutton_discover-stun", "toggled",
119 account_widget_sip_discover_stun_toggled_cb,
122 self->ui_details->add_forget = TRUE;
123 self->ui_details->default_focus = g_strdup ("entry_userid");
126 self->ui_details->widget = vbox_settings;