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.h>
30 #include <glade/glade.h>
32 #include <libmissioncontrol/mc-account.h>
33 #include <libmissioncontrol/mc-protocol.h>
35 #include <libempathy/empathy-utils.h>
36 #include <libempathy/empathy-debug.h>
38 #include "empathy-account-widget.h"
39 #include "empathy-account-widget-sip.h"
40 #include "empathy-ui-utils.h"
42 #define DEBUG_DOMAIN "AccountWidgetSIP"
47 GtkWidget *vbox_settings;
49 GtkWidget *entry_stun_server;
50 GtkWidget *spinbutton_stun_part;
51 GtkWidget *checkbutton_discover_stun;
52 } EmpathyAccountWidgetSip;
55 account_widget_sip_destroy_cb (GtkWidget *widget,
56 EmpathyAccountWidgetSip *settings)
58 g_object_unref (settings->account);
59 g_slice_free (EmpathyAccountWidgetSip, settings);
63 account_widget_sip_discover_stun_toggled_cb (
65 EmpathyAccountWidgetSip *settings)
67 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox))) {
68 gtk_widget_set_sensitive(settings->entry_stun_server, TRUE);
69 gtk_widget_set_sensitive(settings->spinbutton_stun_part, TRUE);
71 gtk_widget_set_sensitive(settings->entry_stun_server, FALSE);
72 gtk_widget_set_sensitive(settings->spinbutton_stun_part, FALSE);
77 * empathy_account_widget_sip_new:
78 * @account: the #McAccount to configure
80 * Creates a new SIP account widget to configure a given #McAccount
82 * Returns: The toplevel container of the configuration widget
85 empathy_account_widget_sip_new (McAccount *account)
87 EmpathyAccountWidgetSip *settings;
91 settings = g_slice_new0 (EmpathyAccountWidgetSip);
92 settings->account = g_object_ref (account);
94 filename = empathy_file_lookup ("empathy-account-widget-sip.glade",
96 glade = empathy_glade_get_file (filename,
99 "vbox_sip_settings", &settings->vbox_settings,
100 "entry_stun-server", &settings->entry_stun_server,
101 "spinbutton_stun-port", &settings->spinbutton_stun_part,
102 "checkbutton_discover-stun", &settings->checkbutton_discover_stun,
106 empathy_account_widget_handle_params (account, glade,
107 "entry_userid", "account",
108 "entry_password", "password",
109 "checkbutton_discover-stun", "discover-stun",
110 "entry_stun-server", "stun-server",
111 "spinbutton_stun-port", "stun-port",
114 empathy_account_widget_add_forget_button (account, glade,
118 account_widget_sip_discover_stun_toggled_cb (settings->checkbutton_discover_stun,
121 empathy_glade_connect (glade, settings,
122 "vbox_sip_settings", "destroy", account_widget_sip_destroy_cb,
123 "checkbutton_discover-stun", "toggled", account_widget_sip_discover_stun_toggled_cb,
126 g_object_unref (glade);
128 return settings->vbox_settings;