Mercurial > audlegacy-plugins
annotate src/statusicon/si.c @ 472:69b8baad0b24 trunk
[svn] - stuff from vfs_get_metadata is already strdup'd
author | nenolod |
---|---|
date | Sun, 21 Jan 2007 02:16:17 -0800 |
parents | 60395c0d7587 |
children | ca6dca840074 |
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" |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
24 #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
|
25 #include <audacious/beepctrl.h> |
433
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
26 |
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 static gboolean plugin_active = FALSE; |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
29 |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
30 |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
31 /* ***************** */ |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
32 /* plug-in functions */ |
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 GeneralPlugin *get_gplugin_info() |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
35 { |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
36 return &si_gp; |
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 |
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; |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
46 si_ui_statusicon_show(); |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
47 return; |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
48 } |
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 void |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
52 si_cleanup ( void ) |
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 if ( plugin_active == TRUE ) |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
55 { |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
56 plugin_active = FALSE; |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
57 si_ui_statusicon_hide(); |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
58 } |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
59 return; |
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 |
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 void |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
64 si_about ( void ) |
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 si_ui_about_show(); |
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 |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
69 |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
70 |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
71 /* ***************** */ |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
72 /* audacious actions */ |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
73 |
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 void |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
76 si_audacious_toggle_visibility ( 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 static gboolean eq_prevstatus = FALSE; |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
79 static gboolean pl_prevstatus = FALSE; |
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 /* use the main window visibility status to toggle show/hide */ |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
82 if ( xmms_remote_is_main_win( si_gp.xmms_session ) == TRUE ) |
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 /* remember the visibility status of equalizer and playlist windows */ |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
85 eq_prevstatus = xmms_remote_is_eq_win( si_gp.xmms_session ); |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
86 pl_prevstatus = xmms_remote_is_pl_win( si_gp.xmms_session ); |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
87 /* now hide all of the player windows */ |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
88 xmms_remote_main_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
|
89 if ( eq_prevstatus == TRUE ) |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
90 xmms_remote_eq_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
|
91 if ( pl_prevstatus == TRUE ) |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
92 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
|
93 } |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
94 else |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
95 { |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
96 /* show the main player window again */ |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
97 xmms_remote_main_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
|
98 /* show the equalizer and playlist window if they were visible before */ |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
99 if ( eq_prevstatus == TRUE ) |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
100 xmms_remote_eq_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
|
101 if ( pl_prevstatus == TRUE ) |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
102 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
|
103 } |
38fe08dff5cd
[svn] - added status icon plugin (written from scratch, with code from gtk 2.10)
giacomo
parents:
diff
changeset
|
104 } |
453
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
433
diff
changeset
|
105 |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
433
diff
changeset
|
106 void |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
433
diff
changeset
|
107 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
|
108 { |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
433
diff
changeset
|
109 gint vl, vr; |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
433
diff
changeset
|
110 xmms_remote_get_volume( si_gp.xmms_session , &vl , &vr ); |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
433
diff
changeset
|
111 xmms_remote_set_volume( si_gp.xmms_session , |
60395c0d7587
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
giacomo
parents:
433
diff
changeset
|
112 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
|
113 } |