[epiphany/history-rewrite] temporary commit to keep everything safe here



commit f4d4a3b289ccbaf40359c4e7740791a827fc29e8
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Mon Aug 29 12:56:12 2011 +0300

    temporary commit to keep everything safe here

 embed/Makefile.am         |    4 +
 src/ephy-history-window.c |  421 +++++++++++++++++++++++++++++++--------------
 2 files changed, 296 insertions(+), 129 deletions(-)
---
diff --git a/embed/Makefile.am b/embed/Makefile.am
index 5cec403..d0107d5 100644
--- a/embed/Makefile.am
+++ b/embed/Makefile.am
@@ -26,6 +26,8 @@ INST_H_FILES = \
 	ephy-history.h			\
 	ephy-history-store.h		\
 	ephy-history-view.h		\
+	ephy-hosts-view.h		\
+	ephy-hosts-store.h		\
 	ephy-browse-history.h		\
 	ephy-permission-manager.h   \
 	ephy-web-view.h
@@ -51,6 +53,8 @@ libephyembed_la_SOURCES = \
 	ephy-history.c			\
 	ephy-history-store.c		\
 	ephy-history-view.c		\
+	ephy-hosts-view.c		\
+	ephy-hosts-store.c		\
 	ephy-browse-history.c		\
 	ephy-permission-manager.c	\
 	ephy-embed-prefs.c		\
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index ad0ee8a..b42f425 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -27,6 +27,10 @@
 
 #include "ephy-window.h"
 #include "ephy-history-window.h"
+#include "ephy-history-view.h"
+#include "ephy-hosts-view.h"
+#include "ephy-history-store.h"
+#include "ephy-hosts-store.h"
 #include "ephy-shell.h"
 #include "ephy-dnd.h"
 #include "ephy-state.h"
@@ -93,6 +97,8 @@ static void cmd_help_contents		  (GtkAction *action,
 static void search_entry_search_cb 	  (GtkWidget *entry,
 					   char *search_text,
 					   EphyHistoryWindow *editor);
+static void
+filter_now (EphyHistoryWindow *editor);
 
 #define EPHY_HISTORY_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_HISTORY_WINDOW, EphyHistoryWindowPrivate))
 
@@ -102,6 +108,7 @@ struct _EphyHistoryWindowPrivate
 	EphyBrowseHistory *browse_history;
 	GtkWidget *sites_view;
 	GtkWidget *pages_view;
+	EphyHistoryStore *history_store;
 	EphyNodeFilter *pages_filter;
 	EphyNodeFilter *sites_filter;
 	GtkWidget *time_combo;
@@ -298,21 +305,16 @@ cmd_open_bookmarks_in_tabs (GtkAction *action,
 	GList *l;
 
 	window = EPHY_WINDOW (get_target_window (editor));
-	selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->pages_view));
+	selection = ephy_history_view_get_selection (EPHY_HISTORY_VIEW (editor->priv->pages_view));
 
 	for (l = selection; l; l = l->next)
 	{
-		EphyNode *node = l->data;
-		const char *location;
-
-		location = ephy_node_get_property_string (node,
-						EPHY_NODE_PAGE_PROP_LOCATION);
-
-		ephy_shell_new_tab (ephy_shell, window, NULL, location,
+		EphyHistoryURL *url = l->data;
+		ephy_shell_new_tab (ephy_shell, window, NULL, url->url,
 			EPHY_NEW_TAB_OPEN_PAGE | EPHY_NEW_TAB_IN_EXISTING_WINDOW);
 	}
 
-	g_list_free (selection);
+	g_list_free_full (selection, (GDestroyNotify) ephy_history_url_free);
 }
 
 static void
