1
mirror of https://code.videolan.org/videolan/vlc synced 2024-07-21 07:24:15 +02:00

Implementing new PDA User Interface design using the GTK2 widget set. This interface is currently in a rewrite and is currently unuseable. However:

- it compiles ;-)
- will have more UI assets to tweak with, then the old interface had
  to name a few: supports stream out, camera's through v4l, use preferences,
  manage playlists, play audio/video local and from a network source
- is not functional (yet)

So expect more functionality to come in and the necessary bug fixes.
This commit is contained in:
Jean-Paul Saman 2003-10-01 20:58:45 +00:00
parent 699c64c8db
commit 2f72e38f4f
10 changed files with 2742 additions and 52 deletions

View File

@ -1,16 +1,12 @@
SOURCES_pda = \
pda.c \
pda.h \
interface.c \
interface.h \
support.c \
support.h \
callbacks.c \
callbacks.h \
network.c \
network.h \
playlist.c \
playlist.h \
pda_interface.c \
pda_interface.h \
pda_support.c \
pda_support.h \
pda_callbacks.c \
pda_callbacks.h \
$(NULL)
EXTRA_DIST += pda.glade \

View File

@ -2,7 +2,7 @@
* pda.c : PDA Gtk2 plugin for vlc
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: pda.c,v 1.2 2003/07/27 21:35:51 jpsaman Exp $
* $Id: pda.c,v 1.3 2003/10/01 20:58:45 jpsaman Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* Marc Ariberti <marcari@videolan.org>
@ -39,9 +39,9 @@
#include <gpe/init.h>
#endif
#include "callbacks.h"
#include "interface.h"
#include "support.h"
#include "pda_callbacks.h"
#include "pda_interface.h"
#include "pda_support.h"
#include "pda.h"
/*****************************************************************************
@ -68,7 +68,7 @@ gint E_(GtkModeManage) ( intf_thread_t * p_intf );
*****************************************************************************/
vlc_module_begin();
add_category_hint( N_("Miscellaneous"), NULL, VLC_TRUE );
add_bool( "pda-autoplayfile", 1, GtkAutoPlayFile, AUTOPLAYFILE_TEXT, AUTOPLAYFILE_LONGTEXT, VLC_TRUE );
// add_bool( "pda-autoplayfile", 1, GtkAutoPlayFile, AUTOPLAYFILE_TEXT, AUTOPLAYFILE_LONGTEXT, VLC_TRUE );
set_description( _("PDA Linux Gtk2+ interface") );
set_capability( "interface", 70 );
set_callbacks( Open, Close );
@ -90,7 +90,7 @@ static int Open( vlc_object_t *p_this )
return VLC_ENOMEM;
}
#ifdef NEED_GTK_MAIN
#ifdef NEED_GTK2_MAIN
msg_Dbg( p_intf, "Using gui-helper" );
p_intf->p_sys->p_gtk_main = module_Need( p_this, "gui-helper", "gtk2" );
if( p_intf->p_sys->p_gtk_main == NULL )
@ -124,7 +124,7 @@ static void Close( vlc_object_t *p_this )
vlc_object_release( p_intf->p_sys->p_input );
}
#ifdef NEED_GTK_MAIN
#ifdef NEED_GTK2_MAIN
msg_Dbg( p_intf, "Releasing gui-helper" );
module_Unneed( p_intf, p_intf->p_sys->p_gtk_main );
#endif
@ -141,7 +141,7 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
#ifndef NEED_GTK_MAIN
#ifndef NEED_GTK2_MAIN
/* gtk_init needs to know the command line. We don't care, so we
* give it an empty one */
char *p_args[] = { "", NULL };
@ -149,6 +149,8 @@ static void Run( intf_thread_t *p_intf )
int i_args = 1;
int i_dummy;
#endif
GtkListStore *filelist = NULL;
GtkListStore *playlist = NULL;
#ifdef HAVE_GPE_INIT_H
/* Initialize GPE interface */
@ -157,7 +159,7 @@ static void Run( intf_thread_t *p_intf )
exit (1);
#else
gtk_set_locale ();
# ifndef NEED_GTK_MAIN
# ifndef NEED_GTK2_MAIN
msg_Dbg( p_intf, "Starting pda GTK2+ interface" );
gtk_init( &i_args, &pp_args );
# else
@ -183,8 +185,13 @@ static void Run( intf_thread_t *p_intf )
{
msg_Err( p_intf, "unable to create pda interface" );
}
gtk_widget_set_usize(p_intf->p_sys->p_window,
gdk_screen_width() , gdk_screen_height() - 30 );
#if 0
msg_Dbg( p_intf, "setting main window size ... " );
gtk_widget_set_usize(p_intf->p_sys->p_window,
gdk_screen_width() , gdk_screen_height() - 30 );
msg_Dbg( p_intf, "setting main window size ... done" );
#endif
/* Set the title of the main window */
gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window),
@ -201,7 +208,9 @@ static void Run( intf_thread_t *p_intf )
p_intf->p_sys->p_slider_label = GTK_LABEL( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "slider_label" ) );
#if 0
/* Connect the date display to the slider */
msg_Dbg( p_intf, "setting slider adjustment ... " );
#define P_SLIDER GTK_RANGE( gtk_object_get_data( \
GTK_OBJECT( p_intf->p_sys->p_window ), "slider" ) )
p_intf->p_sys->p_adj = gtk_range_get_adjustment( P_SLIDER );
@ -211,36 +220,62 @@ static void Run( intf_thread_t *p_intf )
p_intf->p_sys->f_adj_oldvalue = 0;
p_intf->p_sys->i_adj_oldvalue = 0;
#undef P_SLIDER
msg_Dbg( p_intf, "setting slider adjustment ... done" );
#endif
p_intf->p_sys->p_clist = GTK_CLIST( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "clistmedia" ) );
gtk_clist_set_column_visibility (GTK_CLIST (p_intf->p_sys->p_clist), 2, FALSE);
gtk_clist_set_column_visibility (GTK_CLIST (p_intf->p_sys->p_clist), 3, 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));
msg_Dbg(p_intf, "Getting GtkTreeView FileList" );
p_intf->p_sys->p_tvfile = NULL;
p_intf->p_sys->p_tvfile = (GtkTreeView *) lookup_widget( p_intf->p_sys->p_window,
"tvFileList");
if (NULL == p_intf->p_sys->p_tvfile)
msg_Err(p_intf, "Error obtaining pointer to File List");
/* the playlist object */
p_intf->p_sys->p_clistplaylist = GTK_CLIST( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "clistplaylist" ) );
msg_Dbg(p_intf, "Getting GtkTreeView PlayList" );
p_intf->p_sys->p_tvplaylist = NULL;
p_intf->p_sys->p_tvplaylist = (GtkTreeView *) lookup_widget( p_intf->p_sys->p_window,
"tvPlaylist");
if (NULL == p_intf->p_sys->p_tvplaylist)
msg_Err(p_intf, "Error obtaining pointer to Play List");
p_intf->p_sys->p_mrlentry = GTK_ENTRY( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "mrl_entry" ) );
#if 0
/* Store p_intf to keep an eye on it */
msg_Dbg( p_intf, "trying to store p_intf pointer ... " );
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 );
msg_Dbg( p_intf, "trying to store p_intf pointer ... done" );
#endif
/* Show the control window */
gtk_widget_show( p_intf->p_sys->p_window );
ReadDirectory(p_intf->p_sys->p_clist, ".");
/* Get new directory listing */
msg_Dbg(p_intf, "Populating GtkTreeView FileList" );
filelist = gtk_list_store_new (5,
G_TYPE_STRING, /* Filename */
G_TYPE_STRING, /* permissions */
G_TYPE_STRING, /* File size */
G_TYPE_STRING, /* Owner */
G_TYPE_STRING);/* Group */
ReadDirectory(p_intf, filelist, ".");
msg_Dbg(p_intf, "Showing GtkTreeView FileList" );
gtk_tree_view_set_model(p_intf->p_sys->p_tvfile, (GtkTreeModel*) filelist);
/* update the playlist */
PDARebuildCList( p_intf->p_sys->p_clistplaylist,
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ));
#ifdef NEED_GTK_MAIN
msg_Dbg(p_intf, "Populating GtkTreeView Playlist" );
playlist = gtk_list_store_new (2,
G_TYPE_STRING,
G_TYPE_STRING);
PlaylistRebuildListStore( playlist, vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ));
msg_Dbg(p_intf, "Showing GtkTreeView Playlist" );
gtk_tree_view_set_model(p_intf->p_sys->p_tvplaylist, (GtkTreeModel*) playlist);
#ifdef NEED_GTK2_MAIN
msg_Dbg( p_intf, "Manage GTK keyboard events using threads" );
while( !p_intf->b_die )
{
@ -271,7 +306,7 @@ static void Run( intf_thread_t *p_intf )
#endif
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) );
#ifdef NEED_GTK_MAIN
#ifdef NEED_GTK2_MAIN
gdk_threads_leave();
#endif
}
@ -323,6 +358,7 @@ void GtkAutoPlayFile( vlc_object_t *p_this )
*****************************************************************************/
static int Manage( intf_thread_t *p_intf )
{
GtkListStore *p_liststore;
vlc_mutex_lock( &p_intf->change_lock );
/* Update the input */
@ -357,8 +393,13 @@ static int Manage( intf_thread_t *p_intf )
p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if (p_playlist != NULL)
{
PDARebuildCList( p_intf->p_sys->p_clistplaylist,
p_playlist );
msg_Dbg(p_intf, "Manage: Populating GtkTreeView Playlist" );
p_liststore = gtk_list_store_new (2,
G_TYPE_STRING,
G_TYPE_STRING);
PlaylistRebuildListStore(p_liststore, p_playlist);
msg_Dbg(p_intf, "Manage: Updating GtkTreeView Playlist" );
gtk_tree_view_set_model(p_intf->p_sys->p_tvplaylist, (GtkTreeModel*) p_liststore);
}
}
@ -444,7 +485,7 @@ static int Manage( intf_thread_t *p_intf )
p_intf->p_sys->b_playing = 0;
}
#ifndef NEED_GTK_MAIN
#ifndef NEED_GTK2_MAIN
if( p_intf->b_die )
{
vlc_mutex_unlock( &p_intf->change_lock );
@ -530,9 +571,9 @@ gint E_(GtkModeManage)( intf_thread_t * p_intf )
}
/* set control items */
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_rewind"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_pause"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_forward"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "tbRewind"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "tbPause"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "tbForward"), b_control );
#undef GETWIDGET
return TRUE;

