Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: [Ethereal-dev] use g_hook mechanism in file.c, instead of directly calling menu,

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ulf Lamping <ulf.lamping@xxxxxx>
Date: Sat, 05 Feb 2005 14:36:00 +0100
Hi!

While looking at the file.c, I repeatedly ask myself two question:

1.) why do we have separate code for Ethereal and Tethereal for file and capturing things?
2.) why is file.c reponsible to update the menus, statusbar and such?

Well, first of all I would think that 2.) is the main reason for 1.) as Tethereal doesn't have menus and such.

So let's look at 2.)

I would think, it's not the responsibility of file.c to update menus and all that (it shouldn't even have to know about it). I would like to provide a (or some?) hooks in the file.c code, so the user of it could add a hook and will be called when a specific point is reached.

Example: Currently, if a capture file is closed, cf_close will call a bunch of set_menus_for_... functions and a lot more of that kind. Well, that's ugly in my eyes.

It should simply call a hook to spread a "CAPTURE FILE CLOSED" message (or alike), and the user is responsible to do whatever has to be done.

This way, we could come to a file component, which can be used by different users like Ethereal, Tethereal, ... without modifications to the component itself and that way we could eliminate the current "interesting" duplication of file and capture code in tethereal.

To implement this, we could use the GLib's g_hook mechanism.

What do other's think?

Regards, ULFL