comparison src/filedata.c @ 1432:cf4029d10d38

improved notification system
author nadvornik
date Sat, 14 Mar 2009 17:21:35 +0000
parents 80462be81410
children 2441a90c4bcf
comparison
equal deleted inserted replaced
1431:7e180091e0b7 1432:cf4029d10d38
241 fd->date = st->st_mtime; 241 fd->date = st->st_mtime;
242 fd->mode = st->st_mode; 242 fd->mode = st->st_mode;
243 if (fd->thumb_pixbuf) g_object_unref(fd->thumb_pixbuf); 243 if (fd->thumb_pixbuf) g_object_unref(fd->thumb_pixbuf);
244 fd->thumb_pixbuf = NULL; 244 fd->thumb_pixbuf = NULL;
245 file_data_increment_version(fd); 245 file_data_increment_version(fd);
246 file_data_send_notification(fd, NOTIFY_TYPE_REREAD); 246 file_data_send_notification(fd, NOTIFY_REREAD);
247 ret = TRUE; 247 ret = TRUE;
248 } 248 }
249 249
250 work = fd->sidecar_files; 250 work = fd->sidecar_files;
251 while (work) 251 while (work)
293 work = work->next; 293 work = work->next;
294 294
295 file_data_disconnect_sidecar_file(fd, sfd); 295 file_data_disconnect_sidecar_file(fd, sfd);
296 } 296 }
297 if (sfd) file_data_check_sidecars(sfd); /* this will group the sidecars back together */ 297 if (sfd) file_data_check_sidecars(sfd); /* this will group the sidecars back together */
298 file_data_send_notification(fd, NOTIFY_TYPE_REREAD); 298 file_data_send_notification(fd, NOTIFY_REREAD);
299 } 299 }
300 else 300 else
301 { 301 {
302 ret |= file_data_check_changed_files_recursive(fd, &st); 302 ret |= file_data_check_changed_files_recursive(fd, &st);
303 } 303 }
599 { 599 {
600 if (fd->parent) 600 if (fd->parent)
601 { 601 {
602 FileData *parent = file_data_ref(fd->parent); 602 FileData *parent = file_data_ref(fd->parent);
603 file_data_disconnect_sidecar_file(parent, fd); 603 file_data_disconnect_sidecar_file(parent, fd);
604 file_data_send_notification(fd, NOTIFY_TYPE_INTERNAL); 604 file_data_send_notification(fd, NOTIFY_GROUPING);
605 file_data_send_notification(parent, NOTIFY_TYPE_INTERNAL); 605 file_data_send_notification(parent, NOTIFY_GROUPING);
606 file_data_unref(parent); 606 file_data_unref(parent);
607 } 607 }
608 else if (fd->sidecar_files) 608 else if (fd->sidecar_files)
609 { 609 {
610 GList *sidecar_files = filelist_copy(fd->sidecar_files); 610 GList *sidecar_files = filelist_copy(fd->sidecar_files);
612 while (work) 612 while (work)
613 { 613 {
614 FileData *sfd = work->data; 614 FileData *sfd = work->data;
615 work = work->next; 615 work = work->next;
616 file_data_disconnect_sidecar_file(fd, sfd); 616 file_data_disconnect_sidecar_file(fd, sfd);
617 file_data_send_notification(sfd, NOTIFY_TYPE_INTERNAL); 617 file_data_send_notification(sfd, NOTIFY_GROUPING);
618 } 618 }
619 file_data_send_notification(fd, NOTIFY_TYPE_INTERNAL); 619 file_data_send_notification(fd, NOTIFY_GROUPING);
620 file_data_check_sidecars((FileData *)sidecar_files->data); /* this will group the sidecars back together */ 620 file_data_check_sidecars((FileData *)sidecar_files->data); /* this will group the sidecars back together */
621 filelist_free(sidecar_files); 621 filelist_free(sidecar_files);
622 } 622 }
623 } 623 }
624 else 624 else
625 { 625 {
626 file_data_check_sidecars(fd); 626 file_data_check_sidecars(fd);
627 file_data_send_notification(fd, NOTIFY_TYPE_INTERNAL); 627 file_data_send_notification(fd, NOTIFY_GROUPING);
628 } 628 }
629 } 629 }
630 630
631 /* compare name without extension */ 631 /* compare name without extension */
632 gint file_data_compare_name_without_ext(FileData *fd1, FileData *fd2) 632 gint file_data_compare_name_without_ext(FileData *fd1, FileData *fd2)
1149 { 1149 {
1150 file_data_ref(fd); 1150 file_data_ref(fd);
1151 } 1151 }
1152 1152
1153 file_data_increment_version(fd); 1153 file_data_increment_version(fd);
1154 file_data_send_notification(fd, NOTIFY_TYPE_INTERNAL); 1154 file_data_send_notification(fd, NOTIFY_MARKS);
1155 } 1155 }
1156 1156
1157 gboolean file_data_filter_marks(FileData *fd, guint filter) 1157 gboolean file_data_filter_marks(FileData *fd, guint filter)
1158 { 1158 {
1159 gint i; 1159 gint i;
1185 1185
1186 static void file_data_notify_mark_func(gpointer key, gpointer value, gpointer user_data) 1186 static void file_data_notify_mark_func(gpointer key, gpointer value, gpointer user_data)
1187 { 1187 {
1188 FileData *fd = value; 1188 FileData *fd = value;
1189 file_data_increment_version(fd); 1189 file_data_increment_version(fd);
1190 file_data_send_notification(fd, NOTIFY_TYPE_INTERNAL); 1190 file_data_send_notification(fd, NOTIFY_MARKS);
1191 } 1191 }
1192 1192
1193 gboolean file_data_register_mark_func(gint n, FileDataGetMarkFunc get_mark_func, FileDataSetMarkFunc set_mark_func, gpointer data, GDestroyNotify notify) 1193 gboolean file_data_register_mark_func(gint n, FileDataGetMarkFunc get_mark_func, FileDataSetMarkFunc set_mark_func, gpointer data, GDestroyNotify notify)
1194 { 1194 {
1195 if (n < 0 || n >= FILEDATA_MARKS_SIZE) return FALSE; 1195 if (n < 0 || n >= FILEDATA_MARKS_SIZE) return FALSE;
1226 { 1226 {
1227 if (fd->user_orientation == value) return; 1227 if (fd->user_orientation == value) return;
1228 1228
1229 fd->user_orientation = value; 1229 fd->user_orientation = value;
1230 file_data_increment_version(fd); 1230 file_data_increment_version(fd);
1231 file_data_send_notification(fd, NOTIFY_TYPE_INTERNAL); 1231 file_data_send_notification(fd, NOTIFY_ORIENTATION);
1232 } 1232 }
1233 1233
1234 1234
1235 /* 1235 /*
1236 * file_data - operates on the given fd 1236 * file_data - operates on the given fd
2211 { 2211 {
2212 file_data_set_path(fd, fd->change->dest); 2212 file_data_set_path(fd, fd->change->dest);
2213 } 2213 }
2214 } 2214 }
2215 file_data_increment_version(fd); 2215 file_data_increment_version(fd);
2216 file_data_send_notification(fd, NOTIFY_TYPE_CHANGE); 2216 file_data_send_notification(fd, NOTIFY_CHANGE);
2217 2217
2218 return TRUE; 2218 return TRUE;
2219 } 2219 }
2220 2220
2221 gboolean file_data_sc_apply_ci(FileData *fd) 2221 gboolean file_data_sc_apply_ci(FileData *fd)