[shotwell/wip/716987-basic-map: 2/2] More cleanups, debian/control update



commit b0985c82f1f3de4184cd6a784c6c68f6f2fc23fa
Author: Jim Nelson <jim yorba org>
Date:   Thu Jan 15 15:41:53 2015 -0800

    More cleanups, debian/control update

 Makefile            |    6 ++----
 debian/control      |    5 ++++-
 src/MapWidget.vala  |   40 +++++++++++++++++++++++++---------------
 src/Properties.vala |    3 +--
 4 files changed, 32 insertions(+), 22 deletions(-)
---
diff --git a/Makefile b/Makefile
index e66d7d3..80c50ef 100644
--- a/Makefile
+++ b/Makefile
@@ -256,7 +256,6 @@ EXT_PKGS = \
        atk \
        champlain-0.12 \
        champlain-gtk-0.12 \
-       clutter-1.0 \
        clutter-gtk-1.0 \
        gdk-3.0 \
        gee-0.8 \
@@ -290,9 +289,8 @@ THUMBNAILER_PKGS = \
 DIRECT_LIBS =
 
 EXT_PKG_VERSIONS = \
-       champlain-0.12 >= 0.12.3 \
-       champlain-gtk-0.12 >= 0.12.3 \
-       clutter-1.0 >= 1.12.0 \
+       champlain-0.12 >= 0.12.4 \
+       champlain-gtk-0.12 >= 0.12.4 \
        clutter-gtk-1.0 >= 1.0.0 \
        gee-0.8 >= 0.8.5 \
        gexiv2 >= 0.4.90 \
diff --git a/debian/control b/debian/control
index 2b72a69..428bc49 100644
--- a/debian/control
+++ b/debian/control
@@ -24,7 +24,10 @@ Build-Depends: debhelper (>= 7),
  libxml2 (>= 2.6.32),
  m4 (>= 1.4.13),
  valac (>= 0.20.1),
- gnome-doc-utils
+ gnome-doc-utils,
+ libchamplain-0.12-dev (>= 0.12.4),
+ libchamplain-gtk-0.12-dev (>= 0.12.4),
+ libclutter-gtk-1.0-dev (>= 1.0.0)
 Standards-Version: 3.8.3
 Homepage: http://www.yorba.org/shotwell
 
diff --git a/src/MapWidget.vala b/src/MapWidget.vala
index c4d761e..9fc4722 100644
--- a/src/MapWidget.vala
+++ b/src/MapWidget.vala
@@ -22,7 +22,7 @@ private class MapWidget : GtkChamplain.Embed {
         return instance;
     }
 
-    public void setup_map() {
+    private MapWidget() {
         // add scale to bottom left corner of the map
         map_view = get_view();
         map_view.add_layer(marker_layer);
@@ -90,7 +90,7 @@ private class MapWidget : GtkChamplain.Embed {
             // Fall back to the generic champlain marker
             champlain_marker = new Champlain.Point.full(12, { red:10, green:10, blue:255, alpha:255 });
         } else {
-            champlain_marker = new Champlain.CustomMarker(); // TODO: deprecated, switch to Champlain.Marker 
once libchamplain-0.12.4 is used
+            champlain_marker = new Champlain.Marker();
             Clutter.Texture t = new Clutter.Texture();
             t.set_cogl_texture(marker_cogl_texture);
             champlain_marker.add(t);
@@ -102,19 +102,29 @@ private class MapWidget : GtkChamplain.Embed {
     }
 
     private bool map_zoom_handler(Gdk.EventButton event) {
-        if (event.type == Gdk.EventType.2BUTTON_PRESS) {
-            if (event.button == 1 || event.button == 3) {
-                double lat = map_view.y_to_latitude(event.y);
-                double lon = map_view.x_to_longitude(event.x);
-                if (event.button == 1) {
-                    map_view.zoom_in();
-                } else {
-                    map_view.zoom_out();
-                }
-                map_view.center_on(lat, lon);
-                return true;
-            }
+        if (event.type != Gdk.EventType.2BUTTON_PRESS)
+            return false;
+        
+        // fetch before zooming
+        double lat = map_view.y_to_latitude(event.y);
+        double lon = map_view.x_to_longitude(event.x);
+        
+        switch (event.button) {
+            case 1:
+                map_view.zoom_in();
+            break;
+            
+            case 3:
+                map_view.zoom_out();
+            break;
+            
+            default:
+                return false;
         }
-        return false;
+        
+        map_view.center_on(lat, lon);
+        
+        return true;
     }
 }
+
diff --git a/src/Properties.vala b/src/Properties.vala
index 1e77ece..c2225b1 100644
--- a/src/Properties.vala
+++ b/src/Properties.vala
@@ -173,8 +173,7 @@ private class BasicProperties : Properties {
 
     public BasicProperties() {
         map_widget = MapWidget.get_instance();
-        map_widget.setup_map();
-        this.pack_end(map_widget);
+        pack_end(map_widget);
     }
 
     protected override void clear_properties() {


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