Changeset f32bdde1ba38fb390b8288d67e81514bb25f71dc

Show
Ignore:
Timestamp:
10/12/07 15:17:34 (10 months ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1197296254 +0000
git-parent:

[848c1c1f12aaab8c20755462b7f37c226c04473a]

git-author:
Rafaël Carré <funman@videolan.org> 1197296254 +0000
Message:

telepathy: shows an empty status when VLC has been stopped

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/misc/notify/telepathy.c

    r7e6bc77 rf32bdde  
    5252static int ItemChange( vlc_object_t *, const char *, 
    5353                       vlc_value_t, vlc_value_t, void * ); 
     54static int StateChange( vlc_object_t *, const char *, 
     55                        vlc_value_t, vlc_value_t, void * ); 
    5456static int SendToTelepathy( intf_thread_t *, const char * ); 
    5557 
     
    129131static void Close( vlc_object_t *p_this ) 
    130132{ 
     133    p_this->b_dead = VLC_TRUE; 
    131134    intf_thread_t *p_intf = (intf_thread_t *)p_this; 
    132135    playlist_t *p_playlist = pl_Yield( p_this ); 
     
    138141    SendToTelepathy( p_intf, "" ); 
    139142 
     143    PL_LOCK; 
    140144    var_DelCallback( p_playlist, "item-change", ItemChange, p_intf ); 
    141145    var_DelCallback( p_playlist, "playlist-current", ItemChange, p_intf ); 
     146    if( p_playlist->p_input ) 
     147        var_DelCallback( p_playlist->p_input, "state", StateChange, p_intf ); 
     148    PL_UNLOCK; 
    142149    pl_Release( p_this ); 
    143150 
     
    159166    char *psz_buf = NULL; 
    160167    input_thread_t *p_input; 
     168 
     169    if( p_intf->b_dead ) 
     170        return VLC_EGENERIC; 
    161171 
    162172    /* Don't update Telepathy presence each time an item has been preparsed */ 
     
    200210    } 
    201211 
     212    if( !strncmp( "playlist-current", psz_var, 16 ) ) 
     213        var_AddCallback( p_input, "state", StateChange, p_intf ); 
     214 
    202215    /* We format the string to be displayed */ 
    203216    psz_buf = str_format_meta( p_this, p_intf->p_sys->psz_format ); 
     217 
    204218    /* We don't need the input anymore */ 
    205219    vlc_object_release( p_input ); 
     
    211225    } 
    212226    free( psz_buf ); 
     227    return VLC_SUCCESS; 
     228} 
     229 
     230/***************************************************************************** 
     231 * StateChange: State change callback 
     232 *****************************************************************************/ 
     233static int StateChange( vlc_object_t *p_this, const char *psz_var, 
     234                       vlc_value_t oldval, vlc_value_t newval, void *param ) 
     235{ 
     236    intf_thread_t *p_intf = (intf_thread_t *)param; 
     237    if( p_intf->b_dead ) 
     238        return VLC_EGENERIC; 
     239    if( newval.i_int >= END_S ) 
     240        return SendToTelepathy( p_intf, "" ); 
    213241    return VLC_SUCCESS; 
    214242}