Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
107b78a9
Commit
107b78a9
authored
Dec 22, 2007
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use a pointer to a function instead of a callback
parent
8442f8ad
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
25 deletions
+23
-25
include/vlc_update.h
include/vlc_update.h
+1
-1
modules/gui/qt4/dialogs/help.cpp
modules/gui/qt4/dialogs/help.cpp
+2
-6
modules/gui/wxwidgets/dialogs/updatevlc.cpp
modules/gui/wxwidgets/dialogs/updatevlc.cpp
+1
-1
src/libvlc-common.c
src/libvlc-common.c
+0
-5
src/misc/update.c
src/misc/update.c
+19
-12
No files found.
include/vlc_update.h
View file @
107b78a9
...
@@ -280,7 +280,7 @@ struct update_t
...
@@ -280,7 +280,7 @@ struct update_t
VLC_EXPORT
(
update_t
*
,
__update_New
,
(
vlc_object_t
*
)
);
VLC_EXPORT
(
update_t
*
,
__update_New
,
(
vlc_object_t
*
)
);
VLC_EXPORT
(
void
,
update_Delete
,
(
update_t
*
)
);
VLC_EXPORT
(
void
,
update_Delete
,
(
update_t
*
)
);
VLC_EXPORT
(
void
,
update_Check
,
(
update_t
*
)
);
VLC_EXPORT
(
void
,
update_Check
,
(
update_t
*
,
void
(
*
callback
)(
void
*
),
void
*
)
);
VLC_EXPORT
(
int
,
update_CompareReleaseToCurrent
,
(
update_t
*
)
);
VLC_EXPORT
(
int
,
update_CompareReleaseToCurrent
,
(
update_t
*
)
);
VLC_EXPORT
(
void
,
update_Download
,
(
update_t
*
,
char
*
)
);
VLC_EXPORT
(
void
,
update_Download
,
(
update_t
*
,
char
*
)
);
...
...
modules/gui/qt4/dialogs/help.cpp
View file @
107b78a9
...
@@ -179,13 +179,11 @@ void AboutDialog::close()
...
@@ -179,13 +179,11 @@ void AboutDialog::close()
* UpdateDialog
* UpdateDialog
*****************************************************************************/
*****************************************************************************/
/* callback to get information from the core */
/* callback to get information from the core */
static
int
updateCallback
(
vlc_object_t
*
p_this
,
char
const
*
psz_cmd
,
static
void
UpdateCallback
(
void
*
data
)
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
data
)
{
{
UpdateDialog
*
UDialog
=
(
UpdateDialog
*
)
data
;
UpdateDialog
*
UDialog
=
(
UpdateDialog
*
)
data
;
QEvent
*
event
=
new
QEvent
(
QEvent
::
User
);
QEvent
*
event
=
new
QEvent
(
QEvent
::
User
);
QApplication
::
postEvent
(
UDialog
,
event
);
QApplication
::
postEvent
(
UDialog
,
event
);
return
VLC_SUCCESS
;
}
}
UpdateDialog
*
UpdateDialog
::
instance
=
NULL
;
UpdateDialog
*
UpdateDialog
::
instance
=
NULL
;
...
@@ -215,13 +213,11 @@ UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
...
@@ -215,13 +213,11 @@ UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
/* create the update structure and the callback */
/* create the update structure and the callback */
p_update
=
update_New
(
_p_intf
);
p_update
=
update_New
(
_p_intf
);
var_AddCallback
(
_p_intf
->
p_libvlc
,
"update-notify"
,
updateCallback
,
this
);
b_checked
=
false
;
b_checked
=
false
;
}
}
UpdateDialog
::~
UpdateDialog
()
UpdateDialog
::~
UpdateDialog
()
{
{
var_DelCallback
(
p_update
->
p_libvlc
,
"update-notify"
,
updateCallback
,
this
);
update_Delete
(
p_update
);
update_Delete
(
p_update
);
}
}
...
@@ -236,7 +232,7 @@ void UpdateDialog::UpdateOrDownload()
...
@@ -236,7 +232,7 @@ void UpdateDialog::UpdateOrDownload()
if
(
!
b_checked
)
if
(
!
b_checked
)
{
{
updateButton
->
setEnabled
(
false
);
updateButton
->
setEnabled
(
false
);
update_Check
(
p_update
);
update_Check
(
p_update
,
UpdateCallback
,
this
);
}
}
else
else
{
{
...
...
modules/gui/wxwidgets/dialogs/updatevlc.cpp
View file @
107b78a9
...
@@ -100,7 +100,7 @@ void UpdateVLC::OnClose( wxCloseEvent& WXUNUSED(event) )
...
@@ -100,7 +100,7 @@ void UpdateVLC::OnClose( wxCloseEvent& WXUNUSED(event) )
void
UpdateVLC
::
OnCheckForUpdate
(
wxCommandEvent
&
event
)
void
UpdateVLC
::
OnCheckForUpdate
(
wxCommandEvent
&
event
)
{
{
update_Check
(
p_update
);
update_Check
(
p_update
,
NULL
,
this
);
wxBoxSizer
*
main_sizer
=
new
wxBoxSizer
(
wxVERTICAL
);
wxBoxSizer
*
main_sizer
=
new
wxBoxSizer
(
wxVERTICAL
);
DestroyChildren
();
DestroyChildren
();
...
...
src/libvlc-common.c
View file @
107b78a9
...
@@ -884,11 +884,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
...
@@ -884,11 +884,6 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
/* Create volume callback system. */
/* Create volume callback system. */
var_Create
(
p_libvlc
,
"volume-change"
,
VLC_VAR_BOOL
);
var_Create
(
p_libvlc
,
"volume-change"
,
VLC_VAR_BOOL
);
/* Notify interfaces that a new VLC version is available */
#ifdef UPDATE_CHECK
var_Create
(
p_libvlc
,
"update-notify"
,
VLC_VAR_INTEGER
|
VLC_VAR_ISCOMMAND
);
#endif
/*
/*
* Get input filenames given as commandline arguments
* Get input filenames given as commandline arguments
*/
*/
...
...
src/misc/update.c
View file @
107b78a9
...
@@ -883,6 +883,8 @@ typedef struct
...
@@ -883,6 +883,8 @@ typedef struct
{
{
VLC_COMMON_MEMBERS
VLC_COMMON_MEMBERS
update_t
*
p_update
;
update_t
*
p_update
;
void
(
*
pf_callback
)(
void
*
);
void
*
p_data
;
}
update_check_thread_t
;
}
update_check_thread_t
;
void
update_CheckReal
(
update_check_thread_t
*
p_uct
);
void
update_CheckReal
(
update_check_thread_t
*
p_uct
);
...
@@ -891,15 +893,19 @@ void update_CheckReal( update_check_thread_t *p_uct );
...
@@ -891,15 +893,19 @@ void update_CheckReal( update_check_thread_t *p_uct );
* Check for updates
* Check for updates
*
*
* \param p_update pointer to update struct
* \param p_update pointer to update struct
* \param pf_callback pointer to a function to call when the update_check is finished
* \param p_data pointer to some datas to give to the callback
* \returns nothing
* \returns nothing
*/
*/
void
update_Check
(
update_t
*
p_update
)
void
update_Check
(
update_t
*
p_update
,
void
(
*
pf_callback
)(
void
*
),
void
*
p_data
)
{
{
assert
(
p_update
);
assert
(
p_update
);
update_check_thread_t
*
p_uct
=
vlc_object_create
(
p_update
->
p_libvlc
,
update_check_thread_t
*
p_uct
=
vlc_object_create
(
p_update
->
p_libvlc
,
sizeof
(
update_check_thread_t
)
);
sizeof
(
update_check_thread_t
)
);
p_uct
->
p_update
=
p_update
;
p_uct
->
p_update
=
p_update
;
p_uct
->
pf_callback
=
pf_callback
;
p_uct
->
p_data
=
p_data
;
vlc_thread_create
(
p_uct
,
"check for update"
,
update_CheckReal
,
vlc_thread_create
(
p_uct
,
"check for update"
,
update_CheckReal
,
VLC_THREAD_PRIORITY_LOW
,
VLC_FALSE
);
VLC_THREAD_PRIORITY_LOW
,
VLC_FALSE
);
...
@@ -914,7 +920,8 @@ void update_CheckReal( update_check_thread_t *p_uct )
...
@@ -914,7 +920,8 @@ void update_CheckReal( update_check_thread_t *p_uct )
vlc_mutex_unlock
(
&
p_uct
->
p_update
->
lock
);
vlc_mutex_unlock
(
&
p_uct
->
p_update
->
lock
);
var_TriggerCallback
(
p_uct
->
p_libvlc
,
"update-notify"
);
if
(
p_uct
->
pf_callback
)
(
p_uct
->
pf_callback
)(
p_uct
->
p_data
);
}
}
/**
/**
...
@@ -1035,7 +1042,7 @@ void update_DownloadReal( update_download_thread_t *p_udt )
...
@@ -1035,7 +1042,7 @@ void update_DownloadReal( update_download_thread_t *p_udt )
char
*
psz_destdir
=
p_udt
->
psz_destdir
;
char
*
psz_destdir
=
p_udt
->
psz_destdir
;
/* Open the stream */
/* Open the stream */
p_stream
=
stream_UrlNew
(
p_u
pdate
->
p_libvlc
,
p_update
->
release
.
psz_url
);
p_stream
=
stream_UrlNew
(
p_u
dt
,
p_update
->
release
.
psz_url
);
if
(
!
p_stream
)
if
(
!
p_stream
)
{
{
msg_Err
(
p_udt
,
"Failed to open %s for reading"
,
p_update
->
release
.
psz_url
);
msg_Err
(
p_udt
,
"Failed to open %s for reading"
,
p_update
->
release
.
psz_url
);
...
@@ -1107,15 +1114,15 @@ void update_DownloadReal( update_download_thread_t *p_udt )
...
@@ -1107,15 +1114,15 @@ void update_DownloadReal( update_download_thread_t *p_udt )
else
else
remove
(
psz_destfile
);
remove
(
psz_destfile
);
error:
error:
if
(
p_stream
)
if
(
p_stream
)
stream_Delete
(
p_stream
);
stream_Delete
(
p_stream
);
if
(
p_file
)
if
(
p_file
)
fclose
(
p_file
);
fclose
(
p_file
);
free
(
psz_destdir
);
free
(
psz_destdir
);
free
(
psz_destfile
);
free
(
psz_destfile
);
free
(
p_buffer
);
free
(
p_buffer
);
free
(
psz_size
);
free
(
psz_size
);
}
}
#endif
#endif
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