@@ -324,22 +326,17 @@ cmd_open_bookmarks_in_browser (GtkAction *action,
 	GList *l;
 
 	window = EPHY_WINDOW (get_target_window (editor));
-	selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->pages_view));
+	selection = ephy_history_view_get_selection (EPHY_HISTORY_VIEW (editor->priv->pages_view));
 
 	for (l = selection; l; l = l->next)
 	{
-		EphyNode *node = l->data;
-		const char *location;
-
-		location = ephy_node_get_property_string (node,
-						EPHY_NODE_PAGE_PROP_LOCATION);
-
-		ephy_shell_new_tab (ephy_shell, window, NULL, location,
+		EphyHistoryURL *url = l->data;
+		ephy_shell_new_tab (ephy_shell, window, NULL, url->url,
 				    EPHY_NEW_TAB_OPEN_PAGE |
 				    EPHY_NEW_TAB_IN_NEW_WINDOW);
 	}
 
-	g_list_free (selection);
+	g_list_free_full (selection, (GDestroyNotify) ephy_history_url_free);
 }
 
 static void
@@ -369,17 +366,15 @@ cmd_copy (GtkAction *action,
 	{
 		GList *selection;
 
-		selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->pages_view));
+		selection = ephy_history_view_get_selection (EPHY_HISTORY_VIEW (editor->priv->pages_view));
 
 		if (g_list_length (selection) == 1)
 		{
-			const char *tmp;
-			EphyNode *node = selection->data;
-			tmp = ephy_node_get_property_string (node, EPHY_NODE_PAGE_PROP_LOCATION);
-			gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), tmp, -1);
+			EphyHistoryURL *url = selection->data;
+			gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), url->url, -1);
 		}
 
-		g_list_free (selection);
+		g_list_free_full (selection, (GDestroyNotify) ephy_history_url_free);
 	}
 }
 
@@ -416,17 +411,35 @@ cmd_select_all (GtkAction *action,
 }
 
 static void
+on_browse_history_deleted (gpointer service,
+			   gboolean success,
+			   gpointer result_data,
+			   gpointer user_data)
+{
+	EphyHistoryWindow *editor = EPHY_HISTORY_WINDOW (user_data);
+
+	if (success != TRUE)
+		return;
+
+	filter_now (editor);
+}
+
+static void
 cmd_delete (GtkAction *action,
             EphyHistoryWindow *editor)
 {
-	if (ephy_node_view_is_target (EPHY_NODE_VIEW (editor->priv->pages_view)))
+	GList *selected;
+
+	if (gtk_widget_is_focus (editor->priv->pages_view))
 	{
-		ephy_node_view_remove (EPHY_NODE_VIEW (editor->priv->pages_view));
+		selected = ephy_history_view_get_selection (EPHY_HISTORY_VIEW (editor->priv->pages_view));
+		ephy_browse_history_delete_urls (editor->priv->browse_history, selected,
+						 (EphyHistoryJobCallback)on_browse_history_deleted, editor);
 	}
 	else if (ephy_node_view_is_target (EPHY_NODE_VIEW (editor->priv->sites_view)))
 	{
 		EphyNodePriority priority;
-		GList *selected;
+
 		EphyNode *node;
 
 		selected = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->sites_view));
@@ -450,22 +463,18 @@ cmd_bookmark_link (GtkAction *action,
 {
         GList *selection;
 
-        selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->pages_view));
+        selection = ephy_history_view_get_selection (EPHY_HISTORY_VIEW (editor->priv->pages_view));
 
 	if (g_list_length (selection) == 1)
 	{
-		const char *location;
-		const char *title;
-		EphyNode *node;
+		EphyHistoryURL *url;
 
-		node = selection->data;
-		location = ephy_node_get_property_string (node, EPHY_NODE_PAGE_PROP_LOCATION);
-		title = ephy_node_get_property_string (node, EPHY_NODE_PAGE_PROP_TITLE);
+		url = selection->data;
 
-		ephy_bookmarks_ui_add_bookmark (GTK_WINDOW (editor), location, title);
+		ephy_bookmarks_ui_add_bookmark (GTK_WINDOW (editor), url->url, url->title);
 	}
 
-	g_list_free (selection);
+	g_list_free_full (selection, (GDestroyNotify) ephy_history_url_free);
 }
 
 static void
@@ -589,8 +598,7 @@ ephy_history_window_update_menu (EphyHistoryWindow *editor)
 	char *open_in_window_label, *open_in_tab_label, *copy_label;
 	GtkWidget *focus_widget;
 
