[evince/wip/find_results: 181/181] shell: add find results sidebar.



commit 05cc733e756ef2b214b8a2e0fe4f19ea89e04d06
Author: José Aliste <jaliste src gnome org>
Date:   Wed Nov 7 16:03:14 2012 +0100

    shell: add find results sidebar.

 shell/Makefile.am               |    2 +
 shell/ev-sidebar-find-results.c |  354 +++++++++++++++++++++++++++++++++++++++
 shell/ev-sidebar-find-results.h |   73 ++++++++
 shell/ev-window.c               |   77 +++++++++-
 4 files changed, 505 insertions(+), 1 deletions(-)
---
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 1ec8dde..ec8532f 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -83,6 +83,8 @@ evince_SOURCES=                               \
        ev-sidebar-attachments.h        \
        ev-sidebar-bookmarks.h          \
        ev-sidebar-bookmarks.c          \
+       ev-sidebar-find-results.c       \
+       ev-sidebar-find-results.h       \
        ev-sidebar-layers.c             \
        ev-sidebar-layers.h             \
        ev-sidebar-links.c              \
diff --git a/shell/ev-sidebar-find-results.c b/shell/ev-sidebar-find-results.c
new file mode 100644
index 0000000..0909070
--- /dev/null
+++ b/shell/ev-sidebar-find-results.c
@@ -0,0 +1,354 @@
+/* ev-sidebar-find-results.c
+* this file is part of evince, a gnome document viewer
+*
+* Copyright (C) 2008 Sergey Pushkin < pushkinsv gmail com >
+*
+* Evince is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* Evince is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 - 1307, USA.
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <glib/gi18n.h>
+
+#include "ev-sidebar-find-results.h"
+#include "ev-sidebar-page.h"
+
+struct _EvSidebarFindResultsPrivate {
+       GtkWidget *tree_view;
+
+       guint selection_id;
+
+       EvJob *job;
+};
+
+enum {
+       PROP_0,
+       PROP_WIDGET,
+};
+
+enum {
+       FIND_RESULT_ACTIVATED,
+       N_SIGNALS
+};
+
+static void ev_sidebar_find_results_page_iface_init (EvSidebarPageInterface *iface);
+static void ev_sidebar_find_results_set_model (EvSidebarPage *sidebar_page,
+                                               EvDocumentModel *model);
+static gboolean ev_sidebar_find_results_support_document (EvSidebarPage *sidebar_page,
+                                               EvDocument *document);
+static const gchar* ev_sidebar_find_results_get_label (EvSidebarPage *sidebar_page);
+
+static guint signals[N_SIGNALS];
+
+G_DEFINE_TYPE_EXTENDED (EvSidebarFindResults,
+ev_sidebar_find_results,
+GTK_TYPE_VBOX,
+0,
+G_IMPLEMENT_INTERFACE (EV_TYPE_SIDEBAR_PAGE,
+                                       ev_sidebar_find_results_page_iface_init))
+
+
+#define EV_SIDEBAR_FIND_RESULTS_GET_PRIVATE(object) \
+       (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_SIDEBAR_FIND_RESULTS, EvSidebarFindResultsPrivate))
+
+static void
+ev_sidebar_find_results_get_property (GObject *object,
+                       guint prop_id,
+                       GValue *value,
+                       GParamSpec *pspec)
+{
+       EvSidebarFindResults *ev_sidebar_find_results;
+
+       ev_sidebar_find_results = EV_SIDEBAR_FIND_RESULTS (object);
+
+       switch (prop_id) {
+       case PROP_WIDGET:
+               g_value_set_object (value, ev_sidebar_find_results->priv->tree_view);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       };
+}
+
+
+static void
+ev_sidebar_find_results_dispose (GObject *object)
+{
+       EvSidebarFindResults *sidebar = EV_SIDEBAR_FIND_RESULTS (object);
+
+       if (sidebar->priv->job) {
+               g_object_unref (sidebar->priv->job);
+               sidebar->priv->job = NULL;
+       };
+
+       G_OBJECT_CLASS (ev_sidebar_find_results_parent_class)->dispose (object);
+}
+
+static void
+ev_sidebar_find_results_map (GtkWidget *widget)
+{
+       EvSidebarFindResults *find_results;
+
+       find_results = EV_SIDEBAR_FIND_RESULTS (widget);
+
+       GTK_WIDGET_CLASS (ev_sidebar_find_results_parent_class)->map (widget);
+}
+
+static void
+ev_sidebar_find_results_class_init (EvSidebarFindResultsClass *sidebar_find_results_class)
+{
+       GObjectClass *g_object_class;
+       GtkWidgetClass *widget_class;
+
+       g_object_class = G_OBJECT_CLASS (sidebar_find_results_class);
+       widget_class = GTK_WIDGET_CLASS (sidebar_find_results_class);
+
+       g_object_class->get_property = ev_sidebar_find_results_get_property;
+       g_object_class->dispose = ev_sidebar_find_results_dispose;
+
+       widget_class->map = ev_sidebar_find_results_map;
+
+       signals[FIND_RESULT_ACTIVATED] = g_signal_new ("find-result-activated",
+               G_TYPE_FROM_CLASS (g_object_class),
+               G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+               G_STRUCT_OFFSET (EvSidebarFindResultsClass, find_result_activated),
+               NULL, NULL,
+               g_cclosure_marshal_generic,
+               G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT);
+
+       g_object_class_override_property (g_object_class,
+                                       PROP_WIDGET,
+                                       "main-widget");
+
+       g_type_class_add_private (g_object_class, sizeof (EvSidebarFindResultsPrivate));
+}
+
+static void
+selection_changed_callback (GtkTreeSelection *selection,
+               EvSidebarFindResults *sidebar_find_results)
+{
+       GtkTreeModel *model;
+       GtkTreeIter iter;
+       EvJobFind *job_find;
+
+       job_find = EV_JOB_FIND (sidebar_find_results->priv->job);
+
+       if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
+               gint pageno;
+               gint resultno;
+
+               gtk_tree_model_get (model, &iter,
+                               EV_DOCUMENT_FIND_RESULTS_COLUMN_PAGENO, &pageno,
+                               - 1);
+               gtk_tree_model_get (model, &iter,
+                               EV_DOCUMENT_FIND_RESULTS_COLUMN_RESULTNO, &resultno,
+                               - 1);
+
+               g_signal_emit (sidebar_find_results, signals[FIND_RESULT_ACTIVATED], 0, job_find, pageno - 1, 
resultno);
+       }
+}
+
+static gboolean
+focus_out_cb (GtkWidget *treeview,
+GdkEventButton *event,
+EvSidebarFindResults *sidebar_find_results)
+{
+       g_signal_emit (sidebar_find_results, signals[FIND_RESULT_ACTIVATED], 0, NULL, 0, 0);
+       return FALSE;
+}
+
+static gboolean
+focus_in_cb (GtkWidget *treeview,
+GdkEventButton *event,
+EvSidebarFindResults *sidebar_find_results)
+{
+       GtkTreeSelection *selection;
+       EvSidebarFindResultsPrivate *priv;
+       priv = sidebar_find_results->priv;
+
+       selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view));
+       selection_changed_callback (selection, sidebar_find_results);
+       return FALSE;
+}
+
+
+
+
+static void
+ev_sidebar_find_results_construct (EvSidebarFindResults *ev_sidebar_find_results)
+{
+       EvSidebarFindResultsPrivate *priv;
+       GtkWidget *swindow;
+       GtkTreeViewColumn *column;
+       GtkCellRenderer *renderer;
+
+       priv = ev_sidebar_find_results->priv;
+
+       swindow = gtk_scrolled_window_new (NULL, NULL);
+
+       gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
+                                       GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+       gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow),
+                                       GTK_SHADOW_IN);
+
+       priv->tree_view = gtk_tree_view_new_with_model (NULL);
+       gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->tree_view), FALSE);
+       gtk_container_add (GTK_CONTAINER (swindow), priv->tree_view);
+
+       gtk_box_pack_start (GTK_BOX (ev_sidebar_find_results), swindow, TRUE, TRUE, 0);
+       gtk_widget_show_all (GTK_WIDGET (ev_sidebar_find_results));
+
+       column = gtk_tree_view_column_new ();
+       gtk_tree_view_column_set_expand (GTK_TREE_VIEW_COLUMN (column), TRUE);
+       gtk_tree_view_append_column (GTK_TREE_VIEW (priv->tree_view), column);
+
+       renderer = (GtkCellRenderer*) g_object_new (
+                       GTK_TYPE_CELL_RENDERER_TEXT,
+                       "ellipsize",
+                       PANGO_ELLIPSIZE_END,
+                       NULL);
+       gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), renderer, TRUE);
+       gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), renderer,
+                                       "markup", EV_DOCUMENT_FIND_RESULTS_COLUMN_TEXT,
+                                       NULL);
+       
+       renderer = gtk_cell_renderer_text_new ();
+       gtk_tree_view_column_pack_end (GTK_TREE_VIEW_COLUMN (column), renderer, FALSE);
+       gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), renderer,
+                                       "text", EV_DOCUMENT_FIND_RESULTS_COLUMN_PAGENO,
+                                       NULL);
+       g_object_set (G_OBJECT (renderer), "style", PANGO_STYLE_ITALIC, NULL);
+
+       g_signal_connect (GTK_TREE_VIEW (priv->tree_view),
+                       "focus_out_event",
+                       G_CALLBACK (focus_out_cb),
+                       ev_sidebar_find_results);
+       g_signal_connect (GTK_TREE_VIEW (priv->tree_view),
+                       "focus_in_event",
+                       G_CALLBACK (focus_in_cb),
+                       ev_sidebar_find_results);
+
+       priv->selection_id = g_signal_connect (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view)), 
"changed",
+                                       G_CALLBACK (selection_changed_callback),
+                                       ev_sidebar_find_results);
+}
+
+static void
+ev_sidebar_find_results_init (EvSidebarFindResults *ev_sidebar_find_results)
+{
+       ev_sidebar_find_results->priv = EV_SIDEBAR_FIND_RESULTS_GET_PRIVATE (ev_sidebar_find_results);
+
+       ev_sidebar_find_results_construct (ev_sidebar_find_results);
+}
+
+GtkWidget *
+ev_sidebar_find_results_new (void)
+{
+       GtkWidget *ev_sidebar_find_results;
+
+       ev_sidebar_find_results = g_object_new (EV_TYPE_SIDEBAR_FIND_RESULTS, NULL);
+
+       return ev_sidebar_find_results;
+}
+
+
+void
+find_result_activate_result (EvSidebarFindResults *sidebar_find_results,
+                       gpointer results,
+                       gint pageno,
+                       gint resultno)
+{
+       GtkTreeSelection *selection;
+       GtkTreeModel *model;
+       GtkTreeIter iter;
+       EvSidebarFindResultsPrivate *priv;
+       EvJobFind *job_find;
+       gint i, index;
+       GtkTreePath *path;
+
+       if (!gtk_widget_get_mapped (GTK_WIDGET (sidebar_find_results)))
+               return;
+
+       priv = sidebar_find_results->priv;
+       if (priv->job == NULL) return;
+       job_find = EV_JOB_FIND (priv->job);
+       if (ev_job_find_get_n_results (job_find, pageno) == 0) return;
+
+       
+       selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (sidebar_find_results->priv->tree_view));
+
+       if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
+               gint page;
+
+               gtk_tree_model_get (model, &iter,
+                               EV_DOCUMENT_FIND_RESULTS_COLUMN_PAGENO, &page,
+                               - 1);
+       };
+
+       index = resultno;
+       for (i = 0; i < pageno; i++ )
+               index += ev_job_find_get_n_results (job_find, i);
+
+       path = gtk_tree_path_new_from_indices (index, -1);
+       g_signal_handler_block (selection, sidebar_find_results->priv->selection_id);
+       gtk_tree_view_set_cursor (GTK_TREE_VIEW (priv->tree_view), path, NULL, FALSE);
+       g_signal_handler_unblock (selection, sidebar_find_results->priv->selection_id);
+       gtk_tree_path_free (path);
+}
+
+static void
+ev_sidebar_find_results_set_model (EvSidebarPage *sidebar_page,
+                       EvDocumentModel *model)
+{
+}
+
+void
+ev_sidebar_find_results_update (EvSidebarFindResults *sidebar_find_results,
+                       EvJobFind *job_find)
+{
+       EvSidebarFindResultsPrivate *priv;
+
+       priv = sidebar_find_results->priv;
+
+       if (priv->job) g_object_unref (priv->job);
+       priv->job = g_object_ref (job_find);
+
+       gtk_tree_view_set_model (GTK_TREE_VIEW (priv->tree_view), job_find->model);
+}
+
+static gboolean
+ev_sidebar_find_results_support_document (EvSidebarPage *sidebar_page,
+                               EvDocument *document)
+{
+       return TRUE;
+}
+
+static const gchar*
+ev_sidebar_find_results_get_label (EvSidebarPage *sidebar_page)
+{
+       return _ ("Find results");
+}
+
+static void
+ev_sidebar_find_results_page_iface_init (EvSidebarPageInterface *iface)
+{
+       iface->support_document = ev_sidebar_find_results_support_document;
+       iface->set_model = ev_sidebar_find_results_set_model;
+       iface->get_label = ev_sidebar_find_results_get_label;
+}
+
diff --git a/shell/ev-sidebar-find-results.h b/shell/ev-sidebar-find-results.h
new file mode 100644
index 0000000..a5c7bb8
--- /dev/null
+++ b/shell/ev-sidebar-find-results.h
@@ -0,0 +1,73 @@
+/* ev-sidebar-find-results.h
+* this file is part of evince, a gnome document viewer
+*
+* Copyright (C) 2008 Sergey Pushkin < pushkinsv gmail com >
+*
+* Evince is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License as published by
+* the Free Software Foundation; either version 2 of the License, or
+* (at your option) any later version.
+*
+* Evince is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 - 1307, USA.
+*/
+
+#ifndef __EV_SIDEBAR_FIND_RESULTS_H__
+#define __EV_SIDEBAR_FIND_RESULTS_H__
+
+#include <gtk/gtk.h>
+
+#include "ev-jobs.h"
+
+G_BEGIN_DECLS
+
+typedef struct _EvSidebarFindResults EvSidebarFindResults;
+typedef struct _EvSidebarFindResultsClass EvSidebarFindResultsClass;
+typedef struct _EvSidebarFindResultsPrivate EvSidebarFindResultsPrivate;
+
+#define EV_TYPE_SIDEBAR_FIND_RESULTS (ev_sidebar_find_results_get_type ())
+#define EV_SIDEBAR_FIND_RESULTS(object)        (G_TYPE_CHECK_INSTANCE_CAST ((object), 
EV_TYPE_SIDEBAR_FIND_RESULTS, EvSidebarFindResults))
+#define EV_SIDEBAR_FIND_RESULTS_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), 
EV_TYPE_SIDEBAR_FIND_RESULTS, EvSidebarFindResultsClass))
+#define EV_IS_SIDEBAR_FIND_RESULTS(object)     (G_TYPE_CHECK_INSTANCE_TYPE ((object), 
EV_TYPE_SIDEBAR_FIND_RESULTS))
+#define EV_IS_SIDEBAR_FIND_RESULTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), 
EV_TYPE_SIDEBAR_FIND_RESULTS))
+#define EV_SIDEBAR_FIND_RESULTS_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS ((object), 
EV_TYPE_SIDEBAR_FIND_RESULTS, EvSidebarFindResultsClass))
+
+enum {
+       EV_DOCUMENT_FIND_RESULTS_COLUMN_TEXT,
+       EV_DOCUMENT_FIND_RESULTS_COLUMN_PAGENO,
+       EV_DOCUMENT_FIND_RESULTS_COLUMN_RESULTNO
+};
+
+struct _EvSidebarFindResults {
+       GtkVBox base_instance;
+
+       EvSidebarFindResultsPrivate *priv;
+};
+
+struct _EvSidebarFindResultsClass {
+       GtkVBoxClass base_class;
+
+       void (* find_result_activated) (EvSidebarFindResults *sidebar_find_results);
+};
+
+GType ev_sidebar_find_results_get_type (void);
+GtkWidget *ev_sidebar_find_results_new (void);
+
+void ev_sidebar_find_results_update (EvSidebarFindResults *sidebar_find_results,
+                               EvJobFind *job_find);
+void
+find_result_activate_result (EvSidebarFindResults *sidebar_find_results,
+                       gpointer results,
+                       gint pageno,
+                       gint resultno);
+
+G_END_DECLS
+
+#endif /* __EV_SIDEBAR_FIND_RESULTS_H__ */
+
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 626aebc..31a7739 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -71,6 +71,7 @@
 #include "ev-sidebar-attachments.h"
 #include "ev-sidebar-bookmarks.h"
 #include "ev-sidebar.h"
