GTK_WIDGET_CLASS (animation_wallpaper_plugin_parent_class)->realize (widget);
}
-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);
- }
- return TRUE;
-}
-
-static void
-realize (GtkWidget *widget)
-{
- GdkScreen *screen;
- screen = gtk_widget_get_screen (widget);
- gtk_widget_set_colormap (widget, gdk_screen_get_rgba_colormap (screen));
-}
/* Set position of widget on desktop */
static void
init_applet_position(gint *xapplet, gint *yapplet)
gconf_client_clear_cache(gconf_client);
g_object_unref(gconf_client);
}
-#if 0
-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);
-}
-#endif
-
-void
-destroy_hildon_actor(Actor *actor)
-{
- //fprintf(stderr, "destroy_hildon_actor %s\n",actor->name);
- gtk_widget_destroy(actor->widget);
- actor->widget = NULL;
-}
-
-void
-create_hildon_actor_text(Actor *actor, AWallpaperPlugin *desktop_plugin)
-{
- GtkWidget *ha = NULL;
- GtkWidget *label = NULL;
-
- ha = hildon_animation_actor_new();
- label = gtk_label_new(NULL);
-
- if (label){
- //g_signal_connect(G_OBJECT(label), "expose_event", G_CALLBACK(expose_event), NULL);
-
- gtk_container_add (GTK_CONTAINER (ha), label);
- }
- realize(ha);
- gtk_widget_show(label);
- gtk_widget_show_all(ha);
-
- /* TO DO check it */
- /* gdk_flush (); */
-
- //g_object_set_data(G_OBJECT(ha), "image", image);
- actor->image = label;
- hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), GTK_WINDOW(desktop_plugin->priv->window));
- 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
-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);
- }
- realize(ha);
- gtk_widget_show_all(ha);
-
- /* TO DO check it */
- /* gdk_flush (); */
-
- //g_object_set_data(G_OBJECT(ha), "image", image);
- actor->image = image;
- hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), GTK_WINDOW(desktop_plugin->priv->window));
-
- 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")){
- if (actor->image){
- gtk_container_remove(GTK_CONTAINER(actor->widget), actor->image);
- }
- //g_object_set_data(G_OBJECT(actor->widget), "image", image);
- actor->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 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;
-
- if (!desktop_plugin->priv->scene)
- return;
- /*ifprintf(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);
- }
-
-}
-
-gboolean
-long_timeout (AWallpaperPlugin *desktop_plugin)
-{
- GstFormat fmt = GST_FORMAT_TIME;
- gint64 p;
-
- /*fprintf(stderr, "long_timeout %i\n", desktop_plugin->priv->long_timer); */
- if (desktop_plugin->priv->pipeline){
- if (!desktop_plugin->priv->visible){
- gst_element_query_position(desktop_plugin->priv->pipeline, &fmt, &p);
- desktop_plugin->priv->theme_int_parametr1 = p / GST_SECOND;
- gst_element_set_state (desktop_plugin->priv->pipeline, GST_STATE_NULL);
- gst_object_unref (GST_OBJECT (desktop_plugin->priv->pipeline));
- desktop_plugin->priv->pipeline = NULL;
- }
- return TRUE;
- }
-
- 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;
- }
-
- run_long_timeout(desktop_plugin);
- return TRUE; /* keep running this event */
-}
void
desktop_plugin_visible_notify (GObject *object,
}
gboolean
-rich_animation_press(GtkWidget *widget, GdkEvent *event,
- gpointer user_data){
- fprintf(stderr,"gggggggggggggggggggg2222\n");
- return FALSE;
-}
-
-gboolean
send_alive_event(Animation_WallpaperPrivate *priv)
{
switch (priv->view + 1){
priv->yapplet = 0;
priv->scene = NULL;
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);
- g_hash_table_insert(priv->hash_scene_func, g_strdup("Xsnow"), (gpointer)&init_scene_Video);
-//#endif
//priv->theme = g_strdup("Accel");
desktop_plugin->priv->main_widget = gtk_fixed_new();