preferencesdialog.c 18 KB
Newer Older
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
1
2
/*
 *  Copyright (C) 2007 Savoir-Faire Linux inc.
3
 *  Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
4
 *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
5
 *  Author: Guillaume Carmel-Archambault <guillaume.carmel-archambault@savoirfairelinux.com>
6
 *  Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com>
Julien Bonjean's avatar
Julien Bonjean committed
7
 *
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
8
9
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
10
 *  the Free Software Foundation; either version 3 of the License, or
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
11
 *  (at your option) any later version.
Julien Bonjean's avatar
Julien Bonjean committed
12
 *
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
13
14
15
16
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
Julien Bonjean's avatar
Julien Bonjean committed
17
 *
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
18
19
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
20
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
21
 */
22

23
24
#include <gtk/gtk.h>

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
25
#include <accountlist.h>
26
#include <accountconfigdialog.h>
27
#include <actions.h>
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
28
#include <config.h>
29
#include <dbus/dbus.h>
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
30
#include <mainwindow.h>
31
#include <audioconf.h>
Emmanuel Milou's avatar
Emmanuel Milou committed
32
#include <addressbook-config.h>
33
#include <hooks-config.h>
34
#include <utils.h>
35

36
#include <stdlib.h>
37
#include <stdio.h>
38
#include <string.h>
39

40
41
42
/**
 * Local variables
 */
43
gboolean accDialogOpen = FALSE;
44
gboolean dialogOpen = FALSE;
45
gboolean ringtoneEnabled = TRUE;
46

47
GtkWidget * applyButton;
48
GtkWidget * history_value;
49

50
GtkWidget * status;
51

52
53
54
static int history_limit;
static gboolean history_enabled = TRUE;

55
56
57
// Mail notification
GtkWidget * widg;

58
GHashTable * directIpCallsProperties = NULL;
59

60
static void update_port_cb ( GtkSpinButton *button UNUSED, void *ptr )
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
61
{
62
    dbus_set_sip_port(gtk_spin_button_get_value_as_int((GtkSpinButton *)(ptr)));
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
63
64
}

65

66
67
68
69
70
71
72
73
static void
set_md5_hash_cb(GtkWidget *widget UNUSED, gpointer data UNUSED)
{
    gboolean enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
    dbus_set_md5_credential_hashing(enabled);
}

static void
Emmanuel Milou's avatar
Emmanuel Milou committed
74
75
start_hidden( void )
{
76
    dbus_start_hidden();
Emmanuel Milou's avatar
Emmanuel Milou committed
77
78
}

79
static void
80
81
set_popup_mode( void )
{
82
    dbus_switch_popup_mode();
83
84
}

85

86
    void
87
88
set_notif_level(  )
{
89
    dbus_set_notify();
90
91
92
93
94
95
96
97

    if (dbus_get_notify())
      gtk_widget_set_sensitive(widg, TRUE);
    else {
      gtk_widget_set_sensitive(widg, FALSE);
      if (dbus_get_mail_notify())
        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(widg), FALSE);
    }
98
99
}

100
    void
101
102
set_mail_notif( )
{
103
    dbus_set_mail_notify( );
104
}
105
106

static void history_limit_cb (GtkSpinButton *button, void *ptr)
107
{
108
    history_limit = gtk_spin_button_get_value_as_int((GtkSpinButton *)(ptr));
109
}
110
111

static void history_enabled_cb (GtkWidget *widget)
112
{
113
114
    history_enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
    gtk_widget_set_sensitive (GTK_WIDGET (history_value), history_enabled);
115
116
117
        
    // Toggle it through D-Bus
    dbus_set_history_enabled ();
118
}
119
120
    
	void
Emmanuel Milou's avatar
Emmanuel Milou committed
121
122
clean_history( void )
{
Julien Bonjean's avatar
Julien Bonjean committed
123
    calllist_clean_history();
Emmanuel Milou's avatar
Emmanuel Milou committed
124
125
}

126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
static void show_advanced_zrtp_options_cb(GtkWidget *widget UNUSED, gpointer data)
{
    DEBUG("Advanced options for ZRTP");
    show_advanced_zrtp_options((GHashTable *) data);
}

static void show_advanced_tls_options_cb(GtkWidget *widget UNUSED, gpointer data)
{
    DEBUG("Advanced options for TLS");
    show_advanced_tls_options((GHashTable *) data);
}

