added select file into dialog
[livewp] / applet / src / livewp-scene.c
index e0a8f11..ffd4abe 100644 (file)
@@ -7,8 +7,8 @@
  *       for the code
  * 
  * This software is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2 of
  * the License, or (at your option) any later version.
  * 
  * This software is distributed in the hope that it will be useful, but
@@ -38,7 +38,7 @@ Window Window_With_Name( Display *dpy, Window top, char *name)
     if (class_hint->res_name && name && !strcmp(class_hint->res_name, name)){
       XFree(class_hint->res_class);
       XFree(class_hint->res_name);
-           return(top);
+      return(top);
     }
     XFree(class_hint->res_class);
     XFree(class_hint->res_name);
@@ -98,9 +98,13 @@ destroy_scene(AWallpaperPlugin *desktop_plugin)
 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);
+    gtk_widget_destroy(desktop_plugin->priv->window); 
+    if (desktop_plugin->priv->one_in_all_view && desktop_plugin->priv->view >1)
+        exit(-1);   
+    create_xwindow(desktop_plugin->priv);
     init_scene_theme(desktop_plugin);
 }
 /*******************************************************************************/
@@ -223,8 +227,13 @@ init_scene_External(AWallpaperPlugin *desktop_plugin){
         *window_id = NULL,
         *window_name = NULL,
         *view = NULL,
+        *gtk_socket_id = NULL,
         *strwin = NULL,
-        *strview =NULL;
+        *strsocket = NULL,
+        *addedstring = NULL,
+        *theme_string_parametr1 = NULL,
+        *straddedstring = NULL,
+        *strview = NULL;
     gint i;
     Window  id_xwindow;
     if (!desktop_plugin->priv->visible)
@@ -234,19 +243,35 @@ init_scene_External(AWallpaperPlugin *desktop_plugin){
     window_id = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "window_id"));
     view = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "view"));
     window_name = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "window_name"));
+    gtk_socket_id =  g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "gtk_socket_id"));
+    addedstring =  g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "added_string"));
     if (!exec_path) 
         return;
     if (window_id){
         strwin = g_strdup_printf(" %s %i", window_id, (gint)GDK_WINDOW_XID(desktop_plugin->priv->window->window));
     }else
         strwin = "";
+    if (gtk_socket_id){
+        strsocket = g_strdup_printf(" %s %i", gtk_socket_id, (int)gtk_socket_get_id (GTK_SOCKET (desktop_plugin->priv->video_socket)));
+    }else
+        strsocket = "";
 
     if (view){
         strview = g_strdup_printf(" %s %i", view, desktop_plugin->priv->view);
     }else
         strview = "";
 
-    run_string = g_strdup_printf("%s%s%s", exec_path, strwin, strview);
+    if (addedstring){
+        straddedstring = g_strdup_printf(" %s", addedstring);
+    }else
+        straddedstring = "";
+
+    if (desktop_plugin->priv->theme_string_parametr1){
+        theme_string_parametr1 = g_strdup_printf(" %s", desktop_plugin->priv->theme_string_parametr1);
+    }else
+        theme_string_parametr1 = "";
+
+    run_string = g_strdup_printf("%s%s%s%s%s%s", exec_path, strwin, strview, strsocket, straddedstring, theme_string_parametr1);
     fprintf(stderr, "runs string = %s\n", run_string);
     parsestring(run_string, child_argv);
 
@@ -257,6 +282,8 @@ init_scene_External(AWallpaperPlugin *desktop_plugin){
        fprintf(stderr,"Problem with new podprocess");
     }
     g_free(run_string);
+
+    fprintf(stderr, "window name = %s\n", window_name);
     if (window_name){
         /* Do 10 trying to search of window */
         for (i=0; i<10; i++){
@@ -266,7 +293,13 @@ init_scene_External(AWallpaperPlugin *desktop_plugin){
                 window_name);
             fprintf(stderr,"name %s %i %i\n", window_name, id_xwindow, i);
             if (id_xwindow>0){
-                set_live_bg (GDK_WINDOW_XDISPLAY (desktop_plugin->priv->window->window),  id_xwindow, desktop_plugin->priv->view);
+                if (desktop_plugin->priv->one_in_all_view)
+                    set_live_bg (GDK_WINDOW_XDISPLAY (desktop_plugin->priv->window->window), 
+                                                      id_xwindow, -1);
+                else
+                    set_live_bg (GDK_WINDOW_XDISPLAY (desktop_plugin->priv->window->window),  
+                                                      id_xwindow, desktop_plugin->priv->view);
+                /* gtk_widget_destroy(desktop_plugin->priv->window); */
                 break;
             }
         }