-/*vim: set sw=4 ts=4 et: */
+/* vim: set sw=4 ts=4 et: */
/*
* This file is part of Live Wallpaper (livewp)
*
void
destroy_scene(AWallpaperPlugin *desktop_plugin)
{
- GSList * tmp = desktop_plugin->priv->scene->actors;
- while (tmp != NULL){
- destroy_actor(tmp->data);
- tmp = g_slist_next(tmp);
- }
- g_slist_free(tmp);
- desktop_plugin->priv->scene->actors = NULL;
if (desktop_plugin->priv->scene){
- g_free(desktop_plugin->priv->scene);
- desktop_plugin->priv->scene = NULL;
+ GSList * tmp = desktop_plugin->priv->scene->actors;
+ while (tmp != NULL){
+ destroy_actor(tmp->data);
+ tmp = g_slist_next(tmp);
+ }
+ if (tmp)
+ g_slist_free(tmp);
+ desktop_plugin->priv->scene->actors = NULL;
+ if (desktop_plugin->priv->scene){
+ g_free(desktop_plugin->priv->scene);
+ desktop_plugin->priv->scene = NULL;
+ }
}
}
{
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_Modern(desktop_plugin);
- else if (!strcmp(desktop_plugin->priv->theme,"Berlin"))
- init_scene_Berlin(desktop_plugin);
- else if (!strcmp(desktop_plugin->priv->theme,"Matrix"))
- init_scene_Matrix(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
y2 = -480;
}
- fprintf(stderr, "init scene2 \n");
+ /* fprintf(stderr, "init scene2 \n"); */
scene = g_new0(Scene, 1);
//scene.daytime = get_daytime();
scene->actors = NULL;
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,
TRUE , TRUE, 100, 255,
(gpointer)&change_static_actor, NULL, NULL);
- change_static_actor(actor, desktop_plugin);
scene->actors = g_slist_append(scene->actors, actor);
+ change_static_actor(actor, desktop_plugin);
actor = init_object(desktop_plugin, "sun", "sun.png",
0, 0, 6, 88, 88,
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,
- TRUE, FALSE, 100, 255,
- (gpointer)&change_billboard, NULL, NULL);
+ 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);