fixed bugs with xscreensavers start/stop
authortanya <tanyshk@gmail.com>
Tue, 10 Aug 2010 09:11:31 +0000 (12:11 +0300)
committertanya <tanyshk@gmail.com>
Tue, 10 Aug 2010 09:11:31 +0000 (12:11 +0300)
applet/src/livewp-config.c
applet/src/livewp-config.h
applet/src/livewp-main.c
applet/src/livewp-scene.c

index 0487672..4f499ce 100644 (file)
@@ -38,6 +38,39 @@ current_active_view(void){
 
     return result;
 }
+
+/*******************************************************************************/
+#ifdef APPLICATION
+void 
+fill_priv(Animation_WallpaperPrivate *priv)
+{
+    /* Load config */
+    read_config(priv);
+    /* Set function */
+    if (!strcmp(priv->theme, "Accel"))
+        priv->scene_func = (gpointer)&init_scene_Accel;
+    if (!strcmp(priv->theme, "Berlin"))
+        priv->scene_func = (gpointer)&init_scene_Berlin;
+    if (!strcmp(priv->theme, "Modern"))
+        priv->scene_func = (gpointer)&init_scene_Modern;
+    if (!strcmp(priv->theme, "Matrix"))
+        priv->scene_func = (gpointer)&init_scene_Matrix;
+    if (!strcmp(priv->theme, "Video"))
+        priv->scene_func = (gpointer)&init_scene_Video;
+    
+    priv->extheme_list = get_list_exthemes();
+    GSList *store = priv->extheme_list;
+    while (store){
+        if (!strcmp(priv->theme, g_hash_table_lookup(store->data, "name"))){
+            priv->scene_func = (gpointer)&init_scene_External;
+            priv->hash_theme = store->data;
+            break;
+        }
+        store = g_slist_next(store);
+    }
+
+}
+#endif
 /*******************************************************************************/
 gint 
 read_config(Animation_WallpaperPrivate *priv) {
index 944baf3..61ea619 100644 (file)
 #define GCONF_KEY_THEME                             GCONF_KEY_PREFIX"/theme"
 #define GCONF_KEY_RANIMATION                        GCONF_KEY_PREFIX"/rich_animation"
 #define GCONF_KEY_ADDIONAL_STRING_1                  GCONF_KEY_PREFIX"/additional_string_1"
+void init_scene_Modern(AWallpaperPlugin *desktop_plugin);
+void init_scene_Berlin(AWallpaperPlugin *desktop_plugin);
+void init_scene_Matrix(AWallpaperPlugin *desktop_plugin);
+void init_scene_Accel(AWallpaperPlugin *desktop_plugin);
+void init_scene_Video(AWallpaperPlugin *desktop_plugin);
+void init_scene_External(AWallpaperPlugin *desktop_plugin);
+void init_scene_theme(AWallpaperPlugin *desktop_plugin);
 gint read_config(Animation_WallpaperPrivate *priv); 
 void save_config(Animation_WallpaperPrivate *priv); 
+void fill_priv(Animation_WallpaperPrivate *priv);
 gint current_active_view(void);
 #endif
index bc9399d..e37c127 100644 (file)
@@ -322,30 +322,8 @@ main(int argc, char *argv[])
     else 
         priv->visible = FALSE;
 
-    /* Load config */
-    read_config(priv);
-    /* Set function */
-    if (!strcmp(priv->theme, "Accel"))
-        priv->scene_func = (gpointer)&init_scene_Accel;
-    if (!strcmp(priv->theme, "Berlin"))
-        priv->scene_func = (gpointer)&init_scene_Berlin;
-    if (!strcmp(priv->theme, "Modern"))
-        priv->scene_func = (gpointer)&init_scene_Modern;
-    if (!strcmp(priv->theme, "Matrix"))
-        priv->scene_func = (gpointer)&init_scene_Matrix;
-    if (!strcmp(priv->theme, "Video"))
-        priv->scene_func = (gpointer)&init_scene_Video;
+    fill_priv(priv);
     
-    priv->extheme_list = get_list_exthemes();
-    GSList *store = priv->extheme_list;
-    while (store){
-        if (!strcmp(priv->theme, g_hash_table_lookup(store->data, "name"))){
-            priv->scene_func = (gpointer)&init_scene_External;
-            priv->hash_theme = store->data;
-            break;
-        }
-        store = g_slist_next(store);
-    }
     /* Initialize DBUS */
     livewp_initialize_dbus(priv);
     set_live_bg(GDK_WINDOW_XDISPLAY (main_widget->window), GDK_WINDOW_XID (main_widget->window), view);
index 24b25df..9ff6cb9 100644 (file)
@@ -27,6 +27,8 @@
 void 
 destroy_scene(AWallpaperPlugin *desktop_plugin)
 {
+    int status = 0;
+     
     if (desktop_plugin->priv->scene){
            GSList * tmp = desktop_plugin->priv->scene->actors;
            while (tmp != NULL){
@@ -47,16 +49,23 @@ destroy_scene(AWallpaperPlugin *desktop_plugin)
         desktop_plugin->priv->pipeline = NULL;
     }
     if (desktop_plugin->priv->podpid > 1){
+        fprintf(stderr, "rrrrrrr\n");
         kill (desktop_plugin->priv->podpid, SIGTERM);
+        while (TRUE){
+            if (wait(&status) == desktop_plugin->priv->podpid) 
+                break;
+        } 
         desktop_plugin->priv->podpid = -1;
+        desktop_plugin->priv->running = FALSE;
     }
 }
 /*******************************************************************************/
 void
 reload_scene(AWallpaperPlugin *desktop_plugin)
 {
-    /* fprintf(stderr,"Reload scene %s\n", desktop_plugin->priv->theme); */
+     fprintf(stderr,"Reload scene %s\n", desktop_plugin->priv->theme); 
     destroy_scene(desktop_plugin);
+    fill_priv(desktop_plugin->priv);
     init_scene_theme(desktop_plugin);
 }
 /*******************************************************************************/