Mercurial > mplayer.hg
changeset 7092:8e9607c5897e
- 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
author | pontscho |
---|---|
date | Mon, 26 Aug 2002 22:20:58 +0000 |
parents | 2459fcc7baaf |
children | e640dca86e0d |
files | Gui/app.c Gui/cfg.c Gui/interface.c Gui/interface.h Gui/mplayer/gtk/eq.c Gui/mplayer/gtk/eq.h Gui/mplayer/gtk/menu.h Gui/mplayer/gtk/opts.h Gui/mplayer/gtk/pl.c Gui/mplayer/gtk/pl.h Gui/mplayer/gtk/url.c Gui/mplayer/mw.h Gui/mplayer/play.c Gui/wm/wsxdnd.c |
diffstat | 14 files changed, 125 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/Gui/app.c Mon Aug 26 17:20:17 2002 +0000 +++ b/Gui/app.c Mon Aug 26 22:20:58 2002 +0000 @@ -13,6 +13,8 @@ #include "mplayer/mplayer.h" #include "interface.h" +extern char *get_path(char *); + listItems appMPlayer; char * skinDirInHome=NULL;
--- a/Gui/cfg.c Mon Aug 26 17:20:17 2002 +0000 +++ b/Gui/cfg.c Mon Aug 26 22:20:58 2002 +0000 @@ -106,9 +106,22 @@ { 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 @@ 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 @@ } 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; }
--- a/Gui/interface.c Mon Aug 26 17:20:17 2002 +0000 +++ b/Gui/interface.c Mon Aug 26 22:20:58 2002 +0000 @@ -555,6 +555,8 @@ plItem * plList = NULL; plItem * plLastPlayed = NULL; +URLItem *URLList = NULL; + #if defined( MP_DEBUG ) && 0 void list( void ) { @@ -577,6 +579,9 @@ 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 @@ 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 @@ 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;
--- a/Gui/interface.h Mon Aug 26 17:20:17 2002 +0000 +++ b/Gui/interface.h Mon Aug 26 22:20:58 2002 +0000 @@ -144,10 +144,18 @@ 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 @@ #define gtkSetFontFactor 17 #define gtkSetAutoq 18 #define gtkClearStruct 19 +#define gtkAddURLItem 20 extern float gtkEquChannels[6][10];
--- a/Gui/mplayer/gtk/eq.c Mon Aug 26 17:20:17 2002 +0000 +++ b/Gui/mplayer/gtk/eq.c Mon Aug 26 22:20:58 2002 +0000 @@ -233,7 +233,6 @@ static void eqSelectChannelsListRow( GtkCList * clist,gint row,gint column,GdkEvent * event,gpointer user_data ) { - char * tmp; Channel=row - 1; eqSetBands( Channel ); if ( Channel == -1 )
--- a/Gui/mplayer/gtk/eq.h Mon Aug 26 17:20:17 2002 +0000 +++ b/Gui/mplayer/gtk/eq.h Mon Aug 26 22:20:58 2002 +0000 @@ -9,4 +9,4 @@ extern GtkWidget * create_Equalizer( void ); extern void ShowEqualizer( void ); -#endif \ No newline at end of file +#endif
--- a/Gui/mplayer/gtk/menu.h Mon Aug 26 17:20:17 2002 +0000 +++ b/Gui/mplayer/gtk/menu.h Mon Aug 26 22:20:58 2002 +0000 @@ -10,4 +10,4 @@ extern GtkWidget * AddSeparator( GtkWidget * Menu ); extern GtkWidget * create_PopUpMenu( void ); -#endif \ No newline at end of file +#endif
--- a/Gui/mplayer/gtk/opts.h Mon Aug 26 17:20:17 2002 +0000 +++ b/Gui/mplayer/gtk/opts.h Mon Aug 26 22:20:58 2002 +0000 @@ -14,4 +14,4 @@ extern void ShowPreferences( void ); -#endif \ No newline at end of file +#endif
--- a/Gui/mplayer/gtk/pl.c Mon Aug 26 17:20:17 2002 +0000 +++ b/Gui/mplayer/gtk/pl.c Mon Aug 26 22:20:58 2002 +0000 @@ -266,7 +266,7 @@ { 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++;
--- a/Gui/mplayer/gtk/pl.h Mon Aug 26 17:20:17 2002 +0000 +++ b/Gui/mplayer/gtk/pl.h Mon Aug 26 22:20:58 2002 +0000 @@ -11,4 +11,4 @@ extern GtkWidget * create_PlayList (void); -#endif \ No newline at end of file +#endif
--- a/Gui/mplayer/gtk/url.c Mon Aug 26 17:20:17 2002 +0000 +++ b/Gui/mplayer/gtk/url.c Mon Aug 26 22:20:58 2002 +0000 @@ -27,6 +27,18 @@ 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 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 @@ 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 );
--- a/Gui/mplayer/mw.h Mon Aug 26 17:20:17 2002 +0000 +++ b/Gui/mplayer/mw.h Mon Aug 26 22:20:58 2002 +0000 @@ -646,7 +646,7 @@ } /* 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;
--- a/Gui/mplayer/play.c Mon Aug 26 17:20:17 2002 +0000 +++ b/Gui/mplayer/play.c Mon Aug 26 22:20:58 2002 +0000 @@ -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 @@ void mplFullScreen( void ) { +#if 0 static int sx,sy; - -#if 0 // if ( !guiIntfStruct.Playing ) { wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow );
--- a/Gui/wm/wsxdnd.c Mon Aug 26 17:20:17 2002 +0000 +++ b/Gui/wm/wsxdnd.c Mon Aug 26 22:20:58 2002 +0000 @@ -126,6 +126,7 @@ } free(delme); + return True; } Bool @@ -153,10 +154,11 @@ } } 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,