Mercurial > audlegacy-plugins
changeset 453:60395c0d7587 trunk
[svn] - status icon plugin: use scroll wheel on the status icon to change volume
author | giacomo |
---|---|
date | Wed, 17 Jan 2007 03:34:44 -0800 |
parents | 829f029fbd03 |
children | 6c1c03111db4 |
files | ChangeLog src/statusicon/si.c src/statusicon/si_audacious.h src/statusicon/si_ui.c |
diffstat | 4 files changed, 39 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Wed Jan 17 03:13:34 2007 -0800 +++ b/ChangeLog Wed Jan 17 03:34:44 2007 -0800 @@ -1,3 +1,10 @@ +2007-01-17 11:13:34 +0000 Giacomo Lozito <james@develia.org> + revision [988] + - status icon plugin: display main menu on right click + trunk/src/statusicon/si_ui.c | 26 ++------------------------ + 1 file changed, 2 insertions(+), 24 deletions(-) + + 2007-01-17 08:56:53 +0000 William Pitcock <nenolod@sacredspiral.co.uk> revision [986] - various overflow and security-related fixes from XMMS2 (mainly Juho Vaha-Herttua, et al)
--- a/src/statusicon/si.c Wed Jan 17 03:13:34 2007 -0800 +++ b/src/statusicon/si.c Wed Jan 17 03:34:44 2007 -0800 @@ -22,6 +22,7 @@ #include "si_ui.h" #include "si_audacious.h" #include "si_common.h" +#include <audacious/beepctrl.h> static gboolean plugin_active = FALSE; @@ -101,3 +102,12 @@ xmms_remote_pl_win_toggle( si_gp.xmms_session , TRUE ); } } + +void +si_audacious_volume_change ( gint value ) +{ + gint vl, vr; + xmms_remote_get_volume( si_gp.xmms_session , &vl , &vr ); + xmms_remote_set_volume( si_gp.xmms_session , + CLAMP(vl + value, 0, 100) , CLAMP(vr + value, 0, 100) ); +}
--- a/src/statusicon/si_audacious.h Wed Jan 17 03:13:34 2007 -0800 +++ b/src/statusicon/si_audacious.h Wed Jan 17 03:34:44 2007 -0800 @@ -22,9 +22,11 @@ #define _I_SI_AUDACIOUS_H 1 #include "si_common.h" +#include <glib.h> void si_audacious_toggle_visibility ( void ); +void si_audacious_volume_change ( gint ); #endif /* !_I_SI_AUDACIOUS_H */
--- a/src/statusicon/si_ui.c Wed Jan 17 03:13:34 2007 -0800 +++ b/src/statusicon/si_ui.c Wed Jan 17 03:34:44 2007 -0800 @@ -72,6 +72,23 @@ static gboolean +si_ui_statusicon_cb_btscroll ( GtkWidget * evbox , GdkEventScroll * event ) +{ + switch ( event->direction ) + { + case GDK_SCROLL_UP: + si_audacious_volume_change( 5 ); + break; + case GDK_SCROLL_DOWN: + si_audacious_volume_change( -5 ); + break; + } + + return FALSE; +} + + +static gboolean si_ui_statusicon_popup_show ( gpointer evbox ) { if ( GPOINTER_TO_INT(g_object_get_data( G_OBJECT(evbox) , "timer_active" )) == 1 ) @@ -254,12 +271,14 @@ g_signal_connect( G_OBJECT(si_evbox) , "button-press-event" , G_CALLBACK(si_ui_statusicon_cb_btpress) , NULL ); + g_signal_connect( G_OBJECT(si_evbox) , "scroll-event" , + G_CALLBACK(si_ui_statusicon_cb_btscroll) , NULL ); g_signal_connect_after( G_OBJECT(si_evbox) , "event-after" , G_CALLBACK(si_ui_statusicon_cb_popup) , NULL ); gtk_container_add( GTK_CONTAINER(si_evbox), si_image ); gtk_container_add( GTK_CONTAINER(si_applet), si_evbox ); - + gtk_widget_show_all( GTK_WIDGET(si_applet) ); gtk_widget_size_request( GTK_WIDGET(si_applet) , &req );