Commit 2f72e38f authored by Jean-Paul Saman's avatar Jean-Paul Saman

Implementing new PDA User Interface design using the GTK2 widget set. This...

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.
parent 699c64c8
SOURCES_pda = \ SOURCES_pda = \
pda.c \ pda.c \
pda.h \ pda.h \
interface.c \ pda_interface.c \
interface.h \ pda_interface.h \
support.c \ pda_support.c \
support.h \ pda_support.h \
callbacks.c \ pda_callbacks.c \
callbacks.h \ pda_callbacks.h \
network.c \
network.h \
playlist.c \
playlist.h \
$(NULL) $(NULL)
EXTRA_DIST += pda.glade \ EXTRA_DIST += pda.glade \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* pda.c : PDA Gtk2 plugin for vlc * pda.c : PDA Gtk2 plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2002 VideoLAN * 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> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* Marc Ariberti <marcari@videolan.org> * Marc Ariberti <marcari@videolan.org>
...@@ -39,9 +39,9 @@ ...@@ -39,9 +39,9 @@
#include <gpe/init.h> #include <gpe/init.h>
#endif #endif
#include "callbacks.h" #include "pda_callbacks.h"
#include "interface.h" #include "pda_interface.h"
#include "support.h" #include "pda_support.h"
#include "pda.h" #include "pda.h"
/***************************************************************************** /*****************************************************************************
...@@ -68,7 +68,7 @@ gint E_(GtkModeManage) ( intf_thread_t * p_intf ); ...@@ -68,7 +68,7 @@ gint E_(GtkModeManage) ( intf_thread_t * p_intf );
*****************************************************************************/ *****************************************************************************/
vlc_module_begin(); vlc_module_begin();
add_category_hint( N_("Miscellaneous"), NULL, VLC_TRUE ); 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_description( _("PDA Linux Gtk2+ interface") );
set_capability( "interface", 70 ); set_capability( "interface", 70 );
set_callbacks( Open, Close ); set_callbacks( Open, Close );
...@@ -90,7 +90,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -90,7 +90,7 @@ static int Open( vlc_object_t *p_this )
return VLC_ENOMEM; return VLC_ENOMEM;
} }
#ifdef NEED_GTK_MAIN #ifdef NEED_GTK2_MAIN
msg_Dbg( p_intf, "Using gui-helper" ); msg_Dbg( p_intf, "Using gui-helper" );
p_intf->p_sys->p_gtk_main = module_Need( p_this, "gui-helper", "gtk2" ); p_intf->p_sys->p_gtk_main = module_Need( p_this, "gui-helper", "gtk2" );
if( p_intf->p_sys->p_gtk_main == NULL ) if( p_intf->p_sys->p_gtk_main == NULL )
...@@ -124,7 +124,7 @@ static void Close( vlc_object_t *p_this ) ...@@ -124,7 +124,7 @@ static void Close( vlc_object_t *p_this )
vlc_object_release( p_intf->p_sys->p_input ); vlc_object_release( p_intf->p_sys->p_input );
} }
#ifdef NEED_GTK_MAIN #ifdef NEED_GTK2_MAIN
msg_Dbg( p_intf, "Releasing gui-helper" ); msg_Dbg( p_intf, "Releasing gui-helper" );
module_Unneed( p_intf, p_intf->p_sys->p_gtk_main ); module_Unneed( p_intf, p_intf->p_sys->p_gtk_main );
#endif #endif
...@@ -141,7 +141,7 @@ static void Close( vlc_object_t *p_this ) ...@@ -141,7 +141,7 @@ static void Close( vlc_object_t *p_this )
*****************************************************************************/ *****************************************************************************/
static void Run( intf_thread_t *p_intf ) 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 /* gtk_init needs to know the command line. We don't care, so we
* give it an empty one */ * give it an empty one */
char *p_args[] = { "", NULL }; char *p_args[] = { "", NULL };
...@@ -149,6 +149,8 @@ static void Run( intf_thread_t *p_intf ) ...@@ -149,6 +149,8 @@ static void Run( intf_thread_t *p_intf )
int i_args = 1; int i_args = 1;
int i_dummy; int i_dummy;
#endif #endif
GtkListStore *filelist = NULL;
GtkListStore *playlist = NULL;
#ifdef HAVE_GPE_INIT_H #ifdef HAVE_GPE_INIT_H
/* Initialize GPE interface */ /* Initialize GPE interface */
...@@ -157,7 +159,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -157,7 +159,7 @@ static void Run( intf_thread_t *p_intf )
exit (1); exit (1);
#else #else
gtk_set_locale (); gtk_set_locale ();
# ifndef NEED_GTK_MAIN # ifndef NEED_GTK2_MAIN
msg_Dbg( p_intf, "Starting pda GTK2+ interface" ); msg_Dbg( p_intf, "Starting pda GTK2+ interface" );
gtk_init( &i_args, &pp_args ); gtk_init( &i_args, &pp_args );
# else # else
...@@ -183,8 +185,13 @@ static void Run( intf_thread_t *p_intf ) ...@@ -183,8 +185,13 @@ static void Run( intf_thread_t *p_intf )
{ {
msg_Err( p_intf, "unable to create pda interface" ); msg_Err( p_intf, "unable to create pda interface" );
} }
#if 0
msg_Dbg( p_intf, "setting main window size ... " );
gtk_widget_set_usize(p_intf->p_sys->p_window, gtk_widget_set_usize(p_intf->p_sys->p_window,
gdk_screen_width() , gdk_screen_height() - 30 ); gdk_screen_width() , gdk_screen_height() - 30 );
msg_Dbg( p_intf, "setting main window size ... done" );
#endif
/* Set the title of the main window */ /* Set the title of the main window */
gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_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 ) ...@@ -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( p_intf->p_sys->p_slider_label = GTK_LABEL( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "slider_label" ) ); GTK_OBJECT( p_intf->p_sys->p_window ), "slider_label" ) );
#if 0
/* Connect the date display to the slider */ /* Connect the date display to the slider */
msg_Dbg( p_intf, "setting slider adjustment ... " );
#define P_SLIDER GTK_RANGE( gtk_object_get_data( \ #define P_SLIDER GTK_RANGE( gtk_object_get_data( \
GTK_OBJECT( p_intf->p_sys->p_window ), "slider" ) ) GTK_OBJECT( p_intf->p_sys->p_window ), "slider" ) )
p_intf->p_sys->p_adj = gtk_range_get_adjustment( P_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 ) ...@@ -211,36 +220,62 @@ static void Run( intf_thread_t *p_intf )
p_intf->p_sys->f_adj_oldvalue = 0; p_intf->p_sys->f_adj_oldvalue = 0;
p_intf->p_sys->i_adj_oldvalue = 0; p_intf->p_sys->i_adj_oldvalue = 0;
#undef P_SLIDER #undef P_SLIDER
msg_Dbg( p_intf, "setting slider adjustment ... done" );
#endif
p_intf->p_sys->p_clist = GTK_CLIST( gtk_object_get_data( msg_Dbg(p_intf, "Getting GtkTreeView FileList" );
GTK_OBJECT( p_intf->p_sys->p_window ), "clistmedia" ) ); p_intf->p_sys->p_tvfile = NULL;
gtk_clist_set_column_visibility (GTK_CLIST (p_intf->p_sys->p_clist), 2, FALSE); p_intf->p_sys->p_tvfile = (GtkTreeView *) lookup_widget( p_intf->p_sys->p_window,
gtk_clist_set_column_visibility (GTK_CLIST (p_intf->p_sys->p_clist), 3, FALSE); "tvFileList");
gtk_clist_set_column_visibility (GTK_CLIST (p_intf->p_sys->p_clist), 4, FALSE); if (NULL == p_intf->p_sys->p_tvfile)
gtk_clist_column_titles_show (GTK_CLIST (p_intf->p_sys->p_clist)); msg_Err(p_intf, "Error obtaining pointer to File List");
/* the playlist object */ /* the playlist object */
p_intf->p_sys->p_clistplaylist = GTK_CLIST( gtk_object_get_data( msg_Dbg(p_intf, "Getting GtkTreeView PlayList" );
GTK_OBJECT( p_intf->p_sys->p_window ), "clistplaylist" ) ); 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( p_intf->p_sys->p_mrlentry = GTK_ENTRY( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "mrl_entry" ) ); GTK_OBJECT( p_intf->p_sys->p_window ), "mrl_entry" ) );
#if 0
/* Store p_intf to keep an eye on it */ /* 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), gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window),
"p_intf", p_intf ); "p_intf", p_intf );
gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_adj), gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_adj),
"p_intf", p_intf ); "p_intf", p_intf );
msg_Dbg( p_intf, "trying to store p_intf pointer ... done" );
#endif
/* Show the control window */ /* Show the control window */
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, ".");
/* update the playlist */ /* Get new directory listing */
PDARebuildCList( p_intf->p_sys->p_clistplaylist, msg_Dbg(p_intf, "Populating GtkTreeView FileList" );
vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE )); 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);
#ifdef NEED_GTK_MAIN /* update the playlist */
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" ); msg_Dbg( p_intf, "Manage GTK keyboard events using threads" );
while( !p_intf->b_die ) while( !p_intf->b_die )
{ {
...@@ -271,7 +306,7 @@ static void Run( intf_thread_t *p_intf ) ...@@ -271,7 +306,7 @@ static void Run( intf_thread_t *p_intf )
#endif #endif
gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) ); gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) );
#ifdef NEED_GTK_MAIN #ifdef NEED_GTK2_MAIN
gdk_threads_leave(); gdk_threads_leave();
#endif #endif
} }
...@@ -323,6 +358,7 @@ void GtkAutoPlayFile( vlc_object_t *p_this ) ...@@ -323,6 +358,7 @@ void GtkAutoPlayFile( vlc_object_t *p_this )
*****************************************************************************/ *****************************************************************************/
static int Manage( intf_thread_t *p_intf ) static int Manage( intf_thread_t *p_intf )
{ {
GtkListStore *p_liststore;
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
/* Update the input */ /* Update the input */
...@@ -357,8 +393,13 @@ static int Manage( intf_thread_t *p_intf ) ...@@ -357,8 +393,13 @@ static int Manage( intf_thread_t *p_intf )
p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ); p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
if (p_playlist != NULL) if (p_playlist != NULL)
{ {
PDARebuildCList( p_intf->p_sys->p_clistplaylist, msg_Dbg(p_intf, "Manage: Populating GtkTreeView Playlist" );
p_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 ) ...@@ -444,7 +485,7 @@ static int Manage( intf_thread_t *p_intf )
p_intf->p_sys->b_playing = 0; p_intf->p_sys->b_playing = 0;
} }
#ifndef NEED_GTK_MAIN #ifndef NEED_GTK2_MAIN
if( p_intf->b_die ) if( p_intf->b_die )
{ {
vlc_mutex_unlock( &p_intf->change_lock ); vlc_mutex_unlock( &p_intf->change_lock );
...@@ -530,9 +571,9 @@ gint E_(GtkModeManage)( intf_thread_t * p_intf ) ...@@ -530,9 +571,9 @@ gint E_(GtkModeManage)( intf_thread_t * p_intf )
} }
/* set control items */ /* set control items */
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_rewind"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_window, "tbRewind"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_pause"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_window, "tbPause"), b_control );
gtk_widget_set_sensitive( GETWIDGET(p_window, "toolbar_forward"), b_control ); gtk_widget_set_sensitive( GETWIDGET(p_window, "tbForward"), b_control );
#undef GETWIDGET #undef GETWIDGET
return TRUE; return TRUE;
......
...@@ -1889,7 +1889,7 @@ ...@@ -1889,7 +1889,7 @@
<property name="window_placement">GTK_CORNER_TOP_LEFT</property> <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child> <child>
<widget class="GtkTreeView" id="tbPlaylist"> <widget class="GtkTreeView" id="tvPlaylist">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="headers_visible">True</property> <property name="headers_visible">True</property>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* pda.h: private Gtk+ interface description * pda.h: private Gtk+ interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * 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> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -29,16 +29,16 @@ ...@@ -29,16 +29,16 @@
struct intf_sys_t struct intf_sys_t
{ {
/* The gtk_main module */ /* The gtk_main module */
module_t * p_gtk_main; module_t *p_gtk_main;
/* windows and widgets */ /* windows and widgets */
GtkWidget * p_window; /* main window */ GtkWidget *p_window; /* main window */
GtkEntry * p_mrlentry; GtkEntry *p_mrlentry;
GtkNotebook * p_notebook; GtkNotebook *p_notebook;
GtkNotebook * p_mediabook; GtkNotebook *p_mediabook;
GtkHScale * p_slider; GtkHScale *p_slider;
GtkCList * p_clist; GtkTreeView *p_tvfile;
GtkCList * p_clistplaylist; GtkTreeView *p_tvplaylist;
/* slider */ /* slider */
GtkLabel * p_slider_label; GtkLabel * p_slider_label;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
GtkWidget* create_pda (void);
/*
* 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);
}
}
/*
* 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);
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