1 /* vim: set sw=4 ts=4 et: */
3 * This file is part of Live Wallpaper (livewp)
5 * Copyright (C) 2010 Vlad Vasiliev
6 * Copyright (C) 2010 Tanya Makova
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.
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.
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
24 /*******************************************************************************/
25 #include "livewp-common.h"
26 #include "livewp-settings.h"
27 /*******************************************************************************/
30 btn_setting_clicked(HildonButton *btn, gpointer data)
32 Animation_WallpaperPrivate *priv = data;
33 // open settings dialog
34 fprintf(stderr, "btn setting clicked, %s\n", priv->theme);
35 lw_settings(priv, NULL);
36 fprintf(stderr, "btn setting clicked, %s\n", priv->theme);
39 btn_power_clicked(HildonButton *btn, gpointer data)
42 value = hildon_button_get_value(btn);
43 fprintf(stderr, "applet must be %s\n", value);
44 if (!strcmp(value, "stop"))
45 hildon_button_set_text(HILDON_BUTTON(btn), _("Start"), "start");
47 hildon_button_set_text(HILDON_BUTTON(btn), _("Stop"), "stop");
50 main(int argc, char *argv[])
52 GtkWidget *main_widget = NULL;
54 GtkWidget *btn_setting, *vbox, *btn_power;
58 Animation_WallpaperPrivate *priv = g_new0 (Animation_WallpaperPrivate, 1);
61 setlocale(LC_ALL, "");
62 bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
63 bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
64 textdomain(GETTEXT_PACKAGE);
67 hildon_gtk_init (&argc, &argv);
68 app = HILDON_PROGRAM (hildon_program_get_instance());
69 g_set_application_name (PACKAGE);
71 priv->osso = osso_initialize("org.maemo.livewp", VERSION, TRUE, NULL);
73 fprintf(stderr,"osso_initialize failed\n");
81 livewp_initialize_dbus(priv);
84 main_widget = hildon_stackable_window_new ();
85 gtk_window_set_title(GTK_WINDOW(main_widget), PACKAGE);
87 vbox = gtk_vbox_new(FALSE, 5);
88 btn_setting = hildon_button_new(HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT,
89 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL);
90 hildon_button_set_text(HILDON_BUTTON(btn_setting), _("Settings"), "");
91 g_signal_connect(btn_setting, "clicked", G_CALLBACK(btn_setting_clicked), priv);
92 //gtk_container_add(GTK_CONTAINER(main_widget), button);
93 gtk_box_pack_start(vbox, btn_setting, FALSE, FALSE, 0);
95 btn_power = hildon_button_new(HILDON_SIZE_AUTO_WIDTH | HILDON_SIZE_FINGER_HEIGHT,
96 HILDON_BUTTON_ARRANGEMENT_HORIZONTAL);
97 if (1)/* if applet started*/{
98 hildon_button_set_text(HILDON_BUTTON(btn_power), _("Stop"), "stop");
101 hildon_button_set_text(HILDON_BUTTON(btn_power), _("Start"), "start");
103 g_signal_connect(btn_power, "clicked", G_CALLBACK(btn_power_clicked), priv);
104 //gtk_container_add(GTK_CONTAINER(main_widget), button);
105 gtk_box_pack_start(vbox, btn_power, FALSE, FALSE, 0);
107 gtk_container_add(GTK_CONTAINER(main_widget), vbox);
109 g_signal_connect(main_widget, "destroy", G_CALLBACK(gtk_main_quit), NULL);
110 hildon_program_add_window(app, HILDON_WINDOW(main_widget));
112 gtk_widget_show_all(GTK_WIDGET(main_widget));