annotate src/statusicon/si_cfg.c @ 3085:ac0af6b39272

Introduce new GIO plugin to buildsystem. stdio is now deprecated. Thoughts: - getc()/ungetc() should be moved to VFS core now
author William Pitcock <nenolod@atheme.org>
date Wed, 29 Apr 2009 20:58:36 -0500
parents 3134a0987162
children
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"
2971
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2523
diff changeset
23 #include <audlegacy/plugin.h>
857
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 {
2523
769e17da93dd Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents: 2499
diff changeset
31 mcs_handle_t *cfgfile = aud_cfg_db_open();
857
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
32
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1975
diff changeset
33 if ( !aud_cfg_db_get_int( cfgfile , "statusicon" ,
857
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;
918
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
36
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1975
diff changeset
37 if ( !aud_cfg_db_get_int( cfgfile , "statusicon" ,
918
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
38 "scroll_action" , &(si_cfg.scroll_action) ) )
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
39 si_cfg.scroll_action = SI_CFG_SCROLL_ACTION_VOLUME;
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 857
diff changeset
40
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1975
diff changeset
41 if ( !aud_cfg_db_get_bool( cfgfile , "statusicon" ,
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 857
diff changeset
42 "mw_visib_prevstatus" , &(si_cfg.mw_visib_prevstatus) ) )
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 857
diff changeset
43 si_cfg.mw_visib_prevstatus = FALSE;
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1975
diff changeset
44 if ( !aud_cfg_db_get_bool( cfgfile , "statusicon" ,
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 857
diff changeset
45 "pw_visib_prevstatus" , &(si_cfg.pw_visib_prevstatus) ) )
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 857
diff changeset
46 si_cfg.pw_visib_prevstatus = FALSE;
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1975
diff changeset
47 if ( !aud_cfg_db_get_bool( cfgfile , "statusicon" ,
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 857
diff changeset
48 "ew_visib_prevstatus" , &(si_cfg.ew_visib_prevstatus) ) )
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 857
diff changeset
49 si_cfg.ew_visib_prevstatus = FALSE;
2425
ced4a5392948 made status plugin use the main mouse wheel setting when changing the volume
Cristi Magherusan <majeru@atheme.org>
parents: 2124
diff changeset
50 if ( !aud_cfg_db_get_int( cfgfile , "audacious" ,
ced4a5392948 made status plugin use the main mouse wheel setting when changing the volume
Cristi Magherusan <majeru@atheme.org>
parents: 2124
diff changeset
51 "mouse_wheel_change" , &(si_cfg.volume_delta) ) )
ced4a5392948 made status plugin use the main mouse wheel setting when changing the volume
Cristi Magherusan <majeru@atheme.org>
parents: 2124
diff changeset
52 si_cfg.volume_delta = 5;
857
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
53
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1975
diff changeset
54 aud_cfg_db_close( cfgfile );
857
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
55 return;
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
56 }
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
57
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
58
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
59 void
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
60 si_cfg_save ( void )
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
61 {
2523
769e17da93dd Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents: 2499
diff changeset
62 mcs_handle_t *cfgfile = aud_cfg_db_open();
857
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
63
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1975
diff changeset
64 aud_cfg_db_set_int( cfgfile , "statusicon" ,
857
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
65 "rclick_menu" , si_cfg.rclick_menu );
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 857
diff changeset
66
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1975
diff changeset
67 aud_cfg_db_set_int( cfgfile , "statusicon" ,
918
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
68 "scroll_action" , si_cfg.scroll_action );
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
69
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1975
diff changeset
70 aud_cfg_db_set_bool( cfgfile , "statusicon" ,
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 857
diff changeset
71 "mw_visib_prevstatus" , si_cfg.mw_visib_prevstatus );
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1975
diff changeset
72 aud_cfg_db_set_bool( cfgfile , "statusicon" ,
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 857
diff changeset
73 "pw_visib_prevstatus" , si_cfg.pw_visib_prevstatus );
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1975
diff changeset
74 aud_cfg_db_set_bool( cfgfile , "statusicon" ,
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 857
diff changeset
75 "ew_visib_prevstatus" , si_cfg.ew_visib_prevstatus );
857
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
76
2124
b8da6a0b0da2 s/bmp_cfg_/aud_cfg_/g
Matti Hamalainen <ccr@tnsp.org>
parents: 1975
diff changeset
77 aud_cfg_db_close( cfgfile );
857
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
78 return;
bad7c89d7ba0 [svn] statusicon: add missing files
giacomo
parents:
diff changeset
79 }