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-config.h"
26 /*******************************************************************************/
28 current_active_view(void){
29 GConfClient *gconf_client = NULL;
32 gconf_client = gconf_client_get_default();
34 fprintf(stderr, _("Failed to initialize GConf. Quitting.\n"));
37 result = gconf_client_get_int(gconf_client, "/apps/osso/hildon-desktop/views/current", NULL);
42 /*******************************************************************************/
45 fill_priv(Animation_WallpaperPrivate *priv)
50 if (!strcmp(priv->theme, "Accel"))
51 priv->scene_func = (gpointer)&init_scene_Accel;
52 if (!strcmp(priv->theme, "Berlin"))
53 priv->scene_func = (gpointer)&init_scene_Berlin;
54 if (!strcmp(priv->theme, "Modern"))
55 priv->scene_func = (gpointer)&init_scene_Modern;
56 if (!strcmp(priv->theme, "Matrix"))
57 priv->scene_func = (gpointer)&init_scene_Matrix;
58 if (!strcmp(priv->theme, "Video"))
59 priv->scene_func = (gpointer)&init_scene_Video;
61 priv->extheme_list = get_list_exthemes();
62 GSList *store = priv->extheme_list;
64 if (!strcmp(priv->theme, g_hash_table_lookup(store->data, "name"))){
65 priv->scene_func = (gpointer)&init_scene_External;
66 priv->hash_theme = store->data;
69 store = g_slist_next(store);
74 /*******************************************************************************/
76 read_config(Animation_WallpaperPrivate *priv) {
78 GConfClient *gconf_client = NULL;
80 GConfValue *value = NULL;
84 gconf_client = gconf_client_get_default();
86 fprintf(stderr, _("Failed to initialize GConf. Quitting.\n"));
89 /* get Theme default Modern */
90 str = g_strdup_printf("%s%i", GCONF_KEY_THEME, id);
91 tmp = gconf_client_get_string(gconf_client,
100 priv->theme = g_strdup("Modern");
101 /* get Rich animation default TRUE */
102 str = g_strdup_printf("%s%i", GCONF_KEY_RANIMATION, id);
103 value = gconf_client_get(gconf_client, str, NULL);
109 priv->rich_animation = gconf_value_get_bool(value);
110 gconf_value_free(value);
112 priv->rich_animation = TRUE;
113 /* get theme additional parameter 1 */
114 str = g_strdup_printf("%s%i", GCONF_KEY_ADDIONAL_STRING_1 , id);
115 value = gconf_client_get(gconf_client, str, NULL);
121 priv->theme_string_parametr1 = g_strdup(gconf_value_get_string(value));
122 gconf_value_free(value);
128 /*******************************************************************************/
130 save_config(Animation_WallpaperPrivate *priv) {
132 GConfClient *gconf_client;
134 gint id = priv->view;
136 gconf_client = gconf_client_get_default();
138 fprintf(stderr, _("Failed to initialize GConf. Quitting.\n"));
143 str = g_strdup_printf("%s%i", GCONF_KEY_THEME, id);
144 gconf_client_set_string(gconf_client,
153 str = g_strdup_printf("%s%i", GCONF_KEY_RANIMATION, id);
154 if (priv->rich_animation)
155 gconf_client_set_bool(gconf_client,
158 gconf_client_set_bool(gconf_client,
164 if (priv->theme_string_parametr1){
165 str = g_strdup_printf("%s%i",GCONF_KEY_ADDIONAL_STRING_1, id);
166 gconf_client_set_string(gconf_client,
168 priv->theme_string_parametr1, NULL);