[epiphany] Redesign the history dialog



commit 865db790651c20293dfb0ccc4a49a80ba51cf74b
Author: William Jon McCann <william jon mccann gmail com>
Date:   Fri Jan 3 11:35:57 2014 -0500

    Redesign the history dialog
    
    https://bugzilla.gnome.org/show_bug.cgi?id=721415

 src/Makefile.am                              |    1 -
 src/ephy-history-window.c                    | 1449 +++++++-------------------
 src/ephy-history-window.h                    |    4 +-
 src/ephy-shell.c                             |   10 +-
 src/epiphany.gresource.xml                   |    2 +-
 src/resources/epiphany-history-window-ui.xml |   47 -
 src/resources/history-dialog.ui              |  356 +++++++
 src/window-commands.c                        |    4 +
 8 files changed, 768 insertions(+), 1105 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index fa1d583..d124ad0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -101,7 +101,6 @@ libephymain_la_CFLAGS = \
 
 RESOURCE_FILES = \
        resources/epiphany-bookmark-editor-ui.xml \
-       resources/epiphany-history-window-ui.xml  \
        resources/epiphany-ui.xml                 \
        resources/epiphany.ui                     \
        resources/epiphany-application-menu.ui    \
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 9dc3abc..7b94277 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -25,194 +25,154 @@
 
 #include "ephy-bookmarks-ui.h"
 #include "ephy-debug.h"
-#include "ephy-dnd.h"
-#include "ephy-file-helpers.h"
 #include "ephy-gui.h"
-#include "ephy-hosts-store.h"
-#include "ephy-hosts-view.h"
 #include "ephy-prefs.h"
-#include "ephy-session.h"
 #include "ephy-settings.h"
 #include "ephy-shell.h"
-#include "ephy-initial-state.h"
 #include "ephy-time-helpers.h"
-#include "ephy-urls-store.h"
-#include "ephy-urls-view.h"
 #include "ephy-window.h"
-#include "window-commands.h"
 
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
 #include <string.h>
 #include <time.h>
 
-static const GtkTargetEntry page_drag_types [] =
-{
-       { EPHY_DND_URL_TYPE,        0, 0 },
-       { EPHY_DND_URI_LIST_TYPE,   0, 1 },
-       { EPHY_DND_TEXT_TYPE,       0, 2 }
-};
-
-static void ephy_history_window_constructed (GObject *object);
-static void ephy_history_window_class_init (EphyHistoryWindowClass *klass);
-static void ephy_history_window_init (EphyHistoryWindow *editor);
-static void ephy_history_window_finalize (GObject *object);
-static void ephy_history_window_set_property (GObject *object,
-                                             guint prop_id,
-                                             const GValue *value,
-                                             GParamSpec *pspec);
-static void ephy_history_window_get_property (GObject *object,
-                                             guint prop_id,
-                                             GValue *value,
-                                             GParamSpec *pspec);
-static void ephy_history_window_dispose             (GObject *object);
-
-static void cmd_open_bookmarks_in_tabs   (GtkAction *action,
-                                          EphyHistoryWindow *editor);
-static void cmd_open_bookmarks_in_browser (GtkAction *action,
-                                          EphyHistoryWindow *editor);
-static void cmd_delete                   (GtkAction *action,
-                                          EphyHistoryWindow *editor);
-static void cmd_bookmark_link            (GtkAction *action,
-                                          EphyHistoryWindow *editor);
-static void cmd_clear                    (GtkAction *action,
-                                          EphyHistoryWindow *editor);
-static void cmd_close                    (GtkAction *action,
-                                          EphyHistoryWindow *editor);
-static void cmd_cut                      (GtkAction *action,
-                                          EphyHistoryWindow *editor);
-static void cmd_copy                     (GtkAction *action,
-                                          EphyHistoryWindow *editor);
-static void cmd_paste                    (GtkAction *action,
-                                          EphyHistoryWindow *editor);
-static void cmd_select_all               (GtkAction *action,
-                                          EphyHistoryWindow *editor);
-static void cmd_help_contents            (GtkAction *action,
-                                          EphyHistoryWindow *editor);
-static void search_entry_changed_cb      (GtkWidget *entry,
-                                          EphyHistoryWindow *editor);
-static void
-filter_now (EphyHistoryWindow *editor, gboolean hosts, gboolean pages);
-
-#define EPHY_HISTORY_WINDOW_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), 
EPHY_TYPE_HISTORY_WINDOW, EphyHistoryWindowPrivate))
+#define NUM_RESULTS_LIMIT -1
 
 struct _EphyHistoryWindowPrivate
 {
        EphyHistoryService *history_service;
        GCancellable *cancellable;
-       GtkWidget *hosts_view;
-       GtkWidget *pages_view;
-       EphyURLsStore *urls_store;
-       EphyHostsStore *hosts_store;
-       GtkWidget *time_combo;
-       GtkWidget *search_entry;
-       GtkWidget *main_vbox;
+
+       GtkWidget *treeview;
+       GtkWidget *liststore;
+       GtkWidget *date_column;
+       GtkWidget *date_renderer;
+       GtkWidget *remove_button;
+       GtkWidget *open_button;
+       GtkWidget *clear_button;
+       GtkWidget *open_menuitem;
+       GtkWidget *bookmark_menuitem;
+       GtkWidget *delete_menuitem;
+       GtkWidget *copy_location_menuitem;
+       GtkWidget *treeview_popup_menu;
+
+       char *search_text;
        GtkWidget *window;
-       GtkUIManager *ui_merge;
-       GtkActionGroup *action_group;
+
        GtkWidget *confirmation_dialog;
-       GtkTreeViewColumn *title_col;
-       GtkTreeViewColumn *address_col;
-       GtkTreeViewColumn *datetime_col;
 };
 
+G_DEFINE_TYPE_WITH_PRIVATE (EphyHistoryWindow, ephy_history_window, GTK_TYPE_DIALOG)
+
 enum
 {
        PROP_0,
        PROP_HISTORY_SERVICE,
 };
 
-static const GtkActionEntry ephy_history_ui_entries [] = {
-       /* Toplevel */
-       { "File", NULL, N_("_File") },
-       { "Edit", NULL, N_("_Edit") },
-       { "View", NULL, N_("_View") },
-       { "Help", NULL, N_("_Help") },
-       { "PopupAction", NULL, "" },
-
-       /* File Menu */
-       { "OpenInWindow", NULL, N_("Open in New _Window"), "<control>O",
-         N_("Open the selected history link in a new window"),
-         G_CALLBACK (cmd_open_bookmarks_in_browser) },
-       { "OpenInTab", NULL, N_("Open in New _Tab"), "<shift><control>O",
-         N_("Open the selected history link in a new tab"),
-         G_CALLBACK (cmd_open_bookmarks_in_tabs) },
-       { "BookmarkLink", NULL, N_("Add _Bookmark…"), "<control>D",
-         N_("Bookmark the selected history link"),
-         G_CALLBACK (cmd_bookmark_link) },
-       { "Close", NULL, N_("_Close"), "<control>W",
-         N_("Close the history window"),
-         G_CALLBACK (cmd_close) },
-
-       /* Edit Menu */
-       { "Cut", NULL, N_("Cu_t"), "<control>X",
-         N_("Cut the selection"),
-         G_CALLBACK (cmd_cut) },
-       { "Copy", NULL, N_("_Copy"), "<control>C",
-         N_("Copy the selection"),
-         G_CALLBACK (cmd_copy) },
-       { "Paste", NULL, N_("_Paste"), "<control>V",
-         N_("Paste the clipboard"),
-         G_CALLBACK (cmd_paste) },
-       { "Delete", NULL, N_("_Delete"), "<control>T",
-         N_("Delete the selected history link"),
-         G_CALLBACK (cmd_delete) },
-       { "SelectAll", NULL, N_("Select _All"), "<control>A",
-         N_("Select all history links or text"),
-         G_CALLBACK (cmd_select_all) },
-       { "Clear", NULL, N_("Clear _History"), NULL,
-         N_("Clear your browsing history"),
-         G_CALLBACK (cmd_clear) },
-
-       /* Help Menu */
-       { "HelpContents", NULL, N_("_Contents"), "F1",
-         N_("Display history help"),
-         G_CALLBACK (cmd_help_contents) },
-       { "HelpAbout", NULL, N_("_About"), NULL,
-         N_("Display credits for the web browser creators"),
-         G_CALLBACK (window_cmd_help_about) },
-};
-
 typedef enum
 {
-       VIEW_TITLE = 1 << 0,
-       VIEW_ADDRESS = 1 << 1,
-       VIEW_DATETIME = 1 << 2
+       COLUMN_DATE,
+       COLUMN_NAME,
+       COLUMN_LOCATION
 } EphyHistoryWindowColumns;
 
-static const GtkToggleActionEntry ephy_history_toggle_entries [] =
+static void
+add_urls (GtkListStore *store,
+         GList *urls)
 {
-       /* View Menu */
-       { "ViewTitle", NULL, N_("_Title"), NULL,
-         N_("Show the title column"), NULL, TRUE },
-       { "ViewAddress", NULL, N_("_Address"), NULL,
-         N_("Show the address column"), NULL, TRUE },
-       { "ViewDateTime", NULL, N_("_Date and Time"), NULL,
-         N_("Show the date and time column"), NULL, TRUE }
-};
+       EphyHistoryURL *url;
+       GList *iter;
+
+       for (iter = urls; iter != NULL; iter = iter->next) {
+               url = (EphyHistoryURL *)iter->data;
+               gtk_list_store_insert_with_values (store,
+                                                  NULL, G_MAXINT,
+                                                  COLUMN_DATE, url->last_visit_time,
+                                                  COLUMN_NAME, url->title,
+                                                  COLUMN_LOCATION, url->url,
+                                                  -1);
+       }
+}
+
+static void
+on_find_urls_cb (gpointer service,
+                gboolean success,
+                gpointer result_data,
+                gpointer user_data)
+{
+       EphyHistoryWindow *self = EPHY_HISTORY_WINDOW (user_data);
+       GList *urls;
+
+       if (success != TRUE)
+               return;
+
+       urls = (GList *)result_data;
+       gtk_list_store_clear (GTK_LIST_STORE (self->priv->liststore));
+       add_urls (GTK_LIST_STORE (self->priv->liststore), urls);
+       g_list_free_full (urls, (GDestroyNotify)ephy_history_url_free);
+}
+
+static GList *
+substrings_filter (EphyHistoryWindow *self)
+{
+       char **tokens, **p;
+       GList *substrings = NULL;
+
+       if (self->priv->search_text == NULL)
+               return NULL;
+
+       tokens = p = g_strsplit (self->priv->search_text, " ", -1);
+
+       while (*p) {
+               substrings = g_list_prepend (substrings, *p++);
+       };
+       g_free (tokens);
+
+       return substrings;
+}
+
+static void
+filter_now (EphyHistoryWindow *self)
+{
+       gint64 from, to;
+       GList *substrings;
+
+       substrings = substrings_filter (self);
+
+       from = to = -1; /* all */
+       ephy_history_service_find_urls (self->priv->history_service,
+                                       from, to,
+                                       NUM_RESULTS_LIMIT, 0,
+                                       substrings,
+                                       EPHY_HISTORY_SORT_MOST_RECENTLY_VISITED,
+                                       self->priv->cancellable,
+                                       (EphyHistoryJobCallback)on_find_urls_cb, self);
+}
 
 static void
 confirmation_dialog_response_cb (GtkWidget *dialog,
                                 int response,
-                                EphyHistoryWindow *editor)
+                                EphyHistoryWindow *self)
 {
        gtk_widget_destroy (dialog);
 
        if (response == GTK_RESPONSE_ACCEPT)
        {
-               ephy_history_service_clear (editor->priv->history_service,
+               ephy_history_service_clear (self->priv->history_service,
                                            NULL, NULL, NULL);
-               filter_now (editor, TRUE, TRUE);
+               filter_now (self);
        }
 }
 
 static GtkWidget *
-confirmation_dialog_construct (EphyHistoryWindow *editor)
+confirmation_dialog_construct (EphyHistoryWindow *self)
 {
        GtkWidget *dialog, *button;
 
        dialog = gtk_message_dialog_new
-               (GTK_WINDOW (editor),
+               (GTK_WINDOW (self),
                 GTK_DIALOG_DESTROY_WITH_PARENT,
                 GTK_MESSAGE_WARNING,
                 GTK_BUTTONS_CANCEL,
@@ -223,7 +183,7 @@ confirmation_dialog_construct (EphyHistoryWindow *editor)
                 _("Clearing the browsing history will cause all"
                   " history links to be permanently deleted."));
 
-       gtk_window_group_add_window (ephy_gui_ensure_window_group (GTK_WINDOW (editor)),
+       gtk_window_group_add_window (ephy_gui_ensure_window_group (GTK_WINDOW (self)),
                                     GTK_WINDOW (dialog));
        
        button = gtk_button_new_with_mnemonic (_("Cl_ear"));
@@ -236,66 +196,33 @@ confirmation_dialog_construct (EphyHistoryWindow *editor)
 
        g_signal_connect (dialog, "response",
                          G_CALLBACK (confirmation_dialog_response_cb),
-                         editor);
+                         self);
 
        return dialog;
 }
 
-static EphyHistoryHost *
-get_selected_host (EphyHistoryWindow *editor)
-{
-       GtkTreeSelection *selection;
-       GtkTreeIter iter;
-       GtkTreePath *path;
-       GtkTreeModel *model;
-       EphyHistoryHost *host = NULL;
-
-       EphyHistoryWindowPrivate *priv = editor->priv;
-
-       selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->hosts_view));
-       if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
-               path = gtk_tree_model_get_path (model, &iter);
-               host = ephy_hosts_store_get_host_from_path (priv->hosts_store,
-                                                           path);
-               gtk_tree_path_free (path);
-       }
-       return host;
-}
-
 static void
-cmd_clear (GtkAction *action,
-          EphyHistoryWindow *editor)
+clear_all_history (EphyHistoryWindow *self)
 {
-       if (editor->priv->confirmation_dialog == NULL)
+       if (self->priv->confirmation_dialog == NULL)
        {
                GtkWidget **confirmation_dialog;
 
-               editor->priv->confirmation_dialog = confirmation_dialog_construct (editor);
-               confirmation_dialog = &editor->priv->confirmation_dialog;
-               g_object_add_weak_pointer (G_OBJECT (editor->priv->confirmation_dialog),
+               self->priv->confirmation_dialog = confirmation_dialog_construct (self);
+               confirmation_dialog = &self->priv->confirmation_dialog;
+               g_object_add_weak_pointer (G_OBJECT (self->priv->confirmation_dialog),
                                           (gpointer *) confirmation_dialog);
        }
 
-       gtk_widget_show (editor->priv->confirmation_dialog);
-}
-
-static void
-cmd_close (GtkAction *action,
-          EphyHistoryWindow *editor)
-{
-       if (editor->priv->confirmation_dialog != NULL)
-       {
-               gtk_widget_destroy (editor->priv->confirmation_dialog);
-       }
-       gtk_widget_hide (GTK_WIDGET (editor));
+       gtk_widget_show (self->priv->confirmation_dialog);
 }
 
 static GtkWidget *
-get_target_window (EphyHistoryWindow *editor)
+get_target_window (EphyHistoryWindow *self)
 {
-       if (editor->priv->window)
+       if (self->priv->window)
        {
-               return editor->priv->window;
+               return self->priv->window;
        }
        else
        {
@@ -304,179 +231,124 @@ get_target_window (EphyHistoryWindow *editor)
 }
 
 static void
-cmd_open_bookmarks_in_tabs (GtkAction *action,
-                           EphyHistoryWindow *editor)
+on_browse_history_deleted_cb (gpointer service,
+                             gboolean success,
+                             gpointer result_data,
+                             gpointer user_data)
 {
-       EphyWindow *window;
-       GList *selection;
-       GList *l;
+       EphyHistoryWindow *self = EPHY_HISTORY_WINDOW (user_data);
 
-       window = EPHY_WINDOW (get_target_window (editor));
-       selection = ephy_urls_view_get_selection (EPHY_URLS_VIEW (editor->priv->pages_view));
-
-       for (l = selection; l; l = l->next)
-       {
-               EphyHistoryURL *url = l->data;
-               ephy_shell_new_tab (ephy_shell_get_default (),
-                                   window, NULL, url->url,
-                                   EPHY_NEW_TAB_OPEN_PAGE |
-                                   EPHY_NEW_TAB_IN_EXISTING_WINDOW);
-       }
+       if (success != TRUE)
+               return;
 
-       g_list_free_full (selection, (GDestroyNotify) ephy_history_url_free);
+       filter_now (self);
 }
 
-static void
-cmd_open_bookmarks_in_browser (GtkAction *action,
-                              EphyHistoryWindow *editor)
+static EphyHistoryURL *
+get_url_from_path (GtkTreeModel *model,
+                  GtkTreePath *path)
 {
-       EphyWindow *window;
-       GList *selection;
-       GList *l;
+       GtkTreeIter iter;
 
-       window = EPHY_WINDOW (get_target_window (editor));
-       selection = ephy_urls_view_get_selection (EPHY_URLS_VIEW (editor->priv->pages_view));
+       EphyHistoryURL *url = ephy_history_url_new (NULL, NULL, 0, 0, 0);
 
-       for (l = selection; l; l = l->next)
-       {
-               EphyHistoryURL *url = l->data;
-               ephy_shell_new_tab (ephy_shell_get_default (),
-                                   window, NULL, url->url,
-                                   EPHY_NEW_TAB_OPEN_PAGE |
-                                   EPHY_NEW_TAB_IN_NEW_WINDOW);
-       }
+       gtk_tree_model_get_iter (model, &iter, path);
 
-       g_list_free_full (selection, (GDestroyNotify) ephy_history_url_free);
+       gtk_tree_model_get (model, &iter,
+                           COLUMN_NAME, &url->title,
+                           COLUMN_LOCATION, &url->url,
+                           -1);
+       return url;
 }
 
 static void
-cmd_cut (GtkAction *action,
-        EphyHistoryWindow *editor)
+get_selection_foreach (GtkTreeModel *model,
+                      GtkTreePath *path,
+                      GtkTreeIter *iter,
+                      gpointer *data)
 {
-       GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
+       EphyHistoryURL *url;
 
-       if (GTK_IS_EDITABLE (widget))
-       {
-               gtk_editable_cut_clipboard (GTK_EDITABLE (widget));
-       }
+       url = get_url_from_path (model, path);
+       *data = g_list_prepend (*data, url);
 }
 
-static void
-cmd_copy (GtkAction *action,
-         EphyHistoryWindow *editor)
+static GList *
+get_selection (EphyHistoryWindow *self)
 {
-       GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
-
-       if (GTK_IS_EDITABLE (widget))
-       {
-               gtk_editable_copy_clipboard (GTK_EDITABLE (widget));
-       }
-
-       else if (gtk_widget_is_focus (editor->priv->pages_view))
-       {
-               GList *selection;
-
-               selection = ephy_urls_view_get_selection (EPHY_URLS_VIEW (editor->priv->pages_view));
+       GtkTreeSelection *selection;
+       GList *list = NULL;
 
-               if (g_list_length (selection) == 1)
-               {
-                       EphyHistoryURL *url = selection->data;
-                       gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), url->url, -1);
-               }
+       selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->priv->treeview));
+       gtk_tree_selection_selected_foreach (selection,
+                                            (GtkTreeSelectionForeachFunc) get_selection_foreach,
+                                            &list);
 
-               g_list_free_full (selection, (GDestroyNotify) ephy_history_url_free);
-       }
+       return g_list_reverse (list);
 }
 
 static void
-cmd_paste (GtkAction *action,
-          EphyHistoryWindow *editor)
+delete_selected (EphyHistoryWindow *self)
 {
-       GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
+       GList *selected;
 
-       if (GTK_IS_EDITABLE (widget))
-       {
-               gtk_editable_paste_clipboard (GTK_EDITABLE (widget));
-       }
+       selected = get_selection (self);
+       ephy_history_service_delete_urls (self->priv->history_service, selected, self->priv->cancellable,
+                                         (EphyHistoryJobCallback)on_browse_history_deleted_cb, self);
 }
 
 static void
-cmd_select_all (GtkAction *action,
-               EphyHistoryWindow *editor)
+open_selected (EphyHistoryWindow *self)
 {
-       GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (editor));
-       GtkWidget *pages_view = editor->priv->pages_view;
+       GList *selection;
+       GList *l;
+       EphyWindow *window;
 
-       if (GTK_IS_EDITABLE (widget))
-       {
-               gtk_editable_select_region (GTK_EDITABLE (widget), 0, -1);
-       }
-       else if (gtk_widget_is_focus (pages_view))
-       {
-               GtkTreeSelection *sel;
+       selection = get_selection (self);
 
-               sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (pages_view));
-               gtk_tree_selection_select_all (sel);
+       window = EPHY_WINDOW (get_target_window (self));
+       for (l = selection; l; l = l->next) {
+               EphyHistoryURL *url = l->data;
+               ephy_shell_new_tab (ephy_shell_get_default (),
+                                   window, NULL, url->url,
+                                   EPHY_NEW_TAB_OPEN_PAGE |
+                                   EPHY_NEW_TAB_IN_EXISTING_WINDOW);
        }
+
+       g_list_free_full (selection, (GDestroyNotify) ephy_history_url_free);
 }
 
 static void
-on_browse_history_deleted_cb (gpointer service,
-                             gboolean success,
-                             gpointer result_data,
-                             gpointer user_data)
+on_open_menuitem_activate (GtkMenuItem *menuitem,
+                          EphyHistoryWindow *self)
 {
-       EphyHistoryWindow *editor = EPHY_HISTORY_WINDOW (user_data);
-
-       if (success != TRUE)
-               return;
-
-       filter_now (editor, TRUE, TRUE);
+       open_selected (self);
 }
 
 static void
-on_host_deleted_cb (gpointer service,
-                   gboolean success,
-                   gpointer result_data,
-                   gpointer user_data)
+on_copy_location_menuitem_activate (GtkMenuItem *menuitem,
+                                   EphyHistoryWindow *self)
 {
-       EphyHistoryWindow *editor = EPHY_HISTORY_WINDOW (user_data);
-
-       if (success != TRUE)
-               return;
+       GList *selection;
 
-       filter_now (editor, TRUE, TRUE);
-}
+       selection = get_selection (self);
 
-static void
-cmd_delete (GtkAction *action,
-           EphyHistoryWindow *editor)
-{
-       if (gtk_widget_is_focus (editor->priv->pages_view))
-       {
-               GList *selected;
-               selected = ephy_urls_view_get_selection (EPHY_URLS_VIEW (editor->priv->pages_view));
-               ephy_history_service_delete_urls (editor->priv->history_service, selected, 
editor->priv->cancellable,
-                                                 (EphyHistoryJobCallback)on_browse_history_deleted_cb, 
editor);
-       } else if (gtk_widget_is_focus (editor->priv->hosts_view)) {
-               EphyHistoryHost *host = get_selected_host (editor);
-               if (host) {
-                       ephy_history_service_delete_host (editor->priv->history_service,
-                                                         host, editor->priv->cancellable,
-                                                         (EphyHistoryJobCallback)on_host_deleted_cb,
-                                                         editor);
-                       ephy_history_host_free (host);
-               }
+       if (g_list_length (selection) == 1) {
+               EphyHistoryURL *url = selection->data;
+               g_message ("URL %s", url->url);
+               gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), url->url, -1);
        }
+
+       g_list_free_full (selection, (GDestroyNotify) ephy_history_url_free);
 }
 
 static void
-cmd_bookmark_link (GtkAction *action,
-                  EphyHistoryWindow *editor)
+on_bookmark_menuitem_activate (GtkMenuItem *menuitem,
+                              EphyHistoryWindow *self)
 {
        GList *selection;
 
-       selection = ephy_urls_view_get_selection (EPHY_URLS_VIEW (editor->priv->pages_view));
+       selection = get_selection (self);
 
        if (g_list_length (selection) == 1)
        {
@@ -484,104 +356,78 @@ cmd_bookmark_link (GtkAction *action,
 
                url = selection->data;
 
-               ephy_bookmarks_ui_add_bookmark (GTK_WINDOW (editor), url->url, url->title);
+               ephy_bookmarks_ui_add_bookmark (GTK_WINDOW (self), url->url, url->title);
        }
 
        g_list_free_full (selection, (GDestroyNotify) ephy_history_url_free);
 }
 
 static void
-cmd_help_contents (GtkAction *action,
-                  EphyHistoryWindow *editor)
-{
-       ephy_gui_help (GTK_WIDGET (editor), "history");
-}
-
-G_DEFINE_TYPE (EphyHistoryWindow, ephy_history_window, GTK_TYPE_WINDOW)
-
-static void
-ephy_history_window_show (GtkWidget *widget)
+on_delete_menuitem_activate (GtkMenuItem *menuitem,
+                            EphyHistoryWindow *self)
 {
-       EphyHistoryWindow *window = EPHY_HISTORY_WINDOW (widget);
-
-       gtk_widget_grab_focus (window->priv->search_entry);
-
-       GTK_WIDGET_CLASS (ephy_history_window_parent_class)->show (widget);
+       delete_selected (self);
 }
 
-static void
-ephy_history_window_class_init (EphyHistoryWindowClass *klass)
-{
-       GObjectClass *object_class = G_OBJECT_CLASS (klass);
-       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
-       object_class->finalize = ephy_history_window_finalize;
-
-       object_class->set_property = ephy_history_window_set_property;
-       object_class->get_property = ephy_history_window_get_property;
-       object_class->dispose  = ephy_history_window_dispose;
-       object_class->constructed = ephy_history_window_constructed;
-
-       widget_class->show = ephy_history_window_show;
-
-       g_object_class_install_property (object_class,
-                                        PROP_HISTORY_SERVICE,
-                                        g_param_spec_object ("history-service",
-                                                             "History service",
-                                                             "History Service",
-                                                             EPHY_TYPE_HISTORY_SERVICE,
-                                                             G_PARAM_READWRITE | G_PARAM_STATIC_NAME | 
G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_CONSTRUCT_ONLY));
-
-       g_type_class_add_private (object_class, sizeof(EphyHistoryWindowPrivate));
-}
-
-static void
-ephy_history_window_finalize (GObject *object)
+static gboolean
+on_treeview_key_press_event (GtkWidget         *widget,
+                            GdkEventKey       *event,
+                            EphyHistoryWindow *self)
 {
-       EphyHistoryWindow *editor = EPHY_HISTORY_WINDOW (object);
-
-       g_object_unref (editor->priv->action_group);
-       g_object_unref (editor->priv->ui_merge);
-
-       if (editor->priv->window)
+       if (event->keyval == GDK_KEY_Delete || event->keyval == GDK_KEY_KP_Delete)
        {
-               GtkWidget **window = &editor->priv->window;
-               g_object_remove_weak_pointer
-                       (G_OBJECT(editor->priv->window),
-                        (gpointer *)window);
+               delete_selected (self);
+
+               return TRUE;
        }
 
-       G_OBJECT_CLASS (ephy_history_window_parent_class)->finalize (object);
+       return FALSE;
 }
 
-static void
-ephy_history_window_row_activated_cb (GtkTreeView *view,
-                                     GtkTreePath *path,
-                                     GtkTreeViewColumn *col,
-                                     EphyHistoryWindow *editor)
-{
-       EphyHistoryURL *url;
-
-       url = ephy_urls_store_get_url_from_path (EPHY_URLS_STORE (gtk_tree_view_get_model (view)),
-                                                path);
-       g_return_if_fail (url != NULL);
+static gboolean
+on_treeview_button_press_event (GtkWidget         *widget,
+                               GdkEventButton    *event,
+                               EphyHistoryWindow *self)
+{
+       if (event->button == 3) {
+               GtkTreeSelection *selection;
+               int n;
+               gboolean bookmarks_locked;
+
+               selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->priv->treeview));
+               n = gtk_tree_selection_count_selected_rows (selection);
+               if (n == 0)
+                       return FALSE;
+
+               gtk_widget_set_sensitive (self->priv->open_menuitem, (n > 0));
+               gtk_widget_set_sensitive (self->priv->copy_location_menuitem, (n > 0));
+               gtk_widget_set_sensitive (self->priv->delete_menuitem, (n > 0));
+
+               bookmarks_locked = g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+                                                          EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING);
+               gtk_widget_set_sensitive (self->priv->bookmark_menuitem, (n == 1 && !bookmarks_locked));
+
+               gtk_menu_popup (GTK_MENU (self->priv->treeview_popup_menu),
+                               NULL, NULL, NULL, NULL,
+                               event->button, event->time);
+               return TRUE;
+       }
 
