Ethereal-dev: Re: [Ethereal-dev] usability extensions: "recent" patch (now with attachment ;-)

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

From: "Ronnie Sahlberg" <sahlberg@xxxxxxxxxxxxxxxx>
Date: Sun, 8 Sep 2002 00:00:16 +1000
Hi,

Can you update the patch so it applies to current CVS.
Also, can you enhance the patch so that it also updates gtk2?

>-setting of maximum size of recently used lists by user preferences
(currently fixed to 10)
I dont know if this one is really that vital.

>-put repeatedly used submenu item always again at latest place, to get the
right history order
Just move it to the top everytime anything is accessed on the recent list.
That should
be good enough.
I dont think it has to be too advanced like keeping track on how many times
it has been
used and do the sorting based on that.

>-keyboard shortcut for the recent capture files submenu
I dont use shortcuts too much myself so I dont know how vital this is.


Hmmm.
You call add_menu_recent_capture_file() from file.c .
I dont think I like this very much.
Would it be possible to move this call to somewhere inside gtk[2]/main.c
instead?
I think it would be way better to piggy back onto the file_open dialog box.


The two filenames
RECENT_KEY_CAPTURE_FILE  and RECENT_KEY_DISPLAY_FILTER both contains
two dots in the filename. Could you change the names to something with just
one dot or no dot at all?


There is an awful lot of code to implement this feature in the patch.
Could you look at making it smaller/simpler?
It feels like it it would become much smaller and simpler if you redid the
implementation again.

Perhaps as simple as:
* read_recent_files()  which reads the recent file and populates the
in-memory list and all menuitems.  Let the function start by destroying the
existing in memory list and all existing menu items. Let the function ignore
any duplicates when reading this file (so you dont have to worry about
duplicates elsewhere , making life simpler)
* write_recent_files() which just opens the file and overwrites it with the
10 first entries in the
in-memory list. When it has written these 10 entries, just do a
read_recent_files() before returning which makes the in-memory list and the
menu reflect the newly written data automagically.
* new_recent_file() which just adds a file to the start of the in-memory
list (without redards or checks of if the file already exists in the list or
not, we dont worry about duplicates) and then just calls write_recent_file()
before it returns.  This updates the file and also automagically removes any
duplicates.

Then you should only need to do read_recent_files() when ethereal starts and
just do new_recent_file() whenever a user clicks the OK button on the file
dialog nothing more.
Very simple and very few lines to implement.





----- Original Message -----
From: "Ulf Lamping"
Sent: Thursday, September 05, 2002 10:43 PM
Subject: [Ethereal-dev] usability extensions: "recent" patch (now with
attachment ;-)


Hi List!

Please find attached a "medium sized" patch, which will introduce a "recent"
function for the capture files,
and the display filters (current "drop-up" list at bottom of the window).

1. It will add a submenu item under File, which shows a list of recently
used capture files.
2. The display filters of the "pop-up" list are kept from the last run of
Ethereal.
3. It will put a new file called "recent" in the user's preference directory
(the dir, where preferences and others are also stored).


What I've done:
-Changed prefs.c and prefs-int.h to be able to use read_prefs() function in
a more general manner
-added recently used dfilter functionality in main.c and main.h
-added recently used capture file functionality in menu.c
-added file handling for the recent file in main.c (maybe should be moved to
a new "recent.c" file?)
-added calls to the recent functions in file.c and main.c

Things still to be done:
-setting of maximum size of recently used lists by user preferences
(currently fixed to 10)
-put repeatedly used submenu item always again at latest place, to get the
right history order
-keyboard shortcut for the recent capture files submenu


I'm really not sure, if I put the implementation in the right places in the
source code,
so please send suggestions about that.

This patch could also effect the gkt2 implementation (at least the change in
file.c).

Regards ULFL
____________________________________________________________________________
__
WEB.DE Club - jetzt testen für 1 Euro! Nutzen Sie Ihre Chance
unter https://digitaledienste.web.de/Club/?mc=021105