[MPlayer-cvslog] r34698 - in trunk/gui: cfg.c interface.c ui/actions.c ui/gtk/playlist.c ui/gtk/preferences.c ui/gtk/url.c ui/main.c util/list.c util/list.h win32/interface.c win32/preferences.c
ib
subversion at mplayerhq.hu
Sun Feb 12 19:44:19 CET 2012
Author: ib
Date: Sun Feb 12 19:44:19 2012
New Revision: 34698
Log:
Cosmetic: Rename functions in list.c.
Additionally, change a parameter name of new listMgr()
and add some doxygen comments to list.h.
Modified:
trunk/gui/cfg.c
trunk/gui/interface.c
trunk/gui/ui/actions.c
trunk/gui/ui/gtk/playlist.c
trunk/gui/ui/gtk/preferences.c
trunk/gui/ui/gtk/url.c
trunk/gui/ui/main.c
trunk/gui/util/list.c
trunk/gui/util/list.h
trunk/gui/win32/interface.c
trunk/gui/win32/preferences.c
Modified: trunk/gui/cfg.c
==============================================================================
--- trunk/gui/cfg.c Sun Feb 12 19:39:27 2012 (r34697)
+++ trunk/gui/cfg.c Sun Feb 12 19:44:19 2012 (r34698)
@@ -291,7 +291,7 @@ void cfg_read(void)
if (fgetstr(line, sizeof(line), file) && *line) {
item->name = strdup(line);
- listSet(gtkAddPlItem, item);
+ listMgr(gtkAddPlItem, item);
} else {
free(item->path);
free(item);
@@ -323,7 +323,7 @@ void cfg_read(void)
}
item->url = strdup(line);
- listSet(gtkAddURLItem, item);
+ listMgr(gtkAddURLItem, item);
}
fclose(file);
Modified: trunk/gui/interface.c
==============================================================================
--- trunk/gui/interface.c Sun Feb 12 19:39:27 2012 (r34697)
+++ trunk/gui/interface.c Sun Feb 12 19:44:19 2012 (r34698)
@@ -268,8 +268,8 @@ void guiDone(void)
}
appFreeStruct();
- listSet(gtkDelPl, NULL);
- listSet(gtkDelURL, NULL);
+ listMgr(gtkDelPl, NULL);
+ listMgr(gtkDelURL, NULL);
free(guiIcon.collection);
if (gui_conf) {
@@ -449,7 +449,7 @@ int gui(int what, void *data)
while (video_out_drivers[i++]) {
if (video_out_drivers[i - 1]->control(VOCTRL_GUISUPPORT, NULL) == VO_TRUE) {
- gaddlist(&video_driver_list, (char *)video_out_drivers[i - 1]->info->short_name);
+ listSet(&video_driver_list, (char *)video_out_drivers[i - 1]->info->short_name);
break;
}
}
@@ -487,10 +487,10 @@ int gui(int what, void *data)
// if ( ao_plugin_cfg.plugin_list ) { free( ao_plugin_cfg.plugin_list ); ao_plugin_cfg.plugin_list=NULL; }
if (gtkAONorm)
- greplace(&af_cfg.list, "volnorm", "volnorm");
+ listRepl(&af_cfg.list, "volnorm", "volnorm");
if (gtkEnableAudioEqualizer)
- greplace(&af_cfg.list, "equalizer", "equalizer");
+ listRepl(&af_cfg.list, "equalizer", "equalizer");
if (gtkAOExtraStereo) {
char *name;
@@ -498,7 +498,7 @@ int gui(int what, void *data)
name = malloc(12 + 20 + 1);
snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
name[12 + 20] = 0;
- greplace(&af_cfg.list, "extrastereo", name);
+ listRepl(&af_cfg.list, "extrastereo", name);
free(name);
}
@@ -514,7 +514,7 @@ int gui(int what, void *data)
} else
tmp = strdup("oss");
- gaddlist(&audio_driver_list, tmp);
+ listSet(&audio_driver_list, tmp);
free(tmp);
}
@@ -530,7 +530,7 @@ int gui(int what, void *data)
} else
tmp = strdup("alsa");
- gaddlist(&audio_driver_list, tmp);
+ listSet(&audio_driver_list, tmp);
free(tmp);
}
@@ -543,7 +543,7 @@ int gui(int what, void *data)
} else
tmp = strdup("sdl");
- gaddlist(&audio_driver_list, tmp);
+ listSet(&audio_driver_list, tmp);
free(tmp);
}
@@ -556,7 +556,7 @@ int gui(int what, void *data)
} else
tmp = strdup("esd");
- gaddlist(&audio_driver_list, tmp);
+ listSet(&audio_driver_list, tmp);
free(tmp);
}
@@ -777,7 +777,7 @@ int gui(int what, void *data)
break;
}
- if (guiInfo.Playing && (next = listSet(gtkGetNextPlItem, NULL)) && (plLastPlayed != next)) {
+ if (guiInfo.Playing && (next = listMgr(gtkGetNextPlItem, NULL)) && (plLastPlayed != next)) {
plLastPlayed = next;
uiSetFileName(next->path, next->name, STREAMTYPE_FILE);
guiInfo.NewPlay = GUI_FILE_NEW;
@@ -858,9 +858,9 @@ static int import_file_into_gui(char *te
item->path = pathname;
if (insert)
- listSet(gtkInsertPlItem, item); // inserts the item after current, and makes current=item
+ listMgr(gtkInsertPlItem, item); // inserts the item after current, and makes current=item
else
- listSet(gtkAddPlItem, item);
+ listMgr(gtkAddPlItem, item);
return 1;
}
@@ -875,7 +875,7 @@ int guiPlaylistInitialize(play_tree_t *m
int result = 0;
if (!enqueue)
- listSet(gtkDelPl, NULL); // delete playlist before "appending"
+ listMgr(gtkDelPl, NULL); // delete playlist before "appending"
if ((my_pt_iter = pt_iter_create(&my_playtree, config))) {
while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
@@ -904,7 +904,7 @@ int guiPlaylistAdd(play_tree_t *my_playt
int result = 0;
plItem *save;
- save = (plItem *)listSet(gtkGetCurrPlItem, NULL); // save current item
+ save = (plItem *)listMgr(gtkGetCurrPlItem, NULL); // save current item
if ((my_pt_iter = pt_iter_create(&my_playtree, config))) {
while ((filename = pt_iter_get_next_file(my_pt_iter)) != NULL)
@@ -916,12 +916,12 @@ int guiPlaylistAdd(play_tree_t *my_playt
}
if (save)
- listSet(gtkSetCurrPlItem, save);
+ listMgr(gtkSetCurrPlItem, save);
else
- listSet(gtkSetCurrPlItem, plList); // go to head, if plList was empty before
+ listMgr(gtkSetCurrPlItem, plList); // go to head, if plList was empty before
if (save && result)
- listSet(gtkDelCurrPlItem, NULL);
+ listMgr(gtkDelCurrPlItem, NULL);
uiCurr(); // update filename
Modified: trunk/gui/ui/actions.c
==============================================================================
--- trunk/gui/ui/actions.c Sun Feb 12 19:39:27 2012 (r34697)
+++ trunk/gui/ui/actions.c Sun Feb 12 19:44:19 2012 (r34698)
@@ -254,7 +254,7 @@ void uiCurr(void)
default:
- curr = listSet(gtkGetCurrPlItem, NULL);
+ curr = listMgr(gtkGetCurrPlItem, NULL);
if (curr) {
uiSetFileName(curr->path, curr->name, STREAMTYPE_FILE);
@@ -310,7 +310,7 @@ void uiPrev(void)
default:
- prev = listSet(gtkGetPrevPlItem, NULL);
+ prev = listMgr(gtkGetPrevPlItem, NULL);
if (prev) {
uiSetFileName(prev->path, prev->name, STREAMTYPE_FILE);
@@ -371,7 +371,7 @@ void uiNext(void)
default:
- next = listSet(gtkGetNextPlItem, NULL);
+ next = listMgr(gtkGetNextPlItem, NULL);
if (next) {
uiSetFileName(next->path, next->name, STREAMTYPE_FILE);
Modified: trunk/gui/ui/gtk/playlist.c
==============================================================================
--- trunk/gui/ui/gtk/playlist.c Sun Feb 12 19:39:27 2012 (r34697)
+++ trunk/gui/ui/gtk/playlist.c Sun Feb 12 19:44:19 2012 (r34698)
@@ -191,7 +191,7 @@ static void plButtonReleased( GtkButton
case 1: // ok
{
int i;
- if ( plList ) listSet( gtkDelPl,NULL );
+ if ( plList ) listMgr( gtkDelPl,NULL );
for ( i=0;i<NrOfSelected;i++ )
{
plItem * item;
@@ -203,7 +203,7 @@ static void plButtonReleased( GtkButton
if ( !item->name ) item->name = strdup( text[0] );
item->path=g_filename_from_utf8( text[1], -1, NULL, NULL, NULL );
if ( !item->path ) item->path = strdup( text[1] );
- listSet( gtkAddPlItem,item );
+ listMgr( gtkAddPlItem,item );
}
if ( plCurrent )
{
Modified: trunk/gui/ui/gtk/preferences.c
==============================================================================
--- trunk/gui/ui/gtk/preferences.c Sun Feb 12 19:39:27 2012 (r34697)
+++ trunk/gui/ui/gtk/preferences.c Sun Feb 12 19:44:19 2012 (r34698)
@@ -537,8 +537,8 @@ static void prButton( GtkButton * button
mplayer( MPLAYER_SET_EXTRA_STEREO,HSExtraStereoMuladj->value,0 );
audio_delay=HSAudioDelayadj->value;
- gaddlist( &audio_driver_list,ao_driver[0] );
- gaddlist( &video_driver_list,vo_driver[0] );
+ listSet( &audio_driver_list,ao_driver[0] );
+ listSet( &video_driver_list,vo_driver[0] );
// -- 2. page
vo_doublebuffering=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( CBDoubleBuffer ) );
@@ -599,7 +599,7 @@ static void prButton( GtkButton * button
const char * tmp = gtk_entry_get_text( GTK_ENTRY( EVFM ) );
for( i=0;mpcodecs_vd_drivers[i];i++ )
if ( !gstrcmp( tmp,(char *)mpcodecs_vd_drivers[i]->info->name ) )
- { gaddlist( &video_fm_list,(char *)mpcodecs_vd_drivers[i]->info->short_name ); break; }
+ { listSet( &video_fm_list,(char *)mpcodecs_vd_drivers[i]->info->short_name ); break; }
}
{
@@ -607,7 +607,7 @@ static void prButton( GtkButton * button
const char * tmp = gtk_entry_get_text( GTK_ENTRY( EAFM ) );
for( i=0;mpcodecs_ad_drivers[i];i++ )
if ( !gstrcmp( tmp,(char *)mpcodecs_ad_drivers[i]->info->name ) )
- { gaddlist( &audio_fm_list,(char *)mpcodecs_ad_drivers[i]->info->short_name ); break; }
+ { listSet( &audio_fm_list,(char *)mpcodecs_ad_drivers[i]->info->short_name ); break; }
}
// --- 6. page
Modified: trunk/gui/ui/gtk/url.c
==============================================================================
--- trunk/gui/ui/gtk/url.c Sun Feb 12 19:39:27 2012 (r34697)
+++ trunk/gui/ui/gtk/url.c Sun Feb 12 19:44:19 2012 (r34698)
@@ -101,7 +101,7 @@ static void on_Button_pressed( GtkButton
item=calloc( 1,sizeof( urlItem ) );
item->url=gstrdup( str );
- listSet( gtkAddURLItem,item );
+ listMgr( gtkAddURLItem,item );
uiSetFileName( NULL,str,STREAMTYPE_STREAM ); guiInfo.NewPlay=GUI_FILE_NEW;
uiEventHandling( evPlay,0 );
Modified: trunk/gui/ui/main.c
==============================================================================
--- trunk/gui/ui/main.c Sun Feb 12 19:39:27 2012 (r34697)
+++ trunk/gui/ui/main.c Sun Feb 12 19:44:19 2012 (r34698)
@@ -111,7 +111,7 @@ static void guiInfoMediumClear (int what
nfree(guiInfo.Filename);
nfree(guiInfo.SubtitleFilename);
nfree(guiInfo.AudioFilename);
- listSet(gtkDelPl, NULL);
+ listMgr(gtkDelPl, NULL);
}
if (what & CLEAR_VCD) guiInfo.Tracks = 0;
@@ -208,9 +208,9 @@ play:
if ( ( msg == evPlaySwitchToPause )&&( guiInfo.Playing == GUI_PAUSE ) ) goto NoPause;
- if ( listSet( gtkGetCurrPlItem,NULL ) &&( guiInfo.StreamType == STREAMTYPE_FILE ) )
+ if ( listMgr( gtkGetCurrPlItem,NULL ) &&( guiInfo.StreamType == STREAMTYPE_FILE ) )
{
- plItem * next = listSet( gtkGetCurrPlItem,NULL );
+ plItem * next = listMgr( gtkGetCurrPlItem,NULL );
plLastPlayed=next;
uiSetFileName( next->path,next->name,SAME_STREAMTYPE );
}
@@ -271,7 +271,7 @@ NoPause:
uiMainAutoPlay=1;
// guiInfo.StreamType=STREAMTYPE_FILE;
case evLoad:
- listSet( gtkDelPl,NULL );
+ listMgr( gtkDelPl,NULL );
gtkShow( evLoad,NULL );
break;
case evLoadSubtitle: gtkShow( evLoadSubtitle,NULL ); break;
@@ -643,7 +643,7 @@ void uiDandDHandler(int num,char** files
/* clear playlist */
if (filename == NULL) {
filename = files[f];
- listSet(gtkDelPl,NULL);
+ listMgr(gtkDelPl,NULL);
}
item = calloc(1,sizeof(plItem));
@@ -658,7 +658,7 @@ void uiDandDHandler(int num,char** files
item->name = strdup(str);
item->path = strdup("");
}
- listSet(gtkAddPlItem,item);
+ listMgr(gtkAddPlItem,item);
} else {
mp_msg( MSGT_GPLAYER,MSGL_WARN,MSGTR_NotAFile,str );
}
Modified: trunk/gui/util/list.c
==============================================================================
--- trunk/gui/util/list.c Sun Feb 12 19:39:27 2012 (r34697)
+++ trunk/gui/util/list.c Sun Feb 12 19:44:19 2012 (r34698)
@@ -28,10 +28,10 @@ plItem *plLastPlayed;
urlItem *urlList;
-void *listSet(int cmd, void *vparam)
+void *listMgr(int cmd, void *data)
{
- plItem *item = (plItem *)vparam;
- urlItem *url_item = (urlItem *)vparam;
+ plItem *item = (plItem *)data;
+ urlItem *url_item = (urlItem *)data;
int is_added = 1;
switch (cmd) {
@@ -72,7 +72,7 @@ void *listSet(int cmd, void *vparam)
return plCurrent;
} else
- return listSet(gtkAddPlItem, item);
+ return listMgr(gtkAddPlItem, item);
// get next item from playlist
case gtkGetNextPlItem:
@@ -192,7 +192,7 @@ void *listSet(int cmd, void *vparam)
/**
* \brief This actually creates a new list containing only one element...
*/
-void gaddlist(char ***list, const char *entry)
+void listSet(char ***list, const char *entry)
{
int i;
@@ -212,7 +212,7 @@ void gaddlist(char ***list, const char *
* \brief This replaces a string starting with search by replace.
* If not found, replace is appended.
*/
-void greplace(char ***list, const char *search, const char *replace)
+void listRepl(char ***list, const char *search, const char *replace)
{
int i = 0;
int len = (search ? strlen(search) : 0);
Modified: trunk/gui/util/list.h
==============================================================================
--- trunk/gui/util/list.h Sun Feb 12 19:39:27 2012 (r34697)
+++ trunk/gui/util/list.h Sun Feb 12 19:44:19 2012 (r34698)
@@ -47,8 +47,13 @@ extern plItem *plLastPlayed;
extern urlItem *urlList;
-void gaddlist(char ***list, const char *entry);
-void greplace(char ***list, const char *search, const char *replace);
-void *listSet(int cmd, void *vparam);
+/// list manager (playlist, URL list)
+void *listMgr(int cmd, void *data);
+
+//@{
+/// char pointer list operations
+void listRepl(char ***list, const char *search, const char *replace);
+void listSet(char ***list, const char *entry);
+//@}
#endif /* MPLAYER_GUI_LIST_H */
Modified: trunk/gui/win32/interface.c
==============================================================================
--- trunk/gui/win32/interface.c Sun Feb 12 19:39:27 2012 (r34697)
+++ trunk/gui/win32/interface.c Sun Feb 12 19:44:19 2012 (r34698)
@@ -601,13 +601,13 @@ int gui(int what, void *data)
}
}
guiInfo.VideoWindow = 1;
- if(gtkAONorm) greplace(&af_cfg.list, "volnorm", "volnorm");
+ if(gtkAONorm) listRepl(&af_cfg.list, "volnorm", "volnorm");
if(gtkAOExtraStereo)
{
char *name = malloc(12 + 20 + 1);
snprintf(name, 12 + 20, "extrastereo=%f", gtkAOExtraStereoMul);
name[12 + 20] = 0;
- greplace(&af_cfg.list, "extrastereo", name);
+ listRepl(&af_cfg.list, "extrastereo", name);
free(name);
}
if(gtkCacheOn) stream_cache_size = gtkCacheSize;
Modified: trunk/gui/win32/preferences.c
==============================================================================
--- trunk/gui/win32/preferences.c Sun Feb 12 19:39:27 2012 (r34697)
+++ trunk/gui/win32/preferences.c Sun Feb 12 19:44:19 2012 (r34698)
@@ -347,7 +347,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
while(video_out_drivers[i])
{
const vo_info_t *info = video_out_drivers[i++]->info;
- if(!video_driver_list) gaddlist(&video_driver_list, (char *)info->short_name);
+ if(!video_driver_list) listSet(&video_driver_list, (char *)info->short_name);
SendDlgItemMessage(hwnd, ID_VO_DRIVER, CB_ADDSTRING, 0, (LPARAM) info->short_name);
}
/* Special case for directx:noaccel */
@@ -361,7 +361,7 @@ static LRESULT CALLBACK PrefsWndProc(HWN
{
// FIXME: default priority (i.e. order in audio_out_drivers) should be fixed instead
// if win32 as default is really desirable
- gaddlist(&audio_driver_list, "win32"/*(char *)info->short_name*/);
+ listSet(&audio_driver_list, "win32"/*(char *)info->short_name*/);
}
SendDlgItemMessage(hwnd, ID_AO_DRIVER, CB_ADDSTRING, 0, (LPARAM) info->short_name);
}
More information about the MPlayer-cvslog
mailing list