changeset 792:99ea3d973ad3

added NotifyType
author nadvornik
date Fri, 06 Jun 2008 22:11:03 +0000
parents 6d65167764ea
children baade53888be
files src/filedata.c src/filedata.h src/typedefs.h src/utilops.c src/view_file_icon.c src/view_file_list.c
diffstat 6 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/filedata.c	Fri Jun 06 21:50:09 2008 +0000
+++ b/src/filedata.c	Fri Jun 06 22:11:03 2008 +0000
@@ -143,7 +143,7 @@
 	fd->version++;
 	if (fd->parent) fd->parent->version++;
 
-	file_data_send_notification(fd); /* FIXME there are probably situations when we don't want to call this  */
+	file_data_send_notification(fd, NOTIFY_TYPE_REREAD); /* FIXME there are probably situations when we don't want to call this  */
 }
 
 static void file_data_set_collate_keys(FileData *fd)
@@ -1488,14 +1488,14 @@
 }
 
 
-void file_data_send_notification(FileData *fd)
+void file_data_send_notification(FileData *fd, NotifyType type)
 {
 	GList *work = notify_func_list;
 	while(work)
 		{
 		NotifyData *nd = (NotifyData *)work->data;
 		DEBUG_1("Notify func calling: %p %s", nd, fd->path);
-		nd->func(fd, nd->data);
+		nd->func(fd, type, nd->data);
 		work = work->next;
 		}
 }
--- a/src/filedata.h	Fri Jun 06 21:50:09 2008 +0000
+++ b/src/filedata.h	Fri Jun 06 22:11:03 2008 +0000
@@ -77,10 +77,10 @@
 void file_data_sc_free_ci(FileData *fd);
 void file_data_sc_free_ci_list(GList *fd_list);
 
-typedef void (*FileDataNotifyFunc)(FileData *fd, gpointer data);
+typedef void (*FileDataNotifyFunc)(FileData *fd, NotifyType type, gpointer data);
 gint file_data_register_notify_func(FileDataNotifyFunc func, gpointer data, NotifyPriority priority);
 gint file_data_unregister_notify_func(FileDataNotifyFunc func, gpointer data);
-void file_data_send_notification(FileData *fd);
+void file_data_send_notification(FileData *fd, NotifyType type);
 
 gint file_data_register_real_time_monitor(FileData *fd);
 gint file_data_unregister_real_time_monitor(FileData *fd);
--- a/src/typedefs.h	Fri Jun 06 21:50:09 2008 +0000
+++ b/src/typedefs.h	Fri Jun 06 22:11:03 2008 +0000
@@ -137,6 +137,11 @@
 	NOTIFY_PRIORITY_LOW
 } NotifyPriority;
 	
+typedef enum {
+	NOTIFY_TYPE_INTERNAL = 0, /* changed internal data only, like marks */
+	NOTIFY_TYPE_REREAD,       /* changed file size, date, etc., file name remains unchanged */
+	NOTIFY_TYPE_CHANGE        /* generic change described by fd->change */
+} NotifyType;
 
 
 #define MAX_SPLIT_IMAGES 4
--- a/src/utilops.c	Fri Jun 06 21:50:09 2008 +0000
+++ b/src/utilops.c	Fri Jun 06 22:11:03 2008 +0000
@@ -279,7 +279,7 @@
 
 
 	/* this is the new way: */
-	file_data_send_notification(fd);
+	file_data_send_notification(fd, NOTIFY_TYPE_CHANGE);
 }
 
 void file_data_sc_notify_ci(FileData *fd)
--- a/src/view_file_icon.c	Fri Jun 06 21:50:09 2008 +0000
+++ b/src/view_file_icon.c	Fri Jun 06 22:11:03 2008 +0000
@@ -65,7 +65,7 @@
 	FileData *fd;
 };
 
-static void vficon_notify_cb(FileData *fd, gpointer data);
+static void vficon_notify_cb(FileData *fd, NotifyType type, gpointer data);
 static gint vficon_index_by_id(ViewFile *vf, IconData *in_id);
 
 static IconData *vficon_icon_data(ViewFile *vf, FileData *fd)
@@ -2557,7 +2557,7 @@
 	return ret;
 }
 
-static void vficon_notify_cb(FileData *fd, gpointer data)
+static void vficon_notify_cb(FileData *fd, NotifyType type, gpointer data)
 {
 	ViewFile *vf = data;
 
--- a/src/view_file_list.c	Fri Jun 06 21:50:09 2008 +0000
+++ b/src/view_file_list.c	Fri Jun 06 22:11:03 2008 +0000
@@ -50,7 +50,7 @@
 static gint vflist_row_is_selected(ViewFile *vf, FileData *fd);
 static gint vflist_row_rename_cb(TreeEditData *td, const gchar *old, const gchar *new, gpointer data);
 static void vflist_populate_view(ViewFile *vf);
-static void vflist_notify_cb(FileData *fd, gpointer data);
+static void vflist_notify_cb(FileData *fd, NotifyType type, gpointer data);
 
 
 /*
@@ -1875,7 +1875,7 @@
  *-----------------------------------------------------------------------------
  */
 
-static void vflist_notify_cb(FileData *fd, gpointer data)
+static void vflist_notify_cb(FileData *fd, NotifyType type, gpointer data)
 {
 	ViewFile *vf = data;
 	gboolean refresh;