started to do desktop application with settings
[livewp] / applet / src / livewp-main.c
1 /* vim: set sw=4 ts=4 et: */
2 /*
3  * This file is part of Live Wallpaper (livewp)
4  * 
5  * Copyright (C) 2010 Vlad Vasiliev
6  * Copyright (C) 2010 Tanya Makova
7  *       for the code
8  * 
9  * This software is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * as published by the Free Software Foundation; either version 2.1 of
12  * the License, or (at your option) any later version.
13  * 
14  * This software is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  * 
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this software; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22  * 02110-1301 USA
23 */
24 /*******************************************************************************/
25 #include "livewp-settings.h"
26 /*******************************************************************************/
27
28 int
29 main(int argc, char *argv[])
30 {
31     GtkWidget *window;
32     gint result;
33
34     gtk_init(&argc, &argv);
35
36     window = create_settings();
37     if (window){
38         //gtk_widget_show_all(window);
39         
40         result = gtk_dialog_run(GTK_DIALOG(window));
41
42     switch(result){
43         case GTK_RESPONSE_YES:
44             #if 0
45             if (hildon_button_get_value(HILDON_BUTTON (theme_button))){
46                 if (priv->theme)
47                     g_free(priv->theme);
48                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Berlin")))
49                     priv->theme = g_strdup("Berlin");
50                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Modern")))
51                     priv->theme = g_strdup("Modern");
52                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Matrix")))
53                     priv->theme = g_strdup("Matrix");
54                 if (hildon_check_button_get_active (rich_animation_button))
55                     priv->rich_animation = TRUE;
56                 else
57                     priv->rich_animation = FALSE;
58             }
59             save_config(priv);
60             reload_scene(priv->desktop_plugin);
61             #endif
62             //fprintf(stderr, "click save %s\n", hildon_button_get_value(HILDON_BUTTON(theme_button)));
63             fprintf(stderr, "click save \n");
64         break;
65         default:
66         case GTK_RESPONSE_OK:
67         break;
68         case GTK_RESPONSE_NO:
69             fprintf(stderr, "click about\n");
70             gtk_widget_destroy(window);
71             window = NULL;
72             //lw_about();
73         break;
74     }
75     //if (window)
76       //  gtk_widget_destroy(window);
77     //}
78     }
79         gtk_main();
80     return 0;
81 }