? openurl.diff ? Gui/mplayer/gtk/fs.c.new Index: Gui/cfg.c =================================================================== RCS file: /cvsroot/mplayer/main/Gui/cfg.c,v retrieving revision 1.8 diff -u -r1.8 cfg.c --- Gui/cfg.c 15 Aug 2002 22:52:51 -0000 1.8 +++ Gui/cfg.c 25 Aug 2002 18:26:40 -0000 @@ -142,6 +142,26 @@ fclose( f ); free( cfg ); } + + //-- read previously visited urls + { + FILE * f; + cfg=get_path( "gui.url" ); + if ( (f=fopen( cfg,"rt" )) == NULL ) return 1; + while ( !feof( f ) ) + { + char tmp[512]; URLItem * url_item = calloc( 1,sizeof( char ) ); char c; + if ( fgets( tmp,512,f ) == NULL ) continue; + c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; + url_item->url=strdup( tmp ); + gtkSet( gtkAddURLItem,0,(void*)url_item ); + } + fclose( f ); + free( cfg ); + } + + + return 0; } @@ -195,6 +215,20 @@ } free( cfg ); +// -- save URL's + cfg=get_path( "gui.url" ); + if ( (f=fopen( cfg,"wt+" )) ) + { + plCurrent=plList; + while ( URLCurrent ) + { + if ( URLCurrent->url ) + fprintf( f,"%s\n",URLCurrent->url ); + URLCurrent=URLCurrent->next; + } + fclose( f ); + } + free( cfg ); return 0; } Index: Gui/interface.c =================================================================== RCS file: /cvsroot/mplayer/main/Gui/interface.c,v retrieving revision 1.38 diff -u -r1.38 interface.c --- Gui/interface.c 15 Aug 2002 22:52:51 -0000 1.38 +++ Gui/interface.c 25 Aug 2002 18:26:41 -0000 @@ -555,6 +555,8 @@ plItem * plList = NULL; plItem * plLastPlayed = NULL; +URLItem *URLCurrent = NULL; + #if defined( MP_DEBUG ) && 0 void list( void ) { @@ -576,7 +578,9 @@ mp_cmd_t * mp_cmd; equalizer_t * eq = (equalizer_t *)vparam; plItem * item = (plItem *)vparam; - + URLItem * url_item = (URLItem *)vparam; + int is_added=True; + switch ( cmd ) { // --- handle playlist @@ -638,6 +642,28 @@ plList=NULL; plCurrent=NULL; } return NULL; + // ----- Handle url + case gtkAddURLItem: + { + if ( URLCurrent ){ + URLItem * next_url = URLCurrent; + is_added = False; + while ( next_url->next ) + { + if ( strcmp( next_url->url, url_item->url )==0 ) + { + is_added = True; + break; + } + next_url=next_url->next; + } + if ( (! is_added) && (strcmp( next_url->url, url_item->url )!=0) ){ + next_url->next=url_item; + } + } + else { url_item->next=NULL; URLCurrent=url_item; } + return NULL; + } // --- subtitle case gtkSetSubAuto: sub_auto=(int)fparam; Index: Gui/interface.h =================================================================== RCS file: /cvsroot/mplayer/main/Gui/interface.h,v retrieving revision 1.21 diff -u -r1.21 interface.h --- Gui/interface.h 15 Aug 2002 22:52:51 -0000 1.21 +++ Gui/interface.h 25 Aug 2002 18:26:41 -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 * URLCurrent; + #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]; Index: Gui/mplayer/gtk/url.c =================================================================== RCS file: /cvsroot/mplayer/main/Gui/mplayer/gtk/url.c,v retrieving revision 1.6 diff -u -r1.6 url.c --- Gui/mplayer/gtk/url.c 4 Aug 2002 19:23:58 -0000 1.6 +++ Gui/mplayer/gtk/url.c 25 Aug 2002 18:26:42 -0000 @@ -22,15 +22,31 @@ static GtkWidget * URLEntry; static GList * URLComboEntrys = NULL; +//static char * my_item=NULL; void ShowURLDialogBox( void ) { + URLItem * my_item = calloc( 1,sizeof( char ) ); + + if ( gtkVURLDialogBox ) gtkActive( URL ); - else URL=create_URL(); - + else URL=create_URL(); + + if ( URLCurrent ) + { + my_item = URLCurrent; + g_list_free( URLComboEntrys ); + URLComboEntrys = NULL; + while( my_item->next != NULL ) + { + URLComboEntrys = g_list_append( URLComboEntrys, (gchar *)my_item->url ); + my_item = my_item->next; + } + URLComboEntrys = g_list_append( URLComboEntrys, (gchar *)my_item->url ); + } if ( URLComboEntrys ) { - gtk_entry_set_text( GTK_ENTRY( URLEntry ),URLComboEntrys->data ); - gtk_combo_set_popdown_strings( GTK_COMBO( URLCombo ),URLComboEntrys ); + gtk_entry_set_text( GTK_ENTRY( URLEntry ),URLComboEntrys->data ); + gtk_combo_set_popdown_strings( GTK_COMBO( URLCombo ),URLComboEntrys ); } gtk_widget_show( URL ); @@ -52,7 +68,9 @@ } static void on_Button_pressed( GtkButton * button,gpointer user_data ) -{ +{ + URLItem * my_item = calloc( 1,sizeof( char ) ); + if ( (int)user_data ) { gchar * str= strdup( gtk_entry_get_text( GTK_ENTRY( URLEntry ) ) ); @@ -66,8 +84,8 @@ sprintf( tmp,"http://%s",str ); free( str ); str=tmp; } - URLComboEntrys=g_list_prepend( URLComboEntrys,(gchar *)str ); - + my_item->url = strdup( str ); + gtkSet(gtkAddURLItem,0, (void*)my_item ); guiSetFilename( guiIntfStruct.Filename,str ); guiIntfStruct.FilenameChanged=1; mplEventHandling( evPlayNetwork,0 ); }