annotate src/statusicon/si.c @ 3193:93cf4d0a0dde

alsa-ng: Prefer "PCM" volume control over "Wave" on systems that have both, for consistency with OSS plugin and maybe other apps (closes AUD-34 and AUD-36).
author John Lindgren <john.lindgren@tds.net>
date Mon, 29 Jun 2009 23:05:56 -0400
parents 3134a0987162
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
1 /*
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
2 *
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
3 * Author: Giacomo Lozito <james@develia.org>, (C) 2005-2007
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
4 *
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify it
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
6 * under the terms of the GNU General Public License as published by the
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
7 * Free Software Foundation; either version 2 of the License, or (at your
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
8 * option) any later version.
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
9 *
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful, but
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
13 * General Public License for more details.
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
14 *
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License along
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
16 * with this program; if not, write to the Free Software Foundation, Inc.,
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
18 *
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
19 */
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
20
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
21 #include "si.h"
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
22 #include "si_ui.h"
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
23 #include "si_audacious.h"
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
24 #include "si_cfg.h"
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
25 #include "si_common.h"
2971
3134a0987162 - changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2499
diff changeset
26 #include <audlegacy/auddrct.h>
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
27
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
28
1116
86578452bcd1 [svn] - statusicon: converted to v2 plugin system
giacomo
parents: 1022
diff changeset
29 GeneralPlugin *statusicon_gplist[] = { &si_gp, NULL };
1657
61f1f017e847 fix statusicon plugin
mf0102 <0102@gmx.at>
parents: 1395
diff changeset
30 SIMPLE_GENERAL_PLUGIN(statusicon, statusicon_gplist);
1116
86578452bcd1 [svn] - statusicon: converted to v2 plugin system
giacomo
parents: 1022
diff changeset
31
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
32 static gboolean plugin_active = FALSE;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
33
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
34 extern si_cfg_t si_cfg;
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
35
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
36
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
37 /* ***************** */
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
38 /* plug-in functions */
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
39
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
40 void
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
41 si_init ( void )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
42 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
43 g_type_init();
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
44 g_log_set_handler( NULL , G_LOG_LEVEL_WARNING , g_log_default_handler , NULL );
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
45 plugin_active = TRUE;
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
46 si_cfg_load();
795
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 453
diff changeset
47 si_ui_statusicon_enable( TRUE );
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
48 return;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
49 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
50
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
51
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
52 void
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
53 si_cleanup ( void )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
54 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
55 if ( plugin_active == TRUE )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
56 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
57 plugin_active = FALSE;
795
ca6dca840074 [svn] - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
giacomo
parents: 453
diff changeset
58 si_ui_statusicon_enable( FALSE );
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
59 si_cfg_save(); /* required to save windows visibility status */
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
60 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
61 return;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
62 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
63
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
64
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
65 void
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
66 si_prefs ( void )
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
67 {
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
68 si_ui_prefs_show();
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
69 }
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
70
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
71
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
72 void
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
73 si_about ( void )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
74 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
75 si_ui_about_show();
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
76 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
77
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
78
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
79
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
80 /* ***************** */
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
81 /* audacious actions */
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
82
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
83
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
84 void
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
85 si_audacious_toggle_visibility ( void )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
86 {
914
d12d27887bf0 [svn] - statusicon: smarter show/hide on statusicon click (plugin will now correctly handle the situation where the player window is always hidden and the playlist window should be shown/hidden)
giacomo
parents: 855
diff changeset
87 /* use the window visibility status to toggle show/hide
d12d27887bf0 [svn] - statusicon: smarter show/hide on statusicon click (plugin will now correctly handle the situation where the player window is always hidden and the playlist window should be shown/hidden)
giacomo
parents: 855
diff changeset
88 (if at least one is visible, hide) */
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
89 if (( audacious_drct_main_win_is_visible() == TRUE ) ||
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
90 ( audacious_drct_eq_win_is_visible() == TRUE ) ||
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
91 ( audacious_drct_pl_win_is_visible() == TRUE ))
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
92 {
914
d12d27887bf0 [svn] - statusicon: smarter show/hide on statusicon click (plugin will now correctly handle the situation where the player window is always hidden and the playlist window should be shown/hidden)
giacomo
parents: 855
diff changeset
93 /* remember the visibility status of the player windows */
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
94 si_cfg.mw_visib_prevstatus = audacious_drct_main_win_is_visible();
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
95 si_cfg.ew_visib_prevstatus = audacious_drct_eq_win_is_visible();
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
96 si_cfg.pw_visib_prevstatus = audacious_drct_pl_win_is_visible();
914
d12d27887bf0 [svn] - statusicon: smarter show/hide on statusicon click (plugin will now correctly handle the situation where the player window is always hidden and the playlist window should be shown/hidden)
giacomo
parents: 855
diff changeset
97 /* now hide all of them */
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
98 if ( si_cfg.mw_visib_prevstatus == TRUE )
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
99 audacious_drct_main_win_toggle( FALSE );
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
100 if ( si_cfg.ew_visib_prevstatus == TRUE )
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
101 audacious_drct_eq_win_toggle( FALSE );
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
102 if ( si_cfg.pw_visib_prevstatus == TRUE )
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
103 audacious_drct_pl_win_toggle( FALSE );
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
104 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
105 else
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
106 {
914
d12d27887bf0 [svn] - statusicon: smarter show/hide on statusicon click (plugin will now correctly handle the situation where the player window is always hidden and the playlist window should be shown/hidden)
giacomo
parents: 855
diff changeset
107 /* show the windows that were visible before */
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
108 if ( si_cfg.mw_visib_prevstatus == TRUE )
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
109 audacious_drct_main_win_toggle( TRUE );
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
110 if ( si_cfg.ew_visib_prevstatus == TRUE )
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
111 audacious_drct_eq_win_toggle( TRUE );
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
112 if ( si_cfg.pw_visib_prevstatus == TRUE )
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
113 audacious_drct_pl_win_toggle( TRUE );
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
114 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
115 }
453
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 433
diff changeset
116
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 433
diff changeset
117 void
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 433
diff changeset
118 si_audacious_volume_change ( gint value )
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 433
diff changeset
119 {
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 433
diff changeset
120 gint vl, vr;
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
121 audacious_drct_get_volume( &vl , &vr );
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
122 audacious_drct_set_volume( CLAMP(vl + value, 0, 100) , CLAMP(vr + value, 0, 100) );
453
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 433
diff changeset
123 }
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
124
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
125 void
962
9f0ac3bb82f4 [svn] - statusicon: added support for quit button in smallmenu; also, the field is being prepared for customizable smallmenu entries
giacomo
parents: 918
diff changeset
126 si_audacious_quit ( void )
9f0ac3bb82f4 [svn] - statusicon: added support for quit button in smallmenu; also, the field is being prepared for customizable smallmenu entries
giacomo
parents: 918
diff changeset
127 {
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
128 audacious_drct_quit();
962
9f0ac3bb82f4 [svn] - statusicon: added support for quit button in smallmenu; also, the field is being prepared for customizable smallmenu entries
giacomo
parents: 918
diff changeset
129 }
9f0ac3bb82f4 [svn] - statusicon: added support for quit button in smallmenu; also, the field is being prepared for customizable smallmenu entries
giacomo
parents: 918
diff changeset
130
9f0ac3bb82f4 [svn] - statusicon: added support for quit button in smallmenu; also, the field is being prepared for customizable smallmenu entries
giacomo
parents: 918
diff changeset
131 void
918
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
132 si_audacious_playback_skip ( gint numsong )
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
133 {
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
134 gpointer ctrl_code_gp = NULL;
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
135 gint i = 0;
962
9f0ac3bb82f4 [svn] - statusicon: added support for quit button in smallmenu; also, the field is being prepared for customizable smallmenu entries
giacomo
parents: 918
diff changeset
136
918
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
137 if ( numsong >= 0 )
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
138 {
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
139 ctrl_code_gp = GINT_TO_POINTER(SI_AUDACIOUS_PLAYBACK_CTRL_NEXT);
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
140 }
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
141 else
962
9f0ac3bb82f4 [svn] - statusicon: added support for quit button in smallmenu; also, the field is being prepared for customizable smallmenu entries
giacomo
parents: 918
diff changeset
142 {
918
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
143 ctrl_code_gp = GINT_TO_POINTER(SI_AUDACIOUS_PLAYBACK_CTRL_PREV);
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
144 numsong *= -1;
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
145 }
962
9f0ac3bb82f4 [svn] - statusicon: added support for quit button in smallmenu; also, the field is being prepared for customizable smallmenu entries
giacomo
parents: 918
diff changeset
146
918
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
147 for ( i = 0 ; i < numsong ; i++ )
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
148 si_audacious_playback_ctrl( ctrl_code_gp );
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
149 }
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
150
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
151 void
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
152 si_audacious_playback_ctrl ( gpointer ctrl_code_gp )
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
153 {
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
154 gint ctrl_code = GPOINTER_TO_INT(ctrl_code_gp);
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
155 switch ( ctrl_code )
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
156 {
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
157 case SI_AUDACIOUS_PLAYBACK_CTRL_PREV:
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
158 audacious_drct_pl_prev();
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
159 break;
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
160
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
161 case SI_AUDACIOUS_PLAYBACK_CTRL_PLAY:
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
162 audacious_drct_play();
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
163 break;
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
164
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
165 case SI_AUDACIOUS_PLAYBACK_CTRL_PAUSE:
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
166 audacious_drct_pause();
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
167 break;
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
168
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
169 case SI_AUDACIOUS_PLAYBACK_CTRL_STOP:
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
170 audacious_drct_stop();
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
171 break;
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
172
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
173 case SI_AUDACIOUS_PLAYBACK_CTRL_NEXT:
1022
e3beb4b76591 [svn] - statusicon: works again with auddrct
giacomo
parents: 962
diff changeset
174 audacious_drct_pl_next();
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
175 break;
855
fbf1f593b0c6 [svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents: 854
diff changeset
176
fbf1f593b0c6 [svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents: 854
diff changeset
177 case SI_AUDACIOUS_PLAYBACK_CTRL_EJECT:
2074
William Pitcock <nenolod@atheme.org>
parents: 1657
diff changeset
178 audacious_drct_eject();
855
fbf1f593b0c6 [svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents: 854
diff changeset
179 break;
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
180 }
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
181 }
2167
d44adaddae8b applied a patch from Igor Stirbu, middleclick on SI toggles play/pause
Cristi Magherusan <majeru@atheme-project.org>
parents: 2074
diff changeset
182
d44adaddae8b applied a patch from Igor Stirbu, middleclick on SI toggles play/pause
Cristi Magherusan <majeru@atheme-project.org>
parents: 2074
diff changeset
183 void
d44adaddae8b applied a patch from Igor Stirbu, middleclick on SI toggles play/pause
Cristi Magherusan <majeru@atheme-project.org>
parents: 2074
diff changeset
184 si_audacious_toggle_playback ( void )
d44adaddae8b applied a patch from Igor Stirbu, middleclick on SI toggles play/pause
Cristi Magherusan <majeru@atheme-project.org>
parents: 2074
diff changeset
185 {
d44adaddae8b applied a patch from Igor Stirbu, middleclick on SI toggles play/pause
Cristi Magherusan <majeru@atheme-project.org>
parents: 2074
diff changeset
186 if ( audacious_drct_get_playing() )
d44adaddae8b applied a patch from Igor Stirbu, middleclick on SI toggles play/pause
Cristi Magherusan <majeru@atheme-project.org>
parents: 2074
diff changeset
187 audacious_drct_pause();
d44adaddae8b applied a patch from Igor Stirbu, middleclick on SI toggles play/pause
Cristi Magherusan <majeru@atheme-project.org>
parents: 2074
diff changeset
188 else
d44adaddae8b applied a patch from Igor Stirbu, middleclick on SI toggles play/pause
Cristi Magherusan <majeru@atheme-project.org>
parents: 2074
diff changeset
189 audacious_drct_play();
d44adaddae8b applied a patch from Igor Stirbu, middleclick on SI toggles play/pause
Cristi Magherusan <majeru@atheme-project.org>
parents: 2074
diff changeset
190 }