Skip to content

Commit

Permalink
Fix forgotten vd->pf affectation.
Browse files Browse the repository at this point in the history
Cleanup, and reduce code redundancy a bit.
  • Loading branch information
Laurent Monin committed Apr 18, 2008
1 parent 07b43fa commit 5add0a6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 55 deletions.
16 changes: 16 additions & 0 deletions src/view_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,24 @@ ViewDir *vd_new(DirViewType type, const gchar *path)
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;
}
Expand Down
16 changes: 0 additions & 16 deletions src/view_dir_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,6 @@ ViewDir *vdlist_new(ViewDir *vd, const gchar *path)

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);
Expand All @@ -398,19 +396,5 @@ ViewDir *vdlist_new(ViewDir *vd, const gchar *path)

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;
}
43 changes: 4 additions & 39 deletions src/view_dir_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,17 +955,6 @@ ViewDir *vdtree_new(ViewDir *vd, const gchar *path)
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);
Expand All @@ -985,36 +974,12 @@ ViewDir *vdtree_new(ViewDir *vd, const gchar *path)

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


0 comments on commit 5add0a6

Please sign in to comment.