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