changeset 796:f3ce11fad729 trunk

[svn] statusicon: improvements in title changes detection while the popup is being displayed
author giacomo
date Thu, 08 Mar 2007 04:20:23 -0800
parents ca6dca840074
children 19e08e104ba6
files ChangeLog src/statusicon/si_ui.c
diffstat 2 files changed, 23 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Mar 07 16:45:38 2007 -0800
+++ b/ChangeLog	Thu Mar 08 04:20:23 2007 -0800
@@ -1,3 +1,12 @@
+2007-03-08 00:45:38 +0000  Giacomo Lozito <james@develia.org>
+  revision [1688]
+  - statusicon: re-display statusicon popup with updated information when song (or title) changes, closes bug #846
+  trunk/src/statusicon/si.c        |    4 
+  trunk/src/statusicon/si_common.h |    2 
+  trunk/src/statusicon/si_ui.c     |  182 ++++++++++++++++++++++++++++-----------
+  3 files changed, 135 insertions(+), 53 deletions(-)
+
+
 2007-03-07 14:49:54 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [1686]
   - same sanity check on rarely executed part.
--- a/src/statusicon/si_ui.c	Wed Mar 07 16:45:38 2007 -0800
+++ b/src/statusicon/si_ui.c	Thu Mar 08 04:20:23 2007 -0800
@@ -34,6 +34,9 @@
 #include <gtk/gtk.h>
 
 
+static void si_ui_statusicon_popup_timer_start ( GtkWidget * );
+static void si_ui_statusicon_popup_timer_stop ( GtkWidget * );
+
 
 /* this stuff required to make titlechange hook work properly */
 typedef struct
@@ -122,8 +125,7 @@
     g_object_set_data( G_OBJECT(evbox) , "popup_active" , GINT_TO_POINTER(1) );
   }
 
-  g_object_set_data( G_OBJECT(evbox) , "timer_id" , GINT_TO_POINTER(0) );
-  g_object_set_data( G_OBJECT(evbox) , "timer_active" , GINT_TO_POINTER(0) );
+  si_ui_statusicon_popup_timer_stop( evbox );
   return FALSE;
 }
 
@@ -168,6 +170,7 @@
   if ( ( GPOINTER_TO_INT(g_object_get_data( G_OBJECT(evbox) , "popup_active" )) == 1 ) &&
        ( plentry_gp != NULL ) )
   {
+g_print("hook change? 1\n");
     si_ui_statusicon_popup_hide( evbox );
     si_ui_statusicon_popup_timer_start( evbox );
   }
@@ -177,11 +180,14 @@
 static void
 si_ui_statusicon_cb_hook_tchange ( gpointer plentry_gp , gpointer prevs_gp )
 {
+  /* NOTE: this is quite intricated, but it works nicely and it's still
+     much better than polling; wonder if it can be simplified with some
+     help from the core player */
   si_hook_tchange_prevs_t *prevs = prevs_gp;
+  PlaylistEntry *pl_entry = plentry_gp;
   if ( ( GPOINTER_TO_INT(g_object_get_data( G_OBJECT(prevs->evbox) , "popup_active" )) == 1 ) &&
        ( plentry_gp != NULL ) )
   {
-    PlaylistEntry *pl_entry = plentry_gp;
     if ( ( prevs->title != NULL ) && ( prevs->filename != NULL ) )
     {
       if ( ( pl_entry->filename != NULL ) &&
@@ -216,6 +222,11 @@
       prevs->filename = g_strdup(pl_entry->filename);
     }
   }
+  else if ( ( prevs->title != NULL ) && ( strcmp(pl_entry->title,prevs->title) ) )
+  {
+    g_free(prevs->title);
+    prevs->title = g_strdup(pl_entry->title);
+  }
 }