-	pages_focus = ephy_node_view_is_target
-		(EPHY_NODE_VIEW (editor->priv->pages_view));
+	pages_focus = gtk_widget_is_focus (editor->priv->pages_view);
 	num_pages_selected = gtk_tree_selection_count_selected_rows
 		 (gtk_tree_view_get_selection (GTK_TREE_VIEW (editor->priv->pages_view)));
 	pages_selection = num_pages_selected > 0;
@@ -723,7 +731,7 @@ ephy_history_window_show_popup_cb (GtkWidget *view,
 
 	widget = gtk_ui_manager_get_widget (editor->priv->ui_merge,
 					    "/EphyHistoryWindowPopup");
-	ephy_node_view_popup (EPHY_NODE_VIEW (view), widget);
+	ephy_history_view_popup (EPHY_HISTORY_VIEW (view), widget);
 
 	return TRUE;
 }
@@ -911,28 +919,30 @@ site_node_selected_cb (EphyNodeView *view,
 static void
 search_entry_search_cb (GtkWidget *entry, char *search_text, EphyHistoryWindow *editor)
 {
-	EphyNode *all;
-
-	g_signal_handlers_block_by_func
-		(G_OBJECT (editor->priv->sites_view),
-		 G_CALLBACK (site_node_selected_cb),
-		 editor);
-	all = ephy_history_get_pages (editor->priv->history);
-	editor->priv->selected_site = all;
-	ephy_node_view_select_node (EPHY_NODE_VIEW (editor->priv->sites_view),
-				    all);
-	g_signal_handlers_unblock_by_func
-		(G_OBJECT (editor->priv->sites_view),
-		 G_CALLBACK (site_node_selected_cb),
-		 editor);
-
-	setup_filters (editor, TRUE, FALSE);
+	/* EphyNode *all; */
+
+	/* g_signal_handlers_block_by_func */
+	/* 	(G_OBJECT (editor->priv->sites_view), */
+	/* 	 G_CALLBACK (site_node_selected_cb), */
+	/* 	 editor); */
+	/* all = ephy_history_get_pages (editor->priv->history); */
+	/* editor->priv->selected_site = all; */
+	/* ephy_node_view_select_node (EPHY_NODE_VIEW (editor->priv->sites_view), */
+	/* 			    all); */
+	/* g_signal_handlers_unblock_by_func */
+	/* 	(G_OBJECT (editor->priv->sites_view), */
+	/* 	 G_CALLBACK (site_node_selected_cb), */
+	/* 	 editor); */
+
+	/* setup_filters (editor, TRUE, FALSE); */
+	filter_now (editor);
 }
 
 static void
 time_combo_changed_cb (GtkWidget *combo, EphyHistoryWindow *editor)
 {
-	setup_filters (editor, TRUE, TRUE);
+	filter_now (editor);
+	/* setup_filters (editor, TRUE, TRUE); */
 }
 
 static GtkWidget *
@@ -1089,6 +1099,142 @@ view_selection_changed_cb (GtkWidget *view, EphyHistoryWindow *editor)
 }
 
 static void
