[gnome-maps/wip/search-props] wip: Add search properties view
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/search-props] wip: Add search properties view
- Date: Mon, 1 Apr 2013 16:45:01 +0000 (UTC)
commit e66c2020af9a99254001c35b29c8190e9ef3911e
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Mon Apr 1 00:21:15 2013 +0300
wip: Add search properties view
configure.ac | 3 ++
data/Makefile.am | 6 +++-
data/gtk-style.css | 4 +++
src/Makefile-js.am | 1 +
src/application.js | 10 +++++++
src/mapView.js | 15 +++++++++-
src/properties.js | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++
7 files changed, 108 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index d8cc06d..80c17a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,6 +41,9 @@ AC_SUBST(GLIB_COMPILE_RESOURCES)
LIBGD_INIT([
header-bar
+ header-simple-button
+ revealer
+ stack
tagged-entry
gir
])
diff --git a/data/Makefile.am b/data/Makefile.am
index 97eb64e..bf2c244 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -13,10 +13,14 @@ gsettings_SCHEMAS = $(gsettingsschema_in_files:.xml.in=.xml)
@INTLTOOL_XML_NOMERGE_RULE@
@GSETTINGS_RULES@
+styledir = $(datadir)/gnome-maps/style
+style_DATA = gtk-style.css
+
EXTRA_DIST= \
gnome-maps.desktop \
$(desktop_in_files) \
- $(gsettingsschema_in_files)
+ $(gsettingsschema_in_files) \
+ $(style_DATA)
CLEANFILES = \
$(desktop_DATA) \
diff --git a/data/gtk-style.css b/data/gtk-style.css
new file mode 100644
index 0000000..69b70e1
--- /dev/null
+++ b/data/gtk-style.css
@@ -0,0 +1,4 @@
+.maps-osd {
+ background-color: #ededed;
+ color: black;
+}
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/application.js b/src/application.js
index 1e580ec..2217eb4 100644
--- a/src/application.js
+++ b/src/application.js
@@ -28,6 +28,7 @@ const _ = imports.gettext.gettext;
const GtkClutter = imports.gi.GtkClutter;
const Gio = imports.gi.Gio;
const Gtk = imports.gi.Gtk;
+const Gdk = imports.gi.Gdk;
const GLib = imports.gi.GLib;
const Main = imports.main;
@@ -106,6 +107,15 @@ const Application = new Lang.Class({
let resource = Gio.Resource.load(Path.RESOURCE_DIR + '/gnome-maps.gresource');
resource._register();
+ let provider = new Gtk.CssProvider ();
+ try {
+ let sheet = GLib.build_filenamev([Path.STYLE_DIR, "gtk-style.css"]);
+ provider.load_from_path(sheet);
+ Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider, 600);
+ } catch (e) {
+ log(e.message);
+ }
+
application = this;
settings = new Gio.Settings({ schema: 'org.gnome.maps' });
diff --git a/src/mapView.js b/src/mapView.js
index 9afb683..fd61c1b 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,17 @@ 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();
+ let context = this.widget.get_style_context();
+ context.add_class('maps-osd');
+ 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..b4b0223
--- /dev/null
+++ b/src/properties.js
@@ -0,0 +1,72 @@
+/*
+ * 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 revealButton = new Gd.HeaderSimpleButton({ symbolic_icon_name: 'go-previous-symbolic',
+ 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]