[evince] ev-window: add new gsetting to set the page cache size
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] ev-window: add new gsetting to set the page cache size
- Date: Sat, 8 Jun 2013 08:55:59 +0000 (UTC)
commit 392d8e33fb1a85c09690b65b3ad0a709ca6fff77
Author: Jonas Danielsson <jonas threetimestwo org>
Date: Fri May 17 14:58:01 2013 +0200
ev-window: add new gsetting to set the page cache size
https://bugzilla.gnome.org/show_bug.cgi?id=642683
data/org.gnome.Evince.gschema.xml.in | 6 ++++++
shell/ev-window.c | 23 +++++++++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/data/org.gnome.Evince.gschema.xml.in b/data/org.gnome.Evince.gschema.xml.in
index 6c0fdce..ecd3b62 100644
--- a/data/org.gnome.Evince.gschema.xml.in
+++ b/data/org.gnome.Evince.gschema.xml.in
@@ -25,6 +25,12 @@
<default>nothing</default>
<_summary>The URI of the directory last used to save a picture</_summary>
</key>
+ <key name="page-cache-size" type="u">
+ <default>50</default>
+ <_summary>Page cache size in Mb</_summary>
+ <_description>The maximum size that will be used to cache rendered pages, limits maximum zoom
level.</_description>
+ </key>
+
<child name="default" schema="org.gnome.Evince.Default"/>
</schema>
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 13e3bb8..da1ce0c 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -251,6 +251,7 @@ struct _EvWindowPrivate {
#define GS_SCHEMA_NAME "org.gnome.Evince"
#define GS_OVERRIDE_RESTRICTIONS "override-restrictions"
+#define GS_PAGE_CACHE_SIZE "page-cache-size"
#define GS_AUTO_RELOAD "auto-reload"
#define GS_LAST_DOCUMENT_DIRECTORY "document-directory"
#define GS_LAST_PICTURES_DIRECTORY "pictures-directory"
@@ -1255,6 +1256,18 @@ setup_view_from_metadata (EvWindow *window)
}
static void
+page_cache_size_changed (GSettings *settings,
+ gchar *key,
+ EvWindow *ev_window)
+{
+ guint page_cache_mb;
+
+ page_cache_mb = g_settings_get_uint (settings, GS_PAGE_CACHE_SIZE);
+ ev_view_set_page_cache_size (EV_VIEW (ev_window->priv->view),
+ page_cache_mb * 1024 * 1024);
+}
+
+static void
ev_window_setup_default (EvWindow *ev_window)
{
EvDocumentModel *model = ev_window->priv->model;
@@ -1365,6 +1378,11 @@ ev_window_ensure_settings (EvWindow *ev_window)
"changed::"GS_OVERRIDE_RESTRICTIONS,
G_CALLBACK (override_restrictions_changed),
ev_window);
+ g_signal_connect (priv->settings,
+ "changed::"GS_PAGE_CACHE_SIZE,
+ G_CALLBACK (page_cache_size_changed),
+ ev_window);
+
return priv->settings;
}
@@ -7035,6 +7053,7 @@ ev_window_init (EvWindow *ev_window)
GtkWidget *sidebar_widget;
GtkWidget *overlay;
GObject *mpkeys;
+ guint page_cache_mb;
#ifdef ENABLE_DBUS
GDBusConnection *connection;
static gint window_id = 0;
@@ -7292,6 +7311,10 @@ ev_window_init (EvWindow *ev_window)
gtk_widget_show (ev_window->priv->view_box);
ev_window->priv->view = ev_view_new ();
+ page_cache_mb = g_settings_get_uint (ev_window_ensure_settings (ev_window),
+ GS_PAGE_CACHE_SIZE);
+ ev_view_set_page_cache_size (EV_VIEW (ev_window->priv->view),
+ page_cache_mb * 1024 * 1024);
ev_view_set_model (EV_VIEW (ev_window->priv->view), ev_window->priv->model);
ev_window->priv->password_view = ev_password_view_new (GTK_WINDOW (ev_window));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]