+setup_time_filters (EphyHistoryWindow *editor,
+		    gint64 *from, gint64 *to)
+{
+	time_t now, midnight, cmp_time = 0;
+	struct tm btime;
+	int time_range, days = 0;
+
+	time_range = gtk_combo_box_get_active
+		(GTK_COMBO_BOX (editor->priv->time_combo));
+
+	*from = *to = -1;
+
+	/* no need to setup a new filter */
+	if (time_range == EPHY_PREFS_STATE_HISTORY_DATE_FILTER_EVER) return;
+
+	now = time (NULL);
+	if (localtime_r (&now, &btime) == NULL) return;
+
+	/* get start of day */
+	btime.tm_sec = 0;
+	btime.tm_min = 0;
+	btime.tm_hour = 0;
+	midnight = mktime (&btime);
+
+	switch (time_range)
+	{
+		case EPHY_PREFS_STATE_HISTORY_DATE_FILTER_LAST_HALF_HOUR:
+			cmp_time = now - 30 * 60;
+			break;
+		case EPHY_PREFS_STATE_HISTORY_DATE_FILTER_TODAY:
+			cmp_time = midnight;
+			break;
+		case EPHY_PREFS_STATE_HISTORY_DATE_FILTER_LAST_TWO_DAYS:
+			days++;
+			cmp_time = midnight;
+			break;
+		case EPHY_PREFS_STATE_HISTORY_DATE_FILTER_LAST_THREE_DAYS:
+			days++;
+			cmp_time = midnight;
+			break;
+		default:
+			g_return_if_reached ();
+			break;
+	}
+
+	while (--days >= 0)
+	{
+		/* subtract 1 day */
+		cmp_time -= 43200;
+		localtime_r (&cmp_time, &btime);
+		btime.tm_sec = 0;
+		btime.tm_min = 0;
+		btime.tm_hour = 0;
+		cmp_time = mktime (&btime);
+	}
+
+	*from = cmp_time;
+}
+
+static GList *
+substrings_filter (EphyHistoryWindow *editor)
+{
+  const char *search_text;
+  char **tokens, **p;
+  GList *substrings = NULL;
+
+  search_text = gtk_entry_get_text (GTK_ENTRY (editor->priv->search_entry));
+  tokens = p = g_strsplit (search_text, " ", -1);
+
+  while (*p) {
+    substrings = g_list_prepend (substrings, *p++);
+  };
+  substrings = g_list_reverse (substrings);
+  g_free (tokens);
+
+  return substrings;
+}
+
+static GList*
+get_sites_from_urls (GList *urls)
+{
+  GList *l, *hosts = NULL;
+  EphyHistoryURL *url;
+
+  /* We use a hash table to know which items are already in the list
+     of hosts without the need to traverse the list.*/
+
+  GHashTable * table = g_hash_table_new (g_int_hash,
+					 g_int_equal);
+  for (l = urls; l != NULL; l = l->next) {
+    url = l->data;
+    if (!g_hash_table_lookup (table, &url->host->id)) {
+      g_hash_table_insert (table, &url->host->id, GINT_TO_POINTER (TRUE));
+      hosts = g_list_prepend (hosts, ephy_history_host_copy (url->host));
+    }
+  }
+  g_hash_table_unref (table);
+
+  return g_list_reverse (hosts);
+}
+
+static void
+on_find_urls_cb (gpointer service,
+		 gboolean success,
+		 gpointer result_data,
+		 gpointer user_data)
+{
+  EphyHistoryWindow *window = EPHY_HISTORY_WINDOW (user_data);
+  GList *urls;
+  GList *sites;
+  if (success != TRUE)
+    return;
+
+  urls = (GList *)result_data;
+  gtk_list_store_clear (GTK_LIST_STORE (window->priv->history_store));
+  ephy_history_store_add_urls (window->priv->history_store, urls);
+  sites = get_sites_from_urls (urls);
+  g_list_free_full (urls, (GDestroyNotify)ephy_history_url_free);
+}
+
+static void
+filter_now (EphyHistoryWindow *editor)
+{
+	gint64 from, to;
+	GList *substrings;
+
+	setup_time_filters (editor, &from, &to);
+	substrings = substrings_filter (editor);
+
+        ephy_browse_history_find_urls (editor->priv->browse_history,
+				       from, to,
+				       substrings,
+				       (EphyHistoryJobCallback)on_find_urls_cb, editor);
+}
+
+static void
 ephy_history_window_construct (EphyHistoryWindow *editor)
 {
 	GtkTreeViewColumn *col;
@@ -1096,7 +1242,9 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
 	GtkWidget *vbox, *hpaned;
 	GtkWidget *pages_view, *sites_view;
 	GtkWidget *scrolled_window;
-	EphyNode *node;
+	EphyHistoryStore *history_store;
+	EphyHostsStore *hosts_store;
+	/* EphyNode *node; */
 	GtkUIManager *ui_merge;
 	GtkActionGroup *action_group;
 	GtkAction *action;
@@ -1146,7 +1294,7 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
 	g_assert (editor->priv->history);
 
 	/* Sites View */
-	node = ephy_history_get_hosts (editor->priv->history);
+	/* node = ephy_history_get_hosts (editor->priv->history); */
 	scrolled_window = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
 					"hadjustment", NULL,
 					"vadjustment", NULL,
@@ -1156,43 +1304,46 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
 					NULL);
 	gtk_paned_pack1 (GTK_PANED (hpaned), scrolled_window, TRUE, FALSE);
 	gtk_widget_show (scrolled_window);