static void key_exchange_changed_cb(GtkWidget *widget, gpointer data)
{
    DEBUG("Key exchange changed");
    if (g_strcasecmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(widget)), (gchar *) "ZRTP") == 0) {
        gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE);
143
	g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("true"));
144
145
146
147
        g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(ZRTP));
    } else {
        gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE);
        DEBUG("Setting key exchange %s to %s\n", ACCOUNT_KEY_EXCHANGE, KEY_EXCHANGE_NONE);
148
	g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_SRTP_ENABLED), g_strdup("false"));
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
        g_hash_table_replace(directIpCallsProperties, g_strdup(ACCOUNT_KEY_EXCHANGE), g_strdup(KEY_EXCHANGE_NONE));
    }
}

static void use_sip_tls_cb(GtkWidget *widget, gpointer data)
{
    if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
        DEBUG("Using sips");
    	gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE);  
        g_hash_table_replace(directIpCallsProperties,
				g_strdup(TLS_ENABLE), g_strdup("true"));    	          
    } else {
        gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE);
        g_hash_table_replace(directIpCallsProperties,
				g_strdup(TLS_ENABLE), g_strdup("false"));             
    }   
}

GtkWidget* create_direct_ip_calls_tab()
{
    GtkWidget * frame;
    GtkWidget * table;
    GtkWidget * label;
    GtkWidget * explanationLabel;
    GtkWidget * keyExchangeCombo;
    GtkWidget * advancedZrtpButton;
    GtkWidget * useSipTlsCheckBox;    
    
    gchar * curSRTPEnabled = "false";
    gchar * curTlsEnabled = "false";    
    gchar * curKeyExchange = "0";
    gchar * description;
   
    directIpCallsProperties = sflphone_get_ip2ip_properties();
              
    if(directIpCallsProperties != NULL) {
185
	DEBUG("got a directIpCallsProperties");
186
        curSRTPEnabled = g_hash_table_lookup(directIpCallsProperties, ACCOUNT_SRTP_ENABLED);
187
	DEBUG("    curSRTPEnabled = %s", curSRTPEnabled);
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
        curKeyExchange = g_hash_table_lookup(directIpCallsProperties, ACCOUNT_KEY_EXCHANGE);
        curTlsEnabled = g_hash_table_lookup(directIpCallsProperties, TLS_ENABLE);        
    }
                
	GtkWidget * vbox = gtk_vbox_new(FALSE, 10);
    gtk_container_set_border_width(GTK_CONTAINER(vbox), 10);

    description = g_markup_printf_escaped(_("This profile is used when you want to reach a remote peer simply by typing a sip URI such as <b>sip:remotepeer</b>. The settings you define here will also be used if no account can be matched to an incoming or outgoing call."));
    explanationLabel = gtk_label_new(NULL);
    gtk_label_set_markup(GTK_LABEL(explanationLabel), description);
 	gtk_misc_set_alignment(GTK_MISC(explanationLabel), 0, 0.5);    
    gtk_box_pack_start(GTK_BOX(vbox), explanationLabel, FALSE, FALSE, 0);

    gnome_main_section_new_with_table (_("Security"), &frame, &table, 2, 3);
	gtk_container_set_border_width (GTK_CONTAINER(table), 10);
	gtk_table_set_row_spacings (GTK_TABLE(table), 10);
    gtk_table_set_col_spacings( GTK_TABLE(table), 10);
    gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 0);

	GtkWidget * sipTlsAdvancedButton;
	sipTlsAdvancedButton = gtk_button_new_from_stock(GTK_STOCK_EDIT);
    gtk_table_attach_defaults(GTK_TABLE(table), sipTlsAdvancedButton, 2, 3, 0, 1);
	gtk_widget_set_sensitive(GTK_WIDGET(sipTlsAdvancedButton), FALSE);    
    g_signal_connect(G_OBJECT(sipTlsAdvancedButton), "clicked", G_CALLBACK(show_advanced_tls_options_cb), directIpCallsProperties);
    
	useSipTlsCheckBox = gtk_check_button_new_with_mnemonic(_("Use TLS transport (sips)"));
	g_signal_connect (useSipTlsCheckBox, "toggled", G_CALLBACK(use_sip_tls_cb), sipTlsAdvancedButton);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(useSipTlsCheckBox), (g_strcmp0(curTlsEnabled, "false") == 0) ? FALSE:TRUE);
	gtk_table_attach_defaults(GTK_TABLE(table), useSipTlsCheckBox, 0, 2, 0, 1);
       	    
    label = gtk_label_new_with_mnemonic (_("SRTP key exchange"));
 	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
    keyExchangeCombo = gtk_combo_box_new_text();
    gtk_label_set_mnemonic_widget (GTK_LABEL (label), keyExchangeCombo);
    gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "ZRTP");
    //gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), "SDES");
    gtk_combo_box_append_text(GTK_COMBO_BOX(keyExchangeCombo), _("Disabled"));      
    
    advancedZrtpButton = gtk_button_new_from_stock(GTK_STOCK_PREFERENCES);
    g_signal_connect(G_OBJECT(advancedZrtpButton), "clicked", G_CALLBACK(show_advanced_zrtp_options_cb), directIpCallsProperties);
    
    if (g_strcasecmp(curKeyExchange, ZRTP) == 0) {
        gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo),0);
    } else {
        gtk_combo_box_set_active(GTK_COMBO_BOX(keyExchangeCombo), 1);
        gtk_widget_set_sensitive(GTK_WIDGET(advancedZrtpButton), FALSE);
    }
    
	g_signal_connect (G_OBJECT (GTK_COMBO_BOX(keyExchangeCombo)), "changed", G_CALLBACK (key_exchange_changed_cb), advancedZrtpButton);
    
    gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 1, 2);
    gtk_table_attach_defaults(GTK_TABLE(table), keyExchangeCombo, 1, 2, 1, 2);    
    gtk_table_attach_defaults(GTK_TABLE(table), advancedZrtpButton, 2, 3, 1, 2);
    
    gtk_widget_show_all(table);
        
    GtkRequisition requisition;
    gtk_widget_size_request(GTK_WIDGET(table), &requisition);
    gtk_widget_set_size_request(GTK_WIDGET(explanationLabel), requisition.width * 1.5, -1);        
    gtk_label_set_line_wrap(GTK_LABEL(explanationLabel), TRUE);
    
    gtk_widget_show_all(vbox);
    
    return vbox;
}

