changeset 405:7840ccc95aee

Fix forgotten vd->pf affectation. Cleanup, and reduce code redundancy a bit.
author zas_
date Fri, 18 Apr 2008 16:25:40 +0000
parents d9afd1636ed8
children 8e6f5bbe7843
files src/view_dir.c src/view_dir_list.c src/view_dir_tree.c
diffstat 3 files changed, 20 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/src/view_dir.c	Fri Apr 18 11:01:41 2008 +0000
+++ b/src/view_dir.c	Fri Apr 18 16:25:40 2008 +0000
@@ -83,8 +83,24 @@
 	case DIRVIEW_TREE: vd = vdtree_new(vd, path); break;
 	}
 
+	gtk_container_add(GTK_CONTAINER(vd->widget), vd->view);
+	
+	vd_dnd_init(vd);
+
+	g_signal_connect(G_OBJECT(vd->view), "row_activated",
+			 G_CALLBACK(vd_activate_cb), vd);
 	g_signal_connect(G_OBJECT(vd->widget), "destroy",
 			 G_CALLBACK(vd_destroy_cb), vd);
+	g_signal_connect(G_OBJECT(vd->view), "key_press_event",
+			 G_CALLBACK(vd_press_key_cb), vd);
+	g_signal_connect(G_OBJECT(vd->view), "button_press_event",
+			 G_CALLBACK(vd_press_cb), vd);
+	g_signal_connect(G_OBJECT(vd->view), "button_release_event",
+			 G_CALLBACK(vd_release_cb), vd);
+
+	if (path) vd_set_path(vd, path);
+
+	gtk_widget_show(vd->view);
 
 	return vd;
 }
--- a/src/view_dir_list.c	Fri Apr 18 11:01:41 2008 +0000
+++ b/src/view_dir_list.c	Fri Apr 18 16:25:40 2008 +0000
@@ -377,8 +377,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));
 	gtk_tree_selection_set_mode(selection, GTK_SELECTION_NONE);
@@ -398,19 +396,5 @@
 
 	gtk_tree_view_append_column(GTK_TREE_VIEW(vd->view), column);
 
-	g_signal_connect(G_OBJECT(vd->view), "key_press_event",
-			   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(vd_press_cb), vd);
-	g_signal_connect(G_OBJECT(vd->view), "button_release_event",
-			 G_CALLBACK(vd_release_cb), vd);
-
-	if (path) vdlist_set_path(vd, path);
-
 	return vd;
 }
--- a/src/view_dir_tree.c	Fri Apr 18 11:01:41 2008 +0000
+++ b/src/view_dir_tree.c	Fri Apr 18 16:25:40 2008 +0000
@@ -955,17 +955,6 @@
 	gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(store),
 					     GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, GTK_SORT_ASCENDING);
 
-	g_signal_connect(G_OBJECT(vd->view), "row_activated",
-			 G_CALLBACK(vd_activate_cb), vd);
-	g_signal_connect(G_OBJECT(vd->view), "row_expanded",
-			 G_CALLBACK(vdtree_row_expanded), vd);
-	g_signal_connect(G_OBJECT(vd->view), "row_collapsed",
-			 G_CALLBACK(vdtree_row_collapsed), vd);
-#if 0
-	g_signal_connect(G_OBJECT(store), "row_deleted",
-			 G_CALLBACK(vdtree_row_deleted_cb), vd);
-#endif
-
 	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vd->view));
 	gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
 	gtk_tree_selection_set_select_function(selection, vdtree_select_cb, vd, NULL);
@@ -985,36 +974,12 @@
 
 	gtk_tree_view_append_column(GTK_TREE_VIEW(vd->view), column);
 
-	g_signal_connect(G_OBJECT(vd->view), "key_press_event",
-			 G_CALLBACK(vd_press_key_cb), vd);
-
-	gtk_container_add(GTK_CONTAINER(vd->widget), vd->view);
-	gtk_widget_show(vd->view);
-
-	vd->pf = folder_icons_new();
-
 	vdtree_setup_root(vd);
 
-	vd_dnd_init(vd);
-
-	g_signal_connect(G_OBJECT(vd->view), "button_press_event",
-			 G_CALLBACK(vd_press_cb), vd);
-	g_signal_connect(G_OBJECT(vd->view), "button_release_event",
-			 G_CALLBACK(vd_release_cb), vd);
-
-	vdtree_set_path(vd, path);
+	g_signal_connect(G_OBJECT(vd->view), "row_expanded",
+			 G_CALLBACK(vdtree_row_expanded), vd);
+	g_signal_connect(G_OBJECT(vd->view), "row_collapsed",
+			 G_CALLBACK(vdtree_row_collapsed), vd);
 
 	return vd;
 }
-
-#if 0
-void vdtree_set_click_func(ViewDir *vd,
-			   void (*func)(ViewDir *vd, GdkEventButton *event, FileData *fd, gpointer), gpointer data)
-{
-	if (!td) return;
-	vd->click_func = func;
-	vd->click_data = data;
-}
-#endif
-
-