[gnome-maps/wip/osm-edit: 17/47] osmEditor: Add a (for now) hard-coded name entry to allow editing the OSM name tag



commit 3d5ab12dcb7dc63c5bf2f74deb5f9c696bdc4351
Author: Marcus Lundblad <ml update uu se>
Date:   Mon Feb 9 22:48:55 2015 +0100

    osmEditor: Add a (for now) hard-coded name entry to allow editing the OSM name tag

 data/ui/osm-edit-dialog.ui |   23 ++++++++++++++++-------
 src/osmEditDialog.js       |   17 ++++++++++++++++-
 2 files changed, 32 insertions(+), 8 deletions(-)
---
diff --git a/data/ui/osm-edit-dialog.ui b/data/ui/osm-edit-dialog.ui
index 8638c43..c65624c 100644
--- a/data/ui/osm-edit-dialog.ui
+++ b/data/ui/osm-edit-dialog.ui
@@ -46,22 +46,31 @@
                 <property name="margin_top">15</property>
                 <property name="margin_bottom">15</property>
                 <child>
-                  <object class="GtkFrame" id="accountFrame">
+                  <object class="GtkLabel" id="nameLabel">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="hexpand">True</property>
                     <property name="vexpand">True</property>
-                    <property name="label_xalign">0</property>
-                    <property name="shadow_type">in</property>
-                    <child type="label_item">
-                      <placeholder/>
-                    </child>
-                  </object>
+                   <property name="label" translatable="true">Name</property>
+                 </object>
                   <packing>
                     <property name="left_attach">0</property>
                     <property name="top_attach">0</property>
                   </packing>
                 </child>
+               <child>
+                  <object class="GtkEntry" id="nameEntry">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                 </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                  </packing>
+                </child>
+
               </object>
               <packing>
                 <property name="name">editor</property>
diff --git a/src/osmEditDialog.js b/src/osmEditDialog.js
index d43daaf..556795b 100644
--- a/src/osmEditDialog.js
+++ b/src/osmEditDialog.js
@@ -37,7 +37,8 @@ const OSMEditDialog = new Lang.Class({
     Template: 'resource:///org/gnome/Maps/ui/osm-edit-dialog.ui',
     InternalChildren: [ 'cancelButton',
                        'saveButton',
-                       'stack'],
+                       'stack',
+                       'nameEntry'],
     
     _init: function(params) {
        this._place = params.place;
@@ -71,10 +72,24 @@ const OSMEditDialog = new Lang.Class({
     },
 
     _loadOSMData: function(data) {
+       this._osmObject = data;
+       this._initEditWidgets();
        this._stack.set_visible_child_name('editor');
     },
 
     _showError: function(status) {
 
+    },
+
+    _initEditWidgets: function() {
+       // TODO: for now, just use a static name text entry
+       let name = this._osmObject.getTag('name');
+
+       if (name)
+           this._nameEntry.text = this._osmObject.getTag('name');
+
+       this._nameEntry.connect('changed', (function() {
+           this._osmObject.setTag('name', this._nameEntry.text);
+       }).bind(this));
     }
 });


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]