done in slideshow background and centered images
authortanya <tanya@moshkanov.oblgaz>
Mon, 4 Oct 2010 19:22:52 +0000 (22:22 +0300)
committertanya <tanya@moshkanov.oblgaz>
Mon, 4 Oct 2010 19:22:52 +0000 (22:22 +0300)
applet/src/livewp-actor.c
applet/src/livewp-scene.c

index 8d468f1..0bb4522 100644 (file)
@@ -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);
index 2113f9b..e800a83 100644 (file)
@@ -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){