aboutsummaryrefslogtreecommitdiffhomepage
path: root/gui/mplayer
diff options
context:
space:
mode:
authorGravatar reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-06-04 13:15:35 +0000
committerGravatar reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-06-04 13:15:35 +0000
commite8d57600dcbc842d6cf3959980b6810d31dbfd8e (patch)
tree10473056078b782719d4c8dbd9504c4b45867e70 /gui/mplayer
parentb609629b2bfbec9c9f0602c07fdfe855063ec785 (diff)
Factor out some duplicated gui code
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23463 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'gui/mplayer')
-rw-r--r--gui/mplayer/gtk/fs.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/gui/mplayer/gtk/fs.c b/gui/mplayer/gtk/fs.c
index 4cce4b59e3..6d9125eb12 100644
--- a/gui/mplayer/gtk/fs.c
+++ b/gui/mplayer/gtk/fs.c
@@ -147,11 +147,20 @@ static char * Filter( char * name )
return tmp;
}
+static void clist_append_fname(GtkWidget * list, char *fname,
+ GdkPixmap *pixmap, GdkPixmap *mask) {
+ gint pos;
+ gchar *str[2];
+ str[0] = NULL;
+ str[1] = fname;
+ pos = gtk_clist_append(GTK_CLIST(list), str);
+ gtk_clist_set_pixmap(GTK_CLIST(list), pos, 0, pixmap, mask);
+}
+
void CheckDir( GtkWidget * list,char * directory )
{
struct stat fs;
- int i,c=2;
- gchar * str[1][2];
+ int i;
GdkPixmap * pixmap;
GdkBitmap * mask;
glob_t gg;
@@ -160,11 +169,9 @@ void CheckDir( GtkWidget * list,char * directory )
gtk_widget_hide( list );
gtk_clist_clear( GTK_CLIST( list ) );
- str[0][0]=NULL;
- pixmap=dpixmap; mask=dmask;
- str[0][1]="."; gtk_clist_append( GTK_CLIST( list ),str[0] ); gtk_clist_set_pixmap( GTK_CLIST( list ),0,0,pixmap,mask );
- str[0][1]=".."; gtk_clist_append( GTK_CLIST( list ),str[0] ); gtk_clist_set_pixmap( GTK_CLIST( list ),1,0,pixmap,mask );
+ clist_append_fname(list, ".", dpixmap, dmask);
+ clist_append_fname(list, "..", dpixmap, dmask);
glob( "*",0,NULL,&gg );
// glob( ".*",GLOB_NOSORT | GLOB_APPEND,NULL,&gg );
@@ -172,10 +179,7 @@ void CheckDir( GtkWidget * list,char * directory )
{
stat( gg.gl_pathv[i],&fs );
if( !S_ISDIR( fs.st_mode ) ) continue;
-
- str[0][1]=gg.gl_pathv[i];
- gtk_clist_append( GTK_CLIST( list ),str[0] );
- gtk_clist_set_pixmap( GTK_CLIST( list ),c++,0,pixmap,mask );
+ clist_append_fname(list, gg.gl_pathv[i], dpixmap, dmask);
}
globfree( &gg );
@@ -214,15 +218,11 @@ void CheckDir( GtkWidget * list,char * directory )
#endif
// glob( ".*",GLOB_NOSORT | GLOB_APPEND,NULL,&gg );
- pixmap=fpixmap; mask=fmask;
for( i=0;(unsigned)i<gg.gl_pathc;i++ )
{
stat( gg.gl_pathv[i],&fs );
if( S_ISDIR( fs.st_mode ) ) continue;
-
- str[0][1]=gg.gl_pathv[i];
- gtk_clist_append( GTK_CLIST( list ),str[0] );
- gtk_clist_set_pixmap( GTK_CLIST( list ),c++,0,pixmap,mask );
+ clist_append_fname(list, gg.gl_pathv[i], fpixmap, fmask);
}
globfree( &gg );