[gnome-maps/search-props] wip: Add search properties view



commit 977b395d88ff41040b4a49ea7ab0191db3be7fd5
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Apr 1 00:21:15 2013 +0300

    wip: Add search properties view

 configure.ac       |    2 +
 src/Makefile-js.am |    1 +
 src/mapView.js     |   13 +++++++-
 src/properties.js  |   75 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 89 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d8cc06d..66982b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,6 +41,8 @@ AC_SUBST(GLIB_COMPILE_RESOURCES)
 
 LIBGD_INIT([
   header-bar
+  header-simple-button
+  revealer
   tagged-entry
   gir
 ])
diff --git a/src/Makefile-js.am b/src/Makefile-js.am
index 2b0d22f..4cd2737 100644
--- a/src/Makefile-js.am
+++ b/src/Makefile-js.am
@@ -6,6 +6,7 @@ dist_js_DATA = \
     mainToolbar.js \
     mapView.js \
     path.js \
+    properties.js \
     utils.js
 
 BUILT_SOURCES += \
diff --git a/src/mapView.js b/src/mapView.js
index 9afb683..88258cb 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -24,6 +24,8 @@ const Gtk = imports.gi.Gtk;
 const Champlain = imports.gi.Champlain;
 const GtkChamplain = imports.gi.GtkChamplain;
 const Geocode = imports.gi.GeocodeGlib;
+const Gd = imports.gi.Gd;
+const Properties = imports.properties;
 
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
@@ -35,8 +37,15 @@ const MapView = new Lang.Class({
     Name: 'MapView',
 
     _init: function(app) {
-        this.widget = new GtkChamplain.Embed();
-        this.actor = this.widget.get_view();
+        this.widget = new Gtk.Overlay();
+        this._embed = new GtkChamplain.Embed();
+        this.widget.add(this._embed);
+
+        this._properties = new Properties.Properties()
+        this._properties.widget.set_halign(Gtk.Align.END);
+        this.widget.add_overlay(this._properties.widget);
+
+        this.actor = this._embed.get_view();
 
         this._view = this.actor;
         this._view.set_zoom_level(3);
diff --git a/src/properties.js b/src/properties.js
new file mode 100644
index 0000000..ebe3802
--- /dev/null
+++ b/src/properties.js
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2011, 2012, 2013 Red Hat, Inc.
+ *
+ * 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: Zeeshan Ali (Khattak) <zeeshanak gnome org>
+ */
+
+const Gdk = imports.gi.Gdk;
+const GLib = imports.gi.GLib;
+const Gtk = imports.gi.Gtk;
+const Champlain = imports.gi.Champlain;
+const GtkChamplain = imports.gi.GtkChamplain;
+const Geocode = imports.gi.GeocodeGlib;
+const Gd = imports.gi.Gd;
+
+const Lang = imports.lang;
+const Mainloop = imports.mainloop;
+
+const Utils = imports.utils;
+const _ = imports.gettext.gettext;
+
+const Properties = new Lang.Class({
+    Name: 'Properties',
+
+    _init: function(mapView) {
+        this.mapView = mapView;
+
+        this.widget = new Gtk.Grid();
+        this.widget.set_orientation(Gtk.Orientation.HORIZONTAL);
+        let context = this.widget.get_style_context();
+        context.add_class('osd');
+
+        let revealButton = new Gd.HeaderSimpleButton({ symbolic_icon_name: 'go-previous-symbolic',
+                                                       margin_right: 20,
+                                                       halign: Gtk.Align.CENTER,
+                                                       valign: Gtk.Align.CENTER });
+
+        this.widget.add(revealButton);
+
+        let propsGrid = new Gtk.Grid({ vexpand: true, valign: Gtk.Align.FILL });
+        propsGrid.set_orientation(Gtk.Orientation.VERTICAL);
+
+        let label = new Gtk.Label({ label: "Map Type" });
+        propsGrid.add(label);
+
+        let revealer = new Gd.Revealer({ child: propsGrid,
+                                         reveal_child: false,
+                                         orientation: Gtk.Orientation.VERTICAL });
+
+        revealButton.connect('clicked', Lang.bind(this, function() {
+            if (revealer.reveal_child) {
+                revealer.reveal_child = false;
+                revealButton.symbolic_icon_name = 'go-previous-symbolic';
+            } else {
+                revealer.reveal_child = true;
+                revealButton.symbolic_icon_name = 'go-next-symbolic';
+            }
+        }));
+
+        this.widget.add(revealer);
+    },
+});


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