[gnome-maps/wip/mlundblad/osm-edit-namevariants] WIP: osmEditDialog: Implement editing name variants
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/osm-edit-namevariants] WIP: osmEditDialog: Implement editing name variants
- Date: Thu, 23 Mar 2017 22:22:22 +0000 (UTC)
commit 28f98a29749c1426a68424113b1a96d1428d9166
Author: Marcus Lundblad <ml update uu se>
Date: Thu Mar 23 23:21:16 2017 +0100
WIP: osmEditDialog: Implement editing name variants
data/ui/osm-edit-dialog.ui | 14 ++++++++++
src/osmEditDialog.js | 60 ++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 72 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/osm-edit-dialog.ui b/data/ui/osm-edit-dialog.ui
index 1b9fd32..3f6df78 100644
--- a/data/ui/osm-edit-dialog.ui
+++ b/data/ui/osm-edit-dialog.ui
@@ -148,6 +148,20 @@
</packing>
</child>
<child>
+ <object class="GtkGrid" id="nameVariantsGrid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_start">15</property>
+ <property name="margin_end">15</property>
+ <property name="margin_top">15</property>
+ <property name="margin_bottom">15</property>
+ <property name="row-spacing">5</property>
+ </object>
+ <packing>
+ <property name="name">name-variants</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkGrid" id="uploadGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
diff --git a/src/osmEditDialog.js b/src/osmEditDialog.js
index 6447469..3997dfe 100644
--- a/src/osmEditDialog.js
+++ b/src/osmEditDialog.js
@@ -179,6 +179,36 @@ const OSM_FIELDS = [
['service', _("Service")]]
}];
+const OSM_NAME_FIELDS = [
+ {
+ name: _("Alternative name"),
+ tag: 'alt_name',
+ type: EditFieldType.TEXT,
+ hint: _("Alternative name by which the feature is known.")
+ },
+ {
+ name: _("Old name"),
+ tag: 'old_name',
+ type: EditFieldType.TEXT,
+ hint: _("Older or historical name.")
+ },
+ {
+ name: _("English name"),
+ tag: 'name:en',
+ type: EditFieldType.TEXT,
+ hint: _("Name of feature in English.")
+ },
+ {
+ /* Translators: this placeholder string should be replaced by a string
+ * representing the translated equivalent to "English name" where
+ * "English" would be replaced by the name of the language translated
+ * into. This tag will be targetted at the user's actual language.
+ */
+ name: _("name-in-localized-language"),
+ tag: 'name:localized',
+ type: EditFieldType.TEXT
+ }];
+
const OSMEditAddress = new Lang.Class({
Name: 'OSMEditAddress',
Extends: Gtk.Grid,
@@ -469,6 +499,7 @@ const OSMEditDialog = new Lang.Class({
_onBackClicked: function() {
this._backButton.visible = false;
this._cancelButton.visible = true;
+ this._nextButton.visible = true;
this._nextButton.label = _("Next");
this._stack.set_visible_child_name('editor');
this._isEditing = true;
@@ -557,6 +588,29 @@ const OSMEditDialog = new Lang.Class({
deleteButton.show();
},
+ _onNameVariantsClicked: function() {
+ this._cancelButton.visible = false;
+ this._backButton.visible = true;
+ this._nextButton.visible = false;
+ this._headerBar.title = _("Edit Name Variants");
+ this._stack.visible_child_name = 'name-variants';
+ },
+
+ _addOSMEditNameVariantsButton: function() {
+ let nameVariantsButton = Gtk.Button.new_from_icon_name('view-more-symbolic',
+ Gtk.IconSize.BUTTON);
+ let styleContext = nameVariantsButton.get_style_context();
+
+ styleContext.add_class('flat');
+ this._editorGrid.attach(nameVariantsButton, 2, this._currentRow, 1, 1);
+
+ nameVariantsButton.connect('clicked', (function() {
+ this._onNameVariantsClicked();
+ }).bind(this));
+
+ nameVariantsButton.show();
+ },
+
_addOSMEditLabel: function(fieldSpec) {
let text = fieldSpec.name;
if (fieldSpec.includeHelp) {
@@ -606,8 +660,10 @@ const OSMEditDialog = new Lang.Class({
this._editorGrid.attach(entry, 1, this._currentRow, 1, 1);
entry.show();
- /* TODO: should we allow deleting the name field? */
- this._addOSMEditDeleteButton(fieldSpec);
+ if (fieldSpec.tag === 'name')
+ this._addOSMEditNameVariantsButton();
+ else
+ this._addOSMEditDeleteButton(fieldSpec);
this._currentRow++;
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]