254
GtkWidget* create_network_tab()
255
{
256
257
258
    GtkWidget * frame;
    GtkWidget * table;
    GtkWidget * label;
259
    GtkWidget * ret;
260
    gchar * description;
261

262
263
264
    ret = gtk_vbox_new(FALSE, 10);
    gtk_container_set_border_width(GTK_CONTAINER(ret), 10);

265
266
267
268
269
270
271
272
273
274
275
276
    /** SIP port information */
    int curPort = dbus_get_sip_port();
    if(curPort <= 0 || curPort > 65535) {
        curPort = 5060; 
    }
    
    int account_number = account_list_get_sip_account_number();
    DEBUG("sip account number = %i", account_number);
    
    gnome_main_section_new_with_table (_("SIP Port"), &frame, &table, 1, 3);
    gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);
    gtk_widget_set_sensitive(GTK_WIDGET(frame),(account_number == 0) ? FALSE:TRUE);
277

278
279
280
    GtkWidget *applySipPortButton = gtk_button_new_from_stock(GTK_STOCK_APPLY);
    GtkWidget *entryPort; 
    
281
282
    label = gtk_label_new(_("UDP Transport"));
 	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
283
284
285
286
    entryPort = gtk_spin_button_new_with_range(1, 65535, 1);
    gtk_label_set_mnemonic_widget (GTK_LABEL (label), entryPort);
    gtk_spin_button_set_value(GTK_SPIN_BUTTON(entryPort), curPort);
    g_signal_connect( G_OBJECT( applySipPortButton) , "clicked" , G_CALLBACK( update_port_cb ) , entryPort);
287

288
289
290
291
    gtk_table_attach( GTK_TABLE(table), label, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5);
    gtk_table_attach( GTK_TABLE(table), entryPort, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5);
    gtk_table_attach( GTK_TABLE(table), applySipPortButton, 2, 3, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5);
    
292
    gtk_widget_show_all(ret);
293

294
    return ret;
295
296
297
}

    GtkWidget*
