patch for xfce4-panel
Jasper Huijsmans
jasper at moongroup.com
Fri Jan 9 12:14:00 CET 2004
Op vr 09-01-2004, om 05:20 schreef edscott wilson garcia:
> Hey Jasper,
>
> I put the libxfce4_combo module to work in item_dialog.c and it works
> fine. The patch is against the CVS version of this morning (CST), which
> has already changed. But the changes are very small and should not be
> difficult to apply to current CVS. Files modified: configure.ac,
> panel/Makefile.am, panel/item_dialog.c and added file panel/xfcombo.i
>
> Autogen.sh should be run after changes so that configure will check for
> dbh. If dbh is not found, nothing is changed. If dbh is found, then the
> panel will have some extra lines of code to try to load the module. If
> the module fails to load, normal behaviour ensues.
>
> If you have any trouble with the patch, let me know.
>
> regards,
>
> Edscott
>
Thanks edscott.
I am wading through the code now to get a feeling for how it works.
There are some things that I don't really like.
First, the compilation should check for the combo module, not just
libdbh. If there isn't a .pc file now, we have to make one.
Secondy, I don't like *.i files. Why not have a xfcombo.h / xfcombo.c ?
I think I will try to convert it and see how it works.
More importantly, I have trouble finding out the intended API for the
combo module.
Looking at combo.h it seems that most of these things are duplicated in
xfcombo.i. Why?
The header also defines some functions only if __XFFM_COMBO_C__ is
defined. Should these simply be static functions in combo.c or did you
mean something else?
It seems to me there are too many things exposed to the user that should
just be in the module. Let me try to explain the common usage pattern,
as I see it:
* open the module, find module_init function that initializes the module
function pointers.
(hmm, perhaps this can even be done automatically, gmodule automatically
runs an init function if available)
* create an auto-completing combo widget with history (file).
* add callback: when you do completion run this function with this data
(e.g. checkbox settings)
* set this text
* (when closing dialog) get text
* add command to history
This is the only interface I need. Everything else should be hidden from
the user. Did I miss anything?
Thinking about this, it seems to me that the history and the completion
are actually separate functionality. Somthing like this may be possible:
XfceHistory *xfce_history_init (const char *dbh_file);
void xfce_history_add (XfceHistory *history, const char *command);
void xfce_history_remove (XfceHistory *history, const char *command);
void xfce_history_save (XfceHistory *history);
GList *xfce_history_get_list (XfceHistory *history);
GtkWidget *xfce_completion_combo_new (GList *history_list,
void (*completion_callback),
gpointer data);
There should be some API for saving/restoring flags as well, I guess.
BTW, why are the run flags saved in a different dbh file?
Anyway, what do you think about that API? Is that something we want to
work toward?
I like sharing of functionality in the modules, but I think as it is now
the API is not clear enough for people to easily use this.
What do you think? Am I wrong? Do you have different ideas?
Jasper
More information about the Xfce4-dev
mailing list