[MPlayer-cvslog] r36110 - trunk/gui/dialog/fileselect.c
ib
subversion at mplayerhq.hu
Sun Mar 31 14:10:43 CEST 2013
Author: ib
Date: Sun Mar 31 14:10:42 2013
New Revision: 36110
Log:
Cosmetic: Rearrange code.
Modified:
trunk/gui/dialog/fileselect.c
Modified: trunk/gui/dialog/fileselect.c
==============================================================================
--- trunk/gui/dialog/fileselect.c Sun Mar 31 05:57:53 2013 (r36109)
+++ trunk/gui/dialog/fileselect.c Sun Mar 31 14:10:42 2013 (r36110)
@@ -155,6 +155,31 @@ GdkPixmap *fpixmap;
GdkBitmap *dmask;
GdkBitmap *fmask;
+static void fs_PersistantHistory(char *subject)
+{
+ unsigned int i;
+ char *entry;
+
+ if (!subject)
+ return;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(fsHistory); i++)
+ if (gstrcmp(fsHistory[i], subject) == 0) {
+ entry = fsHistory[i];
+ break;
+ }
+
+ if (i == FF_ARRAY_ELEMS(fsHistory)) {
+ entry = strdup(subject);
+ free(fsHistory[--i]);
+ }
+
+ for (; i; i--)
+ fsHistory[i] = fsHistory[i - 1];
+
+ fsHistory[0] = entry;
+}
+
static gchar *get_current_dir_name_utf8(void)
{
char *dir;
@@ -167,6 +192,27 @@ static gchar *get_current_dir_name_utf8(
return utf8dir;
}
+static GList *fs_AddPath(GList *list, gpointer data, GtkPositionType pos)
+{
+ if (!g_list_find_custom(list, data, (GCompareFunc)strcmp)) {
+ if (pos == GTK_POS_TOP)
+ list = g_list_prepend(list, data);
+ else
+ list = g_list_append(list, data);
+ }
+
+ return list;
+}
+
+static void fs_AddPathUtf8(const char *name, GtkPositionType pos)
+{
+ gchar *utf8name;
+
+ utf8name = g_filename_display_name(name);
+ fsTopList_items = fs_AddPath(fsTopList_items, utf8name, pos);
+ g_hash_table_insert(fsPathTable, strdup(utf8name), strdup(name));
+}
+
static void clist_append_fname(GtkWidget *list, char *fname,
GdkPixmap *pixmap, GdkPixmap *mask)
{
@@ -251,63 +297,8 @@ static void CheckDir(GtkWidget *list)
gtk_widget_show(list);
}
-static GList *fs_AddPath(GList *list, gpointer data, GtkPositionType pos)
-{
- if (!g_list_find_custom(list, data, (GCompareFunc)strcmp)) {
- if (pos == GTK_POS_TOP)
- list = g_list_prepend(list, data);
- else
- list = g_list_append(list, data);
- }
-
- return list;
-}
-
-static void fs_AddPathUtf8(const char *name, GtkPositionType pos)
-{
- gchar *utf8name;
-
- utf8name = g_filename_display_name(name);
- fsTopList_items = fs_AddPath(fsTopList_items, utf8name, pos);
- g_hash_table_insert(fsPathTable, strdup(utf8name), strdup(name));
-}
-
-static void fs_PersistantHistory(char *subject)
-{
- unsigned int i;
- char *entry;
-
- if (!subject)
- return;
-
- for (i = 0; i < FF_ARRAY_ELEMS(fsHistory); i++)
- if (gstrcmp(fsHistory[i], subject) == 0) {
- entry = fsHistory[i];
- break;
- }
-
- if (i == FF_ARRAY_ELEMS(fsHistory)) {
- entry = strdup(subject);
- free(fsHistory[--i]);
- }
-
- for (; i; i--)
- fsHistory[i] = fsHistory[i - 1];
-
- fsHistory[0] = entry;
-}
-
/* ----------------------------------------------- */
-static void fs_fsFilterCombo_activate(GtkEntry *entry,
- gpointer user_data)
-{
- (void)entry;
-
- fsFilter = gtk_entry_get_text(GTK_ENTRY(user_data));
- CheckDir(fsFNameList);
-}
-
static void fs_fsFilterCombo_changed(GtkEditable *editable,
gpointer user_data)
{
@@ -376,13 +367,22 @@ static void fs_fsFilterCombo_changed(Gtk
CheckDir(fsFNameList);
}
-static void fs_fsPathCombo_activate(GtkEntry *entry,
- gpointer user_data)
+static void fs_fsFilterCombo_activate(GtkEntry *entry,
+ gpointer user_data)
+{
+ (void)entry;
+
+ fsFilter = gtk_entry_get_text(GTK_ENTRY(user_data));
+ CheckDir(fsFNameList);
+}
+
+static void fs_fsPathCombo_changed(GtkEditable *editable,
+ gpointer user_data)
{
const unsigned char *str;
gchar *dirname;
- (void)entry;
+ (void)editable;
str = gtk_entry_get_text(GTK_ENTRY(user_data));
dirname = g_hash_table_lookup(fsPathTable, str);
@@ -391,13 +391,13 @@ static void fs_fsPathCombo_activate(GtkE
CheckDir(fsFNameList);
}
-static void fs_fsPathCombo_changed(GtkEditable *editable,
- gpointer user_data)
+static void fs_fsPathCombo_activate(GtkEntry *entry,
+ gpointer user_data)
{
const unsigned char *str;
gchar *dirname;
- (void)editable;
+ (void)entry;
str = gtk_entry_get_text(GTK_ENTRY(user_data));
dirname = g_hash_table_lookup(fsPathTable, str);
@@ -406,6 +406,42 @@ static void fs_fsPathCombo_changed(GtkEd
CheckDir(fsFNameList);
}
+static gboolean fs_fsFNameList_event(GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ GdkEventButton *bevent;
+ gint row, col;
+
+ (void)user_data;
+
+ bevent = (GdkEventButton *)event;
+
+ if (event->type == GDK_BUTTON_RELEASE && bevent->button == 2) {
+ if (gtk_clist_get_selection_info(GTK_CLIST(widget), bevent->x, bevent->y, &row, &col)) {
+ fsSelectedFile = gtk_clist_get_row_data(GTK_CLIST(widget), row);
+ gtk_button_released(GTK_BUTTON(fsOk));
+
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+static void fs_fsFNameList_select_row(GtkCList *clist, gint row, gint column,
+ GdkEvent *event, gpointer user_data)
+{
+ (void)column;
+ (void)user_data;
+
+ fsCurrFNameListSelected = row;
+ fsSelectedFile = gtk_clist_get_row_data(clist, row);
+
+ if (event && event->type == GDK_BUTTON_PRESS)
+ gtk_button_released(GTK_BUTTON(fsOk));
+}
+
static void fs_Up_released(GtkButton *button, gpointer user_data)
{
gchar *utf8dir;
@@ -514,19 +550,6 @@ static void fs_Ok_released(GtkButton *bu
gui(GUI_SET_STATE, (void *)GUI_STOP);
}
-static void fs_fsFNameList_select_row(GtkCList *clist, gint row, gint column,
- GdkEvent *event, gpointer user_data)
-{
- (void)column;
- (void)user_data;
-
- fsCurrFNameListSelected = row;
- fsSelectedFile = gtk_clist_get_row_data(clist, row);
-
- if (event && event->type == GDK_BUTTON_PRESS)
- gtk_button_released(GTK_BUTTON(fsOk));
-}
-
static gboolean on_FileSelect_key_release_event(GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
@@ -556,29 +579,6 @@ static gboolean on_FileSelect_key_releas
return FALSE;
}
-static gboolean fs_fsFNameList_event(GtkWidget *widget,
- GdkEvent *event,
- gpointer user_data)
-{
- GdkEventButton *bevent;
- gint row, col;
-
- (void)user_data;
-
- bevent = (GdkEventButton *)event;
-
- if (event->type == GDK_BUTTON_RELEASE && bevent->button == 2) {
- if (gtk_clist_get_selection_info(GTK_CLIST(widget), bevent->x, bevent->y, &row, &col)) {
- fsSelectedFile = gtk_clist_get_row_data(GTK_CLIST(widget), row);
- gtk_button_released(GTK_BUTTON(fsOk));
-
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
static void fs_Destroy(void)
{
gtk_widget_destroyed(FileSelector, &FileSelector);
More information about the MPlayer-cvslog
mailing list