Calendar: don't initialize the event source synchronously
We don't want to block the shell start to load evolution-data-server and open all calendars (which can involve network connections) https://bugzilla.gnome.org/show_bug.cgi?id=694030
This commit is contained in:
parent
b45a2d7335
commit
0aa26e9134
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
const Clutter = imports.gi.Clutter;
|
const Clutter = imports.gi.Clutter;
|
||||||
const Gio = imports.gi.Gio;
|
const Gio = imports.gi.Gio;
|
||||||
|
const GLib = imports.gi.GLib;
|
||||||
const Lang = imports.lang;
|
const Lang = imports.lang;
|
||||||
const St = imports.gi.St;
|
const St = imports.gi.St;
|
||||||
const Signals = imports.signals;
|
const Signals = imports.signals;
|
||||||
@ -196,15 +197,12 @@ const CalendarServerIface = <interface name="org.gnome.Shell.CalendarServer">
|
|||||||
const CalendarServerInfo = Gio.DBusInterfaceInfo.new_for_xml(CalendarServerIface);
|
const CalendarServerInfo = Gio.DBusInterfaceInfo.new_for_xml(CalendarServerIface);
|
||||||
|
|
||||||
function CalendarServer() {
|
function CalendarServer() {
|
||||||
var self = new Gio.DBusProxy({ g_connection: Gio.DBus.session,
|
return new Gio.DBusProxy({ g_connection: Gio.DBus.session,
|
||||||
g_interface_name: CalendarServerInfo.name,
|
g_interface_name: CalendarServerInfo.name,
|
||||||
g_interface_info: CalendarServerInfo,
|
g_interface_info: CalendarServerInfo,
|
||||||
g_name: 'org.gnome.Shell.CalendarServer',
|
g_name: 'org.gnome.Shell.CalendarServer',
|
||||||
g_object_path: '/org/gnome/Shell/CalendarServer',
|
g_object_path: '/org/gnome/Shell/CalendarServer',
|
||||||
g_flags: Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES });
|
g_flags: Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES });
|
||||||
|
|
||||||
self.init(null);
|
|
||||||
return self;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _datesEqual(a, b) {
|
function _datesEqual(a, b) {
|
||||||
@ -232,14 +230,27 @@ const DBusEventSource = new Lang.Class({
|
|||||||
_init: function() {
|
_init: function() {
|
||||||
this._resetCache();
|
this._resetCache();
|
||||||
|
|
||||||
|
this._initialized = false;
|
||||||
this._dbusProxy = new CalendarServer();
|
this._dbusProxy = new CalendarServer();
|
||||||
this._dbusProxy.connectSignal('Changed', Lang.bind(this, this._onChanged));
|
this._dbusProxy.init_async(GLib.PRIORITY_DEFAULT, null, Lang.bind(this, function(object, result) {
|
||||||
|
try {
|
||||||
|
this._dbusProxy.init_finish(result);
|
||||||
|
} catch(e) {
|
||||||
|
log('Error loading calendars: ' + e.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._dbusProxy.connect('notify::g-name-owner', Lang.bind(this, function() {
|
this._dbusProxy.connectSignal('Changed', Lang.bind(this, this._onChanged));
|
||||||
if (this._dbusProxy.g_name_owner)
|
|
||||||
this._onNameAppeared();
|
this._dbusProxy.connect('notify::g-name-owner', Lang.bind(this, function() {
|
||||||
else
|
if (this._dbusProxy.g_name_owner)
|
||||||
this._onNameVanished();
|
this._onNameAppeared();
|
||||||
|
else
|
||||||
|
this._onNameVanished();
|
||||||
|
}));
|
||||||
|
|
||||||
|
this._initialized = true;
|
||||||
|
this._onNameAppeared();
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -286,6 +297,10 @@ const DBusEventSource = new Lang.Class({
|
|||||||
},
|
},
|
||||||
|
|
||||||
_loadEvents: function(forceReload) {
|
_loadEvents: function(forceReload) {
|
||||||
|
// Ignore while loading
|
||||||
|
if (!this._initialized)
|
||||||
|
return;
|
||||||
|
|
||||||
if (this._curRequestBegin && this._curRequestEnd){
|
if (this._curRequestBegin && this._curRequestEnd){
|
||||||
let callFlags = Gio.DBusCallFlags.NO_AUTO_START;
|
let callFlags = Gio.DBusCallFlags.NO_AUTO_START;
|
||||||
if (forceReload)
|
if (forceReload)
|
||||||
|
Loading…
Reference in New Issue
Block a user