[epiphany/overview: 9/30] Add a "Pages" button to the toolbar



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

    Add a "Pages" button to the toolbar
    
    This button enables the overview mode in the window.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=455173

 src/ephy-toolbar.c    |   12 ++++++++++++
 src/ephy-window.c     |   10 ++++++++++
 src/window-commands.c |    7 +++++++
 src/window-commands.h |    2 ++
 4 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index 97a72a1..56bb9c4 100644
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -100,6 +100,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_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 dd2551c..0a25bea 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1350,6 +1350,16 @@ setup_ui_manager (EphyWindow *window)
 	g_object_unref (action_group);
 
 	action_group = gtk_action_group_new ("SpecialToolbarActions");
+	action = GTK_ACTION (gtk_action_new ("ViewOverviewMode",
+					     _("Pages"),
+					     _("Shows the pages overview"),
+					     NULL));
+	g_signal_connect (action, "activate",
+			  G_CALLBACK (window_cmd_show_overview),
+			  window);
+	gtk_action_group_add_action (action_group, action);
+	g_object_unref (action);
+
 	action =
 		g_object_new (EPHY_TYPE_NAVIGATION_HISTORY_ACTION,
 			      "name", "NavigationBack",
diff --git a/src/window-commands.c b/src/window-commands.c
index e32bd5b..b60a4b0 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1391,3 +1391,10 @@ window_cmd_browse_with_caret (GtkAction *action,
 	g_settings_set_boolean (EPHY_SETTINGS_MAIN,
 				EPHY_PREFS_ENABLE_CARET_BROWSING, active);
 }
+
+void
+window_cmd_show_overview (GtkAction *action,
+			  EphyWindow *window)
+{
+	ephy_window_set_overview_mode (window, TRUE);
+}
diff --git a/src/window-commands.h b/src/window-commands.h
index 8c1840b..ccb6b33 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -100,6 +100,8 @@ void window_cmd_load_location            (GtkAction  *action,
                                           EphyWindow *window);
 void window_cmd_browse_with_caret        (GtkAction  *action,
                                           EphyWindow *window);
+void window_cmd_show_overview            (GtkAction *action,
+                                          EphyWindow *window);
 
 G_END_DECLS
 



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