next step for application
[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-common.h"
26 #include "livewp-settings.h"
27 /*******************************************************************************/
28
29 int
30 main(int argc, char *argv[])
31 {
32     GtkWidget *main_widget = NULL;
33     GtkWidget *window;
34     gint result;
35     HildonProgram       *app;
36     osso_context_t  *osso_context;
37
38 #ifdef ENABLE_NLS
39     setlocale(LC_ALL, "");
40     bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
41     bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
42     textdomain(GETTEXT_PACKAGE);
43 #endif
44     hildon_gtk_init (&argc, &argv);
45     osso_context = osso_initialize("org.maemo.livewp", VERSION, TRUE, NULL);
46     if(!osso_context){
47         fprintf(stderr,"osso_initialize failed\n");
48         return 1;
49     }
50
51
52     app = HILDON_PROGRAM ( hildon_program_get_instance () );
53     g_set_application_name (PACKAGE);
54  
55     main_widget = hildon_stackable_window_new ();
56     gtk_window_set_title(GTK_WINDOW(main_widget), PACKAGE);
57     hildon_program_add_window(app, HILDON_WINDOW(main_widget));
58     gtk_widget_show_all(GTK_WIDGET(main_widget));
59 #if 0
60     window = create_settings();
61     if (window){
62         //gtk_widget_show_all(window);
63         
64         result = gtk_dialog_run(GTK_DIALOG(window));
65
66     switch(result){
67         case GTK_RESPONSE_YES:
68             #if 0
69             if (hildon_button_get_value(HILDON_BUTTON (theme_button))){
70                 if (priv->theme)
71                     g_free(priv->theme);
72                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Berlin")))
73                     priv->theme = g_strdup("Berlin");
74                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Modern")))
75                     priv->theme = g_strdup("Modern");
76                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Matrix")))
77                     priv->theme = g_strdup("Matrix");
78                 if (hildon_check_button_get_active (rich_animation_button))
79                     priv->rich_animation = TRUE;
80                 else
81                     priv->rich_animation = FALSE;
82             }
83             save_config(priv);
84             reload_scene(priv->desktop_plugin);
85             #endif
86             //fprintf(stderr, "click save %s\n", hildon_button_get_value(HILDON_BUTTON(theme_button)));
87             fprintf(stderr, "click save \n");
88         break;
89         default:
90         case GTK_RESPONSE_OK:
91         break;
92         case GTK_RESPONSE_NO:
93             fprintf(stderr, "click about\n");
94             gtk_widget_destroy(window);
95             window = NULL;
96             //lw_about();
97         break;
98     }
99     //if (window)
100       //  gtk_widget_destroy(window);
101     //}
102     }
103 #endif
104     fprintf(stderr,"start fdf\n");
105         gtk_main();
106     return 0;
107 }