comparison src/view_file_list.c @ 1523:24a12aa0cb54

Fix up event source ids type: gint -> guint. Functions like g_timeout_add() or g_idle_add() return a guint greater than 0, but in most places it was wrongly stored as int and initialized to -1. This broke assertions matching in g_source_remove() for example since id was always greater than 0 even when timer was not set (-1 was casted to the biggest guint).
author zas_
date Mon, 06 Apr 2009 22:13:54 +0000
parents d352a44545a6
children 4df9f4712d1a
comparison
equal deleted inserted replaced
1522:d7206703d90f 1523:24a12aa0cb54
716 { 716 {
717 ViewFile *vf = data; 717 ViewFile *vf = data;
718 718
719 if (!vf->layout) 719 if (!vf->layout)
720 { 720 {
721 VFLIST(vf)->select_idle_id = -1; 721 VFLIST(vf)->select_idle_id = 0;
722 return FALSE; 722 return FALSE;
723 } 723 }
724 724
725 vf_send_update(vf); 725 vf_send_update(vf);
726 726
728 { 728 {
729 vflist_select_image(vf, VFLIST(vf)->select_fd); 729 vflist_select_image(vf, VFLIST(vf)->select_fd);
730 VFLIST(vf)->select_fd = NULL; 730 VFLIST(vf)->select_fd = NULL;
731 } 731 }
732 732
733 VFLIST(vf)->select_idle_id = -1; 733 VFLIST(vf)->select_idle_id = 0;
734 return FALSE; 734 return FALSE;
735 } 735 }
736 736
737 static void vflist_select_idle_cancel(ViewFile *vf) 737 static void vflist_select_idle_cancel(ViewFile *vf)
738 { 738 {
739 if (VFLIST(vf)->select_idle_id != -1) g_source_remove(VFLIST(vf)->select_idle_id); 739 if (VFLIST(vf)->select_idle_id)
740 VFLIST(vf)->select_idle_id = -1; 740 {
741 g_source_remove(VFLIST(vf)->select_idle_id);
742 VFLIST(vf)->select_idle_id = 0;
743 }
741 } 744 }
742 745
743 static gboolean vflist_select_cb(GtkTreeSelection *selection, GtkTreeModel *store, GtkTreePath *tpath, 746 static gboolean vflist_select_cb(GtkTreeSelection *selection, GtkTreeModel *store, GtkTreePath *tpath,
744 gboolean path_currently_selected, gpointer data) 747 gboolean path_currently_selected, gpointer data)
745 { 748 {
755 { 758 {
756 VFLIST(vf)->select_fd = NULL; 759 VFLIST(vf)->select_fd = NULL;
757 } 760 }
758 761
759 if (vf->layout && 762 if (vf->layout &&
760 VFLIST(vf)->select_idle_id == -1) 763 !VFLIST(vf)->select_idle_id)
761 { 764 {
762 VFLIST(vf)->select_idle_id = g_idle_add(vflist_select_idle_cb, vf); 765 VFLIST(vf)->select_idle_id = g_idle_add(vflist_select_idle_cb, vf);
763 } 766 }
764 767
765 return TRUE; 768 return TRUE;
1971 gint i; 1974 gint i;
1972 gint column; 1975 gint column;
1973 1976
1974 vf->info = g_new0(ViewFileInfoList, 1); 1977 vf->info = g_new0(ViewFileInfoList, 1);
1975 1978
1976 VFLIST(vf)->select_idle_id = -1;
1977
1978 flist_types[FILE_COLUMN_POINTER] = G_TYPE_POINTER; 1979 flist_types[FILE_COLUMN_POINTER] = G_TYPE_POINTER;
1979 flist_types[FILE_COLUMN_VERSION] = G_TYPE_INT; 1980 flist_types[FILE_COLUMN_VERSION] = G_TYPE_INT;
1980 flist_types[FILE_COLUMN_THUMB] = GDK_TYPE_PIXBUF; 1981 flist_types[FILE_COLUMN_THUMB] = GDK_TYPE_PIXBUF;
1981 flist_types[FILE_COLUMN_NAME] = G_TYPE_STRING; 1982 flist_types[FILE_COLUMN_NAME] = G_TYPE_STRING;
1982 flist_types[FILE_COLUMN_MULTILINE] = G_TYPE_STRING; 1983 flist_types[FILE_COLUMN_MULTILINE] = G_TYPE_STRING;