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 = \
modules/gui/familiar/support.h \
modules/gui/familiar/callbacks.c \
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)
EXTRA_DIST += modules/gui/familiar/familiar.glade
......@@ -2,7 +2,7 @@
* callbacks.c : Callbacks for the Familiar Linux Gtk+ plugin.
*****************************************************************************
* 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>
*
......@@ -26,7 +26,6 @@
*****************************************************************************/
#include <sys/types.h> /* off_t */
#include <stdlib.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/vout.h>
......@@ -43,12 +42,12 @@
#include <gtk/gtk.h>
#include "playlist.h"
#include "callbacks.h"
#include "interface.h"
#include "support.h"
#include "familiar.h"
static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url );
static char* get_file_perm(const char *path);
/*****************************************************************************
......@@ -88,7 +87,7 @@ void * E_(__GtkGetIntf)( GtkWidget * widget )
/*****************************************************************************
* 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 );
playlist_t *p_playlist;
......@@ -96,6 +95,12 @@ static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url )
// Add p_url to playlist .... but how ?
p_playlist = (playlist_t *)
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist == NULL)
{
return;
}
if( p_playlist )
{
if (p_intf->p_sys->b_autoplayfile)
......@@ -108,7 +113,8 @@ static void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url )
playlist_Add( p_playlist, (char*)psz_url,
PLAYLIST_APPEND, PLAYLIST_END );
}
vlc_object_release( p_playlist );
vlc_object_release( p_playlist );
FamiliarRebuildCList( p_intf->p_sys->p_clistplaylist, p_playlist);
}
}
......@@ -129,7 +135,7 @@ void ReadDirectory( GtkCList *clist, char *psz_dir )
msg_Err( p_intf, "permision denied" );
}
n = scandir(".", &namelist, 0, alphasort);
if (n<0)
perror("scandir");
else
......@@ -137,24 +143,21 @@ void ReadDirectory( GtkCList *clist, char *psz_dir )
int i, ctr=0;
gchar *ppsz_text[5];
// msg_Dbg( p_intf, "updating interface" );
msg_Dbg( p_intf, "updating interface" );
gtk_clist_freeze( clist );
gtk_clist_clear( clist );
/* XXX : kludge temporaire pour yopy */
ppsz_text[0]="..";
ppsz_text[1] = get_file_perm("..");
ppsz_text[2] = "";
ppsz_text[3] = "";
ppsz_text[4] = "";
gtk_clist_insert( GTK_CLIST(clist), ctr++, ppsz_text );
gtk_clist_insert( GTK_CLIST(clist), ctr++, ppsz_text );
/* /kludge */
for (i=0; i<n; i++)
{
if (namelist[i]->d_name[0] != '.')
{
/* This is a list of strings. */
......@@ -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] );
gtk_clist_insert( GTK_CLIST(clist), ctr++, ppsz_text );
}
free(namelist[i]);
}
gtk_clist_thaw( clist );
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)
......@@ -273,6 +282,11 @@ on_toolbar_open_clicked (GtkButton *button,
gtk_widget_show( GTK_WIDGET(p_intf->p_sys->p_notebook) );
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 );
if (p_intf->p_sys->p_clist)
{
......@@ -290,7 +304,7 @@ on_toolbar_preferences_clicked (GtkButton *button,
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);
gtk_notebook_set_page(p_intf->p_sys->p_notebook,2);
}
gdk_window_raise( p_intf->p_sys->p_window->window );
}
......@@ -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
on_toolbar_about_clicked (GtkButton *button,
......@@ -393,7 +422,7 @@ on_toolbar_about_clicked (GtkButton *button,
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,2);
gtk_notebook_set_page(p_intf->p_sys->p_notebook,3);
}
gdk_window_raise( p_intf->p_sys->p_window->window );
}
......@@ -407,8 +436,9 @@ on_comboURL_entry_changed (GtkEditable *editable,
gchar * psz_url;
struct stat st;
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("udp4://",(const char *) psz_url,7)==0) ||
(strncmp("udp6://",(const char *) psz_url,7)==0) ||
......@@ -418,16 +448,18 @@ on_comboURL_entry_changed (GtkEditable *editable,
(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("mms://",(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)
else */
if (stat((char*)psz_url, &st)==0)
{
if (S_ISDIR(st.st_mode))
{
if (!p_intf->p_sys->p_clist)
msg_Err(p_intf, "p_clist pointer invalid!!" );
if (!p_intf->p_sys->p_clist)
msg_Err(p_intf, "p_clist pointer invalid!!" );
ReadDirectory(p_intf->p_sys->p_clist, psz_url);
}
else if( (S_ISLNK(st.st_mode)) || (S_ISCHR(st.st_mode)) ||
......@@ -436,7 +468,7 @@ on_comboURL_entry_changed (GtkEditable *editable,
{
MediaURLOpenChanged(GTK_WIDGET(editable), psz_url);
}
}
}
}
......@@ -500,8 +532,6 @@ void
on_cbautoplay_toggled (GtkToggleButton *togglebutton,
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,
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 @@
* callbacks.h : familiar plugin for vlc
*****************************************************************************
* 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>
*
......@@ -23,9 +23,13 @@
#include <gtk/gtk.h>
#include "network.h"
#include "playlist.h"
gboolean FamiliarExit ( GtkWidget *, gpointer );
void ReadDirectory(GtkCList *clist, char *psz_dir);
void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url );
void
on_toolbar_open_clicked (GtkButton *button,
......@@ -95,3 +99,18 @@ gboolean
FamiliarSliderPress (GtkWidget *widget,
GdkEventButton *event,
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 @@
* familiar.c : familiar plugin for vlc
*****************************************************************************
* 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>
* Marc Ariberti <marcari@videolan.org>
......@@ -174,6 +174,9 @@ static void Run( intf_thread_t *p_intf )
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();
if (p_intf->p_sys->p_window == NULL)
{
......@@ -188,6 +191,8 @@ static void Run( intf_thread_t *p_intf )
p_intf->p_sys->p_notebook = GTK_NOTEBOOK( gtk_object_get_data(
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 */
p_intf->p_sys->p_slider = GTK_HSCALE( gtk_object_get_data(
......@@ -213,16 +218,27 @@ 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_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 */
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window),
"p_intf", p_intf );
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_adj),
"p_intf", p_intf );
/* Show the control window */
gtk_widget_show( p_intf->p_sys->p_window );
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
msg_Dbg( p_intf, "Manage GTK keyboard events using threads" );
while( !p_intf->b_die )
......@@ -330,8 +346,19 @@ static int Manage( intf_thread_t *p_intf )
/* New input or stream map change */
if( p_input->stream.b_changed )
{
playlist_t *p_playlist;
E_(GtkModeManage)( p_intf );
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 */
......
......@@ -18,8 +18,6 @@
<widget>
<class>GtkWindow</class>
<name>familiar</name>
<width>240</width>
<height>320</height>
<signal>
<name>delete_event</name>
<handler>on_familiar_delete_event</handler>
......@@ -42,8 +40,8 @@
<widget>
<class>GtkToolbar</class>
<name>toolbar</name>
<width>112</width>
<height>16</height>
<width>240</width>
<height>12</height>
<orientation>GTK_ORIENTATION_HORIZONTAL</orientation>
<type>GTK_TOOLBAR_ICONS</type>
<space_size>5</space_size>
......@@ -51,9 +49,9 @@
<relief>GTK_RELIEF_NORMAL</relief>
<tooltips>True</tooltips>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
<padding>5</padding>
<expand>False</expand>
<fill>False</fill>
</child>
<widget>
......@@ -66,10 +64,23 @@
<handler>on_toolbar_open_clicked</handler>
<last_modification_time>Wed, 24 Jul 2002 18:28:31 GMT</last_modification_time>
</signal>
<label>Open</label>
<label></label>
<icon>familiar-openb16x16.xpm</icon>
</widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
<name>toolbar_playlist</name>
<signal>
<name>clicked</name>
<handler>on_toolbar_playlist_clicked</handler>
<last_modification_time>Wed, 05 Mar 2003 22:04:46 GMT</last_modification_time>
</signal>
<label></label>
<icon>familiar-playlistb16x16.xpm</icon>
</widget>
<widget>
<class>GtkButton</class>
<child_name>Toolbar:button</child_name>
......@@ -215,8 +226,8 @@
<page>6.25</page>
<page_size>0</page_size>
<child>
<padding>0</padding>
<expand>True</expand>
<padding>4</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
......@@ -236,56 +247,526 @@
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkFixed</class>
<name>fixedMedia</name>
<class>GtkVBox</class>
<name>vbox1</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkLabel</class>
<name>labelUrl</name>
<x>4</x>
<y>8</y>
<width>38</width>
<height>18</height>
<label>URL:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<class>GtkHBox</class>
<name>hbox1</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkButton</class>
<name>buttonMrlGo</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>FamiliarMrlGo</handler>
<last_modification_time>Wed, 05 Mar 2003 21:47:31 GMT</last_modification_time>
</signal>
<label>Add</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>labelUrl</name>
<label>MRL :</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>2</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkCombo</class>
<name>mrl_combo</name>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items>file://
ftp://
http://
udp://@:1234
udp6://@:1234
rtp://
rtp6://
</items>
<child>
<padding>3</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>mrl_entry</name>
<can_focus>True</can_focus>
<signal>
<name>changed</name>
<handler>on_comboURL-entry_changed</handler>
<last_modification_time>Sun, 09 Feb 2003 13:32:46 GMT</last_modification_time>
</signal>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text>file://</text>
</widget>
</widget>
</widget>
<widget>
<class>GtkNotebook</class>
<name>mediabook</name>
<can_focus>True</can_focus>
<show_tabs>True</show_tabs>
<show_border>True</show_border>
<tab_pos>GTK_POS_TOP</tab_pos>
<scrollable>False</scrollable>
<tab_hborder>2</tab_hborder>
<tab_vborder>2</tab_vborder>
<popup_enable>False</popup_enable>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow4</name>
<hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<widget>
<class>GtkViewport</class>
<name>viewport2</name>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<widget>
<class>GtkCList</class>
<name>clistmedia</name>
<can_focus>True</can_focus>
<signal>
<name>select_row</name>
<handler>on_clistmedia_select_row</handler>
<last_modification_time>Sun, 09 Feb 2003 13:33:18 GMT</last_modification_time>
</signal>
<signal>
<name>click_column</name>
<handler>on_clistmedia_click_column</handler>
<last_modification_time>Sun, 09 Feb 2003 13:33:22 GMT</last_modification_time>
</signal>
<columns>2</columns>
<column_widths>129,80</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>labelname</name>
<label>Name</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>labeltype</name>
<label>Type</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>