Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2018
macOS
vlc
Commits
f32bdde1
Commit
f32bdde1
authored
Dec 10, 2007
by
Rafaël Carré
Browse files
telepathy: shows an empty status when VLC has been stopped
parent
848c1c1f
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/misc/notify/telepathy.c
View file @
f32bdde1
...
...
@@ -51,6 +51,8 @@ static void Close ( vlc_object_t * );
static
int
ItemChange
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
StateChange
(
vlc_object_t
*
,
const
char
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
SendToTelepathy
(
intf_thread_t
*
,
const
char
*
);
/*****************************************************************************
...
...
@@ -128,6 +130,7 @@ static int Open( vlc_object_t *p_this )
*****************************************************************************/
static
void
Close
(
vlc_object_t
*
p_this
)
{
p_this
->
b_dead
=
VLC_TRUE
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
playlist_t
*
p_playlist
=
pl_Yield
(
p_this
);
...
...
@@ -137,8 +140,12 @@ static void Close( vlc_object_t *p_this )
/* Do not check for VLC_ENOMEM as we're closing */
SendToTelepathy
(
p_intf
,
""
);
PL_LOCK
;
var_DelCallback
(
p_playlist
,
"item-change"
,
ItemChange
,
p_intf
);
var_DelCallback
(
p_playlist
,
"playlist-current"
,
ItemChange
,
p_intf
);
if
(
p_playlist
->
p_input
)
var_DelCallback
(
p_playlist
->
p_input
,
"state"
,
StateChange
,
p_intf
);
PL_UNLOCK
;
pl_Release
(
p_this
);
/* we won't use the DBus connection anymore */
...
...
@@ -159,6 +166,9 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
char
*
psz_buf
=
NULL
;
input_thread_t
*
p_input
;
if
(
p_intf
->
b_dead
)
return
VLC_EGENERIC
;
/* Don't update Telepathy presence each time an item has been preparsed */
if
(
!
strncmp
(
"playlist-current"
,
psz_var
,
16
)
)
{
/* stores the current input item id */
...
...
@@ -199,8 +209,12 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
}
}
if
(
!
strncmp
(
"playlist-current"
,
psz_var
,
16
)
)
var_AddCallback
(
p_input
,
"state"
,
StateChange
,
p_intf
);
/* We format the string to be displayed */
psz_buf
=
str_format_meta
(
p_this
,
p_intf
->
p_sys
->
psz_format
);
/* We don't need the input anymore */
vlc_object_release
(
p_input
);
...
...
@@ -213,6 +227,20 @@ static int ItemChange( vlc_object_t *p_this, const char *psz_var,
return
VLC_SUCCESS
;
}
/*****************************************************************************
* StateChange: State change callback
*****************************************************************************/
static
int
StateChange
(
vlc_object_t
*
p_this
,
const
char
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
param
)
{
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
param
;
if
(
p_intf
->
b_dead
)
return
VLC_EGENERIC
;
if
(
newval
.
i_int
>=
END_S
)
return
SendToTelepathy
(
p_intf
,
""
);
return
VLC_SUCCESS
;
}
/*****************************************************************************
* SendToTelepathy
*****************************************************************************/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment