started done external themes
authortanya <tanyshk@gmail.com>
Mon, 9 Aug 2010 11:41:26 +0000 (14:41 +0300)
committertanya <tanyshk@gmail.com>
Mon, 9 Aug 2010 11:41:26 +0000 (14:41 +0300)
applet/src/Makefile.am
applet/src/livewp-common.h
applet/src/livewp-main.c
applet/src/livewp-scene.c
applet/src/livewp-scene.h

index 418c083..13344eb 100644 (file)
@@ -26,9 +26,9 @@ liblivewp_home_widget_la_SOURCES = livewp-home-widget.c livewp-home-widget.h \
                                   livewp-common.h \
                                   livewp-config.c livewp-config.h \
                                   livewp-dbus.c livewp-dbus.h 
-liblivewp_home_widget_la_LIBADD = $(MAEMO_LIBS) $(OSSO_LIBS)  $(SQLITE_LIBS) 
+liblivewp_home_widget_la_LIBADD = $(MAEMO_LIBS) $(OSSO_LIBS) 
 
-AM_CFLAGS = -Wall $(MAEMO_CFLAGS) $(OSSO_CFLAGS) $(SQLITE_CFLAGS) 
+AM_CFLAGS = -Wall $(MAEMO_CFLAGS) $(OSSO_CFLAGS)  
 
 panellib_LTLIBRARIES =  liblivewp-panel-widget.la
 panellibdir = $(HILDON_PANEL_LIB_DIR)
index 24154f6..4f51813 100644 (file)
@@ -96,7 +96,8 @@ struct _Animation_WallpaperPrivate
     gint xapplet;
     gint yapplet;
     Scene *scene;
-    GHashTable * hash_scene_func;
+    //GHashTable * hash_scene_func;
+    void (*scene_func)(gpointer);
     GKeyFile *config_file;
     gint view;
     pid_t  pid;
@@ -107,6 +108,7 @@ struct _Animation_WallpaperPrivate
     gchar *theme_string_parametr1;
     guint theme_int_parametr1;
     GstElement *pipeline;
+    gchar *exec_path;
     gboolean running;
     GSList *extheme_list;
 };
