[gnome-shell/gnome-3-0] network: request that nm-applet show the mobile broadband wizard



commit 762b0e45e075d7bf3548941d68f8d7658669e312
Author: Dan Williams <dcbw redhat com>
Date:   Tue May 3 14:48:10 2011 -0500

    network: request that nm-applet show the mobile broadband wizard
    
    Use nm-applet 0.8.999 API to call the mobile broadband wizard and
    activate the new connection.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=649318

 js/ui/status/network.js |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
index f740dfc..aa4c74a 100644
--- a/js/ui/status/network.js
+++ b/js/ui/status/network.js
@@ -49,7 +49,8 @@ const NMAppletHelperInterface = {
     methods: [
         { name: 'ConnectToHiddenNetwork', inSignature: '', outSignature: '' },
         { name: 'CreateWifiNetwork', inSignature: '', outSignature: '' },
-        { name: 'ConnectTo8021xNetwork', inSignature: 'oo', outSignature: '' }
+        { name: 'ConnectTo8021xNetwork', inSignature: 'oo', outSignature: '' },
+        { name: 'ConnectTo3gNetwork', inSignature: 'o', outSignature: '' }
     ],
 };
 const NMAppletProxy = DBus.makeProxyClass(NMAppletHelperInterface);
@@ -436,7 +437,8 @@ NMDevice.prototype = {
             this._client.activate_connection(this._connections[0].connection, this.device, null, null);
         } else if (this._autoConnectionName) {
             let connection = this._createAutomaticConnection();
-            this._client.add_and_activate_connection(connection, this.device, null, null);
+            if (connection)
+                this._client.add_and_activate_connection(connection, this.device, null, null);
         }
     },
 
@@ -616,7 +618,8 @@ NMDevice.prototype = {
             this._autoConnectionItem = new PopupMenu.PopupMenuItem(this._autoConnectionName);
             this._autoConnectionItem.connect('activate', Lang.bind(this, function() {
                 let connection = this._createAutomaticConnection();
-                this._client.add_and_activate_connection(connection, this.device, null, null);
+                if (connection)
+                    this._client.add_and_activate_connection(connection, this.device, null, null);
             }));
             this.section.addMenuItem(this._autoConnectionItem);
         }
@@ -773,6 +776,10 @@ NMDeviceModem.prototype = {
         this.mobileDevice = null;
         this._connectionType = 'ppp';
 
+        this._applet_proxy = new NMAppletProxy(DBus.session,
+                                               'org.gnome.network_manager_applet',
+                                               '/org/gnome/network_manager_applet');
+
         this._capabilities = device.current_capabilities;
         if (this._capabilities & NetworkManager.DeviceModemCapabilities.GSM_UMTS) {
             is_wwan = true;
@@ -874,19 +881,13 @@ NMDeviceModem.prototype = {
     },
 
     _createAutomaticConnection: function() {
-        // FIXME: we need to summon the mobile wizard here
-        // or NM will not have the necessary parameters to complete the connection
-        // pending a DBus method on nm-applet
-
-        let connection = new NetworkManager.Connection;
-        connection._uuid = NetworkManager.utils_uuid_generate();
-        connection.add_setting(new NetworkManager.SettingConnection({
-            uuid: connection._uuid,
-            id: this._autoConnectionName,
-            type: this._connectionType,
-            autoconnect: false
-        }));
-        return connection;
+        // Mobile wizard is handled by nm-applet for now...
+        this._applet_proxy.ConnectTo3gNetworkRemote(this.device.get_path(),
+                                                    Lang.bind(this, function(results, err) {
+                                                        if (err)
+                                                            log(err);
+                                                    }));
+        return null;
     }
 };
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]