Commit d96dc743 authored by Jean-Paul Saman's avatar Jean-Paul Saman

PDA Interface:

- Removing obsolete files.
- Remove debug messages.
parent 324bfec1
This diff is collapsed.
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
GtkWidget* create_pda (void);
...@@ -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.12 2003/11/30 10:26:19 jpsaman Exp $ * $Id: pda.c,v 1.13 2003/11/30 11:22:29 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>
...@@ -161,13 +161,12 @@ static void Run( intf_thread_t *p_intf ) ...@@ -161,13 +161,12 @@ static void Run( intf_thread_t *p_intf )
#endif #endif
/* Create some useful widgets that will certainly be used */ /* Create some useful widgets that will certainly be used */
// FIXME: magic path /* FIXME: magic path */
add_pixmap_directory("share"); add_pixmap_directory("share");
add_pixmap_directory("/usr/share/vlc"); add_pixmap_directory("/usr/share/vlc");
/* Path for pixmaps under linupy 1.4 */ /* Path for pixmaps under linupy 1.4 */
add_pixmap_directory("/usr/local/share/pixmaps/vlc"); add_pixmap_directory("/usr/local/share/pixmaps/vlc");
/* Path for pixmaps under linupy 2.0 */ /* Path for pixmaps under linupy 2.0 */
add_pixmap_directory("/usr/share/pixmaps/vlc"); add_pixmap_directory("/usr/share/pixmaps/vlc");
...@@ -178,10 +177,8 @@ static void Run( intf_thread_t *p_intf ) ...@@ -178,10 +177,8 @@ static void Run( intf_thread_t *p_intf )
} }
/* 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 );
msg_Dbg( p_intf, "trying to store p_intf pointer ... done" );
/* 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),
...@@ -193,17 +190,23 @@ static void Run( intf_thread_t *p_intf ) ...@@ -193,17 +190,23 @@ static void Run( intf_thread_t *p_intf )
/* Get the slider object */ /* Get the slider object */
p_intf->p_sys->p_slider = GTK_HSCALE( gtk_object_get_data( p_intf->p_sys->p_slider = GTK_HSCALE( gtk_object_get_data(
GTK_OBJECT( p_intf->p_sys->p_window ), "slider" ) ); GTK_OBJECT( p_intf->p_sys->p_window ), "timeSlider" ) );
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 ), "timeLabel" ) );
if (p_intf->p_sys->p_slider == NULL)
msg_Err( p_intf, "Time slider widget not found." );
if (p_intf->p_sys->p_slider_label == NULL)
msg_Err( p_intf, "Time label widget not found." );
#if 0 #if 0
/* Connect the date display to the slider */ /* Connect the date display to the slider */
msg_Dbg( p_intf, "setting slider adjustment ... " ); 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 ), "timeSlider" ) )
p_intf->p_sys->p_adj = gtk_range_get_adjustment( P_SLIDER ); p_intf->p_sys->p_adj = gtk_range_get_adjustment( P_SLIDER );
if (p_intf->p_sys->p_adj == NULL)
msg_Err( p_intf, "Adjustment range not found." );
gtk_signal_connect ( GTK_OBJECT( p_intf->p_sys->p_adj ), "value_changed", gtk_signal_connect ( GTK_OBJECT( p_intf->p_sys->p_adj ), "value_changed",
GTK_SIGNAL_FUNC( E_(GtkDisplayDate) ), NULL ); GTK_SIGNAL_FUNC( E_(GtkDisplayDate) ), NULL );
p_intf->p_sys->f_adj_oldvalue = 0; p_intf->p_sys->f_adj_oldvalue = 0;
...@@ -213,7 +216,6 @@ static void Run( intf_thread_t *p_intf ) ...@@ -213,7 +216,6 @@ static void Run( intf_thread_t *p_intf )
#endif #endif
/* BEGIN OF FILEVIEW GTK_TREE_VIEW */ /* BEGIN OF FILEVIEW GTK_TREE_VIEW */
msg_Dbg(p_intf, "Getting GtkTreeView FileList" );
p_intf->p_sys->p_tvfile = NULL; p_intf->p_sys->p_tvfile = NULL;
p_intf->p_sys->p_tvfile = (GtkTreeView *) lookup_widget( p_intf->p_sys->p_window, p_intf->p_sys->p_tvfile = (GtkTreeView *) lookup_widget( p_intf->p_sys->p_window,
"tvFileList"); "tvFileList");
...@@ -252,7 +254,6 @@ static void Run( intf_thread_t *p_intf ) ...@@ -252,7 +254,6 @@ static void Run( intf_thread_t *p_intf )
gtk_tree_view_column_set_sort_column_id(column, 4); gtk_tree_view_column_set_sort_column_id(column, 4);
/* Get new directory listing */ /* Get new directory listing */
msg_Dbg(p_intf, "Populating GtkTreeView FileList" );
filelist = gtk_list_store_new (5, filelist = gtk_list_store_new (5,
G_TYPE_STRING, /* Filename */ G_TYPE_STRING, /* Filename */
G_TYPE_STRING, /* permissions */ G_TYPE_STRING, /* permissions */
...@@ -260,7 +261,6 @@ static void Run( intf_thread_t *p_intf ) ...@@ -260,7 +261,6 @@ static void Run( intf_thread_t *p_intf )
G_TYPE_STRING, /* Owner */ G_TYPE_STRING, /* Owner */
G_TYPE_STRING);/* Group */ G_TYPE_STRING);/* Group */
ReadDirectory(p_intf, filelist, "."); ReadDirectory(p_intf, filelist, ".");
msg_Dbg(p_intf, "Showing GtkTreeView FileList" );
gtk_tree_view_set_model(GTK_TREE_VIEW(p_intf->p_sys->p_tvfile), GTK_TREE_MODEL(filelist)); gtk_tree_view_set_model(GTK_TREE_VIEW(p_intf->p_sys->p_tvfile), GTK_TREE_MODEL(filelist));
g_object_unref(filelist); /* Model will be released by GtkTreeView */ g_object_unref(filelist); /* Model will be released by GtkTreeView */
gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(p_intf->p_sys->p_tvfile)),GTK_SELECTION_MULTIPLE); gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(p_intf->p_sys->p_tvfile)),GTK_SELECTION_MULTIPLE);
...@@ -272,7 +272,6 @@ static void Run( intf_thread_t *p_intf ) ...@@ -272,7 +272,6 @@ static void Run( intf_thread_t *p_intf )
/* END OF FILEVIEW GTK_TREE_VIEW */ /* END OF FILEVIEW GTK_TREE_VIEW */
/* BEGIN OF PLAYLIST GTK_TREE_VIEW */ /* BEGIN OF PLAYLIST GTK_TREE_VIEW */
msg_Dbg(p_intf, "Getting GtkTreeView PlayList" );
p_intf->p_sys->p_tvplaylist = NULL; p_intf->p_sys->p_tvplaylist = NULL;
p_intf->p_sys->p_tvplaylist = (GtkTreeView *) lookup_widget( p_intf->p_sys->p_window, "tvPlaylist"); p_intf->p_sys->p_tvplaylist = (GtkTreeView *) lookup_widget( p_intf->p_sys->p_window, "tvPlaylist");
if (NULL == p_intf->p_sys->p_tvplaylist) if (NULL == p_intf->p_sys->p_tvplaylist)
...@@ -290,21 +289,20 @@ static void Run( intf_thread_t *p_intf ) ...@@ -290,21 +289,20 @@ static void Run( intf_thread_t *p_intf )
column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 1 ); column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 1 );
gtk_tree_view_column_add_attribute(column, renderer, "text", 1 ); gtk_tree_view_column_add_attribute(column, renderer, "text", 1 );
gtk_tree_view_column_set_sort_column_id(column, 1); gtk_tree_view_column_set_sort_column_id(column, 1);
/* Column 3 */ #if 0
/* Column 3 - is a hidden column used for reliable deleting items from the underlying playlist */
renderer = gtk_cell_renderer_text_new (); renderer = gtk_cell_renderer_text_new ();
gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvplaylist, 2, _("Index"), renderer, NULL); gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvplaylist, 2, _("Index"), renderer, NULL);
column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 2 ); column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 2 );
gtk_tree_view_column_add_attribute(column, renderer, "text", 2 ); gtk_tree_view_column_add_attribute(column, renderer, "text", 2 );
gtk_tree_view_column_set_sort_column_id(column, 2); gtk_tree_view_column_set_sort_column_id(column, 2);
#endif
/* update the playlist */ /* update the playlist */
msg_Dbg(p_intf, "Populating GtkTreeView Playlist" );
playlist = gtk_list_store_new (3, playlist = gtk_list_store_new (3,
G_TYPE_STRING, /* Filename */ G_TYPE_STRING, /* Filename */
G_TYPE_STRING, /* Time */ G_TYPE_STRING, /* Time */
G_TYPE_UINT); /* Hidden index */ G_TYPE_UINT); /* Hidden index */
PlaylistRebuildListStore( playlist, vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE )); PlaylistRebuildListStore( playlist, vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE ));
msg_Dbg(p_intf, "Showing GtkTreeView Playlist" );
gtk_tree_view_set_model(GTK_TREE_VIEW(p_intf->p_sys->p_tvplaylist), GTK_TREE_MODEL(playlist)); gtk_tree_view_set_model(GTK_TREE_VIEW(p_intf->p_sys->p_tvplaylist), GTK_TREE_MODEL(playlist));
g_object_unref(playlist); g_object_unref(playlist);
gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(p_intf->p_sys->p_tvplaylist)),GTK_SELECTION_MULTIPLE); gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(p_intf->p_sys->p_tvplaylist)),GTK_SELECTION_MULTIPLE);
...@@ -436,13 +434,11 @@ static int Manage( intf_thread_t *p_intf ) ...@@ -436,13 +434,11 @@ 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)
{ {
msg_Dbg(p_intf, "Manage: Populating GtkTreeView Playlist" );
p_liststore = gtk_list_store_new (3, p_liststore = gtk_list_store_new (3,
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_UINT); /* Hidden index */ G_TYPE_UINT); /* Hidden index */
PlaylistRebuildListStore(p_liststore, p_playlist); 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); gtk_tree_view_set_model(p_intf->p_sys->p_tvplaylist, (GtkTreeModel*) p_liststore);
g_object_unref(p_liststore); g_object_unref(p_liststore);
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
...@@ -600,6 +596,7 @@ gint E_(GtkModeManage)( intf_thread_t * p_intf ) ...@@ -600,6 +596,7 @@ gint E_(GtkModeManage)( intf_thread_t * p_intf )
/* initialize and show slider for seekable streams */ /* initialize and show slider for seekable streams */
if( p_intf->p_sys->p_input->stream.b_seekable ) if( p_intf->p_sys->p_input->stream.b_seekable )
{ {
msg_Dbg( p_intf, "Updating slider widget" );
if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU) if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
p_intf->p_sys->p_adj->value = p_intf->p_sys->f_adj_oldvalue = 0; p_intf->p_sys->p_adj->value = p_intf->p_sys->f_adj_oldvalue = 0;
else else
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* pda_callbacks.c : Callbacks for the pda Linux Gtk+ plugin. * pda_callbacks.c : Callbacks for the pda Linux Gtk+ plugin.
***************************************************************************** *****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN * Copyright (C) 2000, 2001 VideoLAN
* $Id: pda_callbacks.c,v 1.18 2003/11/30 10:26:19 jpsaman Exp $ * $Id: pda_callbacks.c,v 1.19 2003/11/30 11:22:29 jpsaman Exp $
* *
* Authors: Jean-Paul Saman <jpsaman@wxs.nl> * Authors: Jean-Paul Saman <jpsaman@wxs.nl>
* *
...@@ -120,7 +120,6 @@ void PlaylistAddItem(GtkWidget *widget, gchar *name) ...@@ -120,7 +120,6 @@ void PlaylistAddItem(GtkWidget *widget, gchar *name)
2, p_playlist->i_size, /* Hidden index. */ 2, p_playlist->i_size, /* Hidden index. */
-1 ); -1 );
msg_Dbg( p_intf, "Adding files to playlist ...");
/* Add to VLC's playlist */ /* Add to VLC's playlist */
#if 0 #if 0
if (p_intf->p_sys->b_autoplayfile) if (p_intf->p_sys->b_autoplayfile)
...@@ -134,7 +133,6 @@ void PlaylistAddItem(GtkWidget *widget, gchar *name) ...@@ -134,7 +133,6 @@ void PlaylistAddItem(GtkWidget *widget, gchar *name)
playlist_Add( p_playlist, (const char*)name, 0, 0, playlist_Add( p_playlist, (const char*)name, 0, 0,
PLAYLIST_APPEND, PLAYLIST_END ); PLAYLIST_APPEND, PLAYLIST_END );
} }
msg_Dbg( p_intf, "done");
} }
} }
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
...@@ -334,7 +332,6 @@ onPDADeleteEvent (GtkWidget *widget, ...@@ -334,7 +332,6 @@ onPDADeleteEvent (GtkWidget *widget,
{ {
intf_thread_t *p_intf = GtkGetIntf( widget ); intf_thread_t *p_intf = GtkGetIntf( widget );
msg_Dbg( p_intf, "about to exit vlc ... " );
vlc_mutex_lock( &p_intf->change_lock ); vlc_mutex_lock( &p_intf->change_lock );
p_intf->p_vlc->b_die = VLC_TRUE; p_intf->p_vlc->b_die = VLC_TRUE;
vlc_mutex_unlock( &p_intf->change_lock ); vlc_mutex_unlock( &p_intf->change_lock );
...@@ -562,6 +559,7 @@ void ...@@ -562,6 +559,7 @@ void
NetworkBuildMRL (GtkEditable *editable, NetworkBuildMRL (GtkEditable *editable,
gpointer user_data) gpointer user_data)
{ {
intf_thread_t *p_intf = GtkGetIntf( GTK_WIDGET(editable) );
GtkSpinButton *networkPort = NULL; GtkSpinButton *networkPort = NULL;
GtkEntry *entryMRL = NULL; GtkEntry *entryMRL = NULL;
GtkEntry *networkType = NULL; GtkEntry *networkType = NULL;
...@@ -595,7 +593,10 @@ NetworkBuildMRL (GtkEditable *editable, ...@@ -595,7 +593,10 @@ NetworkBuildMRL (GtkEditable *editable,
pos += snprintf( &text[pos], VLC_MAX_MRL - pos, "%s:%d", (char*)mrlAddress, (int)mrlPort ); pos += snprintf( &text[pos], VLC_MAX_MRL - pos, "%s:%d", (char*)mrlAddress, (int)mrlPort );
if (pos >= VLC_MAX_MRL) if (pos >= VLC_MAX_MRL)
{
text[VLC_MAX_MRL-1]='\0'; text[VLC_MAX_MRL-1]='\0';
msg_Err( p_intf, "Media Resource Locator is truncated to: %s", text);
}
gtk_entry_set_text(entryMRL,text); gtk_entry_set_text(entryMRL,text);
} }
...@@ -775,7 +776,6 @@ onUpdatePlaylist (GtkButton *button, ...@@ -775,7 +776,6 @@ onUpdatePlaylist (GtkButton *button,
if (p_model) if (p_model)
{ {
PlaylistRebuildListStore(p_model, p_playlist); PlaylistRebuildListStore(p_model, p_playlist);
msg_Dbg(p_intf, "Adding new model to Playlist" );
gtk_tree_view_set_model(GTK_TREE_VIEW(p_tvplaylist), GTK_TREE_MODEL(p_model)); gtk_tree_view_set_model(GTK_TREE_VIEW(p_tvplaylist), GTK_TREE_MODEL(p_model));
g_object_unref(p_model); g_object_unref(p_model);
} }
...@@ -793,7 +793,6 @@ onDeletePlaylist (GtkButton *button, ...@@ -793,7 +793,6 @@ onDeletePlaylist (GtkButton *button,
GtkTreeView *p_tvplaylist; GtkTreeView *p_tvplaylist;
/* Delete an arbitrary item from the playlist */ /* Delete an arbitrary item from the playlist */
msg_Dbg(p_intf, "Delete playlist item ... " );
p_tvplaylist = (GtkTreeView *) lookup_widget( GTK_WIDGET(button), "tvPlaylist" ); p_tvplaylist = (GtkTreeView *) lookup_widget( GTK_WIDGET(button), "tvPlaylist" );
if (p_tvplaylist != NULL) if (p_tvplaylist != NULL)
{ {
...@@ -825,14 +824,10 @@ onDeletePlaylist (GtkButton *button, ...@@ -825,14 +824,10 @@ onDeletePlaylist (GtkButton *button,
{ {
if (gtk_tree_model_get_iter(p_model, &iter, p_path)) if (gtk_tree_model_get_iter(p_model, &iter, p_path))
{ {
gchar *p_filename;
gint item; gint item;
gtk_tree_model_get(p_model, &iter, 0, &p_filename, -1);
gtk_tree_model_get(p_model, &iter, 2, &item, -1); gtk_tree_model_get(p_model, &iter, 2, &item, -1);
msg_Dbg(p_intf, "Deleting %d %s", item, p_filename);
playlist_Delete(p_playlist, item); playlist_Delete(p_playlist, item);
g_free(p_filename);
} }
} }
} }
...@@ -848,14 +843,11 @@ onDeletePlaylist (GtkButton *button, ...@@ -848,14 +843,11 @@ onDeletePlaylist (GtkButton *button,
if (p_model) if (p_model)
{ {
PlaylistRebuildListStore(GTK_LIST_STORE(p_model), p_playlist); PlaylistRebuildListStore(GTK_LIST_STORE(p_model), p_playlist);
msg_Dbg(p_intf, "Adding new model to Playlist" );
gtk_tree_view_set_model(GTK_TREE_VIEW(p_tvplaylist), GTK_TREE_MODEL(p_model)); gtk_tree_view_set_model(GTK_TREE_VIEW(p_tvplaylist), GTK_TREE_MODEL(p_model));
g_object_unref(p_model); g_object_unref(p_model);
} }
} }
vlc_object_release( p_playlist ); vlc_object_release( p_playlist );
msg_Dbg(p_intf, "Delete playlist item ... done" );
} }
...@@ -899,9 +891,12 @@ void ...@@ -899,9 +891,12 @@ void
onPreferenceSave (GtkButton *button, onPreferenceSave (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
#if 0
intf_thread_t *p_intf = GtkGetIntf( button ); intf_thread_t *p_intf = GtkGetIntf( button );
msg_Dbg(p_intf, "Preferences Save" ); msg_Dbg(p_intf, "Preferences Save" );
config_SaveConfigFile( p_intf, NULL );
#endif
} }
...@@ -909,9 +904,11 @@ void ...@@ -909,9 +904,11 @@ void
onPreferenceApply (GtkButton *button, onPreferenceApply (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
#if 0
intf_thread_t *p_intf = GtkGetIntf( button ); intf_thread_t *p_intf = GtkGetIntf( button );
msg_Dbg(p_intf, "Preferences Apply" ); msg_Dbg(p_intf, "Preferences Apply" );
#endif
} }
...@@ -919,9 +916,14 @@ void ...@@ -919,9 +916,14 @@ void
onPreferenceCancel (GtkButton *button, onPreferenceCancel (GtkButton *button,
gpointer user_data) gpointer user_data)
{ {
#if 0
intf_thread_t *p_intf = GtkGetIntf( button ); intf_thread_t *p_intf = GtkGetIntf( button );
msg_Dbg(p_intf, "Preferences Cancel" ); msg_Dbg(p_intf, "Preferences Cancel" );
config_ResetAll( p_intf );
/* Cancel interface changes. */
config_SaveConfigFile( p_intf, NULL );
#endif
} }
......
/*****************************************************************************
* playlist.c : Playlist interface of the gtk-pda plugin.
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: playlist.c,v 1.2 2003/11/30 10:26:19 jpsaman 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 "pda.h"
#include "playlist.h"
gboolean
PDAPlaylistEvent (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 );
PDARebuildCList( p_clist, p_playlist );
return TRUE;
}
vlc_object_release( p_playlist );
return FALSE;
}
void
PDAPlaylistClear (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 );
PDARebuildCList( p_intf->p_sys->p_clistplaylist, p_playlist);
}
void PDARebuildCList( 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
PDAPlaylistUpdate (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;
}
PDARebuildCList( p_intf->p_sys->p_clistplaylist, p_playlist );
}
static void PDADeleteGListItem( gpointer data, gpointer param )
{
int i_cur_row = (long)data;
playlist_t * p_playlist = param;
playlist_Delete( p_playlist, i_cur_row );
}
static gint PDACompareItems( gconstpointer a, gconstpointer b )
{
return (ptrdiff_t) ( (int *)b - (int *)a );
}
void
PDAPlaylistDel (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, PDACompareItems );
g_list_foreach( p_selection, PDADeleteGListItem, p_playlist );
}
vlc_mutex_unlock( &p_intf->change_lock );
vlc_object_release( p_playlist );
PDARebuildCList( p_intf->p_sys->p_clistplaylist, p_playlist );
}
gboolean
PDAPlaylistEvent (GtkWidget *widget,
GdkEvent *event,
gpointer user_data);
void PDARebuildCList( GtkCList * p_clist, playlist_t * p_playlist );
void PDAPlaylistClear (GtkButton *button,
gpointer user_data);
void
PDAPlaylistUpdate (GtkButton *button,
gpointer user_data);
void
PDAPlaylistDel (GtkButton *button,
gpointer user_data);
/*
* 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 <gtk/gtk.h>
#include "support.h"
/* This is an internally used function to check if a pixmap file exists. */
static gchar* check_file_exists (const gchar *directory,
const gchar *filename);
/* This is an internally used function to create pixmaps. */
static GtkWidget* create_dummy_pixmap (GtkWidget *widget);
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 == NULL)
break;
widget = parent;
}
found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget),
widget_name);
if (!found_widget)
g_warning ("Widget not found: %s", widget_name);
return found_widget;
}
/* This is a dummy pixmap we use when a pixmap can't be found. */
static char *dummy_pixmap_xpm[] = {
/* columns rows colors chars-per-pixel */
"1 1 1 1",
" c None",
/* pixels */
" "
};
/* This is an internally used function to create pixmaps. */
static GtkWidget*
create_dummy_pixmap (GtkWidget *widget)
{
GdkColormap *colormap;
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
GtkWidget *pixmap;
colormap = gtk_widget_get_colormap (widget);
gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask,
NULL, dummy_pixmap_xpm);
if (gdkpixmap == NULL)
g_error ("Couldn't create replacement pixmap.");
pixmap = gtk_pixmap_new (gdkpixmap, mask);
gdk_pixmap_unref (gdkpixmap);
gdk_bitmap_unref (mask);
return pixmap;
}
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 create pixmaps. */
GtkWidget*
create_pixmap (GtkWidget *widget,
const gchar *filename)
{
gchar *found_filename = NULL;
GdkColormap *colormap;
GdkPixmap *gdkpixmap;
GdkBitmap *mask;
GtkWidget *pixmap;
GList *elem;
if (!filename || !filename[0])
return create_dummy_pixmap (widget);
/* We first try any pixmaps directories set by the application. */
elem = pixmaps_directories;
while (elem)
{
found_filename = check_file_exists ((gchar*)elem->data, filename);
if (found_filename)
break;
elem = elem->next;
}
/* If we haven't found the pixmap, try the source directory. */
if (!found_filename)
{
found_filename = check_file_exists ("../../../share", filename);
}
if (!found_filename)
{
g_warning (_("Couldn't find pixmap file: %s"), filename);
return create_dummy_pixmap (widget);
}
colormap = gtk_widget_get_colormap (widget);
gdkpixmap = gdk_pixmap_colormap_create_from_xpm (NULL, colormap, &mask,
NULL, found_filename);
if (gdkpixmap == NULL)
{
g_warning (_("Error loading pixmap file: %s"), found_filename);
g_free (found_filename);
return create_dummy_pixmap (widget);
}
g_free (found_filename);
pixmap = gtk_pixmap_new (gdkpixmap, mask);
gdk_pixmap_unref (gdkpixmap);
gdk_bitmap_unref (mask);
return pixmap;
}
/* This is an internally used function to check if a pixmap file exists. */
static gchar*
check_file_exists (const gchar *directory,
const gchar *filename)
{
gchar *full_filename;
struct stat s;
gint status;
full_filename = (gchar*) g_malloc (strlen (directory) + 1
+ strlen (filename) + 1);
strcpy (full_filename, directory);
strcat (full_filename, G_DIR_SEPARATOR_S);
strcat (full_filename, filename);
status = stat (full_filename, &s);
if (status == 0 && S_ISREG (s.st_mode))
return full_filename;
g_free (full_filename);
return NULL;
}
/*
* Created by glade, fixed by bootstrap
*/
#ifdef HAVE_CONFIG_H
# include <vlc/vlc.h>
#endif
#include <gtk/gtk.h>
/*
* Standard gettext macros.
*/
#if 0 /* Disabled by bootstrap */
# 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);
/* get_widget() is deprecated. Use lookup_widget instead. */
#define get_widget lookup_widget
/* 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 in the interface. */
GtkWidget* create_pixmap (GtkWidget *widget,
const gchar *filename);
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