[gnome-shell] Port GDM and Caribou to GDBus



commit 0996174b3d13f367cf9f5888e4a0b55e509df686
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Nov 20 17:52:50 2011 +0100

    Port GDM and Caribou to GDBus
    
    During the mass port to GDBus, this classes were left out (probably
    because they didn't exist at the time). Now it's time to update
    them.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=664436

 js/gdm/consoleKit.js          |   42 ++++++++++++++----------------------
 js/gdm/fingerprint.js         |   28 +++++++++--------------
 js/gdm/loginDialog.js         |    3 +-
 js/ui/keyboard.js             |   47 ++++++++++++++++++++---------------------
 js/ui/status/accessibility.js |    1 -
 5 files changed, 51 insertions(+), 70 deletions(-)
---
diff --git a/js/gdm/consoleKit.js b/js/gdm/consoleKit.js
index 99465cb..6445a8c 100644
--- a/js/gdm/consoleKit.js
+++ b/js/gdm/consoleKit.js
@@ -1,32 +1,22 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
-const DBus = imports.dbus;
+const Gio = imports.gi.Gio;
 
-const ConsoleKitManagerIface = {
-    name: 'org.freedesktop.ConsoleKit.Manager',
-    methods: [{ name: 'CanRestart',
-                inSignature: '',
-                outSignature: 'b' },
-              { name: 'CanStop',
-                inSignature: '',
-                outSignature: 'b' },
-              { name: 'Restart',
-                inSignature: '',
-                outSignature: '' },
-              { name: 'Stop',
-                inSignature: '',
-                outSignature: '' }]
-};
+const ConsoleKitManagerIface = <interface name='org.freedesktop.ConsoleKit.Manager'>
+<method name='CanRestart'>
+    <arg type='b' direction='out'/>
+</method>
+<method name='CanStop'>
+    <arg type='b' direction='out'/>
+</method>
+<method name='Restart' />
+<method name='Stop' />
+</interface>;
 
-function ConsoleKitManager() {
-    this._init();
-};
+const ConsoleKitProxy = Gio.DBusProxy.makeProxyWrapper(ConsoleKitManagerIface);
 
-ConsoleKitManager.prototype = {
-    _init: function() {
-        DBus.system.proxifyObject(this,
-                                  'org.freedesktop.ConsoleKit',
-                                  '/org/freedesktop/ConsoleKit/Manager');
-    }
+function ConsoleKitManager() {
+    return new ConsoleKitProxy(Gio.DBus.system,
+                               'org.freedesktop.ConsoleKit',
+                               '/org/freedesktop/ConsoleKit/Manager');
 };
-DBus.proxifyPrototype(ConsoleKitManager.prototype, ConsoleKitManagerIface);
diff --git a/js/gdm/fingerprint.js b/js/gdm/fingerprint.js
index 9892ef8..9c090b0 100644
--- a/js/gdm/fingerprint.js
+++ b/js/gdm/fingerprint.js
@@ -1,26 +1,20 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
-const DBus = imports.dbus;
+const Gio = imports.gi.Gio;
 const Lang = imports.lang;
 const Shell = imports.gi.Shell;
 const Signals = imports.signals;
 
-const FprintManagerIface = {
-    name: 'net.reactivated.Fprint.Manager',
-    methods: [{ name: 'GetDefaultDevice',
-                inSignature: '',
-                outSignature: 'o' }]
-};
+const FprintManagerIface = <interface name='net.reactivated.Fprint.Manager'>
+<method name='GetDefaultDevice'>
+    <arg type='o' direction='out' />
+</method>
+</interface>;
 
-function FprintManager() {
-    this._init();
-};
+const FprintManagerProxy = Gio.DBusProxy.makeProxyWrapper(FprintManagerIface);
 
-FprintManager.prototype = {
-    _init: function() {
-        DBus.system.proxifyObject(this,
-                                  'net.reactivated.Fprint',
-                                  '/net/reactivated/Fprint/Manager');
-    }
+function FprintManager() {
+    return new FprintManagerProxy(Gio.DBus.system,
+                           'net.reactivated.Fprint',
+                           '/net/reactivated/Fprint/Manager');
 };
-DBus.proxifyPrototype(FprintManager.prototype, FprintManagerIface);
diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js
index 8109206..0113dc8 100644
--- a/js/gdm/loginDialog.js
+++ b/js/gdm/loginDialog.js
@@ -33,7 +33,6 @@ const St = imports.gi.St;
 const GdmGreeter = imports.gi.GdmGreeter;
 
 const Batch = imports.gdm.batch;
-const DBus = imports.dbus;
 const Fprint = imports.gdm.fingerprint;
 const Lightbox = imports.ui.lightbox;
 const Main = imports.ui.main;
@@ -908,7 +907,7 @@ const LoginDialog = new Lang.Class({
         if (!this._settings.get_boolean(_FINGERPRINT_AUTHENTICATION_KEY))
             return;
 
-        this._fprintManager.GetDefaultDeviceRemote(DBus.CALL_FLAG_START, Lang.bind(this,
+        this._fprintManager.GetDefaultDeviceRemote(Gio.DBusCallFlags.NONE, Lang.bind(this,
             function(device, error) {
                 if (!error && device)
                     this._haveFingerprintReader = true;
diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js
index 2bf7868..a427f17 100644
--- a/js/ui/keyboard.js
+++ b/js/ui/keyboard.js
@@ -39,28 +39,27 @@ const PRETTY_KEYS = {
     'Alt_L': 'Alt'
 };
 
-const CaribouKeyboardIface = {
-    name: 'org.gnome.Caribou.Keyboard',
-    methods:    [ { name: 'Show',
-                    inSignature: 'u',
-                    outSignature: ''
-                  },
-                  { name: 'Hide',
-                    inSignature: 'u',
-                    outSignature: ''
-                  },
-                  { name: 'SetCursorLocation',
-                    inSignature: 'iiii',
-                    outSignature: ''
-                  },
-                  { name: 'SetEntryLocation',
-                    inSignature: 'iiii',
-                    outSignature: ''
-                  } ],
-    properties: [ { name: 'Name',
-                    signature: 's',
-                    access: 'read' } ]
-};
+const CaribouKeyboardIface = <interface name='org.gnome.Caribou.Keyboard'>
+<method name='Show'>
+    <arg type='u' direction='in' />
+</method>
+<method name='Hide'>
+    <arg type='u' direction='in' />
+</method>
+<method name='SetCursorLocation'>
+    <arg type='i' direction='in' />
+    <arg type='i' direction='in' />
+    <arg type='i' direction='in' />
+    <arg type='i' direction='in' />
+</method>
+<method name='SetEntryLocation'>
+    <arg type='i' direction='in' />
+    <arg type='i' direction='in' />
+    <arg type='i' direction='in' />
+    <arg type='i' direction='in' />
+</method>
+<property name='Name' access='read' type='s' />
+</interface>;
 
 function Key() {
     this._init.apply(this, arguments);
@@ -200,7 +199,8 @@ function Keyboard() {
 
 Keyboard.prototype = {
     _init: function () {
-        DBus.session.exportObject('/org/gnome/Caribou/Keyboard', this);
+        this._impl = Gio.DBusExportedObject.wrapJSObject(CaribouKeyboardIface, this);
+        this._impl.export(Gio.DBus.session, '/org/gnome/Caribou/Keyboard');
 
         this.actor = null;
 
@@ -533,7 +533,6 @@ Keyboard.prototype = {
         return 'gnome-shell';
     }
 };
-DBus.conformExport(Keyboard.prototype, CaribouKeyboardIface);
 
 const KeyboardSource = new Lang.Class({
     Name: 'KeyboardSource',
diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js
index 2804da3..4173c73 100644
--- a/js/ui/status/accessibility.js
+++ b/js/ui/status/accessibility.js
@@ -1,6 +1,5 @@
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
 
-const DBus = imports.dbus;
 const GDesktopEnums = imports.gi.GDesktopEnums;
 const Gio = imports.gi.Gio;
 const Gtk = imports.gi.Gtk;



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