From 1eeaf5051b19c532a4d6d3545a8d9e8e732b6082 Mon Sep 17 00:00:00 2001 From: Vlad Vasiliev Date: Sun, 11 Apr 2010 00:02:50 +0300 Subject: [PATCH] fixed gcc warnings --- applet/src/livewp-astro.c | 2 +- applet/src/livewp-config.c | 5 +--- applet/src/livewp-home-widget.c | 56 +++++++++++++++++---------------------- applet/src/livewp-home-widget.h | 3 +++ applet/src/livewp-rules.c | 11 ++++---- applet/src/livewp-settings.c | 4 +-- 6 files changed, 38 insertions(+), 43 deletions(-) diff --git a/applet/src/livewp-astro.c b/applet/src/livewp-astro.c index 0a70d43..5d65ede 100644 --- a/applet/src/livewp-astro.c +++ b/applet/src/livewp-astro.c @@ -212,7 +212,7 @@ double moon_phase(int year, int month, int day) agepart = (jd - 2451550.1) / moonday; agepart = agepart - floor(agepart); - if (agepart < 0) agepart + 1; + if (agepart < 0) agepart ++; /* ageday = agepart * moonday; diff --git a/applet/src/livewp-config.c b/applet/src/livewp-config.c index 9b15b75..a529834 100644 --- a/applet/src/livewp-config.c +++ b/applet/src/livewp-config.c @@ -27,10 +27,7 @@ gint read_config(Animation_WallpaperPrivate *priv) { - GConfValue *value = NULL; GConfClient *gconf_client = NULL; - GSList *stlist = NULL; - GError *gerror = NULL; gchar *tmp = NULL; gconf_client = gconf_client_get_default(); @@ -57,7 +54,7 @@ save_config(Animation_WallpaperPrivate *priv) { gconf_client = gconf_client_get_default(); if (!gconf_client) { fprintf(stderr, _("Failed to initialize GConf. Quitting.\n")); - return -1; + return; } /* Save Weather source name. */ if (priv->theme) diff --git a/applet/src/livewp-home-widget.c b/applet/src/livewp-home-widget.c index ca53296..6dc1e03 100644 --- a/applet/src/livewp-home-widget.c +++ b/applet/src/livewp-home-widget.c @@ -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; diff --git a/applet/src/livewp-home-widget.h b/applet/src/livewp-home-widget.h index bcb8db2..37e0e24 100644 --- a/applet/src/livewp-home-widget.h +++ b/applet/src/livewp-home-widget.h @@ -73,5 +73,8 @@ gint read_config(Animation_WallpaperPrivate *priv); void save_config(Animation_WallpaperPrivate *priv); static void init_scene(AWallpaperPlugin *desktop_plugin); static void init_scene1(AWallpaperPlugin *desktop_plugin); +void create_hildon_actor(Actor *actor, AWallpaperPlugin *desktop_plugin); +void get_sun_screen_pos(double alt, double azm, gint * x, gint * y); +void probability_sun(Actor *actor); #endif diff --git a/applet/src/livewp-rules.c b/applet/src/livewp-rules.c index 6b3ff2e..daa6056 100644 --- a/applet/src/livewp-rules.c +++ b/applet/src/livewp-rules.c @@ -57,10 +57,8 @@ double get_max_sun_alt(double lon, double lat, int year, int month, int day, int zone) { int h1, m1, h2, m2, h, m; - time_t t1, t2, t; - struct tm tm1, tm2; + struct tm; double alt, hour1, hour2, hh, x; - int hour, min; sun_rise_set(lon, lat, year, month, day, @@ -122,19 +120,22 @@ int get_daytime() if (alt > -7 && alt < 7 && azm < 50) return TIME_SUNRISE; if (alt > -7 && alt < 7 && azm > 50) return TIME_SUNSET; if (alt >= 7) return TIME_DAY; - + return TIME_DAY; } + int get_moon_phase() { int year, month, day, hour, min, zone; double phase; get_localtime(&year, &month, &day, &hour, &min, &zone); phase = moon_phase(year, month, day) * 100; - printf("ph = %f\n", phase); + /* printf("ph = %f\n", phase); */ if (phase <= 3 || phase >=97) return MOON_NONE; if (phase > 5 && phase <= 25) return MOON_GROWS; if (phase > 25 && phase <= 45) return MOON_GROWSHALF; if (phase > 45 && phase <= 55) return MOON_FULL; if (phase > 55 && phase <= 75) return MOON_DECREASHALF; if (phase > 75 && phase < 97) return MOON_DECREAS; + return MOON_NONE; + } diff --git a/applet/src/livewp-settings.c b/applet/src/livewp-settings.c index 8996310..8be2883 100644 --- a/applet/src/livewp-settings.c +++ b/applet/src/livewp-settings.c @@ -71,11 +71,11 @@ create_themes_button (gchar *theme){ if (theme) { if (!strcmp(theme, "Berlin")){ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 0); - hildon_button_set_value(button, _("Berlin")); + hildon_button_set_value(HILDON_BUTTON(button), _("Berlin")); } if (!strcmp(theme, "Modern")){ hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 1); - hildon_button_set_value(button, _("Modern")); + hildon_button_set_value(HILDON_BUTTON(button), _("Modern")); } } -- 1.7.9.5