Commit e5a02487 authored by Marc Ariberti's avatar Marc Ariberti

* all: enhancements of the familiar interface includes :

    - the interface adapts to the screen size/rotation
    - a playlist
    - a network tab next to te file tab inside the media tab
    - MRL-Combo behaviour changed a bit
    - apply handling in preferences
parent 28484a0e
...@@ -7,6 +7,10 @@ SOURCES_familiar = \ ...@@ -7,6 +7,10 @@ SOURCES_familiar = \
modules/gui/familiar/support.h \ modules/gui/familiar/support.h \
modules/gui/familiar/callbacks.c \ modules/gui/familiar/callbacks.c \
modules/gui/familiar/callbacks.h \ modules/gui/familiar/callbacks.h \
modules/gui/familiar/network.c \
modules/gui/familiar/network.h \
modules/gui/familiar/playlist.c \
modules/gui/familiar/playlist.h \
$(NULL) $(NULL)
EXTRA_DIST += modules/gui/familiar/familiar.glade EXTRA_DIST += modules/gui/familiar/familiar.glade
...@@ -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.21 2003/02/26 15:47:26 marcari Exp $ * $Id: callbacks.c,v 1.22 2003/03/13 15:50:17 marcari Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
*****************************************************************************/ *****************************************************************************/
#include <sys/types.h> /* off_t */ #include <sys/types.h> /* off_t */
#include <stdlib.h> #include <stdlib.h>
#include <vlc/vlc.h> #include <vlc/vlc.h>
#include <vlc/intf.h> #include <vlc/intf.h>
#include <vlc/vout.h> #include <vlc/vout.h>
...@@ -43,12 +42,12 @@ ...@@ -43,12 +42,12 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "playlist.h"
#include "callbacks.h" #include "callbacks.h"
#include "interface.h" #include "interface.h"
#include "support.h" #include "support.h"
#include "familiar.h" #include "familiar.h"
static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url );
static char* get_file_perm(const char *path); static char* get_file_perm(const char *path);
/***************************************************************************** /*****************************************************************************
...@@ -88,7 +87,7 @@ void * E_(__GtkGetIntf)( GtkWidget * widget ) ...@@ -88,7 +87,7 @@ void * E_(__GtkGetIntf)( GtkWidget * widget )
/***************************************************************************** /*****************************************************************************
* Helper functions for URL changes in Media and Preferences notebook pages. * Helper functions for URL changes in Media and Preferences notebook pages.
****************************************************************************/ ****************************************************************************/
static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url ) void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url )
{ {
intf_thread_t *p_intf = GtkGetIntf( widget ); intf_thread_t *p_intf = GtkGetIntf( widget );
playlist_t *p_playlist; playlist_t *p_playlist;
...@@ -96,6 +95,12 @@ static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url ) ...@@ -96,6 +95,12 @@ static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url )
// Add p_url to playlist .... but how ? // Add p_url to playlist .... but how ?
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 == NULL)
{
return;
}
if( p_playlist ) if( p_playlist )
{ {
if (p_intf->p_sys->b_autoplayfile) if (p_intf->p_sys->b_autoplayfile)
...@@ -109,6 +114,7 @@ static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url ) ...@@ -109,6 +114,7 @@ static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url )
PLAYLIST_APPEND, PLAYLIST_END ); PLAYLIST_APPEND, PLAYLIST_END );
} }
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
FamiliarRebuildCList( p_intf->p_sys->p_clistplaylist, p_playlist);
} }
} }
...@@ -137,8 +143,7 @@ void ReadDirectory( GtkCList *clist, char *psz_dir ) ...@@ -137,8 +143,7 @@ void ReadDirectory( GtkCList *clist, char *psz_dir )
int i, ctr=0; int i, ctr=0;
gchar *ppsz_text[5]; gchar *ppsz_text[5];
msg_Dbg( p_intf, "updating interface" );
// msg_Dbg( p_intf, "updating interface" );
gtk_clist_freeze( clist ); gtk_clist_freeze( clist );
gtk_clist_clear( clist ); gtk_clist_clear( clist );
...@@ -151,10 +156,8 @@ void ReadDirectory( GtkCList *clist, char *psz_dir ) ...@@ -151,10 +156,8 @@ void ReadDirectory( GtkCList *clist, char *psz_dir )
gtk_clist_insert( GTK_CLIST(clist), ctr++, ppsz_text ); gtk_clist_insert( GTK_CLIST(clist), ctr++, ppsz_text );
/* /kludge */ /* /kludge */
for (i=0; i<n; i++) for (i=0; i<n; i++)
{ {
if (namelist[i]->d_name[0] != '.') if (namelist[i]->d_name[0] != '.')
{ {
/* This is a list of strings. */ /* This is a list of strings. */
...@@ -166,11 +169,17 @@ void ReadDirectory( GtkCList *clist, char *psz_dir ) ...@@ -166,11 +169,17 @@ void ReadDirectory( GtkCList *clist, char *psz_dir )
// msg_Dbg(p_intf, "(%d) file: %s permission: %s", i, ppsz_text[0], ppsz_text[1] ); // msg_Dbg(p_intf, "(%d) file: %s permission: %s", i, ppsz_text[0], ppsz_text[1] );
gtk_clist_insert( GTK_CLIST(clist), ctr++, ppsz_text ); gtk_clist_insert( GTK_CLIST(clist), ctr++, ppsz_text );
} }
free(namelist[i]);
} }
gtk_clist_thaw( clist ); gtk_clist_thaw( clist );
free(namelist); free(namelist);
} }
/* now switch to the "file" tab */
if (p_intf->p_sys->p_mediabook)
{
gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_mediabook) );
gtk_notebook_set_page(p_intf->p_sys->p_mediabook,0);
}
} }
static char* get_file_perm(const char *path) static char* get_file_perm(const char *path)
...@@ -273,6 +282,11 @@ on_toolbar_open_clicked (GtkButton *button, ...@@ -273,6 +282,11 @@ on_toolbar_open_clicked (GtkButton *button,
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); gtk_notebook_set_page(p_intf->p_sys->p_notebook,0);
} }
if (p_intf->p_sys->p_mediabook)
{
gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_mediabook) );
gtk_notebook_set_page(p_intf->p_sys->p_mediabook,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) if (p_intf->p_sys->p_clist)
{ {
...@@ -290,7 +304,7 @@ on_toolbar_preferences_clicked (GtkButton *button, ...@@ -290,7 +304,7 @@ on_toolbar_preferences_clicked (GtkButton *button,
if (p_intf->p_sys->p_notebook) 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); gtk_notebook_set_page(p_intf->p_sys->p_notebook,2);
} }
gdk_window_raise( p_intf->p_sys->p_window->window ); gdk_window_raise( p_intf->p_sys->p_window->window );
} }
...@@ -382,6 +396,21 @@ on_toolbar_forward_clicked (GtkButton *button, ...@@ -382,6 +396,21 @@ on_toolbar_forward_clicked (GtkButton *button,
} }
} }
void
on_toolbar_playlist_clicked (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET(button) );
// Toggle notebook
if (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 );
}
void void
on_toolbar_about_clicked (GtkButton *button, on_toolbar_about_clicked (GtkButton *button,
...@@ -393,7 +422,7 @@ on_toolbar_about_clicked (GtkButton *button, ...@@ -393,7 +422,7 @@ on_toolbar_about_clicked (GtkButton *button,
if (p_intf->p_sys->p_notebook) 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,2); gtk_notebook_set_page(p_intf->p_sys->p_notebook,3);
} }
gdk_window_raise( p_intf->p_sys->p_window->window ); gdk_window_raise( p_intf->p_sys->p_window->window );
} }
...@@ -407,8 +436,9 @@ on_comboURL_entry_changed (GtkEditable *editable, ...@@ -407,8 +436,9 @@ on_comboURL_entry_changed (GtkEditable *editable,
gchar * psz_url; gchar * psz_url;
struct stat st; struct stat st;
psz_url = gtk_entry_get_text(GTK_ENTRY(editable)); psz_url = gtk_entry_get_text(GTK_ENTRY(editable));
if( (strncmp("file://",(const char *) psz_url,7)==0) || /* if( (strncmp("file://",(const char *) psz_url,7)==0) ||
(strncmp("udp://",(const char *) psz_url,6)==0) || (strncmp("udp://",(const char *) psz_url,6)==0) ||
(strncmp("udp4://",(const char *) psz_url,7)==0) || (strncmp("udp4://",(const char *) psz_url,7)==0) ||
(strncmp("udp6://",(const char *) psz_url,7)==0) || (strncmp("udp6://",(const char *) psz_url,7)==0) ||
...@@ -418,11 +448,13 @@ on_comboURL_entry_changed (GtkEditable *editable, ...@@ -418,11 +448,13 @@ on_comboURL_entry_changed (GtkEditable *editable,
(strncmp("rtp6://",(const char *) psz_url,7)==0) || (strncmp("rtp6://",(const char *) psz_url,7)==0) ||
(strncmp("rtpstream://",(const char *) psz_url,12)==0) || (strncmp("rtpstream://",(const char *) psz_url,12)==0) ||
(strncmp("ftp://",(const char *) psz_url,6)==0) || (strncmp("ftp://",(const char *) psz_url,6)==0) ||
(strncmp("mms://",(const char *) psz_url,6)==0) ||
(strncmp("http://",(const char *) psz_url,7)==0) ) (strncmp("http://",(const char *) psz_url,7)==0) )
{ {
MediaURLOpenChanged(GTK_WIDGET(editable), psz_url); MediaURLOpenChanged(GTK_WIDGET(editable), psz_url);
} }
else if (lstat((char*)psz_url, &st)==0) else */
if (stat((char*)psz_url, &st)==0)
{ {
if (S_ISDIR(st.st_mode)) if (S_ISDIR(st.st_mode))
{ {
...@@ -500,8 +532,6 @@ void ...@@ -500,8 +532,6 @@ void
on_cbautoplay_toggled (GtkToggleButton *togglebutton, on_cbautoplay_toggled (GtkToggleButton *togglebutton,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t * p_intf = GtkGetIntf( GTK_WIDGET(togglebutton) );
p_intf->p_sys->b_autoplayfile = !p_intf->p_sys->b_autoplayfile;
} }
...@@ -545,3 +575,35 @@ FamiliarSliderPress (GtkWidget *widget, ...@@ -545,3 +575,35 @@ FamiliarSliderPress (GtkWidget *widget,
return FALSE; return FALSE;
} }
void
FamiliarMrlGo (GtkButton *button,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( button );
MediaURLOpenChanged( GTK_WIDGET( button ),
gtk_entry_get_text(p_intf->p_sys->p_mrlentry ) );
}
void
FamiliarPreferencesApply (GtkButton *button,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( GTK_WIDGET(button) );
GtkToggleButton * p_autopl_button = GTK_GET( TOGGLE_BUTTON, "cbautoplay" );
if (gtk_toggle_button_get_active(p_autopl_button))
{
p_intf->p_sys->b_autoplayfile = 1;
}
else
{
p_intf->p_sys->b_autoplayfile = 0;
}
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* callbacks.h : familiar plugin for vlc * callbacks.h : familiar plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * Copyright (C) 2002 VideoLAN
* $Id: callbacks.h,v 1.8 2003/01/03 20:55:00 jpsaman Exp $ * $Id: callbacks.h,v 1.9 2003/03/13 15:50:17 marcari Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -23,9 +23,13 @@ ...@@ -23,9 +23,13 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "network.h"
#include "playlist.h"
gboolean FamiliarExit ( GtkWidget *, gpointer ); gboolean FamiliarExit ( GtkWidget *, gpointer );
void ReadDirectory(GtkCList *clist, char *psz_dir); void ReadDirectory(GtkCList *clist, char *psz_dir);
void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url );
void void
on_toolbar_open_clicked (GtkButton *button, on_toolbar_open_clicked (GtkButton *button,
...@@ -95,3 +99,18 @@ gboolean ...@@ -95,3 +99,18 @@ gboolean
FamiliarSliderPress (GtkWidget *widget, FamiliarSliderPress (GtkWidget *widget,
GdkEventButton *event, GdkEventButton *event,
gpointer user_data); gpointer user_data);
void
FamiliarMrlGo (GtkButton *button,
gpointer user_data);
void
on_toolbar_playlist_clicked (GtkButton *button,
gpointer user_data);
void
FamiliarPreferencesApply (GtkButton *button,
gpointer user_data);
...@@ -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.30 2003/02/26 15:44:22 marcari Exp $ * $Id: familiar.c,v 1.31 2003/03/13 15:50:17 marcari Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* Marc Ariberti <marcari@videolan.org> * Marc Ariberti <marcari@videolan.org>
...@@ -174,6 +174,9 @@ static void Run( intf_thread_t *p_intf ) ...@@ -174,6 +174,9 @@ static void Run( intf_thread_t *p_intf )
add_pixmap_directory("/usr/local/share/pixmaps/vlc"); add_pixmap_directory("/usr/local/share/pixmaps/vlc");
/* Path for pixmaps under linupy */
add_pixmap_directory("/usr/local/share/pixmaps/vlc");
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)
{ {
...@@ -188,6 +191,8 @@ static void Run( intf_thread_t *p_intf ) ...@@ -188,6 +191,8 @@ static void Run( intf_thread_t *p_intf )
p_intf->p_sys->p_notebook = GTK_NOTEBOOK( gtk_object_get_data( p_intf->p_sys->p_notebook = GTK_NOTEBOOK( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "notebook" ) ); GTK_OBJECT( p_intf->p_sys->p_window ), "notebook" ) );
p_intf->p_sys->p_mediabook = GTK_NOTEBOOK( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "mediabook" ) );
/* Get the slider object */ /* Get the slider object */
p_intf->p_sys->p_slider = GTK_HSCALE( gtk_object_get_data( p_intf->p_sys->p_slider = GTK_HSCALE( gtk_object_get_data(
...@@ -213,6 +218,13 @@ static void Run( intf_thread_t *p_intf ) ...@@ -213,6 +218,13 @@ static void Run( intf_thread_t *p_intf )
gtk_clist_set_column_visibility (GTK_CLIST (p_intf->p_sys->p_clist), 4, FALSE); gtk_clist_set_column_visibility (GTK_CLIST (p_intf->p_sys->p_clist), 4, FALSE);
gtk_clist_column_titles_show (GTK_CLIST (p_intf->p_sys->p_clist)); gtk_clist_column_titles_show (GTK_CLIST (p_intf->p_sys->p_clist));
/* the playlist object */
p_intf->p_sys->p_clistplaylist = GTK_CLIST( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "clistplaylist" ) );
p_intf->p_sys->p_mrlentry = GTK_ENTRY( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "mrl_entry" ) );
/* Store p_intf to keep an eye on it */ /* Store p_intf to keep an eye on it */
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window), gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window),
"p_intf", p_intf ); "p_intf", p_intf );
...@@ -223,6 +235,10 @@ static void Run( intf_thread_t *p_intf ) ...@@ -223,6 +235,10 @@ static void Run( intf_thread_t *p_intf )
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, ".");
/* update the playlist */
FamiliarRebuildCList( p_intf->p_sys->p_clistplaylist,
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ));
#ifdef NEED_GTK_MAIN #ifdef NEED_GTK_MAIN
msg_Dbg( p_intf, "Manage GTK keyboard events using threads" ); msg_Dbg( p_intf, "Manage GTK keyboard events using threads" );
while( !p_intf->b_die ) while( !p_intf->b_die )
...@@ -330,8 +346,19 @@ static int Manage( intf_thread_t *p_intf ) ...@@ -330,8 +346,19 @@ static int Manage( intf_thread_t *p_intf )
/* New input or stream map change */ /* New input or stream map change */
if( p_input->stream.b_changed ) if( p_input->stream.b_changed )
{ {
playlist_t *p_playlist;
E_(GtkModeManage)( p_intf ); E_(GtkModeManage)( p_intf );
p_intf->p_sys->b_playing = 1; p_intf->p_sys->b_playing = 1;
/* update playlist interface */
p_playlist = (playlist_t *) vlc_object_find(
p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if (p_playlist != NULL)
{
FamiliarRebuildCList( p_intf->p_sys->p_clistplaylist,
p_playlist );
}
} }
/* Manage the slider */ /* Manage the slider */
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* familiar.h: private Gtk+ interface description * familiar.h: private Gtk+ interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: familiar.h,v 1.12 2003/01/04 13:30:02 jpsaman Exp $ * $Id: familiar.h,v 1.13 2003/03/13 15:50:17 marcari Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -33,9 +33,12 @@ struct intf_sys_t ...@@ -33,9 +33,12 @@ struct intf_sys_t
/* windows and widgets */ /* windows and widgets */
GtkWidget * p_window; /* main window */ GtkWidget * p_window; /* main window */
GtkEntry * p_mrlentry;
GtkNotebook * p_notebook; GtkNotebook * p_notebook;
GtkNotebook * p_mediabook;
GtkHScale * p_slider; GtkHScale * p_slider;
GtkCList * p_clist; GtkCList * p_clist;
GtkCList * p_clistplaylist;
/* slider */ /* slider */
GtkLabel * p_slider_label; GtkLabel * p_slider_label;
...@@ -58,5 +61,9 @@ struct intf_sys_t ...@@ -58,5 +61,9 @@ struct intf_sys_t
/***************************************************************************** /*****************************************************************************
* Useful macro * Useful macro
****************************************************************************/ ****************************************************************************/
#define GTK_GET( type, nom ) GTK_##type( gtk_object_get_data( \
GTK_OBJECT( p_intf->p_sys->p_window ), nom ) )
#define GtkGetIntf( widget ) E_(__GtkGetIntf)( GTK_WIDGET( widget ) ) #define GtkGetIntf( widget ) E_(__GtkGetIntf)( GTK_WIDGET( widget ) )
void * E_(__GtkGetIntf)( GtkWidget * ); void * E_(__GtkGetIntf)( GtkWidget * );
This diff is collapsed.
/*****************************************************************************
* network.c : Network interface of the gtk-familiar plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: network.c,v 1.1 2003/03/13 15:50:17 marcari Exp $
*
* Authors: Marc Ariberti <marcari@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <sys/types.h> /* off_t */
#include <stdlib.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/vout.h>
#include <stdio.h>
#include <string.h>
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
#include "callbacks.h"
#include "interface.h"
#include "support.h"
#include "familiar.h"
static void update_network_multicast(GtkWidget * widget);
static void update_network_multicast(GtkWidget * widget)
{
intf_thread_t * p_intf = GtkGetIntf( widget );
GtkToggleButton * p_network_multicast =
GTK_GET( TOGGLE_BUTTON, "network_multicast" );
GtkEditable * p_network_multicast_address =
GTK_GET( EDITABLE, "network_multicast_address" );
GtkEditable * p_network_multicast_port =
GTK_GET( EDITABLE, "network_multicast_port" );
if (gtk_toggle_button_get_active(p_network_multicast))
{
gchar * str = g_strconcat( "udp://@",
gtk_editable_get_chars(p_network_multicast_address, 0, -1), ":",
gtk_editable_get_chars(p_network_multicast_port, 0, -1), NULL );
gtk_entry_set_text(p_intf->p_sys->p_mrlentry, str);
g_free( str );
}
}
void
on_network_multicast_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
update_network_multicast(GTK_WIDGET(togglebutton));
}
void
on_network_multicast_port_changed (GtkEditable *editable,
gpointer user_data)
{
update_network_multicast(GTK_WIDGET(editable));
}
void
on_network_multicast_address_changed (GtkEditable *editable,
gpointer user_data)
{
update_network_multicast(GTK_WIDGET(editable));
}
void
on_network_http_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( togglebutton );
if (gtk_toggle_button_get_active(togglebutton))
{
gtk_entry_set_text(p_intf->p_sys->p_mrlentry, "http://");
}
}
void
on_network_ftp_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( togglebutton );
if (gtk_toggle_button_get_active(togglebutton))
{
gtk_entry_set_text(p_intf->p_sys->p_mrlentry, "ftp://");
}
}
void
on_network_mms_toggled (GtkToggleButton *togglebutton,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( togglebutton );
if (gtk_toggle_button_get_active(togglebutton))
{
gtk_entry_set_text(p_intf->p_sys->p_mrlentry, "mms://");
}
}
/*****************************************************************************
* network.h : Network part of the gtk-familiar plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: network.h,v 1.1 2003/03/13 15:50:17 marcari Exp $
*
* Authors: Marc Ariberti <marcari@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
void
on_network_udp_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
on_network_udp_port_changed (GtkEditable *editable,
gpointer user_data);
void
on_network_multicast_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
on_network_multicast_port_changed (GtkEditable *editable,
gpointer user_data);
void
on_network_multicast_address_changed (GtkEditable *editable,
gpointer user_data);
void
on_network_http_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
on_network_ftp_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
on_network_mms_toggled (GtkToggleButton *togglebutton,
gpointer user_data);
void
FamiliarNetworkGo (GtkButton *button,
gpointer user_data);
/*****************************************************************************
* playlist.c : Playlist interface of the gtk-familiar plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: playlist.c,v 1.1 2003/03/13 15:50:17 marcari Exp $
*
* Authors: Marc Ariberti <marcari@videolan.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <sys/types.h> /* off_t */
#include <stdlib.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/vout.h>
#include <stdio.h>
#include <string.h>
#include <dirent.h>
#include <sys/stat.h>
#include <unistd.h>
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
#include "interface.h"
#include "support.h"
#include "familiar.h"
#include "playlist.h"
gboolean
FamiliarPlaylistEvent (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( widget );
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return FALSE;
}
if( ( event->button ).type == GDK_2BUTTON_PRESS )
{
GtkCList * p_clist;
gint i_row;
gint i_col;
p_clist = p_intf->p_sys->p_clistplaylist;
if( gtk_clist_get_selection_info( p_clist, (event->button).x,
(event->button).y, &i_row, &i_col ) == 1 )
{
playlist_Goto( p_playlist, i_row );
}
vlc_object_release( p_playlist );
FamiliarRebuildCList( p_clist, p_playlist );
return TRUE;
}
vlc_object_release( p_playlist );
return FALSE;
}
void
FamiliarPlaylistClear (GtkButton *button,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( button );
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
int item;
if( p_playlist == NULL )
{
return;
}
for(item = p_playlist->i_size - 1 ; item >= 0 ; item-- )
{
playlist_Delete( p_playlist, item);
}
vlc_object_release( p_playlist );
FamiliarRebuildCList( p_intf->p_sys->p_clistplaylist, p_playlist);
}
void FamiliarRebuildCList( GtkCList * p_clist, playlist_t * p_playlist )
{
int i_dummy;
gchar * ppsz_text[2];
GdkColor red;
red.red = 65535;
red.blue = 0;
red.green = 0;
gtk_clist_freeze( p_clist );
gtk_clist_clear( p_clist );
vlc_mutex_lock( &p_playlist->object_lock );
for( i_dummy = p_playlist->i_size ; i_dummy-- ; )
{
ppsz_text[0] = p_playlist->pp_items[i_dummy]->psz_name;
ppsz_text[1] = "no info";
gtk_clist_insert( p_clist, 0, ppsz_text );
}
vlc_mutex_unlock( &p_playlist->object_lock );
gtk_clist_set_background( p_clist, p_playlist->i_index, &red);
gtk_clist_thaw( p_clist );
}
void
FamiliarPlaylistUpdate (GtkButton *button,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( button );
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
FamiliarRebuildCList( p_intf->p_sys->p_clistplaylist, p_playlist );
}
static void FamiliarDeleteGListItem( gpointer data, gpointer param )
{
int i_cur_row = (long)data;
playlist_t * p_playlist = param;
playlist_Delete( p_playlist, i_cur_row );
}
static gint FamiliarCompareItems( gconstpointer a, gconstpointer b )
{
return (ptrdiff_t) ( (int *)b - (int *)a );
}
void
FamiliarPlaylistDel (GtkButton *button,
gpointer user_data)
{
/* user wants to delete a file in the queue */
GList * p_selection;
intf_thread_t * p_intf = GtkGetIntf( button );
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist == NULL )
{
return;
}
/* lock the struct */
vlc_mutex_lock( &p_intf->change_lock );
p_selection = p_intf->p_sys->p_clistplaylist->selection;
if( g_list_length( p_selection ) )
{
/* reverse-sort so that we can delete from the furthest
* to the closest item to delete...
*/
p_selection = g_list_sort( p_selection, FamiliarCompareItems );
g_list_foreach( p_selection, FamiliarDeleteGListItem, p_playlist );
}
vlc_mutex_unlock( &p_intf->change_lock );
vlc_object_release( p_playlist );
FamiliarRebuildCList( p_intf->p_sys->p_clistplaylist, p_playlist );
}
gboolean
FamiliarPlaylistEvent (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
void FamiliarRebuildCList( GtkCList * p_clist, playlist_t * p_playlist );
void FamiliarPlaylistClear (GtkButton *button,
gpointer user_data);
void
FamiliarPlaylistUpdate (GtkButton *button,
gpointer user_data);
void
FamiliarPlaylistDel (GtkButton *button,
gpointer user_data);
/* XPM */
static char * familiar_playlistb16x16_xpm[] = {
"16 16 2 1",
" c None",
". c #000000",
" ",
" ............ ",
" ............ ",
" .. .. ",
" .. .. ",
" ............ ",
" ............ ",
" .. .. ",
" .. .. ",
" ............ ",
" ............ ",
" .. .. ",
" .. .. ",
" ............ ",
" ............ ",
" "};
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