started to do desktop application with settings
authortanya <tanya@tanin.oblgaz>
Thu, 22 Apr 2010 13:43:39 +0000 (16:43 +0300)
committertanya <tanya@tanin.oblgaz>
Thu, 22 Apr 2010 13:43:39 +0000 (16:43 +0300)
applet/data/theme/Matrix/town0_right_corner.png [deleted file]
applet/src/Makefile.am
applet/src/livewp-home-widget.c
applet/src/livewp-main.c [new file with mode: 0644]
applet/src/livewp-settings.c
applet/src/livewp-settings.h

diff --git a/applet/data/theme/Matrix/town0_right_corner.png b/applet/data/theme/Matrix/town0_right_corner.png
deleted file mode 100644 (file)
index 48335fe..0000000
Binary files a/applet/data/theme/Matrix/town0_right_corner.png and /dev/null differ
index 3df4273..a3590cf 100644 (file)
@@ -1,9 +1,24 @@
+SOURCE_FILES = livewp-main.c \
+              livewp-home-widget.c livewp-home-widget.h \
+              livewp-astro.c livewp-astro.h \
+              livewp-rules.c livewp-rules.h \
+              livewp-settings.c livewp-settings.h livewp-common.h \
+              livewp-config.c livewp-config.h
+
+bin_PROGRAMS = livewp
+livewp_SOURCES = $(SOURCE_FILES)
+
+livewp_CFLAGS = -Wall $(EXAMPLE_CFLAGS)
+
+livewp_LDADD = $(EXAMPLE_LIBS)
+
 # We invent desktoplib_LTLIBRARIES instead of the normal lib_LTLIBRARIES,
 # so we can specify the non-standard installation directory.
 desktoplib_LTLIBRARIES =  liblivewp-home-widget.la
 desktoplibdir = $(HILDON_DESKTOP_LIB_DIR)
 
-liblivewp_home_widget_la_SOURCES = livewp-home-widget.c livewp-home-widget.h \
+liblivewp_home_widget_la_SOURCES = livewp-main.c \
+                                  livewp-home-widget.c livewp-home-widget.h \
                                   livewp-astro.c livewp-astro.h \
                                   livewp-rules.c livewp-rules.h \
                                   livewp-settings.c livewp-settings.h livewp-common.h \
index b4bd3d4..57aef46 100644 (file)
@@ -773,7 +773,7 @@ init_scene2(AWallpaperPlugin *desktop_plugin)
                       TRUE, 100, 255, NULL, NULL);
   scene.actors = g_slist_append(scene.actors, actor);
 
-  actor = init_object(desktop_plugin, "symbols", "symbols_without.png", 
+  actor = init_object(desktop_plugin, "symbols", "symbols.png", 
                       0, 0, 10, 800, 480, 
                       TRUE, 100, 255, NULL, NULL);
   scene.actors = g_slist_append(scene.actors, actor);
diff --git a/applet/src/livewp-main.c b/applet/src/livewp-main.c
new file mode 100644 (file)
index 0000000..eb6d6d9
--- /dev/null
@@ -0,0 +1,81 @@
+/* vim: set sw=4 ts=4 et: */
+/*
+ * This file is part of Live Wallpaper (livewp)
+ * 
+ * Copyright (C) 2010 Vlad Vasiliev
+ * Copyright (C) 2010 Tanya Makova
+ *       for the code
+ * 
+ * This software is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+*/
+/*******************************************************************************/
+#include "livewp-settings.h"
+/*******************************************************************************/
+
+int
+main(int argc, char *argv[])
+{
+    GtkWidget *window;
+    gint result;
+
+    gtk_init(&argc, &argv);
+
+    window = create_settings();
+    if (window){
+        //gtk_widget_show_all(window);
+        
+        result = gtk_dialog_run(GTK_DIALOG(window));
+
+    switch(result){
+        case GTK_RESPONSE_YES:
+            #if 0
+            if (hildon_button_get_value(HILDON_BUTTON (theme_button))){
+                if (priv->theme)
+                    g_free(priv->theme);
+                if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Berlin")))
+                    priv->theme = g_strdup("Berlin");
+                if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Modern")))
+                    priv->theme = g_strdup("Modern");
+                if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Matrix")))
+                    priv->theme = g_strdup("Matrix");
+                if (hildon_check_button_get_active (rich_animation_button))
+                    priv->rich_animation = TRUE;
+                else
+                    priv->rich_animation = FALSE;
+            }
+            save_config(priv);
+            reload_scene(priv->desktop_plugin);
+            #endif
+            //fprintf(stderr, "click save %s\n", hildon_button_get_value(HILDON_BUTTON(theme_button)));
+            fprintf(stderr, "click save \n");
+        break;
+        default:
+        case GTK_RESPONSE_OK:
+        break;
+        case GTK_RESPONSE_NO:
+            fprintf(stderr, "click about\n");
+            gtk_widget_destroy(window);
+            window = NULL;
+            //lw_about();
+        break;
+    }
+    //if (window)
+      //  gtk_widget_destroy(window);
+    //}
+    }
+        gtk_main();
+    return 0;
+}
index ae6bb03..be92f13 100644 (file)
@@ -160,3 +160,65 @@ lw_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv){
     if (window)
         gtk_widget_destroy(window);
 }
