[Goodies-commits] r3484 - ristretto/trunk/src
Stephan Arts
stephan at xfce.org
Thu Nov 1 23:08:50 CET 2007
Author: stephan
Date: 2007-11-01 22:08:50 +0000 (Thu, 01 Nov 2007)
New Revision: 3484
Modified:
ristretto/trunk/src/main.c
ristretto/trunk/src/main_window.c
ristretto/trunk/src/navigator.c
ristretto/trunk/src/navigator.h
ristretto/trunk/src/picture_viewer.c
Log:
Add preloader
Modified: ristretto/trunk/src/main.c
===================================================================
--- ristretto/trunk/src/main.c 2007-11-01 07:38:58 UTC (rev 3483)
+++ ristretto/trunk/src/main.c 2007-11-01 22:08:50 UTC (rev 3484)
@@ -93,12 +93,15 @@
gint window_height = xfce_rc_read_int_entry(xfce_rc, "LastWindowHeight", 300);
gint slideshow_timeout = xfce_rc_read_int_entry(xfce_rc, "SlideShowTimeout", 5000);
gint max_cache = xfce_rc_read_int_entry(xfce_rc, "MaxImagesCacheSize", 1);
+ gboolean preload_during_slideshow = xfce_rc_read_bool_entry (xfce_rc, "PreloadDuringSlideShow", FALSE);
GtkWidget *window = rstto_main_window_new();
gtk_widget_ref(window);
RsttoNavigator *navigator = rstto_main_window_get_navigator(RSTTO_MAIN_WINDOW(window));
+ navigator->preload = preload_during_slideshow;
+
rstto_main_window_set_max_cache_size(RSTTO_MAIN_WINDOW(window), max_cache);
rstto_main_window_set_slideshow_timeout(RSTTO_MAIN_WINDOW(window), (gdouble)slideshow_timeout);
@@ -217,6 +220,7 @@
gtk_main();
xfce_rc_write_bool_entry(xfce_rc, "ShowToolBar", rstto_main_window_get_show_toolbar(RSTTO_MAIN_WINDOW(window)));
+ xfce_rc_write_bool_entry(xfce_rc, "PreloadDuringSlideShow", navigator->preload);
xfce_rc_write_bool_entry(xfce_rc, "ShowThumbnailViewer", rstto_main_window_get_show_thumbnail_viewer(RSTTO_MAIN_WINDOW(window)));
switch (rstto_main_window_get_thumbnail_viewer_orientation(RSTTO_MAIN_WINDOW(window)))
{
Modified: ristretto/trunk/src/main_window.c
===================================================================
--- ristretto/trunk/src/main_window.c 2007-11-01 07:38:58 UTC (rev 3483)
+++ ristretto/trunk/src/main_window.c 2007-11-01 22:08:50 UTC (rev 3484)
@@ -846,7 +846,6 @@
rstto_main_window_set_max_cache_size (RsttoMainWindow *window, gint max_cache_size)
{
window->priv->settings.max_cache_size = max_cache_size;
- window->priv->navigator->max_history = max_cache_size;
}
/* CALLBACK FUNCTIONS */
@@ -1031,21 +1030,7 @@
gtk_container_add(GTK_CONTAINER(slideshow_frame), slideshow_vbox);
- GtkWidget *cache_frame = gtk_frame_new(N_("Image history cache:"));
-
- GtkWidget *cache_vbox = gtk_vbox_new(FALSE, 0);
- GtkWidget *cache_lbl = gtk_label_new(NULL);
- GtkWidget *cache_hscale = gtk_hscale_new_with_range(1, 20, 3);
-
- gtk_range_set_value(GTK_RANGE(cache_hscale), window->priv->settings.max_cache_size);
-
- gtk_box_pack_start(GTK_BOX(cache_vbox), cache_lbl, FALSE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(cache_vbox), cache_hscale, FALSE, TRUE, 0);
-
- gtk_container_add(GTK_CONTAINER(cache_frame), cache_vbox);
-
gtk_box_pack_start(GTK_BOX(main_vbox), slideshow_frame, FALSE, TRUE, 0);
- gtk_box_pack_start(GTK_BOX(main_vbox), cache_frame, FALSE, TRUE, 0);
gtk_widget_show_all(notebook);
@@ -1055,8 +1040,6 @@
{
case GTK_RESPONSE_OK:
rstto_main_window_set_slideshow_timeout(window, gtk_range_get_value(GTK_RANGE(slideshow_hscale)) * 1000);
- rstto_main_window_set_max_cache_size(window, gtk_range_get_value(GTK_RANGE(cache_hscale)));
- break;
default:
break;
}
Modified: ristretto/trunk/src/navigator.c
===================================================================
--- ristretto/trunk/src/navigator.c 2007-11-01 07:38:58 UTC (rev 3483)
+++ ristretto/trunk/src/navigator.c 2007-11-01 22:08:50 UTC (rev 3484)
@@ -132,7 +132,7 @@
navigator->timeout = 5000;
navigator->monitor = thunar_vfs_monitor_get_default();
navigator->max_history = 1;
- navigator->max_preload = 0;
+ navigator->preload = FALSE;
navigator->factory = thunar_vfs_thumb_factory_new(THUNAR_VFS_THUMB_SIZE_NORMAL);
}
@@ -407,7 +407,15 @@
{
navigator->running = running;
if(!navigator->id)
+ {
navigator->id = g_timeout_add(navigator->timeout, (GSourceFunc)cb_rstto_navigator_running, navigator);
+ if (navigator->preload)
+ {
+ RsttoNavigatorEntry *next_entry = g_list_next(navigator->file_iter)->data;
+
+ rstto_navigator_entry_load_image(next_entry, FALSE);
+ }
+ }
}
else
{
@@ -575,6 +583,13 @@
if(navigator->running)
{
rstto_navigator_jump_forward(navigator);
+
+ if (navigator->preload)
+ {
+ RsttoNavigatorEntry *next_entry = g_list_next(navigator->file_iter)->data;
+
+ rstto_navigator_entry_load_image(next_entry, FALSE);
+ }
}
else
navigator->id = 0;
@@ -833,7 +848,7 @@
}
gboolean
-rstto_navigator_entry_load_image (RsttoNavigatorEntry *entry)
+rstto_navigator_entry_load_image (RsttoNavigatorEntry *entry, gboolean empty_cache)
{
g_return_val_if_fail(entry != NULL, FALSE);
gchar *path = NULL;
@@ -842,7 +857,7 @@
{
return FALSE;
}
- if (entry->loader == NULL)
+ if ((entry->loader == NULL) && ((empty_cache == TRUE ) || entry->src_pixbuf == NULL))
{
entry->loader = gdk_pixbuf_loader_new();
@@ -1054,7 +1069,7 @@
switch (event)
{
case THUNAR_VFS_MONITOR_EVENT_CHANGED:
- rstto_navigator_entry_load_image (entry);
+ rstto_navigator_entry_load_image (entry, TRUE);
break;
case THUNAR_VFS_MONITOR_EVENT_CREATED:
break;
Modified: ristretto/trunk/src/navigator.h
===================================================================
--- ristretto/trunk/src/navigator.h 2007-11-01 07:38:58 UTC (rev 3483)
+++ ristretto/trunk/src/navigator.h 2007-11-01 22:08:50 UTC (rev 3484)
@@ -55,8 +55,9 @@
GList *file_iter;
GList *history;
gint max_history;
- gint max_preload;
+ gboolean preload;
+
gint old_position;
gboolean running;
gint timeout;
@@ -139,7 +140,7 @@
GdkPixbuf *
rstto_navigator_entry_get_pixbuf (RsttoNavigatorEntry *entry);
gboolean
-rstto_navigator_entry_load_image (RsttoNavigatorEntry *entry);
+rstto_navigator_entry_load_image (RsttoNavigatorEntry *entry, gboolean empty_cache);
gint
rstto_navigator_get_cache_max_images (RsttoNavigator *navigator);
Modified: ristretto/trunk/src/picture_viewer.c
===================================================================
--- ristretto/trunk/src/picture_viewer.c 2007-11-01 07:38:58 UTC (rev 3483)
+++ ristretto/trunk/src/picture_viewer.c 2007-11-01 22:08:50 UTC (rev 3484)
@@ -732,7 +732,7 @@
viewer->priv->entry = entry;
if(entry)
{
- rstto_navigator_entry_load_image(entry);
+ rstto_navigator_entry_load_image(entry, FALSE);
}
else
{
More information about the Goodies-commits
mailing list