~dylanmccall/ubuntu/oneiric/network-manager-applet/lp852961-disable-autostart-for-gnome-shell

« back to all changes in this revision

Viewing changes to src/connection-editor/page-mobile.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2011-05-30 13:25:18 UTC
  • mto: This revision was merged to the branch mainline in revision 68.
  • Revision ID: james.westby@ubuntu.com-20110530132518-ya5i5mcrl8szsmoj
Tags: upstream-0.8.9997+git.20110529t170033.9ec4c5d
ImportĀ upstreamĀ versionĀ 0.8.9997+git.20110529t170033.9ec4c5d

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 * (C) Copyright 2008 - 2010 Red Hat, Inc.
21
21
 */
22
22
 
 
23
#include "config.h"
 
24
 
23
25
#include <string.h>
24
26
#include <ctype.h>
25
27
 
34
36
 
35
37
#include "page-mobile.h"
36
38
#include "nm-connection-editor.h"
37
 
#include "gconf-helpers.h"
38
39
#include "mobile-wizard.h"
39
40
 
40
41
G_DEFINE_TYPE (CEPageMobile, ce_page_mobile, CE_TYPE_PAGE)
117
118
                gtk_entry_set_text (priv->network_id, s);
118
119
 
119
120
        switch (nm_setting_gsm_get_network_type (setting)) {
120
 
        case NM_GSM_NETWORK_UMTS_HSPA:
 
121
        case NM_SETTING_GSM_NETWORK_TYPE_UMTS_HSPA:
121
122
                type_idx = NET_TYPE_3G;
122
123
                break;
123
 
        case NM_GSM_NETWORK_GPRS_EDGE:
 
124
        case NM_SETTING_GSM_NETWORK_TYPE_GPRS_EDGE:
124
125
                type_idx = NET_TYPE_2G;
125
126
                break;
126
 
        case NM_GSM_NETWORK_PREFER_UMTS_HSPA:
 
127
        case NM_SETTING_GSM_NETWORK_TYPE_PREFER_UMTS_HSPA:
127
128
                type_idx = NET_TYPE_PREFER_3G;
128
129
                break;
129
 
        case NM_GSM_NETWORK_PREFER_GPRS_EDGE:
 
130
        case NM_SETTING_GSM_NETWORK_TYPE_PREFER_GPRS_EDGE:
130
131
                type_idx = NET_TYPE_PREFER_2G;
131
132
                break;
132
 
        case NM_GSM_NETWORK_ANY:
 
133
        case NM_SETTING_GSM_NETWORK_TYPE_ANY:
133
134
        default:
134
135
                type_idx = NET_TYPE_ANY;
135
136
                break;
206
207
 
207
208
        if (!canceled && method) {
208
209
                switch (method->devtype) {
209
 
                case NM_DEVICE_TYPE_GSM:
 
210
                case NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS:
210
211
                        gtk_entry_set_text (GTK_ENTRY (priv->username),
211
212
                                            method->username ? method->username : "");
212
213
                        gtk_entry_set_text (GTK_ENTRY (priv->password),
214
215
                        gtk_entry_set_text (GTK_ENTRY (priv->apn),
215
216
                                            method->gsm_apn ? method->gsm_apn : "");
216
217
                        break;
 
218
                case NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO:
 
219
                        gtk_entry_set_text (GTK_ENTRY (priv->username),
 
220
                                            method->username ? method->username : "");
 
221
                        gtk_entry_set_text (GTK_ENTRY (priv->password),
 
222
                                            method->password ? method->password : "");
 
223
                        break;
217
224
                default:
218
225
                        g_assert_not_reached ();
219
226
                        break;
241
248
 
242
249
        wizard = mobile_wizard_new (GTK_WINDOW (toplevel),
243
250
                                    priv->window_group,
244
 
                                    NM_DEVICE_TYPE_GSM,
 
251
                                    NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS,
245
252
                                    FALSE,
246
253
                                    apn_button_mobile_wizard_done,
247
254
                                    self);
293
300
        gchar *result = g_new0 (gchar, length);
294
301
 
295
302
        for (i = 0; i < length; i++) {
296
 
                if (isalnum (text[i]) || (text[i] == '.') || (text[i] == '-'))
 
303
                if (   isalnum (text[i])
 
304
                    || (text[i] == '.')
 
305
                    || (text[i] == '_')
 
306
                    || (text[i] == '-'))
297
307
                        result[count++] = text[i];
298
308
        }
299
309
 
414
424
 
415
425
        switch (gtk_combo_box_get_active (priv->network_type)) {
416
426
        case NET_TYPE_3G:
417
 
                net_type = NM_GSM_NETWORK_UMTS_HSPA;
 
427
                net_type = NM_SETTING_GSM_NETWORK_TYPE_UMTS_HSPA;
418
428
                break;
419
429
        case NET_TYPE_2G:
420
 
                net_type = NM_GSM_NETWORK_GPRS_EDGE;
 
430
                net_type = NM_SETTING_GSM_NETWORK_TYPE_GPRS_EDGE;
421
431
                break;
422
432
        case NET_TYPE_PREFER_3G:
423
 
                net_type = NM_GSM_NETWORK_PREFER_UMTS_HSPA;
 
433
                net_type = NM_SETTING_GSM_NETWORK_TYPE_PREFER_UMTS_HSPA;
424
434
                break;
425
435
        case NET_TYPE_PREFER_2G:
426
 
                net_type = NM_GSM_NETWORK_PREFER_GPRS_EDGE;
 
436
                net_type = NM_SETTING_GSM_NETWORK_TYPE_PREFER_GPRS_EDGE;
427
437
                break;
428
438
        case NET_TYPE_ANY:
429
439
        default:
430
 
                net_type = NM_GSM_NETWORK_ANY;
 
440
                net_type = NM_SETTING_GSM_NETWORK_TYPE_ANY;
431
441
                break;
432
442
        }
433
443
 
547
557
                char *detail = NULL;
548
558
 
549
559
                switch (method->devtype) {
550
 
                case NM_DEVICE_TYPE_GSM:
 
560
                case NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS:
551
561
                        ctype = NM_SETTING_GSM_SETTING_NAME;
552
562
                        type_setting = nm_setting_gsm_new ();
553
563
                        /* De-facto standard for GSM */
558
568
                                      NM_SETTING_GSM_APN, method->gsm_apn,
559
569
                                      NULL);
560
570
                        break;
561
 
                case NM_DEVICE_TYPE_CDMA:
 
571
                case NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO:
562
572
                        ctype = NM_SETTING_CDMA_SETTING_NAME;
563
573
                        type_setting = nm_setting_cdma_new ();
564
574
                        /* De-facto standard for CDMA */
616
626
        info->get_connections_func = get_connections_func;
617
627
        info->user_data = user_data;
618
628
 
619
 
        wizard = mobile_wizard_new (parent, NULL, NM_DEVICE_TYPE_UNKNOWN, FALSE,
 
629
        wizard = mobile_wizard_new (parent, NULL, NM_DEVICE_MODEM_CAPABILITY_NONE, FALSE,
620
630
                                    new_connection_mobile_wizard_done, info);
621
631
        if (wizard) {
622
632
                mobile_wizard_present (wizard);
672
682
        response = gtk_dialog_run (GTK_DIALOG (dialog));
673
683
        if (response == GTK_RESPONSE_OK) {
674
684
                if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cdma_radio))) {
675
 
                        method.devtype = NM_DEVICE_TYPE_CDMA;
 
685
                        method.devtype = NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO;
676
686
                        method.provider_name = _("CDMA");
677
687
                } else {
678
 
                        method.devtype = NM_DEVICE_TYPE_GSM;
 
688
                        method.devtype = NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS;
679
689
                        method.provider_name = _("GSM");
680
690
                }
681
691
        }