#define Animation_Wallpaper_HOME_PLUGIN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE (obj,\
Animation_Wallpaper_TYPE_HOME_PLUGIN,\
Animation_WallpaperPrivate))
-
static void
lw_applet_realize (GtkWidget *widget)
{
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)
//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));
+
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);
time_t now;
Actor *actor;
-
+ if (!desktop_plugin->priv->scene)
+ return;
//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;
}
}
}
-
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)
{
priv->short_timer = 0;
priv->xapplet = 0;
priv->yapplet = 0;
- //priv->theme = g_strdup("Modern");
+ priv->scene = NULL;
+// priv->theme = g_strdup("Modern");
desktop_plugin->priv->main_widget = gtk_fixed_new();
gtk_widget_set_size_request(desktop_plugin->priv->main_widget, 100, 32);
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");
+#if 0
+ GtkWidget *label = gtk_label_new ("1111ddddddddd");
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);
-*/
+#endif
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);
/* 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);
static void
lw_applet_finalize (GObject *object)
{
+fprintf(stderr,"lw_applet_finalize\n");
+/*
AWallpaperPlugin *desktop_plugin = Animation_Wallpaper_HOME_PLUGIN (object);
Animation_WallpaperPrivate *priv = desktop_plugin->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;
+
+ 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);
}
+*/
+}
- destroy_scene(desktop_plugin);
+static void
+desktop_widget_finalize (GObject *object)
+{
+ 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: */
+ 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;
animation_wallpaper_plugin_class_finalize (AWallpaperPluginClass *class) {
}
+Animation_WallpaperPrivate*
+animation_wallpaper_plugin_new (void)
+{
+ return g_object_new (Animation_Wallpaper_TYPE_HOME_PLUGIN , NULL);
+}
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;
+ }
}
}
/* 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);
+ change_static_actor(actor, desktop_plugin);
actor = init_object(desktop_plugin, "sun", "sun.png",
0, 0, 6, 88, 88,