started done external themes
authortanya <tanyshk@gmail.com>
Fri, 6 Aug 2010 12:55:55 +0000 (15:55 +0300)
committertanya <tanyshk@gmail.com>
Fri, 6 Aug 2010 12:55:55 +0000 (15:55 +0300)
applet/data/Makefile.am
applet/data/external_themes/xsnow.xml [new file with mode: 0644]
applet/debian/changelog
applet/src/Makefile.am
applet/src/livewp-common.h
applet/src/livewp-exthemes.c [new file with mode: 0644]
applet/src/livewp-exthemes.h [new file with mode: 0644]
applet/src/livewp-settings.c
applet/src/livewp-settings.h

index 80d5a6c..47ebcbe 100644 (file)
@@ -37,6 +37,9 @@ videotheme_DATA = theme/Video/*
 xsnowthemedir = $(datadir)/livewp/theme/Xsnow
 xsnowtheme_DATA = theme/Xsnow/* 
 
+externalthemedir = $(datadir)/livewp/external_themes
+externaltheme_DATA = external_themes/* 
+
 dbus_servicedir = $(datadir)/dbus-1/services
 dbus_service_DATA = org.maemo.livewp.service
 
@@ -71,6 +74,7 @@ EXTRA_DIST = $(berlintheme_DATA) \
             $(acceltheme_DATA) \
             $(videotheme_DATA) \
             $(xshowtheme_DATA) \
+            $(externaltheme_DATA) \
             $(dbus_service_DATA)
 
 
diff --git a/applet/data/external_themes/xsnow.xml b/applet/data/external_themes/xsnow.xml
new file mode 100644 (file)
index 0000000..3fd9f58
--- /dev/null
@@ -0,0 +1,4 @@
+<theme>
+    <name>Xsnow</name>
+    <exec_path>/usr/bin/xsnow</exec_path>
+</theme>
index cd3d29f..deb33d4 100644 (file)
@@ -1,3 +1,9 @@
+live-wallpaper (0.8) unstable; urgency=low
+
+  * New
+
+ -- Vlad Vasiliev <vlad@gas.by>  Thu, 03 Aug 2010 21:39:10 +0200
 live-wallpaper (0.7.1) unstable; urgency=low
 
   * Fixed problem in settings for non English locales 
index 22c6152..418c083 100644 (file)
@@ -6,6 +6,7 @@ SOURCE_FILES = livewp-main.c \
               livewp-config.c livewp-config.h \
               livewp-dbus.c livewp-dbus.h \
               livewp-actor.c livewp-actor.h \
+              livewp-exthemes.c livewp-exthemes.h \
               livewp-scene.c livewp-scene.h
 
 
@@ -33,7 +34,8 @@ panellib_LTLIBRARIES =  liblivewp-panel-widget.la
 panellibdir = $(HILDON_PANEL_LIB_DIR)
 
 liblivewp_panel_widget_la_SOURCES = livewp-settings.c livewp-settings.h livewp-common.h \
-                                  livewp-config.c livewp-config.h \
+                                      livewp-config.c livewp-config.h \
+                                      livewp-exthemes.c livewp-exthemes.h \
                                   livewp-control-widget.c livewp-control-widget.h \
                                   livewp-dbus.c livewp-dbus.h
 liblivewp_panel_widget_la_LIBADD = $(MAEMO_LIBS) $(OSSO_LIBS) $(CONTROLPANEL_LIBS)   
index 5693d3c..31422e3 100644 (file)
@@ -51,6 +51,7 @@
 #define Ystartposition 480 
 
 #define THEME_PATH "/usr/share/livewp/theme"
+#define EXTHEME_PATH "/usr/share/livewp/external_themes/"
 #define SHORT_TIMER 75 /* 100 milisecond */
 //#define LONG_TIMER 5*60*1000 /* 10 minutes */
 #define LONG_TIMER  20*1000 /* 20 seconds */
