~ubuntu-branches/ubuntu/saucy/sflphone/saucy

« back to all changes in this revision

Viewing changes to sflphone-client-gnome/src/config/zrtpadvanceddialog.c

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2010-12-24 16:33:55 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20101224163355-tkvvikqxbrbav6up
Tags: 0.9.11-1
* New upstream release
* Add new build dependencies on libwebkit-dev and libyaml-dev

* Bump Standards-Version up to 3.9.1
* Bump debhelper compatibility to 8
* Patch another typo in the upstream code (lintian notice)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *  Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010 Savoir-Faire Linux Inc.
3
3
 *  Author: Pierre-Luc Bacon <pierre-luc.bacon@savoirfairelinux.com>
4
 
 *                                                                              
 
4
 *
5
5
 *  This program is free software; you can redistribute it and/or modify
6
6
 *  it under the terms of the GNU General Public License as published by
7
7
 *  the Free Software Foundation; either version 3 of the License, or
8
8
 *  (at your option) any later version.
9
 
 *                                                                                
 
9
 *
10
10
 *  This program is distributed in the hope that it will be useful,
11
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
13
 *  GNU General Public License for more details.
14
 
 *                                                                              
 
14
 *
15
15
 *  You should have received a copy of the GNU General Public License
16
16
 *  along with this program; if not, write to the Free Software
17
17
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
34
34
 
35
35
#include <gtk/gtk.h>
36
36
 
37
 
void show_advanced_zrtp_options(GHashTable * properties)
 
37
void show_advanced_zrtp_options (GHashTable * properties)
38
38
{
39
39
    GtkDialog * securityDialog;
40
40
 
41
 
    GtkWidget * zrtpFrame;
42
41
    GtkWidget * tableZrtp;
43
42
    GtkWidget * enableHelloHash;
44
43
    GtkWidget * enableSASConfirm;
45
44
    GtkWidget * enableZrtpNotSuppOther;
46
45
    GtkWidget * displaySasOnce;
47
 
    
 
46
 
48
47
    gchar * curSasConfirm = "true";
49
48
    gchar * curHelloEnabled = "true";
50
49
    gchar * curZrtpNotSuppOther = "true";
51
50
    gchar * curDisplaySasOnce = "false";
52
 
    
53
 
    if(properties != NULL) {
54
 
        curHelloEnabled = g_hash_table_lookup(properties, ACCOUNT_ZRTP_HELLO_HASH);
55
 
        curSasConfirm = g_hash_table_lookup(properties, ACCOUNT_ZRTP_DISPLAY_SAS);
56
 
        curZrtpNotSuppOther = g_hash_table_lookup(properties, ACCOUNT_ZRTP_NOT_SUPP_WARNING);
57
 
        curDisplaySasOnce = g_hash_table_lookup(properties, ACCOUNT_DISPLAY_SAS_ONCE); 
58
 
    }
59
 
    
60
 
    securityDialog = GTK_DIALOG (gtk_dialog_new_with_buttons (  _("ZRTP Options"),
61
 
                            GTK_WINDOW (get_main_window()),
62
 
                                                                                                                                GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
63
 
                                                                                                                                GTK_STOCK_CANCEL,
64
 
                                                                                                                                GTK_RESPONSE_CANCEL,
65
 
                                                                                                                                GTK_STOCK_SAVE,
66
 
                                                                                                                                GTK_RESPONSE_ACCEPT,
67
 
                                                                                                                                NULL)
68
 
                                                                );
69
 
    gtk_window_set_policy( GTK_WINDOW(securityDialog), FALSE, FALSE, FALSE );
70
 
    gtk_dialog_set_has_separator(securityDialog, TRUE);
71
 
    gtk_container_set_border_width (GTK_CONTAINER(securityDialog), 0);
72
 
 
73
 
    
74
 
    tableZrtp = gtk_table_new (4, 2  , FALSE/* homogeneous */);  
75
 
    gtk_table_set_row_spacings( GTK_TABLE(tableZrtp), 10);
76
 
    gtk_table_set_col_spacings( GTK_TABLE(tableZrtp), 10); 
77
 
    gtk_box_pack_start(GTK_BOX(securityDialog->vbox), tableZrtp, FALSE, FALSE, 0);  
78
 
    gtk_widget_show(tableZrtp);
79
 
    
80
 
    enableHelloHash = gtk_check_button_new_with_mnemonic(_("Send Hello Hash in S_DP"));
81
 
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enableHelloHash),
82
 
            g_strcasecmp(curHelloEnabled,"true") == 0 ? TRUE: FALSE);