-	editor->priv->sites_filter = ephy_node_filter_new ();
-	sites_view = ephy_node_view_new (node, editor->priv->sites_filter);
+	/* editor->priv->sites_filter = ephy_node_filter_new (); */
+	hosts_store = ephy_hosts_store_new ();
+	sites_view = ephy_hosts_view_new ();
+	gtk_tree_view_set_model (GTK_TREE_VIEW (sites_view),
+				 GTK_TREE_MODEL (hosts_store));
 	add_focus_monitor (editor, sites_view);
-	url_col_id = ephy_node_view_add_data_column (EPHY_NODE_VIEW (sites_view),
-					             G_TYPE_STRING,
-					             EPHY_NODE_PAGE_PROP_LOCATION,
-						     NULL, NULL);
-	title_col_id = ephy_node_view_add_column (EPHY_NODE_VIEW (sites_view), _("Sites"),
-						  G_TYPE_STRING,
-						  EPHY_NODE_PAGE_PROP_TITLE,
-						  EPHY_NODE_VIEW_SEARCHABLE |
-						  EPHY_NODE_VIEW_SHOW_PRIORITY,
-						  provide_favicon,
-						  NULL);
-	ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (sites_view),
-					   page_drag_types,
-				           G_N_ELEMENTS (page_drag_types),
-					   url_col_id,
-					   title_col_id);
+	/* url_col_id = ephy_node_view_add_data_column (EPHY_NODE_VIEW (sites_view), */
+	/* 				             G_TYPE_STRING, */
+	/* 				             EPHY_NODE_PAGE_PROP_LOCATION, */
+	/* 					     NULL, NULL); */
+	/* title_col_id = ephy_node_view_add_column (EPHY_NODE_VIEW (sites_view), _("Sites"), */
+	/* 					  G_TYPE_STRING, */
+	/* 					  EPHY_NODE_PAGE_PROP_TITLE, */
+	/* 					  EPHY_NODE_VIEW_SEARCHABLE | */
+	/* 					  EPHY_NODE_VIEW_SHOW_PRIORITY, */
+	/* 					  provide_favicon, */
+	/* 					  NULL); */
+	/* ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (sites_view), */
+	/* 				   page_drag_types, */
+	/* 			           G_N_ELEMENTS (page_drag_types), */
+	/* 				   url_col_id, */
+	/* 				   title_col_id); */
 	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (sites_view));
 	gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
-	ephy_node_view_set_priority (EPHY_NODE_VIEW (sites_view),
-				     EPHY_NODE_PAGE_PROP_PRIORITY);
-	ephy_node_view_set_sort (EPHY_NODE_VIEW (sites_view), G_TYPE_STRING,
-				 EPHY_NODE_PAGE_PROP_TITLE,
-				 GTK_SORT_ASCENDING);
+	/* ephy_node_view_set_priority (EPHY_NODE_VIEW (sites_view), */
+	/* 			     EPHY_NODE_PAGE_PROP_PRIORITY); */
+	/* ephy_node_view_set_sort (EPHY_NODE_VIEW (sites_view), G_TYPE_STRING, */
+	/* 			 EPHY_NODE_PAGE_PROP_TITLE, */
+	/* 			 GTK_SORT_ASCENDING); */
 	gtk_container_add (GTK_CONTAINER (scrolled_window), sites_view);
 	gtk_widget_show (sites_view);
 	editor->priv->sites_view = sites_view;
