|
rpm-build |
858c0f |
// -*- Mode: js; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*-
|
|
rpm-build |
858c0f |
//
|
|
rpm-build |
858c0f |
// Copyright (c) 2012 Giovanni Campagna <scampa.giovanni@gmail.com>
|
|
rpm-build |
858c0f |
// Copyright (C) 2015 Daiki Ueno <dueno@src.gnome.org>
|
|
rpm-build |
858c0f |
//
|
|
rpm-build |
858c0f |
// Gnome Weather is free software; you can redistribute it and/or modify
|
|
rpm-build |
858c0f |
// it under the terms of the GNU General Public License as published by the
|
|
rpm-build |
858c0f |
// Free Software Foundation; either version 2 of the License, or (at your
|
|
rpm-build |
858c0f |
// option) any later version.
|
|
rpm-build |
858c0f |
//
|
|
rpm-build |
858c0f |
// Gnome Weather is distributed in the hope that it will be useful, but
|
|
rpm-build |
858c0f |
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
rpm-build |
858c0f |
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
rpm-build |
858c0f |
// for more details.
|
|
rpm-build |
858c0f |
//
|
|
rpm-build |
858c0f |
// You should have received a copy of the GNU General Public License along
|
|
rpm-build |
858c0f |
// with Gnome Weather; if not, write to the Free Software Foundation,
|
|
rpm-build |
858c0f |
// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
pkg.initGettext();
|
|
rpm-build |
858c0f |
pkg.initFormat();
|
|
rpm-build |
858c0f |
pkg.require({ 'Gio': '2.0',
|
|
rpm-build |
858c0f |
'GLib': '2.0',
|
|
rpm-build |
858c0f |
'GObject': '2.0',
|
|
rpm-build |
858c0f |
'Gtk': '3.0' });
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
const Gio = imports.gi.Gio;
|
|
rpm-build |
858c0f |
const GLib = imports.gi.GLib;
|
|
rpm-build |
858c0f |
const Gtk = imports.gi.Gtk;
|
|
rpm-build |
858c0f |
const Lang = imports.lang;
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
const Util = imports.util;
|
|
rpm-build |
858c0f |
const SearchProvider = imports.searchProvider;
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
function initEnvironment() {
|
|
rpm-build |
858c0f |
window.getApp = function() {
|
|
rpm-build |
858c0f |
return Gio.Application.get_default();
|
|
rpm-build |
858c0f |
};
|
|
rpm-build |
858c0f |
}
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
const BackgroundService = new Lang.Class({
|
|
rpm-build |
858c0f |
Name: 'CharactersBackgroundService',
|
|
rpm-build |
858c0f |
// This needs to be a Gtk.Application instead of Gio.Application,
|
|
rpm-build |
858c0f |
// to get Gtk.Clipboard working.
|
|
rpm-build |
858c0f |
Extends: Gtk.Application,
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
_init: function() {
|
|
rpm-build |
858c0f |
this.parent({ application_id: pkg.name,
|
|
rpm-build |
858c0f |
flags: Gio.ApplicationFlags.IS_SERVICE,
|
|
rpm-build |
858c0f |
inactivity_timeout: 30000 });
|
|
rpm-build |
858c0f |
GLib.set_application_name(_("Characters"));
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
this._searchProvider = new SearchProvider.SearchProvider(this);
|
|
rpm-build |
858c0f |
},
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
_onQuit: function() {
|
|
rpm-build |
858c0f |
this.quit();
|
|
rpm-build |
858c0f |
},
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
vfunc_dbus_register: function(connection, path) {
|
|
rpm-build |
858c0f |
this.parent(connection, path);
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
this._searchProvider.export(connection, path);
|
|
rpm-build |
858c0f |
return true;
|
|
rpm-build |
858c0f |
},
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
/*
|
|
rpm-build |
858c0f |
Can't do until GApplication is fixed.
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
vfunc_dbus_unregister: function(connection, path) {
|
|
rpm-build |
858c0f |
this._searchProvider.unexport(connection);
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
this.parent(connection, path);
|
|
rpm-build |
858c0f |
},
|
|
rpm-build |
858c0f |
*/
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
vfunc_startup: function() {
|
|
rpm-build |
858c0f |
this.parent();
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
Util.initActions(this,
|
|
rpm-build |
858c0f |
[{ name: 'quit',
|
|
rpm-build |
858c0f |
activate: this._onQuit }]);
|
|
rpm-build |
858c0f |
},
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
vfunc_activate: function() {
|
|
rpm-build |
858c0f |
// do nothing, this is a background service
|
|
rpm-build |
858c0f |
},
|
|
rpm-build |
858c0f |
});
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
function main(argv) {
|
|
rpm-build |
858c0f |
initEnvironment();
|
|
rpm-build |
858c0f |
|
|
rpm-build |
858c0f |
return (new BackgroundService()).run(argv);
|
|
rpm-build |
858c0f |
}
|