83
 
    gtk_table_attach ( GTK_TABLE(tableZrtp), enableHelloHash, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
84
 
    gtk_widget_set_sensitive( GTK_WIDGET( enableHelloHash ) , TRUE );
85
 
        
86
 
    enableSASConfirm = gtk_check_button_new_with_mnemonic(_("Ask User to Confirm SAS"));
87
 
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enableSASConfirm),
88
 
            g_strcasecmp(curSasConfirm,"true") == 0 ? TRUE: FALSE);
89
 
    gtk_table_attach ( GTK_TABLE(tableZrtp), enableSASConfirm, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
90
 
    gtk_widget_set_sensitive( GTK_WIDGET( enableSASConfirm ) , TRUE ); 
91
 
  
92
 
    enableZrtpNotSuppOther = gtk_check_button_new_with_mnemonic(_("_Warn if ZRTP not supported"));
93
 
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enableZrtpNotSuppOther),
94
 
            g_strcasecmp(curZrtpNotSuppOther,"true") == 0 ? TRUE: FALSE);
95
 
    gtk_table_attach ( GTK_TABLE(tableZrtp), enableZrtpNotSuppOther, 0, 1, 4, 5, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
96
 
    gtk_widget_set_sensitive( GTK_WIDGET( enableZrtpNotSuppOther ) , TRUE );
97
 
  
98
 
    displaySasOnce = gtk_check_button_new_with_mnemonic(_("Display SAS once for hold events"));
99
 
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(displaySasOnce),
100
 
            g_strcasecmp(curDisplaySasOnce,"true") == 0 ? TRUE: FALSE);
101
 
    gtk_table_attach ( GTK_TABLE(tableZrtp), displaySasOnce, 0, 1, 5, 6, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
102
 
    gtk_widget_set_sensitive( GTK_WIDGET( displaySasOnce ) , TRUE );
103
 
    
104
 
    gtk_widget_show_all(tableZrtp);
105
 
 
106
 
    gtk_container_set_border_width (GTK_CONTAINER(tableZrtp), 10);
107
 
        
108
 
    if(gtk_dialog_run(GTK_DIALOG(securityDialog)) == GTK_RESPONSE_ACCEPT) {        
109
 
        g_hash_table_replace(properties,
110
 
                g_strdup(ACCOUNT_ZRTP_DISPLAY_SAS),
111
 
                g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(enableSASConfirm)) ? "true": "false"));   
112
 
                
113
 
         g_hash_table_replace(properties,
114
 
                g_strdup(ACCOUNT_DISPLAY_SAS_ONCE),
115
 
                g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(displaySasOnce)) ? "true": "false")); 
116
 
                
117
 
        g_hash_table_replace(properties,
118
 
                g_strdup(ACCOUNT_ZRTP_HELLO_HASH),
119
 
                g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(enableHelloHash)) ? "true": "false"));
120
 
                
121
 
        g_hash_table_replace(properties,
122
 
                g_strdup(ACCOUNT_ZRTP_NOT_SUPP_WARNING),
123
 
                g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(enableZrtpNotSuppOther)) ? "true": "false"));                
124
 
    }    
125
 
    
126
 
    gtk_widget_destroy (GTK_WIDGET(securityDialog));
 
