summaryrefslogtreecommitdiffstats
path: root/Gui
diff options
context:
space:
mode:
authorpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-08-26 22:20:58 +0000
committerpontscho <pontscho@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-08-26 22:20:58 +0000
commit452e7bdc03546c71d2d9ebffbcd254b5842e052d (patch)
tree47cae3fbb2656e04c14894d1bea04b7add05fdee /Gui
parentc39611bbe90b79a9e17ffe4ff95a4c1a058eba92 (diff)
downloadmpv-452e7bdc03546c71d2d9ebffbcd254b5842e052d.tar.bz2
mpv-452e7bdc03546c71d2d9ebffbcd254b5842e052d.tar.xz
- warning fixes from Dominik Mierzejewski <dominik@rangers.eu.org>
- wsXDNDProcessSelection return Truae fix - add url list saving support from Morten Volden <mvolden@tdcadsl.dk> - fix bug's in this patches - fix some memleak and bug git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7093 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'Gui')
-rw-r--r--Gui/app.c2
-rw-r--r--Gui/cfg.c79
-rw-r--r--Gui/interface.c26
-rw-r--r--Gui/interface.h9
-rw-r--r--Gui/mplayer/gtk/eq.c1
-rw-r--r--Gui/mplayer/gtk/eq.h2
-rw-r--r--Gui/mplayer/gtk/menu.h2
-rw-r--r--Gui/mplayer/gtk/opts.h2
-rw-r--r--Gui/mplayer/gtk/pl.c2
-rw-r--r--Gui/mplayer/gtk/pl.h2
-rw-r--r--Gui/mplayer/gtk/url.c18
-rw-r--r--Gui/mplayer/mw.h2
-rw-r--r--Gui/mplayer/play.c5
-rw-r--r--Gui/wm/wsxdnd.c6
14 files changed, 125 insertions, 33 deletions
diff --git a/Gui/app.c b/Gui/app.c
index 75b686a604..81e3fc1558 100644
--- a/Gui/app.c
+++ b/Gui/app.c
@@ -13,6 +13,8 @@
#include "mplayer/mplayer.h"
#include "interface.h"
+extern char *get_path(char *);
+
listItems appMPlayer;
char * skinDirInHome=NULL;
diff --git a/Gui/cfg.c b/Gui/cfg.c
index 24d2e2b2d2..24bf27bf3c 100644
--- a/Gui/cfg.c
+++ b/Gui/cfg.c
@@ -106,9 +106,22 @@ static config_t gui_opts[] =
{ NULL, NULL, 0, 0, 0, 0, NULL }
};
+char * gfgets( char * str, int size, FILE * f )
+{
+ char * s = fgets( str,size,f );
+ char c;
+ if ( s )
+ {
+ c=s[ strlen( s ) - 1 ]; if ( c == '\n' || c == '\r' ) s[ strlen( s ) - 1 ]=0;
+ c=s[ strlen( s ) - 1 ]; if ( c == '\n' || c == '\r' ) s[ strlen( s ) - 1 ]=0;
+ }
+ return s;
+}
+
int cfg_read( void )
{
char * cfg = get_path( "gui.conf" );
+ FILE * f;
// -- read configuration
mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[cfg] read config file: %s\n",cfg );
@@ -122,26 +135,39 @@ int cfg_read( void )
free( cfg );
// -- read pl
- {
- FILE * f;
- cfg=get_path( "gui.pl" );
- if ( (f=fopen( cfg,"rt" )) == NULL ) return 1;
- while ( !feof( f ) )
- {
- char tmp[512]; plItem * item = calloc( 1,sizeof( plItem ) ); char c;
- if ( fgets( tmp,512,f ) == NULL ) continue;
- c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
- c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
- item->path=strdup( tmp );
- fgets( tmp,512,f );
- c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
- c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0;
- item->name=strdup( tmp );
- gtkSet( gtkAddPlItem,0,(void*)item );
- }
- fclose( f );
- free( cfg );
- }
+ cfg=get_path( "gui.pl" );
+ if ( (f=fopen( cfg,"rt" )) )
+ {
+ while ( !feof( f ) )
+ {
+ char tmp[512]; plItem * item;
+ if ( gfgets( tmp,512,f ) == NULL ) continue;
+ item=calloc( 1,sizeof( plItem ) );
+ item->path=strdup( tmp );
+ gfgets( tmp,512,f );
+ item->name=strdup( tmp );
+ gtkSet( gtkAddPlItem,0,(void*)item );
+ }
+ fclose( f );
+ }
+ free( cfg );
+
+ //-- read previously visited urls
+ cfg=get_path( "gui.url" );
+ if ( (f=fopen( cfg,"rt" )) )
+ {
+ while ( !feof( f ) )
+ {
+ char tmp[512]; URLItem * item;
+ if ( gfgets( tmp,512,f ) == NULL ) continue;
+ item=calloc( 1,sizeof( URLItem ) );
+ item->url=strdup( tmp );
+ gtkSet( gtkAddURLItem,0,(void*)item );
+ }
+ fclose( f );
+ }
+ free( cfg );
+
return 0;
}
@@ -195,6 +221,19 @@ int cfg_write( void )
}
free( cfg );
+// -- save URL's
+ cfg=get_path( "gui.url" );
+ if ( (f=fopen( cfg,"wt+" )) )
+ {
+ while ( URLList )
+ {
+ if ( URLList->url ) fprintf( f,"%s\n",URLList->url );
+ URLList=URLList->next;
+ }
+ fclose( f );
+ }
+ free( cfg );
+
return 0;
}
diff --git a/Gui/interface.c b/Gui/interface.c
index 64a4139bc1..9caf1a245a 100644
--- a/Gui/interface.c
+++ b/Gui/interface.c
@@ -555,6 +555,8 @@ plItem * plCurrent = NULL;
plItem * plList = NULL;
plItem * plLastPlayed = NULL;
+URLItem *URLList = NULL;
+
#if defined( MP_DEBUG ) && 0
void list( void )
{
@@ -577,6 +579,9 @@ void * gtkSet( int cmd,float fparam, void * vparam )
equalizer_t * eq = (equalizer_t *)vparam;
plItem * item = (plItem *)vparam;
+ URLItem * url_item = (URLItem *)vparam;
+ int is_added = True;
+
switch ( cmd )
{
// --- handle playlist
@@ -586,8 +591,7 @@ void * gtkSet( int cmd,float fparam, void * vparam )
plItem * next = plList;
while ( next->next ) { /*printf( "%s\n",next->name );*/ next=next->next; }
next->next=item; item->prev=next;
- }
- else { item->prev=item->next=NULL; plCurrent=plList=item; }
+ } else { item->prev=item->next=NULL; plCurrent=plList=item; }
list();
return NULL;
case gtkGetNextPlItem: // get current item from playlist
@@ -638,6 +642,24 @@ void * gtkSet( int cmd,float fparam, void * vparam )
plList=NULL; plCurrent=NULL;
}
return NULL;
+ // ----- Handle url
+ case gtkAddURLItem:
+ if ( URLList )
+ {
+ URLItem * next_url = URLList;
+ is_added = False;
+ while ( next_url->next )
+ {
+ if ( !gstrcmp( next_url->url,url_item->url ) )
+ {
+ is_added=True;
+ break;
+ }
+ next_url=next_url->next;
+ }
+ if ( ( !is_added )&&( gstrcmp( next_url->url,url_item->url ) ) ) next_url->next=url_item;
+ } else { url_item->next=NULL; URLList=url_item; }
+ return NULL;
// --- subtitle
case gtkSetSubAuto:
sub_auto=(int)fparam;
diff --git a/Gui/interface.h b/Gui/interface.h
index 7c4442bf5b..128023c9b3 100644
--- a/Gui/interface.h
+++ b/Gui/interface.h
@@ -144,10 +144,18 @@ typedef struct _plItem
char * name;
} plItem;
+typedef struct _urlItem
+{
+ struct _urlItem *next;
+ char * url;
+} URLItem;
+
extern plItem * plList;
extern plItem * plCurrent;
extern plItem * plLastPlayed;
+extern URLItem * URLList;
+
#define gtkSetContrast 0
#define gtkSetBrightness 1
#define gtkSetHue 2
@@ -168,6 +176,7 @@ extern plItem * plLastPlayed;
#define gtkSetFontFactor 17
#define gtkSetAutoq 18
#define gtkClearStruct 19
+#define gtkAddURLItem 20
extern float gtkEquChannels[6][10];
diff --git a/Gui/mplayer/gtk/eq.c b/Gui/mplayer/gtk/eq.c
index b87cb2aba8..aa69309ba2 100644
--- a/Gui/mplayer/gtk/eq.c
+++ b/Gui/mplayer/gtk/eq.c
@@ -233,7 +233,6 @@ static void eqShow( GtkWidget * widget,gpointer user_data )
static void eqSelectChannelsListRow( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data )
{
- char * tmp;
Channel=row - 1;
eqSetBands( Channel );
if ( Channel == -1 )
diff --git a/Gui/mplayer/gtk/eq.h b/Gui/mplayer/gtk/eq.h
index 883c4f8135..99941a0509 100644
--- a/Gui/mplayer/gtk/eq.h
+++ b/Gui/mplayer/gtk/eq.h
@@ -9,4 +9,4 @@ extern GtkWidget * Equalizer;
extern GtkWidget * create_Equalizer( void );
extern void ShowEqualizer( void );
-#endif \ No newline at end of file
+#endif
diff --git a/Gui/mplayer/gtk/menu.h b/Gui/mplayer/gtk/menu.h
index 546158ed02..ffaa9665f0 100644
--- a/Gui/mplayer/gtk/menu.h
+++ b/Gui/mplayer/gtk/menu.h
@@ -10,4 +10,4 @@ extern GtkWidget * AddSubMenu( GtkWidget * Menu,char * label );
extern GtkWidget * AddSeparator( GtkWidget * Menu );
extern GtkWidget * create_PopUpMenu( void );
-#endif \ No newline at end of file
+#endif
diff --git a/Gui/mplayer/gtk/opts.h b/Gui/mplayer/gtk/opts.h
index d4cc88ba00..13367545c9 100644
--- a/Gui/mplayer/gtk/opts.h
+++ b/Gui/mplayer/gtk/opts.h
@@ -14,4 +14,4 @@ extern GtkWidget * create_OSSConfig( void );
extern void ShowPreferences( void );
-#endif \ No newline at end of file
+#endif
diff --git a/Gui/mplayer/gtk/pl.c b/Gui/mplayer/gtk/pl.c
index f171ba8c12..4471251bd6 100644
--- a/Gui/mplayer/gtk/pl.c
+++ b/Gui/mplayer/gtk/pl.c
@@ -266,7 +266,7 @@ static void plButtonReleased( GtkButton * button,gpointer user_data )
{
if ( CLFileSelected[i] )
{
- gtk_clist_get_text( GTK_CLIST( CLFiles ),i,0,&itext );
+ gtk_clist_get_text( GTK_CLIST( CLFiles ),i,0,(char **)&itext );
text[0][0]=itext[0][0]; text[0][1]=current_path;
gtk_clist_append( GTK_CLIST( CLSelected ),text[0] );
NrOfSelected++;
diff --git a/Gui/mplayer/gtk/pl.h b/Gui/mplayer/gtk/pl.h
index 34c00c2d2e..d5e1ebe8b4 100644
--- a/Gui/mplayer/gtk/pl.h
+++ b/Gui/mplayer/gtk/pl.h
@@ -11,4 +11,4 @@ extern void HidePlayList( void );
extern GtkWidget * create_PlayList (void);
-#endif \ No newline at end of file
+#endif
diff --git a/Gui/mplayer/gtk/url.c b/Gui/mplayer/gtk/url.c
index 7b35e4d893..4a433a45a0 100644
--- a/Gui/mplayer/gtk/url.c
+++ b/Gui/mplayer/gtk/url.c
@@ -27,6 +27,18 @@ void ShowURLDialogBox( void )
if ( gtkVURLDialogBox ) gtkActive( URL );
else URL=create_URL();
+ if ( URLList )
+ {
+ URLItem * item = URLList;
+ g_list_free( URLComboEntrys );
+ URLComboEntrys=NULL;
+ while( item )
+ {
+ URLComboEntrys=g_list_append( URLComboEntrys,(gchar *)item->url );
+ item=item->next;
+ }
+ }
+
if ( URLComboEntrys )
{
gtk_entry_set_text( GTK_ENTRY( URLEntry ),URLComboEntrys->data );
@@ -53,6 +65,8 @@ static gboolean on_URL_destroy_event( GtkWidget * widget,GdkEvent * event,gpoint
static void on_Button_pressed( GtkButton * button,gpointer user_data )
{
+ URLItem * item;
+
if ( (int)user_data )
{
gchar * str= strdup( gtk_entry_get_text( GTK_ENTRY( URLEntry ) ) );
@@ -67,6 +81,10 @@ static void on_Button_pressed( GtkButton * button,gpointer user_data )
free( str ); str=tmp;
}
URLComboEntrys=g_list_prepend( URLComboEntrys,(gchar *)str );
+
+ item=calloc( 1,sizeof( URLItem ) );
+ item->url=gstrdup( str );
+ gtkSet( gtkAddURLItem,0,(void *)item );
guiSetFilename( guiIntfStruct.Filename,str ); guiIntfStruct.FilenameChanged=1;
mplEventHandling( evPlayNetwork,0 );
diff --git a/Gui/mplayer/mw.h b/Gui/mplayer/mw.h
index c02f337e54..e1df60bad0 100644
--- a/Gui/mplayer/mw.h
+++ b/Gui/mplayer/mw.h
@@ -646,7 +646,7 @@ void mplMainKeyHandle( int KeyCode,int Type,int Key )
}
/* this will be used to handle Drag&Drop files */
-void mplDandDHandler(int num,const char** files)
+void mplDandDHandler(int num,char** files)
{
struct stat buf;
int f = 0;
diff --git a/Gui/mplayer/play.c b/Gui/mplayer/play.c
index 0e6df5fd55..794173586b 100644
--- a/Gui/mplayer/play.c
+++ b/Gui/mplayer/play.c
@@ -1,6 +1,8 @@
+
#include <inttypes.h>
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
#include <unistd.h>
#include <signal.h>
@@ -33,9 +35,8 @@ static int mplGotoTheNext = 1;
void mplFullScreen( void )
{
- static int sx,sy;
-
#if 0
+ static int sx,sy;
// if ( !guiIntfStruct.Playing )
{
wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
diff --git a/Gui/wm/wsxdnd.c b/Gui/wm/wsxdnd.c
index 0e6da01349..92a37cca22 100644
--- a/Gui/wm/wsxdnd.c
+++ b/Gui/wm/wsxdnd.c
@@ -126,6 +126,7 @@ wsXDNDProcessSelection(wsTWindow* wnd, XEvent *event)
}
free(delme);
+ return True;
}
Bool
@@ -153,10 +154,11 @@ wsXDNDProcessClientMessage(wsTWindow* wnd, XClientMessageEvent *event)
}
} else {
/* need to check the whole list here */
- int ret_left = 1;
+ unsigned long ret_left = 1;
int offset = 0;
Atom* ret_buff;
- int ret_type,ret_format,ret_items;
+ Atom ret_type;
+ unsigned long ret_format,ret_items;
/* while there is data left...*/
while(ret_left){
XGetWindowProperty(wsDisplay,event->data.l[0],_XA_XdndTypeList,