changeset 915:1ccc7a9c7fc2 trunk

[svn] - statusicon: memorize player windows visibility status between sessions
author giacomo
date Thu, 05 Apr 2007 10:47:18 -0700
parents d12d27887bf0
children a8494c2a87eb
files ChangeLog src/statusicon/si.c src/statusicon/si_cfg.c src/statusicon/si_cfg.h
diffstat 4 files changed, 40 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Apr 04 11:49:12 2007 -0700
+++ b/ChangeLog	Thu Apr 05 10:47:18 2007 -0700
@@ -1,3 +1,11 @@
+2007-04-04 18:49:12 +0000  Giacomo Lozito <james@develia.org>
+  revision [1946]
+  - 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)
+  trunk/src/statusicon/si.c        |   22 ++++++++++++++--------
+  trunk/src/statusicon/si_common.h |    2 +-
+  2 files changed, 15 insertions(+), 9 deletions(-)
+
+
 2007-04-04 17:53:50 +0000  Giacomo Lozito <james@develia.org>
   revision [1926]
   - aosd: small changes
--- a/src/statusicon/si.c	Wed Apr 04 11:49:12 2007 -0700
+++ b/src/statusicon/si.c	Thu Apr 05 10:47:18 2007 -0700
@@ -28,6 +28,8 @@
 
 static gboolean plugin_active = FALSE;
 
+extern si_cfg_t si_cfg;
+
 
 /* ***************** */
 /* plug-in functions */
@@ -57,6 +59,7 @@
   {
     plugin_active = FALSE;
     si_ui_statusicon_enable( FALSE );
+    si_cfg_save(); /* required to save windows visibility status */
   }
   return;
 }
@@ -84,10 +87,6 @@
 void
 si_audacious_toggle_visibility ( void )
 {
-  static gboolean mw_prevstatus = FALSE;
-  static gboolean eq_prevstatus = FALSE;
-  static gboolean pl_prevstatus = FALSE;
-
   /* use the window visibility status to toggle show/hide
      (if at least one is visible, hide) */
   if (( xmms_remote_is_main_win( si_gp.xmms_session ) == TRUE ) ||
@@ -95,25 +94,25 @@
       ( xmms_remote_is_pl_win( si_gp.xmms_session ) == TRUE ))
   {
     /* remember the visibility status of the player windows */
-    mw_prevstatus = xmms_remote_is_main_win( si_gp.xmms_session );
-    eq_prevstatus = xmms_remote_is_eq_win( si_gp.xmms_session );
-    pl_prevstatus = xmms_remote_is_pl_win( si_gp.xmms_session );
+    si_cfg.mw_visib_prevstatus = xmms_remote_is_main_win( si_gp.xmms_session );
+    si_cfg.ew_visib_prevstatus = xmms_remote_is_eq_win( si_gp.xmms_session );
+    si_cfg.pw_visib_prevstatus = xmms_remote_is_pl_win( si_gp.xmms_session );
     /* now hide all of them */
-    if ( mw_prevstatus == TRUE )
+    if ( si_cfg.mw_visib_prevstatus == TRUE )
       xmms_remote_main_win_toggle( si_gp.xmms_session , FALSE );
-    if ( eq_prevstatus == TRUE )
+    if ( si_cfg.ew_visib_prevstatus == TRUE )
       xmms_remote_eq_win_toggle( si_gp.xmms_session , FALSE );
-    if ( pl_prevstatus == TRUE )
+    if ( si_cfg.pw_visib_prevstatus == TRUE )
       xmms_remote_pl_win_toggle( si_gp.xmms_session , FALSE );
   }
   else
   {
     /* show the windows that were visible before */
-    if ( mw_prevstatus == TRUE )
+    if ( si_cfg.mw_visib_prevstatus == TRUE )
       xmms_remote_main_win_toggle( si_gp.xmms_session , TRUE );
-    if ( eq_prevstatus == TRUE )
+    if ( si_cfg.ew_visib_prevstatus == TRUE )
       xmms_remote_eq_win_toggle( si_gp.xmms_session , TRUE );
-    if ( pl_prevstatus == TRUE )
+    if ( si_cfg.pw_visib_prevstatus == TRUE )
       xmms_remote_pl_win_toggle( si_gp.xmms_session , TRUE );
   }
 }
--- a/src/statusicon/si_cfg.c	Wed Apr 04 11:49:12 2007 -0700
+++ b/src/statusicon/si_cfg.c	Thu Apr 05 10:47:18 2007 -0700
@@ -33,6 +33,16 @@
   if ( !bmp_cfg_db_get_int( cfgfile , "statusicon" ,
        "rclick_menu" , &(si_cfg.rclick_menu) ) )
     si_cfg.rclick_menu = SI_CFG_RCLICK_MENU_AUD;
+    
+  if ( !bmp_cfg_db_get_bool( cfgfile , "statusicon" ,
+       "mw_visib_prevstatus" , &(si_cfg.mw_visib_prevstatus) ) )
+    si_cfg.mw_visib_prevstatus = FALSE;
+  if ( !bmp_cfg_db_get_bool( cfgfile , "statusicon" ,
+       "pw_visib_prevstatus" , &(si_cfg.pw_visib_prevstatus) ) )
+    si_cfg.pw_visib_prevstatus = FALSE;
+  if ( !bmp_cfg_db_get_bool( cfgfile , "statusicon" ,
+       "ew_visib_prevstatus" , &(si_cfg.ew_visib_prevstatus) ) )
+    si_cfg.ew_visib_prevstatus = FALSE;
 
   bmp_cfg_db_close( cfgfile );
   return;
@@ -46,6 +56,13 @@
 
   bmp_cfg_db_set_int( cfgfile , "statusicon" ,
     "rclick_menu" , si_cfg.rclick_menu );
+  
+  bmp_cfg_db_set_bool( cfgfile , "statusicon" ,
+    "mw_visib_prevstatus" , si_cfg.mw_visib_prevstatus );
+  bmp_cfg_db_set_bool( cfgfile , "statusicon" ,
+    "pw_visib_prevstatus" , si_cfg.pw_visib_prevstatus );
+  bmp_cfg_db_set_bool( cfgfile , "statusicon" ,
+    "ew_visib_prevstatus" , si_cfg.ew_visib_prevstatus );
 
   bmp_cfg_db_close( cfgfile );
   return;
--- a/src/statusicon/si_cfg.h	Wed Apr 04 11:49:12 2007 -0700
+++ b/src/statusicon/si_cfg.h	Thu Apr 05 10:47:18 2007 -0700
@@ -31,6 +31,9 @@
 typedef struct
 {
   gint rclick_menu;
+  gboolean mw_visib_prevstatus;
+  gboolean pw_visib_prevstatus;
+  gboolean ew_visib_prevstatus;
 }
 si_cfg_t;