+
+GtkWidget* 
+create_settings(void){
+    gint result;
+    GtkWidget *window = NULL;
+    GtkWidget *save_button;
+    GtkWidget *theme_button;
+    GtkWidget *rich_animation_button;
+
+    window = gtk_dialog_new();
+    gtk_window_set_title(GTK_WINDOW(window), _("Live Wallpaper Settings"));
+    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
+    gtk_window_set_modal(GTK_WINDOW(window), TRUE);
+    /* Create Theme button */
+    theme_button = create_themes_button("Modern");
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
+                                   theme_button, TRUE, TRUE, 5);
+    /* Create rich animation button */  
+    rich_animation_button = create_rich_animation_button(TRUE);
+    gtk_box_pack_start(GTK_BOX(GTK_DIALOG(window)->vbox),
+                                   rich_animation_button, TRUE, TRUE, 5);
+    gtk_widget_show (theme_button);
+    gtk_widget_show (rich_animation_button);
+    gtk_widget_show (window);
+    gtk_dialog_add_button(GTK_DIALOG(window), _("About"), GTK_RESPONSE_NO);
+    save_button = gtk_dialog_add_button(GTK_DIALOG(window), _("Save"), GTK_RESPONSE_YES);
+#if 0
+    result = gtk_dialog_run(GTK_DIALOG(window));
+
+    switch(result){
+        case GTK_RESPONSE_YES:
+            if (hildon_button_get_value(HILDON_BUTTON (theme_button))){
+                if (priv->theme)
+                    g_free(priv->theme);
+                if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Berlin")))
+                    priv->theme = g_strdup("Berlin");
+                if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Modern")))
+                    priv->theme = g_strdup("Modern");
+                if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Matrix")))
+                    priv->theme = g_strdup("Matrix");
+                if (hildon_check_button_get_active (rich_animation_button))
+                    priv->rich_animation = TRUE;
+                else
+                    priv->rich_animation = FALSE;
+            }
+            save_config(priv);
+            reload_scene(priv->desktop_plugin);
+        break;
+        default:
+        case GTK_RESPONSE_OK:
+        break;
+        case GTK_RESPONSE_NO:
+            gtk_widget_destroy(window);
+            window = NULL;
+            lw_about();
+        break;
+    }
+    if (window)
+        gtk_widget_destroy(window);
+#endif
+    return window;
+}
index e65c1e4..19ec23a 100644 (file)
@@ -26,4 +26,5 @@
 void lw_settings(GtkWidget *widget, Animation_WallpaperPrivate *priv);
 void save_config(Animation_WallpaperPrivate *priv);
 void reload_scene(AWallpaperPlugin *desktop_plugin);
+GtkWidget* create_settings(void);