diff --git a/js/misc/modemManager.js b/js/misc/modemManager.js
index 6fb2e2c76..d04a3ab65 100644
--- a/js/misc/modemManager.js
+++ b/js/misc/modemManager.js
@@ -1,6 +1,6 @@
// -*- 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;
@@ -8,33 +8,43 @@ const Signals = imports.signals;
// The following are not the complete interfaces, just the methods we need
// (or may need in the future)
-const ModemGsmNetworkInterface = {
- name: 'org.freedesktop.ModemManager.Modem.Gsm.Network',
- methods: [
- { name: 'GetRegistrationInfo', inSignature: '', outSignature: 'uss' },
- { name: 'GetSignalQuality', inSignature: '', outSignature: 'u' }
- ],
- properties: [
- { name: 'AccessTechnology', signature: 'u', access: 'read' }
- ],
- signals: [
- { name: 'SignalQuality', inSignature: 'u' },
- { name: 'RegistrationInfo', inSignature: 'uss' }
- ]
-};
-const ModemGsmNetworkProxy = DBus.makeProxyClass(ModemGsmNetworkInterface);
+const ModemGsmNetworkInterface =
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+;
-const ModemCdmaInterface = {
- name: 'org.freedesktop.ModemManager.Modem.Cdma',
- methods: [
- { name: 'GetSignalQuality', inSignature: '', outSignature: 'u' },
- { name: 'GetServingSystem', inSignature: '', outSignature: 'usu' }
- ],
- signals: [
- { name: 'SignalQuality', inSignature: 'u' }
- ]
-};
-const ModemCdmaProxy = DBus.makeProxyClass(ModemCdmaInterface);
+const ModemGsmNetworkProxy = Gio.DBusProxy.makeProxyWrapper(ModemGsmNetworkInterface);
+
+const ModemCdmaInterface =
+
+
+
+
+
+
+
+
+
+
+
+;
+
+const ModemCdmaProxy = Gio.DBusProxy.makeProxyWrapper(ModemCdmaInterface);
let _providersTable;
function _getProvidersTable() {
@@ -50,17 +60,17 @@ function ModemGsm() {
ModemGsm.prototype = {
_init: function(path) {
- this._proxy = new ModemGsmNetworkProxy(DBus.system, 'org.freedesktop.ModemManager', path);
+ this._proxy = new ModemGsmNetworkProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
this.signal_quality = 0;
this.operator_name = null;
// Code is duplicated because the function have different signatures
- this._proxy.connect('SignalQuality', Lang.bind(this, function(proxy, quality) {
+ this._proxy.connectSignal('SignalQuality', Lang.bind(this, function(proxy, sender, [quality]) {
this.signal_quality = quality;
this.emit('notify::signal-quality');
}));
- this._proxy.connect('RegistrationInfo', Lang.bind(this, function(proxy, status, code, name) {
+ this._proxy.connectSignal('RegistrationInfo', Lang.bind(this, function(proxy, sender, [status, code, name]) {
this.operator_name = this._findOperatorName(name, code);
this.emit('notify::operator-name');
}));
@@ -155,12 +165,12 @@ function ModemCdma() {
ModemCdma.prototype = {
_init: function(path) {
- this._proxy = new ModemCdmaProxy(DBus.system, 'org.freedesktop.ModemManager', path);
+ this._proxy = new ModemCdmaProxy(Gio.DBus.system, 'org.freedesktop.ModemManager', path);
this.signal_quality = 0;
this.operator_name = null;
- this._proxy.connect('SignalQuality', Lang.bind(this, function(proxy, quality) {
- this.signal_quality = quality;
+ this._proxy.connect('SignalQuality', Lang.bind(this, function(proxy, sender, params) {
+ this.signal_quality = params[0];
this.emit('notify::signal-quality');
// receiving this signal means the device got activated
diff --git a/js/ui/automountManager.js b/js/ui/automountManager.js
index e3dfe4dda..456e04269 100644
--- a/js/ui/automountManager.js
+++ b/js/ui/automountManager.js
@@ -1,7 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Lang = imports.lang;
-const DBus = imports.dbus;
const Mainloop = imports.mainloop;
const Gio = imports.gi.Gio;
const Params = imports.misc.params;
@@ -16,63 +15,54 @@ const SETTING_ENABLE_AUTOMOUNT = 'automount';
const AUTORUN_EXPIRE_TIMEOUT_SECS = 10;
-const ConsoleKitSessionIface = {
- name: 'org.freedesktop.ConsoleKit.Session',
- methods: [{ name: 'IsActive',
- inSignature: '',
- outSignature: 'b' }],
- signals: [{ name: 'ActiveChanged',
- inSignature: 'b' }]
-};
+const ConsoleKitSessionIface =
+
+
+
+
+
+
+;
-const ConsoleKitSessionProxy = DBus.makeProxyClass(ConsoleKitSessionIface);
+const ConsoleKitSessionProxy = Gio.DBusProxy.makeProxyWrapper(ConsoleKitSessionIface);
-const ConsoleKitManagerIface = {
- name: 'org.freedesktop.ConsoleKit.Manager',
- methods: [{ name: 'GetCurrentSession',
- inSignature: '',
- outSignature: 'o' }]
-};
+const ConsoleKitManagerIface =
+
+
+
+;
+
+const ConsoleKitManagerInfo = Gio.DBusInterfaceInfo.new_for_xml(ConsoleKitManagerIface);
function ConsoleKitManager() {
- this._init();
-};
+ var self = new Gio.DBusProxy({ g_connection: Gio.DBus.system,
+ g_interface_name: ConsoleKitManagerInfo.name,
+ g_interface_info: ConsoleKitManagerInfo,
+ g_name: 'org.freedesktop.ConsoleKit',
+ g_object_path: '/org/freedesktop/ConsoleKit/Manager',
+ g_flags: (Gio.DBusProxyFlags.DO_NOT_AUTO_START |
+ Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES) });
-ConsoleKitManager.prototype = {
- _init: function() {
- this.sessionActive = true;
+ self.connect('notify::g-name-owner', function() {
+ if (self.g_name_owner) {
+ self.GetCurrentSessionRemote(function([session]) {
+ self._ckSession = new ConsoleKitSessionProxy(Gio.DBus.system, 'org.freedesktop.ConsoleKit', session);
- DBus.system.proxifyObject(this,
- 'org.freedesktop.ConsoleKit',
- '/org/freedesktop/ConsoleKit/Manager');
+ self._ckSession.connectSignal('ActiveChanged', function(object, senderName, [isActive]) {
+ self.sessionActive = isActive;
+ });
+ self._ckSession.IsActiveRemote(function([isActive]) {
+ self.sessionActive = isActive;
+ });
+ });
+ } else {
+ self.sessionActive = true;
+ }
+ });
- DBus.system.watch_name('org.freedesktop.ConsoleKit',
- false, // do not launch a name-owner if none exists
- Lang.bind(this, this._onManagerAppeared),
- Lang.bind(this, this._onManagerVanished));
- },
-
- _onManagerAppeared: function(owner) {
- this.GetCurrentSessionRemote(Lang.bind(this, this._onCurrentSession));
- },
-
- _onManagerVanished: function(oldOwner) {
- this.sessionActive = true;
- },
-
- _onCurrentSession: function(session) {
- this._ckSession = new ConsoleKitSessionProxy(DBus.system, 'org.freedesktop.ConsoleKit', session);
-
- this._ckSession.connect
- ('ActiveChanged', Lang.bind(this, function(object, isActive) {
- this.sessionActive = isActive;
- }));
- this._ckSession.IsActiveRemote(Lang.bind(this, function(isActive) {
- this.sessionActive = isActive;
- }));
- }
-};
-DBus.proxifyPrototype(ConsoleKitManager.prototype, ConsoleKitManagerIface);
+ self.init(null);
+ return self;
+}
function AutomountManager() {
this._init();
diff --git a/js/ui/autorunManager.js b/js/ui/autorunManager.js
index 71e51e6ce..2cc13c510 100644
--- a/js/ui/autorunManager.js
+++ b/js/ui/autorunManager.js
@@ -1,7 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Lang = imports.lang;
-const DBus = imports.dbus;
const Gio = imports.gi.Gio;
const St = imports.gi.St;
@@ -62,25 +61,19 @@ function startAppForMount(app, mount) {
/******************************************/
-const HotplugSnifferIface = {
- name: 'org.gnome.Shell.HotplugSniffer',
- methods: [{ name: 'SniffURI',
- inSignature: 's',
- outSignature: 'as' }]
-};
+const HotplugSnifferIface =
+
+
+
+
+;
-const HotplugSniffer = function() {
- this._init();
-};
-
-HotplugSniffer.prototype = {
- _init: function() {
- DBus.session.proxifyObject(this,
+const HotplugSnifferProxy = Gio.DBusProxy.makeProxyWrapper(HotplugSnifferIface);
+function HotplugSniffer() {
+ return new HotplugSnifferProxy(Gio.DBus.session,
'org.gnome.Shell.HotplugSniffer',
'/org/gnome/Shell/HotplugSniffer');
- },
-};
-DBus.proxifyPrototype(HotplugSniffer.prototype, HotplugSnifferIface);
+}
function ContentTypeDiscoverer(callback) {
this._init(callback);
@@ -114,9 +107,8 @@ ContentTypeDiscoverer.prototype = {
let root = mount.get_root();
let hotplugSniffer = new HotplugSniffer();
- hotplugSniffer.SniffURIRemote
- (root.get_uri(), DBus.CALL_FLAG_START,
- Lang.bind(this, function(contentTypes) {
+ hotplugSniffer.SniffURIRemote(root.get_uri(),
+ Lang.bind(this, function([contentTypes]) {
this._emitCallback(mount, contentTypes);
}));
}
diff --git a/js/ui/calendar.js b/js/ui/calendar.js
index cec7b2596..98ae634e6 100644
--- a/js/ui/calendar.js
+++ b/js/ui/calendar.js
@@ -1,6 +1,5 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const DBus = imports.dbus;
const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio;
const Lang = imports.lang;
@@ -195,30 +194,34 @@ EmptyEventSource.prototype = {
};
Signals.addSignalMethods(EmptyEventSource.prototype);
-const CalendarServerIface = {
- name: 'org.gnome.Shell.CalendarServer',
- methods: [{ name: 'GetEvents',
- inSignature: 'xxb',
- outSignature: 'a(sssbxxa{sv})' }],
- signals: [{ name: 'Changed',
- inSignature: '' }]
-};
+const CalendarServerIface =
+
+
+
+
+
+
+
+;
-const CalendarServer = function () {
- this._init();
-};
+const CalendarServerInfo = Gio.DBusInterfaceInfo.new_for_xml(CalendarServerIface);
-CalendarServer.prototype = {
- _init: function() {
- DBus.session.proxifyObject(this, 'org.gnome.Shell.CalendarServer', '/org/gnome/Shell/CalendarServer');
- }
-};
+function CalendarServer() {
+ var self = new Gio.DBusProxy({ g_connection: Gio.DBus.session,
+ g_interface_name: CalendarServerInfo.name,
+ g_interface_info: CalendarServerInfo,
+ g_name: 'org.gnome.Shell.CalendarServer',
+ g_object_path: '/org/gnome/Shell/CalendarServer',
+ g_flags: (Gio.DBusProxyFlags.DO_NOT_AUTO_START |
+ Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES) });
-DBus.proxifyPrototype(CalendarServer.prototype, CalendarServerIface);
+ self.init(null);
+ return self;
+}
// an implementation that reads data from a session bus service
-function DBusEventSource(owner) {
- this._init(owner);
+function DBusEventSource() {
+ this._init();
}
function _datesEqual(a, b) {
@@ -241,16 +244,18 @@ function _dateIntervalsOverlap(a0, a1, b0, b1)
DBusEventSource.prototype = {
- _init: function(owner) {
+ _init: function() {
this._resetCache();
- this._dbusProxy = new CalendarServer(owner);
- this._dbusProxy.connect('Changed', Lang.bind(this, this._onChanged));
+ this._dbusProxy = new CalendarServer();
+ this._dbusProxy.connectSignal('Changed', Lang.bind(this, this._onChanged));
- DBus.session.watch_name('org.gnome.Shell.CalendarServer',
- false, // do not launch a name-owner if none exists
- Lang.bind(this, this._onNameAppeared),
- Lang.bind(this, this._onNameVanished));
+ this._dbusProxy.connect('notify::g-name-owner', Lang.bind(this, function() {
+ if (this._dbusProxy.g_name_owner)
+ this._onNameAppeared();
+ else
+ this._onNameVanished();
+ }));
},
_resetCache: function() {
@@ -273,7 +278,7 @@ DBusEventSource.prototype = {
this._loadEvents(false);
},
- _onEventsReceived: function(appointments) {
+ _onEventsReceived: function([appointments]) {
let newEvents = [];
if (appointments != null) {
for (let n = 0; n < appointments.length; n++) {
@@ -296,9 +301,9 @@ DBusEventSource.prototype = {
_loadEvents: function(forceReload) {
if (this._curRequestBegin && this._curRequestEnd){
- let callFlags = 0;
+ let callFlags = Gio.DBusCallFlags.NO_AUTO_START;
if (forceReload)
- callFlags |= DBus.CALL_FLAG_START;
+ callFlags = Gio.DBusCallFlags.NONE;
this._dbusProxy.GetEventsRemote(this._curRequestBegin.getTime() / 1000,
this._curRequestEnd.getTime() / 1000,
forceReload,
diff --git a/js/ui/scripting.js b/js/ui/scripting.js
index 3b8e44521..d5e2eaee6 100644
--- a/js/ui/scripting.js
+++ b/js/ui/scripting.js
@@ -1,6 +1,5 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-const DBus = imports.dbus;
const Gio = imports.gi.Gio;
const Mainloop = imports.mainloop;
const Meta = imports.gi.Meta;
@@ -70,24 +69,21 @@ function waitLeisure() {
};
}
-const PerfHelperIface = {
- name: 'org.gnome.Shell.PerfHelper',
- methods: [{ name: 'CreateWindow', inSignature: 'iibb', outSignature: '' },
- { name: 'WaitWindows', inSignature: '', outSignature: '' },
- { name: 'DestroyWindows', inSignature: '', outSignature: ''}]
-};
+const PerfHelperIface =
+
+
+
+
+
+
+
+
+;
-const PerfHelper = function () {
- this._init();
-};
-
-PerfHelper.prototype = {
- _init: function() {
- DBus.session.proxifyObject(this, 'org.gnome.Shell.PerfHelper', '/org/gnome/Shell/PerfHelper');
- }
-};
-
-DBus.proxifyPrototype(PerfHelper.prototype, PerfHelperIface);
+var PerfHelperProxy = Gio.DBusProxy.makeProxyWrapper(PerfHelperIface);
+function PerfHelper() {
+ return new PerfHelperProxy(Gio.DBus.session, 'org.gnome.Shell.PerfHelper', '/org/gnome/Shell/PerfHelper');
+}
let _perfHelper = null;
function _getPerfHelper() {
diff --git a/js/ui/status/power.js b/js/ui/status/power.js
index aee22e9aa..fa77d552a 100644
--- a/js/ui/status/power.js
+++ b/js/ui/status/power.js
@@ -1,7 +1,6 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Gio = imports.gi.Gio;
-const DBus = imports.dbus;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Shell = imports.gi.Shell;
@@ -40,20 +39,18 @@ const UPDeviceState = {
PENDING_DISCHARGE: 6
};
-const PowerManagerInterface = {
- name: 'org.gnome.SettingsDaemon.Power',
- methods: [
- { name: 'GetDevices', inSignature: '', outSignature: 'a(susdut)' },
- { name: 'GetPrimaryDevice', inSignature: '', outSignature: '(susdut)' },
- ],
- signals: [
- { name: 'Changed', inSignature: '' },
- ],
- properties: [
- { name: 'Icon', signature: 's', access: 'read' },
- ]
-};
-let PowerManagerProxy = DBus.makeProxyClass(PowerManagerInterface);
+const PowerManagerInterface =
+
+
+
+
+
+
+
+
+;
+
+const PowerManagerProxy = Gio.DBusProxy.makeProxyWrapper(PowerManagerInterface);
function Indicator() {
this._init.apply(this, arguments);
@@ -64,7 +61,7 @@ Indicator.prototype = {
_init: function() {
PanelMenu.SystemStatusButton.prototype._init.call(this, 'battery-missing');
- this._proxy = new PowerManagerProxy(DBus.session, BUS_NAME, OBJECT_PATH);
+ this._proxy = new PowerManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH);
this._deviceItems = [ ];
this._hasPrimary = false;
@@ -81,19 +78,19 @@ Indicator.prototype = {
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
this.menu.addSettingsAction(_("Power Settings"), 'gnome-power-panel.desktop');
- this._proxy.connect('Changed', Lang.bind(this, this._devicesChanged));
+ this._proxy.connectSignal('Changed', Lang.bind(this, this._devicesChanged));
this._devicesChanged();
},
_readPrimaryDevice: function() {
- this._proxy.GetPrimaryDeviceRemote(Lang.bind(this, function(device, error) {
+ this._proxy.GetPrimaryDeviceRemote(Lang.bind(this, function(result, error) {
if (error) {
this._hasPrimary = false;
this._primaryDeviceId = null;
this._batteryItem.actor.hide();
return;
}
- let [device_id, device_type, icon, percentage, state, seconds] = device;
+ let [[device_id, device_type, icon, percentage, state, seconds]] = result;
if (device_type == UPDeviceType.BATTERY) {
this._hasPrimary = true;
let time = Math.round(seconds / 60);
@@ -130,7 +127,7 @@ Indicator.prototype = {
},
_readOtherDevices: function() {
- this._proxy.GetDevicesRemote(Lang.bind(this, function(devices, error) {
+ this._proxy.GetDevicesRemote(Lang.bind(this, function(result, error) {
this._deviceItems.forEach(function(i) { i.destroy(); });
this._deviceItems = [];
@@ -139,6 +136,7 @@ Indicator.prototype = {
}
let position = 0;
+ let [devices] = result;
for (let i = 0; i < devices.length; i++) {
let [device_id, device_type] = devices[i];
if (device_type == UPDeviceType.AC_POWER || device_id == this._primaryDeviceId)
@@ -153,16 +151,15 @@ Indicator.prototype = {
},
_devicesChanged: function() {
- this._proxy.GetRemote('Icon', Lang.bind(this, function(icon, error) {
- if (icon) {
- let gicon = Gio.icon_new_for_string(icon);
- this.setGIcon(gicon);
- this.actor.show();
- } else {
- this.menu.close();
- this.actor.hide();
- }
- }));
+ let icon = this._proxy.Icon;
+ if (icon) {
+ let gicon = Gio.icon_new_for_string(icon);
+ this.setGIcon(gicon);
+ this.actor.show();
+ } else {
+ this.menu.close();
+ this.actor.hide();
+ }
this._readPrimaryDevice();
this._readOtherDevices();
}