Blob Blame History Raw
diff -up gnome-desktop-2.27.5/libgnome-desktop/gnome-bg.c.slideshow-api gnome-desktop-2.27.5/libgnome-desktop/gnome-bg.c
--- gnome-desktop-2.27.5/libgnome-desktop/gnome-bg.c.slideshow-api	2009-04-26 18:40:20.000000000 -0400
+++ gnome-desktop-2.27.5/libgnome-desktop/gnome-bg.c	2009-08-13 01:14:41.403741426 -0400
@@ -177,7 +177,8 @@ static GdkPixbuf *create_img_thumbnail (
 					GnomeDesktopThumbnailFactory *factory,
 					GdkScreen             *screen,
 					int                    dest_width,
-					int                    dest_height);
+					int                    dest_height,
+					int		       frame_num);
 static SlideShow * get_as_slideshow    (GnomeBG               *bg,
 					const char 	      *filename);
 static Slide *     get_current_slide   (SlideShow 	      *show,
@@ -1055,7 +1056,7 @@ fit_factor (int from_width, int from_hei
 
 GdkPixbuf *
 gnome_bg_create_thumbnail (GnomeBG               *bg,
-			   GnomeDesktopThumbnailFactory *factory,
+		           GnomeDesktopThumbnailFactory *factory,
 			   GdkScreen             *screen,
 			   int                    dest_width,
 			   int                    dest_height)
@@ -1069,7 +1070,7 @@ gnome_bg_create_thumbnail (GnomeBG      
 	
 	draw_color (bg, result);
 	
-	thumb = create_img_thumbnail (bg, factory, screen, dest_width, dest_height);
+	thumb = create_img_thumbnail (bg, factory, screen, dest_width, dest_height, -1);
 	
 	if (thumb) {
 		draw_image (bg->placement, thumb, result);
@@ -1752,7 +1753,8 @@ create_img_thumbnail (GnomeBG           
 		      GnomeDesktopThumbnailFactory *factory,
 		      GdkScreen             *screen,
 		      int                    dest_width,
-		      int                    dest_height)
+		      int                    dest_height,
+		      int                    frame_num)
 {
 	if (bg->filename) {
 		GdkPixbuf *thumb = get_as_thumbnail (bg, factory, bg->filename);
@@ -1771,7 +1773,10 @@ create_img_thumbnail (GnomeBG           
 
 				slideshow_ref (show);
 
-				slide = get_current_slide (show, &alpha);
+				if (frame_num == -1)
+					slide = get_current_slide (show, &alpha);
+				else
+					slide = g_queue_peek_nth (show->slides, frame_num);
 
 				if (slide->fixed) {
 					GdkPixbuf *tmp;
@@ -2636,3 +2641,75 @@ slideshow_changes_with_size (SlideShow *
 	return show->changes_with_size;
 }
 
+gboolean
+gnome_bg_changes_with_time (GnomeBG *bg)
+{
+	SlideShow *show;
+
+	g_return_val_if_fail (bg != NULL, FALSE);
+
+	show = get_as_slideshow (bg, bg->filename);
+	if (show)
+		return g_queue_get_length (show->slides) > 1;
+
+	return FALSE;
+}
+
+/* frame_num is only counting static frames here,
+ * we are skipping transitions
+ * returns NULL if frame_num is out of bounds
+ */
+GdkPixbuf *
+gnome_bg_create_frame_thumbnail (GnomeBG               *bg,
+		   	         GnomeDesktopThumbnailFactory *factory,
+			         GdkScreen             *screen,
+			         int                    dest_width,
+			         int                    dest_height,
+                                 int                    frame_num)
+{
+	SlideShow *show;
+	GdkPixbuf *result;
+	GdkPixbuf *thumb;
+	GList *l;
+        int i, skipped;
+	gboolean found;
+
+	g_return_val_if_fail (bg != NULL, FALSE);
+
+	show = get_as_slideshow (bg, bg->filename);
+
+	if (!show)
+		return NULL;
+
+	i = 0;
+	skipped = 0;
+	found = FALSE;
+	for (l = show->slides->head; l; l = l->next) {
+		Slide *slide = l->data;
+		if (!slide->fixed) {
+			skipped++;
+			continue;
+		}
+		if (i == frame_num) {
+			found = TRUE;
+			break;
+		}
+		i++;
+	}
+	if (!found)
+		return NULL;
+
+	result = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, dest_width, dest_height);
+
+	draw_color (bg, result);
+
+	thumb = create_img_thumbnail (bg, factory, screen, dest_width, dest_height, frame_num + skipped);
+
+	if (thumb) {
+		draw_image (bg->placement, thumb, result);
+		g_object_unref (thumb);
+	}
+
+	return result;
+}
+
diff -up gnome-desktop-2.27.5/libgnome-desktop/libgnomeui/gnome-bg.h.slideshow-api gnome-desktop-2.27.5/libgnome-desktop/libgnomeui/gnome-bg.h
--- gnome-desktop-2.27.5/libgnome-desktop/libgnomeui/gnome-bg.h.slideshow-api	2009-04-19 13:39:06.000000000 -0400
+++ gnome-desktop-2.27.5/libgnome-desktop/libgnomeui/gnome-bg.h	2009-08-12 23:09:11.297992749 -0400
@@ -104,7 +104,13 @@ GdkPixbuf *      gnome_bg_create_thumbna
 						 int                    dest_height);
 gboolean         gnome_bg_is_dark               (GnomeBG               *bg);
 gboolean         gnome_bg_changes_with_size     (GnomeBG               *bg);
-
+gboolean         gnome_bg_changes_with_time     (GnomeBG               *bg);
+GdkPixbuf *      gnome_bg_create_frame_thumbnail (GnomeBG              *bg,
+						 GnomeDesktopThumbnailFactory *factory,
+						 GdkScreen             *screen,
+						 int                    dest_width,
+						 int                    dest_height,
+                                                 int                    frame_num);
 
 /* Set a pixmap as root - not a GnomeBG method. At some point
  * if we decide to stabilize the API then we may want to make