Mercurial > geeqie
comparison src/filedata.c @ 800:a25b228978a0
various notification improvements
author | nadvornik |
---|---|
date | Sat, 07 Jun 2008 15:08:33 +0000 |
parents | 99ea3d973ad3 |
children | 9b676bb76a2e |
comparison
equal
deleted
inserted
replaced
799:278962ba162a | 800:a25b228978a0 |
---|---|
140 | 140 |
141 void file_data_increment_version(FileData *fd) | 141 void file_data_increment_version(FileData *fd) |
142 { | 142 { |
143 fd->version++; | 143 fd->version++; |
144 if (fd->parent) fd->parent->version++; | 144 if (fd->parent) fd->parent->version++; |
145 | |
146 file_data_send_notification(fd, NOTIFY_TYPE_REREAD); /* FIXME there are probably situations when we don't want to call this */ | |
147 } | 145 } |
148 | 146 |
149 static void file_data_set_collate_keys(FileData *fd) | 147 static void file_data_set_collate_keys(FileData *fd) |
150 { | 148 { |
151 gchar *caseless_name; | 149 gchar *caseless_name; |
231 fd->size = st->st_size; | 229 fd->size = st->st_size; |
232 fd->date = st->st_mtime; | 230 fd->date = st->st_mtime; |
233 if (fd->pixbuf) g_object_unref(fd->pixbuf); | 231 if (fd->pixbuf) g_object_unref(fd->pixbuf); |
234 fd->pixbuf = NULL; | 232 fd->pixbuf = NULL; |
235 file_data_increment_version(fd); | 233 file_data_increment_version(fd); |
234 file_data_send_notification(fd, NOTIFY_TYPE_REREAD); | |
236 } | 235 } |
237 | 236 |
238 work = fd->sidecar_files; | 237 work = fd->sidecar_files; |
239 while (work) | 238 while (work) |
240 { | 239 { |
913 | 912 |
914 return list; | 913 return list; |
915 } | 914 } |
916 | 915 |
917 | 916 |
917 /* | |
918 * marks and orientation | |
919 */ | |
920 | |
921 | |
922 gboolean file_data_get_mark(FileData *fd, gint n) | |
923 { | |
924 return !!(fd->marks & (1 << n)); | |
925 } | |
926 | |
927 void file_data_set_mark(FileData *fd, gint n, gboolean value) | |
928 { | |
929 if (!value == !(fd->marks & (1 << n))) return; | |
930 | |
931 fd->marks = fd->marks ^ (1 << n); | |
932 file_data_increment_version(fd); | |
933 file_data_send_notification(fd, NOTIFY_TYPE_INTERNAL); | |
934 | |
935 } | |
936 | |
937 gint file_data_get_user_orientation(FileData *fd) | |
938 { | |
939 return fd->user_orientation; | |
940 } | |
941 | |
942 void file_data_set_user_orientation(FileData *fd, gint value) | |
943 { | |
944 if (fd->user_orientation == value) return; | |
945 | |
946 fd->user_orientation = value; | |
947 file_data_increment_version(fd); | |
948 file_data_send_notification(fd, NOTIFY_TYPE_INTERNAL); | |
949 } | |
950 | |
951 | |
918 | 952 |
919 /* | 953 /* |
920 * file_data - operates on the given fd | 954 * file_data - operates on the given fd |
921 * file_data_sc - operates on the given fd + sidecars - all fds linked via fd->sidecar_files or fd->parent | 955 * file_data_sc - operates on the given fd + sidecars - all fds linked via fd->sidecar_files or fd->parent |
922 */ | 956 */ |
1405 if (type == FILEDATA_CHANGE_MOVE || type == FILEDATA_CHANGE_RENAME) | 1439 if (type == FILEDATA_CHANGE_MOVE || type == FILEDATA_CHANGE_RENAME) |
1406 { | 1440 { |
1407 file_data_set_path(fd, fd->change->dest); | 1441 file_data_set_path(fd, fd->change->dest); |
1408 } | 1442 } |
1409 file_data_increment_version(fd); | 1443 file_data_increment_version(fd); |
1444 file_data_send_notification(fd, NOTIFY_TYPE_CHANGE); | |
1410 } | 1445 } |
1411 | 1446 |
1412 gint file_data_sc_apply_ci(FileData *fd) | 1447 gint file_data_sc_apply_ci(FileData *fd) |
1413 { | 1448 { |
1414 GList *work; | 1449 GList *work; |
1498 nd->func(fd, type, nd->data); | 1533 nd->func(fd, type, nd->data); |
1499 work = work->next; | 1534 work = work->next; |
1500 } | 1535 } |
1501 } | 1536 } |
1502 | 1537 |
1503 void file_data_sc_send_notification(FileData *fd) | |
1504 { | |
1505 } | |
1506 | |
1507 | |
1508 static GHashTable *file_data_monitor_pool = NULL; | 1538 static GHashTable *file_data_monitor_pool = NULL; |
1509 static gint realtime_monitor_id = -1; | 1539 static gint realtime_monitor_id = -1; |
1510 | 1540 |
1511 static void realtime_monitor_check_cb(gpointer key, gpointer value, gpointer data) | 1541 static void realtime_monitor_check_cb(gpointer key, gpointer value, gpointer data) |
1512 { | 1542 { |
1513 FileData *fd = key; | 1543 FileData *fd = key; |
1514 struct stat st; | 1544 struct stat st; |
1515 | 1545 |
1516 stat_utf8(fd->path, &st); | 1546 if (stat_utf8(fd->path, &st)) |
1517 | 1547 file_data_check_changed_files(fd, &st); |
1518 file_data_check_changed_files(fd, &st); | 1548 else |
1549 file_data_send_notification(fd, NOTIFY_TYPE_REREAD); | |
1519 | 1550 |
1520 DEBUG_1("monitor %s", fd->path); | 1551 DEBUG_1("monitor %s", fd->path); |
1521 } | 1552 } |
1522 | 1553 |
1523 static gboolean realtime_monitor_cb(gpointer data) | 1554 static gboolean realtime_monitor_cb(gpointer data) |