Changeset f32bdde1ba38fb390b8288d67e81514bb25f71dc
- 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
| r7e6bc77 |
rf32bdde |
|
| 52 | 52 | static int ItemChange( vlc_object_t *, const char *, |
|---|
| 53 | 53 | vlc_value_t, vlc_value_t, void * ); |
|---|
| | 54 | static int StateChange( vlc_object_t *, const char *, |
|---|
| | 55 | vlc_value_t, vlc_value_t, void * ); |
|---|
| 54 | 56 | static int SendToTelepathy( intf_thread_t *, const char * ); |
|---|
| 55 | 57 | |
|---|
| … | … | |
| 129 | 131 | static void Close( vlc_object_t *p_this ) |
|---|
| 130 | 132 | { |
|---|
| | 133 | p_this->b_dead = VLC_TRUE; |
|---|
| 131 | 134 | intf_thread_t *p_intf = (intf_thread_t *)p_this; |
|---|
| 132 | 135 | playlist_t *p_playlist = pl_Yield( p_this ); |
|---|
| … | … | |
| 138 | 141 | SendToTelepathy( p_intf, "" ); |
|---|
| 139 | 142 | |
|---|
| | 143 | PL_LOCK; |
|---|
| 140 | 144 | var_DelCallback( p_playlist, "item-change", ItemChange, p_intf ); |
|---|
| 141 | 145 | 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; |
|---|
| 142 | 149 | pl_Release( p_this ); |
|---|
| 143 | 150 | |
|---|
| … | … | |
| 159 | 166 | char *psz_buf = NULL; |
|---|
| 160 | 167 | input_thread_t *p_input; |
|---|
| | 168 | |
|---|
| | 169 | if( p_intf->b_dead ) |
|---|
| | 170 | return VLC_EGENERIC; |
|---|
| 161 | 171 | |
|---|
| 162 | 172 | /* Don't update Telepathy presence each time an item has been preparsed */ |
|---|
| … | … | |
| 200 | 210 | } |
|---|
| 201 | 211 | |
|---|
| | 212 | if( !strncmp( "playlist-current", psz_var, 16 ) ) |
|---|
| | 213 | var_AddCallback( p_input, "state", StateChange, p_intf ); |
|---|
| | 214 | |
|---|
| 202 | 215 | /* We format the string to be displayed */ |
|---|
| 203 | 216 | psz_buf = str_format_meta( p_this, p_intf->p_sys->psz_format ); |
|---|
| | 217 | |
|---|
| 204 | 218 | /* We don't need the input anymore */ |
|---|
| 205 | 219 | vlc_object_release( p_input ); |
|---|
| … | … | |
| 211 | 225 | } |
|---|
| 212 | 226 | free( psz_buf ); |
|---|
| | 227 | return VLC_SUCCESS; |
|---|
| | 228 | } |
|---|
| | 229 | |
|---|
| | 230 | /***************************************************************************** |
|---|
| | 231 | * StateChange: State change callback |
|---|
| | 232 | *****************************************************************************/ |
|---|
| | 233 | static 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, "" ); |
|---|
| 213 | 241 | return VLC_SUCCESS; |
|---|
| 214 | 242 | } |
|---|