-       ephy_shell_new_tab (ephy_shell_get_default (),
-                           NULL, NULL, url->url,
-                           EPHY_NEW_TAB_OPEN_PAGE);
-       ephy_history_url_free (url);
+       return FALSE;
 }
 
 static void
-ephy_history_window_row_middle_clicked_cb (EphyHistoryView *view,
-                                          GtkTreePath *path,
-                                          EphyHistoryWindow *editor)
+on_treeview_row_activated (GtkTreeView *view,
+                          GtkTreePath *path,
+                          GtkTreeViewColumn *col,
+                          EphyHistoryWindow *self)
 {
        EphyWindow *window;
        EphyHistoryURL *url;
 
-       window = EPHY_WINDOW (get_target_window (editor));
-       url = ephy_urls_store_get_url_from_path (editor->priv->urls_store, path);
+       window = EPHY_WINDOW (get_target_window (self));
+       url = get_url_from_path (gtk_tree_view_get_model (view),
+                                path);
        g_return_if_fail (url != NULL);
 
        ephy_shell_new_tab (ephy_shell_get_default (),
@@ -592,290 +438,205 @@ ephy_history_window_row_middle_clicked_cb (EphyHistoryView *view,
 }
 
 static void
-ephy_history_window_update_menu (EphyHistoryWindow *editor)
+on_search_entry_changed (GtkSearchEntry *entry,
+                        EphyHistoryWindow *self)
 {
-       gboolean open_in_window, open_in_tab;
-       gboolean cut, copy, paste, select_all;
-       gboolean pages_focus, pages_selection, single_page_selected;
-       gboolean delete, bookmark_page;
-       gboolean bookmarks_locked;
-       int num_pages_selected;
-       GtkActionGroup *action_group;
-       GtkAction *action;
-       char *open_in_window_label, *open_in_tab_label, *copy_label;
-       GtkWidget *focus_widget;
-
-       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;
-       single_page_selected = num_pages_selected == 1;
-
-       focus_widget = gtk_window_get_focus (GTK_WINDOW (editor));
-
-       if (GTK_IS_EDITABLE (focus_widget))
-       {
-               gboolean has_selection;
+       const char *text;
 
-               has_selection = gtk_editable_get_selection_bounds
-                       (GTK_EDITABLE (focus_widget), NULL, NULL);
+       text = gtk_entry_get_text (GTK_ENTRY (entry));
+       g_free (self->priv->search_text);
+       self->priv->search_text = g_strdup (text);
 
-               cut = has_selection;
-               copy = has_selection;
-               paste = TRUE;
-               select_all = TRUE;
-       }
-       else
-       {
-               cut = FALSE;
-               copy = (pages_focus && single_page_selected);
-               paste = FALSE;
-               select_all = pages_focus;
-       }
-
-       open_in_window_label = ngettext ("Open in New _Window",
-                                        "Open in New _Windows",
-                                        num_pages_selected);
-       open_in_tab_label = ngettext ("Open in New _Tab",
-                                     "Open in New _Tabs",
-                                     num_pages_selected);
+       filter_now (self);
+}
 
-       if (pages_focus)
-       {
-               copy_label = _("_Copy Address");
-       }
-       else
-       {
-               copy_label = _("_Copy");
-       }
+static void
+on_treeview_selection_changed (GtkTreeSelection *selection,
+                              EphyHistoryWindow *self)
+{
+       gboolean has_selection;
 
-       open_in_window = (pages_focus && pages_selection);
-       open_in_tab = (pages_focus && pages_selection);
-       delete = (pages_focus && pages_selection);
-       bookmarks_locked = g_settings_get_boolean
-                               (EPHY_SETTINGS_LOCKDOWN,
-                                EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING);
-       bookmark_page = (pages_focus && single_page_selected) && !bookmarks_locked;
-
-       action_group = editor->priv->action_group;
-       action = gtk_action_group_get_action (action_group, "OpenInWindow");
-       gtk_action_set_sensitive (action, open_in_window);
-       g_object_set (action, "label", open_in_window_label, NULL);
-       action = gtk_action_group_get_action (action_group, "OpenInTab");
-       gtk_action_set_sensitive (action, open_in_tab);
-       g_object_set (action, "label", open_in_tab_label, NULL);
-       action = gtk_action_group_get_action (action_group, "Cut");
-       gtk_action_set_sensitive (action, cut);
-       action = gtk_action_group_get_action (action_group, "Copy");
-       gtk_action_set_sensitive (action, copy);
-       g_object_set (action, "label", copy_label, NULL);
-       action = gtk_action_group_get_action (action_group, "Paste");
-       gtk_action_set_sensitive (action, paste);
-       action = gtk_action_group_get_action (action_group, "SelectAll");
-       gtk_action_set_sensitive (action, select_all);
-       action = gtk_action_group_get_action (action_group, "Delete");
-       gtk_action_set_sensitive (action, delete);
-       action = gtk_action_group_get_action (action_group, "BookmarkLink");
-       gtk_action_set_sensitive (action, bookmark_page);
+       has_selection = gtk_tree_selection_count_selected_rows (selection) > 0;
 
+       gtk_widget_set_sensitive (self->priv->remove_button, has_selection);
+       gtk_widget_set_sensitive (self->priv->open_button, has_selection);
 }
 
 static void
-entry_selection_changed_cb (GtkWidget *widget, GParamSpec *pspec, EphyHistoryWindow *editor)
+on_remove_button_clicked (GtkButton *button,
+                         EphyHistoryWindow *self)
 {
-       ephy_history_window_update_menu (editor);
-       filter_now (editor, FALSE, TRUE);
+       delete_selected (self);
+
+       /* Restore the focus to the button */
+       gtk_widget_grab_focus (GTK_WIDGET (button));
 }
 
 static void
-add_entry_monitor (EphyHistoryWindow *editor, GtkWidget *entry)
+on_open_button_clicked (GtkButton *button,
+                       EphyHistoryWindow *self)
 {
-       g_signal_connect (G_OBJECT (entry),
-                         "notify::selection-bound",
-                         G_CALLBACK (entry_selection_changed_cb),
-                         editor);
-       g_signal_connect (G_OBJECT (entry),
-                         "notify::cursor-position",
-                         G_CALLBACK (entry_selection_changed_cb),
-                         editor);
+       open_selected (self);
 }
 
 static gboolean
-view_focus_cb (GtkWidget *view,
-              GdkEventFocus *event,
-              EphyHistoryWindow *editor)
+on_urls_visited_cb (EphyHistoryService *service,
+                   EphyHistoryWindow *self)
 {
-       ephy_history_window_update_menu (editor);
+       filter_now (self);
 
-       return FALSE;
-}
-
-static void
-add_focus_monitor (EphyHistoryWindow *editor, GtkWidget *widget)
-{
-       g_signal_connect (G_OBJECT (widget),
-                        "focus_in_event",
-                        G_CALLBACK (view_focus_cb),
-                        editor);
-       g_signal_connect (G_OBJECT (widget),
-                        "focus_out_event",
-                        G_CALLBACK (view_focus_cb),
-                        editor);
+       return FALSE;
 }
 
 static void
-remove_focus_monitor (EphyHistoryWindow *editor, GtkWidget *widget)
+set_history_service (EphyHistoryWindow *self,
+                    EphyHistoryService *history_service)
 {
-       g_signal_handlers_disconnect_by_func (G_OBJECT (widget),
-                                            G_CALLBACK (view_focus_cb),
-                                            editor);
-}
+       if (history_service == self->priv->history_service)
+               return;
 
-static gboolean
-ephy_history_window_show_popup_cb (GtkWidget *view,
-                                  EphyHistoryWindow *editor)
-{
-       GtkWidget *widget;
+       if (self->priv->history_service != NULL) {
+               g_signal_handlers_disconnect_by_func (self->priv->history_service,
+                                                     on_urls_visited_cb,
+                                                     self);
+               g_clear_object (&self->priv->history_service);
+       }
 
-       widget = gtk_ui_manager_get_widget (editor->priv->ui_merge,
-                                           "/EphyHistoryWindowPopup");
-       ephy_history_view_popup (EPHY_HISTORY_VIEW (view), widget);
+       if (history_service != NULL) {
+               self->priv->history_service = g_object_ref (history_service);
+               g_signal_connect_after (self->priv->history_service,
+                                       "urls-visited", G_CALLBACK (on_urls_visited_cb),
+                                       self);
+       }
 
-       return TRUE;
+       filter_now (self);
 }
 
-static gboolean
-key_pressed_cb (GtkWidget *view,
-               GdkEventKey *event,
-               EphyHistoryWindow *editor)
+static void
+ephy_history_window_set_property (GObject *object,
+                                 guint prop_id,
+                                 const GValue *value,
+                                 GParamSpec *pspec)
 {
-       switch (event->keyval)
-       {
-       case GDK_KEY_Delete:
-       case GDK_KEY_KP_Delete:
-               cmd_delete (NULL, editor);
-               return TRUE;
+       EphyHistoryWindow *self = EPHY_HISTORY_WINDOW (object);
 
+       switch (prop_id)
+       {
+       case PROP_HISTORY_SERVICE:
+               set_history_service (self, g_value_get_object (value));
+               break;
        default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
                break;
        }
-
-       return FALSE;
 }
 
 static void
-search_entry_changed_cb (GtkWidget *entry, EphyHistoryWindow *editor)
+ephy_history_window_get_property (GObject *object,
+                                 guint prop_id,
+                                 GValue *value,
+                                 GParamSpec *pspec)
 {
-       filter_now (editor, FALSE, TRUE);
+       EphyHistoryWindow *self = EPHY_HISTORY_WINDOW (object);
+
+       switch (prop_id)
+       {
+       case PROP_HISTORY_SERVICE:
+               g_value_set_object (value, self->priv->history_service);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
 }
 
 static void
-time_combo_changed_cb (GtkWidget *combo, EphyHistoryWindow *editor)
+ephy_history_window_dispose (GObject *object)
 {
-       filter_now (editor, TRUE, TRUE);
-}
+       EphyHistoryWindow *self = EPHY_HISTORY_WINDOW (object);
 
-static GtkWidget *
-build_search_box (EphyHistoryWindow *editor)
-{
-       GtkWidget *box, *entry;
-       GtkWidget *combo;
-       char *str;
-
-       box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-       gtk_container_set_border_width (GTK_CONTAINER (box), 6);
-       gtk_widget_show (box);
-
-       entry = gtk_search_entry_new ();
-       add_focus_monitor (editor, entry);
-       add_entry_monitor (editor, entry);
-       editor->priv->search_entry = entry;
-    
-       gtk_widget_show_all (entry);
-
-       combo = gtk_combo_box_text_new ();
-       gtk_widget_show (combo);
-
-       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Last 30 minutes"));
-       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Today"));
-
-       str = g_strdup_printf (ngettext ("Last %d day", "Last %d days", 2), 2);
-       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), str);
-       g_free (str);
-
-       str = g_strdup_printf (ngettext ("Last %d day", "Last %d days", 3), 3);
-       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), str);
-       g_free (str);
-
-       /* keep this in sync with embed/ephy-history.c's
-        * HISTORY_PAGE_OBSOLETE_DAYS */
-       str = g_strdup_printf (ngettext ("Last %d day", "Last %d days", 10), 10);
-       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), str);
-       g_free (str);
-
-       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("All history"));
-
-       g_settings_bind (EPHY_SETTINGS_STATE,
-                        EPHY_PREFS_STATE_HISTORY_DATE_FILTER,
-                        combo, "active",
-                        G_SETTINGS_BIND_DEFAULT);
-
-       editor->priv->time_combo = combo;
-
-       gtk_box_pack_start (GTK_BOX (box),
-                           entry, TRUE, TRUE, 0);
-       gtk_box_pack_start (GTK_BOX (box),
-                           combo, FALSE, TRUE, 0);
-
-       g_signal_connect (combo, "changed",
-                         G_CALLBACK (time_combo_changed_cb),
-                         editor);
-       g_signal_connect (G_OBJECT (entry), "changed",
-                         G_CALLBACK (search_entry_changed_cb),
-                         editor);
-
-       return box;
+       g_free (self->priv->search_text);
+       self->priv->search_text = NULL;
+
+       if (self->priv->cancellable)
+       {
+               g_cancellable_cancel (self->priv->cancellable);
+               g_clear_object (&self->priv->cancellable);
+       }
+
+       if (self->priv->history_service != NULL)
+               g_signal_handlers_disconnect_by_func (self->priv->history_service,
+                                                     on_urls_visited_cb,
+                                                     self);
+       g_clear_object (&self->priv->history_service);
+
+       G_OBJECT_CLASS (ephy_history_window_parent_class)->dispose (object);
 }
 
 static void
