aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Le Thanh Duong <olivier@lethanh.be>2009-09-03 22:18:39 +0800
committerOlivier Le Thanh Duong <olivier@lethanh.be>2009-09-22 22:56:29 +0800
commitcf5784fe3e77bedfe25f3b31dff6eb92e7a580ee (patch)
tree76a2ab0ed077b7232978305ead1142b37402a697
parent775ad4a575d720ef964d08e1ab12099da2f3af71 (diff)
downloadgsoc2013-empathy-cf5784fe3e77bedfe25f3b31dff6eb92e7a580ee.tar
gsoc2013-empathy-cf5784fe3e77bedfe25f3b31dff6eb92e7a580ee.tar.gz
gsoc2013-empathy-cf5784fe3e77bedfe25f3b31dff6eb92e7a580ee.tar.bz2
gsoc2013-empathy-cf5784fe3e77bedfe25f3b31dff6eb92e7a580ee.tar.lz
gsoc2013-empathy-cf5784fe3e77bedfe25f3b31dff6eb92e7a580ee.tar.xz
gsoc2013-empathy-cf5784fe3e77bedfe25f3b31dff6eb92e7a580ee.tar.zst
gsoc2013-empathy-cf5784fe3e77bedfe25f3b31dff6eb92e7a580ee.zip
Add a Best fit button to the map view (#584034)
Add a button to the contact map view which show all the contacts at once.
-rw-r--r--src/empathy-map-view.c23
-rw-r--r--src/empathy-map-view.ui10
2 files changed, 33 insertions, 0 deletions
diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c
index 9eadee756..95fdabd44 100644
--- a/src/empathy-map-view.c
+++ b/src/empathy-map-view.c
@@ -130,6 +130,28 @@ map_view_zoom_out_cb (GtkWidget *widget,
champlain_view_zoom_out (window->map_view);
}
+static void
+map_view_zoom_fit_cb (GtkWidget *widget,
+ EmpathyMapView *window)
+{
+ GList *item, *children;
+ GPtrArray *markers;
+
+ children = clutter_container_get_children (CLUTTER_CONTAINER (window->layer));
+ markers = g_ptr_array_sized_new (g_list_length (children) + 1);
+
+ for (item = children; item != NULL; item = g_list_next (item))
+ g_ptr_array_add (markers, (gpointer) item->data);
+
+ g_ptr_array_add (markers, (gpointer) NULL);
+ champlain_view_ensure_markers_visible (window->map_view,
+ (ChamplainBaseMarker **) markers->pdata,
+ TRUE);
+
+ g_ptr_array_free (markers, TRUE);
+ g_list_free (children);
+}
+
static gboolean
marker_clicked_cb (ChamplainMarker *marker,
ClutterButtonEvent *event,
@@ -332,6 +354,7 @@ empathy_map_view_show (void)
"map_view", "destroy", map_view_destroy_cb,
"zoom_in", "clicked", map_view_zoom_in_cb,
"zoom_out", "clicked", map_view_zoom_out_cb,
+ "zoom_fit", "clicked", map_view_zoom_fit_cb,
NULL);
g_object_unref (gui);
diff --git a/src/empathy-map-view.ui b/src/empathy-map-view.ui
index 7d3e3cefc..a56090e0e 100644
--- a/src/empathy-map-view.ui
+++ b/src/empathy-map-view.ui
@@ -35,6 +35,16 @@
</packing>
</child>
<child>
+ <object class="GtkToolButton" id="zoom_fit">
+ <property name="visible">True</property>
+ <property name="stock_id">gtk-zoom-fit</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkToolItem" id="toolbutton1">
<property name="visible">True</property>
<child>