comparison src/view_file.c @ 783:d6a7fb4b8e7c

replaced directory path with FileData* dir_fd
author nadvornik
date Tue, 03 Jun 2008 19:44:19 +0000
parents 477f48ba28d8
children 16b3a5c8aedc
comparison
equal deleted inserted replaced
782:3f7a0420c293 783:d6a7fb4b8e7c
618 } 618 }
619 619
620 return ret; 620 return ret;
621 } 621 }
622 622
623 gint vf_set_path(ViewFile *vf, const gchar *path) 623 gint vf_set_fd(ViewFile *vf, FileData *dir_fd)
624 { 624 {
625 gint ret = FALSE; 625 gint ret = FALSE;
626 626
627 switch(vf->type) 627 switch(vf->type)
628 { 628 {
629 case FILEVIEW_LIST: ret = vflist_set_path(vf, path); break; 629 case FILEVIEW_LIST: ret = vflist_set_fd(vf, dir_fd); break;
630 case FILEVIEW_ICON: ret = vficon_set_path(vf, path); break; 630 case FILEVIEW_ICON: ret = vficon_set_fd(vf, dir_fd); break;
631 } 631 }
632 632
633 return ret; 633 return ret;
634 } 634 }
635 635
648 g_signal_handlers_disconnect_matched(G_OBJECT(vf->popup), G_SIGNAL_MATCH_DATA, 648 g_signal_handlers_disconnect_matched(G_OBJECT(vf->popup), G_SIGNAL_MATCH_DATA,
649 0, 0, 0, NULL, vf); 649 0, 0, 0, NULL, vf);
650 gtk_widget_destroy(vf->popup); 650 gtk_widget_destroy(vf->popup);
651 } 651 }
652 652
653 g_free(vf->path); 653 file_data_unref(vf->dir_fd);
654 g_free(vf->info); 654 g_free(vf->info);
655 g_free(vf); 655 g_free(vf);
656 } 656 }
657 657
658 ViewFile *vf_new(FileViewType type, const gchar *path) 658 ViewFile *vf_new(FileViewType type, FileData *dir_fd)
659 { 659 {
660 ViewFile *vf; 660 ViewFile *vf;
661 661
662 vf = g_new0(ViewFile, 1); 662 vf = g_new0(ViewFile, 1);
663 vf->type = type; 663 vf->type = type;
664 664
665 vf->info = NULL; 665 vf->info = NULL;
666 vf->path = NULL; 666 vf->dir_fd = NULL;
667 vf->list = NULL; 667 vf->list = NULL;
668 668
669 vf->sort_method = SORT_NAME; 669 vf->sort_method = SORT_NAME;
670 vf->sort_ascend = TRUE; 670 vf->sort_ascend = TRUE;
671 671
684 g_signal_connect(G_OBJECT(vf->widget), "destroy", 684 g_signal_connect(G_OBJECT(vf->widget), "destroy",
685 G_CALLBACK(vf_destroy_cb), vf); 685 G_CALLBACK(vf_destroy_cb), vf);
686 686
687 switch(type) 687 switch(type)
688 { 688 {
689 case FILEVIEW_LIST: vf = vflist_new(vf, path); break; 689 case FILEVIEW_LIST: vf = vflist_new(vf, dir_fd); break;
690 case FILEVIEW_ICON: vf = vficon_new(vf, path); break; 690 case FILEVIEW_ICON: vf = vficon_new(vf, dir_fd); break;
691 } 691 }
692 692
693 vf_dnd_init(vf); 693 vf_dnd_init(vf);
694 694
695 g_signal_connect(G_OBJECT(vf->listview), "key_press_event", 695 g_signal_connect(G_OBJECT(vf->listview), "key_press_event",
700 G_CALLBACK(vf_release_cb), vf); 700 G_CALLBACK(vf_release_cb), vf);
701 701
702 gtk_container_add(GTK_CONTAINER(vf->widget), vf->listview); 702 gtk_container_add(GTK_CONTAINER(vf->widget), vf->listview);
703 gtk_widget_show(vf->listview); 703 gtk_widget_show(vf->listview);
704 704
705 if (path) vf_set_path(vf, path); 705 if (dir_fd) vf_set_fd(vf, dir_fd);
706 706
707 return vf; 707 return vf;
708 } 708 }
709 709
710 void vf_set_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gpointer data), gpointer data) 710 void vf_set_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gpointer data), gpointer data)