Emmanuel Milou's avatar
Emmanuel Milou committed
298
299
create_general_settings ()
{
Emmanuel Milou's avatar
Emmanuel Milou committed
300

301
302
303
    GtkWidget *ret;

    GtkWidget *notifAll;
304

305
306
    GtkWidget *trayItem;
    GtkWidget *frame;
307
    GtkWidget *checkBoxWidget;
308
    GtkWidget *label;
309
    GtkWidget *table;
310

311
312
313
    // Load history configuration
    history_load_configuration ();

314
315
316
317
318
    // Main widget
    ret = gtk_vbox_new(FALSE, 10);
    gtk_container_set_border_width(GTK_CONTAINER(ret), 10);

    // Notifications Frame
319
    gnome_main_section_new_with_table (_("Desktop Notifications"), &frame, &table, 2, 1);
320
    gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);
321

322
    // Notification All
323
    notifAll = gtk_check_button_new_with_mnemonic( _("_Enable notifications"));
324
    gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(notifAll), dbus_get_notify() ); 
325
    g_signal_connect(G_OBJECT( notifAll ) , "clicked" , G_CALLBACK( set_notif_level ) , NULL );
326
327
    gtk_table_attach( GTK_TABLE(table), notifAll, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5);

328
    // Notification
329
    widg = gtk_check_button_new_with_mnemonic(  _("Enable voicemail _notifications"));
330
331
    gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(widg), dbus_get_mail_notify() );
    g_signal_connect(G_OBJECT( widg ) , "clicked" , G_CALLBACK( set_mail_notif ) , NULL);
332
333
    gtk_table_attach( GTK_TABLE(table), widg, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5);
    
334

335
336
337
338
339
    if (dbus_get_notify())
       gtk_widget_set_sensitive(widg, TRUE);
    else
       gtk_widget_set_sensitive(widg, FALSE);

340
    // System Tray option frame
341
    gnome_main_section_new_with_table (_("System Tray Icon"), &frame, &table, 3, 1);
342
    gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);
343
344
345

    GtkWidget* trayItem1 = gtk_radio_button_new_with_mnemonic(NULL,  _("_Popup main window on incoming call"));
    gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(trayItem1), dbus_popup_mode() );
346
347
    g_signal_connect(G_OBJECT( trayItem1 ), "clicked", G_CALLBACK( set_popup_mode ) , NULL);
    gtk_table_attach( GTK_TABLE(table), trayItem1, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5);
348
349
350

    trayItem = gtk_radio_button_new_with_mnemonic_from_widget(GTK_RADIO_BUTTON(trayItem1), _("Ne_ver popup main window"));
    gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(trayItem), !dbus_popup_mode() );
351
    gtk_table_attach( GTK_TABLE(table), trayItem, 0, 1, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5);
352

353
    trayItem = gtk_check_button_new_with_mnemonic(_("Hide SFLphone window on _startup"));
354
355
    gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(trayItem), dbus_is_start_hidden() );
    g_signal_connect(G_OBJECT( trayItem ) , "clicked" , G_CALLBACK( start_hidden ) , NULL);
356
    gtk_table_attach( GTK_TABLE(table), trayItem, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5);
357

358
    // HISTORY CONFIGURATION
359
    gnome_main_section_new_with_table (_("Calls History"), &frame, &table, 3, 1);
360
361
    gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);

362
363
364
365
    checkBoxWidget = gtk_check_button_new_with_mnemonic(_("_Keep my history for at least"));
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkBoxWidget), history_enabled);
    g_signal_connect (G_OBJECT (checkBoxWidget) , "clicked" , G_CALLBACK (history_enabled_cb) , NULL);
    gtk_table_attach( GTK_TABLE(table), checkBoxWidget, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5);
366
    
367
368
369
    history_value = gtk_spin_button_new_with_range(1, 99, 1);
    gtk_spin_button_set_value (GTK_SPIN_BUTTON(history_value), history_limit);
    g_signal_connect( G_OBJECT (history_value) , "value-changed" , G_CALLBACK (history_limit_cb) , history_value);
370
    gtk_widget_set_sensitive (GTK_WIDGET (history_value), gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkBoxWidget)));
371
372
    gtk_table_attach( GTK_TABLE(table), history_value, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5); 

