[empathy] Add a Best fit button to the map view (#584034)
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [empathy] Add a Best fit button to the map view (#584034)
- Date: Tue, 22 Sep 2009 21:24:20 +0000 (UTC)
commit cf5784fe3e77bedfe25f3b31dff6eb92e7a580ee
Author: Olivier Le Thanh Duong <olivier lethanh be>
Date: Thu Sep 3 16:18:39 2009 +0200
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.
src/empathy-map-view.c | 23 +++++++++++++++++++++++
src/empathy-map-view.ui | 10 ++++++++++
2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/src/empathy-map-view.c b/src/empathy-map-view.c
index 9eadee7..95fdabd 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 7d3e3ce..a56090e 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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]