51
 
 
52
    if (properties != NULL) {
 
53
        curHelloEnabled = g_hash_table_lookup (properties, ACCOUNT_ZRTP_HELLO_HASH);
 
54
        curSasConfirm = g_hash_table_lookup (properties, ACCOUNT_ZRTP_DISPLAY_SAS);
 
55
        curZrtpNotSuppOther = g_hash_table_lookup (properties, ACCOUNT_ZRTP_NOT_SUPP_WARNING);
 
56
        curDisplaySasOnce = g_hash_table_lookup (properties, ACCOUNT_DISPLAY_SAS_ONCE);
 
57
    }
 
58
 
 
59
    securityDialog = GTK_DIALOG (gtk_dialog_new_with_buttons (_ ("ZRTP Options"),
 
60
                                 GTK_WINDOW (get_main_window()),
 
61
                                 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
 
62
                                 GTK_STOCK_CANCEL,
 
63
                                 GTK_RESPONSE_CANCEL,
 
64
                                 GTK_STOCK_SAVE,
 
65
                                 GTK_RESPONSE_ACCEPT,
 
66
                                 NULL)
 
67
                                );
 
68
    gtk_window_set_policy (GTK_WINDOW (securityDialog), FALSE, FALSE, FALSE);
 
69
    gtk_dialog_set_has_separator (securityDialog, TRUE);
 
70
    gtk_container_set_border_width (GTK_CONTAINER (securityDialog), 0);
 
71
 
 
72
 
 
73
    tableZrtp = gtk_table_new (4, 2  , FALSE/* homogeneous */);
 
74
    gtk_table_set_row_spacings (GTK_TABLE (tableZrtp), 10);
 
75
    gtk_table_set_col_spacings (GTK_TABLE (tableZrtp), 10);
 
76
    gtk_box_pack_start (GTK_BOX (securityDialog->vbox), tableZrtp, FALSE, FALSE, 0);
 
77
    gtk_widget_show (tableZrtp);
 
78
 
 
79
    enableHelloHash = gtk_check_button_new_with_mnemonic (_ ("Send Hello Hash in S_DP"));
 
80
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (enableHelloHash),
 
81
                                  g_strcasecmp (curHelloEnabled,"true") == 0 ? TRUE: FALSE);
 
82
    gtk_table_attach (GTK_TABLE (tableZrtp), enableHelloHash, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
 
83
    gtk_widget_set_sensitive (GTK_WIDGET (enableHelloHash) , TRUE);
 
84
 
 
85
    enableSASConfirm = gtk_check_button_new_with_mnemonic (_ ("Ask User to Confirm SAS"));
 
86
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (enableSASConfirm),
 
87
                                  g_strcasecmp (curSasConfirm,"true") == 0 ? TRUE: FALSE);
 
88
    gtk_table_attach (GTK_TABLE (tableZrtp), enableSASConfirm, 0, 1, 3, 4, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
 
89
    gtk_widget_set_sensitive (GTK_WIDGET (enableSASConfirm) , TRUE);
 
90
 
 
91
    enableZrtpNotSuppOther = gtk_check_button_new_with_mnemonic (_ ("_Warn if ZRTP not supported"));
 
92
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (enableZrtpNotSuppOther),
 
93
                                  g_strcasecmp (curZrtpNotSuppOther,"true") == 0 ? TRUE: FALSE);
 
94
    gtk_table_attach (GTK_TABLE (tableZrtp), enableZrtpNotSuppOther, 0, 1, 4, 5, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
 
95
    gtk_widget_set_sensitive (GTK_WIDGET (enableZrtpNotSuppOther) , TRUE);
 
96
 
 
97
    displaySasOnce = gtk_check_button_new_with_mnemonic (_ ("Display SAS once for hold events"));
 
98
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (displaySasOnce),
 
99
                                  g_strcasecmp (curDisplaySasOnce,"true") == 0 ? TRUE: FALSE);
 
