Mercurial > geeqie.yaz
changeset 401:0a2e1b130a25
Add some wrappers in view_dir.c and simplify even more.
author | zas_ |
---|---|
date | Thu, 17 Apr 2008 20:03:49 +0000 |
parents | 35346871af88 |
children | f6046e1b3622 |
files | src/typedefs.h src/view_dir.c src/view_dir.h src/view_dir_list.c src/view_dir_list.h src/view_dir_tree.c src/view_dir_tree.h |
diffstat | 7 files changed, 55 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/typedefs.h Thu Apr 17 19:57:41 2008 +0000 +++ b/src/typedefs.h Thu Apr 17 20:03:49 2008 +0000 @@ -532,7 +532,6 @@ { DirViewType type; gpointer info; - void (*widget_destroy_cb)(GtkWidget *widget, gpointer data); GtkWidget *widget; GtkWidget *view;
--- a/src/view_dir.c Thu Apr 17 19:57:41 2008 +0000 +++ b/src/view_dir.c Thu Apr 17 20:03:49 2008 +0000 @@ -30,7 +30,7 @@ { "FolderTree", NULL, N_("Tr_ee"), "<control>T", NULL, DIRVIEW_TREE }, }; -void vd_destroy_cb(GtkWidget *widget, gpointer data) +static void vd_destroy_cb(GtkWidget *widget, gpointer data) { ViewDir *vd = data; @@ -41,8 +41,12 @@ gtk_widget_destroy(vd->popup); } - if (vd->widget_destroy_cb) vd->widget_destroy_cb(widget, data); - + switch(vd->type) + { + case DIRVIEW_LIST: vdlist_destroy_cb(widget, data); break; + case DIRVIEW_TREE: vdtree_destroy_cb(widget, data); break; + } + if (vd->pf) folder_icons_free(vd->pf); if (vd->drop_list) filelist_free(vd->drop_list); @@ -918,3 +922,30 @@ return FALSE; } +gint vd_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) +{ + ViewDir *vd = data; + gint ret = FALSE; + + switch(vd->type) + { + case DIRVIEW_LIST: ret = vdlist_press_key_cb(widget, event, data); break; + case DIRVIEW_TREE: ret = vdtree_press_key_cb(widget, event, data); break; + } + + return ret; +} + +gint vd_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +{ + ViewDir *vd = data; + gint ret = FALSE; + + switch(vd->type) + { + case DIRVIEW_LIST: ret = vdlist_press_cb(widget, bevent, data); break; + case DIRVIEW_TREE: ret = vdtree_press_cb(widget, bevent, data); break; + } + + return ret; +}
--- a/src/view_dir.h Thu Apr 17 19:57:41 2008 +0000 +++ b/src/view_dir.h Thu Apr 17 20:03:49 2008 +0000 @@ -22,8 +22,6 @@ extern GtkRadioActionEntry menu_view_dir_radio_entries[2]; -void vd_destroy(ViewDir *vd); - ViewDir *vd_new(DirViewType type, const gchar *path); void vd_set_select_func(ViewDir *vdl, void (*func)(ViewDir *vdl, const gchar *path, gpointer data), gpointer data); @@ -51,6 +49,8 @@ void vd_color_cb(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell, GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data); gint vd_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data); +gint vd_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data); +gint vd_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data); #endif
--- a/src/view_dir_list.c Thu Apr 17 19:57:41 2008 +0000 +++ b/src/view_dir_list.c Thu Apr 17 20:03:49 2008 +0000 @@ -284,7 +284,7 @@ g_free(path); } -static gint vdlist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) +gint vdlist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { ViewDir *vd = data; GtkTreePath *tpath; @@ -317,7 +317,7 @@ return TRUE; } -static gint vdlist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +gint vdlist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { ViewDir *vd = data; GtkTreePath *tpath; @@ -349,7 +349,7 @@ return TRUE; } -static void vdlist_destroy_cb(GtkWidget *widget, gpointer data) +void vdlist_destroy_cb(GtkWidget *widget, gpointer data) { ViewDir *vd = data; @@ -368,7 +368,6 @@ vd->info = g_new0(ViewDirInfoList, 1); vd->type = DIRVIEW_LIST; - vd->widget_destroy_cb = vdlist_destroy_cb; VDLIST_INFO(vd, list) = NULL; @@ -379,7 +378,6 @@ gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(vd->view), FALSE); gtk_tree_view_set_enable_search(GTK_TREE_VIEW(vd->view), FALSE); g_signal_connect(G_OBJECT(vd->view), "row_activated", - G_CALLBACK(vd_activate_cb), vd); selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vd->view)); @@ -401,14 +399,14 @@ gtk_tree_view_append_column(GTK_TREE_VIEW(vd->view), column); g_signal_connect(G_OBJECT(vd->view), "key_press_event", - G_CALLBACK(vdlist_press_key_cb), vd); + G_CALLBACK(vd_press_key_cb), vd); gtk_container_add(GTK_CONTAINER(vd->widget), vd->view); gtk_widget_show(vd->view); vd_dnd_init(vd); g_signal_connect(G_OBJECT(vd->view), "button_press_event", - G_CALLBACK(vdlist_press_cb), vd); + G_CALLBACK(vd_press_cb), vd); g_signal_connect(G_OBJECT(vd->view), "button_release_event", G_CALLBACK(vd_release_cb), vd);
--- a/src/view_dir_list.h Thu Apr 17 19:57:41 2008 +0000 +++ b/src/view_dir_list.h Thu Apr 17 20:03:49 2008 +0000 @@ -26,6 +26,10 @@ void vdlist_rename_by_row(ViewDir *vd, FileData *fd); FileData *vdlist_row_by_path(ViewDir *vd, const gchar *path, gint *row); +gint vdlist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data); +gint vdlist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data); + +void vdlist_destroy_cb(GtkWidget *widget, gpointer data); #endif
--- a/src/view_dir_tree.c Thu Apr 17 19:57:41 2008 +0000 +++ b/src/view_dir_tree.c Thu Apr 17 20:03:49 2008 +0000 @@ -738,7 +738,7 @@ *---------------------------------------------------------------------------- */ -static gint vdtree_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) +gint vdtree_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) { ViewDir *vd = data; GtkTreePath *tpath; @@ -809,7 +809,7 @@ return FALSE; } -static gint vdtree_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) +gint vdtree_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data) { ViewDir *vd = data; GtkTreePath *tpath; @@ -918,7 +918,7 @@ return FALSE; } -static void vdtree_destroy_cb(GtkWidget *widget, gpointer data) +void vdtree_destroy_cb(GtkWidget *widget, gpointer data) { ViewDir *vd = data; GtkTreeModel *store; @@ -940,7 +940,6 @@ vd->info = g_new0(ViewDirInfoTree, 1); vd->type = DIRVIEW_TREE; - vd->widget_destroy_cb = vdtree_destroy_cb; VDTREE_INFO(vd, drop_expand_id) = -1; @@ -987,7 +986,7 @@ gtk_tree_view_append_column(GTK_TREE_VIEW(vd->view), column); g_signal_connect(G_OBJECT(vd->view), "key_press_event", - G_CALLBACK(vdtree_press_key_cb), vd); + G_CALLBACK(vd_press_key_cb), vd); gtk_container_add(GTK_CONTAINER(vd->widget), vd->view); gtk_widget_show(vd->view); @@ -999,7 +998,7 @@ vd_dnd_init(vd); g_signal_connect(G_OBJECT(vd->view), "button_press_event", - G_CALLBACK(vdtree_press_cb), vd); + G_CALLBACK(vd_press_cb), vd); g_signal_connect(G_OBJECT(vd->view), "button_release_event", G_CALLBACK(vd_release_cb), vd);
--- a/src/view_dir_tree.h Thu Apr 17 19:57:41 2008 +0000 +++ b/src/view_dir_tree.h Thu Apr 17 20:03:49 2008 +0000 @@ -36,5 +36,10 @@ void vdtree_dnd_drop_expand_cancel(ViewDir *vd); void vdtree_dnd_drop_expand(ViewDir *vd); +gint vdtree_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data); +gint vdtree_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data); + +void vdtree_destroy_cb(GtkWidget *widget, gpointer data); + #endif