View File

@ -1889,7 +1889,7 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="tbPlaylist">
<widget class="GtkTreeView" id="tvPlaylist">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>

View File

@ -2,7 +2,7 @@
* pda.h: private Gtk+ interface description
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: pda.h,v 1.1 2003/07/23 22:02:56 jpsaman Exp $
* $Id: pda.h,v 1.2 2003/10/01 20:58:45 jpsaman Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
@ -29,16 +29,16 @@
struct intf_sys_t
{
/* The gtk_main module */
module_t * p_gtk_main;
module_t *p_gtk_main;
/* windows and widgets */
GtkWidget * p_window; /* main window */
GtkEntry * p_mrlentry;
GtkNotebook * p_notebook;
GtkNotebook * p_mediabook;
GtkHScale * p_slider;
GtkCList * p_clist;
GtkCList * p_clistplaylist;
GtkWidget *p_window; /* main window */
GtkEntry *p_mrlentry;
GtkNotebook *p_notebook;
GtkNotebook *p_mediabook;
GtkHScale *p_slider;
GtkTreeView *p_tvfile;
GtkTreeView *p_tvplaylist;
/* slider */
GtkLabel * p_slider_label;

View File

@ -0,0 +1,906 @@
/*****************************************************************************
* pda_callbacks.c : Callbacks for the pda Linux Gtk+ plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: pda_callbacks.c,v 1.1 2003/10/01 20:58:45 jpsaman Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
* 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 "pda_callbacks.h"
#include "pda_interface.h"
#include "pda_support.h"
#include "pda.h"
static char* get_file_perm(const char *path);
/*****************************************************************************
* Useful function to retrieve p_intf
****************************************************************************/
void * E_(__GtkGetIntf)( GtkWidget * widget )
{
void *p_data;
if( GTK_IS_MENU_ITEM( widget ) )
{
/* Look for a GTK_MENU */
while( widget->parent && !GTK_IS_MENU( widget ) )
{
widget = widget->parent;
}
/* Maybe this one has the data */
p_data = gtk_object_get_data( GTK_OBJECT( widget ), "p_intf" );
if( p_data )
{
return p_data;
}
/* Otherwise, the parent widget has it */
widget = gtk_menu_get_attach_widget( GTK_MENU( widget ) );
}
/* We look for the top widget */
widget = gtk_widget_get_toplevel( GTK_WIDGET( widget ) );
p_data = gtk_object_get_data( GTK_OBJECT( widget ), "p_intf" );
return p_data;
}
void PlaylistRebuildListStore( GtkListStore * p_list, playlist_t * p_playlist )
{
GtkTreeIter iter;
int i_dummy;
gchar * ppsz_text[2];
GdkColor red;
red.red = 65535;
red.blue = 0;
red.green = 0;
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_list_store_append (p_list, &iter);
gtk_list_store_set (p_list, &iter,
0, ppsz_text[0],
1, ppsz_text[1],
-1);
}
vlc_mutex_unlock( &p_playlist->object_lock );
}
/*****************************************************************************
* Helper functions for URL changes in Media and Preferences notebook pages.
****************************************************************************/
void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url )
{
intf_thread_t *p_intf = GtkGetIntf( widget );
playlist_t *p_playlist;
GtkListStore *p_liststore;
// 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)
{
playlist_Add( p_playlist, (char*)psz_url, 0, 0,
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END);
}
else
{
playlist_Add( p_playlist, (char*)psz_url, 0, 0,
PLAYLIST_APPEND, PLAYLIST_END );
}
vlc_object_release( p_playlist );
msg_Dbg(p_intf, "MediaURLOpenChange: Populating GtkTreeView Playlist" );
p_liststore = gtk_list_store_new (2,
G_TYPE_STRING,
G_TYPE_STRING);
PlaylistRebuildListStore(p_liststore, p_playlist);
msg_Dbg(p_intf, "MediaURLOpenChange: Updating GtkTreeView Playlist" );
gtk_tree_view_set_model(p_intf->p_sys->p_tvplaylist, (GtkTreeModel*) p_liststore);
}
}
/*****************************************************************
* Read directory helper function.
****************************************************************/
void ReadDirectory( intf_thread_t *p_intf, GtkListStore *p_list, char *psz_dir )
{
// intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET(p_list) );
GtkTreeIter iter;
struct dirent **namelist;
int n=-1, status=-1;
msg_Dbg(p_intf, "changing to dir %s", psz_dir);
if (psz_dir)
{
status = chdir(psz_dir);
if (status<0)
msg_Err( p_intf, "permision denied" );
}
n = scandir(".", &namelist, 0, alphasort);
if (n<0)
perror("scandir");
else
{
int i;
gchar *ppsz_text[5];
msg_Dbg( p_intf, "updating interface" );
/* XXX : kludge temporaire pour yopy */
ppsz_text[0]="..";
ppsz_text[1] = get_file_perm("..");
ppsz_text[2] = "";
ppsz_text[3] = "";
ppsz_text[4] = "";
/* Add a new row to the model */
gtk_list_store_append (p_list, &iter);
gtk_list_store_set (p_list, &iter,
0, ppsz_text[0],
1, ppsz_text[1],
2, ppsz_text[2],
3, ppsz_text[3],
4, ppsz_text[4],
-1);
/* kludge */
for (i=0; i<n; i++)
{
if (namelist[i]->d_name[0] != '.')
{
/* This is a list of strings. */
ppsz_text[0] = namelist[i]->d_name;
ppsz_text[1] = get_file_perm(namelist[i]->d_name);
ppsz_text[2] = "";
ppsz_text[3] = "";
ppsz_text[4] = "";
msg_Dbg(p_intf, "(%d) file: %s permission: %s", i, ppsz_text[0], ppsz_text[1] );
gtk_list_store_append (p_list, &iter);
gtk_list_store_set (p_list, &iter,
0, ppsz_text[0],
1, ppsz_text[1],
2, ppsz_text[2],
3, ppsz_text[3],
4, ppsz_text[4],
-1);
}
}
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)
{
struct stat st;
char *perm;
perm = (char *) malloc(sizeof(char)*10);
strncpy( perm, "----------", sizeof("----------"));
if (lstat(path, &st)==0)
{
if (S_ISLNK(st.st_mode))
perm[0]= 'l';
else if (S_ISDIR(st.st_mode))
perm[0]= 'd';
else if (S_ISCHR(st.st_mode))
perm[0]= 'c';
else if (S_ISBLK(st.st_mode))
perm[0]= 'b';
else if (S_ISFIFO(st.st_mode))
perm[0]= 'f';
else if (S_ISSOCK(st.st_mode))
perm[0]= 's';
else if (S_ISREG(st.st_mode))
perm[0]= '-';
else /* Unknown type is an error */
perm[0]= '?';
/* Get file permissions */
/* User */
if (st.st_mode & S_IRUSR)
perm[1]= 'r';
if (st.st_mode & S_IWUSR)
perm[2]= 'w';
if (st.st_mode & S_IXUSR)
{
if (st.st_mode & S_ISUID)
perm[3] = 's';
else
perm[3]= 'x';
}
else if (st.st_mode & S_ISUID)
perm[3] = 'S';
/* Group */
if (st.st_mode & S_IRGRP)
perm[4]= 'r';
if (st.st_mode & S_IWGRP)
perm[5]= 'w';
if (st.st_mode & S_IXGRP)
{
if (st.st_mode & S_ISGID)
perm[6] = 's';
else
perm[6]= 'x';
}
else if (st.st_mode & S_ISGID)
perm[6] = 'S';
/* Other */
if (st.st_mode & S_IROTH)
perm[7]= 'r';
if (st.st_mode & S_IWOTH)
perm[8]= 'w';
if (st.st_mode & S_IXOTH)
{
// 'sticky' bit
if (st.st_mode &S_ISVTX)
perm[9] = 't';
else
perm[9]= 'x';
}
else if (st.st_mode &S_ISVTX)
perm[9]= 'T';
}
return perm;
}
/*
* Main interface callbacks
*/
gboolean
onPDADeleteEvent (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
intf_thread_t *p_intf = GtkGetIntf( widget );
vlc_mutex_lock( &p_intf->change_lock );
p_intf->p_vlc->b_die = VLC_TRUE;
vlc_mutex_unlock( &p_intf->change_lock );
return TRUE;
}
void
onFileOpen (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET( button ) );
GtkListStore *list;
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,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_tvfile)
{
/* Get new directory listing */
list = gtk_list_store_new (5,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_STRING);
ReadDirectory(p_intf, list, ".");
/* Update TreeView */
gtk_tree_view_set_model(p_intf->p_sys->p_tvfile, (GtkTreeModel*) list);
}
}
void
onPlaylist (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
onPreferences (GtkButton *button,
gpointer user_data)
{
intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET( 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);
}
gdk_window_raise( p_intf->p_sys->p_window->window );
}
void
onRewind (GtkButton *button,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( button );
if( p_intf->p_sys->p_input != NULL )
{
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_SLOWER );
}
}
void
onPause (GtkButton *button,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( button );
if( p_intf->p_sys->p_input != NULL )
{
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_PAUSE );
}
}
void
onPlay (GtkButton *button,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( GTK_WIDGET( button ) );
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if( p_playlist == NULL )
{
/* Display open page */
onFileOpen(button,user_data);
}
/* If the playlist is empty, open a file requester instead */
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size )
{
vlc_mutex_unlock( &p_playlist->object_lock );
playlist_Play( p_playlist );
vlc_object_release( p_playlist );
gdk_window_lower( p_intf->p_sys->p_window->window );
}
else
{
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
/* Display open page */
onFileOpen(button,user_data);
}
}
void
onStop (GtkButton *button,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( GTK_WIDGET( button ) );
playlist_t * p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist)
{
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
gdk_window_raise( p_intf->p_sys->p_window->window );
}
}
void
onForward (GtkButton *button,
gpointer user_data)
{
intf_thread_t * p_intf = GtkGetIntf( button );
if( p_intf->p_sys->p_input != NULL )
{
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_FASTER );
}
}
void
onAbout (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,3);
}
gdk_window_raise( p_intf->p_sys->p_window->window );
}
gboolean
SliderRelease (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
intf_thread_t *p_intf = GtkGetIntf( widget );
vlc_mutex_lock( &p_intf->change_lock );
p_intf->p_sys->b_slider_free = 1;
vlc_mutex_unlock( &p_intf->change_lock );
return TRUE;
}
gboolean
SliderPress (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data)
{
intf_thread_t *p_intf = GtkGetIntf( widget );
vlc_mutex_lock( &p_intf->change_lock );
p_intf->p_sys->b_slider_free = 0;
vlc_mutex_unlock( &p_intf->change_lock );
return TRUE;
}
void
onFileListRow (GtkTreeView *treeview,
GtkTreePath *path,
GtkTreeViewColumn *column,
gpointer user_data)
{
g_print("onFileListRow\n");
}
void
onFileListColumns (GtkTreeView *treeview,
gpointer user_data)
{
g_print("onFileListColumn\n");
}
gboolean
onFileListRowSelected (GtkTreeView *treeview,
gboolean start_editing,
gpointer user_data)
{
g_print("onFileListRowSelected\n");
return FALSE;
}
void
onAddFileToPlaylist (GtkButton *button,
gpointer user_data)
{
}
void
onEntryMRLChanged (GtkEditable *editable,
gpointer user_data)
{
g_print("onMRLChanged\n");
}
void
onEntryMRLEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
g_print("onMRLEditingDone\n");
}
void
onNetworkPortChanged (GtkEditable *editable,
gpointer user_data)
{
}
void
onEntryNetworkPortEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
}
void
onNetworkAddressChanged (GtkEditable *editable,
gpointer user_data)
{
}
void
onEntryNetworkAddressEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
}
void
onNetworkTypeChanged (GtkEditable *editable,
gpointer user_data)
{
}
void
onEntryNetworkTypeEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
}
void
onProtocolTypeChanged (GtkEditable *editable,
gpointer user_data)
{
}
void
onEntryProtocolTypeEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
}
void
onMRLTypeChanged (GtkEditable *editable,
gpointer user_data)
{
}
void
onEntryMRLTypeEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
}
void
onStreamTypeChanged (GtkEditable *editable,
gpointer user_data)
{
}
void
onEntryStreamTypeEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
}
void
onAddNetworkPlaylist (GtkButton *button,
gpointer user_data)
{
}
void
onV4LAudioChanged (GtkEditable *editable,
gpointer user_data)
{
}
void
onEntryV4LAudioEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
}
void
onV4LVideoChanged (GtkEditable *editable,
gpointer user_data)
{
}
void
onEntryV4LVideoEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
}
void
onAddCameraToPlaylist (GtkButton *button,
gpointer user_data)
{
}
void
onVideoDeviceChanged (GtkEditable *editable,
gpointer user_data)
{
}
void
onEntryVideoDeviceEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
}
void
onVideoCodecChanged (GtkEditable *editable,
gpointer user_data)
{
}
void
onEntryVideoCodecEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
}
void
onVideoBitrateChanged (GtkEditable *editable,
gpointer user_data)
{
}
void
onVideoBitrateEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
}
void
onAudioDeviceChanged (GtkEditable *editable,
gpointer user_data)
{
}
void
onEntryAudioDeviceEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
}
void
onAudioCodecChanged (GtkEditable *editable,
gpointer user_data)
{
}
void
onEntryAudioCodecEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
}
void
onAudioBitrateChanged (GtkEditable *editable,
gpointer user_data)
{
}
void
onAudioBitrateEditingDone (GtkCellEditable *celleditable,
gpointer user_data)
{
}
void
onAddServerToPlaylist (GtkButton *button,
gpointer user_data)
{
}
gboolean
PlaylistEvent (GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
g_print("onPlaylistEvent\n");
return FALSE;
}
void
onPlaylistColumnsChanged (GtkTreeView *treeview,
gpointer user_data)
{
g_print("onPlaylistColumnsChanged\n");
}
gboolean
onPlaylistRowSelected (GtkTreeView *treeview,
gboolean start_editing,
gpointer user_data)
{
g_print("onPlaylistRowSelected\n");
return FALSE;
}
void
onPlaylistRow (GtkTreeView *treeview,
GtkTreePath *path,
GtkTreeViewColumn *column,
gpointer user_data)
{
g_print("onPlaylistRow\n");
}
void
onUpdatePlaylist (GtkButton *button,
gpointer user_data)
{
}
void
onDeletePlaylist (GtkButton *button,
gpointer user_data)
{
}
void
onClearPlaylist (GtkButton *button,
gpointer user_data)
{
}
void
onPreferenceSave (GtkButton *button,
gpointer user_data)
{
}
void
onPreferenceApply (GtkButton *button,
gpointer user_data)
{
}
void
onPreferenceCancel (GtkButton *button,
gpointer user_data)
{
}

