changeset 457:f5ed9a6ad3f1 trunk

[svn] - evdev-plug: added volume->mute and win->jumptofile actions
author giacomo
date Wed, 17 Jan 2007 09:14:03 -0800
parents 2e0b55117302
children 89453f4a4278
files ChangeLog src/evdev-plug/ed.c src/evdev-plug/ed_actions.h src/evdev-plug/ed_ui.c
diffstat 4 files changed, 55 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jan 17 08:52:04 2007 -0800
+++ b/ChangeLog	Wed Jan 17 09:14:03 2007 -0800
@@ -1,3 +1,10 @@
+2007-01-17 16:52:04 +0000  Giacomo Lozito <james@develia.org>
+  revision [996]
+  - status icon plugin: better logic for KWin workaround
+  trunk/src/statusicon/si_ui.c |    2 +-
+  1 file changed, 1 insertion(+), 1 deletion(-)
+
+
 2007-01-17 16:46:53 +0000  Giacomo Lozito <james@develia.org>
   revision [994]
   - status icon plugin: added a workaround to handle situations where KWin doesn't give a correct size for tray icons
--- a/src/evdev-plug/ed.c	Wed Jan 17 08:52:04 2007 -0800
+++ b/src/evdev-plug/ed.c	Wed Jan 17 09:14:03 2007 -0800
@@ -42,9 +42,11 @@
 void ed_action_vol_down5 ( gpointer );
 void ed_action_vol_up10 ( gpointer );
 void ed_action_vol_down10 ( gpointer );
+void ed_action_vol_mute ( gpointer );
 void ed_action_win_main ( gpointer );
 void ed_action_win_playlist ( gpointer );
 void ed_action_win_equalizer ( gpointer );
+void ed_action_win_jtf ( gpointer );
 void ed_action_pl_repeat ( gpointer );
 void ed_action_pl_shuffle ( gpointer );
 
@@ -65,10 +67,12 @@
   [ED_ACTION_VOL_DOWN5] = { N_("Volume->Down_5") , ed_action_vol_down5 },
   [ED_ACTION_VOL_UP10] = { N_("Volume->Up_10") , ed_action_vol_up10 },
   [ED_ACTION_VOL_DOWN10] = { N_("Volume->Down_10") , ed_action_vol_down10 },
+  [ED_ACTION_VOL_MUTE] = { N_("Volume->Mute") , ed_action_vol_mute },
 
   [ED_ACTION_WIN_MAIN] = { N_("Window->Main") , ed_action_win_main },
   [ED_ACTION_WIN_PLAYLIST] = { N_("Window->Playlist") , ed_action_win_playlist },
-  [ED_ACTION_WIN_EQUALIZER] = { N_("Window->Equalizer") , ed_action_win_equalizer }
+  [ED_ACTION_WIN_EQUALIZER] = { N_("Window->Equalizer") , ed_action_win_equalizer },
+  [ED_ACTION_WIN_JTF] = { N_("Window->JumpToFile") , ed_action_win_jtf }
 };
 
 
@@ -221,6 +225,38 @@
 }
 
 void
+ed_action_vol_mute ( gpointer param )
+{
+  static gint vl = -1;
+  static gint vr = -1;
+
+  if ( vl == -1 ) /* no previous memory of volume before mute action */
+  {
+    xmms_remote_get_volume( ed_gp.xmms_session , &vl , &vr ); /* memorize volume before mute */
+    xmms_remote_set_volume( ed_gp.xmms_session , 0 , 0 ); /* mute */
+  }
+  else /* memorized volume values exist */
+  {
+    gint vl_now = 0;
+    gint vr_now = 0;
+
+    xmms_remote_get_volume( ed_gp.xmms_session , &vl_now , &vr_now );
+    if (( vl_now == 0 ) && ( vr_now == 0 ))
+    {
+      /* the volume is still muted, restore the old values */
+      xmms_remote_set_volume( ed_gp.xmms_session , vl , vr );
+      vl = -1; vr = -1; /* reset these for next use */
+    }
+    else
+    {
+      /* the volume has been raised with other commands, act as if there wasn't a previous memory */
+      xmms_remote_get_volume( ed_gp.xmms_session , &vl , &vr ); /* memorize volume before mute */
+      xmms_remote_set_volume( ed_gp.xmms_session , 0 , 0 ); /* mute */
+    }
+  }
+}
+
+void
 ed_action_win_main ( gpointer param )
 {
   xmms_remote_main_win_toggle( ed_gp.xmms_session ,
@@ -240,3 +276,9 @@
   xmms_remote_eq_win_toggle( ed_gp.xmms_session ,
     !xmms_remote_is_eq_win ( ed_gp.xmms_session ) );
 }
+
+void
+ed_action_win_jtf ( gpointer param )
+{
+  xmms_remote_show_jtf_box( ed_gp.xmms_session );
+}
--- a/src/evdev-plug/ed_actions.h	Wed Jan 17 08:52:04 2007 -0800
+++ b/src/evdev-plug/ed_actions.h	Wed Jan 17 09:14:03 2007 -0800
@@ -49,10 +49,12 @@
   ED_ACTION_VOL_DOWN5 = 21,
   ED_ACTION_VOL_UP10 = 22,
   ED_ACTION_VOL_DOWN10 = 23,
+  ED_ACTION_VOL_MUTE = 24,
 
   ED_ACTION_WIN_MAIN = 30,
   ED_ACTION_WIN_PLAYLIST = 31,
-  ED_ACTION_WIN_EQUALIZER = 32
+  ED_ACTION_WIN_EQUALIZER = 32,
+  ED_ACTION_WIN_JTF = 33
 };
 
 void ed_action_call ( gint , gpointer );
--- a/src/evdev-plug/ed_ui.c	Wed Jan 17 08:52:04 2007 -0800
+++ b/src/evdev-plug/ed_ui.c	Wed Jan 17 09:14:03 2007 -0800
@@ -1338,10 +1338,11 @@
   action_store_add( ED_ACTION_VOL_DOWN5 );
   action_store_add( ED_ACTION_VOL_UP10 );
   action_store_add( ED_ACTION_VOL_DOWN10 );
-  action_store_add( ED_ACTION_VOL_UP5 );
+  action_store_add( ED_ACTION_VOL_MUTE );
   action_store_add( ED_ACTION_WIN_MAIN );
   action_store_add( ED_ACTION_WIN_PLAYLIST );
   action_store_add( ED_ACTION_WIN_EQUALIZER );
+  action_store_add( ED_ACTION_WIN_JTF );
   g_object_set_data_full( G_OBJECT(bindings_win) , "action_store" , action_store , g_object_unref );
 
   /* info table */