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

Familiar interface works (tested on Intel).

parent 3551ba24
...@@ -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.8.2.5 2002/10/02 20:12:02 jpsaman Exp $ * $Id: familiar.c,v 1.8.2.6 2002/10/02 21:41:50 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -56,11 +56,18 @@ static void Close ( intf_thread_t *p_intf ); ...@@ -56,11 +56,18 @@ static void Close ( intf_thread_t *p_intf );
static void Run ( intf_thread_t * ); static void Run ( intf_thread_t * );
static gint GtkManage ( gpointer p_data ); static gint GtkManage ( gpointer p_data );
void GtkAutoPlayFile( void );
/***************************************************************************** /*****************************************************************************
* Module descriptor * 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_CONFIG_START MODULE_CONFIG_START
ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL ) ADD_CATEGORY_HINT( N_("Miscellaneous"), NULL )
ADD_BOOL( "familiar-autoplayfile", 1, GtkAutoPlayFile, AUTOPLAYFILE_TEXT, AUTOPLAYFILE_LONGTEXT)
MODULE_CONFIG_STOP MODULE_CONFIG_STOP
MODULE_INIT_START MODULE_INIT_START
...@@ -180,6 +187,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -180,6 +187,7 @@ static void Run( intf_thread_t *p_intf )
/* 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("/usr/share/videolan"); add_pixmap_directory("/usr/share/videolan");
p_intf->p_sys->p_window = create_familiar(); p_intf->p_sys->p_window = create_familiar();
...@@ -272,3 +280,22 @@ static gint GtkManage( gpointer p_data ) ...@@ -272,3 +280,22 @@ static gint GtkManage( gpointer p_data )
#undef p_intf #undef p_intf
} }
/*****************************************************************************
* 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);
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* familiar_callbacks.c : Callbacks for the Familiar Linux Gtk+ plugin. * familiar_callbacks.c : Callbacks for the Familiar Linux Gtk+ plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: familiar_callbacks.c,v 1.6.2.6 2002/10/02 20:12:02 jpsaman Exp $ * $Id: familiar_callbacks.c,v 1.6.2.7 2002/10/02 21:41:50 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -110,7 +110,6 @@ static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url ) ...@@ -110,7 +110,6 @@ static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url )
if (p_intf->p_sys->b_autoplayfile) if (p_intf->p_sys->b_autoplayfile)
{ {
intf_ErrMsg("autoplay selected");
/* end current item, select added item */ /* end current item, select added item */
if( p_input_bank->pp_input[0] != NULL ) if( p_input_bank->pp_input[0] != NULL )
{ {
...@@ -324,7 +323,6 @@ on_toolbar_play_clicked (GtkButton *button, ...@@ -324,7 +323,6 @@ on_toolbar_play_clicked (GtkButton *button,
{ {
intf_thread_t * p_intf = GtkGetIntf( button ); intf_thread_t * p_intf = GtkGetIntf( button );
if( p_input_bank->pp_input[0] != NULL ) if( p_input_bank->pp_input[0] != NULL )
{ {
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY ); input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
...@@ -352,10 +350,8 @@ on_toolbar_play_clicked (GtkButton *button, ...@@ -352,10 +350,8 @@ on_toolbar_play_clicked (GtkButton *button,
} }
else else
{ {
vlc_mutex_unlock( &p_main->p_playlist->change_lock ); vlc_mutex_unlock( &p_main->p_playlist->change_lock );
} }
} }
} }
...@@ -418,11 +414,19 @@ on_comboURL_entry_changed (GtkEditable *editable, ...@@ -418,11 +414,19 @@ 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 (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);
}
} }
} }
...@@ -475,24 +479,11 @@ on_clistmedia_select_row (GtkCList *clist, ...@@ -475,24 +479,11 @@ on_clistmedia_select_row (GtkCList *clist,
} }
} }
void void
on_cbautoplay_toggled (GtkToggleButton *togglebutton, on_cbautoplay_toggled (GtkToggleButton *togglebutton,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GtkGetIntf( togglebutton ); };
if (p_intf->p_sys->b_autoplayfile == 1)
{
p_intf->p_sys->b_autoplayfile = 0;
intf_ErrMsg("autoplay not selected");
}
else
{
p_intf->p_sys->b_autoplayfile = 1;
intf_ErrMsg("autoplay selected");
}
}
gboolean gboolean
...@@ -535,8 +526,10 @@ void ...@@ -535,8 +526,10 @@ void
on_buttonSave_clicked (GtkButton *button, on_buttonSave_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GtkGetIntf( button );
on_buttonApply_clicked( button, user_data ); on_buttonApply_clicked( button, user_data );
config_SaveConfigFile( NULL ); config_PutIntVariable( "familiar-autoplayfile", p_intf->p_sys->b_autoplayfile );
// config_SaveConfigFile( NULL );
} }
...@@ -544,17 +537,12 @@ void ...@@ -544,17 +537,12 @@ void
on_buttonApply_clicked (GtkButton *button, on_buttonApply_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
GtkWidget *apply_button; intf_thread_t * p_intf = GtkGetIntf( button );
// GHashTable *hash_table; GtkWidget *cbautoplay;
//
// hash_table = (GHashTable *)gtk_object_get_data( GTK_OBJECT(user_data), cbautoplay = GTK_WIDGET( gtk_object_get_data(
// "config_hash_table" ); GTK_OBJECT( p_intf->p_sys->p_window ), "cbautoplay" ) );
// g_hash_table_foreach_remove( hash_table, GtkSaveHashValue, NULL ); p_intf->p_sys->b_autoplayfile = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(cbautoplay));
/* change the highlight status of the Apply button */
apply_button = (GtkWidget *)gtk_object_get_data( GTK_OBJECT(user_data),
"buttonAapply" );
gtk_widget_set_sensitive( apply_button, FALSE );
} }
...@@ -562,6 +550,11 @@ void ...@@ -562,6 +550,11 @@ void
on_buttonCancel_clicked (GtkButton *button, on_buttonCancel_clicked (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
//gtk_widget_destroy( gtk_widget_get_toplevel( GTK_WIDGET (button) ) ); intf_thread_t * p_intf = GtkGetIntf( button );
GtkWidget *cbautoplay;
cbautoplay = GTK_WIDGET( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "cbautoplay" ) );
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(cbautoplay),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