-add_widget (GtkUIManager *merge, GtkWidget *widget, EphyHistoryWindow *editor)
+ephy_history_window_finalize (GObject *object)
 {
-       gtk_box_pack_start (GTK_BOX (editor->priv->main_vbox),
-                           widget, FALSE, FALSE, 0);
-       gtk_widget_show (widget);
-}
+       EphyHistoryWindow *self = EPHY_HISTORY_WINDOW (object);
 
-static gboolean
-delete_event_cb (EphyHistoryWindow *editor)
-{
-       gtk_widget_hide (GTK_WIDGET (editor));
+       if (self->priv->window)
+       {
+               GtkWidget **window = &self->priv->window;
+               g_object_remove_weak_pointer
+                       (G_OBJECT(self->priv->window),
+                        (gpointer *)window);
+       }
 
-       return TRUE;
+       G_OBJECT_CLASS (ephy_history_window_parent_class)->finalize (object);
 }
 
-#if 0
 static void
-provide_favicon (EphyNode *node, GValue *value, gpointer user_data)
+ephy_history_window_class_init (EphyHistoryWindowClass *klass)
 {
-       const char *page_location;
-       GdkPixbuf *pixbuf = NULL;
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-       page_location = ephy_node_get_property_string
-               (node, EPHY_NODE_PAGE_PROP_LOCATION);
+       object_class->finalize = ephy_history_window_finalize;
 
-       LOG ("Get favicon for %s", page_location ? page_location : "None");
+       object_class->set_property = ephy_history_window_set_property;
+       object_class->get_property = ephy_history_window_get_property;
+       object_class->dispose  = ephy_history_window_dispose;
 
-       if (page_location)
-        {
-               /* No need to use the async version as this function will be
-               called many times by the treeview. */
-               /* TODO: Favicons */
-        }
+       g_object_class_install_property (object_class,
+                                        PROP_HISTORY_SERVICE,
+                                        g_param_spec_object ("history-service",
+                                                             "History service",
+                                                             "History Service",
+                                                             EPHY_TYPE_HISTORY_SERVICE,
+                                                             G_PARAM_READWRITE | G_PARAM_STATIC_NAME | 
G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_CONSTRUCT_ONLY));
 
-       g_value_init (value, GDK_TYPE_PIXBUF);
-       g_value_take_object (value, pixbuf);
+       gtk_widget_class_set_template_from_resource (widget_class,
+                                                    "/org/gnome/epiphany/history-dialog.ui");
+       gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, liststore);
+       gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, treeview);
+       gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, clear_button);
+       gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, remove_button);
+       gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, open_button);
+       gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, date_column);
+       gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, date_renderer);
+       gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, open_menuitem);
+       gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, 
copy_location_menuitem);
+       gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, bookmark_menuitem);
+       gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, delete_menuitem);
+       gtk_widget_class_bind_template_child_private (widget_class, EphyHistoryWindow, treeview_popup_menu);
+
+       gtk_widget_class_bind_template_callback (widget_class, on_treeview_row_activated);
+       gtk_widget_class_bind_template_callback (widget_class, on_treeview_key_press_event);
+       gtk_widget_class_bind_template_callback (widget_class, on_treeview_button_press_event);
+       gtk_widget_class_bind_template_callback (widget_class, on_treeview_selection_changed);
+       gtk_widget_class_bind_template_callback (widget_class, on_remove_button_clicked);
+       gtk_widget_class_bind_template_callback (widget_class, on_open_button_clicked);
+       gtk_widget_class_bind_template_callback (widget_class, on_search_entry_changed);
+
+       gtk_widget_class_bind_template_callback (widget_class, on_open_menuitem_activate);
+       gtk_widget_class_bind_template_callback (widget_class, on_copy_location_menuitem_activate);
+       gtk_widget_class_bind_template_callback (widget_class, on_bookmark_menuitem_activate);
+       gtk_widget_class_bind_template_callback (widget_class, on_delete_menuitem_activate);
 }
