gchar * strid;
gint id;
AWallpaperPlugin *desktop_plugin = widget;
+ char* child_argv[] = {"/usr/bin/livewp", "0", (char *) 0 };
+
strid = g_strdup(hd_plugin_item_get_plugin_id (HD_PLUGIN_ITEM (widget)));
id = strid[strlen(strid)-1] - '0';
desktop_plugin->priv->view = id;
g_free(strid);
+
+ 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->pid = fork();
+ if (desktop_plugin->priv->pid == 0){
+ execvp("/usr/bin/livewp", child_argv);
+ fprintf(stderr,"Problem with new process");
+ }
+#if 0
/* Load config */
read_config(desktop_plugin->priv);
init_scene_theme(desktop_plugin);
desktop_plugin->priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin);
-
+#endif
screen = gtk_widget_get_screen (widget);
gtk_widget_set_colormap (widget,
gdk_screen_get_rgba_colormap (screen));
AWallpaperPlugin *desktop_plugin)
{
gboolean visible;
+ Animation_WallpaperPrivate *priv = desktop_plugin->priv;
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;
- }
- }
+ fprintf (stderr, "is-on-current-desktop changed. visible: %u", visible);
+ if (priv){
+ 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;
+ }
+ }
+
}
+
gboolean
rich_animation_press(GtkWidget *widget, GdkEvent *event,
gpointer user_data){
fprintf(stderr,"gggggggggggggggggggg2222\n");
return FALSE;
}
+
+gboolean
+send_alive_event(Animation_WallpaperPrivate *priv)
+{
+ fprintf(stderr, "send_alive_event\n");
+ 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;
+ }
+
+ return TRUE;
+}
+
static void
animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
{
priv->xapplet = 0;
priv->yapplet = 0;
priv->scene = NULL;
-// priv->theme = g_strdup("Modern");
+ priv->theme = g_strdup("Modern");
//#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("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("Accel"), (gpointer)&init_scene_Accel);
+ g_hash_table_insert(priv->hash_scene_func, g_strdup("Video"), (gpointer)&init_scene_Video);
//#endif
- //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, 1, 1);
init_applet_position(&(priv->xapplet), &(priv->yapplet));
- //fprintf(stderr, "!!!theme = %s\n", priv->theme);
- //snprintf(str, sizeof(str) - 1, "%s", "init_scene2");
- //fprintf(stderr, " str = %s\n", str);
priv->scene = NULL;
-#if 0
- if (!strcmp(priv->theme,"Modern"))
- init_scene_Modern(desktop_plugin);
- else if (!strcmp(priv->theme,"Berlin"))
- init_scene_Berlin(desktop_plugin);
- else if (!strcmp(priv->theme, "Matrix"))
- init_scene_Matrix(desktop_plugin);
-#endif
-// init_scene_theme(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);
-
- //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;
+/*
if (priv){
livewp_deinitialize_dbus(priv);
destroy_scene(desktop_plugin);
}
-*/
+*/
+
+ 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->alive_timer > 0)
+ g_source_remove(priv->alive_timer);
+
+ livewp_deinitialize_dbus(priv);
+ while (TRUE){
+ wpid = wait(&status);
+ if (wpid == priv->pid)
+ break;
+ }
}
static void
AWallpaperPlugin *desktop_plugin = Animation_Wallpaper_HOME_PLUGIN (object);
Animation_WallpaperPrivate *priv = desktop_plugin->priv;
- 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);
- }
- /* Call the base class's implementation: */
+ /* Call the base class's implementation: */
G_OBJECT_CLASS (animation_wallpaper_plugin_parent_class)->finalize (object);
}
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;
+// widget_class->expose_event = lw_applet_expose_event;
g_type_class_add_private (klass, sizeof (Animation_WallpaperPrivate));