annotate src/statusicon/si_cfg.c @ 876:04a56ecc9442 trunk

[svn] statusicon: do not behave strangely (or crash) when the plugin is loaded/unloaded multiple times
author giacomo
date Sun, 18 Mar 2007 16:21:10 -0700
parents bad7c89d7ba0
children 1ccc7a9c7fc2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
857
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
1 /*
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
2 *
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
3 * Author: Giacomo Lozito <james@develia.org>, (C) 2005-2007
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
4 *
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify it
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
6 * under the terms of the GNU General Public License as published by the
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
7 * Free Software Foundation; either version 2 of the License, or (at your
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
8 * option) any later version.
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
9 *
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful, but
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
13 * General Public License for more details.
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
14 *
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License along
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
16 * with this program; if not, write to the Free Software Foundation, Inc.,
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
18 *
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
19 */
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
20
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
21 #include "si_cfg.h"
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
22 #include "si_common.h"
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
23 #include <audacious/configdb.h>
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
24
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
25 si_cfg_t si_cfg;
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
26
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
27
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
28 void
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
29 si_cfg_load ( void )
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
30 {
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
31 ConfigDb *cfgfile = bmp_cfg_db_open();
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
32
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
33 if ( !bmp_cfg_db_get_int( cfgfile , "statusicon" ,
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
34 "rclick_menu" , &(si_cfg.rclick_menu) ) )
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
35 si_cfg.rclick_menu = SI_CFG_RCLICK_MENU_AUD;
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
36
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
37 bmp_cfg_db_close( cfgfile );
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
38 return;
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
39 }
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
40
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
41
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
42 void
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
43 si_cfg_save ( void )
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
44 {
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
45 ConfigDb *cfgfile = bmp_cfg_db_open();
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
46
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
47 bmp_cfg_db_set_int( cfgfile , "statusicon" ,
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
48 "rclick_menu" , si_cfg.rclick_menu );
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
49
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
50 bmp_cfg_db_close( cfgfile );
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
51 return;
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
52 }