fixed gcc warnings
[livewp] / applet / src / livewp-home-widget.c
index ca53296..6dc1e03 100644 (file)
@@ -140,7 +140,7 @@ init_applet_position(void)
        yapplet = Ystartposition;
   }
   g_free (position_key);
-  modified = g_strdup_printf ("%ld", 0);
+  modified = g_strdup_printf ("%i", 0);
   modified_key = g_strdup_printf (GCONF_KEY_MODIFIED, PLUGIN_NAME);
   gconf_client_set_string (gconf_client,
                            modified_key,
@@ -203,8 +203,8 @@ init_object(AWallpaperPlugin *desktop_plugin,
   actor->opacity = opacity;
   actor->filename = g_strdup(filename);
   actor->name = g_strdup(name);
-  actor->func_change = pfunc_change; 
-  actor->func_probability = pfunc_probability;
+  actor->func_change = (gpointer)pfunc_change; 
+  actor->func_probability = (gpointer)pfunc_probability;
   if (visible)
     create_hildon_actor(actor, desktop_plugin);
   else 
@@ -226,7 +226,7 @@ init_object(AWallpaperPlugin *desktop_plugin,
 void 
 change_moon(Actor * actor, AWallpaperPlugin *desktop_plugin)
 {
-    gint x, y, z, daytime, phase;
+    gint daytime, phase;
     char *newfile;
 
     if (actor){
@@ -260,7 +260,7 @@ void
 change_sun(Actor * actor, AWallpaperPlugin *desktop_plugin)
 {
     double alt, azm;
-    gint x, y, z, daytime;
+    gint x, y, daytime;
 
     if (actor){
         daytime = get_daytime();
@@ -317,7 +317,7 @@ change_tram(Actor * actor, AWallpaperPlugin *desktop_plugin)
     scale = path_line(scale0, scale1, t);
     //fprintf(stderr, "change tram t=%f x=%d y=%d scale=%d\n", t, x, y, scale);
     actor_set_position_full(actor->widget, x, y, actor->z);
-    hildon_animation_actor_set_scale(actor->widget, (double)scale/100, (double)scale/100);
+    hildon_animation_actor_set_scale(HILDON_ANIMATION_ACTOR(actor->widget), (double)scale/100, (double)scale/100);
     if (t >= 1){
         /* stop animation */
         actor->visible = FALSE;
@@ -351,8 +351,8 @@ create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
     gtk_container_add (GTK_CONTAINER (ha), image);
   }  
   actor_set_position_full(ha, actor->x, actor->y, actor->z);
-  hildon_animation_actor_set_show (ha, actor->visible);
-  hildon_animation_actor_set_scale(ha, (double)actor->scale/100, (double)actor->scale/100);
+  hildon_animation_actor_set_show (HILDON_ANIMATION_ACTOR(ha), actor->visible);
+  hildon_animation_actor_set_scale(HILDON_ANIMATION_ACTOR(ha), (double)actor->scale/100, (double)actor->scale/100);
   realize(ha);
   gtk_widget_show_all(ha);
 
@@ -370,7 +370,7 @@ create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
   g_object_set_data(G_OBJECT(ha), "opacity", opacity);
   g_object_set_data(G_OBJECT(ha), "func", pfunc);
   */
-  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), desktop_plugin);
+  hildon_animation_actor_set_parent (HILDON_ANIMATION_ACTOR (ha), GTK_WINDOW(desktop_plugin));
   actor->widget = ha;
 }
 
@@ -397,7 +397,7 @@ change_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin)
         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(actor->widget, 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);
@@ -422,13 +422,13 @@ change_static_actor(Actor * actor, AWallpaperPlugin *desktop_plugin)
 
 
 
-
+/*
 static gint 
 get_time(gint t){
     // уравнение изменения времени
     return t*1.1;
 }
-
+*/
 static void 
 destroy_scene(void){
     GSList * tmp = scene.actors;
@@ -474,12 +474,12 @@ init_scene(AWallpaperPlugin *desktop_plugin)
   scene.actors = NULL;
 
   actor = init_object(desktop_plugin, "sky", "sky0.png", 0, 0, 5, 800, 480, 
-                      TRUE, 100, 255, &change_static_actor, NULL);
+                      TRUE, 100, 255, (gpointer)&change_static_actor, 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, 
-                      TRUE, 100, 255, &change_sun, &probability_sun);
+                      TRUE, 100, 255, (gpointer)&change_sun, &probability_sun);
   actor->time_start_animation = time(NULL);
   actor->duration_animation = G_MAXINT;
   change_sun(actor, desktop_plugin);
@@ -491,25 +491,25 @@ init_scene(AWallpaperPlugin *desktop_plugin)
 
 
   actor = init_object(desktop_plugin, "town", "town0.png", 0, 0, 7, 800, 480, 
-                      TRUE, 100, 255, &change_static_actor, NULL);
+                      TRUE, 100, 255, (gpointer)&change_static_actor, 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, 8, 350, 210, 
-                      FALSE, 100, 255, &change_tram, NULL);
+                      FALSE, 100, 255, (gpointer)&change_tram, NULL);
   actor->time_start_animation = time(NULL) + 10;
   actor->duration_animation = 60;
   scene.actors = g_slist_append(scene.actors, actor);
 
   actor = init_object(desktop_plugin, "border", "border0.png", 0, 480-79, 9, 800, 79,
-                      TRUE, 100, 255, &change_static_actor, NULL);
+                      TRUE, 100, 255, (gpointer)&change_static_actor, NULL);
   change_static_actor(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
   
   actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 20, 10, 60, 60, 
-                      FALSE, 100, 255, &change_moon, NULL);
+                      FALSE, 100, 255, (gpointer)&change_moon, NULL);
   change_moon(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
 
@@ -536,13 +536,13 @@ init_scene1(AWallpaperPlugin *desktop_plugin)
   scene.actors = NULL;
   
   actor = init_object(desktop_plugin, "sky", "sky.png", 0, 0, 5, 800, 480, 
-                      TRUE, 100, 255, &change_static_actor, NULL);
+                      TRUE, 100, 255, (gpointer)&change_static_actor, 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, 
-                      TRUE, 100, 255, &change_sun, &probability_sun);
+                      TRUE, 100, 255, (gpointer)&change_sun, &probability_sun);
   actor->time_start_animation = time(NULL);
   actor->duration_animation = G_MAXINT;
   change_sun(actor, desktop_plugin);
