aboutsummaryrefslogtreecommitdiffstats
path: root/file.h
diff options
context:
space:
mode:
authorUlf Lamping <ulf.lamping@web.de>2005-02-07 00:54:46 +0000
committerUlf Lamping <ulf.lamping@web.de>2005-02-07 00:54:46 +0000
commit1c6b2cf0e350951dc9b0b4a6e783db33ad24e480 (patch)
tree5e047e9ae04cd327b2be4652d850490555991aab /file.h
parent7be4ff2a9278d862ebd16e40fe850eef9e540de5 (diff)
Instead of calling each single thing when doing/finish a file operation, file.c shouldn't call all the GUI related functions itself, instead throwing some kind of Events to it's caller(s).
I've implemented a very simple callback mechanism which provides exactly this. I've tried GHook from GLib before, but this doesn't seem to be the right thing, as it's too inflexible for the purpose here. So I've implemented a callback function in main.c which receives all "events" and spreads them to menu, statusbar and itself. I would see this implementation as a prototype which may need improvements. Please comment the changes. svn path=/trunk/; revision=13330
Diffstat (limited to 'file.h')
-rw-r--r--file.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/file.h b/file.h
index ee47fee173..a1f7a97069 100644
--- a/file.h
+++ b/file.h
@@ -55,6 +55,29 @@ typedef enum {
CF_PRINT_WRITE_ERROR /**< print operation failed while writing to the printer */
} cf_print_status_t;
+typedef enum {
+ cf_cb_file_closed,
+ cf_cb_file_read_start,
+ cf_cb_file_read_finished,
+ cf_cb_live_capture_started,
+ cf_cb_live_capture_finished,
+ cf_cb_packet_selected,
+ cf_cb_packet_unselected,
+ cf_cb_field_unselected,
+ cf_cb_file_safe_started,
+ cf_cb_file_safe_finished,
+ cf_cb_file_safe_reload_finished,
+ cf_cb_file_safe_failed
+} cf_cbs;
+
+typedef void (*cf_callback_t) (gint event, gpointer data, gpointer user_data);
+
+extern void
+cf_callback_add(cf_callback_t func, gpointer user_data);
+
+extern void
+cf_callback_remove(cf_callback_t func);
+
/**
* Open a capture file.
*