Commit d8c645cf authored by Jean-Paul Saman's avatar Jean-Paul Saman

Syncing functionality with vlc-0.4.6

parent d11c5018
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* callbacks.c : Callbacks for the Familiar Linux Gtk+ plugin. * callbacks.c : Callbacks for the Familiar Linux Gtk+ plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: callbacks.c,v 1.10 2002/09/30 11:05:38 sam Exp $ * $Id: callbacks.c,v 1.11 2002/12/09 21:37:41 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -101,9 +101,17 @@ static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url ) ...@@ -101,9 +101,17 @@ static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url )
p_playlist = (playlist_t *) p_playlist = (playlist_t *)
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist ) if( p_playlist )
{
if (p_intf->p_sys->b_autoplayfile)
{ {
playlist_Add( p_playlist, (char*)psz_url, playlist_Add( p_playlist, (char*)psz_url,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
}
else
{
playlist_Add( p_playlist, (char*)psz_url,
PLAYLIST_APPEND, PLAYLIST_END );
}
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
} }
} }
...@@ -115,21 +123,25 @@ void ReadDirectory( GtkCList *clist, char *psz_dir ) ...@@ -115,21 +123,25 @@ void ReadDirectory( GtkCList *clist, char *psz_dir )
{ {
intf_thread_t *p_intf = GtkGetIntf( clist ); intf_thread_t *p_intf = GtkGetIntf( clist );
struct dirent **namelist; struct dirent **namelist;
int n,i; int n,status;
if (psz_dir) if (psz_dir)
chdir(psz_dir); {
n = scandir(".", &namelist, 0, NULL); status = chdir(psz_dir);
if (status<0)
intf_ErrMsg("File is not a directory.");
}
n = scandir(".", &namelist, 0, alphasort);
if (n<0) if (n<0)
perror("scandir"); perror("scandir");
else else
{ {
gchar *ppsz_text[2]; gchar *ppsz_text[2];
int i;
gtk_clist_freeze( clist ); gtk_clist_freeze( clist );
gtk_clist_clear( clist ); gtk_clist_clear( clist );
for (i=0; i<n; i++) for (i=0; i<n; i++)
{ {
/* This is a list of strings. */ /* This is a list of strings. */
...@@ -140,8 +152,8 @@ void ReadDirectory( GtkCList *clist, char *psz_dir ) ...@@ -140,8 +152,8 @@ void ReadDirectory( GtkCList *clist, char *psz_dir )
gtk_clist_insert( clist, i, ppsz_text ); gtk_clist_insert( clist, i, ppsz_text );
free(namelist[i]); free(namelist[i]);
} }
free(namelist);
gtk_clist_thaw( clist ); gtk_clist_thaw( clist );
free(namelist);
} }
} }
...@@ -240,18 +252,16 @@ on_toolbar_open_clicked (GtkButton *button, ...@@ -240,18 +252,16 @@ on_toolbar_open_clicked (GtkButton *button,
{ {
intf_thread_t *p_intf = GtkGetIntf( button ); intf_thread_t *p_intf = GtkGetIntf( button );
/* Testing routine */ if (p_intf->p_sys->p_notebook)
/*
GtkCList *clistmedia = NULL;
clistmedia = GTK_CLIST( lookup_widget( p_intf->p_sys->p_window,
"clistmedia") );
if (GTK_CLIST(clistmedia))
{ {
ReadDirectory(clistmedia, ".");
}
*/
gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) ); gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) );
gtk_notebook_set_page(p_intf->p_sys->p_notebook,0);
}
gdk_window_raise( p_intf->p_sys->p_window->window ); gdk_window_raise( p_intf->p_sys->p_window->window );
if (p_intf->p_sys->p_clist)
{
ReadDirectory(p_intf->p_sys->p_clist, ".");
}
} }
...@@ -261,7 +271,11 @@ on_toolbar_preferences_clicked (GtkButton *button, ...@@ -261,7 +271,11 @@ on_toolbar_preferences_clicked (GtkButton *button,
{ {
intf_thread_t *p_intf = GtkGetIntf( button ); intf_thread_t *p_intf = GtkGetIntf( button );
if (p_intf->p_sys->p_notebook)
{
gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) ); gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) );
gtk_notebook_set_page(p_intf->p_sys->p_notebook,1);
}
gdk_window_raise( p_intf->p_sys->p_window->window ); gdk_window_raise( p_intf->p_sys->p_window->window );
} }
...@@ -299,13 +313,14 @@ on_toolbar_play_clicked (GtkButton *button, ...@@ -299,13 +313,14 @@ on_toolbar_play_clicked (GtkButton *button,
intf_thread_t * p_intf = GtkGetIntf( button ); intf_thread_t * p_intf = GtkGetIntf( button );
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE ); FIND_ANYWHERE );
if( p_playlist == NULL ) if( p_playlist != NULL )
{ {
gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) ); input_SetStatus( p_playlist, INPUT_STATUS_PLAY );
gdk_window_raise( p_intf->p_sys->p_window->window ); p_main->p_playlist->b_stopped = 0;
/* Display open page */ gdk_window_lower( p_intf->p_sys->p_window->window );
} }
else
{
/* If the playlist is empty, open a file requester instead */ /* If the playlist is empty, open a file requester instead */
vlc_mutex_lock( &p_playlist->object_lock ); vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size ) if( p_playlist->i_size )
...@@ -320,6 +335,8 @@ on_toolbar_play_clicked (GtkButton *button, ...@@ -320,6 +335,8 @@ on_toolbar_play_clicked (GtkButton *button,
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
/* Display open page */ /* Display open page */
on_toolbar_open_clicked(button,user_data);
}
} }
} }
...@@ -362,10 +379,8 @@ on_toolbar_about_clicked (GtkButton *button, ...@@ -362,10 +379,8 @@ on_toolbar_about_clicked (GtkButton *button,
// Toggle notebook // Toggle notebook
if (p_intf->p_sys->p_notebook) if (p_intf->p_sys->p_notebook)
{ {
/* if ( gtk_get_data( GTK_WIDGET(p_intf->p_sys->p_notebook), "visible" ) ) gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) );
* gtk_widget_hide( GTK_WIDGET(p_intf->p_sys->p_notebook) ); gtk_notebook_set_page(p_intf->p_sys->p_notebook,2);
* else
*/ gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) );
} }
gdk_window_raise( p_intf->p_sys->p_window->window ); gdk_window_raise( p_intf->p_sys->p_window->window );
} }
...@@ -377,11 +392,33 @@ on_comboURL_entry_changed (GtkEditable *editable, ...@@ -377,11 +392,33 @@ on_comboURL_entry_changed (GtkEditable *editable,
{ {
intf_thread_t * p_intf = GtkGetIntf( editable ); intf_thread_t * p_intf = GtkGetIntf( editable );
gchar * psz_url; gchar * psz_url;
struct stat st;
if (p_intf->p_sys->b_autoplayfile == 1)
{
psz_url = gtk_entry_get_text(GTK_ENTRY(editable)); psz_url = gtk_entry_get_text(GTK_ENTRY(editable));
MediaURLOpenChanged( GTK_WIDGET(editable), psz_url ); if( (strncmp("file://",(const char *) psz_url,7)==0) ||
(strncmp("udp://",(const char *) psz_url,6)==0) ||
(strncmp("udp4://",(const char *) psz_url,7)==0) ||
(strncmp("udp6://",(const char *) psz_url,7)==0) ||
(strncmp("udpstream://",(const char *) psz_url,12)==0) ||
(strncmp("rtp://",(const char *) psz_url,6)==0) ||
(strncmp("rtp4://",(const char *) psz_url,7)==0) ||
(strncmp("rtp6://",(const char *) psz_url,7)==0) ||
(strncmp("rtpstream://",(const char *) psz_url,12)==0) ||
(strncmp("ftp://",(const char *) psz_url,6)==0) ||
(strncmp("http://",(const char *) psz_url,7)==0) )
{
MediaURLOpenChanged(GTK_WIDGET(editable), psz_url);
}
else if (lstat((char*)psz_url, &st)==0)
{
if (S_ISDIR(st.st_mode))
ReadDirectory(p_intf->p_sys->p_clist, psz_url);
else if( (S_ISLNK(st.st_mode)) || (S_ISCHR(st.st_mode)) ||
(S_ISBLK(st.st_mode)) || (S_ISFIFO(st.st_mode))||
(S_ISSOCK(st.st_mode))|| (S_ISREG(st.st_mode)) )
{
MediaURLOpenChanged(GTK_WIDGET(editable), psz_url);
}
} }
} }
...@@ -416,19 +453,24 @@ on_clistmedia_select_row (GtkCList *clist, ...@@ -416,19 +453,24 @@ on_clistmedia_select_row (GtkCList *clist,
GdkEvent *event, GdkEvent *event,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = p_main->p_intf;
gchar *text[2]; gchar *text[2];
gint ret; gint ret;
struct stat st; struct stat st;
ret = gtk_clist_get_text (clist, row, 0, text); ret = gtk_clist_get_text (p_intf->p_sys->p_clist, row, 0, text);
if (ret) if (ret)
{ {
if (lstat((char*)text[0], &st)==0) if (lstat((char*)text[0], &st)==0)
{ {
if (S_ISDIR(st.st_mode)) if (S_ISDIR(st.st_mode))
ReadDirectory(clist, text[0]); ReadDirectory(p_intf->p_sys->p_clist, text[0]);
else else if( (S_ISLNK(st.st_mode)) || (S_ISCHR(st.st_mode)) ||
MediaURLOpenChanged(GTK_WIDGET(clist), text[0]); (S_ISBLK(st.st_mode)) || (S_ISFIFO(st.st_mode))||
(S_ISSOCK(st.st_mode))|| (S_ISREG(st.st_mode)) )
{
MediaURLOpenChanged(GTK_WIDGET(p_intf->p_sys->p_clist), text[0]);
}
} }
} }
} }
...@@ -438,12 +480,12 @@ void ...@@ -438,12 +480,12 @@ void
on_cbautoplay_toggled (GtkToggleButton *togglebutton, on_cbautoplay_toggled (GtkToggleButton *togglebutton,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GtkGetIntf( togglebutton ); // intf_thread_t * p_intf = GtkGetIntf( togglebutton );
//
if (p_intf->p_sys->b_autoplayfile == 1) // if (p_intf->p_sys->b_autoplayfile == 1)
p_intf->p_sys->b_autoplayfile = 0; // p_intf->p_sys->b_autoplayfile = 0;
else // else
p_intf->p_sys->b_autoplayfile = 1; // p_intf->p_sys->b_autoplayfile = 1;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* familiar.c : familiar plugin for vlc * familiar.c : familiar plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: familiar.c,v 1.10 2002/10/14 16:46:55 sam Exp $ * $Id: familiar.c,v 1.11 2002/12/09 21:37:41 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#ifdef HAVE_GPE_INIT_H
#include <gpe/init.h>
#endif
#include "callbacks.h" #include "callbacks.h"
#include "interface.h" #include "interface.h"
#include "support.h" #include "support.h"
...@@ -47,10 +51,21 @@ static void Close ( vlc_object_t * ); ...@@ -47,10 +51,21 @@ static void Close ( vlc_object_t * );
static void Run ( intf_thread_t * ); static void Run ( intf_thread_t * );
void GtkAutoPlayFile( void );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
#define AUTOPLAYFILE_TEXT N_("autoplay selected file")
#define AUTOPLAYFILE_LONGTEXT N_("automatically play a file when selected in the "\
"file selection list")
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
vlc_module_begin(); vlc_module_begin();
add_category_Hint( N_("Miscellaneous"), NULL )
add_bool( "familiar-autoplayfile", 1, GtkAutoPlayFile, AUTOPLAYFILE_TEXT, AUTOPLAYFILE_LONGTEXT)
set_description( _("Familiar Linux Gtk+ interface module") ); set_description( _("Familiar Linux Gtk+ interface module") );
set_capability( "interface", 70 ); set_capability( "interface", 70 );
set_callbacks( Open, Close ); set_callbacks( Open, Close );
...@@ -114,11 +129,22 @@ static void Close( vlc_object_t *p_this ) ...@@ -114,11 +129,22 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************/ *****************************************************************************/
static void Run( intf_thread_t *p_intf ) static void Run( intf_thread_t *p_intf )
{ {
gdk_threads_enter(); #ifdef HAVE_GPE_INIT_H
/* Initialize GPE interface */
if (gpe_application_init(&i_args, &pp_args) == FALSE)
exit (1);
#else
/* Initialize Gtk+ */
gtk_set_locale ();
gdk_threads_enter();
#endif
/* Create some useful widgets that will certainly be used */ /* Create some useful widgets that will certainly be used */
// FIXME: magic path // FIXME: magic path
add_pixmap_directory("share"); add_pixmap_directory("share");
add_pixmap_directory("/usr/share/videolan");
p_intf->p_sys->p_window = create_familiar(); p_intf->p_sys->p_window = create_familiar();
if (p_intf->p_sys->p_window == NULL) if (p_intf->p_sys->p_window == NULL)
{ {
...@@ -149,7 +175,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -149,7 +175,7 @@ static void Run( intf_thread_t *p_intf )
"p_intf", p_intf ); "p_intf", p_intf );
/* Show the control window */ /* Show the control window */
gtk_widget_show( p_intf->p_sys->p_window ); gtk_widget_show( p_intf->p_sys->p_window );
ReadDirectory(p_intf->p_sys->p_clist, "."); ReadDirectory(p_intf->p_sys->p_clist, "/mnt");
/* Sleep to avoid using all CPU - since some interfaces need to /* Sleep to avoid using all CPU - since some interfaces need to
* access keyboard events, a 100ms delay is a good compromise */ * access keyboard events, a 100ms delay is a good compromise */
...@@ -166,3 +192,21 @@ static void Run( intf_thread_t *p_intf ) ...@@ -166,3 +192,21 @@ static void Run( intf_thread_t *p_intf )
gtk_main_quit(); gtk_main_quit();
} }
/*****************************************************************************
* GtkAutoplayFile: Autoplay file depending on configuration settings
*****************************************************************************
* FIXME: we should get the intf as parameter
*****************************************************************************/
void GtkAutoPlayFile( void )
{
GtkWidget *cbautoplay;
cbautoplay = GTK_WIDGET( gtk_object_get_data(
GTK_OBJECT( p_main->p_intf->p_sys->p_window ), "cbautoplay" ) );
if( !config_GetIntVariable( "familiar-autoplayfile" ) )
p_main->p_intf->p_sys->b_autoplayfile=0;
else
p_main->p_intf->p_sys->b_autoplayfile=1;
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(cbautoplay),p_main->p_intf->p_sys->b_autoplayfile);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment