[epiphany/overview-2: 5/9] Add the "Pages" toggle button to the toolbar



commit 41802c094b5c2cbac14b770ced776de42114c91c
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Wed Jan 25 16:39:19 2012 +0200

    Add the "Pages" toggle button to the toolbar
    
    Bind it to the EphyWindow::overview-mode property
    
    https://bugzilla.gnome.org/show_bug.cgi?id=455173

 src/ephy-toolbar.c |   12 ++++++++++++
 src/ephy-window.c  |   10 ++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index 6e10753..5be15cf 100644
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -95,6 +95,18 @@ ephy_toolbar_constructed (GObject *object)
   gtk_style_context_add_class (gtk_widget_get_style_context (toolbar),
                                GTK_STYLE_CLASS_MENUBAR);
 
+  /* Overview button */
+  action_group = ephy_window_get_toolbar_action_group (priv->window);
+  tool_item = gtk_tool_item_new ();
+  tool_button = gtk_toggle_button_new ();
+  action = gtk_action_group_get_action (action_group, "ViewOverviewMode");
+  gtk_activatable_set_related_action (GTK_ACTIVATABLE (tool_button),
+                                      action);
+  gtk_container_add (GTK_CONTAINER (tool_item), tool_button);
+  gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
+  gtk_widget_show_all (GTK_WIDGET (tool_item));
+  gtk_widget_set_margin_right (GTK_WIDGET (tool_item), 12);
+
   /* Back and Forward */
   back_forward = gtk_tool_item_new ();
   box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index b2a1698..cdcad53 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1319,6 +1319,16 @@ setup_ui_manager (EphyWindow *window)
 	g_object_unref (action_group);
 
 	action_group = gtk_action_group_new ("SpecialToolbarActions");
+	action = GTK_ACTION (gtk_toggle_action_new ("ViewOverviewMode",
+						    _("Pages"),
+						    _("Shows the pages overview"),
+						    NULL));
+	gtk_action_group_add_action (action_group, action);
+	g_object_bind_property (window, "overview-mode",
+				action, "active",
+				G_BINDING_BIDIRECTIONAL);
+	g_object_unref (action);
+
 	action =
 		g_object_new (EPHY_TYPE_NAVIGATION_HISTORY_ACTION,
 			      "name", "NavigationBack",



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