[epiphany/in-tab-overview: 17/56] ephy-embed-shell: add a frecent store to the shell



commit 495cc94e118e21e78439bb04304983708ff45523
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Mon Aug 20 13:21:53 2012 +0300

    ephy-embed-shell: add a frecent store to the shell
    
    Since we will use the overview in each tab and these should share
    the underlying model.

 embed/ephy-embed-shell.c |   31 +++++++++++++++++++++++++++++++
 embed/ephy-embed-shell.h |    3 +++
 src/Makefile.am          |    4 ++++
 3 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 09bbc41..a87095f 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -57,6 +57,7 @@ struct _EphyEmbedShellPrivate
 	GtkPageSetup *page_setup;
 	GtkPrintSettings *print_settings;
 	EphyEmbedShellMode mode;
+	EphyFrecentStore *frecent_store;
 	guint single_initialised : 1;
 };
 
@@ -111,6 +112,9 @@ ephy_embed_shell_dispose (GObject *object)
 		priv->print_settings = NULL;
 	}
 
+	if (priv->frecent_store != NULL)
+		g_clear_object (&priv->frecent_store);
+
 	G_OBJECT_CLASS (ephy_embed_shell_parent_class)->dispose (object);
 }
 
@@ -173,6 +177,33 @@ ephy_embed_shell_get_global_history_service (EphyEmbedShell *shell)
 	return G_OBJECT (shell->priv->global_history_service);
 }
 
+/**
+ * ephy_embed_shell_get_frecent_store:
+ * @shell: a #EphyEmbedShell
+ *
+ * Gets the #EphyFrecentStore in the shell. This can be used
+ * by EphyOverview implementors.
+ *
+ * Returns: (transfer none): a #EphyFrecentStore
+ **/
+EphyFrecentStore *
+ephy_embed_shell_get_frecent_store (EphyEmbedShell *shell)
+{
+	g_return_val_if_fail (EPHY_IS_EMBED_SHELL (shell), NULL);
+
+	if (shell->priv->frecent_store == NULL)
+	{
+		shell->priv->frecent_store = ephy_frecent_store_new ();
+		g_object_set (shell->priv->frecent_store,
+			      "history-service",
+			      ephy_embed_shell_get_global_history_service (shell),
+			      "history-length", 10,
+			      NULL);
+	}
+
+	return shell->priv->frecent_store;
+}
+
 static GObject *
 impl_get_embed_single (EphyEmbedShell *shell)
 {
diff --git a/embed/ephy-embed-shell.h b/embed/ephy-embed-shell.h
index 8f4717b..84c9a45 100644
--- a/embed/ephy-embed-shell.h
+++ b/embed/ephy-embed-shell.h
@@ -31,6 +31,7 @@
 #include <gtk/gtk.h>
 
 #include "ephy-download.h"
+#include "ephy-frecent-store.h"
 
 G_BEGIN_DECLS
 
@@ -82,6 +83,8 @@ EphyEmbedShell	  *ephy_embed_shell_get_default		(void);
 
 GObject		  *ephy_embed_shell_get_global_history_service (EphyEmbedShell *shell);
 
+EphyFrecentStore  *ephy_embed_shell_get_frecent_store   (EphyEmbedShell *shell);
+
 GObject		  *ephy_embed_shell_get_encodings	(EphyEmbedShell *shell);
 
 GObject		  *ephy_embed_shell_get_embed_single	(EphyEmbedShell *shell);
diff --git a/src/Makefile.am b/src/Makefile.am
index 61b6fbe..69045e3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -146,6 +146,7 @@ epiphany_CPPFLAGS = \
 	-I$(top_srcdir)/lib   		\
 	-I$(top_srcdir)/lib/egg		\
 	-I$(top_srcdir)/lib/history	\
+	-I$(top_srcdir)/lib/widgets	\
 	-I$(top_srcdir)/src/bookmarks   \
 	-DDATADIR=\""$(datadir)"\" 	\
 	-DGNOMELOCALEDIR=\"$(datadir)/locale\"	\
@@ -246,6 +247,7 @@ EPHY_GIR_H_FILES = \
 	$(top_srcdir)/lib/ephy-node.h \
 	$(top_srcdir)/lib/ephy-state.h \
 	$(top_srcdir)/lib/widgets/ephy-download-widget.h \
+	$(top_srcdir)/lib/widgets/ephy-frecent-store.h \
 	$(top_srcdir)/lib/widgets/ephy-search-entry.h \
 	$(top_srcdir)/src/bookmarks/ephy-bookmarks.h \
 	$(top_srcdir)/src/ephy-extension.h \
@@ -274,6 +276,7 @@ EPHY_GIR_C_FILES = \
 	$(top_srcdir)/lib/ephy-node.c \
 	$(top_srcdir)/lib/ephy-state.c \
 	$(top_srcdir)/lib/widgets/ephy-download-widget.c \
+	$(top_srcdir)/lib/widgets/ephy-frecent-store.c \
 	$(top_srcdir)/lib/widgets/ephy-search-entry.c \
 	$(top_srcdir)/src/bookmarks/ephy-bookmarks.c \
 	$(top_srcdir)/src/ephy-extension.c \
@@ -308,6 +311,7 @@ Epiphany-$(EPIPHANY_API_VERSION).gir: $(INTROSPECTION_SCANNER) $(EPHY_GIR_H_FILE
 		-I$(top_srcdir)/embed \
 		-I$(top_srcdir)/lib \
 		-I$(top_srcdir)/lib/egg \
+		-I$(top_srcdir)/lib/widgets \
 		-I$(top_srcdir)/src \
 		-I$(top_srcdir)/src/bookmarks \
 		$(EPHY_GIR_H_FILES) \



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