# HG changeset patch # User giacomo # Date 1179826138 25200 # Node ID 2d6a00ed166fc7b5bf6f171276af86716ade5833 # Parent 149fc284aa866ba0713fe1c2c9f81c36d29606f0 [svn] - statusicon: partial rewrite of si_ui_statusicon_cb_hook_tchange , nicer this way diff -r 149fc284aa86 -r 2d6a00ed166f ChangeLog --- a/ChangeLog Tue May 22 01:56:51 2007 -0700 +++ b/ChangeLog Tue May 22 02:28:58 2007 -0700 @@ -1,3 +1,10 @@ +2007-05-22 08:56:51 +0000 Giacomo Lozito + revision [2272] + - statusicon: strenghten checks before last strcmp in si_ui_statusicon_cb_hook_tchange + trunk/src/statusicon/si_ui.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + + 2007-05-21 23:34:55 +0000 Tony Vroon revision [2270] Isn't that cute. But it's WRONG diff -r 149fc284aa86 -r 2d6a00ed166f src/statusicon/si_ui.c --- a/src/statusicon/si_ui.c Tue May 22 01:56:51 2007 -0700 +++ b/src/statusicon/si_ui.c Tue May 22 02:28:58 2007 -0700 @@ -209,7 +209,6 @@ 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 ); } @@ -219,13 +218,11 @@ 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 ) ) + gboolean upd_pop = FALSE; + + if ( pl_entry != NULL ) { if ( ( prevs->title != NULL ) && ( prevs->filename != NULL ) ) { @@ -235,10 +232,9 @@ if ( ( pl_entry->title != NULL ) && ( strcmp(pl_entry->title,prevs->title) ) ) { - si_ui_statusicon_popup_hide( prevs->evbox ); - si_ui_statusicon_popup_timer_start( prevs->evbox ); g_free( prevs->title ); prevs->title = g_strdup(pl_entry->title); + upd_pop = TRUE; } } else @@ -246,8 +242,7 @@ g_free(prevs->filename); prevs->filename = g_strdup(pl_entry->filename); /* if filename changes, reset title as well */ - if ( prevs->title != NULL ) - g_free(prevs->title); + g_free(prevs->title); prevs->title = g_strdup(pl_entry->title); } } @@ -261,12 +256,12 @@ prevs->filename = g_strdup(pl_entry->filename); } } - else if ( ( prevs->title != NULL ) && - ( pl_entry->title != NULL ) && - ( strcmp(pl_entry->title,prevs->title) ) ) + + if ( ( upd_pop == TRUE ) && + ( GPOINTER_TO_INT(g_object_get_data( G_OBJECT(prevs->evbox) , "popup_active" )) == 1 ) ) { - g_free(prevs->title); - prevs->title = g_strdup(pl_entry->title); + si_ui_statusicon_popup_hide( prevs->evbox ); + si_ui_statusicon_popup_timer_start( prevs->evbox ); } }