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 <libmissioncontrol/mc-protocol.h>
33 #include <libempathy/empathy-utils.h>
35 #include "empathy-account-widget.h"
36 #include "empathy-account-widget-sip.h"
37 #include "empathy-ui-utils.h"
40 EmpathyAccount *account;
42 GtkWidget *vbox_settings;
44 GtkWidget *entry_stun_server;
45 GtkWidget *spinbutton_stun_part;
46 GtkWidget *checkbutton_discover_stun;
47 } EmpathyAccountWidgetSip;
50 account_widget_sip_destroy_cb (GtkWidget *widget,
51 EmpathyAccountWidgetSip *settings)
53 g_object_unref (settings->account);
54 g_slice_free (EmpathyAccountWidgetSip, settings);
58 account_widget_sip_discover_stun_toggled_cb (
60 EmpathyAccountWidgetSip *settings)
64 active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
65 gtk_widget_set_sensitive (settings->entry_stun_server, !active);
66 gtk_widget_set_sensitive (settings->spinbutton_stun_part, !active);
70 * empathy_account_widget_sip_new:
71 * @account: the #EmpathyAccount to configure
73 * Creates a new SIP account widget to configure a given #EmpathyAccount
75 * Returns: The toplevel container of the configuration widget
78 empathy_account_widget_sip_new (EmpathyAccount *account)
80 EmpathyAccountWidgetSip *settings;
84 settings = g_slice_new0 (EmpathyAccountWidgetSip);
85 settings->account = g_object_ref (account);
87 filename = empathy_file_lookup ("empathy-account-widget-sip.ui",
89 gui = empathy_builder_get_file (filename,
90 "vbox_sip_settings", &settings->vbox_settings,
91 "entry_stun-server", &settings->entry_stun_server,
92 "spinbutton_stun-port", &settings->spinbutton_stun_part,
93 "checkbutton_discover-stun", &settings->checkbutton_discover_stun,
97 empathy_account_widget_handle_params (account, gui,
98 "entry_userid", "account",
99 "entry_password", "password",
100 "checkbutton_discover-stun", "discover-stun",
101 "entry_stun-server", "stun-server",
102 "spinbutton_stun-port", "stun-port",
105 empathy_account_widget_add_forget_button (account, gui,
109 account_widget_sip_discover_stun_toggled_cb (settings->checkbutton_discover_stun,
112 empathy_builder_connect (gui, settings,
113 "vbox_sip_settings", "destroy", account_widget_sip_destroy_cb,
114 "checkbutton_discover-stun", "toggled", account_widget_sip_discover_stun_toggled_cb,
117 empathy_account_widget_set_default_focus (gui, "entry_userid");
119 return empathy_builder_unref_and_keep_widget (gui, settings->vbox_settings);