annotate src/statusicon/si.c @ 962:9f0ac3bb82f4 trunk

[svn] - statusicon: added support for quit button in smallmenu; also, the field is being prepared for customizable smallmenu entries
author giacomo
date Mon, 16 Apr 2007 01:35:24 -0700
parents 209bd85dc1b9
children e3beb4b76591
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"
453
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 433
diff changeset
26 #include <audacious/beepctrl.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
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
29 static gboolean plugin_active = FALSE;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
30
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
31 extern si_cfg_t si_cfg;
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
32
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
33
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
34 /* ***************** */
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
35 /* plug-in functions */
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 GeneralPlugin *get_gplugin_info()
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
38 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
39 return &si_gp;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
40 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
41
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 void
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
44 si_init ( void )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
45 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
46 g_type_init();
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
47 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
48 plugin_active = TRUE;
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
49 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
50 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
51 return;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
52 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
53
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 void
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
56 si_cleanup ( void )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
57 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
58 if ( plugin_active == TRUE )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
59 {
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
60 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
61 si_ui_statusicon_enable( FALSE );
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
62 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
63 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
64 return;
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
65 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
66
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
67
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
68 void
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
69 si_prefs ( void )
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 si_ui_prefs_show();
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
72 }
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
73
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
74
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
75 void
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
76 si_about ( void )
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 si_ui_about_show();
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
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 /* audacious actions */
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
85
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
86
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
87 void
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
88 si_audacious_toggle_visibility ( void )
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
89 {
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
90 /* 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
91 (if at least one is visible, 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
92 if (( xmms_remote_is_main_win( si_gp.xmms_session ) == TRUE ) ||
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 ( xmms_remote_is_eq_win( si_gp.xmms_session ) == TRUE ) ||
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
94 ( xmms_remote_is_pl_win( si_gp.xmms_session ) == TRUE ))
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
95 {
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
96 /* remember the visibility status of the player windows */
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
97 si_cfg.mw_visib_prevstatus = xmms_remote_is_main_win( si_gp.xmms_session );
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
98 si_cfg.ew_visib_prevstatus = xmms_remote_is_eq_win( si_gp.xmms_session );
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
99 si_cfg.pw_visib_prevstatus = xmms_remote_is_pl_win( si_gp.xmms_session );
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
100 /* now hide all of them */
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
101 if ( si_cfg.mw_visib_prevstatus == TRUE )
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
102 xmms_remote_main_win_toggle( si_gp.xmms_session , FALSE );
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
103 if ( si_cfg.ew_visib_prevstatus == TRUE )
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
104 xmms_remote_eq_win_toggle( si_gp.xmms_session , FALSE );
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
105 if ( si_cfg.pw_visib_prevstatus == TRUE )
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
106 xmms_remote_pl_win_toggle( si_gp.xmms_session , FALSE );
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
107 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
108 else
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
109 {
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
110 /* show the windows that were visible before */
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
111 if ( si_cfg.mw_visib_prevstatus == TRUE )
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
112 xmms_remote_main_win_toggle( si_gp.xmms_session , TRUE );
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
113 if ( si_cfg.ew_visib_prevstatus == TRUE )
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
114 xmms_remote_eq_win_toggle( si_gp.xmms_session , TRUE );
915
1ccc7a9c7fc2 [svn] - statusicon: memorize player windows visibility status between sessions
giacomo
parents: 914
diff changeset
115 if ( si_cfg.pw_visib_prevstatus == TRUE )
433
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
116 xmms_remote_pl_win_toggle( si_gp.xmms_session , TRUE );
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
117 }
38fe08dff5cd [svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff changeset
118 }
453
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 void
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 433
diff changeset
121 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
122 {
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 433
diff changeset
123 gint vl, vr;
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 433
diff changeset
124 xmms_remote_get_volume( si_gp.xmms_session , &vl , &vr );
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
125 xmms_remote_set_volume( si_gp.xmms_session ,
453
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 433
diff changeset
126 CLAMP(vl + value, 0, 100) , CLAMP(vr + value, 0, 100) );
60395c0d7587 [svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents: 433
diff changeset
127 }
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
128
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
129 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
130 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
131 {
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
132 xmms_remote_quit( si_gp.xmms_session );
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
133 }
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
134
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
135 void
918
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
136 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
137 {
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
138 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
139 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
140
918
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
141 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
142 {
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_NEXT);
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
144 }
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
145 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
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 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
148 numsong *= -1;
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
149 }
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
150
918
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
151 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
152 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
153 }
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
154
209bd85dc1b9 [svn] - statusicon: add an option to use mouse wheel to change playing song instead of volume
giacomo
parents: 915
diff changeset
155 void
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
156 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
157 {
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
158 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
159 switch ( ctrl_code )
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_PREV:
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
162 xmms_remote_playlist_prev( si_gp.xmms_session );
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_PLAY:
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
166 xmms_remote_play( si_gp.xmms_session );
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_PAUSE:
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
170 xmms_remote_pause( si_gp.xmms_session );
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_STOP:
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
174 xmms_remote_stop( si_gp.xmms_session );
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
175 break;
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
176
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
177 case SI_AUDACIOUS_PLAYBACK_CTRL_NEXT:
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
178 xmms_remote_playlist_next( si_gp.xmms_session );
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
179 break;
855
fbf1f593b0c6 [svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents: 854
diff changeset
180
fbf1f593b0c6 [svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents: 854
diff changeset
181 case SI_AUDACIOUS_PLAYBACK_CTRL_EJECT:
fbf1f593b0c6 [svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents: 854
diff changeset
182 xmms_remote_eject( si_gp.xmms_session );
fbf1f593b0c6 [svn] statusicon: added a open-file item in the small right-click menu
giacomo
parents: 854
diff changeset
183 break;
854
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
184 }
aac49941ee8f [svn] statusicon 0.3: alternative right-click menu with simple playback control commands
giacomo
parents: 795
diff changeset
185 }