[gnome-maps] contextMenu: Add 'Copy Geo URI'
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] contextMenu: Add 'Copy Geo URI'
- Date: Sun, 16 Aug 2015 11:27:49 +0000 (UTC)
commit 8e3e00496bee593fc144eb4564a383ea1c4b96d5
Author: Jonas Danielsson <jonas threetimestwo org>
Date: Sun Aug 16 13:06:07 2015 +0200
contextMenu: Add 'Copy Geo URI'
https://bugzilla.gnome.org/show_bug.cgi?id=753654
data/ui/context-menu.ui | 7 +++++++
src/contextMenu.js | 18 +++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/data/ui/context-menu.ui b/data/ui/context-menu.ui
index fa5bc3d..8e59650 100644
--- a/data/ui/context-menu.ui
+++ b/data/ui/context-menu.ui
@@ -10,5 +10,12 @@
<property name="visible">True</property>
</object>
</child>
+ <child>
+ <object class="GtkMenuItem" id="geoURIItem">
+ <property name="name">geo-uri-item</property>
+ <property name="label" translatable="yes">Copy Geo URI</property>
+ <property name="visible">True</property>
+ </object>
+ </child>
</template>
</interface>
diff --git a/src/contextMenu.js b/src/contextMenu.js
index 1739e6c..fd4381f 100644
--- a/src/contextMenu.js
+++ b/src/contextMenu.js
@@ -20,6 +20,8 @@
*/
const Clutter = imports.gi.Clutter;
+const Gdk = imports.gi.Gdk;
+const Geocode = imports.gi.GeocodeGlib;
const Gtk = imports.gi.Gtk;
const Mainloop = imports.mainloop;
@@ -32,7 +34,8 @@ const ContextMenu = new Lang.Class({
Name: 'ContextMenu',
Extends: Gtk.Menu,
Template: 'resource:///org/gnome/Maps/ui/context-menu.ui',
- InternalChildren: [ 'whatsHereItem' ],
+ InternalChildren: [ 'whatsHereItem',
+ 'geoURIItem' ],
_init: function(params) {
this._mapView = params.mapView;
@@ -45,6 +48,8 @@ const ContextMenu = new Lang.Class({
this._whatsHereItem.connect('activate',
this._onWhatsHereActivated.bind(this));
+ this._geoURIItem.connect('activate',
+ this._onGeoURIActivated.bind(this));
},
_onButtonReleaseEvent: function(actor, event) {
@@ -70,4 +75,15 @@ const ContextMenu = new Lang.Class({
this._mapView.showSearchResult(place, false);
}).bind(this));
},
+
+ _onGeoURIActivated: function() {
+ let location = new Location.Location({ latitude: this._latitude,
+ longitude: this._longitude,
+ accuracy: 0 });
+ let display = Gdk.Display.get_default();
+ let clipboard = Gtk.Clipboard.get_default(display);
+ let uri = location.to_uri(Geocode.LocationURIScheme.GEO);
+
+ clipboard.set_text(uri, uri.length);
+ }
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]