[gnome-maps/wip/osm-edit] osmEdit: WIP, implement OSM account dialog.



commit 57d89e69a9f5cbb0869ace12851f18f6c97ea6e3
Author: Marcus Lundblad <ml update uu se>
Date:   Sat Nov 7 12:17:07 2015 +0100

    osmEdit: WIP, implement OSM account dialog.

 data/org.gnome.Maps.data.gresource.xml |    1 +
 data/ui/app-menu.ui                    |    6 +++++
 data/ui/osm-account-dialog.ui          |   30 +++++++++++++++++++++++++
 src/application.js                     |    7 +++++-
 src/org.gnome.Maps.src.gresource.xml   |    1 +
 src/osmAccountDialog.js                |   37 ++++++++++++++++++++++++++++++++
 src/osmEdit.js                         |    8 +++++++
 7 files changed, 89 insertions(+), 1 deletions(-)
---
diff --git a/data/org.gnome.Maps.data.gresource.xml b/data/org.gnome.Maps.data.gresource.xml
index eb68093..04bd08c 100644
--- a/data/org.gnome.Maps.data.gresource.xml
+++ b/data/org.gnome.Maps.data.gresource.xml
@@ -13,6 +13,7 @@
     <file preprocess="xml-stripblanks">ui/main-window.ui</file>
     <file preprocess="xml-stripblanks">ui/map-bubble.ui</file>
     <file preprocess="xml-stripblanks">ui/notification.ui</file>
+    <file preprocess="xml-stripblanks">ui/osm-account-dialog.ui</file>
     <file preprocess="xml-stripblanks">ui/osm-edit-dialog.ui</file>
     <file preprocess="xml-stripblanks">ui/place-bubble.ui</file>
     <file preprocess="xml-stripblanks">ui/place-entry.ui</file>
diff --git a/data/ui/app-menu.ui b/data/ui/app-menu.ui
index a40eb08..8e4bacf 100644
--- a/data/ui/app-menu.ui
+++ b/data/ui/app-menu.ui
@@ -3,6 +3,12 @@
   <menu id="app-menu">
     <section>
       <item>
+       <attribute name="action">app.osm-account-setup</attribute>
+       <attribute name="label" translatable="yes">Setup OpenStreetMap Account</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
         <attribute name="action">win.about</attribute>
         <attribute name="label" translatable="yes">About</attribute>
       </item>
diff --git a/data/ui/osm-account-dialog.ui b/data/ui/osm-account-dialog.ui
new file mode 100644
index 0000000..c8e72ee
--- /dev/null
+++ b/data/ui/osm-account-dialog.ui
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <template class="Gjs_OSMAccountDialog" parent="GtkDialog">
+    <property name="can_focus">False</property>
+    <property name="type">popup</property>
+    <property name="type_hint">dialog</property>
+    <property name="width_request">500</property>
+    <property name="height_request">500</property>
+    <child internal-child="vbox">
+      <object class="GtkStack" id="stack">
+       <child>
+         <object class="GtkBox" id="setupBox">
+
+         </object>
+         <packing>
+           <property name="name">setup</property>
+         </packing>
+       </child>
+       <child>
+         <object class="GtkBox" id="logoutBox">
+         </object>
+         <packing>
+           <property name="name">logout</property>
+         </packing>
+       </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/src/application.js b/src/application.js
index d21826d..73a988c 100644
--- a/src/application.js
+++ b/src/application.js
@@ -149,6 +149,10 @@ const Application = new Lang.Class({
         this._mainWindow.destroy();
     },
 
+    _onOsmAccountSetupActivate: function() {
+        osmEdit.showAccountDialog(this._mainWindow);
+    },
+
     _addContacts: function() {
         contactStore.get_contacts().forEach(function(contact) {
             contact.geocode(function() {
@@ -207,7 +211,8 @@ const Application = new Lang.Class({
             'show-contact': {
                 paramType: 's',
                 onActivate: this._onShowContactActivate.bind(this)
-            }
+            },
+           'osm-account-setup': { onActivate: this._onOsmAccountSetupActivate.bind(this) }
         });
 
         Gtk.IconTheme.get_default().append_search_path(GLib.build_filenamev([pkg.pkgdatadir,
diff --git a/src/org.gnome.Maps.src.gresource.xml b/src/org.gnome.Maps.src.gresource.xml
index 98fae43..65b83ba 100644
--- a/src/org.gnome.Maps.src.gresource.xml
+++ b/src/org.gnome.Maps.src.gresource.xml
@@ -28,6 +28,7 @@
     <file>mapWalker.js</file>
     <file>notification.js</file>
     <file>notificationManager.js</file>
+    <file>osmAccountDialog.js</file>
     <file>osmConnection.js</file>
     <file>osmEdit.js</file>
     <file>osmEditDialog.js</file>
diff --git a/src/osmAccountDialog.js b/src/osmAccountDialog.js
new file mode 100644
index 0000000..e188add
--- /dev/null
+++ b/src/osmAccountDialog.js
@@ -0,0 +1,37 @@
+/* -*- Mode: JS2; indent-tabs-mode: nil; js2-basic-offset: 4 -*- */
+/* vim: set et ts=4 sw=4: */
+/*
+ * Copyright (c) 2015 Marcus Lundblad
+ *
+ * GNOME Maps is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * GNOME Maps is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with GNOME Maps; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Author: Marcus Lundblad <ml update uu se>
+ */
+
+const Gtk = imports.gi.Gtk;
+const Lang = imports.lang;
+
+const OSMAccountDialog = new Lang.Class({
+    Name: 'OSMAccountDialog',
+    Extends: Gtk.Dialog,
+    Template: 'resource:///org/gnome/Maps/ui/osm-account-dialog.ui',
+
+    _init: function(params) {
+       // This is a construct-only property and cannot be set by GtkBuilder
+       params.use_header_bar = true;
+
+       this.parent(params);
+    }
+});
diff --git a/src/osmEdit.js b/src/osmEdit.js
index f7318bd..5155055 100644
--- a/src/osmEdit.js
+++ b/src/osmEdit.js
@@ -23,6 +23,7 @@
 const GObject = imports.gi.GObject;
 const Lang = imports.lang;
 
+const OSMAccountDialog = imports.osmAccountDialog;
 const OSMEditDialog = imports.osmEditDialog;
 const OSMConnection = imports.osmConnection;
 const Utils = imports.utils;
@@ -52,6 +53,13 @@ const OSMEdit = new Lang.Class({
         return response;
     },
 
+    showAccountDialog: function(parentWindow) {
+       let dialog = new OSMAccountDialog.OSMAccountDialog( {transient_for: parentWindow });
+       let response = dialog.run();
+       dialog.destroy();
+       return response;
+    },
+    
     fetchObject: function(place, callback, cancellable) {
         let osmType = Utils.osmTypeToString(place.osmType);
 


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