-	editor->priv->selected_site = ephy_history_get_pages (editor->priv->history);
-	ephy_node_view_select_node (EPHY_NODE_VIEW (sites_view),
-				    editor->priv->selected_site);
-
-	g_signal_connect (G_OBJECT (sites_view),
-			  "node_selected",
-			  G_CALLBACK (site_node_selected_cb),
-			  editor);
+	/* editor->priv->selected_site = ephy_history_get_pages (editor->priv->history); */
+	/* ephy_node_view_select_node (EPHY_NODE_VIEW (sites_view), */
+	/* 			    editor->priv->selected_site); */
+
+	/* g_signal_connect (G_OBJECT (sites_view), */
+	/* 		  "node_selected", */
+	/* 		  G_CALLBACK (site_node_selected_cb), */
+	/* 		  editor); */
 	g_signal_connect (G_OBJECT (sites_view),
 			  "key_press_event",
 			  G_CALLBACK (key_pressed_cb),
@@ -1220,45 +1371,56 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
 					NULL);
 	gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
 	gtk_widget_show (scrolled_window);
-	node = ephy_history_get_pages (editor->priv->history);
-	editor->priv->pages_filter = ephy_node_filter_new ();
-	pages_view = ephy_node_view_new (node, editor->priv->pages_filter);
+	/* node = ephy_history_get_pages (editor->priv->history); */
+	/* editor->priv->pages_filter = ephy_node_filter_new (); */
+	/* pages_view = ephy_node_view_new (node, editor->priv->pages_filter); */
+	editor->priv->pages_view = pages_view = ephy_history_view_new ();
+        history_store = ephy_history_store_new ();
+        gtk_tree_view_set_model (GTK_TREE_VIEW (pages_view), GTK_TREE_MODEL (history_store));
 	add_focus_monitor (editor, pages_view);
 	selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (pages_view));
 	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (pages_view), TRUE);
-	title_col_id = ephy_node_view_add_column (EPHY_NODE_VIEW (pages_view), _("Title"),
-				                  G_TYPE_STRING, EPHY_NODE_PAGE_PROP_TITLE,
-				                  EPHY_NODE_VIEW_SORTABLE |
-					          EPHY_NODE_VIEW_SEARCHABLE |
-						  EPHY_NODE_VIEW_ELLIPSIZED, NULL, &col);
+	/* title_col_id = ephy_node_view_add_column (EPHY_NODE_VIEW (pages_view), _("Title"), */
+	/* 			                  G_TYPE_STRING, EPHY_NODE_PAGE_PROP_TITLE, */
+	/* 			                  EPHY_NODE_VIEW_SORTABLE | */
+	/* 				          EPHY_NODE_VIEW_SEARCHABLE | */
+	/* 					  EPHY_NODE_VIEW_ELLIPSIZED, NULL, &col); */
+	title_col_id = 0;
+	col = gtk_tree_view_get_column (GTK_TREE_VIEW (pages_view), title_col_id);
+
 	gtk_tree_view_column_set_min_width (col, 300);
 	gtk_tree_view_column_set_resizable (col, TRUE);
 	editor->priv->title_col = col;
-	
-	url_col_id = ephy_node_view_add_column (EPHY_NODE_VIEW (pages_view), _("Address"),
-				                G_TYPE_STRING, EPHY_NODE_PAGE_PROP_LOCATION,
-				                EPHY_NODE_VIEW_SORTABLE |
-						EPHY_NODE_VIEW_ELLIPSIZED, NULL, &col);
+
+	/* url_col_id = ephy_node_view_add_column (EPHY_NODE_VIEW (pages_view), _("Address"), */
+	/* 			                G_TYPE_STRING, EPHY_NODE_PAGE_PROP_LOCATION, */
+	/* 			                EPHY_NODE_VIEW_SORTABLE | */
+	/* 					EPHY_NODE_VIEW_ELLIPSIZED, NULL, &col); */
+	url_col_id = 1;
+	col = gtk_tree_view_get_column (GTK_TREE_VIEW (pages_view), url_col_id);
 	gtk_tree_view_column_set_min_width (col, 300);
 	gtk_tree_view_column_set_resizable (col, TRUE);
 	editor->priv->address_col = col;
 