@@ -554,12 +554,12 @@ init_scene1(AWallpaperPlugin *desktop_plugin)
 
 
   actor = init_object(desktop_plugin, "town", "town.png", 0, 0, 7, 800, 480, 
-                      TRUE, 100, 255, &change_static_actor, NULL);
+                      TRUE, 100, 255, (gpointer)&change_static_actor, NULL);
   change_static_actor(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
 
   actor = init_object(desktop_plugin, "moon", "moon1.png", 400, 15, 8, 60, 60, 
-                      FALSE, 100, 255, &change_moon, NULL);
+                      FALSE, 100, 255, (gpointer)&change_moon, NULL);
   change_moon(actor, desktop_plugin);
   scene.actors = g_slist_append(scene.actors, actor);
   //scene.dynamic_actors = g_slist_append(scene.dynamic_actors, G_OBJECT(actor));
@@ -584,8 +584,6 @@ void
 get_sun_screen_pos(double alt, double azm, gint * x, gint * y)
 {
     gint y0 = 365;// - уровень горизонта
-    gint o_width = 128,
-         o_height = 128; 
     *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);
@@ -668,10 +666,8 @@ short_timeout (AWallpaperPlugin *desktop_plugin)
 {
       gint daytime = get_daytime();
       GSList * tmp;
-      gchar * name;
       void (*pfunc)(gpointer, gpointer);
       time_t now;
-      gint t;
       Actor *actor;
       gboolean stop_flag = TRUE;
 
@@ -708,10 +704,8 @@ long_timeout (AWallpaperPlugin *desktop_plugin)
 {
       gint daytime = get_daytime();
       GSList * tmp;
-      gchar * name;
       void (*pfunc)(gpointer, gpointer);
       time_t now;
-      gint t;
       Actor *actor;
 
     /* TODO  remove timeout */
@@ -740,7 +734,7 @@ long_timeout (AWallpaperPlugin *desktop_plugin)
            && desktop_plugin->priv->short_timer == 0){
             actor->time_start_animation = now;
             /* fprintf(stderr, "start short timer act = %s %d\n", actor->name, now); */
-            desktop_plugin->priv->short_timer = g_timeout_add(SHORT_TIMER, short_timeout, desktop_plugin);
+            desktop_plugin->priv->short_timer = g_timeout_add(SHORT_TIMER, (GtkFunction)short_timeout, desktop_plugin);
         }
         tmp = g_slist_next(tmp);
    }
@@ -791,7 +785,7 @@ animation_wallpaper_plugin_init (AWallpaperPlugin *desktop_plugin)
         init_scene(desktop_plugin);
     else if (!strcmp(priv->theme,"Berlin")) 
         init_scene1(desktop_plugin);
-    priv->long_timer = g_timeout_add(LONG_TIMER, long_timeout, desktop_plugin);
+    priv->long_timer = g_timeout_add(LONG_TIMER, (GtkFunction)long_timeout, desktop_plugin);
     priv->short_timer = 0;
     /* TODO Move scene to priv */
     scene.timer_type = LONG_TIMER_TYPE;
@@ -822,7 +816,7 @@ animation_wallpaper_plugin_class_init (AWallpaperPluginClass *klass) {
     GtkObjectClass *gobject_class = GTK_OBJECT_CLASS (klass);
 
     /* gobject */
-    gobject_class->destroy = lw_applet_finalize;
+    gobject_class->destroy = (gpointer)lw_applet_finalize;
     widget_class->realize = lw_applet_realize;
     widget_class->expose_event = lw_applet_expose_event;