Mercurial > geeqie.yaz
comparison src/metadata.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 | e70bbc97acc5 |
children | 286ed7c6cae6 |
comparison
equal
deleted
inserted
replaced
1522:d7206703d90f | 1523:24a12aa0cb54 |
---|---|
45 * write queue | 45 * write queue |
46 *------------------------------------------------------------------- | 46 *------------------------------------------------------------------- |
47 */ | 47 */ |
48 | 48 |
49 static GList *metadata_write_queue = NULL; | 49 static GList *metadata_write_queue = NULL; |
50 static gint metadata_write_idle_id = -1; | 50 static guint metadata_write_idle_id = 0; /* event source id */ |
51 | 51 |
52 static void metadata_write_queue_add(FileData *fd) | 52 static void metadata_write_queue_add(FileData *fd) |
53 { | 53 { |
54 if (!g_list_find(metadata_write_queue, fd)) | 54 if (!g_list_find(metadata_write_queue, fd)) |
55 { | 55 { |
57 file_data_ref(fd); | 57 file_data_ref(fd); |
58 | 58 |
59 layout_status_update_write_all(); | 59 layout_status_update_write_all(); |
60 } | 60 } |
61 | 61 |
62 if (metadata_write_idle_id != -1) | 62 if (metadata_write_idle_id) |
63 { | 63 { |
64 g_source_remove(metadata_write_idle_id); | 64 g_source_remove(metadata_write_idle_id); |
65 metadata_write_idle_id = -1; | 65 metadata_write_idle_id = 0; |
66 } | 66 } |
67 | 67 |
68 if (options->metadata.confirm_after_timeout) | 68 if (options->metadata.confirm_after_timeout) |
69 { | 69 { |
70 metadata_write_idle_id = g_timeout_add(options->metadata.confirm_timeout * 1000, metadata_write_queue_idle_cb, NULL); | 70 metadata_write_idle_id = g_timeout_add(options->metadata.confirm_timeout * 1000, metadata_write_queue_idle_cb, NULL); |
128 } | 128 } |
129 | 129 |
130 static gboolean metadata_write_queue_idle_cb(gpointer data) | 130 static gboolean metadata_write_queue_idle_cb(gpointer data) |
131 { | 131 { |
132 metadata_write_queue_confirm(NULL, NULL); | 132 metadata_write_queue_confirm(NULL, NULL); |
133 metadata_write_idle_id = -1; | 133 metadata_write_idle_id = 0; |
134 return FALSE; | 134 return FALSE; |
135 } | 135 } |
136 | 136 |
137 gboolean metadata_write_perform(FileData *fd) | 137 gboolean metadata_write_perform(FileData *fd) |
138 { | 138 { |