Jérémy Quentin's avatar
Jérémy Quentin committed
373
    label = gtk_label_new(_("days"));
374
    gtk_table_attach( GTK_TABLE(table), label, 2, 3, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5);
375
376
377
378
379
380
381
382
383
  
    // Configuration File
    gnome_main_section_new_with_table (_("Configuration File"), &frame, &table, 1, 1);
    gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);    
    checkBoxWidget = gtk_check_button_new_with_mnemonic(_("Store SIP credentials as MD5 hash"));
    gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(checkBoxWidget), dbus_is_md5_credential_hashing() );
    g_signal_connect(G_OBJECT( checkBoxWidget ) , "clicked" , G_CALLBACK(set_md5_hash_cb) , NULL);
    gtk_table_attach( GTK_TABLE(table), checkBoxWidget, 0, 1, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 5);
              
384
385
386
387
388
    gtk_widget_show_all(ret);

    return ret;
}

389
void save_configuration_parameters (void) {
390

391
    // Address book config
392
393
394
    addressbook_config_save_parameters ();
    hooks_save_parameters ();

395
396
    // History config
    dbus_set_history_limit (history_limit);
397
398
399
    
    // Direct IP calls config
    dbus_set_ip2ip_details(directIpCallsProperties);
400
}
401

402
403
404
405
void history_load_configuration ()
{
    history_limit = dbus_get_history_limit ();
    history_enabled = TRUE;
406
    if (g_strcasecmp (dbus_get_history_enabled (), "false") == 0)
407
408
409
        history_enabled = FALSE;
}

410
411
412
/**
 * Show configuration window with tabs
 */
413
    void
414
show_preferences_dialog ()
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
415
{
416
417
418
    GtkDialog * dialog;
    GtkWidget * notebook;
    GtkWidget * tab;
Emmanuel Milou's avatar
Emmanuel Milou committed
419
    guint result;
420

421
422
423
424
425
426
427
428
429
430
431
    dialogOpen = TRUE;

    dialog = GTK_DIALOG(gtk_dialog_new_with_buttons (_("Preferences"),
                GTK_WINDOW(get_main_window()),
                GTK_DIALOG_DESTROY_WITH_PARENT,
                GTK_STOCK_CLOSE,
                GTK_RESPONSE_ACCEPT,
                NULL));

    // Set window properties
    gtk_dialog_set_has_separator(dialog, FALSE);
432
    gtk_window_set_default_size(GTK_WINDOW(dialog), 600, 400);
433
    gtk_container_set_border_width(GTK_CONTAINER(dialog), 0);
434

435
436
437
438
439
    // Create tabs container
    notebook = gtk_notebook_new();
    gtk_box_pack_start(GTK_BOX (dialog->vbox), notebook, TRUE, TRUE, 0);
    gtk_container_set_border_width(GTK_CONTAINER(notebook), 10);
    gtk_widget_show(notebook);
440

441
442
    // General settings tab
    tab = create_general_settings();
443
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("General")));
444
    gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab);
445

446
    // Audio tab
Julien Bonjean's avatar
Julien Bonjean committed
447
    tab = create_audio_configuration();
448
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Audio")));
449
    gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab);
450

Emmanuel Milou's avatar
Emmanuel Milou committed
451
    // Addressbook tab
Julien Bonjean's avatar
Julien Bonjean committed
452
    tab = create_addressbook_settings();
Emmanuel Milou's avatar
Emmanuel Milou committed
453
454
455
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Address Book")));
    gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab);

456
    // HookS tab
Julien Bonjean's avatar
Julien Bonjean committed
457
    tab = create_hooks_settings();
458
459
460
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Hooks")));
    gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab);

461
    // Network tab
462
    tab = create_network_tab();
463
464
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Network")));
    gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab);
465
466
467
468
469
470

    // Direct IP calls tab
    tab = create_direct_ip_calls_tab();
    gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new(_("Direct IP calls")));
    gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab);
        
471
    gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook) ,  0);
472

Emmanuel Milou's avatar
Emmanuel Milou committed
473
474
475
    result = gtk_dialog_run(dialog);

    save_configuration_parameters ();
476
    toolbar_update_buttons();
477

478
    dialogOpen = FALSE;
479

480
481
    gtk_widget_destroy(GTK_WIDGET(dialog));
}
482