[eog-plugins] map: Only set initial zoom if markers are actually present



commit 5262edbdf544e95c8d14d2e411791176432748d5
Author: Felix Riemann <friemann gnome org>
Date:   Sun Oct 2 18:51:39 2016 +0200

    map: Only set initial zoom if markers are actually present
    
    Otherwise it would just zoom somewhere in the Atlantic.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771976

 plugins/map/eog-map-plugin.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plugins/map/eog-map-plugin.c b/plugins/map/eog-map-plugin.c
index d60393f..aa0c3a1 100644
--- a/plugins/map/eog-map-plugin.c
+++ b/plugins/map/eog-map-plugin.c
@@ -349,6 +349,7 @@ static void
 prepared_cb (EogWindow *window,
             EogMapPlugin *plugin)
 {
+       GList *markers;
 
        plugin->store = eog_window_get_store (plugin->window);
 
@@ -380,8 +381,13 @@ prepared_cb (EogWindow *window,
         * This is useful to have a good starting zoom level where
         * you can see a available markers on the map
         */
-       champlain_view_set_zoom_level (plugin->map, 15);
-       champlain_view_ensure_layers_visible (plugin->map, FALSE);
+       markers = champlain_marker_layer_get_markers (plugin->layer);
+       if(markers != NULL)
+       {
+               champlain_view_set_zoom_level (plugin->map, 15);
+               champlain_view_ensure_layers_visible (plugin->map, FALSE);
+               g_list_free (markers);
+       }
 }
 
 static void


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