[evince/wip/recent-view: 5/12] shell: Integrate recent view into the main window
- From: Germán Poó Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/recent-view: 5/12] shell: Integrate recent view into the main window
- Date: Mon, 24 Feb 2014 04:04:59 +0000 (UTC)
commit 4f982445c4d375373485065d3479c87ad3409b2b
Author: Aakash Goenka <aakash goenka gmail com>
Date: Sun Feb 23 14:53:57 2014 -0800
shell: Integrate recent view into the main window
shell/ev-application.c | 2 +-
shell/ev-window.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++
shell/ev-window.h | 1 +
3 files changed, 70 insertions(+), 1 deletions(-)
---
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 475dfaf..86ea9f5 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -654,7 +654,7 @@ ev_application_open_window (EvApplication *application,
GdkScreen *screen,
guint32 timestamp)
{
- GtkWidget *new_window = ev_window_new ();
+ GtkWidget *new_window = ev_window_new_with_bookshelf ();
#ifdef GDK_WINDOWING_X11
GdkWindow *gdk_window;
#endif
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 8a01ab9..c539e8e 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -91,6 +91,7 @@
#include "ev-bookmark-action.h"
#include "ev-zoom-action.h"
#include "ev-toolbar.h"
+#include "ev-bookshelf.h"
#ifdef ENABLE_DBUS
#include "ev-gdbus-generated.h"
@@ -191,6 +192,9 @@ struct _EvWindowPrivate {
GtkWidget *attachment_popup;
GList *attach_list;
+ /* For Bookshelf */
+ EvBookshelf *bookshelf;
+
/* Document */
EvDocumentModel *model;
char *uri;
@@ -382,6 +386,10 @@ static void ev_window_setup_bookmarks (EvWindow *windo
static void ev_window_show_find_bar (EvWindow *ev_window,
gboolean restart);
static void ev_window_close_find_bar (EvWindow *ev_window);
+static void ev_window_try_swap_out_bookshelf (EvWindow *ev_window);
+static void bookshelf_item_activated_cb (EvBookshelf *bookshelf,
+ const char *uri,
+ EvWindow *ev_window);
static gchar *nautilus_sendto = NULL;
@@ -1657,6 +1665,9 @@ ev_window_load_job_cb (EvJob *job,
/* Success! */
if (!ev_job_is_failed (job)) {
+
+ ev_window_try_swap_out_bookshelf (ev_window);
+
ev_document_model_set_document (ev_window->priv->model, document);
#ifdef ENABLE_DBUS
@@ -2185,6 +2196,7 @@ ev_window_open_document (EvWindow *ev_window,
ev_window_close_dialogs (ev_window);
ev_window_clear_load_job (ev_window);
ev_window_clear_local_uri (ev_window);
+ ev_window_try_swap_out_bookshelf (ev_window);
if (ev_window->priv->monitor) {
g_object_unref (ev_window->priv->monitor);
@@ -5357,6 +5369,35 @@ find_sidebar_result_activated_cb (EvFindSidebar *find_sidebar,
}
static void
+ev_window_try_swap_out_bookshelf (EvWindow *ev_window)
+{
+ GtkWidget *widget;
+
+ widget = gtk_bin_get_child (GTK_BIN (ev_window->priv->scrolled_window));
+
+ if (ev_window->priv->bookshelf)
+ {
+ gtk_container_remove (GTK_CONTAINER (ev_window->priv->scrolled_window), widget);
+ g_object_unref (ev_window->priv->bookshelf);
+ ev_window->priv->bookshelf = NULL;
+
+ gtk_container_add (GTK_CONTAINER (ev_window->priv->scrolled_window),
+ ev_window->priv->view);
+ }
+}
+
+static void
+bookshelf_item_activated_cb (EvBookshelf *bookshelf,
+ const char *uri,
+ EvWindow *ev_window)
+{
+ ev_application_open_uri_at_dest (EV_APP, uri,
+ gtk_window_get_screen (GTK_WINDOW (ev_window)),
+ NULL, 0, NULL, gtk_get_current_event_time ());
+ return;
+}
+
+static void
ev_window_update_find_status_message (EvWindow *ev_window)
{
gchar *message;
@@ -7350,6 +7391,7 @@ ev_window_init (EvWindow *ev_window)
#endif /* ENABLE_DBUS */
ev_window->priv->model = ev_document_model_new ();
+ ev_window->priv->bookshelf = NULL;
ev_window->priv->page_mode = PAGE_MODE_DOCUMENT;
ev_window->priv->chrome = EV_CHROME_NORMAL;
@@ -7760,6 +7802,7 @@ ev_window_init (EvWindow *ev_window)
NULL, 0,
GDK_ACTION_COPY);
gtk_drag_dest_add_uri_targets (GTK_WIDGET (ev_window));
+
}
/**
@@ -7783,6 +7826,31 @@ ev_window_new (void)
return ev_window;
}
+GtkWidget *
+ev_window_new_with_bookshelf (void)
+{
+ EvWindow *ev_window;
+ GtkWidget *widget;
+
+ ev_window = EV_WINDOW (ev_window_new ());
+
+ widget = gtk_bin_get_child (GTK_BIN (ev_window->priv->scrolled_window));
+ gtk_container_remove (GTK_CONTAINER (ev_window->priv->scrolled_window), widget);
+
+ ev_window->priv->bookshelf = ev_bookshelf_new ();
+
+ g_object_ref (ev_window->priv->bookshelf);
+ gtk_widget_show (GTK_WIDGET (ev_window->priv->bookshelf));
+ gtk_container_add (GTK_CONTAINER (ev_window->priv->scrolled_window),
+ GTK_WIDGET (ev_window->priv->bookshelf));
+
+ g_signal_connect_object (ev_window->priv->bookshelf,
+ "item-activated",
+ G_CALLBACK (bookshelf_item_activated_cb),
+ ev_window, 0);
+ return GTK_WIDGET (ev_window);
+}
+
const gchar *
ev_window_get_dbus_object_path (EvWindow *ev_window)
{
diff --git a/shell/ev-window.h b/shell/ev-window.h
index fd2d0b5..570f110 100644
--- a/shell/ev-window.h
+++ b/shell/ev-window.h
@@ -70,6 +70,7 @@ struct _EvWindowClass {
GType ev_window_get_type (void) G_GNUC_CONST;
GtkWidget *ev_window_new (void);
+GtkWidget *ev_window_new_with_bookshelf (void);
const char *ev_window_get_uri (EvWindow *ev_window);
void ev_window_open_uri (EvWindow *ev_window,
const char *uri,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]