index ba880b9..1783ab4 100644 (file)
@@ -55,12 +55,7 @@ void
 view_state_changed (Animation_WallpaperPrivate *priv)
 {
    fprintf(stderr," VIew %i State %i\n", priv->view, priv->visible);
-   if (priv->visible){
-       if (!priv->running){
-            if (!strcmp(priv->theme, "Xsnow")){
-                init_scene_Xsnow(priv->desktop_plugin);
-            }
-       }
+   if (priv->visible){       
        if (!strcmp(priv->theme,"Video")){
            if (priv->pipeline){
                gst_element_set_state (priv->pipeline, GST_STATE_PLAYING);
@@ -68,6 +63,11 @@ view_state_changed (Animation_WallpaperPrivate *priv)
                init_scene_Video(priv->desktop_plugin);
            }
        }
+       if (!priv->running){
+            if (priv->exec_path){
+                init_scene_External(priv->desktop_plugin);
+            }
+       }
        if (priv->long_timer == 0 ){
             priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, priv->desktop_plugin);
             run_long_timeout(priv->desktop_plugin);
@@ -134,7 +134,7 @@ quit_from_program (Animation_WallpaperPrivate *priv)
             }
             destroy_scene(priv->desktop_plugin);
          osso_deinitialize(priv->osso);
-         g_hash_table_destroy(priv->hash_scene_func);
+         //g_hash_table_destroy(priv->hash_scene_func);
          g_free(priv->desktop_plugin);
          priv->desktop_plugin = NULL;
          g_free(priv);
@@ -308,18 +308,11 @@ main(int argc, char *argv[])
     
     gtk_widget_show_all(GTK_WIDGET(main_widget));
 
-    priv->hash_scene_func = g_hash_table_new(g_str_hash, g_str_equal);
-    g_hash_table_insert(priv->hash_scene_func, g_strdup("Accel"),  (gpointer)&init_scene_Accel);
-    g_hash_table_insert(priv->hash_scene_func, g_strdup("Berlin"), (gpointer)&init_scene_Berlin);
-    g_hash_table_insert(priv->hash_scene_func, g_strdup("Modern"), (gpointer)&init_scene_Modern);
-    g_hash_table_insert(priv->hash_scene_func, g_strdup("Matrix"), (gpointer)&init_scene_Matrix);
-    g_hash_table_insert(priv->hash_scene_func, g_strdup("Video"),  (gpointer)&init_scene_Video);
-    g_hash_table_insert(priv->hash_scene_func, g_strdup("Xsnow"),  (gpointer)&init_scene_Xsnow);
-
     priv->scene = NULL;
     priv->pipeline = NULL;
     priv->podpid = -1;
     priv->running = FALSE;
+    priv->exec_path = NULL;
     priv->window = main_widget;
     /* fprintf(stderr,"XWINDOW %i\n",GDK_WINDOW_XID (main_widget->window)); */
     priv->desktop_plugin = desktop_plugin;
@@ -332,6 +325,37 @@ main(int argc, char *argv[])
 
     /* 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;
+
+    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->exec_path = g_strdup(g_hash_table_lookup(store->data, "exec_path"));
+            fprintf(stderr, "PATH %s\n",  priv->exec_path);
+            break;
+        }
+        store = g_slist_next(store);
+    }
+#if 0
+    priv->hash_scene_func = g_hash_table_new(g_str_hash, g_str_equal);
+    g_hash_table_insert(priv->hash_scene_func, g_strdup("Accel"),  (gpointer)&init_scene_Accel);
+    g_hash_table_insert(priv->hash_scene_func, g_strdup("Berlin"), (gpointer)&init_scene_Berlin);
+    g_hash_table_insert(priv->hash_scene_func, g_strdup("Modern"), (gpointer)&init_scene_Modern);
+    g_hash_table_insert(priv->hash_scene_func, g_strdup("Matrix"), (gpointer)&init_scene_Matrix);
+    g_hash_table_insert(priv->hash_scene_func, g_strdup("Video"),  (gpointer)&init_scene_Video);
+    g_hash_table_insert(priv->hash_scene_func, g_strdup("Xsnow"),  (gpointer)&init_scene_Xsnow);
+#endif
 
     /* Initialize DBUS */
     livewp_initialize_dbus(priv);
index dca13f0..24c4c84 100644 (file)
@@ -169,9 +169,9 @@ bus_call (GstBus *bus, GstMessage *msg, AWallpaperPlugin *desktop_plugin)
 
 /*******************************************************************************/
 void
-init_scene_Xsnow(AWallpaperPlugin *desktop_plugin){
+init_scene_External(AWallpaperPlugin *desktop_plugin){
     fprintf(stderr,"init_scene_Xsnow\n");
-    char* child_argv[128];
+    char* child_argv[2048];
     char *run_string = NULL;
 #if 0
     fprintf(stderr, "PARAMETR %s\n",  desktop_plugin->priv->theme_string_parametr1);
@@ -180,13 +180,13 @@ init_scene_Xsnow(AWallpaperPlugin *desktop_plugin){
 #endif
     if (!desktop_plugin->priv->visible)
         return;
-    run_string= g_strdup_printf("/usr/bin/xsnow");
+    run_string= g_strdup_printf(desktop_plugin->priv->exec_path);
     parsestring(run_string, child_argv);
 
     desktop_plugin->priv->running = TRUE;
     desktop_plugin->priv->podpid = fork();
     if (desktop_plugin->priv->podpid == 0){
-       execvp("/usr/bin/xsnow", child_argv);
+       execvp(desktop_plugin->priv->exec_path, child_argv);
        fprintf(stderr,"Problem with new podprocess");
     }
     g_free(run_string);
@@ -869,9 +869,16 @@ init_scene_Berlin(AWallpaperPlugin *desktop_plugin)
 void 
 init_scene_theme(AWallpaperPlugin *desktop_plugin)
 {
-    void (*func)(gpointer);
+#if 0
+void (*func)(gpointer);
     func = g_hash_table_lookup(desktop_plugin->priv->hash_scene_func, desktop_plugin->priv->theme);
     if (func){
         (*func)(desktop_plugin);
     }
+#endif
+    fprintf(stderr, "Init_scene_theme\n");
+    if (desktop_plugin->priv->scene_func){
+        fprintf(stderr, "Success init_scene_theme\n");
+        (*desktop_plugin->priv->scene_func)(desktop_plugin);
+    }
 }
index 0423f9c..fe0f6df 100644 (file)
@@ -42,7 +42,7 @@ 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_Xsnow(AWallpaperPlugin *desktop_plugin);
+void init_scene_External(AWallpaperPlugin *desktop_plugin);
 void init_scene_theme(AWallpaperPlugin *desktop_plugin);
 void create_hildon_actor_text(Actor *actor, AWallpaperPlugin *desktop_plugin);