From 2091a36f080a7dc077fd73c7a417d17b408e57ed Mon Sep 17 00:00:00 2001 From: tanya Date: Mon, 4 Oct 2010 22:22:52 +0300 Subject: [PATCH] done in slideshow background and centered images --- applet/src/livewp-actor.c | 14 ++++++++++++-- applet/src/livewp-scene.c | 9 ++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/applet/src/livewp-actor.c b/applet/src/livewp-actor.c index 8d468f1..0bb4522 100644 --- a/applet/src/livewp-actor.c +++ b/applet/src/livewp-actor.c @@ -913,9 +913,10 @@ change_tape(Actor *actor, AWallpaperPlugin *desktop_plugin) void change_slideshow(Actor *actor, AWallpaperPlugin *desktop_plugin) { - gint num, next, prev, now; + gint num, next, prev, now, w, h; Actor *a1 = NULL, *a2 = NULL; - + GtkImage *image; + GdkPixbuf *pixbuf; struct timeval tvb; suseconds_t ms; long sec; @@ -935,6 +936,15 @@ change_slideshow(Actor *actor, AWallpaperPlugin *desktop_plugin) a2->visible = TRUE; create_hildon_actor(a2, desktop_plugin); set_actor_opacity(a2, 0); + pixbuf = gtk_image_get_pixbuf(a2->image); + w = gdk_pixbuf_get_width(pixbuf); + h = gdk_pixbuf_get_height(pixbuf); + if (w < 800) { + set_actor_position(a2, (800-w)/2, 0, 5, desktop_plugin); + } + if (h < 480){ + set_actor_position(a2, 0, (480-h)/2, 5, desktop_plugin); + } actor->z = next; }else { a2 = g_ptr_array_index(actor->child, next); diff --git a/applet/src/livewp-scene.c b/applet/src/livewp-scene.c index 2113f9b..e800a83 100644 --- a/applet/src/livewp-scene.c +++ b/applet/src/livewp-scene.c @@ -384,7 +384,7 @@ init_scene_Video(AWallpaperPlugin *desktop_plugin) void init_scene_Slideshow(AWallpaperPlugin *desktop_plugin) { - gchar *ext, *file, *str; + gchar *ext, *file, *str, *bgfile; Dirent *dp; DIR *dir_fd; int i; @@ -423,6 +423,13 @@ init_scene_Slideshow(AWallpaperPlugin *desktop_plugin) } closedir(dir_fd); } + + bgfile = g_strdup_printf("/home/user/.backgrounds/background-%i.png", desktop_plugin->priv->view); + actor = init_object(desktop_plugin, "original", bgfile, + 0, 0, 0, 800, 480, + TRUE, TRUE, 100, 255, + NULL, NULL, NULL); + scene->actors = g_slist_append(scene->actors, actor); child = g_ptr_array_sized_new(num); while (store){ -- 1.7.9.5