comparison src/view_dir.c @ 397:a7be56e84870

Merge vd(list|tree)_release_cb() in vd_release_cb(). I made some assumptions here i hope correct.
author zas_
date Thu, 17 Apr 2008 17:35:51 +0000
parents a01535f52b56
children d071a3555011
comparison
equal deleted inserted replaced
396:a01535f52b56 397:a7be56e84870
935 g_object_set(G_OBJECT(cell), 935 g_object_set(G_OBJECT(cell),
936 "cell-background-gdk", vd_color_shifted(vd->view), 936 "cell-background-gdk", vd_color_shifted(vd->view),
937 "cell-background-set", set, NULL); 937 "cell-background-set", set, NULL);
938 } 938 }
939 939
940 gint vd_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
941 {
942 ViewDir *vd = data;
943 GtkTreePath *tpath;
944 GtkTreeIter iter;
945 FileData *fd = NULL;
946
947 vd_color_set(vd, vd->click_fd, FALSE);
948
949 if (bevent->button != 1) return TRUE;
950
951 if ((bevent->x != 0 || bevent->y != 0) &&
952 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), bevent->x, bevent->y,
953 &tpath, NULL, NULL, NULL))
954 {
955 GtkTreeModel *store;
956
957 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
958 gtk_tree_model_get_iter(store, &iter, tpath);
959 switch (vd->type)
960 {
961 case DIRVIEW_LIST:
962 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &fd, -1);
963 break;
964 case DIRVIEW_TREE:
965 {
966 NodeData *nd;
967 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &nd, -1);
968 fd = (nd) ? nd->fd : NULL;
969 };
970 break;
971 }
972
973 gtk_tree_path_free(tpath);
974 }
975
976 if (fd && vd->click_fd == fd)
977 {
978 vdlist_select_row(vd, vd->click_fd);
979 }
980
981 return TRUE;
982 }
983