* 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
/*******************************************************************************/
#include "livewp-common.h"
#include "livewp-home-widget.h"
-#include "livewp-actor.h"
#include <gconf/gconf-client.h>
#include "livewp-rules.h"
+#include "livewp-scene.h"
#include <sys/time.h>
#include <stdlib.h>
+#include <unistd.h>
+#include <sys/wait.h>
-#define PLUGIN_NAME "livewp-home-widget.desktop-0"
-#define GCONF_KEY_POSITION "/apps/osso/hildon-desktop/applets/%s/position"
-#define GCONF_KEY_MODIFIED "/apps/osso/hildon-desktop/applets/%s/modified"
-#define GCONF_KEY_VIEW "/apps/osso/hildon-desktop/applets/%s/view"
+#define GCONF_KEY_POSITION "/apps/osso/hildon-desktop/applets/livewp-home-widget.desktop-%i/position"
+#define GCONF_KEY_MODIFIED "/apps/osso/hildon-desktop/applets/livewp-home-widget.desktop-%i/modified"
+#define GCONF_KEY_VIEW "/apps/osso/hildon-desktop/applets/livewp-home-widget.desktop-%i/view"
HD_DEFINE_PLUGIN_MODULE (AWallpaperPlugin, animation_wallpaper_plugin, HD_TYPE_HOME_PLUGIN_ITEM)
#define Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE (obj,\
Animation_Wallpaper_TYPE_HOME_PLUGIN,\
Animation_WallpaperPrivate))
-
-/* Position of plugin on desktop */
-#define Xstartposition 700
-#define Ystartposition 448
-
-//gint xapplet = 0, yapplet = 0;
-
static void
lw_applet_realize (GtkWidget *widget)
{
- GdkScreen *screen;
-
- screen = gtk_widget_get_screen (widget);
- gtk_widget_set_colormap (widget,
- gdk_screen_get_rgba_colormap (screen));
- gtk_widget_set_app_paintable (widget,
- TRUE);
- GTK_WIDGET_CLASS (animation_wallpaper_plugin_parent_class)->realize (widget);
-}
-
-
-static gboolean
-lw_applet_expose_event(GtkWidget *widget,
- GdkEventExpose *event)
-{
- cairo_t *cr;
-
- /* Create cairo context */
- cr = gdk_cairo_create (GDK_DRAWABLE (widget->window));
- gdk_cairo_region (cr, event->region);
- cairo_clip (cr);
+ GdkScreen *screen;
+ gchar * strid;
+ gint id;
+ AWallpaperPlugin *desktop_plugin = (AWallpaperPlugin *)widget;
+ char* child_argv[] = {"/usr/bin/livewp", "0", (char *) 0 };
- /* Draw alpha background */
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.0);
- cairo_paint (cr);
- /* Free context */
- cairo_destroy (cr);
+ strid = g_strdup(hd_plugin_item_get_plugin_id (HD_PLUGIN_ITEM (widget)));
- return GTK_WIDGET_CLASS (animation_wallpaper_plugin_parent_class)->expose_event (widget,
- event);
-}
+ id = strid[strlen(strid)-1] - '0';
+ desktop_plugin->priv->view = id;
+ g_free(strid);
+
-static gboolean
-expose_event (GtkWidget *widget,GdkEventExpose *event,
- gpointer data)
-{
- cairo_t *cr;
- GdkPixbuf *pixbuf = (GdkPixbuf *) data;
-
- cr = gdk_cairo_create(widget->window);
- if (cr){
- gdk_cairo_region(cr, event->region);
- cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
- gdk_cairo_set_source_pixbuf(cr, pixbuf, 0.0, 0.0);
- cairo_paint(cr);
- cairo_destroy(cr);
+ switch (id){
+ case 0: child_argv[1] = "1";
+ break;
+ case 1: child_argv[1] = "2";
+ break;
+ case 2: child_argv[1] = "3";
+ break;
+ case 3: child_argv[1] = "4";
+ break;
+ }
+ desktop_plugin->priv->one_in_all_view = get_one_in_all_views_from_config();
+ /* Check one theme in all view mode */
+ if (!desktop_plugin->priv->one_in_all_view ||
+ (desktop_plugin->priv->one_in_all_view && id == 0)){
+ /* Start a new process */
+ desktop_plugin->priv->pid = fork();
+ if (desktop_plugin->priv->pid == 0){
+ execvp("/usr/bin/livewp", child_argv);
+ fprintf(stderr,"Problem with new process");
+ }
}
- return TRUE;
-}
-static void
-realize (GtkWidget *widget)
-{
- GdkScreen *screen;
+ desktop_plugin_visible_notify((GObject *)widget, NULL, desktop_plugin);
+
screen = gtk_widget_get_screen (widget);
- gtk_widget_set_colormap (widget, gdk_screen_get_rgba_colormap (screen));
+ gtk_widget_set_colormap (widget,
+ gdk_screen_get_rgba_colormap (screen));
+ gtk_widget_set_app_paintable (widget,
+ TRUE);
+ GTK_WIDGET_CLASS (animation_wallpaper_plugin_parent_class)->realize (widget);
}
/* Set position of widget on desktop */
gchar *modified_key;
gchar *modified;
GError *error = NULL;
+ gint i;
GConfClient *gconf_client = gconf_client_get_default ();
- position_key = g_strdup_printf (GCONF_KEY_POSITION, PLUGIN_NAME);
- position = gconf_client_get_list (gconf_client,
- position_key,
- GCONF_VALUE_INT,
- NULL);
- if (position && position->data && position->next->data){
- *xapplet = GPOINTER_TO_INT (position->data);
- *yapplet = GPOINTER_TO_INT (position->next->data);
- }else{
- position = g_slist_prepend (g_slist_prepend (NULL,
- GINT_TO_POINTER (Ystartposition)),
- GINT_TO_POINTER (Xstartposition));
- gconf_client_set_list (gconf_client,
- position_key,
- GCONF_VALUE_INT,
- position,
- &error);
- *xapplet = Xstartposition;
- *yapplet = Ystartposition;
+ for (i=0;i<4;i++){
+ position_key = g_strdup_printf (GCONF_KEY_POSITION, i);
+ position = gconf_client_get_list (gconf_client,
+ position_key,
+ GCONF_VALUE_INT,
+ NULL);
+ if (position && position->data && position->next->data){
+ *xapplet = GPOINTER_TO_INT (position->data);
+ *yapplet = GPOINTER_TO_INT (position->next->data);
+ }else{
+ position = g_slist_prepend (g_slist_prepend (NULL,
+ GINT_TO_POINTER (Ystartposition)),
+ GINT_TO_POINTER (Xstartposition));
+ gconf_client_set_list (gconf_client,
+ position_key,
+ GCONF_VALUE_INT,
+ position,
+ &error);
+ *xapplet = Xstartposition;
+ *yapplet = Ystartposition;
+ }
+ g_free (position_key);
+ modified = g_strdup_printf ("%i", 0);
+ modified_key = g_strdup_printf (GCONF_KEY_MODIFIED, i);
+ gconf_client_set_string (gconf_client,
+ modified_key,
+ modified,
+ &error);
+ g_free(modified);
+ g_free(modified_key);
+ modified_key = g_strdup_printf (GCONF_KEY_VIEW, i);
+ gconf_client_set_int (gconf_client,
+ modified_key,
+ (i+1),
+ &error);
+ g_free(modified_key);
+
}
- g_free (position_key);
- modified = g_strdup_printf ("%i", 0);
- modified_key = g_strdup_printf (GCONF_KEY_MODIFIED, PLUGIN_NAME);
- gconf_client_set_string (gconf_client,
- modified_key,
- modified,
- &error);
- g_free(modified);
- g_free(modified_key);
gconf_client_clear_cache(gconf_client);
g_object_unref(gconf_client);
}
void
-actor_set_position_full(GtkWidget *actor, gint x, gint y, gint z)
-{
-/* fprintf(stderr, "actor_set_position_full z=%d\n", z); */
- hildon_animation_actor_set_position_full (HILDON_ANIMATION_ACTOR (actor),x-0, y-0, z);
-}
-
-
-void
-destroy_hildon_actor(Actor *actor)
-{
- //fprintf(stderr, "destroy_hildon_actor %s\n",actor->name);
- gtk_widget_destroy(actor->widget);
- actor->widget = NULL;
-}
-
-
-gint
-rnd(gint max)
-{
- srand(time(NULL));
- return rand() % max;
-}
-gint fast_rnd(gint max)
-{
- guint offset = 12923;
- guint multiplier = 4079;
-
- //*seed = *seed * multiplier + offset;
- //return (gint)(*seed % max);
- guint seed = time(NULL);
- return (gint)(seed % max);
-}
-
-void
-create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
-{
- GtkWidget *ha = NULL;
- GdkPixbuf *pixbuf = NULL;
- GtkWidget *image = NULL;
- gchar *str = NULL;
-
- ha = hildon_animation_actor_new();
- str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
- desktop_plugin->priv->theme, actor->filename);
- pixbuf = gdk_pixbuf_new_from_file_at_size (str,
- actor->width,
- actor->height,
- NULL);
- /*fprintf(stderr, "create_hildon_actor %s %s\n", actor->name, str);*/
- if (str)
- g_free(str);
- if (pixbuf){
- image = gtk_image_new_from_pixbuf (pixbuf);
- g_object_unref(G_OBJECT(pixbuf));
- }
- if (image){
- g_signal_connect(G_OBJECT(image), "expose_event",
- G_CALLBACK(expose_event), pixbuf);
- gtk_container_add (GTK_CONTAINER (ha), image);
- }
- //actor_set_position_full(ha, actor->x, actor->y, actor->z);
- //hildon_animation_actor_set_scale(HILDON_ANIMATION_ACTOR(ha), (double)actor->scale/100, (double)actor->scale/100);
- realize(ha);
- gtk_widget_show_all(ha);
- //hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(ha), actor->visible);
-
- /* TO DO check it */
- /* gdk_flush (); */
-
- g_object_set_data(G_OBJECT(ha), "image", image);
- hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), GTK_WINDOW(desktop_plugin));
- actor->widget = ha;
- set_actor_position(actor, actor->x, actor->y, actor->z, desktop_plugin);
- set_actor_scale(actor, (double)actor->scale/100, (double)actor->scale/100);
- set_actor_visible(actor, actor->visible);
-}
-
-
-void
-change_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
-{
- GtkWidget *image = NULL;
- GdkPixbuf *pixbuf = NULL;
- gchar *str = NULL;
-
- str = g_strdup_printf( "%s/%s/%s", THEME_PATH,
- desktop_plugin->priv->theme, actor->filename);
-
- pixbuf = gdk_pixbuf_new_from_file_at_size (str,
- actor->width,
- actor->height,
- NULL);
- if(str)
- g_free(str);
- if (pixbuf){
- image = gtk_image_new_from_pixbuf (pixbuf);
- g_object_unref(G_OBJECT(pixbuf));
- }
- if (image){
- g_signal_connect(G_OBJECT(image), "expose_event",
- G_CALLBACK(expose_event), pixbuf);
- if (g_object_get_data(G_OBJECT(actor->widget), "image")){
- gtk_container_remove(GTK_CONTAINER(actor->widget), g_object_get_data(G_OBJECT(actor->widget), "image"));
- }
- g_object_set_data(G_OBJECT(actor->widget), "image", image);
- gtk_container_add (GTK_CONTAINER (actor->widget), image);
- realize(actor->widget);
- gtk_widget_show_all(actor->widget);
- /* TO DO check it */
- /* gdk_flush (); */
-
-
- }
-
-}
-
-
-
-/*
-static gint
-get_time(gint t){
- // уравнение изменения времени
- return t*1.1;
-}
-*/
-static 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);
-
-}
-
-void
-reload_scene(AWallpaperPlugin *desktop_plugin)
-{
- fprintf(stderr,"Reload scene %s\n", desktop_plugin->priv->theme);
- destroy_scene(desktop_plugin);
- 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);
-}
-
-static void
-init_scene2(AWallpaperPlugin *desktop_plugin)
-{
- Actor *actor;
- Scene *scene;
- GPtrArray *child;
- gint now = time(NULL);
- gint y1, y2;
-
- if (desktop_plugin->priv->rich_animation){
- y1 = -480;
- y2 = -480-480;
- }else {
- y1 = 0;
- y2 = -480;
- }
-
- fprintf(stderr, "init scene2 \n");
- scene = g_new0(Scene, 1);
- //scene.daytime = get_daytime();
- scene->actors = NULL;
- desktop_plugin->priv->scene = scene;
-
- actor = init_object(desktop_plugin, "background", "bg.png",
- 0, 0, 5, 800, 480,
- TRUE, TRUE, 100, 255,
- NULL, NULL, NULL);
- scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "symbols", "symbols.png",
- 0, 0, 10, 800, 480,
- TRUE, TRUE, 100, 255,
- NULL, NULL, NULL);
- scene->actors = g_slist_append(scene->actors, actor);
-
- child = g_ptr_array_sized_new(4);
- actor = init_object(desktop_plugin, "layer1", "layer1_2.png",
- 0, y1, 6, 800, 960,
- TRUE, TRUE, 100, 255,
- NULL, NULL, NULL);
- //actor->time_start_animation = now;
- //actor->duration_animation = G_MAXINT;
- scene->actors = g_slist_append(scene->actors, actor);
- g_ptr_array_add(child, actor);
-
- actor = init_object(desktop_plugin, "layer1", "layer1_1.png",
- 0, y2, 7, 800, 960,
- TRUE, TRUE, 100, 255,
- NULL, NULL, NULL);
- //actor->time_start_animation = now;
- //actor->duration_animation = G_MAXINT;
- scene->actors = g_slist_append(scene->actors, actor);
- g_ptr_array_add(child, actor);
-
- actor = init_object(desktop_plugin, "layer2", "layer2_2.png",
- 0, y1, 8, 800, 960,
- TRUE, TRUE, 100, 255,
- NULL, NULL, NULL);
- //actor->time_start_animation = now;
- //actor->duration_animation = G_MAXINT;
- scene->actors = g_slist_append(scene->actors, actor);
- g_ptr_array_add(child, actor);
-
- actor = init_object(desktop_plugin, "layer2", "layer2_1.png",
- 0, y2, 9, 800, 960,
- TRUE, TRUE, 100, 255,
- NULL, NULL, NULL);
- //actor->time_start_animation = now;
- //actor->duration_animation = G_MAXINT;
- scene->actors = g_slist_append(scene->actors, actor);
- g_ptr_array_add(child, actor);
-
- actor = init_object(desktop_plugin, "layers", "",
- 0, y2, 9, 800, 960,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_layer, NULL, child);
- actor->time_start_animation = now;
- actor->duration_animation = G_MAXINT;
- scene->actors = g_slist_append(scene->actors, actor);
-
- run_long_timeout(desktop_plugin);
-
-}
-
-/* Init Modern Scene */
-static void
-init_scene(AWallpaperPlugin *desktop_plugin)
-{
- Actor *actor;
- Scene *scene;
- gint now = time(NULL);
- gint i;
- gint winds[13][2];
-
- //fprintf(stderr, "init scene \n");
- scene = g_new0(Scene, 1);
- scene->daytime = get_daytime();
- scene->actors = NULL;
- scene->wind_orientation = -1;
- scene->wind_angle = 0.3;
- /* init value for random */
- scene->seed = time(NULL);
- 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);
-
- actor = init_object(desktop_plugin, "sun", "sun.png",
- 0, 0, 6, 88, 88,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_sun, NULL, NULL);
- actor->time_start_animation = now;
- actor->duration_animation = G_MAXINT;
- change_sun(actor, desktop_plugin);
- scene->actors = g_slist_append(scene->actors, actor);
-
- //actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50,
- // TRUE, 100, 255, NULL, NULL);
- //scene.actors = g_slist_append(scene.actors, actor);
-
- actor = init_object(desktop_plugin, "cloud1", "cloud1.png",
- 0, fast_rnd(300)-97, 7, 150, 97,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_cloud, NULL, NULL);
- actor->time_start_animation = now + fast_rnd(20);
- actor->duration_animation = 3*60;
- scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "cloud2", "cloud2.png",
- 0, fast_rnd(300)-75, 7, 188, 75,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_cloud, NULL, NULL);
- actor->time_start_animation = now + fast_rnd(40)+10;
- actor->duration_animation = 3*60;
- scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "cloud4", "cloud4.png",
- 0, fast_rnd(300)-75, 7, 150, 75,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_cloud, NULL, NULL);
- actor->time_start_animation = now + fast_rnd(60) + 20;
- actor->duration_animation = 5*60;
- scene->actors = g_slist_append(scene->actors, actor);
-
-
- actor = init_object(desktop_plugin, "town", "town0.png",
- 0, 0, 8, 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);
-
- actor = init_object(desktop_plugin, "stend", "stend0.png",
- 482, 146, 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);
-
- actor = init_object(desktop_plugin, "tram", "tram.png",
- -300, 225, 10, 350, 210,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_tram, NULL, NULL);
- actor->time_start_animation = time(NULL) + fast_rnd(10);
- actor->duration_animation = 60;
- scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "border", "border0.png",
- 0, 480-79, 11, 800, 79,
- TRUE, TRUE, 100, 255,
- (gpointer)&change_static_actor_with_corner, NULL, NULL);
- change_static_actor_with_corner(actor, desktop_plugin);
- scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "moon", "moon1.png",
- 400, 20, 6, 60, 60,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_moon, NULL, NULL);
- change_moon(actor, desktop_plugin);
- scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "wind", "",
- 0, 0, 5, 0, 0,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_wind, NULL, NULL);
- change_wind(actor, desktop_plugin);
- scene->actors = g_slist_append(scene->actors, actor);
-
- /* windows in 4-th house */
-
- winds[0][0] = 482;
- winds[0][1] = 180;
-
- winds[1][0] = 495;
- winds[1][1] = 179;
-
- winds[2][0] = 482;
- winds[2][1] = 191;
-
- winds[3][0] = 495;
- winds[3][1] = 190;
-
- winds[4][0] = 482;
- winds[4][1] = 201;
-
- winds[5][0] = 495;
- winds[5][1] = 210;
-
- winds[6][0] = 482;
- winds[6][1] = 222;
-
- winds[7][0] = 495;
- winds[7][1] = 221;
-
- winds[8][0] = 459;
- winds[8][1] = 203;
-
- winds[9][0] = 495;
- winds[9][1] = 241;
-
- winds[10][0] = 495;
- winds[10][1] = 252;
-
- winds[11][0] = 482;
- winds[11][1] = 273;
-
- winds[12][0] = 495;
- winds[12][1] = 303;
- for (i=0; i<13; i++){
- actor = init_object(desktop_plugin, "window1", "window1.png",
- winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_window1, NULL, NULL);
- //change_window1(actor, desktop_plugin);
- actor->time_start_animation = now + fast_rnd(30);
- scene->actors = g_slist_append(scene->actors, actor);
-
- }
-
- /* windows in 1-th house */
-
- winds[0][0] = 86;
- winds[0][1] = 321;
-
- winds[1][0] = 86;
- winds[1][1] = 363;
-
- winds[2][0] = 86;
- winds[2][1] = 385;
-
- winds[3][0] = 86;
- winds[3][1] = 286;
-
- winds[4][0] = 94;
- winds[4][1] = 232;
-
- winds[5][0] = 94;
- winds[5][1] = 243;
-
- winds[6][0] = 94;
- winds[6][1] = 265;
-
- winds[7][0] = 94;
- winds[7][1] = 331;
- for (i=0; i<8; i++){
- actor = init_object(desktop_plugin, "window2", "window2.png",
- winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_window1, NULL, NULL);
- //change_window1(actor, desktop_plugin);
- actor->time_start_animation = now + fast_rnd(30);
- scene->actors = g_slist_append(scene->actors, actor);
-
- }
-
- /* windows in 3-th house */
-
- winds[0][0] = 251;
- winds[0][1] = 162;
-
- winds[1][0] = 251;
- winds[1][1] = 196;
-
- winds[2][0] = 251;
- winds[2][1] = 278;
-
- winds[3][0] = 251;
- winds[3][1] = 289;
-
- winds[4][0] = 313;
- winds[4][1] = 173;
-
- winds[5][0] = 322;
- winds[5][1] = 160;
-
- winds[6][0] = 303;
- winds[6][1] = 217;
-
- winds[7][0] = 322;
- winds[7][1] = 224;
-
- winds[8][0] = 323;
- winds[8][1] = 217;
-
- winds[9][0] = 322;
- winds[9][1] = 288;
-
- for (i=0; i<10; i++){
- actor = init_object(desktop_plugin, "window3", "window3.png",
- winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_window1, NULL, NULL);
- //change_window1(actor, desktop_plugin);
- actor->time_start_animation = now + fast_rnd(30);
- scene->actors = g_slist_append(scene->actors, actor);
-
- }
-
- /* windows in 5-th house */
-
- winds[0][0] = 610;
- winds[0][1] = 224;
-
- winds[1][0] = 602;
- winds[1][1] = 245;
-
- winds[2][0] = 602;
- winds[2][1] = 264;
-
- winds[3][0] = 610;
- winds[3][1] = 301;
-
- winds[4][0] = 610;
- winds[4][1] = 320;
-
- winds[5][0] = 593;
- winds[5][1] = 352;
-
- winds[6][0] = 610;
- winds[6][1] = 368;
-
- for (i=0; i<7; i++){
- actor = init_object(desktop_plugin, "window4", "window4.png",
- winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_window1, NULL, NULL);
- //change_window1(actor, desktop_plugin);
- actor->time_start_animation = now + fast_rnd(30);
- scene->actors = g_slist_append(scene->actors, actor);
-
- }
-
- /* windows in 6-th house */
-
- winds[0][0] = 717;
- winds[0][1] = 283;
-
- winds[1][0] = 698;
- winds[1][1] = 293;
-
- winds[2][0] = 717;
- winds[2][1] = 315;
-
- winds[3][0] = 717;
- winds[3][1] = 323;
-
- winds[4][0] = 698;
- winds[4][1] = 362;
-
- winds[5][0] = 698;
- winds[5][1] = 400;
-
- for (i=0; i<6; i++){
- actor = init_object(desktop_plugin, "window5", "window5.png",
- winds[i][0], winds[i][1], 8, 8, 10,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_window1, NULL, NULL);
- //change_window1(actor, desktop_plugin);
- actor->time_start_animation = now + fast_rnd(30);
- scene->actors = g_slist_append(scene->actors, actor);
-
- }
- run_long_timeout(desktop_plugin);
-
-#if 0
- anim = g_new0(Animation, 1);
- anim->count = 1;
- anim->actor = actor;
- anim->func_change = &change_tram;
- anim->func_time = NULL;
- anim->timestart = time(NULL);
- anim->timeall = 10;
-
- scene.dynamic_actors = g_slist_append(scene.dynamic_actors, anim);
-#endif
-}
-
-/* Init Berlin Scene */
-static void
-init_scene1(AWallpaperPlugin *desktop_plugin)
-{
- Actor *actor, *actor1, *actor2;
- Scene *scene;
- gint now = time(NULL);
- gint i;
- gint winds[13][2];
- GPtrArray *child = NULL;
-
- scene = g_new0(Scene, 1);
- scene->daytime = get_daytime();
- scene->actors = NULL;
- scene->wind_orientation = -1;
- scene->wind_angle = 0.3;
- /* init value for random */
- scene->seed = time(NULL);
- desktop_plugin->priv->scene = scene;
-
- actor = init_object(desktop_plugin, "sky", "sky.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);
-
-
- actor = init_object(desktop_plugin, "sun", "sun.png", 0, 0, 6, 88, 88,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_sun, NULL, NULL);
- actor->time_start_animation = time(NULL);
- actor->duration_animation = G_MAXINT;
- change_sun(actor, desktop_plugin);
- scene->actors = g_slist_append(scene->actors, actor);
-
-#if 0
- actor = init_object(desktop_plugin, "dot", "dot1.png", 0, 0, 11, 50, 50,
- TRUE, 100, 255, NULL, NULL);
- scene.actors = g_slist_append(scene.actors, actor);
-#endif
-
- actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 15, 6, 60, 60,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_moon, NULL, NULL);
- change_moon(actor, desktop_plugin);
- scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "cloud1", "cloud1.png", 0, fast_rnd(300)-97, 7, 150, 97,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_cloud, NULL, NULL);
- actor->time_start_animation = now + fast_rnd(30) + 10;
- actor->duration_animation = 3*60;
- scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "cloud2", "cloud2.png", 0, fast_rnd(300)-75, 7, 188, 75,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_cloud, NULL, NULL);
- actor->time_start_animation = now + fast_rnd(10);
- actor->duration_animation = 3*60;
- scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "cloud4", "cloud4.png", 0, fast_rnd(300)-75, 7, 150, 75,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_cloud, NULL, NULL);
- actor->time_start_animation = now + fast_rnd(60) + 20;
- actor->duration_animation = 5*60;
- scene->actors = g_slist_append(scene->actors, actor);
-
-
- actor = init_object(desktop_plugin, "plane2", "plane3.png", 0, 45, 8, 160, 50,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_plane2, NULL, NULL);
- actor->time_start_animation = now + fast_rnd(40) + 20;
- actor->duration_animation = 60;
- scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "plane1", "tu154.png", 620, 233, 9, 300, 116,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_plane1, NULL, NULL);
- actor->time_start_animation = now + fast_rnd(20);
- actor->duration_animation = 30;
- scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 10, 800, 480,
- TRUE, TRUE, 100, 255,
- (gpointer)&change_static_actor_with_corner, NULL, NULL);
- change_static_actor_with_corner(actor, desktop_plugin);
- scene->actors = g_slist_append(scene->actors, actor);
-
- actor = init_object(desktop_plugin, "wind", "", 0, 0, 5, 0, 0,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_wind, NULL, NULL);
- change_wind(actor, desktop_plugin);
- scene->actors = g_slist_append(scene->actors, actor);
-
- actor1 = init_object(desktop_plugin, "signal_red", "red.png",
- 486, 425, 10, 18, 38,
- FALSE, TRUE, 100, 255, NULL, NULL, NULL);
- //actor->time_start_animation = now + fast_rnd(30) + 10;
- scene->actors = g_slist_append(scene->actors, actor1);
-
- actor2 = init_object(desktop_plugin, "signal_green", "green.png",
- 486, 425, 10, 18, 38,
- TRUE, TRUE, 100, 255, NULL, NULL, NULL);
- //actor->time_start_animation = now + fast_rnd(30) + 10;
- scene->actors = g_slist_append(scene->actors, actor2);
- child = g_ptr_array_sized_new(2);
- g_ptr_array_add(child, actor1);
- g_ptr_array_add(child, actor2);
- actor = init_object(desktop_plugin, "signal", "",
- 486, 425, 10, 18, 38,
- FALSE, FALSE, 100, 255,
- (gpointer)&change_signal, NULL, child);
- actor->time_start_animation = now + fast_rnd(30) + 10;
- scene->actors = g_slist_append(scene->actors, actor);
-
- winds[0][0] = 389;
- winds[0][1] = 305;
-
- winds[1][0] = 373;
- winds[1][1] = 306;
-
- winds[2][0] = 355;
- winds[2][1] = 306;
-
- winds[3][0] = 356;
- winds[3][1] = 288;
-
- winds[4][0] = 337;
- winds[4][1] = 269;
-
- winds[5][0] = 372;
- winds[5][1] = 268;
-
- winds[6][0] = 372;
- winds[6][1] = 249;
-
- winds[7][0] = 388;
- winds[7][1] = 249;
-
- winds[8][0] = 387;
- winds[8][1] = 230;
-
- winds[9][0] = 372;
- winds[9][1] = 211;
-
- winds[10][0] = 355;
- winds[10][1] = 159;
-
- winds[11][0] = 335;
- winds[11][1] = 158;
-
- winds[12][0] = 386;
- winds[12][1] = 119;
-
- for (i=0; i<13; i++){
- actor = init_object(desktop_plugin, "window", "window.png",
- winds[i][0], winds[i][1], 10, 8, 9,
- FALSE, TRUE, 100, 255,
- (gpointer)&change_window1, NULL, NULL);
- //change_window1(actor, desktop_plugin);
- actor->time_start_animation = now + fast_rnd(30);
- scene->actors = g_slist_append(scene->actors, actor);
-
- }
-
- run_long_timeout(desktop_plugin);
-
-}
-
-void
-get_sun_screen_pos(double alt, double azm, gint * x, gint * y)
-{
- gint y0 = 365;// - уровень горизонта
- *x = (int)(azm * 800) - 64;
- *y = (int)((1 - alt) * y0) - 64;
- //fprintf(stderr, "sun pos alt=%f azm=%f x=%d y=%d\n", alt, azm, *x, *y);
-}
-#if 0
-static void
-change_actor(GtkWidget * actor)
+desktop_plugin_visible_notify (GObject *object,
+ GParamSpec *spec,
+ AWallpaperPlugin *desktop_plugin)
{
- char * name;
- gint x, y, daytime, scale;
- gdouble sc;
- double alt, azm;
-
- GtkWidget *image;
- GdkPixbuf *pixbuf;
-
- void (*pfunc)(gpointer, gpointer);
+ gboolean visible;
+ Animation_WallpaperPrivate *priv = desktop_plugin->priv;
+ g_object_get (object, "is-on-current-desktop", &visible, NULL);
+ fprintf (stderr, "LWP is-on-current-desktop changed. visible: %u", visible);
+ if (priv){
+ if (priv->one_in_all_view){
+ if (visible)
+ send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_PLAY_LIVEBG_ON_VIEW1);
+ else{
+ /* start any application on current view */
+ if ((priv->view + 1) == current_active_view())
+ send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_PAUSE_LIVEBG_ON_VIEW1);
+ }
+ return;
+ }
+ switch (priv->view + 1){
+ case 1: if (visible)
+ send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_PLAY_LIVEBG_ON_VIEW1);
+ else
+ send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_PAUSE_LIVEBG_ON_VIEW1);
+ break;
+ case 2: if (visible)
+ send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_PLAY_LIVEBG_ON_VIEW2);
+ else
+ send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_PAUSE_LIVEBG_ON_VIEW2);
+ break;
+ case 3: if (visible)
+ send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_PLAY_LIVEBG_ON_VIEW3);
+ else
+ send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_PAUSE_LIVEBG_ON_VIEW3);
+ break;
+ case 4: if (visible)
+ send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_PLAY_LIVEBG_ON_VIEW4);
+ else
+ send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_PAUSE_LIVEBG_ON_VIEW4);
+ break;
+ }
- name = g_object_get_data(G_OBJECT(actor), "name");
- fprintf(stderr, "change actor %s\n", name);
- if (name == "sun"){
- pfunc = g_object_get_data(G_OBJECT(actor), "func");
- if (pfunc)
- (*pfunc)(actor, g_strdup(name));
- daytime = get_daytime();
- if (daytime != TIME_NIGHT){
- hildon_animation_actor_set_show(actor, 1);
- get_sun_pos(&alt, &azm);
- get_sun_screen_pos(alt, azm, &x, &y);
- actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z"));
- }
- }
+ }
- if (name == "cloud1"){
- x = g_object_get_data(G_OBJECT(actor), "x");
- y = g_object_get_data(G_OBJECT(actor), "y");
- scale = g_object_get_data(G_OBJECT(actor), "scale");
-
- /* Start */
- image = g_object_get_data(G_OBJECT(actor), "image");
-
- gtk_container_remove(actor, image);
- pixbuf = gdk_pixbuf_new_from_file_at_size ("/usr/share/livewp/theme/Modern/sun.png",
- 200,
- 200,
- NULL);
- if (pixbuf){
- image = gtk_image_new_from_pixbuf (pixbuf);
- g_object_unref(G_OBJECT(pixbuf));
- }
- g_signal_connect(G_OBJECT(image), "expose_event",
- G_CALLBACK(expose_event), pixbuf);
- gtk_container_add (GTK_CONTAINER (actor), image);
- realize(actor);
- gtk_widget_show_all(actor);
- /* End*/
-
-
- x += 40;
- y -= 20;
- scale -= 10;
- if (x > 500){
- x = 400;
- y = 150;
- sc = 1;
- }
- sc = (double)scale / 100;
- hildon_animation_actor_set_scale(actor, sc, sc);
- fprintf(stderr, "cloud x=%d y=%d scale=%f", x, y, sc);
- actor_set_position_full(actor, x, y, g_object_get_data(G_OBJECT(actor), "z"));
- g_object_set_data(G_OBJECT(actor), "x", x);
- g_object_set_data(G_OBJECT(actor), "y", y);
- g_object_set_data(G_OBJECT(actor), "scale", scale);
- }
-
-}
-#endif
-static gboolean
-short_timeout (AWallpaperPlugin *desktop_plugin)
-{
- //gint daytime = get_daytime();
- GSList * tmp;
- void (*pfunc)(gpointer, gpointer);
- time_t now;
- Actor *actor;
- gboolean stop_flag = TRUE;
-
-if (!desktop_plugin->priv->visible || !desktop_plugin->priv->rich_animation){
- desktop_plugin->priv->short_timer = 0;
- return FALSE;
- }
-
- now = time(NULL);
- //scene.daytime = daytime;
- /* fprintf(stderr, "Short timer %d\n", now); */
- tmp = desktop_plugin->priv->scene->actors;
- while (tmp != NULL){
- actor = tmp->data;
- if (now >= actor->time_start_animation
- && actor->time_start_animation > 0
- /* && now - actor->time_start_animation <= actor->duration_animation*/){
- pfunc = actor->func_change;
- if (pfunc){
- (*pfunc)(actor, desktop_plugin);
- stop_flag = FALSE;
- }
- }
- tmp = g_slist_next(tmp);
- }
- if (stop_flag){
- desktop_plugin->priv->short_timer = 0;
- return FALSE;
- }else
- return TRUE; /* keep running this event */
-}
-
-void
-run_long_timeout(AWallpaperPlugin *desktop_plugin)
-{
-
- gint daytime = get_daytime();
- GSList * tmp;
- void (*pfunc)(gpointer, gpointer);
- time_t now;
- Actor *actor;
-
-
- //fprintf(stderr, "!!!run long timeout short_timer=%d\n", desktop_plugin->priv->short_timer);
- if (desktop_plugin->priv->scene->daytime != daytime){
- desktop_plugin->priv->scene->daytime = daytime;
- tmp = desktop_plugin->priv->scene->actors;
- while (tmp != NULL){
- //change_actor(tmp->data);
- pfunc =((Actor*)tmp->data)->func_change;
- if (pfunc){
- (*pfunc)(tmp->data, desktop_plugin);
- }
- tmp = g_slist_next(tmp);
- }
- }
-
- now = time(NULL);
- //fprintf(stderr, "Now %d\n", now);
- tmp = desktop_plugin->priv->scene->actors;
- while (tmp != NULL){
- actor = tmp->data;
- if (now >= actor->time_start_animation
- && actor->time_start_animation > 0
- && desktop_plugin->priv->short_timer == 0){
- /* fprintf(stderr, "start short timer act = %s %d\n", actor->name, now); */
- if (desktop_plugin->priv->rich_animation){
- actor->time_start_animation = now;
- desktop_plugin->priv->short_timer = g_timeout_add(SHORT_TIMER, (GtkFunction)short_timeout, desktop_plugin);
- }
- else {
- (*actor->func_change)(actor, desktop_plugin);
- }
- }
- tmp = g_slist_next(tmp);
- }
-
}
-static gboolean
-long_timeout (AWallpaperPlugin *desktop_plugin)
+gboolean
+send_alive_event(Animation_WallpaperPrivate *priv)
{
- /* fprintf(stderr, "long_timeout %i\n", desktop_plugin->priv->long_timer); */
- if (desktop_plugin->priv->long_timer == 0 )
- return FALSE;
- if (!desktop_plugin->priv->visible){
- if(desktop_plugin->priv->short_timer != 0){
- g_source_remove(desktop_plugin->priv->short_timer);
- desktop_plugin->priv->short_timer = 0;
- }
- desktop_plugin->priv->long_timer = 0;
- return FALSE;
+ switch (priv->view + 1){
+ case 1: send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_ALIVE_LIVEBG_ON_VIEW1);
+ break;
+ case 2: send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_ALIVE_LIVEBG_ON_VIEW2);
+ break;
+ case 3: send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_ALIVE_LIVEBG_ON_VIEW3);
+ break;
+ case 4: send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_ALIVE_LIVEBG_ON_VIEW4);
+ break;
}
-
-
- run_long_timeout(desktop_plugin);
- return TRUE; /* keep running this event */
-}
-static void
-desktop_plugin_visible_notify (GObject *object,
- GParamSpec *spec,
- AWallpaperPlugin *desktop_plugin)
-{
- gboolean visible;
- g_object_get (object, "is-on-current-desktop", &visible, NULL);
- /* fprintf (stderr, "is-on-current-desktop changed. visible: %u", visible); */
- if (visible){
- desktop_plugin->priv->visible = TRUE;
- if (desktop_plugin->priv->long_timer == 0 ){
- desktop_plugin->priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin);
- run_long_timeout(desktop_plugin);
- }
- }else{
- desktop_plugin->priv->visible = FALSE;
- if (desktop_plugin->priv->long_timer != 0 ){
- g_source_remove(desktop_plugin->priv->long_timer);
- desktop_plugin->priv->long_timer = 0;
- }
- }
+ return TRUE;
}
-gboolean
-rich_animation_press(GtkWidget *widget, GdkEvent *event,
- gpointer user_data){
- fprintf(stderr,"gggggggggggggggggggg2222\n");
- return FALSE;
-}
static void
animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
{
- GtkWidget *rich_animation;
- gchar buffer[2048];
-
//fprintf(stderr, "!!!!!!!plugin init \n");
Animation_WallpaperPrivate *priv = Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
desktop_plugin->priv = Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE (desktop_plugin);
priv->osso = osso_initialize(PACKAGE, VERSION, TRUE, NULL);
- /* Load config */
- read_config(priv);
- /* Initialize DBUS */
+ /* Initialize DBUS */
livewp_initialize_dbus(priv);
priv->desktop_plugin = desktop_plugin;
- priv->visible = TRUE;
+ priv->window = (GtkWidget *)desktop_plugin;
+ priv->visible = FALSE;
priv->short_timer = 0;
priv->xapplet = 0;
priv->yapplet = 0;
- //priv->theme = g_strdup("Modern");
+ priv->scene = NULL;
+ priv->pid = 0;
+ priv->theme = g_strdup("Modern");
+ //priv->theme = g_strdup("Accel");
desktop_plugin->priv->main_widget = gtk_fixed_new();
- gtk_widget_set_size_request(desktop_plugin->priv->main_widget, 100, 32);
- desktop_plugin->priv->right_corner = NULL;
- snprintf(buffer, sizeof(buffer) - 1, "%s/%s/%s", THEME_PATH, desktop_plugin->priv->theme, "town0_right_corner.png");
- desktop_plugin->priv->right_corner = gtk_image_new_from_file (buffer);
- if (desktop_plugin->priv->right_corner){
- gtk_fixed_put(GTK_FIXED(desktop_plugin->priv->main_widget), desktop_plugin->priv->right_corner, 0, 0);
- gtk_widget_show (desktop_plugin->priv->right_corner);
- }
- /* Create rich animation event */
- rich_animation = gtk_event_box_new();
- if(rich_animation){
- gtk_widget_set_events(rich_animation, GDK_BUTTON_PRESS_MASK);
- gtk_event_box_set_visible_window(GTK_EVENT_BOX(rich_animation), FALSE);
- gtk_widget_set_size_request(rich_animation, 100, 32);
- gtk_widget_show (rich_animation);
- g_signal_connect(rich_animation, "button-press-event", G_CALLBACK(rich_animation_press), desktop_plugin);
- gtk_fixed_put(GTK_FIXED(desktop_plugin->priv->main_widget), rich_animation, 0, 0);
- }
-/*
- GtkWidget *label = gtk_label_new ("ddddddddddddd");
- gtk_widget_set_size_request(label, 95, 30);
- gtk_widget_show (label);
- gtk_container_add (GTK_CONTAINER (desktop_plugin), label);
- gtk_fixed_put(GTK_FIXED(widget), label, 0, 0);
-*/
- hd_home_plugin_item_set_settings (HD_HOME_PLUGIN_ITEM (desktop_plugin), TRUE);
- g_signal_connect (desktop_plugin, "show-settings",
- G_CALLBACK (show_settings), priv);
+ gtk_widget_set_size_request(desktop_plugin->priv->main_widget, 1, 1);
gtk_widget_show (desktop_plugin->priv->main_widget);
gtk_container_add (GTK_CONTAINER (desktop_plugin), desktop_plugin->priv->main_widget);
init_applet_position(&(priv->xapplet), &(priv->yapplet));
- fprintf(stderr, "!!!theme = %s\n", priv->theme);
priv->scene = NULL;
- if (!strcmp(priv->theme,"Modern"))
- init_scene(desktop_plugin);
- else if (!strcmp(priv->theme,"Berlin"))
- init_scene1(desktop_plugin);
- else if (!strcmp(priv->theme, "Matrix"))
- init_scene2(desktop_plugin);
- priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin);
- /* TODO Move scene to priv */
- //scene.timer_type = LONG_TIMER_TYPE;
g_signal_connect (desktop_plugin, "notify::is-on-current-desktop",
- G_CALLBACK (desktop_plugin_visible_notify), desktop_plugin);
+ G_CALLBACK (desktop_plugin_visible_notify), desktop_plugin);
-
- //sleep(2);
+ priv->alive_timer = g_timeout_add(60000*3, (GtkFunction)send_alive_event, priv); /* One per 3 minute */
}
static void
lw_applet_finalize (GObject *object)
{
+ int status = 0; int wpid;
+fprintf(stderr,"lw_applet_finalize\n");
AWallpaperPlugin *desktop_plugin = Animation_Wallpaper_HOME_PLUGIN (object);
Animation_WallpaperPrivate *priv = desktop_plugin->priv;
+/*
- fprintf(stderr,"finalaze %i\n", priv->long_timer);
- if (priv->long_timer){
- g_source_remove(priv->long_timer);
- priv->long_timer = 0;
+ if (priv){
+ livewp_deinitialize_dbus(priv);
+ fprintf(stderr,"finalaze %i\n", priv->long_timer);
+ if (priv->long_timer){
+ g_source_remove(priv->long_timer);
+ priv->long_timer = 0;
+ }
+ if (priv->short_timer){
+ g_source_remove(priv->short_timer);
+ priv->short_timer = 0;
+ }
+
+ destroy_scene(desktop_plugin);
+ }
+*/
+ fprintf(stderr,"sddddddddd1111111 %i\n", priv->view);
+ if (priv){
+ switch (priv->view + 1){
+ case 1: send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_STOP_LIVEBG_ON_VIEW1);
+ break;
+ case 2: send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_STOP_LIVEBG_ON_VIEW2);
+ break;
+ case 3: send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_STOP_LIVEBG_ON_VIEW3);
+ break;
+ case 4: send_dbus_signal (priv, LIVEWP_SIGNAL_INTERFACE,
+ LIVEWP_SIGNAL_PATH, LIVEWP_STOP_LIVEBG_ON_VIEW4);
+ break;
+ }
}
- if (priv->short_timer){
- g_source_remove(priv->short_timer);
- priv->short_timer = 0;
+ fprintf(stderr,"sddddddddd222222222222\n");
+ if(priv->alive_timer > 0)
+ g_source_remove(priv->alive_timer);
+
+ fprintf(stderr,"sddddddddd222333333222222222\n");
+ livewp_deinitialize_dbus(priv);
+
+ fprintf(stderr,"sddddddddd222334333222222222\n");
+ if (priv->pid >0){
+ fprintf(stderr,"sddddddddd22233433333333333333333333322222233222222222\n");
+ while (TRUE){
+ wpid = wait(&status);
+ if (wpid == priv->pid)
+ break;
+ }
}
+}
- destroy_scene(desktop_plugin);
+static void
+desktop_widget_finalize (GObject *object)
+{
+fprintf(stderr,"desktop lw_applet_finalize\n");
+ /* Call the base class's implementation: */
+ G_OBJECT_CLASS (animation_wallpaper_plugin_parent_class)->finalize (object);
}
static void
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkObjectClass *gobject_class = GTK_OBJECT_CLASS (klass);
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
/* gobject */
gobject_class->destroy = (gpointer)lw_applet_finalize;
+ object_class->finalize = desktop_widget_finalize;
widget_class->realize = lw_applet_realize;
- widget_class->expose_event = lw_applet_expose_event;
g_type_class_add_private (klass, sizeof (Animation_WallpaperPrivate));
animation_wallpaper_plugin_class_finalize (AWallpaperPluginClass *class) {
}
+Animation_WallpaperPrivate*
+animation_wallpaper_plugin_new (void)
+{
+ return g_object_new (Animation_Wallpaper_TYPE_HOME_PLUGIN , NULL);
+}