Hop this is felling better now ... Michael Weber --- gtk-sunlight-0.2.1/callbacks.c +++ gtk-sunlight-0.2.1callbacks.c @@ -19,6 +19,9 @@ #include "support.h" +#include +#include +#include void button_sensitive (ChData *data, gboolean sensitive); void change_wallpaper (ChData *data); @@ -94,21 +97,21 @@ void cmd_ok_clicked ( GtkButton *button, ChData *data) { - FILE *file; int time_out; - gchar *contents; + gchar *contents = g_malloc(1002); gchar *fname = g_strconcat(g_get_home_dir(), DIR_PROJECT, "/sunlight_options", NULL); gtk_widget_hide(data->main_window); /*Saving gi_rd1 and gi_rd2 to a file under DIR_PROJECT*/ - sprintf(contents, "%d %d", data->gi_rd1, data->gi_rd2); + snprintf(contents, 1000, "%d %d", data->gi_rd1, data->gi_rd2); g_file_set_contents(fname, contents, -1, NULL); change_wallpaper (data); time_out = gtk_timeout_add(1800000, (GtkFunction) change_wallpaper, data); + g_free(contents); g_free(fname); } @@ -118,7 +121,6 @@ void change_wallpaper (ChData *data) { - FILE *file; gchar *text1, *text2, *image_address, *set_wallpaper; gchar *dir_wallpapers = g_strconcat(g_get_home_dir(), DIR_WALLPAPERS, NULL); gchar *dir_project = g_strconcat(g_get_home_dir(), DIR_PROJECT, NULL); @@ -183,7 +185,6 @@ void chk_startup_toggled_cb (GtkToggleButton *togglebutton, ChData *data) { - FILE *file; gchar *contents = "[Desktop Entry]\nEncoding=UTF-8\nIcon=/usr/share/icons/hicolor/48x48/apps/gtk-sunlight.png\nName=Real-time Sunlight Wallpaper\nComment=World sunlight map every 30 minutes\nExec=gtk-sunlight --nodisplay\nTerminal=false\nType=Application\nCategories=Utility;\nStartupNotify=false\nHidden=false\nNoDisplay=false"; gchar *path_startup = g_strconcat(g_get_home_dir(), "/.config/autostart/", NULL); --- gtk-sunlight-0.2.1/sunlight.c +++ gtk-sunlight-0.2.1/sunlight.c @@ -20,9 +20,15 @@ #include "support.h" #include "errno.h" //#include "time.h" +#include +#include +#include +#include #define UI_FILE "/usr/share/sunlight/sunlight.glade" +void change_wallpaper (ChData *data); + gboolean make_dir(gchar *trail) { @@ -78,7 +84,7 @@ GError *error = NULL; gchar *option_file = g_strconcat(g_get_home_dir(), DIR_PROJECT, "/sunlight_options", NULL); gchar *contents; - gint length; + gsize length; int time_out; GOptionContext *context; @@ -111,8 +117,8 @@ data = g_slice_new( ChData ); /* create project directories if necessary */ - if (!make_dir(DIR_PROJECT)) return; - if (!make_dir(DIR_WALLPAPERS)) return; + if (!make_dir(DIR_PROJECT)) return 1; + if (!make_dir(DIR_WALLPAPERS)) return 1; /* Check for sunlight_options file and getting gi_rd1 and gi_rd2*/ if (g_file_test(option_file, G_FILE_TEST_EXISTS)){