35
35
const Main = imports.main;
36
36
const Format = imports.format;
37
const Geoclue = imports.geoclue;
38
const GeocodeService = imports.geocodeService;
37
39
const MainWindow = imports.mainWindow;
40
const Notification = imports.notification;
41
const NotificationManager = imports.notificationManager;
38
42
const Utils = imports.utils;
39
43
const Path = imports.path;
40
44
const Settings = imports.settings;
45
const PlaceStore = imports.placeStore;
46
const RouteService = imports.routeService;
43
49
let application = null;
44
50
let settings = null;
51
let placeStore = null;
52
let notificationManager = null;
53
let routeService = null;
55
let geocodeService = null;
46
57
const Application = new Lang.Class({
47
58
Name: 'Application',
61
72
this._mainWindow.window.destroy();
75
_initPlaceStore: function() {
76
placeStore = new PlaceStore.PlaceStore();
80
log('Failed to parse Maps places file, ' +
81
'subsequent writes will overwrite the file!');
64
85
_initAppMenu: function() {
65
86
let builder = new Gtk.Builder();
66
87
builder.add_from_resource('/org/gnome/maps/app-menu.ui');
78
99
Utils.loadStyleSheet(Gio.file_new_for_uri('resource:///org/gnome/maps/application.css'));
80
101
application = this;
81
settings = new Settings.Settings('org.gnome.maps');
102
this._initServices();
83
104
Utils.initActions(this, [{
84
105
properties: { name: 'quit' },
85
106
signalHandlers: { activate: this._onQuitActivate }
109
this._initPlaceStore();
88
110
this._initAppMenu();
113
_initServices: function() {
114
settings = new Settings.Settings('org.gnome.maps');
115
routeService = new RouteService.GraphHopper();
116
geoclue = new Geoclue.Geoclue();
117
geocodeService = new GeocodeService.GeocodeService();
91
120
_createWindow: function() {
92
121
if (this._mainWindow)
95
this._mainWindow = new MainWindow.MainWindow(this);
124
Gtk.IconTheme.get_default().append_search_path(Path.ICONS_DIR);
125
let overlay = new Gtk.Overlay({ visible: true, can_focus: true });
126
notificationManager = new NotificationManager.NotificationManager(overlay);
127
this._mainWindow = new MainWindow.MainWindow(this, overlay);
96
128
this._mainWindow.window.connect('destroy', this._onWindowDestroy.bind(this));
131
vfunc_dbus_register: function(connection, path) {
132
this.parent(connection, path);
136
vfunc_dbus_unregister: function(connection, path) {
137
this.parent(connection, path);
99
140
vfunc_activate: function() {
100
141
this._createWindow();
101
142
this._mainWindow.window.present();