Mercurial > mplayer.hg
changeset 36024:a9e5f317d6e4
Move gtkFindCList() to tools.c.
Additionally, rename it gtkFindInCList().
author | ib |
---|---|
date | Sun, 31 Mar 2013 18:30:30 +0000 |
parents | a04e8798227b |
children | df87a3a24a7c |
files | gui/dialog/dialog.c gui/dialog/dialog.h gui/dialog/skinbrowser.c gui/dialog/tools.c gui/dialog/tools.h |
diffstat | 5 files changed, 21 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/dialog/dialog.c Sun Mar 31 18:08:37 2013 +0000 +++ b/gui/dialog/dialog.c Sun Mar 31 18:30:30 2013 +0000 @@ -66,6 +66,7 @@ #include "menu.h" #include "url.h" #include "equalizer.h" +#include "tools.h" static const char gui_icon_name[] = "mplayer"; @@ -188,21 +189,6 @@ wsWindowIcon(gdk_display, GDK_WINDOW_XWINDOW(window->window), &guiIcon); } -int gtkFindCList(GtkWidget *list, char *item) -{ - gint j; - gchar *tmpstr; - - for (j = 0; j < GTK_CLIST(list)->rows; j++) { - gtk_clist_get_text(GTK_CLIST(list), j, 0, &tmpstr); - - if (!strcmp(tmpstr, item)) - return j; - } - - return -1; -} - void gtkEventHandling(void) { int i; @@ -281,7 +267,7 @@ { gint i; - if ((i = gtkFindCList(list, item)) > -1) + if ((i = gtkFindInCList(list, item)) > -1) gtk_clist_select_row(GTK_CLIST(list), i, 0); }
--- a/gui/dialog/dialog.h Sun Mar 31 18:08:37 2013 +0000 +++ b/gui/dialog/dialog.h Sun Mar 31 18:30:30 2013 +0000 @@ -67,7 +67,6 @@ void gtkAddIcon(GtkWidget *window); int gtkFillSkinList(gchar *dir); -int gtkFindCList(GtkWidget *list, char *item); void gtkEventHandling(void);
--- a/gui/dialog/skinbrowser.c Sun Mar 31 18:08:37 2013 +0000 +++ b/gui/dialog/skinbrowser.c Sun Mar 31 18:30:30 2013 +0000 @@ -183,7 +183,7 @@ str[0]="default"; str[1]=""; - if ( gtkFindCList( SkinList,str[0] ) == -1 ) gtk_clist_append( GTK_CLIST( SkinList ),str ); + if ( gtkFindInCList( SkinList,str[0] ) == -1 ) gtk_clist_append( GTK_CLIST( SkinList ),str ); glob( mdir,GLOB_NOSORT,NULL,&gg ); for( i=0;i<(int)gg.gl_pathc;i++ ) @@ -196,7 +196,7 @@ else tmp = gg.gl_pathv[i]; if ( !strcmp( tmp,"default" ) ) continue; str[0]=tmp; - if ( gtkFindCList( SkinList,str[0] ) == -1 ) gtk_clist_append( GTK_CLIST( SkinList ),str ); + if ( gtkFindInCList( SkinList,str[0] ) == -1 ) gtk_clist_append( GTK_CLIST( SkinList ),str ); } } globfree( &gg );
--- a/gui/dialog/tools.c Sun Mar 31 18:08:37 2013 +0000 +++ b/gui/dialog/tools.c Sun Mar 31 18:30:30 2013 +0000 @@ -18,6 +18,7 @@ #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> +#include <string.h> #include "tools.h" @@ -187,3 +188,18 @@ if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),CB,TRUE,TRUE,0 ); return CB; } + +int gtkFindInCList (GtkWidget *list, char *item) +{ + gint j; + gchar *tmpstr; + + for (j = 0; j < GTK_CLIST(list)->rows; j++) + { + gtk_clist_get_text(GTK_CLIST(list), j, 0, &tmpstr); + + if (!strcmp(tmpstr, item)) return j; + } + + return -1; +}
--- a/gui/dialog/tools.h Sun Mar 31 18:08:37 2013 +0000 +++ b/gui/dialog/tools.h Sun Mar 31 18:30:30 2013 +0000 @@ -36,5 +36,6 @@ GtkWidget * gtkAddHScale( GtkAdjustment * adj, GtkWidget * parent, int digit ); GtkWidget * gtkAddVScale( GtkAdjustment * adj, GtkWidget * parent, int digit ); GtkWidget * gtkAddCombo( GtkWidget * parent ); +int gtkFindInCList(GtkWidget *list, char *item); #endif /* MPLAYER_GUI_TOOLS_H */