"Fossies" - the Fresh Open Source Software Archive 
As a special service "Fossies" has tried to format the requested text file into HTML format (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
1 NetBiff supports pluggable front-ends (decided upon at runtime from the
2 possible list). Right now the selection code is pretty lousy. It currently
3 uses the GTK interface if it has been compiled in and if the DISPLAY variable
4 is set. If not, it uses the text interface. This should probably be
5 extended to support N interfaces using command line arguments or a
6 configuration file.
7
8 Currently an interface needs to support an event loop which provides timers
9 and file descriptor events (this is simple to do from scratch, but most GUI
10 event loops support it). It also needs to provide the following callable C
11 functions (any interface using non-C language bindings will probably need
12 to provide a simple C wrapper):
13
14 void flagup(const Connection *) -- this is called when the "image" action is
15 specified and a folder is biffed
16
17 void flagdown(const Connection *) -- like flagup, but not
18
19 void init(int *, char **) -- this function is guaranteed to be called before
20 any other. It should prepare any data structures, etc, for use in the
21 other functions. The arguments are a pointer to argc and argv.
22
23 int display_message(char *, va_list) -- displays a message to the user. The
24 fmt and va_list follow the conventions of the printf() family.
25 Returns 0 on success, -1 on error.
26
27 void event_loop() -- enter the event loop for the interface
28
29 void beep() -- cause a beep on the user's terminal (triggered by the "beep"
30 action)
31
32 void add_fd(const Connection *, int) -- add the connection to the event loop
33 using a specified type (either GUI_FD_READ or GUI_FD_WRITE). On the
34 specified event, either proto_do_conn_input() or
35 proto_do_conn_output() should be called (as appropriate by the type)
36 with the specified connection as an argument.
37
38 void delete_fd(const Connection *, int) -- remove a connection from the event
39 loop for the specified type (in other words, no longer respond on
40 that event).
41
42 char *request_data(const char *, int) -- request a piece of data from the
43 user; the function should return a NUL-terminated string allocated
44 from the heap containing the user's response. The second argument
45 indicates whether or not the item should be "hidden" on the screen
46 (i.e., it is a password).
47
48 void register_connections() -- this function is called once before the main
49 loop starts; at this point all connections have been added and the
50 interface may do any setup related to them
51
52 void schedule_retry(time_t) -- a connection has indicated that it would like
53 proto_do_retries() to be called at that time.
54
55 These should all be packaged as function pointers into a GUI object and some
56 method of selection should be provided in gui_init().