-/*vim: set sw=4 ts=4 et: */
+/* vim: set sw=4 ts=4 et: */
/*
* This file is part of Live Wallpaper (livewp)
*
{
fprintf(stderr,"Reload scene %s\n", desktop_plugin->priv->theme);
destroy_scene(desktop_plugin);
+ init_scene_theme(desktop_plugin);
+}
+
+void
+parsestring(char *line, char **argv)
+{
+ while (*line != '\0') {
+ while (*line == ' ' || *line == '\n')
+ *line++ = '\0'; /* replace white spaces with 0 */
+ *argv++ = line; /* save the argument position */
+ while (*line != '\0' && *line != ' ' &&
+ *line != '\n')
+ line++; /* skip the argument until ... */
+ }
+ *argv = '\0'; /* mark the end of argument list */
+}
+
#if 0
- if (!strcmp(desktop_plugin->priv->theme,"Modern"))
- init_scene(desktop_plugin);
- else if (!strcmp(desktop_plugin->priv->theme,"Berlin"))
- init_scene1(desktop_plugin);
- else if (!strcmp(desktop_plugin->priv->theme,"Matrix"))
- init_scene2(desktop_plugin);
+GstBusSyncReply
+sync_handler(GstBus *bus, GstMessage *message, AWallpaperPlugin *desktop_plugin){
+
+ if (!desktop_plugin->priv->visible)
+ gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_PAUSED);
+ if (GST_MESSAGE_TYPE(message) != GST_MESSAGE_ELEMENT){
+ return (GST_BUS_PASS);
+ }
+ if (!gst_structure_has_name(message->structure, "prepare-xwindow-id")){
+ return (GST_BUS_PASS);
+ }
+ return (GST_BUS_DROP);
+
+}
#endif
- init_scene_theme(desktop_plugin);
+void
+init_scene_Video(AWallpaperPlugin *desktop_plugin)
+{
+ GstElement *bin;
+ GstElement *videosink;
+ GstFormat format;
+ gchar *file_plus_uri;
+
+
+ desktop_plugin->priv->pipeline= gst_pipeline_new("gst-player");
+ bin = gst_element_factory_make ("playbin2", "bin");
+ videosink = gst_element_factory_make ("ximagesink", "videosink");
+ g_object_set (G_OBJECT (bin), "video-sink", videosink, NULL);
+ gst_bin_add (GST_BIN (desktop_plugin->priv->pipeline), bin);
+
+ {
+ GstBus *bus;
+ bus = gst_pipeline_get_bus (GST_PIPELINE (desktop_plugin->priv->pipeline));
+// gst_bus_add_watch(bus, bus_call, NULL);
+ gst_object_unref (bus);
+ }
+ file_plus_uri = g_strdup_printf("file://%s",desktop_plugin->priv->theme_string_parametr1);
+ g_object_set (G_OBJECT (bin), "uri", file_plus_uri, NULL );
+ g_object_set (G_OBJECT (videosink), "force-aspect-ratio", TRUE, NULL );
+ if (GST_IS_X_OVERLAY (videosink))
+ gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (videosink), GDK_DRAWABLE_XID(desktop_plugin->priv->window->window));
+ if (desktop_plugin->priv->visible)
+ gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_PLAYING);
}
void
-init_scene2(AWallpaperPlugin *desktop_plugin)
+init_scene_Matrix(AWallpaperPlugin *desktop_plugin)
{
Actor *actor;
Scene *scene;
y2 = -480;
}
- fprintf(stderr, "init scene2 \n");
+ /* fprintf(stderr, "init scene2 \n"); */
scene = g_new0(Scene, 1);
//scene.daytime = get_daytime();
scene->actors = NULL;
/* Init Modern Scene */
void
-init_scene(AWallpaperPlugin *desktop_plugin)
+init_scene_Modern(AWallpaperPlugin *desktop_plugin)
{
Actor *actor;
Scene *scene;
gint now = time(NULL);
gint i;
gint winds[13][2];
+ GPtrArray *child;
- //fprintf(stderr, "init scene \n");
+ /* fprintf(stderr, "init scene \n"); */
scene = g_new0(Scene, 1);
scene->daytime = get_daytime();
scene->actors = NULL;
scene->wind_angle = 0.3;
/* init value for random */
scene->seed = time(NULL);
+ scene->notification = TRUE;
desktop_plugin->priv->scene = scene;
actor = init_object(desktop_plugin, "sky", "sky0.png",
0, 0, 5, 800, 480,
scene->actors = g_slist_append(scene->actors, actor);
actor = init_object(desktop_plugin, "stend", "stend0.png",
- 482, 146, 9, 300, 305,
+ 452, 166, 9, 300, 305,
TRUE, TRUE, 100, 255,
(gpointer)&change_static_actor, NULL, NULL);
change_static_actor(actor, desktop_plugin);
scene->actors = g_slist_append(scene->actors, actor);
+
+ child = g_ptr_array_sized_new(4);
+ actor = init_object(desktop_plugin, "call", "call.png",
+ 480, 190, 9, 50, 58,
+ FALSE, TRUE, 100, 255,
+ NULL, NULL, NULL);
+ scene->actors = g_slist_append(scene->actors, actor);
+ g_ptr_array_add(child, actor);
+
+ actor = init_object(desktop_plugin, "chat", "chat.png",
+ 540, 190, 9, 50, 58,
+ FALSE, TRUE, 100, 255,
+ NULL, NULL, NULL);
+ scene->actors = g_slist_append(scene->actors, actor);
+ g_ptr_array_add(child, actor);
+
+ actor = init_object(desktop_plugin, "mail", "mail.png",
+ 600, 190, 9, 50, 58,
+ FALSE, TRUE, 100, 255,
+ NULL, NULL, NULL);
+ scene->actors = g_slist_append(scene->actors, actor);
+ g_ptr_array_add(child, actor);
+
+ actor = init_object(desktop_plugin, "sms", "sms.png",
+ 660, 190, 9, 50, 58,
+ FALSE, TRUE, 100, 255,
+ NULL, NULL, NULL);
+ scene->actors = g_slist_append(scene->actors, actor);
+ g_ptr_array_add(child, actor);
+
+ actor = init_object(desktop_plugin, "billboard_text", "",
+ 470, 174, 9, 300, 108,
+ FALSE, FALSE, 100, 255,
+ (gpointer)&change_billboard, NULL, child);
+ create_hildon_actor_text(actor, desktop_plugin);
+ //actor->time_start_animation = time(NULL) + 20;
+ change_billboard(actor, desktop_plugin);
+ scene->actors = g_slist_append(scene->actors, actor);
+
actor = init_object(desktop_plugin, "tram", "tram.png",
-300, 225, 10, 350, 210,
FALSE, FALSE, 100, 255,
/* Init Berlin Scene */
void
-init_scene1(AWallpaperPlugin *desktop_plugin)
+init_scene_Berlin(AWallpaperPlugin *desktop_plugin)
{
Actor *actor, *actor1, *actor2;
Scene *scene;
void
init_scene_theme(AWallpaperPlugin *desktop_plugin)
{
- GHashTable * hash;
void (*func)(gpointer);
- hash = g_hash_table_new(g_str_hash, g_str_equal);
-
- g_hash_table_insert(hash, g_strdup("Berlin"), (gpointer)&init_scene1);
- g_hash_table_insert(hash, g_strdup("Modern"), (gpointer)&init_scene);
- g_hash_table_insert(hash, g_strdup("Matrix"), (gpointer)&init_scene2);
-
- func = g_hash_table_lookup(hash, desktop_plugin->priv->theme);
+ func = g_hash_table_lookup(desktop_plugin->priv->hash_scene_func, desktop_plugin->priv->theme);
if (func){
(*func)(desktop_plugin);
}