[gnome-maps/wip/osm-edit: 4/47] osmEdit: Add an edit OSM button.
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/osm-edit: 4/47] osmEdit: Add an edit OSM button.
- Date: Thu, 30 Apr 2015 12:57:42 +0000 (UTC)
commit d4690b076b6820978af2c914086f345767a3b6c6
Author: Marcus Lundblad <ml update uu se>
Date: Tue Jan 20 22:53:11 2015 +0100
osmEdit: Add an edit OSM button.
Added edit button. Currently just connected to a simple callback just
outputting the raw OSM data.
data/ui/map-bubble.ui | 11 +++++++++++
src/mapBubble.js | 43 +++++++++++++++++++++++++++++++++++++++++--
src/placeBubble.js | 5 ++++-
3 files changed, 56 insertions(+), 3 deletions(-)
---
diff --git a/data/ui/map-bubble.ui b/data/ui/map-bubble.ui
index e488412..3ee9928 100644
--- a/data/ui/map-bubble.ui
+++ b/data/ui/map-bubble.ui
@@ -108,6 +108,17 @@
<property name="tooltip-text" translatable="yes">Check in here</property>
</object>
</child>
+ <child>
+ <object class="GtkButton" id="bubble-edit-button">
+ <property name="name">bubble-edit-button"</property>
+ <property name="label" translatable="yes">Edit</property>
+ <!-- TODO: this button should be invisible by default
+ when we handle OSM accounts -->
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ </object>
+ </child>
</object>
<packing>
<property name="left_attach">0</property>
diff --git a/src/mapBubble.js b/src/mapBubble.js
index 0d67414..9d977b8 100644
--- a/src/mapBubble.js
+++ b/src/mapBubble.js
@@ -27,6 +27,7 @@ const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Application = imports.application;
+const OSMConnection = imports.osmConnection;
const Place = imports.place;
const PlaceStore = imports.placeStore;
const SendToDialog = imports.sendToDialog;
@@ -37,7 +38,8 @@ const Button = {
ROUTE: 2,
SEND_TO: 4,
FAVORITE: 8,
- CHECK_IN: 16
+ CHECK_IN: 16,
+ EDIT: 32
};
const MapBubble = new Lang.Class({
@@ -75,7 +77,8 @@ const MapBubble = new Lang.Class({
'bubble-route-button',
'bubble-send-to-button',
'bubble-favorite-button',
- 'bubble-check-in-button']);
+ 'bubble-check-in-button',
+ 'bubble-edit-button']);
this._image = ui.bubbleImage;
this._content = ui.bubbleContentArea;
@@ -90,6 +93,8 @@ const MapBubble = new Lang.Class({
this._initFavoriteButton(ui.bubbleFavoriteButton);
if (buttonFlags & Button.CHECK_IN)
this._initCheckInButton(ui.bubbleCheckInButton, checkInMatchPlace);
+ if (buttonFlags & Button.EDIT)
+ this._initEditButton(ui.bubbleEditButton);
}
this.add(ui.bubbleMainGrid);
@@ -171,5 +176,39 @@ const MapBubble = new Lang.Class({
this.place,
matchPlace);
}).bind(this));
+ },
+
+ _initEditButton: function(button) {
+ button.connect('clicked', (function() {
+ // TODO: this should be handled in an "edit manager", something like for the
+ // check in service above
+ print ('about to edit place: type: ' + this._place.osm_type + ' id: ' +
+ this._place.osm_id);
+ let conn = new OSMConnection.OSMConnection();
+ let osmType;
+
+ switch (this._place.osm_type) {
+ case 1:
+ osmType = 'node';
+ break;
+ case 2:
+ osmType = 'way';
+ break;
+ case 3:
+ osmType = 'relation';
+ break;
+ default:
+ debug ('Unknown OSM type: ' + this._place.osm_type);
+ break;
+ }
+
+ conn.getOSMObject(osmType, this._place.osm_id,
+ (function(success, status, data) {
+ print('success: ' + success);
+ print('status: ' + status);
+ print('data: ' + data);
+ }));
+ }).bind(this));
+
}
});
diff --git a/src/placeBubble.js b/src/placeBubble.js
index 98bcce4..6202094 100644
--- a/src/placeBubble.js
+++ b/src/placeBubble.js
@@ -41,7 +41,10 @@ const PlaceBubble = new Lang.Class({
'box-content',
'label-title']);
params.buttons = (MapBubble.Button.ROUTE |
- MapBubble.Button.SEND_TO);
+ MapBubble.Button.SHARE |
+ MapBubble.Button.FAVORITE |
+ MapBubble.Button.SEND_TO |;
+ MapBubble.Button.EDIT);
// We do not serialize contacts to file, so adding them
// as favourites does not makes sense right now.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]