+#include "ev-sidebar-find-results.h"
 #include "ev-sidebar-links.h"
 #include "ev-sidebar-page.h"
 #include "ev-sidebar-thumbnails.h"
@@ -139,6 +140,7 @@ struct _EvWindowPrivate {
        GtkWidget *password_view;
        GtkWidget *sidebar_thumbs;
        GtkWidget *sidebar_links;
+       GtkWidget *sidebar_find_results;
        GtkWidget *sidebar_attachments;
        GtkWidget *sidebar_layers;
        GtkWidget *sidebar_annots;
@@ -256,6 +258,7 @@ struct _EvWindowPrivate {
 #define GS_LAST_PICTURES_DIRECTORY "pictures-directory"
 
 #define SIDEBAR_DEFAULT_SIZE    132
+#define FIND_RESULTS_SIDEBAR_ID "find_results"
 #define LINKS_SIDEBAR_ID "links"
 #define THUMBNAILS_SIDEBAR_ID "thumbnails"
 #define ATTACHMENTS_SIDEBAR_ID "attachments"
@@ -807,6 +810,49 @@ typedef struct _LinkTitleData {
        EvLink      *link;
        const gchar *link_title;
 } LinkTitleData;
+static void
+ev_view_find_result_highlight_changed_cb (EvView *view,
+               gpointer find_result,
+               gint page,
+               gint result,
+               EvWindow *window)
+{
+
+       find_result_activate_result (
+               EV_SIDEBAR_FIND_RESULTS (window->priv->sidebar_find_results),
+               find_result,
+               page,
+               result);
+}
+
+static void
+sidebar_find_results_find_result_activated_cb (EvSidebarFindResults *sidebar_find_results,
+                                       EvJobFind *job,
+                                       gint pageno,
+                                       gint resultno,
+                                       EvWindow *window)
+{
+       if (window->priv->view == NULL) return;
+       if (gtk_widget_get_visible (window->priv->find_bar)) return;
+       if (job == NULL) {
+               ev_view_find_changed (EV_VIEW (window->priv->view), NULL, 0);
+               ev_view_find_set_highlight_search (EV_VIEW (window->priv->view), FALSE);
+       }
+       else {
+               ev_view_find_changed (EV_VIEW (window->priv->view),
+                       ev_job_find_get_results (job),
+                       pageno);
+               ev_view_find_set_highlight_search (EV_VIEW (window->priv->view), TRUE);
+               ev_view_find_highlight_result (EV_VIEW (window->priv->view), pageno, resultno);
+       };
+
+}
+
+typedef struct _PageTitleData {
+
+       const gchar *page_label;
+       gchar       *page_title;
+} PageTitleData;
 
 static gboolean
 find_link_cb (GtkTreeModel  *tree_model,
@@ -959,6 +1005,8 @@ ev_window_sidebar_get_current_page_id (EvWindow *ev_window)
                id = ANNOTS_SIDEBAR_ID;
        } else if (current_page == ev_window->priv->sidebar_bookmarks) {
                id = BOOKMARKS_SIDEBAR_ID;
+       } else if (current_page == ev_window->priv->sidebar_find_results) {
+               id = FIND_RESULTS_SIDEBAR_ID;
        } else {
                g_assert_not_reached();
        }
@@ -980,7 +1028,8 @@ ev_window_sidebar_set_current_page (EvWindow    *window,
        GtkWidget  *annots = window->priv->sidebar_annots;
        GtkWidget  *layers = window->priv->sidebar_layers;
        GtkWidget  *bookmarks = window->priv->sidebar_bookmarks;
-
+       GtkWidget  *find_results = window->priv->sidebar_find_results;
+       
        if (strcmp (page_id, LINKS_SIDEBAR_ID) == 0 &&
            ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (links), document)) {
                ev_sidebar_set_page (sidebar, links);
@@ -999,6 +1048,9 @@ ev_window_sidebar_set_current_page (EvWindow    *window,
        } else if (strcmp (page_id, BOOKMARKS_SIDEBAR_ID) == 0 &&
                   ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (bookmarks), document)) {
                ev_sidebar_set_page (sidebar, bookmarks);
+       } else if (strcmp (page_id, FIND_RESULTS_SIDEBAR_ID) == 0 &&
+                 ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (find_results), document)) {
+               ev_sidebar_set_page (sidebar, find_results);
        }
 }
 
