[epiphany/overview-2: 4/9] Add a boolean overview-mode property to EphyWindow



commit e0e7c2b385753673aa027d729fccd1bfa13900ec
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Wed Jan 25 16:28:24 2012 +0200

    Add a boolean overview-mode property to EphyWindow
    
    With this, add the GdMainView widget to the main_vbox, so that
    it's visible instead of the notebook when the property is TRUE.
    The widget is initially empty.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=455173

 src/ephy-window.c |   61 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 src/ephy-window.h |    4 +++
 2 files changed, 64 insertions(+), 1 deletions(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 6ee9961..b2a1698 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -59,6 +59,7 @@
 #include "ephy-zoom.h"
 #include "popup-commands.h"
 #include "window-commands.h"
+#include "gd-main-view.h"
 
 #include <gdk/gdkkeysyms.h>
 #include <gio/gio.h>
@@ -343,6 +344,7 @@ struct _EphyWindowPrivate
 	EphyEmbedEvent *context_event;
 	guint idle_worker;
 	GtkWidget *downloads_box;
+	GtkWidget *main_view;
 
 	EphyLocationController *location_controller;
 
@@ -356,6 +358,7 @@ struct _EphyWindowPrivate
 	guint key_theme_is_emacs : 1;
 	guint updating_address : 1;
 	guint show_lock : 1;
+	guint overview_mode : 1;
 };
 
 enum
@@ -363,7 +366,8 @@ enum
 	PROP_0,
 	PROP_ACTIVE_CHILD,
 	PROP_CHROME,
-	PROP_SINGLE_TAB_MODE
+	PROP_SINGLE_TAB_MODE,
+	PROP_OVERVIEW_MODE
 };
 
 /* Make sure not to overlap with those in ephy-lockdown.c */
@@ -3011,6 +3015,9 @@ ephy_window_set_property (GObject *object,
 		case PROP_SINGLE_TAB_MODE:
 			ephy_window_set_is_popup (window, g_value_get_boolean (value));
 			break;
+		case PROP_OVERVIEW_MODE:
+			ephy_window_set_overview_mode (window, g_value_get_boolean (value));
+			break;
 	        default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 
 			break;
@@ -3036,6 +3043,9 @@ ephy_window_get_property (GObject *object,
 		case PROP_SINGLE_TAB_MODE:
 			g_value_set_boolean (value, window->priv->is_popup);
 			break;
+		case PROP_OVERVIEW_MODE:
+			g_value_set_boolean (value, ephy_window_get_overview_mode (EPHY_WINDOW (object)));
+			break;
 	        default:
 			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 
 			break;
@@ -3335,6 +3345,12 @@ ephy_window_constructor (GType type,
 	gtk_box_pack_start (GTK_BOX (priv->main_vbox),
 			    GTK_WIDGET (priv->find_toolbar), FALSE, FALSE, 0);
 
+	priv->main_view = GTK_WIDGET (gd_main_view_new (GD_MAIN_VIEW_ICON));
+	gtk_box_pack_start (GTK_BOX (priv->main_vbox),
+			    priv->main_view,
+			    TRUE, TRUE, 0);
+	gtk_widget_hide (GTK_WIDGET (priv->main_view));
+
 	priv->downloads_box = setup_downloads_box (window);
 	gtk_box_pack_start (GTK_BOX (priv->main_vbox),
 			    GTK_WIDGET (priv->downloads_box), FALSE, FALSE, 0);
@@ -3436,6 +3452,8 @@ ephy_window_constructor (GType type,
 
 	sync_chromes_visibility (window);
 
+	ephy_window_set_overview_mode (window, FALSE);
+
 	return object;
 }
 
@@ -3501,6 +3519,14 @@ ephy_window_class_init (EphyWindowClass *klass)
 					  PROP_CHROME,
 					  "chrome");
 
+	g_object_class_install_property (object_class,
+					 PROP_OVERVIEW_MODE,
+					 g_param_spec_boolean ("overview-mode",
+							       "Overview mode",
+							       "Whether the window is showing the overview",
+							       TRUE,
+							       G_PARAM_READWRITE));
+
 	g_type_class_add_private (object_class, sizeof (EphyWindowPrivate));
 }
 
@@ -3830,3 +3856,36 @@ ephy_window_get_location_controller (EphyWindow *window)
 
 	return window->priv->location_controller;
 }
+
+gboolean
+ephy_window_get_overview_mode (EphyWindow *window)
+{
+	g_return_val_if_fail (EPHY_IS_WINDOW (window), FALSE);
+
+	return window->priv->overview_mode;
+}
+
+void
+ephy_window_set_overview_mode (EphyWindow *window, gboolean overview_mode)
+{
+	EphyWindowPrivate *priv;
+
+	g_return_if_fail (EPHY_IS_WINDOW (window));
+
+	priv = window->priv;
+
+	if (priv->overview_mode == overview_mode)
+		return;
+
+	if (overview_mode) {
+		gtk_widget_show (priv->main_view);
+		gtk_widget_hide (GTK_WIDGET (priv->notebook));
+	} else {
+		gtk_widget_hide (priv->main_view);
+		gtk_widget_show (GTK_WIDGET (priv->notebook));
+	}
+
+	priv->overview_mode = overview_mode;
+
+	g_object_notify (G_OBJECT (window), "overview-mode");
+}
diff --git a/src/ephy-window.h b/src/ephy-window.h
index 51e9c61..881274f 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -71,6 +71,10 @@ void		  ephy_window_load_url		  (EphyWindow *window,
 void		  ephy_window_set_zoom		  (EphyWindow *window,
 						   float zoom);
 
+gboolean          ephy_window_get_overview_mode   (EphyWindow *window);
+
+void              ephy_window_set_overview_mode   (EphyWindow *window, gboolean overview_mode);
+
 void		  ephy_window_activate_location	  (EphyWindow *window);
 const char       *ephy_window_get_location        (EphyWindow *window);
 



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