100
    gtk_table_attach (GTK_TABLE (tableZrtp), displaySasOnce, 0, 1, 5, 6, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
 
101
    gtk_widget_set_sensitive (GTK_WIDGET (displaySasOnce) , TRUE);
 
102
 
 
103
    gtk_widget_show_all (tableZrtp);
 
104
 
 
105
    gtk_container_set_border_width (GTK_CONTAINER (tableZrtp), 10);
 
106
 
 
107
    if (gtk_dialog_run (GTK_DIALOG (securityDialog)) == GTK_RESPONSE_ACCEPT) {
 
108
        g_hash_table_replace (properties,
 
109
                              g_strdup (ACCOUNT_ZRTP_DISPLAY_SAS),
 
110
                              g_strdup (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (enableSASConfirm)) ? "true": "false"));
 
111
 
 
112
        g_hash_table_replace (properties,
 
113
                              g_strdup (ACCOUNT_DISPLAY_SAS_ONCE),
 
114
                              g_strdup (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (displaySasOnce)) ? "true": "false"));
 
115
 
 
116
        g_hash_table_replace (properties,
 
117
                              g_strdup (ACCOUNT_ZRTP_HELLO_HASH),
 
118
                              g_strdup (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (enableHelloHash)) ? "true": "false"));
 
119
 
 
120
        g_hash_table_replace (properties,
 
121
                              g_strdup (ACCOUNT_ZRTP_NOT_SUPP_WARNING),
 
122
                              g_strdup (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (enableZrtpNotSuppOther)) ? "true": "false"));
 
123
    }
 
124
 
 
125
    gtk_widget_destroy (GTK_WIDGET (securityDialog));
127
126
}
128
127
 
129
128
 
130
 
