[gnome-maps/wip/jonasdn/geojson: 53/55] application: Handle open GeoJSON files
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/jonasdn/geojson: 53/55] application: Handle open GeoJSON files
- Date: Fri, 23 Oct 2015 19:20:51 +0000 (UTC)
commit 967f4189be70362a716540043c028cbbf1aba315
Author: Jonas Danielsson <jonas threetimestwo org>
Date: Fri Oct 23 12:09:52 2015 +0200
application: Handle open GeoJSON files
src/application.js | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 2a6ca2c..292c46c 100644
--- a/src/application.js
+++ b/src/application.js
@@ -76,7 +76,8 @@ const Application = new Lang.Class({
/* Translators: This is the program name. */
GLib.set_application_name(_("Maps"));
- this.parent({ application_id: 'org.gnome.Maps' });
+ this.parent({ application_id: 'org.gnome.Maps',
+ flags: Gio.ApplicationFlags.HANDLES_OPEN });
this._connected = false;
this.add_main_option('local',
@@ -252,6 +253,15 @@ const Application = new Lang.Class({
this._mainWindow.present();
},
+ vfunc_open: function(files) {
+ this.activate();
+ let content_type = Gio.content_type_guess(files[0].get_uri(), null)[0];
+ if (content_type === 'application/vnd.geo+json' ||
+ content_type === 'application/json') {
+ this._mainWindow.mapView.openGeoJSON(files[0]);
+ }
+ },
+
_onWindowDestroy: function(window) {
this._mainWindow = null;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]