[Mplayer-cvslog] CVS: main/Gui app.c,1.13,1.14 cfg.c,1.8,1.9 interface.c,1.38,1.39 interface.h,1.21,1.22
Zoltan Ponekker
pontscho at mplayerhq.hu
Tue Aug 27 00:21:29 CEST 2002
Update of /cvsroot/mplayer/main/Gui
In directory mail:/var/tmp.root/cvs-serv864/Gui
Modified Files:
app.c cfg.c interface.c interface.h
Log Message:
- warning fixes from Dominik Mierzejewski <dominik at rangers.eu.org>
- wsXDNDProcessSelection return Truae fix
- add url list saving support from Morten Volden <mvolden at tdcadsl.dk>
- fix bug's in this patches
- fix some memleak and bug
Index: app.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/app.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- app.c 28 May 2002 11:55:15 -0000 1.13
+++ app.c 26 Aug 2002 22:20:43 -0000 1.14
@@ -13,6 +13,8 @@
#include "mplayer/mplayer.h"
#include "interface.h"
+extern char *get_path(char *);
+
listItems appMPlayer;
char * skinDirInHome=NULL;
Index: cfg.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/cfg.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- cfg.c 15 Aug 2002 22:52:51 -0000 1.8
+++ cfg.c 26 Aug 2002 22:20:43 -0000 1.9
@@ -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;
}
@@ -190,6 +216,19 @@
fprintf( f,"%s\n",plCurrent->name );
}
plCurrent=plCurrent->next;
+ }
+ fclose( f );
+ }
+ 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 );
}
Index: interface.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/interface.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- interface.c 15 Aug 2002 22:52:51 -0000 1.38
+++ interface.c 26 Aug 2002 22:20:43 -0000 1.39
@@ -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
@@ -637,6 +641,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:
Index: interface.h
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/interface.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- interface.h 15 Aug 2002 22:52:51 -0000 1.21
+++ interface.h 26 Aug 2002 22:20:43 -0000 1.22
@@ -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];
More information about the MPlayer-cvslog
mailing list