[gnome-maps] ZoomControl: switch to GtkOverlay
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] ZoomControl: switch to GtkOverlay
- Date: Tue, 20 Aug 2013 14:48:46 +0000 (UTC)
commit 4449f9462756320e17569e3aab1e64411c1ca7de
Author: Jonas Danielsson <jonas threetimestwo org>
Date: Tue Aug 20 14:24:27 2013 +0200
ZoomControl: switch to GtkOverlay
https://bugzilla.gnome.org/show_bug.cgi?id=706297
src/mainWindow.js | 6 +++---
src/mapView.js | 5 ++---
src/zoomControl.js | 14 +++++++++-----
3 files changed, 14 insertions(+), 11 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index bd766da..a205ee8 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -62,7 +62,9 @@ const MainWindow = new Lang.Class({
this.window = ui.appWindow;
this.window.application = app;
- this.mapView = new MapView.MapView();
+ this._mapOverlay = new Gtk.Overlay({ visible: true });
+ this.mapView = new MapView.MapView(this._mapOverlay);
+ this._mapOverlay.add(this.mapView);
this.mapView.gotoUserLocation(false);
@@ -71,8 +73,6 @@ const MainWindow = new Lang.Class({
this._initSignals();
this._restoreWindowGeometry();
- this._mapOverlay = new Gtk.Overlay({ visible: true });
- this._mapOverlay.add(this.mapView);
this._mapOverlay.add_overlay(this._searchPopup);
grid.add(this._mapOverlay);
diff --git a/src/mapView.js b/src/mapView.js
index cd59c14..2269cfc 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -53,7 +53,7 @@ const MapView = new Lang.Class({
Name: 'MapView',
Extends: GtkChamplain.Embed,
- _init: function() {
+ _init: function(overlay) {
this.parent();
this.actor = this.get_view();
@@ -80,8 +80,7 @@ const MapView = new Lang.Class({
this.setMapType(MapType.STREET);
this._zoomControl = new ZoomControl.ZoomControl(this);
- this._zoomControl.set_position(20, 20);
- this.view.add_child(this._zoomControl);
+ overlay.add_overlay(this._zoomControl);
this._geoclue = new Geoclue.Geoclue();
this._updateUserLocation();
diff --git a/src/zoomControl.js b/src/zoomControl.js
index ae65e9f..569e237 100644
--- a/src/zoomControl.js
+++ b/src/zoomControl.js
@@ -21,20 +21,23 @@
const Lang = imports.lang;
-const GtkClutter = imports.gi.GtkClutter;
+const Gtk = imports.gi.Gtk;
const Utils = imports.utils;
const ZoomControl = new Lang.Class({
Name: 'ZoomControl',
- Extends: GtkClutter.Actor,
+ Extends: Gtk.Bin,
_init: function (mapView) {
- this.parent();
- Utils.clearGtkClutterActorBg(this);
+ this.parent({ halign: Gtk.Align.START,
+ valign: Gtk.Align.START,
+ margin_top: 20,
+ margin_left: 20,
+ visible: true });
+
let ui = Utils.getUIObject('zoom-control', ['zoom-control',
'zoom-in-button',
'zoom-out-button']);
- this.contents = ui.zoomControl;
this._zoomInButton = ui.zoomInButton;
this._zoomOutButton = ui.zoomOutButton;
this._view = mapView.view;
@@ -50,6 +53,7 @@ const ZoomControl = new Lang.Class({
this._updateSensitive.bind(this));
this._view.connect('notify::min-zoom-level',
this._updateSensitive.bind(this));
+ this.add(ui.zoomControl);
},
_updateSensitive: function () {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]