void show_advanced_sdes_options(GHashTable * properties) {
 
129
void show_advanced_sdes_options (GHashTable * properties)
 
130
{
131
131
 
132
132
    GtkDialog * securityDialog;
133
133
 
134
134
    GtkWidget * sdesTable;
135
135
    GtkWidget * enableRtpFallback;
136
136
    gchar * rtpFallback = "false";
137
 
    
138
 
    if(properties != NULL) {
139
 
        rtpFallback = g_hash_table_lookup(properties, ACCOUNT_SRTP_RTP_FALLBACK);
140
 
    }
141
 
 
142
 
    securityDialog = GTK_DIALOG (gtk_dialog_new_with_buttons (  _("SDES Options"),
143
 
 
144
 
                                GTK_WINDOW (get_main_window()),                                                 
145
 
                                GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
146
 
 
147
 
                                GTK_STOCK_CANCEL,
148
 
 
149
 
                                GTK_RESPONSE_CANCEL,
150
 
 
151
 
                                GTK_STOCK_SAVE,
152
 
 
153
 
                                GTK_RESPONSE_ACCEPT,           
154
 
                                
155
 
                                NULL));
156
 
 
157
 
    gtk_window_set_policy( GTK_WINDOW(securityDialog), FALSE, FALSE, FALSE );
158
 
    gtk_dialog_set_has_separator(securityDialog, TRUE);
159
 
    gtk_container_set_border_width (GTK_CONTAINER(securityDialog), 0);
160
 
 
161
 
    sdesTable = gtk_table_new (1, 2  , FALSE/* homogeneous */);  
162
 
    gtk_table_set_row_spacings( GTK_TABLE(sdesTable), 10);
163
 
    gtk_table_set_col_spacings( GTK_TABLE(sdesTable), 10); 
164
 
    gtk_box_pack_start(GTK_BOX(securityDialog->vbox), sdesTable, FALSE, FALSE, 0);  
165
 
    gtk_widget_show(sdesTable);
166
 
 
167
 
    enableRtpFallback = gtk_check_button_new_with_mnemonic(_("Fallback on RTP on SDES failure"));
168
 
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(enableRtpFallback),
169
 
                                 g_strcasecmp(rtpFallback,"true") == 0 ? TRUE: FALSE);
170
 
    gtk_table_attach ( GTK_TABLE(sdesTable), enableRtpFallback, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
171
 
    gtk_widget_set_sensitive( GTK_WIDGET( enableRtpFallback ) , TRUE );
172
 
 
173
 
 
174
 
    gtk_widget_show_all(sdesTable);
175
 
 
176
 
    gtk_container_set_border_width (GTK_CONTAINER(sdesTable), 10);
177
 
        
178
 
    if(gtk_dialog_run(GTK_DIALOG(securityDialog)) == GTK_RESPONSE_ACCEPT) {        
179
 
        g_hash_table_replace(properties,
180
 
                g_strdup(ACCOUNT_SRTP_RTP_FALLBACK),
181
 
                g_strdup(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(enableRtpFallback)) ? "true": "false"));                
182
 
    }    
183
 
    
184
 
    gtk_widget_destroy (GTK_WIDGET(securityDialog));
 
137
 
 
138
    if (properties != NULL) {
 
139
        rtpFallback = g_hash_table_lookup (properties, ACCOUNT_SRTP_RTP_FALLBACK);
 
140
    }
 
141
 
 
142
    securityDialog = GTK_DIALOG (gtk_dialog_new_with_buttons (_ ("SDES Options"),
 
143
 
 
144
                                 GTK_WINDOW (get_main_window()),
 
145
                                 GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
 
146
 
 
147
                                 GTK_STOCK_CANCEL,
 
148
 
 
149
                                 GTK_RESPONSE_CANCEL,
 
150
 
 
151
                                 GTK_STOCK_SAVE,
 
152
 
 
153
                                 GTK_RESPONSE_ACCEPT,
 
154
 
 
155
                                 NULL));
 
156
 
 
157
    gtk_window_set_policy (GTK_WINDOW (securityDialog), FALSE, FALSE, FALSE);
 
158
    gtk_dialog_set_has_separator (securityDialog, TRUE);
 
159
    gtk_container_set_border_width (GTK_CONTAINER (securityDialog), 0);
 
160
 
 
161
    sdesTable = gtk_table_new (1, 2  , FALSE/* homogeneous */);
 
162
    gtk_table_set_row_spacings (GTK_TABLE (sdesTable), 10);
 
163
    gtk_table_set_col_spacings (GTK_TABLE (sdesTable), 10);
 
164
    gtk_box_pack_start (GTK_BOX (securityDialog->vbox), sdesTable, FALSE, FALSE, 0);
 
165
    gtk_widget_show (sdesTable);
 
166
 
 
167
    enableRtpFallback = gtk_check_button_new_with_mnemonic (_ ("Fallback on RTP on SDES failure"));
 
168
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (enableRtpFallback),
 
169
                                  g_strcasecmp (rtpFallback,"true") == 0 ? TRUE: FALSE);
 
170
    gtk_table_attach (GTK_TABLE (sdesTable), enableRtpFallback, 0, 1, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
 
171
    gtk_widget_set_sensitive (GTK_WIDGET (enableRtpFallback) , TRUE);
 
172
 
 
173
 
 
174
    gtk_widget_show_all (sdesTable);
 
175
 
 
176
    gtk_container_set_border_width (GTK_CONTAINER (sdesTable), 10);
 
177
 
 
178
    if (gtk_dialog_run (GTK_DIALOG (securityDialog)) == GTK_RESPONSE_ACCEPT) {
 
179
        g_hash_table_replace (properties,
 
180
                              g_strdup (ACCOUNT_SRTP_RTP_FALLBACK),
 
181
                              g_strdup (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (enableRtpFallback)) ? "true": "false"));
 
182
    }
 
183
 
 
184
    gtk_widget_destroy (GTK_WIDGET (securityDialog));
185
185
}