-#endif
 
 static void
 convert_cell_data_func (GtkTreeViewColumn *column,
@@ -888,400 +649,29 @@ convert_cell_data_func (GtkTreeViewColumn *column,
        int value;
        time_t time;
        char *friendly;
-       
+
        gtk_tree_model_get (model, iter,
-                           col_id,     
+                           col_id,
                            &value,
                            -1);
        time = (time_t) value;
-       
+
        friendly = ephy_time_helpers_utf_friendly_time (time);
        g_object_set (renderer, "text", friendly, NULL);
        g_free (friendly);
 }
 
 static void
-parse_time_into_date (GtkTreeViewColumn *column,
-                     int column_id)
-{
-       GList *renderers_list;
-       GtkCellRenderer *renderer;
-       
-       renderers_list = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
-       renderer = GTK_CELL_RENDERER (renderers_list->data);
-       gtk_tree_view_column_set_cell_data_func (column, renderer,
-                                                (GtkTreeCellDataFunc) convert_cell_data_func,
-                                                GINT_TO_POINTER (column_id),
-                                                NULL);
-       g_list_free (renderers_list);
-}
-static void
-view_selection_changed_cb (GtkWidget *view, EphyHistoryWindow *editor)
+response_cb (GtkDialog *widget,
+            int response,
+            EphyHistoryWindow *self)
 {
-       ephy_history_window_update_menu (editor);
-       filter_now (editor, FALSE, TRUE);
-}
-
-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 = 1;
-                       cmp_time = midnight;
-                       break;
-               case EPHY_PREFS_STATE_HISTORY_DATE_FILTER_LAST_THREE_DAYS:
-                       days = 2;
-                       cmp_time = midnight;
-                       break;
-               case EPHY_PREFS_STATE_HISTORY_DATE_FILTER_LAST_TEN_DAYS:
-                       days = 9;
-                       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 void
-on_get_hosts_cb (gpointer service,
-                gboolean success,
-                gpointer result_data,
-                gpointer user_data)
-{
-       EphyHistoryWindow *window = EPHY_HISTORY_WINDOW (user_data);
-       EphyHistoryHost *selected_host;
-       GList *hosts = NULL;
-
-       if (success != TRUE)
-               goto out;
-
-       hosts = (GList *) result_data;
-       selected_host = get_selected_host (window);
-       ephy_hosts_store_clear (EPHY_HOSTS_STORE (window->priv->hosts_store));
-       ephy_hosts_store_add_hosts (window->priv->hosts_store, hosts);
-       ephy_hosts_view_select_host (EPHY_HOSTS_VIEW (window->priv->hosts_view),
-                                    selected_host);
-       ephy_history_host_free (selected_host);
-out:
-       g_list_free_full (hosts, (GDestroyNotify)ephy_history_host_free);
-}
-
-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;
-       
-       if (success != TRUE)
+       if (response == GTK_RESPONSE_REJECT) {
+               clear_all_history (self);
                return;
-
-       urls = (GList *)result_data;
-       gtk_list_store_clear (GTK_LIST_STORE (window->priv->urls_store));
-       ephy_urls_store_add_urls (window->priv->urls_store, urls);
-       g_list_free_full (urls, (GDestroyNotify)ephy_history_url_free);
-}
-
-static void
-filter_now (EphyHistoryWindow *editor,
-           gboolean hosts,
-           gboolean pages)
-{
-       gint64 from, to;
-       EphyHistoryHost *host;
-       GList *substrings;
-
-       setup_time_filters (editor, &from, &to);
-       substrings = substrings_filter (editor);
-
-       if (hosts)
-       {
-               ephy_history_service_find_hosts (editor->priv->history_service,
-                                                from, to, editor->priv->cancellable,
-                                               (EphyHistoryJobCallback) on_get_hosts_cb, editor);
        }
 
-       if (pages)
-       {
-               host = get_selected_host (editor);
-               ephy_history_service_find_urls (editor->priv->history_service,
-                                               from, to,
-                                               0, host ? host->id : 0,
-                                               substrings, EPHY_HISTORY_SORT_MOST_VISITED,
-                                               editor->priv->cancellable,
-                                               (EphyHistoryJobCallback)on_find_urls_cb, editor);
-               ephy_history_host_free (host);
-       }
-}
-
-static gboolean
-on_urls_visited_cb (EphyHistoryService *service,
-                   EphyHistoryWindow *editor)
-{
-       filter_now (editor, TRUE, TRUE);
-
-       return FALSE;
-}
-
-static void
-ephy_history_window_constructed (GObject *object)
-{
-       GtkTreeViewColumn *col;
-       GtkTreeSelection *selection;
-       GtkWidget *vbox, *hpaned;
-       GtkWidget *pages_view, *hosts_view;
-       GtkWidget *scrolled_window;
-       EphyURLsStore *urls_store;
-       EphyHostsStore *hosts_store;
-       GtkUIManager *ui_merge;
-       GtkActionGroup *action_group;
-       GtkAction *action;
-       EphyHistoryWindow *editor = EPHY_HISTORY_WINDOW (object);
-
-       ephy_gui_ensure_window_group (GTK_WINDOW (editor));
-
-       gtk_window_set_title (GTK_WINDOW (editor), _("History"));
-
-       g_signal_connect (editor, "delete_event",
-                         G_CALLBACK (delete_event_cb), NULL);
-
-       editor->priv->main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-       gtk_widget_show (editor->priv->main_vbox);
-       gtk_container_add (GTK_CONTAINER (editor), editor->priv->main_vbox);
-
-       ui_merge = gtk_ui_manager_new ();
-       g_signal_connect (ui_merge, "add_widget", G_CALLBACK (add_widget), editor);
-       gtk_window_add_accel_group (GTK_WINDOW (editor),
-                                   gtk_ui_manager_get_accel_group (ui_merge));
-       action_group = gtk_action_group_new ("PopupActions");
-       gtk_action_group_set_translation_domain (action_group, NULL);
-       gtk_action_group_add_actions (action_group, ephy_history_ui_entries,
-                                     G_N_ELEMENTS (ephy_history_ui_entries), editor);
-
-       gtk_action_group_add_toggle_actions (action_group,
-                                            ephy_history_toggle_entries,
-                                            G_N_ELEMENTS (ephy_history_toggle_entries),
-                                            editor);
-
-       gtk_ui_manager_insert_action_group (ui_merge,
-                                           action_group, 0);
-       gtk_ui_manager_add_ui_from_resource (ui_merge,
-                                            "/org/gnome/epiphany/epiphany-history-window-ui.xml",
-                                            NULL);
-       gtk_ui_manager_ensure_update (ui_merge);
-       editor->priv->ui_merge = ui_merge;
-       editor->priv->action_group = action_group;
-
-       hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
-       gtk_container_set_border_width (GTK_CONTAINER (hpaned), 0);
-       gtk_box_pack_end (GTK_BOX (editor->priv->main_vbox), hpaned,
-                         TRUE, TRUE, 0);
-       gtk_widget_show (hpaned);
-
-       /* Sites View */
-       scrolled_window = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
-                                       "hadjustment", NULL,
-                                       "vadjustment", NULL,
-                                       "hscrollbar_policy", GTK_POLICY_AUTOMATIC,
-                                       "vscrollbar_policy", GTK_POLICY_AUTOMATIC,
-                                       "shadow_type", GTK_SHADOW_IN,
-                                       NULL);
-       gtk_paned_pack1 (GTK_PANED (hpaned), scrolled_window, TRUE, FALSE);
-       gtk_widget_show (scrolled_window);
-       hosts_store = ephy_hosts_store_new ();
-       hosts_view = ephy_hosts_view_new ();
-       gtk_tree_view_set_model (GTK_TREE_VIEW (hosts_view),
-                                GTK_TREE_MODEL (hosts_store));
-       add_focus_monitor (editor, hosts_view);
-       selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (hosts_view));
-       gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
-       gtk_container_add (GTK_CONTAINER (scrolled_window), hosts_view);
-       gtk_widget_show (hosts_view);
-       editor->priv->hosts_view = hosts_view;
-       g_signal_connect (G_OBJECT (hosts_view),
-                         "key_press_event",
-                         G_CALLBACK (key_pressed_cb),
-                         editor);
-       g_signal_connect (G_OBJECT (selection),
-                         "changed",
-                         G_CALLBACK (view_selection_changed_cb),
-                         editor);
-
-       vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-       gtk_paned_pack2 (GTK_PANED (hpaned), vbox, TRUE, FALSE);
-       gtk_widget_show (vbox);
-
-       gtk_box_pack_start (GTK_BOX (vbox),
-                           build_search_box (editor),
-                           FALSE, FALSE, 0);
-
-       /* Pages View */
-       scrolled_window = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
-                                       "hadjustment", NULL,
-                                       "vadjustment", NULL,
-                                       "hscrollbar_policy", GTK_POLICY_AUTOMATIC,
-                                       "vscrollbar_policy", GTK_POLICY_AUTOMATIC,
-                                       "shadow_type", GTK_SHADOW_IN,
-                                       NULL);
-       gtk_box_pack_start (GTK_BOX (vbox), scrolled_window, TRUE, TRUE, 0);
-       gtk_widget_show (scrolled_window);
-       editor->priv->pages_view = pages_view = ephy_urls_view_new ();
-       urls_store = ephy_urls_store_new ();
-       gtk_tree_view_set_model (GTK_TREE_VIEW (pages_view), GTK_TREE_MODEL (urls_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);
-
-       /* These three blocks should most likely go into
-          EphyHistoryView. */
-       col = gtk_tree_view_get_column (GTK_TREE_VIEW (pages_view), 0);
-       gtk_tree_view_column_set_min_width (col, 300);
-       gtk_tree_view_column_set_resizable (col, TRUE);
-       editor->priv->title_col = col;
-
-       col = gtk_tree_view_get_column (GTK_TREE_VIEW (pages_view), 1);
-       gtk_tree_view_column_set_min_width (col, 300);
-       gtk_tree_view_column_set_resizable (col, TRUE);
-       editor->priv->address_col = col;
-
-       col = gtk_tree_view_get_column (GTK_TREE_VIEW (pages_view), 2);
-       editor->priv->datetime_col = col;
-       parse_time_into_date (editor->priv->datetime_col, 2);
-
-       gtk_container_add (GTK_CONTAINER (scrolled_window), pages_view);
-       gtk_widget_show (pages_view);
-       editor->priv->pages_view = pages_view;
-       editor->priv->urls_store = urls_store;
-       editor->priv->hosts_store = hosts_store;
-
-       action = gtk_action_group_get_action (action_group, "ViewTitle");
-       g_settings_bind (EPHY_SETTINGS_STATE,
-                        EPHY_PREFS_STATE_HISTORY_VIEW_TITLE,
-                        action, "active",
-                        G_SETTINGS_BIND_DEFAULT);
-       g_settings_bind (EPHY_SETTINGS_STATE,
-                        EPHY_PREFS_STATE_HISTORY_VIEW_TITLE,
-                        editor->priv->title_col, "visible",
-                        G_SETTINGS_BIND_DEFAULT);
-
-       action = gtk_action_group_get_action (action_group, "ViewAddress");
-       g_settings_bind (EPHY_SETTINGS_STATE,
-                        EPHY_PREFS_STATE_HISTORY_VIEW_ADDRESS,
-                        action, "active",
-                        G_SETTINGS_BIND_DEFAULT);
-       g_settings_bind (EPHY_SETTINGS_STATE,
-                        EPHY_PREFS_STATE_HISTORY_VIEW_ADDRESS,
-                        editor->priv->address_col, "visible",
-                        G_SETTINGS_BIND_DEFAULT);
-
-       action = gtk_action_group_get_action (action_group, "ViewDateTime");
-       g_settings_bind (EPHY_SETTINGS_STATE,
-                        EPHY_PREFS_STATE_HISTORY_VIEW_DATE,
-                        action, "active",
-                        G_SETTINGS_BIND_DEFAULT);
-       g_settings_bind (EPHY_SETTINGS_STATE,
-                        EPHY_PREFS_STATE_HISTORY_VIEW_DATE,
-                        editor->priv->datetime_col, "visible",
-                        G_SETTINGS_BIND_DEFAULT);
-
-       g_signal_connect (G_OBJECT (pages_view),
-                         "row-activated",
-                         G_CALLBACK (ephy_history_window_row_activated_cb),
-                         editor);
-       g_signal_connect (pages_view, "row-middle-clicked",
-                         G_CALLBACK (ephy_history_window_row_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);
-
-       ephy_initial_state_add_window (GTK_WIDGET (editor),
-                                      "history_window",
-                                      450, 400, FALSE,
-                                      EPHY_INITIAL_STATE_WINDOW_SAVE_SIZE | 
EPHY_INITIAL_STATE_WINDOW_SAVE_POSITION);
-       ephy_initial_state_add_paned  (GTK_WIDGET (hpaned),
-                                      "history_paned",
-                                      130);
-
-       editor->priv->cancellable = g_cancellable_new ();
-       filter_now (editor, TRUE, TRUE);
-
-       g_signal_connect_after (editor->priv->history_service,
-                               "urls-visited", G_CALLBACK (on_urls_visited_cb),
-                               editor);
-
-       if (G_OBJECT_CLASS (ephy_history_window_parent_class)->constructed)
-               G_OBJECT_CLASS (ephy_history_window_parent_class)->constructed (object);
+       gtk_widget_destroy (GTK_WIDGET (self));
 }
 
 void
@@ -1309,80 +699,33 @@ ephy_history_window_set_parent (EphyHistoryWindow *ebe,
 GtkWidget *
 ephy_history_window_new (EphyHistoryService *history_service)
 {
-       EphyHistoryWindow *editor;
+       EphyHistoryWindow *self;
 
        g_return_val_if_fail (history_service != NULL, NULL);
 
-       editor = g_object_new (EPHY_TYPE_HISTORY_WINDOW,
-                              "history-service", history_service,
-                              NULL);
+       self = g_object_new (EPHY_TYPE_HISTORY_WINDOW,
+                            "history-service", history_service,
+                            NULL);
 
-       return GTK_WIDGET (editor);
+       return GTK_WIDGET (self);
 }
 
 static void
-ephy_history_window_set_property (GObject *object,
-                                 guint prop_id,
-                                 const GValue *value,
-                                 GParamSpec *pspec)
+ephy_history_window_init (EphyHistoryWindow *self)
 {
-       EphyHistoryWindow *editor = EPHY_HISTORY_WINDOW (object);
+       self->priv = ephy_history_window_get_instance_private (self);
+       gtk_widget_init_template (GTK_WIDGET (self));
 
-       switch (prop_id)
-       {
-       case PROP_HISTORY_SERVICE:
-               editor->priv->history_service = g_value_get_object (value);
-               break;
-       default:
-               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-               break;
-       }
-}
+       self->priv->cancellable = g_cancellable_new ();
 
-static void
-ephy_history_window_get_property (GObject *object,
-                                 guint prop_id,
-                                 GValue *value,
-                                 GParamSpec *pspec)
-{
-       EphyHistoryWindow *editor = EPHY_HISTORY_WINDOW (object);
+       ephy_gui_ensure_window_group (GTK_WINDOW (self));
 
-       switch (prop_id)
-       {
-       case PROP_HISTORY_SERVICE:
-               g_value_set_object (value, editor->priv->history_service);
-               break;
-       default:
-               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-               break;
-       }
-}
-
-static void
-ephy_history_window_init (EphyHistoryWindow *editor)
-{
-       editor->priv = EPHY_HISTORY_WINDOW_GET_PRIVATE (editor);
-}
-
-static void
-ephy_history_window_dispose (GObject *object)
-{
-       EphyHistoryWindow *editor = EPHY_HISTORY_WINDOW (object);
-
-       if (editor->priv->hosts_view != NULL)
-       {
-               remove_focus_monitor (editor, editor->priv->pages_view);
-               remove_focus_monitor (editor, editor->priv->hosts_view);
-               remove_focus_monitor (editor, editor->priv->search_entry);
-
-               editor->priv->hosts_view = NULL;
-       }
-
-       if (editor->priv->cancellable)
-       {
-               g_cancellable_cancel (editor->priv->cancellable);
-               g_clear_object (&editor->priv->cancellable);
-       }
+       gtk_tree_view_column_set_cell_data_func (GTK_TREE_VIEW_COLUMN (self->priv->date_column),
+                                                GTK_CELL_RENDERER (self->priv->date_renderer),
+                                                (GtkTreeCellDataFunc) convert_cell_data_func,
+                                                GINT_TO_POINTER (COLUMN_DATE),
+                                                NULL);
 
-       G_OBJECT_CLASS (ephy_history_window_parent_class)->dispose (object);
+       g_signal_connect (self, "response",
+                         G_CALLBACK (response_cb), self);
 }
diff --git a/src/ephy-history-window.h b/src/ephy-history-window.h
index a5c98f4..c153073 100644
--- a/src/ephy-history-window.h
+++ b/src/ephy-history-window.h
@@ -41,7 +41,7 @@ typedef struct _EphyHistoryWindowPrivate EphyHistoryWindowPrivate;
 
 typedef struct
 {
-       GtkWindow parent;
+       GtkDialog parent;
 
        /*< private >*/
        EphyHistoryWindowPrivate *priv;
@@ -49,7 +49,7 @@ typedef struct
 
 typedef struct
 {
-       GtkWindowClass parent;
+       GtkDialogClass parent;
 } EphyHistoryWindowClass;
 
 GType               ephy_history_window_get_type (void);
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 35b646c..b66b19d 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -178,7 +178,11 @@ show_history (GSimpleAction *action,
               GVariant *parameter,
               gpointer user_data)
 {
-  window_cmd_edit_history (NULL, NULL);
+  GtkWindow *window;
+
+  window = gtk_application_get_active_window (GTK_APPLICATION (ephy_shell));
+
+  window_cmd_edit_history (NULL, EPHY_WINDOW (window));
 }
 
 static void
@@ -906,6 +910,10 @@ ephy_shell_get_history_window (EphyShell *shell)
     service = EPHY_HISTORY_SERVICE
       (ephy_embed_shell_get_global_history_service (embed_shell));
     shell->priv->history_window = ephy_history_window_new (service);
+    g_signal_connect (shell->priv->history_window,
+                      "destroy",
+                      G_CALLBACK (gtk_widget_destroyed),
+                      &shell->priv->history_window);
   }
 
   return shell->priv->history_window;
diff --git a/src/epiphany.gresource.xml b/src/epiphany.gresource.xml
index 263e43d..946428c 100644
--- a/src/epiphany.gresource.xml
+++ b/src/epiphany.gresource.xml
@@ -8,11 +8,11 @@
     <file preprocess="xml-stripblanks" compressed="true">prefs-lang-dialog.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">clear-data-dialog.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">cookies-dialog.ui</file>
+    <file preprocess="xml-stripblanks" compressed="true">history-dialog.ui</file>
     <file preprocess="xml-stripblanks" compressed="true">passwords-dialog.ui</file>
     <file preprocess="xml-stripblanks">epiphany-application-menu.ui</file>
     <file preprocess="xml-stripblanks">epiphany-ui.xml</file>
     <file preprocess="xml-stripblanks">epiphany-bookmark-editor-ui.xml</file>
-    <file preprocess="xml-stripblanks">epiphany-history-window-ui.xml</file>
     <file>epiphany.css</file>
     <file alias="page-templates/error.html" compressed="true">error.html</file>
   </gresource>
diff --git a/src/resources/history-dialog.ui b/src/resources/history-dialog.ui
new file mode 100644
index 0000000..5831409
--- /dev/null
+++ b/src/resources/history-dialog.ui
@@ -0,0 +1,356 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.0 -->
+<interface>
+  <requires lib="gtk+" version="3.10"/>
+  <object class="GtkListStore" id="liststore">
+    <columns>
+      <!-- column-name DATE -->
+      <column type="gint"/>
+      <!-- column-name TITLE -->
+      <column type="gchararray"/>
+      <!-- column-name LOCATION -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <template class="EphyHistoryWindow" parent="GtkDialog">
+    <property name="height_request">500</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="title" translatable="yes">History</property>
+    <property name="modal">True</property>
+    <property name="window_position">center</property>
+    <property name="default_width">1000</property>
+    <property name="default_height">600</property>
+    <property name="destroy_with_parent">True</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox2">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="clear_button">
+                <property name="label" translatable="yes">C_lear All</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="close_button">
+                <property name="label" translatable="yes">_Close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="box1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">5</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkSearchEntry" id="searchentry1">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="primary_icon_name">edit-find-symbolic</property>
+                <property name="primary_icon_activatable">False</property>
+                <property name="primary_icon_sensitive">False</property>
+                <property name="placeholder_text" translatable="yes">Search history</property>
+                <signal name="search-changed" handler="on_search_entry_changed" object="EphyHistoryWindow" 
swapped="no"/>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox" id="box2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="border_width">0</property>
+                <property name="orientation">vertical</property>
+                <child>
+                  <object class="GtkScrolledWindow" id="scrolledwindow1">
+                    <property name="width_request">400</property>
+                    <property name="height_request">300</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="shadow_type">in</property>
+                    <property name="min_content_width">300</property>
+                    <property name="min_content_height">300</property>
+                    <child>
+                      <object class="GtkTreeView" id="treeview">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="model">liststore</property>
+                        <property name="enable_search">False</property>
+                        <property name="search_column">0</property>
+                        <property name="fixed-height-mode">True</property>
+                        <signal name="button-press-event" handler="on_treeview_button_press_event" 
object="EphyHistoryWindow" swapped="no"/>
+                        <signal name="key-press-event" handler="on_treeview_key_press_event" 
object="EphyHistoryWindow" swapped="no"/>
+                        <signal name="row-activated" handler="on_treeview_row_activated" swapped="no"/>
+                        <child internal-child="selection">
+                          <object class="GtkTreeSelection" id="treeview-selection">
+                            <property name="mode">multiple</property>
+                            <signal name="changed" handler="on_treeview_selection_changed" 
object="EphyHistoryWindow" swapped="no"/>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkTreeViewColumn" id="date_column">
+                            <property name="sizing">fixed</property>
+                            <property name="fixed-width">150</property>
+                            <property name="title" translatable="yes">Date</property>
+                            <property name="clickable">True</property>
+                            <property name="reorderable">True</property>
+                            <property name="sort_indicator">True</property>
+                            <property name="sort_order">descending</property>
+                            <property name="sort_column_id">0</property>
+                            <child>
+                              <object class="GtkCellRendererText" id="date_renderer"/>
+                              <attributes>
+                                <attribute name="text">0</attribute>
+                              </attributes>
+                            </child>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkTreeViewColumn" id="treeviewcolumn2">
+                            <property name="sizing">fixed</property>
+                            <property name="fixed-width">500</property>
+                            <property name="title" translatable="yes">Name</property>
+                            <property name="clickable">True</property>
+                            <property name="reorderable">True</property>
+                            <property name="sort_column_id">1</property>
+                            <child>
+                              <object class="GtkCellRendererText" id="cellrenderertext2">
+                                <property name="ellipsize">end</property>
+                              </object>
+                              <attributes>
+                                <attribute name="text">1</attribute>
+                              </attributes>
+                            </child>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkTreeViewColumn" id="location_column">
+                           <property name="sizing">fixed</property>
+                            <property name="fixed-width">200</property>
+                            <property name="title" translatable="yes">Location</property>
+                            <child>
+                              <object class="GtkCellRendererText" id="location_renderer">
+                                <property name="ellipsize">end</property>
+                              </object>
+                              <attributes>
+                                <attribute name="text">2</attribute>
+                              </attributes>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToolbar" id="toolbar1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="icon_size">1</property>
+                    <child>
+                      <object class="GtkToolItem" id="toolitem1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkBox" id="remove_button_box">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <object class="GtkButton" id="remove_button">
+                                <property name="visible">True</property>
+                                <property name="sensitive">False</property>
+                                <property name="can_focus">False</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <signal name="clicked" handler="on_remove_button_clicked" 
object="EphyHistoryWindow" swapped="no"/>
+                                <child>
+                                  <object class="GtkImage" id="remove_image">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="icon_name">list-remove-symbolic</property>
+                                    <property name="icon_size">1</property>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkSeparatorToolItem" id="toolbutton1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="draw">False</property>
+                      </object>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="homogeneous">True</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToolItem" id="toolitem2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <object class="GtkBox" id="open_button_box">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <child>
+                              <object class="GtkButton" id="open_button">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="receives_default">False</property>
+                                <property name="use_underline">True</property>
+                                <signal name="clicked" handler="on_open_button_clicked" 
object="EphyHistoryWindow" swapped="no"/>
+                                <child>
+                                  <object class="GtkImage" id="open_image">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="icon_name">go-jump-symbolic</property>
+                                    <property name="icon_size">1</property>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="homogeneous">False</property>
+                      </packing>
+                    </child>
+                    <style>
+                      <class name="inline-toolbar"/>
+                    </style>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="pack_type">end</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-2">clear_button</action-widget>
+      <action-widget response="-7">close_button</action-widget>
+    </action-widgets>
+  </template>
+  <object class="GtkMenu" id="treeview_popup_menu">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkMenuItem" id="open_menuitem">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Open</property>
+        <property name="use_underline">True</property>
+        <signal name="activate" handler="on_open_menuitem_activate" object="EphyHistoryWindow" swapped="no"/>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="copy_location_menuitem">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Copy Location</property>
+        <property name="use_underline">True</property>
+        <signal name="activate" handler="on_copy_location_menuitem_activate" object="EphyHistoryWindow" 
swapped="no"/>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="bookmark_menuitem">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">Add _Bookmark</property>
+        <property name="use_underline">True</property>
+        <signal name="activate" handler="on_bookmark_menuitem_activate" object="EphyHistoryWindow" 
swapped="no"/>
+      </object>
+    </child>
+    <child>
+      <object class="GtkMenuItem" id="delete_menuitem">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="label" translatable="yes">_Delete</property>
+        <property name="use_underline">True</property>
+        <signal name="activate" handler="on_delete_menuitem_activate" object="EphyHistoryWindow" 
swapped="no"/>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/src/window-commands.c b/src/window-commands.c
index ed95c3f..4024960 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1126,6 +1126,10 @@ window_cmd_edit_history (GtkAction *action,
        GtkWidget *hwindow;
        
        hwindow = ephy_shell_get_history_window (ephy_shell_get_default ());
+
+       if (GTK_WINDOW (window) != gtk_window_get_transient_for (GTK_WINDOW (hwindow)))
+               gtk_window_set_transient_for (GTK_WINDOW (hwindow),
+                                              GTK_WINDOW (window));
        gtk_window_present (GTK_WINDOW (hwindow));
 }
 


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