|
0 |
cdebconf plugins (custom widgets)
|
|
1 |
---------------------------------
|
|
2 |
|
|
3 |
[This is a draft, and is not implemented yet.]
|
|
4 |
|
|
5 |
cdebconf has the facility to load custom implementations for template types
|
|
6 |
at run-time. This may be used to provide more sophisticated user interfaces
|
|
7 |
than can be achieved using the standard generic template types. Naturally,
|
|
8 |
these implementations are per-frontend.
|
|
9 |
|
|
10 |
The CAPB command may be used to query the existence of a given plugin for
|
|
11 |
the current frontend. If the type "foo" is supported by a plugin, CAPB will
|
|
12 |
return the capability "plugin-foo".
|
|
13 |
|
|
14 |
Plugins are dynamically-loaded libraries. The library must be in the
|
|
15 |
following location:
|
|
16 |
|
|
17 |
<frontend_path>/<frontend>/plugin-<type>.so
|
|
18 |
|
|
19 |
(The initial "plugin-" is to allow for more convenient testing within the
|
|
20 |
cdebconf source tree.)
|
|
21 |
|
|
22 |
In the default cdebconf.conf, <frontend_path> is /usr/lib/cdebconf/frontend.
|
|
23 |
Thus, an implementation of the "detect-keyboard" type for the newt frontend
|
|
24 |
would be stored in:
|
|
25 |
|
|
26 |
/usr/lib/cdebconf/frontend/newt/plugin-detect-keyboard.so
|
|
27 |
|
|
28 |
The library must provide a function with the following name:
|
|
29 |
|
|
30 |
<frontend>_handler_<type>
|
|
31 |
|
|
32 |
Any hyphens in <type> here are substituted with underscores, so:
|
|
33 |
|
|
34 |
newt_handler_detect_keyboard
|
|
35 |
|
|
36 |
The required prototype for this function depends on the frontend. For newt
|
|
37 |
and text, it is (again with hyphens in <type> substituted with underscores):
|
|
38 |
|
|
39 |
int <frontend>_handler_<type>(struct frontend *obj, struct question *q)
|
|
40 |
|
|
41 |
For gtk, it is:
|
|
42 |
|
|
43 |
int <frontend>_handler_<type>(struct frontend *obj, struct question *q, GtkWidget *questionbox);
|
|
44 |
|
|
45 |
The handler should return DC_OK (defined in common.h) if all went well,
|
|
46 |
DC_GOBACK if the user wants to back up to the previous question, or DC_NOTOK
|
|
47 |
if an error occurred.
|