-	datetime_col_id = ephy_node_view_add_column (EPHY_NODE_VIEW (pages_view), _("Date"),
-						     G_TYPE_INT, EPHY_NODE_PAGE_PROP_LAST_VISIT,
-						     EPHY_NODE_VIEW_SORTABLE, NULL, &col);
+	/* datetime_col_id = ephy_node_view_add_column (EPHY_NODE_VIEW (pages_view), _("Date"), */
+	/* 					     G_TYPE_INT, EPHY_NODE_PAGE_PROP_LAST_VISIT, */
+	/* 					     EPHY_NODE_VIEW_SORTABLE, NULL, &col); */
+	datetime_col_id = 2;
+	col = gtk_tree_view_get_column (GTK_TREE_VIEW (pages_view), datetime_col_id);
 	editor->priv->datetime_col = col;
 	parse_time_into_date (editor->priv->datetime_col, datetime_col_id);
 
-	ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (pages_view),
-					   page_drag_types,
-				           G_N_ELEMENTS (page_drag_types),
-					   url_col_id, title_col_id);
-	ephy_node_view_set_sort (EPHY_NODE_VIEW (pages_view), G_TYPE_INT,
-				 EPHY_NODE_PAGE_PROP_LAST_VISIT,
-				 GTK_SORT_DESCENDING);
+	/* ephy_node_view_enable_drag_source (EPHY_NODE_VIEW (pages_view), */
+	/* 				   page_drag_types, */
+	/* 			           G_N_ELEMENTS (page_drag_types), */
+	/* 				   url_col_id, title_col_id); */
+	/* ephy_node_view_set_sort (EPHY_NODE_VIEW (pages_view), G_TYPE_INT, */
+	/* 			 EPHY_NODE_PAGE_PROP_LAST_VISIT, */
+	/* 			 GTK_SORT_DESCENDING); */
 	gtk_container_add (GTK_CONTAINER (scrolled_window), pages_view);
 	gtk_widget_show (pages_view);
 	editor->priv->pages_view = pages_view;
+        editor->priv->history_store = history_store;
 
 	action = gtk_action_group_get_action (action_group, "ViewTitle");
 	g_settings_bind (EPHY_SETTINGS_STATE,
@@ -1290,26 +1452,26 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
 			 editor->priv->datetime_col, "visible",
 			 G_SETTINGS_BIND_DEFAULT);
 
-	g_signal_connect (G_OBJECT (pages_view),
-			  "node_activated",
-			  G_CALLBACK (ephy_history_window_node_activated_cb),
-			  editor);
-	g_signal_connect (G_OBJECT (pages_view),
-			  "node-middle-clicked",
-			  G_CALLBACK (ephy_history_window_node_middle_clicked_cb),
-			  editor);
+	/* g_signal_connect (G_OBJECT (pages_view), */
+	/* 		  "node_activated", */
+	/* 		  G_CALLBACK (ephy_history_window_node_activated_cb), */
+	/* 		  editor); */
+	/* g_signal_connect (G_OBJECT (pages_view), */
+	/* 		  "node-middle-clicked", */
+	/* 		  G_CALLBACK (ephy_history_window_node_middle_clicked_cb), */
+	/* 		  editor); */
 	g_signal_connect (G_OBJECT (pages_view),
 			  "popup_menu",
 			  G_CALLBACK (ephy_history_window_show_popup_cb),
 			  editor);
-	g_signal_connect (G_OBJECT (pages_view),
-			  "key_press_event",
-			  G_CALLBACK (key_pressed_cb),
-			  editor);
-	g_signal_connect (G_OBJECT (selection),
-			  "changed",
-			  G_CALLBACK (view_selection_changed_cb),
-			  editor);
+	/* g_signal_connect (G_OBJECT (pages_view), */
+	/* 		  "key_press_event", */
+	/* 		  G_CALLBACK (key_pressed_cb), */
+	/* 		  editor); */
+	/* g_signal_connect (G_OBJECT (selection), */
+	/* 		  "changed", */
+	/* 		  G_CALLBACK (view_selection_changed_cb), */
+	/* 		  editor); */
 
 	ephy_state_add_window (GTK_WIDGET (editor),
 			       "history_window",
@@ -1319,7 +1481,8 @@ ephy_history_window_construct (EphyHistoryWindow *editor)
 			       "history_paned",
 		               130);
 
-	setup_filters (editor, TRUE, TRUE);
+	/* setup_filters (editor, TRUE, TRUE); */
+	filter_now (editor);
 }
 
 void



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