diff --git a/applet/src/livewp-exthemes.c b/applet/src/livewp-exthemes.c
new file mode 100644 (file)
index 0000000..7be0d39
--- /dev/null
@@ -0,0 +1,57 @@
+/* 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-exthemes.h"
+/*******************************************************************************/
+
+GHashTable  * 
+parse_theme(gchar *file){
+    GHashTable  *hash;
+    hash = g_hash_table_new(g_str_hash, g_str_equal);
+    g_hash_table_insert(hash, g_strdup("name"),  g_strdup("Xsnow"));
+    g_hash_table_insert(hash, g_strdup("exec_path"),  g_strdup("/usr/bin/xsnow"));
+    return hash;
+}
+
+GSList *
+get_list_exthemes(void){
+    Dirent  *dp;
+    DIR     *dir_fd;
+    GSList *store = NULL;
+    
+    dir_fd = opendir(EXTHEME_PATH);
+    if(dir_fd){
+
+        while((dp = readdir(dir_fd))){
+            
+            if(!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
+                continue;
+            if(dp->d_type == DT_REG || dp->d_type == DT_LNK){
+                store = g_slist_append(store, parse_theme(dp->d_name));
+            }
+        }
+        closedir(dir_fd);
+    }
+    return store;
+}
diff --git a/applet/src/livewp-exthemes.h b/applet/src/livewp-exthemes.h
new file mode 100644 (file)
index 0000000..94b36f0
--- /dev/null
@@ -0,0 +1,32 @@
+/* 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-common.h"
+#include <dirent.h>                                                                                                              
+#include <linux/fs.h>                                                                                                                    
+typedef struct dirent Dirent;
+/*******************************************************************************/
+
+GSList * get_list_exthemes(void);
+
index cf1e26a..76aa4e7 100644 (file)
@@ -34,7 +34,7 @@ void lw_about(void){
     gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
     gtk_window_set_modal(GTK_WINDOW(window), TRUE);
     vbox = gtk_vbox_new (FALSE, 5);
-    label_about = gtk_label_new (_("Live Wallpaper Version 0.7.1 \n Copyright(c) 2010\n \
+    label_about = gtk_label_new (_("Live Wallpaper Version 0.8 \n Copyright(c) 2010\n \
 Tanya Makova\n Vlad Vasiliev\n \
 Copyright(c) 2010 for design themes Berlin, Modern and Accel Vasya Bobrikov\n \
 Copyright(c) 2010 for design theme Matrix Andrew Zhilin\n \
@@ -55,17 +55,22 @@ Russian - Tanya Makova \n \
 /*******************************************************************************/
 GtkWidget *
 create_theme_selector (void){
-      GtkWidget *selector;
-
-      selector = hildon_touch_selector_new_text ();
+    GtkWidget *selector;
+    GSList * store = get_list_exthemes();
+          
+    selector = hildon_touch_selector_new_text ();
+
+    hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Berlin"));
+    hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Modern"));
+    hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Matrix"));
+    hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Accel"));
+    hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Video"));
+    while (store){  
+        hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), g_hash_table_lookup(store->data, "name"));
+        store = g_slist_next(store);
+    }
 
-      hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Berlin"));
-      hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Modern"));
-      hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Matrix"));
-      hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Accel"));
-      hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Video"));
-      hildon_touch_selector_append_text (HILDON_TOUCH_SELECTOR (selector), _("Xsnow"));
-      return selector;
+    return selector;
 }
 /*******************************************************************************/
 void
@@ -142,9 +147,6 @@ changed_value_theme_cb (HildonPickerButton *picker, Animation_WallpaperPrivate *
         if (!strcmp(choice, _("Matrix"))){
             rich_animation_additional_parametr(vbox,priv);
         }
-        if (!strcmp(choice, _("Xsnow"))){
-            rich_animation_additional_parametr(vbox,priv);
-        }
 
         if (!strcmp(choice, _("Accel"))){
             rich_animation_additional_parametr(vbox,priv);
@@ -189,10 +191,6 @@ create_themes_button (gchar *theme){
             hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 4);
             hildon_button_set_value(HILDON_BUTTON(button), _("Video"));
         }
-        if (!strcmp(theme, "Xsnow")){
-            hildon_touch_selector_set_active (HILDON_TOUCH_SELECTOR (selector), 0, 5);
-            hildon_button_set_value(HILDON_BUTTON(button), _("Xsnow"));
-        }
     }
     
     return button;
@@ -396,7 +394,6 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
     if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Berlin"))||
         !strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Matrix"))||
         !strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Accel"))||
-        !strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Xsnow"))||
         !strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Modern"))){
         rich_animation_additional_parametr(vbox, priv);
     }
@@ -438,8 +435,6 @@ lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv) {
                     priv->theme = g_strdup("Matrix");
                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Accel")))
                     priv->theme = g_strdup("Accel");
-                if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Xsnow")))
-                    priv->theme = g_strdup("Xsnow");
                 if (!strcmp(hildon_button_get_value(HILDON_BUTTON (theme_button)), _("Video"))){
                     priv->theme = g_strdup("Video");
                     button1 = g_object_get_data(G_OBJECT(priv->window), "filename_button");
index 2c66d3f..115c7e2 100644 (file)
@@ -23,6 +23,7 @@
 */
 /*******************************************************************************/
 #include "livewp-common.h"
+
 #include <hildon-fm-2/hildon/hildon-file-chooser-dialog.h>
 #include <unistd.h>
 void lw_main_settings(Animation_WallpaperPrivate *priv, gpointer data);
@@ -40,5 +41,5 @@ void lw_theme_settings(GtkWidget *button, Animation_WallpaperPrivate *priv);
 void theme_button_clicked(GtkButton *button, Animation_WallpaperPrivate *priv);
 void rich_animation_additional_parametr(GtkWidget *vbox, Animation_WallpaperPrivate *priv);
 void additional_parametr_for_theme_video(GtkWidget *vbox, Animation_WallpaperPrivate *priv);
-
+GSList * get_list_exthemes(void);