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>
30 #include <glade/glade.h>
32 #include <libmissioncontrol/mc-account.h>
33 #include <libmissioncontrol/mc-protocol.h>
35 #include <libempathy/empathy-utils.h>
37 #include "empathy-account-widget.h"
38 #include "empathy-account-widget-sip.h"
39 #include "empathy-ui-utils.h"
44 GtkWidget *vbox_settings;
46 GtkWidget *entry_stun_server;
47 GtkWidget *spinbutton_stun_part;
48 GtkWidget *checkbutton_discover_stun;
49 } EmpathyAccountWidgetSip;
52 account_widget_sip_destroy_cb (GtkWidget *widget,
53 EmpathyAccountWidgetSip *settings)
55 g_object_unref (settings->account);
56 g_slice_free (EmpathyAccountWidgetSip, settings);
60 account_widget_sip_discover_stun_toggled_cb (
62 EmpathyAccountWidgetSip *settings)
66 active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
67 gtk_widget_set_sensitive(settings->entry_stun_server, !active);
68 gtk_widget_set_sensitive(settings->spinbutton_stun_part, !active);
72 * empathy_account_widget_sip_new:
73 * @account: the #McAccount to configure
75 * Creates a new SIP account widget to configure a given #McAccount
77 * Returns: The toplevel container of the configuration widget
80 empathy_account_widget_sip_new (McAccount *account)
82 EmpathyAccountWidgetSip *settings;
86 settings = g_slice_new0 (EmpathyAccountWidgetSip);
87 settings->account = g_object_ref (account);
89 filename = empathy_file_lookup ("empathy-account-widget-sip.glade",
91 glade = empathy_glade_get_file (filename,
94 "vbox_sip_settings", &settings->vbox_settings,
95 "entry_stun-server", &settings->entry_stun_server,
96 "spinbutton_stun-port", &settings->spinbutton_stun_part,
97 "checkbutton_discover-stun", &settings->checkbutton_discover_stun,
101 empathy_account_widget_handle_params (account, glade,
102 "entry_userid", "account",
103 "entry_password", "password",
104 "checkbutton_discover-stun", "discover-stun",
105 "entry_stun-server", "stun-server",
106 "spinbutton_stun-port", "stun-port",
109 empathy_account_widget_add_forget_button (account, glade,
113 account_widget_sip_discover_stun_toggled_cb (settings->checkbutton_discover_stun,
116 empathy_glade_connect (glade, settings,
117 "vbox_sip_settings", "destroy", account_widget_sip_destroy_cb,
118 "checkbutton_discover-stun", "toggled", account_widget_sip_discover_stun_toggled_cb,
121 g_object_unref (glade);
123 return settings->vbox_settings;