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 */
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* familiar.h: private Gtk+ interface description
*****************************************************************************
* 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>
*
......@@ -32,10 +32,13 @@ struct intf_sys_t
module_t * p_gtk_main;
/* windows and widgets */
GtkWidget * p_window; /* main window */
GtkWidget * p_window; /* main window */
GtkEntry * p_mrlentry;
GtkNotebook * p_notebook;
GtkNotebook * p_mediabook;
GtkHScale * p_slider;
GtkCList * p_clist;
GtkCList * p_clistplaylist;
/* slider */
GtkLabel * p_slider_label;
......@@ -58,5 +61,9 @@ struct intf_sys_t
/*****************************************************************************
* 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 ) )
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