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
e996c64e
Commit
e996c64e
authored
Mar 14, 2001
by
Pierre Baillet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc code clean-up
parent
9ac9b010
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
41 deletions
+71
-41
plugins/gtk/gtk_callbacks.c
plugins/gtk/gtk_callbacks.c
+3
-1
plugins/gtk/gtk_playlist.c
plugins/gtk/gtk_playlist.c
+68
-40
No files found.
plugins/gtk/gtk_callbacks.c
View file @
e996c64e
...
@@ -745,7 +745,9 @@ on_main_window_toggle (GtkMenuItem *menuitem,
...
@@ -745,7 +745,9 @@ on_main_window_toggle (GtkMenuItem *menuitem,
if
(
GTK_WIDGET_VISIBLE
(
p_intf
->
p_sys
->
p_window
)
)
{
if
(
GTK_WIDGET_VISIBLE
(
p_intf
->
p_sys
->
p_window
)
)
{
gtk_widget_hide
(
p_intf
->
p_sys
->
p_window
);
gtk_widget_hide
(
p_intf
->
p_sys
->
p_window
);
}
else
{
}
else
{
gtk_widget_show
(
p_intf
->
p_sys
->
p_window
);
gtk_widget_show
(
p_intf
->
p_sys
->
p_window
);
}
}
}
}
...
...
plugins/gtk/gtk_playlist.c
View file @
e996c64e
...
@@ -73,27 +73,26 @@ void
...
@@ -73,27 +73,26 @@ void
on_menubar_playlist_activate
(
GtkMenuItem
*
menuitem
,
on_menubar_playlist_activate
(
GtkMenuItem
*
menuitem
,
gpointer
user_data
)
gpointer
user_data
)
{
{
intf_thread_t
*
p_intf
=
GetIntf
(
GTK_WIDGET
(
menuitem
),
"intf_window"
);
intf_thread_t
*
p_intf
=
GetIntf
(
GTK_WIDGET
(
menuitem
),
"intf_window"
);
playlist_t
*
p_playlist
;
playlist_t
*
p_playlist
;
GtkCList
*
list
;
GtkCList
*
list
;
if
(
!
GTK_IS_WIDGET
(
p_intf
->
p_sys
->
p_playlist
)
)
if
(
!
GTK_IS_WIDGET
(
p_intf
->
p_sys
->
p_playlist
)
)
{
{
/* this shoud never happen */
intf_ErrMsgImm
(
"intf_playlist is not a widget !"
);
p_intf
->
p_sys
->
p_playlist
=
create_intf_playlist
();
p_intf
->
p_sys
->
p_playlist
=
create_intf_playlist
();
gtk_object_set_data
(
GTK_OBJECT
(
p_intf
->
p_sys
->
p_playlist
),
gtk_object_set_data
(
GTK_OBJECT
(
p_intf
->
p_sys
->
p_playlist
),
"p_intf"
,
p_intf
);
"p_intf"
,
p_intf
);
}
}
vlc_mutex_lock
(
&
p_main
->
p_playlist
->
change_lock
);
vlc_mutex_lock
(
&
p_main
->
p_playlist
->
change_lock
);
if
(
p_main
->
p_playlist
->
i_size
>
0
)
if
(
p_main
->
p_playlist
->
i_size
>
0
)
{
{
p_playlist
=
p_main
->
p_playlist
;
p_playlist
=
p_main
->
p_playlist
;
list
=
GTK_CLIST
(
lookup_widget
(
p_intf
->
p_sys
->
p_playlist
,
"playlist_clist"
))
;
list
=
GTK_CLIST
(
lookup_widget
(
p_intf
->
p_sys
->
p_playlist
,
"playlist_clist"
))
;
rebuildCList
(
list
,
p_playlist
);
rebuildCList
(
list
,
p_playlist
);
}
}
vlc_mutex_unlock
(
&
p_main
->
p_playlist
->
change_lock
);
vlc_mutex_unlock
(
&
p_main
->
p_playlist
->
change_lock
);
...
@@ -110,13 +109,18 @@ on_toolbar_playlist_clicked (GtkButton *button,
...
@@ -110,13 +109,18 @@ on_toolbar_playlist_clicked (GtkButton *button,
if
(
!
GTK_IS_WIDGET
(
p_intf
->
p_sys
->
p_playlist
)
)
if
(
!
GTK_IS_WIDGET
(
p_intf
->
p_sys
->
p_playlist
)
)
{
{
/* this shoud never happen */
intf_ErrMsgImm
(
"intf_playlist is not a widget !"
);
p_intf
->
p_sys
->
p_playlist
=
create_intf_playlist
();
p_intf
->
p_sys
->
p_playlist
=
create_intf_playlist
();
gtk_object_set_data
(
GTK_OBJECT
(
p_intf
->
p_sys
->
p_playlist
),
gtk_object_set_data
(
GTK_OBJECT
(
p_intf
->
p_sys
->
p_playlist
),
"p_intf"
,
p_intf
);
"p_intf"
,
p_intf
);
}
}
if
(
GTK_WIDGET_VISIBLE
(
p_intf
->
p_sys
->
p_playlist
)
)
{
if
(
GTK_WIDGET_VISIBLE
(
p_intf
->
p_sys
->
p_playlist
)
)
{
gtk_widget_hide
(
p_intf
->
p_sys
->
p_playlist
);
gtk_widget_hide
(
p_intf
->
p_sys
->
p_playlist
);
}
else
{
}
else
{
GtkCList
*
clist
;
GtkCList
*
clist
;
gtk_widget_show
(
p_intf
->
p_sys
->
p_playlist
);
gtk_widget_show
(
p_intf
->
p_sys
->
p_playlist
);
clist
=
GTK_CLIST
(
lookup_widget
(
p_intf
->
p_sys
->
p_playlist
,
"playlist_clist"
));
clist
=
GTK_CLIST
(
lookup_widget
(
p_intf
->
p_sys
->
p_playlist
,
"playlist_clist"
));
...
@@ -261,6 +265,9 @@ on_delete_clicked (GtkMenuItem *item,
...
@@ -261,6 +265,9 @@ on_delete_clicked (GtkMenuItem *item,
if
(
g_list_length
(
selection
)
>
0
)
if
(
g_list_length
(
selection
)
>
0
)
{
{
/* reverse-sort so that we can delete from the furthest to the
closest item to delete...
*/
selection
=
g_list_sort
(
selection
,
compareItems
);
selection
=
g_list_sort
(
selection
,
compareItems
);
g_list_foreach
(
selection
,
g_list_foreach
(
selection
,
deleteGListItem
,
deleteGListItem
,
...
@@ -277,8 +284,8 @@ on_intf_playlist_destroy_event (GtkWidget *widget,
...
@@ -277,8 +284,8 @@ on_intf_playlist_destroy_event (GtkWidget *widget,
GdkEvent
*
event
,
GdkEvent
*
event
,
gpointer
user_data
)
gpointer
user_data
)
{
{
/* hide ! */
gtk_widget_hide
(
widget
);
gtk_widget_hide
(
widget
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -299,6 +306,7 @@ on_intf_playlist_drag_data_received (GtkWidget *widget,
...
@@ -299,6 +306,7 @@ on_intf_playlist_drag_data_received (GtkWidget *widget,
clist
=
GTK_CLIST
(
lookup_widget
(
p_intf
->
p_sys
->
p_playlist
,
"playlist_clist"
));
clist
=
GTK_CLIST
(
lookup_widget
(
p_intf
->
p_sys
->
p_playlist
,
"playlist_clist"
));
/* are we dropping somewhere into the clist items ? */
if
(
gtk_clist_get_selection_info
(
clist
,
if
(
gtk_clist_get_selection_info
(
clist
,
x
,
x
,
y
,
y
,
...
@@ -306,7 +314,10 @@ on_intf_playlist_drag_data_received (GtkWidget *widget,
...
@@ -306,7 +314,10 @@ on_intf_playlist_drag_data_received (GtkWidget *widget,
&
col
)
==
1
)
&
col
)
==
1
)
{
{
on_generic_drop_data_received
(
p_intf
,
data
,
info
,
row
);
on_generic_drop_data_received
(
p_intf
,
data
,
info
,
row
);
}
else
{
}
/* else, put that at the end of the playlist */
else
{
on_generic_drop_data_received
(
p_intf
,
data
,
info
,
PLAYLIST_END
);
on_generic_drop_data_received
(
p_intf
,
data
,
info
,
PLAYLIST_END
);
}
}
}
}
...
@@ -337,6 +348,7 @@ void on_generic_drop_data_received( intf_thread_t * p_intf,
...
@@ -337,6 +348,7 @@ void on_generic_drop_data_received( intf_thread_t * p_intf,
}
}
/* this cuts string into single file drops */
/* this cuts string into single file drops */
/* this code was borrowed from xmms, thx guys :) */
while
(
*
string
)
while
(
*
string
)
{
{
temp
=
strchr
(
string
,
'\n'
);
temp
=
strchr
(
string
,
'\n'
);
...
@@ -367,7 +379,9 @@ void on_generic_drop_data_received( intf_thread_t * p_intf,
...
@@ -367,7 +379,9 @@ void on_generic_drop_data_received( intf_thread_t * p_intf,
}
}
intf_WarnMsg
(
1
,
"Dropped %s"
,
string
);
intf_WarnMsg
(
1
,
"Dropped %s"
,
string
);
}
else
{
}
else
{
protocol
=
strdup
(
""
);
protocol
=
strdup
(
""
);
}
}
...
@@ -393,10 +407,13 @@ void on_generic_drop_data_received( intf_thread_t * p_intf,
...
@@ -393,10 +407,13 @@ void on_generic_drop_data_received( intf_thread_t * p_intf,
{
{
/* lock the interface */
/* lock the interface */
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
change_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
change_lock
);
intf_WarnMsg
(
1
,
"List has %d elements"
,
g_list_length
(
files
)
);
intf_WarnMsg
(
1
,
"List has %d elements"
,
g_list_length
(
files
)
);
intf_AppendList
(
p_playlist
,
position
,
files
);
intf_AppendList
(
p_playlist
,
position
,
files
);
/* get the CList and rebuild it. */
/* get the CList and rebuild it. */
clist
=
GTK_CLIST
(
lookup_widget
(
p_intf
->
p_sys
->
p_playlist
,
"playlist_clist"
));
clist
=
GTK_CLIST
(
lookup_widget
(
p_intf
->
p_sys
->
p_playlist
,
"playlist_clist"
)
);
rebuildCList
(
clist
,
p_playlist
);
rebuildCList
(
clist
,
p_playlist
);
/* unlock the interface */
/* unlock the interface */
...
@@ -406,15 +423,15 @@ void on_generic_drop_data_received( intf_thread_t * p_intf,
...
@@ -406,15 +423,15 @@ void on_generic_drop_data_received( intf_thread_t * p_intf,
/* check a file (string) against supposed valid extension */
/* check a file (string) against supposed valid extension */
int
int
hasValidExtension
(
gchar
*
filename
)
hasValidExtension
(
gchar
*
filename
)
{
{
char
*
ext
[
6
]
=
{
"mpg"
,
"mpeg"
,
"vob"
,
"mp2"
,
"ts"
,
"ps"
};
char
*
ext
[
6
]
=
{
"mpg"
,
"mpeg"
,
"vob"
,
"mp2"
,
"ts"
,
"ps"
};
int
i_ext
=
6
;
int
i_ext
=
6
;
int
dummy
;
int
dummy
;
gchar
*
p_filename
=
strrchr
(
filename
,
'.'
)
+
sizeof
(
char
);
gchar
*
p_filename
=
strrchr
(
filename
,
'.'
)
+
sizeof
(
char
);
for
(
dummy
=
0
;
dummy
<
i_ext
;
dummy
++
)
for
(
dummy
=
0
;
dummy
<
i_ext
;
dummy
++
)
{
{
if
(
strcmp
(
p_filename
,
ext
[
dummy
])
==
0
)
if
(
strcmp
(
p_filename
,
ext
[
dummy
]
)
==
0
)
return
1
;
return
1
;
}
}
return
0
;
return
0
;
...
@@ -422,11 +439,12 @@ hasValidExtension(gchar * filename)
...
@@ -422,11 +439,12 @@ hasValidExtension(gchar * filename)
/* recursive function: descend into folders and build a list of valid filenames */
/* recursive function: descend into folders and build a list of valid filenames */
GList
*
GList
*
intf_readFiles
(
gchar
*
fsname
)
intf_readFiles
(
gchar
*
fsname
)
{
{
struct
stat
statbuf
;
struct
stat
statbuf
;
GList
*
current
=
NULL
;
GList
*
current
=
NULL
;
/* get the attributes of this file */
stat
(
fsname
,
&
statbuf
);
stat
(
fsname
,
&
statbuf
);
/* is it a regular file ? */
/* is it a regular file ? */
...
@@ -436,9 +454,12 @@ intf_readFiles(gchar * fsname )
...
@@ -436,9 +454,12 @@ intf_readFiles(gchar * fsname )
{
{
intf_WarnMsg
(
3
,
"%s is a valid file. Stacking on the playlist"
,
fsname
);
intf_WarnMsg
(
3
,
"%s is a valid file. Stacking on the playlist"
,
fsname
);
return
g_list_append
(
NULL
,
g_strdup
(
fsname
)
);
return
g_list_append
(
NULL
,
g_strdup
(
fsname
)
);
}
else
}
else
{
return
NULL
;
return
NULL
;
}
}
}
/* is it a directory (should we check for symlinks ?) */
/* is it a directory (should we check for symlinks ?) */
else
if
(
S_ISDIR
(
statbuf
.
st_mode
)
)
else
if
(
S_ISDIR
(
statbuf
.
st_mode
)
)
{
{
...
@@ -471,7 +492,7 @@ intf_readFiles(gchar * fsname )
...
@@ -471,7 +492,7 @@ intf_readFiles(gchar * fsname )
strlen
(
dirContent
->
d_name
)
*
sizeof
(
char
)
);
strlen
(
dirContent
->
d_name
)
*
sizeof
(
char
)
);
strcpy
(
newfs
,
fsname
);
strcpy
(
newfs
,
fsname
);
strcpy
(
newfs
+
strlen
(
fsname
)
+
1
,
dirContent
->
d_name
);
strcpy
(
newfs
+
strlen
(
fsname
)
+
1
,
dirContent
->
d_name
);
newfs
[
strlen
(
fsname
)]
=
'/'
;
newfs
[
strlen
(
fsname
)]
=
'/'
;
current
=
g_list_concat
(
current
,
intf_readFiles
(
newfs
)
);
current
=
g_list_concat
(
current
,
intf_readFiles
(
newfs
)
);
...
@@ -491,10 +512,13 @@ int intf_AppendList( playlist_t * p_playlist, int i_pos, GList * list )
...
@@ -491,10 +512,13 @@ int intf_AppendList( playlist_t * p_playlist, int i_pos, GList * list )
{
{
guint
length
,
dummy
;
guint
length
,
dummy
;
length
=
g_list_length
(
list
);
length
=
g_list_length
(
list
);
for
(
dummy
=
0
;
dummy
<
length
;
dummy
++
)
for
(
dummy
=
0
;
dummy
<
length
;
dummy
++
)
{
{
intf_PlstAdd
(
p_playlist
,
intf_PlstAdd
(
p_playlist
,
i_pos
==
PLAYLIST_END
?
PLAYLIST_END
:
(
i_pos
+
dummy
),
/* ok; this is a really nasty trick to insert
the item where they are suppose to go but, hey
this works :P (btw, you are really nasty too) */
i_pos
==
PLAYLIST_END
?
PLAYLIST_END
:
(
i_pos
+
dummy
),
g_list_nth_data
(
list
,
dummy
));
g_list_nth_data
(
list
,
dummy
));
}
}
return
0
;
return
0
;
...
@@ -504,19 +528,23 @@ on_playlist_clist_event (GtkWidget *widget,
...
@@ -504,19 +528,23 @@ on_playlist_clist_event (GtkWidget *widget,
GdkEvent
*
event
,
GdkEvent
*
event
,
gpointer
user_data
)
gpointer
user_data
)
{
{
intf_thread_t
*
p_intf
=
GetIntf
(
GTK_WIDGET
(
widget
),
"intf_playlist"
);
intf_thread_t
*
p_intf
=
GetIntf
(
GTK_WIDGET
(
widget
),
"intf_playlist"
);
if
(
(
event
->
button
).
type
==
GDK_2BUTTON_PRESS
)
if
(
(
event
->
button
).
type
==
GDK_2BUTTON_PRESS
)
{
{
GtkCList
*
clist
;
GtkCList
*
clist
;
gint
row
,
col
;
gint
row
,
col
;
clist
=
GTK_CLIST
(
lookup_widget
(
p_intf
->
p_sys
->
p_playlist
,
"playlist_clist"
));
clist
=
GTK_CLIST
(
lookup_widget
(
p_intf
->
p_sys
->
p_playlist
,
"playlist_clist"
)
);
if
(
gtk_clist_get_selection_info
(
clist
,
if
(
gtk_clist_get_selection_info
(
clist
,
(
event
->
button
).
x
,
(
event
->
button
).
x
,
(
event
->
button
).
y
,
(
event
->
button
).
y
,
&
row
,
&
row
,
&
col
)
==
1
)
&
col
)
==
1
)
{
{
/* clicked is in range. */
/* clicked is in range. */
...
@@ -535,9 +563,7 @@ on_playlist_clist_event (GtkWidget *widget,
...
@@ -535,9 +563,7 @@ on_playlist_clist_event (GtkWidget *widget,
/* statis timeouted function */
/* statis timeouted function */
void
GtkPlayListManage
(
gpointer
p_data
)
void
GtkPlayListManage
(
gpointer
p_data
)
{
{
/* this thing really sucks for now :( */
/* this thing really sucks for now :( */
/* TODO speak more with interface/intf_plst.c */
/* TODO speak more with interface/intf_plst.c */
intf_thread_t
*
p_intf
=
(
void
*
)
p_data
;
intf_thread_t
*
p_intf
=
(
void
*
)
p_data
;
...
@@ -545,23 +571,25 @@ void GtkPlayListManage( gpointer p_data )
...
@@ -545,23 +571,25 @@ void GtkPlayListManage( gpointer p_data )
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
change_lock
);
vlc_mutex_lock
(
&
p_intf
->
p_sys
->
change_lock
);
if
(
p_intf
->
p_sys
->
i_playing
!=
p_playlist
->
i_index
)
if
(
p_intf
->
p_sys
->
i_playing
!=
p_playlist
->
i_index
)
{
{
GdkColor
color
;
GdkColor
color
;
color
.
red
=
65535
;
color
.
red
=
0xffff
;
color
.
green
=
0
;
color
.
green
=
0
;
color
.
blue
=
0
;
color
.
blue
=
0
;
gtk_clist_set_background
(
gtk_clist_set_background
(
GTK_CLIST
(
GTK_CLIST
(
lookup_widget
(
p_intf
->
p_sys
->
p_playlist
,
"playlist_clist"
)
),
lookup_widget
(
p_intf
->
p_sys
->
p_playlist
,
"playlist_clist"
)
),
p_playlist
->
i_index
,
p_playlist
->
i_index
,
&
color
);
&
color
);
if
(
p_intf
->
p_sys
->
i_playing
!=
-
1
)
if
(
p_intf
->
p_sys
->
i_playing
!=
-
1
)
{
{
color
.
red
=
65535
;
color
.
red
=
0xffff
;
color
.
green
=
65535
;
color
.
green
=
0xffff
;
color
.
blue
=
65535
;
color
.
blue
=
0xffff
;
gtk_clist_set_background
(
gtk_clist_set_background
(
GTK_CLIST
(
lookup_widget
(
p_intf
->
p_sys
->
p_playlist
,
"playlist_clist"
)
),
GTK_CLIST
(
lookup_widget
(
p_intf
->
p_sys
->
p_playlist
,
"playlist_clist"
)
),
p_intf
->
p_sys
->
i_playing
,
p_intf
->
p_sys
->
i_playing
,
...
...
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