@@ -5224,6 +5276,9 @@ ev_window_find_job_finished_cb (EvJobFind *job,
                                EvWindow  *ev_window)
 {
        ev_window_update_find_status_message (ev_window);
+       ev_sidebar_find_results_update (
+                       EV_SIDEBAR_FIND_RESULTS (ev_window->priv->sidebar_find_results),
+                       EV_JOB_FIND (ev_window->priv->find_job));
 }
 
 /**
@@ -5258,6 +5313,7 @@ ev_window_find_job_updated_cb (EvJobFind *job,
        if (find_check_refresh_rate (job, FIND_PAGE_RATE_REFRESH)) {
                ev_window_update_actions_sensitivity (ev_window);
                ev_window_update_find_status_message (ev_window);
+               ev_sidebar_find_results_update (EV_SIDEBAR_FIND_RESULTS 
(ev_window->priv->sidebar_find_results), job);
        }
 }
 
@@ -7255,6 +7311,17 @@ ev_window_init (EvWindow *ev_window)
                            FALSE, TRUE, 0);
 
        overlay = gtk_overlay_new ();
+       sidebar_widget = ev_sidebar_find_results_new ();
+       ev_window->priv->sidebar_find_results = sidebar_widget;
+       g_signal_connect (sidebar_widget,
+                       "notify::model",
+                       G_CALLBACK (sidebar_widget_model_set),
+                       ev_window);
+       sidebar_page_main_widget_update_cb (G_OBJECT (sidebar_widget), NULL, ev_window);
+       gtk_widget_show (sidebar_widget);
+       ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar),
+                       sidebar_widget);
+
        ev_window->priv->scrolled_window =
                GTK_WIDGET (g_object_new (GTK_TYPE_SCROLLED_WINDOW,
                                          "shadow-type", GTK_SHADOW_IN,
@@ -7321,6 +7388,14 @@ ev_window_init (EvWindow *ev_window)
        gtk_widget_show (ev_window->priv->view);
        gtk_widget_show (ev_window->priv->password_view);
 
+       /* Find results sidebar */
+       g_signal_connect (ev_window->priv->sidebar_find_results,
+                       "find-result-activated",
+                       G_CALLBACK (sidebar_find_results_find_result_activated_cb),
+                       ev_window);
+       g_signal_connect (ev_window->priv->view, "find-result-highlight-changed",
+                       G_CALLBACK (ev_view_find_result_highlight_changed_cb), ev_window);
+
        /* We own a ref on these widgets, as we can swap them in and out */
        g_object_ref (ev_window->priv->view);
        g_object_ref (ev_window->priv->password_view);


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