fixed gcc warnings
[livewp] / applet / src / livewp-config.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-config.h"
26 /*******************************************************************************/
27 gint 
28 read_config(Animation_WallpaperPrivate *priv) {
29
30     GConfClient *gconf_client = NULL;
31     gchar *tmp = NULL;
32
33     gconf_client = gconf_client_get_default();
34     if (!gconf_client) {
35         fprintf(stderr, _("Failed to initialize GConf. Quitting.\n"));
36         return -1;
37     }
38     /* get Theme default Modern */
39     tmp = gconf_client_get_string(gconf_client,
40                                   GCONF_KEY_THEME, NULL);
41     if (tmp){
42         priv->theme = tmp;
43     }else
44         priv->theme = g_strdup("Modern");
45
46     return 0;
47 }
48
49 /*******************************************************************************/
50 void
51 save_config(Animation_WallpaperPrivate *priv) {
52
53     GConfClient *gconf_client;
54     gconf_client = gconf_client_get_default();
55     if (!gconf_client) {
56         fprintf(stderr, _("Failed to initialize GConf. Quitting.\n"));
57         return;
58     }
59     /* Save Weather source name. */
60     if (priv->theme)
61         gconf_client_set_string(gconf_client,
62                   GCONF_KEY_THEME,
63                   priv->theme, NULL);
64 }