From 5f7efbf8b6d1d6b7c08bada340d856e0762c553d Mon Sep 17 00:00:00 2001 From: tanya Date: Mon, 9 Aug 2010 17:11:23 +0300 Subject: [PATCH] next step in external themes --- applet/data/external_themes/abstractile.xml | 5 +++++ applet/src/livewp-common.h | 2 +- applet/src/livewp-exthemes.c | 3 +++ applet/src/livewp-main.c | 5 ++--- applet/src/livewp-scene.c | 15 +++++++++++++-- 5 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 applet/data/external_themes/abstractile.xml diff --git a/applet/data/external_themes/abstractile.xml b/applet/data/external_themes/abstractile.xml new file mode 100644 index 0000000..c3c073b --- /dev/null +++ b/applet/data/external_themes/abstractile.xml @@ -0,0 +1,5 @@ + + Abstractle + /usr/lib/xscreensaver/abstractile + -window-id + diff --git a/applet/src/livewp-common.h b/applet/src/livewp-common.h index 4f51813..d4500c3 100644 --- a/applet/src/livewp-common.h +++ b/applet/src/livewp-common.h @@ -108,9 +108,9 @@ struct _Animation_WallpaperPrivate gchar *theme_string_parametr1; guint theme_int_parametr1; GstElement *pipeline; - gchar *exec_path; gboolean running; GSList *extheme_list; + GHashTable *hash_theme; }; struct _AWallpaperPlugin diff --git a/applet/src/livewp-exthemes.c b/applet/src/livewp-exthemes.c index 1b58c83..7be9cee 100644 --- a/applet/src/livewp-exthemes.c +++ b/applet/src/livewp-exthemes.c @@ -35,6 +35,9 @@ parse_theme(gchar *file){ first_child = root->children; hash = g_hash_table_new(g_str_hash, g_str_equal); for (node = first_child; node; node = node->next){ + //if (node-type == XML_ELEMENT_NODE && xmlStrcmp(node->name, "param")){ + // child = + //} if (node->type == XML_ELEMENT_NODE){ fprintf(stderr, "%s => %s\n", node->name, xmlNodeGetContent(node)); g_hash_table_insert(hash, g_strdup(node->name), g_strdup(xmlNodeGetContent(node))); diff --git a/applet/src/livewp-main.c b/applet/src/livewp-main.c index 1a84d75..bc9399d 100644 --- a/applet/src/livewp-main.c +++ b/applet/src/livewp-main.c @@ -64,7 +64,7 @@ view_state_changed (Animation_WallpaperPrivate *priv) } } if (!priv->running){ - if (priv->exec_path){ + if (g_hash_table_lookup(priv->hash_theme, "exec_path")){ init_scene_External(priv->desktop_plugin); } } @@ -312,7 +312,6 @@ main(int argc, char *argv[]) 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; @@ -342,7 +341,7 @@ main(int argc, char *argv[]) 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")); + priv->hash_theme = store->data; break; } store = g_slist_next(store); diff --git a/applet/src/livewp-scene.c b/applet/src/livewp-scene.c index f03eb29..24b25df 100644 --- a/applet/src/livewp-scene.c +++ b/applet/src/livewp-scene.c @@ -173,11 +173,22 @@ init_scene_External(AWallpaperPlugin *desktop_plugin){ //fprintf(stderr,"init_scene_Xsnow\n"); char* child_argv[2048]; char *run_string = NULL; + gchar *exec_path = NULL, + *window_id = NULL; if (!desktop_plugin->priv->visible) return; - run_string = g_strdup_printf("%s -window-id %d", desktop_plugin->priv->exec_path, - GDK_WINDOW_XID(desktop_plugin->priv->window->window)); + exec_path = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "exec_path")); + window_id = g_strdup(g_hash_table_lookup(desktop_plugin->priv->hash_theme, "window_id")); + if (!exec_path) + return; + if (window_id){ + run_string = g_strdup_printf("%s %s %d", exec_path, window_id, + GDK_WINDOW_XID(desktop_plugin->priv->window->window)); + }else { + run_string = g_strdup_printf("%s", exec_path); + } + fprintf(stderr, "runs string = %s\n", run_string); parsestring(run_string, child_argv); desktop_plugin->priv->running = TRUE; -- 1.7.9.5