added button in 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     GtkWidget *button, *vbox;
35     gint result;
36     HildonProgram       *app;
37     osso_context_t  *osso_context=NULL;
38
39 #ifdef ENABLE_NLS
40     setlocale(LC_ALL, "");
41     bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
42     bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
43     textdomain(GETTEXT_PACKAGE);
44 #endif
45     hildon_gtk_init (&argc, &argv);
46     app = HILDON_PROGRAM (hildon_program_get_instance());
47     g_set_application_name (PACKAGE);
48  
49     osso_context = osso_initialize("org.maemo.livewp", VERSION, TRUE, NULL);
50     if(!osso_context){
51         fprintf(stderr,"osso_initialize failed\n");
52         return 1;
53     }
54
55
56
57     main_widget = hildon_stackable_window_new ();
58     gtk_window_set_title(GTK_WINDOW(main_widget), PACKAGE);
59
60     vbox = gtk_vbox_new(FALSE, 5);
61     button = hildon_button_new(HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT,
62                                HILDON_BUTTON_ARRANGEMENT_HORIZONTAL);
63     hildon_button_set_text(HILDON_BUTTON(button), "кнопка", "");
64     //gtk_container_add(GTK_CONTAINER(main_widget), button);
65     gtk_box_pack_start(vbox, button, FALSE, FALSE, 0);
66     gtk_container_add(GTK_CONTAINER(main_widget), vbox);
67
68     hildon_program_add_window(app, HILDON_WINDOW(main_widget));
69
70     gtk_widget_show_all(GTK_WIDGET(main_widget));
71 #if 0
72     window = create_settings();
73     if (window){
74         //gtk_widget_show_all(window);
75         
76         result = gtk_dialog_run(GTK_DIALOG(window));
77
78     switch(result){
79         case GTK_RESPONSE_YES:
80             #if 0
81             if (hildon_button_get_value(HILDON_BUTTON (theme_button))){
82                 if (priv->theme)
83                     g_free(priv->theme);
84                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Berlin")))
85                     priv->theme = g_strdup("Berlin");
86                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Modern")))
87                     priv->theme = g_strdup("Modern");
88                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Matrix")))
89                     priv->theme = g_strdup("Matrix");
90                 if (hildon_check_button_get_active (rich_animation_button))
91                     priv->rich_animation = TRUE;
92                 else
93                     priv->rich_animation = FALSE;
94             }
95             save_config(priv);
96             reload_scene(priv->desktop_plugin);
97             #endif
98             //fprintf(stderr, "click save %s\n", hildon_button_get_value(HILDON_BUTTON(theme_button)));
99             fprintf(stderr, "click save \n");
100         break;
101         default:
102         case GTK_RESPONSE_OK:
103         break;
104         case GTK_RESPONSE_NO:
105             fprintf(stderr, "click about\n");
106             gtk_widget_destroy(window);
107             window = NULL;
108             //lw_about();
109         break;
110     }
111     //if (window)
112       //  gtk_widget_destroy(window);
113     //}
114     }
115 #endif
116     fprintf(stderr,"start fdf\n");
117         gtk_main();
118     return 0;
119 }