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-sip.h"
35 #include "empathy-ui-utils.h"
38 EmpathyAccount *account;
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_object_unref (settings->account);
52 g_slice_free (EmpathyAccountWidgetSip, settings);
56 account_widget_sip_discover_stun_toggled_cb (
58 EmpathyAccountWidgetSip *settings)
62 active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
63 gtk_widget_set_sensitive (settings->entry_stun_server, !active);
64 gtk_widget_set_sensitive (settings->spinbutton_stun_part, !active);
68 * empathy_account_widget_sip_new:
69 * @account: the #EmpathyAccount to configure
71 * Creates a new SIP account widget to configure a given #EmpathyAccount
73 * Returns: The toplevel container of the configuration widget
76 empathy_account_widget_sip_new (EmpathyAccount *account)
78 EmpathyAccountWidgetSip *settings;
82 settings = g_slice_new0 (EmpathyAccountWidgetSip);
83 settings->account = g_object_ref (account);
85 filename = empathy_file_lookup ("empathy-account-widget-sip.ui",
87 gui = empathy_builder_get_file (filename,
88 "vbox_sip_settings", &settings->vbox_settings,
89 "entry_stun-server", &settings->entry_stun_server,
90 "spinbutton_stun-port", &settings->spinbutton_stun_part,
91 "checkbutton_discover-stun", &settings->checkbutton_discover_stun,
95 empathy_account_widget_handle_params (account, gui,
96 "entry_userid", "account",
97 "entry_password", "password",
98 "checkbutton_discover-stun", "discover-stun",
99 "entry_stun-server", "stun-server",
100 "spinbutton_stun-port", "stun-port",
103 empathy_account_widget_add_forget_button (account, gui,
107 account_widget_sip_discover_stun_toggled_cb (settings->checkbutton_discover_stun,
110 empathy_builder_connect (gui, settings,
111 "vbox_sip_settings", "destroy", account_widget_sip_destroy_cb,
112 "checkbutton_discover-stun", "toggled", account_widget_sip_discover_stun_toggled_cb,
115 empathy_account_widget_set_default_focus (gui, "entry_userid");
117 return empathy_builder_unref_and_keep_widget (gui, settings->vbox_settings);