[evince/wip/recent-view: 7/12] shell: Rename class from EvBookshelf to EvRecentView
- From: Germán Poó Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/recent-view: 7/12] shell: Rename class from EvBookshelf to EvRecentView
- Date: Mon, 24 Feb 2014 04:05:09 +0000 (UTC)
commit 4bed6f0463baa8a10103a46f811d0e29892473f7
Author: Aakash Goenka <aakash goenka gmail com>
Date: Mon Jul 22 20:13:17 2013 +0530
shell: Rename class from EvBookshelf to EvRecentView
EvRecentView sounds more appropriate based on feedback with
KaL.
shell/Makefile.am | 4 +-
shell/ev-application.c | 2 +-
shell/ev-bookshelf.h | 60 --------
shell/{ev-bookshelf.c => ev-recent-view.c} | 213 ++++++++++++++--------------
shell/ev-recent-view.h | 60 ++++++++
shell/ev-toolbar.c | 4 +-
shell/ev-window.c | 76 +++++-----
shell/ev-window.h | 2 +-
8 files changed, 208 insertions(+), 213 deletions(-)
---
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 121e4ce..a2d9d49 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -15,8 +15,6 @@ evince_SOURCES= \
ev-bookmarks.c \
ev-bookmark-action.h \
ev-bookmark-action.c \
- ev-bookshelf.c \
- ev-bookshelf.h \
ev-application.c \
ev-application.h \
ev-file-monitor.h \
@@ -49,6 +47,8 @@ evince_SOURCES= \
ev-properties-license.h \
ev-open-recent-action.c \
ev-open-recent-action.h \
+ ev-recent-view.c \
+ ev-recent-view.h \
ev-toolbar.c \
ev-toolbar.h \
ev-utils.c \
diff --git a/shell/ev-application.c b/shell/ev-application.c
index 5c34dca..517e785 100644
--- a/shell/ev-application.c
+++ b/shell/ev-application.c
@@ -655,7 +655,7 @@ ev_application_open_window (EvApplication *application,
guint32 timestamp)
{
GtkWidget *new_window = ev_window_new ();
- ev_window_show_bookshelf (new_window);
+ ev_window_show_recent_view (EV_WINDOW (new_window));
#ifdef GDK_WINDOWING_X11
GdkWindow *gdk_window;
#endif
diff --git a/shell/ev-bookshelf.c b/shell/ev-recent-view.c
similarity index 69%
rename from shell/ev-bookshelf.c
rename to shell/ev-recent-view.c
index bb7b83c..9bd343f 100644
--- a/shell/ev-bookshelf.c
+++ b/shell/ev-recent-view.c
@@ -21,7 +21,7 @@
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "ev-bookshelf.h"
+#include "ev-recent-view.h"
#include "ev-file-helpers.h"
#include "gd-icon-utils.h"
#include "gd-main-view-generic.h"
@@ -33,14 +33,14 @@
#include "ev-metadata.h"
typedef enum {
- EV_BOOKSHELF_JOB_COLUMN = GD_MAIN_COLUMN_LAST,
- EV_BOOKSHELF_THUMBNAILED_COLUMN,
- EV_BOOKSHELF_DOCUMENT_COLUMN,
- EV_BOOKSHELF_METADATA_COLUMN,
+ EV_RECENT_VIEW_JOB_COLUMN = GD_MAIN_COLUMN_LAST,
+ EV_RECENT_VIEW_THUMBNAILED_COLUMN,
+ EV_RECENT_VIEW_DOCUMENT_COLUMN,
+ EV_RECENT_VIEW_METADATA_COLUMN,
NUM_COLUMNS
-} EvBookshelfColumns;
+} EvRecentViewColumns;
-struct _EvBookshelfPrivate {
+struct _EvRecentViewPrivate {
GtkWidget *view;
GtkListStore *list_store;
GtkRecentManager *recent_manager;
@@ -55,39 +55,39 @@ enum {
static guint signals[NUM_SIGNALS] = { 0, };
static void thumbnail_job_completed_callback (EvJobThumbnail *job,
- EvBookshelf *ev_bookshelf);
+ EvRecentView *ev_recent_view);
static void document_load_job_completed_callback (EvJobLoad *job_load,
- EvBookshelf *ev_bookshelf);
-static gboolean ev_bookshelf_clear_job (GtkTreeModel *model,
+ EvRecentView *ev_recent_view);
+static gboolean ev_recent_view_clear_job (GtkTreeModel *model,
GtkTreePath *path,
GtkTreeIter *iter,
- gpointer data);
-static void ev_bookshelf_clear_model (EvBookshelf *bookshelf);
-static void ev_bookshelf_refresh (EvBookshelf *bookshelf);
+ gpointer data);
+static void ev_recent_view_clear_model (EvRecentView *ev_recent_view);
+static void ev_recent_view_refresh (EvRecentView *ev_recent_view);
-G_DEFINE_TYPE (EvBookshelf, ev_bookshelf, GTK_TYPE_SCROLLED_WINDOW)
+G_DEFINE_TYPE (EvRecentView, ev_recent_view, GTK_TYPE_SCROLLED_WINDOW)
#define ICON_VIEW_SIZE 128
-#define MAX_BOOKSHELF_ITEMS 20
+#define MAX_RECENT_VIEW_ITEMS 20
static void
-ev_bookshelf_dispose (GObject *obj)
+ev_recent_view_dispose (GObject *obj)
{
- EvBookshelf *self = EV_BOOKSHELF (obj);
+ EvRecentView *self = EV_RECENT_VIEW (obj);
if (self->priv->list_store) {
- ev_bookshelf_clear_model (self);
+ ev_recent_view_clear_model (self);
g_object_unref (self->priv->list_store);
self->priv->list_store = NULL;
}
if (self->priv->recent_manager) {
g_signal_handlers_disconnect_by_func (self->priv->recent_manager,
- ev_bookshelf_refresh,
+ ev_recent_view_refresh,
self);
self->priv->recent_manager = NULL;
}
- G_OBJECT_CLASS (ev_bookshelf_parent_class)->dispose (obj);
+ G_OBJECT_CLASS (ev_recent_view_parent_class)->dispose (obj);
}
static gboolean
@@ -150,14 +150,14 @@ save_thumbnail (GdkPixbuf *pixbuf,
}
static gboolean
-ev_bookshelf_clear_job (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gpointer data)
+ev_recent_view_clear_job (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer data)
{
EvJob *job;
- gtk_tree_model_get (model, iter, EV_BOOKSHELF_JOB_COLUMN, &job, -1);
+ gtk_tree_model_get (model, iter, EV_RECENT_VIEW_JOB_COLUMN, &job, -1);
if (job != NULL) {
ev_job_cancel (job);
@@ -170,11 +170,11 @@ ev_bookshelf_clear_job (GtkTreeModel *model,
}
static void
-ev_bookshelf_clear_model (EvBookshelf *bookshelf)
+ev_recent_view_clear_model (EvRecentView *ev_recent_view)
{
- EvBookshelfPrivate *priv = bookshelf->priv;
+ EvRecentViewPrivate *priv = ev_recent_view->priv;
- gtk_tree_model_foreach (GTK_TREE_MODEL (priv->list_store), ev_bookshelf_clear_job, bookshelf);
+ gtk_tree_model_foreach (GTK_TREE_MODEL (priv->list_store), ev_recent_view_clear_job, ev_recent_view);
gtk_list_store_clear (priv->list_store);
}
@@ -205,7 +205,7 @@ compare_recent_items (GtkRecentInfo *a,
}
static GdMainViewGeneric *
-get_generic (EvBookshelf *self)
+get_generic (EvRecentView *self)
{
if (self->priv->view != NULL)
return GD_MAIN_VIEW_GENERIC (self->priv->view);
@@ -218,7 +218,7 @@ on_button_release_event (GtkWidget *view,
GdkEventButton *event,
gpointer user_data)
{
- EvBookshelf *self = user_data;
+ EvRecentView *self = user_data;
GdMainViewGeneric *generic = get_generic (self);
GtkTreePath *path;
gchar *button_release_item_path;
@@ -272,7 +272,7 @@ on_button_press_event (GtkWidget *view,
GdkEventButton *event,
gpointer user_data)
{
- EvBookshelf *self = user_data;
+ EvRecentView *self = user_data;
GdMainViewGeneric *generic = get_generic (self);
GtkTreePath *path;
@@ -288,21 +288,21 @@ on_button_press_event (GtkWidget *view,
static void
thumbnail_job_completed_callback (EvJobThumbnail *job,
- EvBookshelf *ev_bookshelf)
+ EvRecentView *ev_recent_view)
{
- EvBookshelfPrivate *priv = ev_bookshelf->priv;
- GtkTreeIter *iter;
- GdkPixbuf *pixbuf;
- EvDocument *document;
- EvMetadata *metadata;
- GtkBorder border;
+ EvRecentViewPrivate *priv = ev_recent_view->priv;
+ GtkTreeIter *iter;
+ GdkPixbuf *pixbuf;
+ EvDocument *document;
+ EvMetadata *metadata;
+ GtkBorder border;
border.left = 4;
border.right = 3;
border.top = 3;
border.bottom = 6;
- pixbuf = ev_document_misc_render_thumbnail_with_frame (GTK_WIDGET (ev_bookshelf), job->thumbnail);
+ pixbuf = ev_document_misc_render_thumbnail_with_frame (GTK_WIDGET (ev_recent_view), job->thumbnail);
pixbuf = gd_embed_image_in_frame (pixbuf,
"resource:///org/gnome/evince/shell/ui/thumbnail-frame.png",
@@ -311,15 +311,15 @@ thumbnail_job_completed_callback (EvJobThumbnail *job,
gtk_tree_model_get (GTK_TREE_MODEL (priv->list_store),
iter,
- EV_BOOKSHELF_DOCUMENT_COLUMN, &document,
- EV_BOOKSHELF_METADATA_COLUMN, &metadata,
+ EV_RECENT_VIEW_DOCUMENT_COLUMN, &document,
+ EV_RECENT_VIEW_METADATA_COLUMN, &metadata,
-1);
gtk_list_store_set (priv->list_store,
iter,
GD_MAIN_COLUMN_ICON, pixbuf,
- EV_BOOKSHELF_THUMBNAILED_COLUMN, TRUE,
- EV_BOOKSHELF_JOB_COLUMN, NULL,
+ EV_RECENT_VIEW_THUMBNAILED_COLUMN, TRUE,
+ EV_RECENT_VIEW_JOB_COLUMN, NULL,
-1);
if (metadata) {
@@ -332,12 +332,12 @@ thumbnail_job_completed_callback (EvJobThumbnail *job,
static void
document_load_job_completed_callback (EvJobLoad *job_load,
- EvBookshelf *ev_bookshelf)
+ EvRecentView *ev_recent_view)
{
- EvBookshelfPrivate *priv = ev_bookshelf->priv;
- GtkTreeIter *iter;
- EvDocument *document;
- EvMetadata *metadata;
+ EvRecentViewPrivate *priv = ev_recent_view->priv;
+ GtkTreeIter *iter;
+ EvDocument *document;
+ EvMetadata *metadata;
document = EV_JOB (job_load)->document;
iter = (GtkTreeIter *) g_object_get_data (G_OBJECT (job_load), "tree_iter");
@@ -362,13 +362,13 @@ document_load_job_completed_callback (EvJobLoad *job_load,
g_signal_connect (job_thumbnail, "finished",
G_CALLBACK (thumbnail_job_completed_callback),
- ev_bookshelf);
+ ev_recent_view);
gtk_list_store_set (priv->list_store,
iter,
- EV_BOOKSHELF_THUMBNAILED_COLUMN, FALSE,
- EV_BOOKSHELF_JOB_COLUMN, job_thumbnail,
- EV_BOOKSHELF_DOCUMENT_COLUMN, document,
+ EV_RECENT_VIEW_THUMBNAILED_COLUMN, FALSE,
+ EV_RECENT_VIEW_JOB_COLUMN, job_thumbnail,
+ EV_RECENT_VIEW_DOCUMENT_COLUMN, document,
-1);
ev_job_scheduler_push_job (EV_JOB (job_thumbnail), EV_JOB_PRIORITY_HIGH);
@@ -383,8 +383,8 @@ document_load_job_completed_callback (EvJobLoad *job_load,
gtk_list_store_set (priv->list_store,
iter,
- EV_BOOKSHELF_THUMBNAILED_COLUMN, TRUE,
- EV_BOOKSHELF_JOB_COLUMN, NULL,
+ EV_RECENT_VIEW_THUMBNAILED_COLUMN, TRUE,
+ EV_RECENT_VIEW_JOB_COLUMN, NULL,
-1);
if (metadata) {
@@ -407,17 +407,17 @@ document_load_job_completed_callback (EvJobLoad *job_load,
}
static void
-ev_bookshelf_refresh (EvBookshelf *ev_bookshelf)
+ev_recent_view_refresh (EvRecentView *ev_recent_view)
{
GList *items, *l;
guint n_items = 0;
const gchar *evince = g_get_application_name ();
- GdMainViewGeneric *generic = get_generic (ev_bookshelf);
+ GdMainViewGeneric *generic = get_generic (ev_recent_view);
- items = gtk_recent_manager_get_items (ev_bookshelf->priv->recent_manager);
+ items = gtk_recent_manager_get_items (ev_recent_view->priv->recent_manager);
items = g_list_sort (items, (GCompareFunc) compare_recent_items);
- gtk_list_store_clear (ev_bookshelf->priv->list_store);
+ gtk_list_store_clear (ev_recent_view->priv->list_store);
for (l = items; l && l->data; l = g_list_next (l)) {
EvJob *job_load = NULL;
@@ -461,23 +461,23 @@ ev_bookshelf_refresh (EvBookshelf *ev_bookshelf)
job_load = ev_job_load_new (uri);
g_signal_connect (job_load, "finished",
G_CALLBACK (document_load_job_completed_callback),
- ev_bookshelf);
+ ev_recent_view);
}
access_time = gtk_recent_info_get_modified (info);
- gtk_list_store_append (ev_bookshelf->priv->list_store, &iter);
+ gtk_list_store_append (ev_recent_view->priv->list_store, &iter);
- gtk_list_store_set (ev_bookshelf->priv->list_store, &iter,
+ gtk_list_store_set (ev_recent_view->priv->list_store, &iter,
GD_MAIN_COLUMN_URI, uri,
GD_MAIN_COLUMN_PRIMARY_TEXT, name,
GD_MAIN_COLUMN_SECONDARY_TEXT, NULL,
GD_MAIN_COLUMN_ICON, thumbnail,
GD_MAIN_COLUMN_MTIME, access_time,
GD_MAIN_COLUMN_SELECTED, FALSE,
- EV_BOOKSHELF_DOCUMENT_COLUMN, NULL,
- EV_BOOKSHELF_JOB_COLUMN, job_load,
- EV_BOOKSHELF_THUMBNAILED_COLUMN, FALSE,
- EV_BOOKSHELF_METADATA_COLUMN, metadata,
+ EV_RECENT_VIEW_DOCUMENT_COLUMN, NULL,
+ EV_RECENT_VIEW_JOB_COLUMN, job_load,
+ EV_RECENT_VIEW_THUMBNAILED_COLUMN, FALSE,
+ EV_RECENT_VIEW_METADATA_COLUMN, metadata,
-1);
if (job_load) {
@@ -491,57 +491,57 @@ ev_bookshelf_refresh (EvBookshelf *ev_bookshelf)
if (thumbnail != NULL)
g_object_unref (thumbnail);
- if (++n_items == MAX_BOOKSHELF_ITEMS)
+ if (++n_items == MAX_RECENT_VIEW_ITEMS)
break;
}
g_list_foreach (items, (GFunc) gtk_recent_info_unref, NULL);
g_list_free (items);
- gd_main_view_generic_set_model (generic, GTK_TREE_MODEL (ev_bookshelf->priv->list_store));
+ gd_main_view_generic_set_model (generic, GTK_TREE_MODEL (ev_recent_view->priv->list_store));
}
static void
-ev_bookshelf_rebuild (EvBookshelf *ev_bookshelf)
+ev_recent_view_rebuild (EvRecentView *ev_recent_view)
{
GtkStyleContext *context;
- if (ev_bookshelf->priv->view != NULL)
- gtk_widget_destroy (ev_bookshelf->priv->view);
+ if (ev_recent_view->priv->view != NULL)
+ gtk_widget_destroy (ev_recent_view->priv->view);
- ev_bookshelf->priv->view = gd_main_icon_view_new ();
+ ev_recent_view->priv->view = gd_main_icon_view_new ();
- context = gtk_widget_get_style_context (ev_bookshelf->priv->view);
+ context = gtk_widget_get_style_context (ev_recent_view->priv->view);
gtk_style_context_add_class (context, "content-view");
- gtk_container_add (GTK_CONTAINER (ev_bookshelf), ev_bookshelf->priv->view);
+ gtk_container_add (GTK_CONTAINER (ev_recent_view), ev_recent_view->priv->view);
- g_signal_connect (ev_bookshelf->priv->view, "button-press-event",
- G_CALLBACK (on_button_press_event), ev_bookshelf);
+ g_signal_connect (ev_recent_view->priv->view, "button-press-event",
+ G_CALLBACK (on_button_press_event), ev_recent_view);
- g_signal_connect (ev_bookshelf->priv->view, "button-release-event",
- G_CALLBACK (on_button_release_event), ev_bookshelf);
+ g_signal_connect (ev_recent_view->priv->view, "button-release-event",
+ G_CALLBACK (on_button_release_event), ev_recent_view);
- ev_bookshelf_refresh (ev_bookshelf);
+ ev_recent_view_refresh (ev_recent_view);
- gtk_widget_show_all (GTK_WIDGET (ev_bookshelf));
+ gtk_widget_show_all (GTK_WIDGET (ev_recent_view));
}
static void
-ev_bookshelf_constructed (GObject *object)
+ev_recent_view_constructed (GObject *object)
{
- EvBookshelf *ev_bookshelf = EV_BOOKSHELF (object);
+ EvRecentView *ev_recent_view = EV_RECENT_VIEW (object);
- G_OBJECT_CLASS (ev_bookshelf_parent_class)->constructed (object);
- ev_bookshelf_rebuild (ev_bookshelf);
+ G_OBJECT_CLASS (ev_recent_view_parent_class)->constructed (object);
+ ev_recent_view_rebuild (ev_recent_view);
}
static void
-ev_bookshelf_init (EvBookshelf *ev_bookshelf)
+ev_recent_view_init (EvRecentView *ev_recent_view)
{
- ev_bookshelf->priv = G_TYPE_INSTANCE_GET_PRIVATE (ev_bookshelf, EV_TYPE_BOOKSHELF,
EvBookshelfPrivate);
- ev_bookshelf->priv->recent_manager = gtk_recent_manager_get_default ();
- ev_bookshelf->priv->list_store = gtk_list_store_new (11,
+ ev_recent_view->priv = G_TYPE_INSTANCE_GET_PRIVATE (ev_recent_view, EV_TYPE_RECENT_VIEW,
EvRecentViewPrivate);
+ ev_recent_view->priv->recent_manager = gtk_recent_manager_get_default ();
+ ev_recent_view->priv->list_store = gtk_list_store_new (11,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
@@ -553,52 +553,47 @@ ev_bookshelf_init (EvBookshelf *ev_bookshelf)
G_TYPE_BOOLEAN,
EV_TYPE_DOCUMENT,
EV_TYPE_METADATA);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (ev_bookshelf->priv->list_store),
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (ev_recent_view->priv->list_store),
GD_MAIN_COLUMN_MTIME,
GTK_SORT_DESCENDING);
- gtk_widget_set_hexpand (GTK_WIDGET (ev_bookshelf), TRUE);
- gtk_widget_set_vexpand (GTK_WIDGET (ev_bookshelf), TRUE);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (ev_bookshelf), GTK_SHADOW_IN);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ev_bookshelf),
+ gtk_widget_set_hexpand (GTK_WIDGET (ev_recent_view), TRUE);
+ gtk_widget_set_vexpand (GTK_WIDGET (ev_recent_view), TRUE);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (ev_recent_view), GTK_SHADOW_IN);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ev_recent_view),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
-
- g_signal_connect_swapped (ev_bookshelf->priv->recent_manager,
+ g_signal_connect_swapped (ev_recent_view->priv->recent_manager,
"changed",
- G_CALLBACK (ev_bookshelf_refresh),
- ev_bookshelf);
+ G_CALLBACK (ev_recent_view_refresh),
+ ev_recent_view);
}
static void
-ev_bookshelf_class_init (EvBookshelfClass *klass)
+ev_recent_view_class_init (EvRecentViewClass *klass)
{
GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
- g_object_class->constructed = ev_bookshelf_constructed;
- g_object_class->dispose = ev_bookshelf_dispose;
+ g_object_class->constructed = ev_recent_view_constructed;
+ g_object_class->dispose = ev_recent_view_dispose;
/* Signals */
signals[ITEM_ACTIVATED] =
g_signal_new ("item-activated",
- EV_TYPE_BOOKSHELF,
+ EV_TYPE_RECENT_VIEW,
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EvBookshelfClass, item_activated),
+ G_STRUCT_OFFSET (EvRecentViewClass, item_activated),
NULL, NULL,
g_cclosure_marshal_generic,
G_TYPE_NONE, 1,
G_TYPE_STRING);
- g_type_class_add_private (klass, sizeof (EvBookshelfPrivate));
+ g_type_class_add_private (klass, sizeof (EvRecentViewPrivate));
}
-EvBookshelf *
-ev_bookshelf_new (void)
+EvRecentView *
+ev_recent_view_new (void)
{
- EvBookshelf *bookshelf;
-
- bookshelf = EV_BOOKSHELF (g_object_new (EV_TYPE_BOOKSHELF, NULL));
-
- return bookshelf;
+ return EV_RECENT_VIEW (g_object_new (EV_TYPE_RECENT_VIEW, NULL));
}
diff --git a/shell/ev-recent-view.h b/shell/ev-recent-view.h
new file mode 100644
index 0000000..3f9a9a3
--- /dev/null
+++ b/shell/ev-recent-view.h
@@ -0,0 +1,60 @@
+/* this file is part of evince, a gnome document viewer
+ *
+ * Copyright (C) 2013 Aakash Goenka
+ *
+ * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __EV_RECENT_VIEW_H__
+#define __EV_RECENT_VIEW_H__
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+typedef struct _EvRecentView EvRecentView;
+typedef struct _EvRecentViewClass EvRecentViewClass;
+typedef struct _EvRecentViewPrivate EvRecentViewPrivate;
+
+#define EV_TYPE_RECENT_VIEW (ev_recent_view_get_type ())
+#define EV_RECENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EV_TYPE_RECENT_VIEW,
EvRecentView))
+#define EV_IS_RECENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EV_TYPE_RECENT_VIEW))
+#define EV_RECENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_RECENT_VIEW,
EvRecentViewClass))
+#define EV_IS_RECENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_RECENT_VIEW))
+#define EV_RECENT_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), EV_TYPE_RECENT_VIEW,
EvRecentViewClass))
+
+struct _EvRecentView
+{
+ GtkScrolledWindow parent;
+
+ EvRecentViewPrivate *priv;
+};
+
+struct _EvRecentViewClass
+{
+ GtkScrolledWindowClass parent_class;
+
+ /* Signals */
+ void (* item_activated) (EvRecentView *bookshelf,
+ const char *uri);
+};
+
+GType ev_recent_view_get_type (void) G_GNUC_CONST;
+EvRecentView *ev_recent_view_new (void);
+
+G_END_DECLS
+
+#endif /* __EV_RECENT_VIEW_H__ */
diff --git a/shell/ev-toolbar.c b/shell/ev-toolbar.c
index aac0a24..1bc270f 100644
--- a/shell/ev-toolbar.c
+++ b/shell/ev-toolbar.c
@@ -158,8 +158,8 @@ ev_toolbar_constructed (GObject *object)
action_group = ev_window_get_main_action_group (ev_toolbar->priv->window);
ui_manager = ev_window_get_ui_manager (ev_toolbar->priv->window);
- /* Bookshelf */
- action = gtk_action_group_get_action (action_group, "ViewBookshelf");
+ /* View of recent items */
+ action = gtk_action_group_get_action (action_group, "RecentViewShow");
button = ev_toolbar_create_toggle_button (ev_toolbar, action);
tool_item = GTK_WIDGET (gtk_tool_item_new ());
gtk_container_add (GTK_CONTAINER (tool_item), button);
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 003252e..195073f 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -91,7 +91,7 @@
#include "ev-bookmark-action.h"
#include "ev-zoom-action.h"
#include "ev-toolbar.h"
-#include "ev-bookshelf.h"
+#include "ev-recent-view.h"
#ifdef ENABLE_DBUS
#include "ev-gdbus-generated.h"
@@ -192,8 +192,8 @@ struct _EvWindowPrivate {
GtkWidget *attachment_popup;
GList *attach_list;
- /* For Bookshelf */
- EvBookshelf *bookshelf;
+ /* For bookshelf view of recent items*/
+ EvRecentView *recent_view;
/* Document */
EvDocumentModel *model;
@@ -386,8 +386,8 @@ 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,
+static void ev_window_try_swap_out_recent_view (EvWindow *ev_window);
+static void recent_view_item_activated_cb (EvRecentView *recent_view,
const char *uri,
EvWindow *ev_window);
@@ -429,7 +429,7 @@ ev_window_setup_action_sensitivity (EvWindow *ev_window)
gboolean has_pages = FALSE;
gboolean can_find = FALSE;
- if (document && !ev_window->priv->bookshelf) {
+ if (document && !ev_window->priv->recent_view) {
has_document = TRUE;
has_pages = ev_document_get_n_pages (document) > 0;
info = ev_document_get_info (document);
@@ -519,16 +519,16 @@ ev_window_update_actions_sensitivity (EvWindow *ev_window)
gboolean can_find_in_page = FALSE;
gboolean dual_mode = FALSE;
- if (ev_window->priv->document && !ev_window->priv->bookshelf) {
+ if (ev_window->priv->document && !ev_window->priv->recent_view) {
page = ev_document_model_get_page (ev_window->priv->model);
n_pages = ev_document_get_n_pages (ev_window->priv->document);
has_pages = n_pages > 0;
dual_mode = ev_document_model_get_dual_page (ev_window->priv->model);
}
- ev_window_set_action_sensitive (ev_window, "ViewBookshelf",
+ ev_window_set_action_sensitive (ev_window, "RecentViewShow",
ev_window->priv->document ||
- !ev_window->priv->bookshelf);
+ !ev_window->priv->recent_view);
can_find_in_page = (ev_window->priv->find_job &&
ev_job_find_has_results (EV_JOB_FIND (ev_window->priv->find_job)));
@@ -1666,7 +1666,7 @@ ev_window_load_job_cb (EvJob *job,
g_assert (job_load->uri);
ev_window_hide_loading_message (ev_window);
- ev_window_try_swap_out_bookshelf (ev_window);
+ ev_window_try_swap_out_recent_view (ev_window);
/* Success! */
if (!ev_job_is_failed (job)) {
@@ -2199,7 +2199,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);
+ ev_window_try_swap_out_recent_view (ev_window);
if (ev_window->priv->monitor) {
g_object_unref (ev_window->priv->monitor);
@@ -4721,13 +4721,13 @@ ev_window_cmd_bookmark_activate (GtkAction *action,
}
static void
-ev_window_cmd_toggle_bookshelf (GtkAction *action,
- EvWindow *ev_window)
+ev_window_cmd_toggle_recent_view (GtkAction *action,
+ EvWindow *ev_window)
{
- if (!ev_window->priv->bookshelf)
- ev_window_show_bookshelf (ev_window);
+ if (!ev_window->priv->recent_view)
+ ev_window_show_recent_view (ev_window);
else {
- ev_window_try_swap_out_bookshelf (ev_window);
+ ev_window_try_swap_out_recent_view (ev_window);
ev_window_setup_action_sensitivity (ev_window);
}
return;
@@ -5385,24 +5385,24 @@ find_sidebar_result_activated_cb (EvFindSidebar *find_sidebar,
}
static void
-ev_window_try_swap_out_bookshelf (EvWindow *ev_window)
+ev_window_try_swap_out_recent_view (EvWindow *ev_window)
{
- if (ev_window->priv->bookshelf)
+ if (ev_window->priv->recent_view)
{
- gtk_widget_hide (GTK_WIDGET (ev_window->priv->bookshelf));
- g_object_unref (ev_window->priv->bookshelf);
- ev_window->priv->bookshelf = NULL;
+ gtk_widget_hide (GTK_WIDGET (ev_window->priv->recent_view));
+ g_object_unref (ev_window->priv->recent_view);
+ ev_window->priv->recent_view = NULL;
}
gtk_widget_show (ev_window->priv->hpaned);
}
static void
-bookshelf_item_activated_cb (EvBookshelf *bookshelf,
- const char *uri,
- EvWindow *ev_window)
+recent_view_item_activated_cb (EvRecentView *recent_view,
+ const char *uri,
+ EvWindow *ev_window)
{
if (ev_window->priv->uri && strcmp (ev_window->priv->uri, uri) == 0)
- ev_window_try_swap_out_bookshelf (ev_window);
+ ev_window_try_swap_out_recent_view (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 ());
@@ -6139,10 +6139,10 @@ static const GtkActionEntry entries[] = {
{ "ViewAutoscroll", GTK_STOCK_MEDIA_PLAY, N_("Auto_scroll"), NULL, NULL,
G_CALLBACK (ev_window_cmd_view_autoscroll) },
- /* Bookshelf */
- { "ViewBookshelf", "view-grid-symbolic", N_("_Bookshelf"), NULL,
- N_("Toggle between bookshelf and open document"),
- G_CALLBACK (ev_window_cmd_toggle_bookshelf) },
+ /* View of recent items */
+ { "RecentViewShow", "view-grid-symbolic", N_("Recent Items"), NULL,
+ N_("Toggle between view of recent items and open document"),
+ G_CALLBACK (ev_window_cmd_toggle_recent_view) },
/* Go menu */
{ "GoPreviousPage", "go-up-symbolic", N_("_Previous Page"), "<control>Page_Up",
@@ -7408,7 +7408,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->recent_view = NULL;
ev_window->priv->page_mode = PAGE_MODE_DOCUMENT;
ev_window->priv->chrome = EV_CHROME_NORMAL;
@@ -7844,22 +7844,22 @@ ev_window_new (void)
}
void
-ev_window_show_bookshelf (EvWindow *ev_window)
+ev_window_show_recent_view (EvWindow *ev_window)
{
gtk_widget_hide (ev_window->priv->hpaned);
- if (!ev_window->priv->bookshelf) {
- ev_window->priv->bookshelf = ev_bookshelf_new ();
- g_object_ref (ev_window->priv->bookshelf);
- g_signal_connect_object (ev_window->priv->bookshelf,
+ if (!ev_window->priv->recent_view) {
+ ev_window->priv->recent_view = ev_recent_view_new ();
+ g_object_ref (ev_window->priv->recent_view);
+ g_signal_connect_object (ev_window->priv->recent_view,
"item-activated",
- G_CALLBACK (bookshelf_item_activated_cb),
+ G_CALLBACK (recent_view_item_activated_cb),
ev_window, 0);
gtk_box_pack_start (GTK_BOX (ev_window->priv->main_box),
- GTK_WIDGET (ev_window->priv->bookshelf),
+ GTK_WIDGET (ev_window->priv->recent_view),
TRUE, TRUE, 0);
}
- gtk_widget_show (GTK_WIDGET (ev_window->priv->bookshelf));
+ gtk_widget_show (GTK_WIDGET (ev_window->priv->recent_view));
ev_window_setup_action_sensitivity (ev_window);
return;
diff --git a/shell/ev-window.h b/shell/ev-window.h
index aa81d47..3dc1f2c 100644
--- a/shell/ev-window.h
+++ b/shell/ev-window.h
@@ -89,7 +89,7 @@ const gchar *ev_window_get_dbus_object_path (EvWindow *ev_win
GtkUIManager *ev_window_get_ui_manager (EvWindow *ev_window);
GtkActionGroup *ev_window_get_main_action_group (EvWindow *ev_window);
GtkActionGroup *ev_window_get_zoom_selector_action_group (EvWindow *ev_window);
-void ev_window_show_bookshelf (EvWindow *ev_window);
+void ev_window_show_recent_view (EvWindow *ev_window);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]