[gnome-maps/wip/zoom-control] MapView: add a zoom control
- From: Mattias Bengtsson <mattiasb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/zoom-control] MapView: add a zoom control
- Date: Tue, 18 Jun 2013 15:03:33 +0000 (UTC)
commit 3a75aeb53f99f62a9f8a128d397f84111afbcfb6
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date: Tue Jun 18 17:02:16 2013 +0200
MapView: add a zoom control
Add a zoom control widget based on two buttons. WIP, needs styling.
src/gnome-maps.gresource.xml | 1 +
src/mapView.js | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-maps.gresource.xml b/src/gnome-maps.gresource.xml
index 5916d8f..e6c29b5 100644
--- a/src/gnome-maps.gresource.xml
+++ b/src/gnome-maps.gresource.xml
@@ -3,6 +3,7 @@
<gresource prefix="/org/gnome/maps">
<file preprocess="xml-stripblanks">app-menu.ui</file>
<file preprocess="xml-stripblanks">main-window.ui</file>
+ <file preprocess="xml-stripblanks">map-view.ui</file>
<file alias="application.css">../data/gnome-maps.css</file>
</gresource>
</gresources>
diff --git a/src/mapView.js b/src/mapView.js
index a368e0c..4789009 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -26,6 +26,7 @@ const Gdk = imports.gi.Gdk;
const GdkPixbuf = imports.gi.GdkPixbuf;
const GLib = imports.gi.GLib;
const Gtk = imports.gi.Gtk;
+const GtkClutter = imports.gi.GtkClutter;
const GtkChamplain = imports.gi.GtkChamplain;
const Champlain = imports.gi.Champlain;
const Geocode = imports.gi.GeocodeGlib;
@@ -78,6 +79,8 @@ const MapView = new Lang.Class({
this._factory = Champlain.MapSourceFactory.dup_default();
this.setMapType(MapType.STREET);
+ this.view.add_child(this._createZoomControl());
+
this._showUserLocation();
},
@@ -208,6 +211,25 @@ const MapView = new Lang.Class({
_onViewMoved: function() {
this.emit('view-moved');
+ },
+
+ _createZoomControl: function() {
+ let builder = new Gtk.Builder();
+ builder.add_from_resource('/org/gnome/maps/map-view.ui');
+ let zoomControl = builder.get_object('zoom-control');
+ let zoomInButton = builder.get_object('zoom-in-button');
+ let zoomOutButton = builder.get_object('zoom-out-button');
+
+ zoomInButton.connect('clicked', Lang.bind(this, function() {
+ this.view.zoom_in();
+ }));
+ zoomOutButton.connect('clicked', Lang.bind(this, function() {
+ this.view.zoom_out();
+ }));
+ return new GtkClutter.Actor({
+ contents: zoomControl,
+ x_align: Clutter.ActorAlign.END
+ });
}
});
Signals.addSignalMethods(MapView.prototype);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]