View File

@ -0,0 +1,274 @@
/*****************************************************************************
* callbacks.h : pda plugin for vlc
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: pda_callbacks.h,v 1.1 2003/10/01 20:58:45 jpsaman Exp $
*
* Authors: Jean-Paul Saman <jpsaman@wxs.nl>
*
* 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.
*****************************************************************************/
#include <gtk/gtk.h>
void ReadDirectory( intf_thread_t *p_intf, GtkListStore *p_list, char *psz_dir );
void MediaURLOpenChanged( GtkWidget *widget, gchar *psz_url );
void PlaylistRebuildListStore( GtkListStore *p_list, playlist_t * p_playlist );
gboolean
onPDADeleteEvent (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
void
onFileOpen (GtkButton *button,
gpointer user_data);
void
onPlaylist (GtkButton *button,
gpointer user_data);
void
onPreferences (GtkButton *button,
gpointer user_data);
void
onRewind (GtkButton *button,
gpointer user_data);
void
onPause (GtkButton *button,
gpointer user_data);
void
onPlay (GtkButton *button,
gpointer user_data);
void
onStop (GtkButton *button,
gpointer user_data);
void
onForward (GtkButton *button,
gpointer user_data);
void
onAbout (GtkButton *button,
gpointer user_data);
gboolean
SliderRelease (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
gboolean
SliderPress (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
void
onFileListRow (GtkTreeView *treeview,
GtkTreePath *path,
GtkTreeViewColumn *column,
gpointer user_data);
void
onFileListColumns (GtkTreeView *treeview,
gpointer user_data);
gboolean
onFileListRowSelected (GtkTreeView *treeview,
gboolean start_editing,
gpointer user_data);
void
onAddFileToPlaylist (GtkButton *button,
gpointer user_data);
void
onEntryMRLChanged (GtkEditable *editable,
gpointer user_data);
void
onEntryMRLEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onNetworkPortChanged (GtkEditable *editable,
gpointer user_data);
void
onEntryNetworkPortEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onNetworkAddressChanged (GtkEditable *editable,
gpointer user_data);
void
onEntryNetworkAddressEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onNetworkTypeChanged (GtkEditable *editable,
gpointer user_data);
void
onEntryNetworkTypeEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onProtocolTypeChanged (GtkEditable *editable,
gpointer user_data);
void
onEntryProtocolTypeEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onMRLTypeChanged (GtkEditable *editable,
gpointer user_data);
void
onEntryMRLTypeEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onStreamTypeChanged (GtkEditable *editable,
gpointer user_data);
void
onEntryStreamTypeEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onAddNetworkPlaylist (GtkButton *button,
gpointer user_data);
void
onV4LAudioChanged (GtkEditable *editable,
gpointer user_data);
void
onEntryV4LAudioEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onV4LVideoChanged (GtkEditable *editable,
gpointer user_data);
void
onEntryV4LVideoEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onAddCameraToPlaylist (GtkButton *button,
gpointer user_data);
void
onVideoDeviceChanged (GtkEditable *editable,
gpointer user_data);
void
onEntryVideoDeviceEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onVideoCodecChanged (GtkEditable *editable,
gpointer user_data);
void
onEntryVideoCodecEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onVideoBitrateChanged (GtkEditable *editable,
gpointer user_data);
void
onVideoBitrateEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onAudioDeviceChanged (GtkEditable *editable,
gpointer user_data);
void
onEntryAudioDeviceEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onAudioCodecChanged (GtkEditable *editable,
gpointer user_data);
void
onEntryAudioCodecEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onAudioBitrateChanged (GtkEditable *editable,
gpointer user_data);
void
onAudioBitrateEditingDone (GtkCellEditable *celleditable,
gpointer user_data);
void
onAddServerToPlaylist (GtkButton *button,
gpointer user_data);
gboolean
PlaylistEvent (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
void
onPlaylistColumnsChanged (GtkTreeView *treeview,
gpointer user_data);
gboolean
onPlaylistRowSelected (GtkTreeView *treeview,
gboolean start_editing,
gpointer user_data);
void
onPlaylistRow (GtkTreeView *treeview,
GtkTreePath *path,
GtkTreeViewColumn *column,
gpointer user_data);
void
onUpdatePlaylist (GtkButton *button,
gpointer user_data);
void
onDeletePlaylist (GtkButton *button,
gpointer user_data);
void
onClearPlaylist (GtkButton *button,
gpointer user_data);
void
onPreferenceSave (GtkButton *button,
gpointer user_data);
void
onPreferenceApply (GtkButton *button,
gpointer user_data);
void
onPreferenceCancel (GtkButton *button,
gpointer user_data);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,5 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
GtkWidget* create_pda (void);

View File

@ -0,0 +1,144 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <gtk/gtk.h>
#include "pda_support.h"
GtkWidget*
lookup_widget (GtkWidget *widget,
const gchar *widget_name)
{
GtkWidget *parent, *found_widget;
for (;;)
{
if (GTK_IS_MENU (widget))
parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
else
parent = widget->parent;
if (!parent)
parent = g_object_get_data (G_OBJECT (widget), "GladeParentKey");
if (parent == NULL)
break;
widget = parent;
}
found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
widget_name);
if (!found_widget)
g_warning ("Widget not found: %s", widget_name);
return found_widget;
}
static GList *pixmaps_directories = NULL;
/* Use this function to set the directory containing installed pixmaps. */
void
add_pixmap_directory (const gchar *directory)
{
pixmaps_directories = g_list_prepend (pixmaps_directories,
g_strdup (directory));
}
/* This is an internally used function to find pixmap files. */
static gchar*
find_pixmap_file (const gchar *filename)
{
GList *elem;
/* We step through each of the pixmaps directory to find it. */
elem = pixmaps_directories;
while (elem)
{
gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
G_DIR_SEPARATOR_S, filename);
if (g_file_test (pathname, G_FILE_TEST_EXISTS))
return pathname;
g_free (pathname);
elem = elem->next;
}
return NULL;
}
/* This is an internally used function to create pixmaps. */
GtkWidget*
create_pixmap (GtkWidget *widget,
const gchar *filename)
{
gchar *pathname = NULL;
GtkWidget *pixmap;
if (!filename || !filename[0])
return gtk_image_new ();
pathname = find_pixmap_file (filename);
if (!pathname)
{
g_warning (_("Couldn't find pixmap file: %s"), filename);
return gtk_image_new ();
}
pixmap = gtk_image_new_from_file (pathname);
g_free (pathname);
return pixmap;
}
/* This is an internally used function to create pixmaps. */
GdkPixbuf*
create_pixbuf (const gchar *filename)
{
gchar *pathname = NULL;
GdkPixbuf *pixbuf;
GError *error = NULL;
if (!filename || !filename[0])
return NULL;
pathname = find_pixmap_file (filename);
if (!pathname)
{
g_warning (_("Couldn't find pixmap file: %s"), filename);
return NULL;
}
pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
if (!pixbuf)
{
fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
pathname, error->message);
g_error_free (error);
}
g_free (pathname);
return pixbuf;
}
/* This is used to set ATK action descriptions. */
void
glade_set_atk_action_description (AtkAction *action,
const gchar *action_name,
const gchar *description)
{
gint n_actions, i;
n_actions = atk_action_get_n_actions (action);
for (i = 0; i < n_actions; i++)
{
if (!strcmp (atk_action_get_name (action, i), action_name))
atk_action_set_description (action, i, description);
}
}

View File

@ -0,0 +1,67 @@
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
/*
* Standard gettext macros.
*/
#ifdef ENABLE_NLS
# include <libintl.h>
# undef _
# define _(String) dgettext (PACKAGE, String)
# ifdef gettext_noop
# define N_(String) gettext_noop (String)
# else
# define N_(String) (String)
# endif
#else
# define textdomain(String) (String)
# define gettext(String) (String)
# define dgettext(Domain,Message) (Message)
# define dcgettext(Domain,Message,Type) (Message)
# define bindtextdomain(Domain,Directory) (Domain)
# define _(String) (String)
# define N_(String) (String)
#endif
/*
* Public Functions.
*/
/*
* This function returns a widget in a component created by Glade.
* Call it with the toplevel widget in the component (i.e. a window/dialog),
* or alternatively any widget in the component, and the name of the widget
* you want returned.
*/
GtkWidget* lookup_widget (GtkWidget *widget,
const gchar *widget_name);
/* Use this function to set the directory containing installed pixmaps. */
void add_pixmap_directory (const gchar *directory);
/*
* Private Functions.
*/
/* This is used to create the pixmaps used in the interface. */
GtkWidget* create_pixmap (GtkWidget *widget,
const gchar *filename);
/* This is used to create the pixbufs used in the interface. */
GdkPixbuf* create_pixbuf (const gchar *filename);
/* This is used to set ATK action descriptions. */
void glade_set_atk_action_description (AtkAction *action,
const gchar *action_name,
const gchar *description);