aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/file_dlg.c
AgeCommit message (Collapse)AuthorFilesLines
2002-09-09From Graeme Hewson:Guy Harris1-6/+30
Currently Ethereal sets and uses a default directory for reading and writing, but only in some places. This set of patches extends the setting of the default directory to the -w option as well as the -r option, and causes all file dialogs to use and set the default consistently. (I haven't changed the Preferences/Printing/File dialog, though, as that's a special case.) There's also a fix for a bug where Ethereal was issuing the message "Ring buffer requested, but capture isn't being saved to a permanent file" even though a file was specified with -w. There also appear to be some other cleanups in his patch. svn path=/trunk/; revision=6238
2002-09-05Include cleanups in gtk and gtk2:Jörg Mayer1-12/+2
Remove unneded includes Add include wrappers where missing svn path=/trunk/; revision=6191
2002-08-28Removed trailing whitespaces from .h and .c files using theJörg Mayer1-10/+10
winapi_cleanup tool written by Patrik Stridvall for the wine project. svn path=/trunk/; revision=6117
2002-03-05From Joerg Mayer: use _U_ to flag unused arguments.Guy Harris1-11/+11
svn path=/trunk/; revision=4878
2002-01-21Include files from the "epan" directory and subdirectories thereof withGuy Harris1-2/+2
"epan/..." pathnames, so as to avoid collisions with header files in any of the directories in which we look (e.g., "proto.h", as some other package has its own "proto.h" file which it installs in the top-level include directory). Don't add "-I" flags to search "epan", as that's no longer necessary (and we want includes of "epan" headers to fail if the "epan/" is left out, so that we don't re-introduce includes lacking "epan/"). svn path=/trunk/; revision=4586
2002-01-13Add a preferences page for the name resolution flags.Guy Harris1-9/+8
Separate the preferences value for those flags and the name resolution code's value into separate variables; this means that the resolution code no longer depends on the preferences code, and may let us eventually have the current setting and the preference setting differ (so that a user can temporarily override the preference setting without causing subsequent saves of the preferences to save the temporary value). Add routines to create various types of widgets for preferences, and to fetch the values for "enumerated" preferences, and use them both in the code to handle hardwired preference pages and table-driven preference pages. svn path=/trunk/; revision=4536
2001-12-06Don't update the "Save As..." dialog box if it doesn't exist.Guy Harris1-7/+22
Update some comments. svn path=/trunk/; revision=4342
2001-12-06Make the "Save only marked frames" button in the "Save As..." dialog boxGuy Harris1-7/+39
sensitive only if there *are* marked frames. svn path=/trunk/; revision=4341
2001-11-09From <a.stockmeier[AT]avm.de>: fix the file dialog box code to useGuy Harris1-2/+2
"g_strdup()", not "strdup()" to copy strings. svn path=/trunk/; revision=4181
2001-10-24Have a routine that takes a file name for a personal configuration fileGuy Harris1-1/+3
and generates the path name; have it, if the file is to be opened for reading on Win32, check whether it exists and, if not, check for it in the old home directory-based configuration directory and, if so, return that path instead, so that files saved with earlier versions of Ethereal will be seen. svn path=/trunk/; revision=4072
2001-09-10The "Save only marked packets" checkbox should change as the file typeGuy Harris1-1/+14
changes, just as the "Save only packets currently being displayed" checkbox should. svn path=/trunk/; revision=3913
2001-08-21On Windows, use the directory in which the binary resides as theGuy Harris1-2/+3
directory in which global data files are stored. If an installed binary is being run, that's the correct directory for them; if a build-tree binary is being run, the "manuf" file will be there, and you can put other data files there as well, if necessary. Do the same with plugins, except that, if there's no "plugins\\{version}" subdirectory of that directory, fall back on the default installation directory, so you at least have a place where you can put plugins for use by build-tree binaries. (Should we, instead, have the Windows build procedure create a subdirectory of the "plugins" source directory, with the plugin version number as its name, and copy the plugins there, so you'd use the build-tree plugin binaries?) Move "test_for_directory()" out of "util.c" and into "epan/filesystem.c", with the other file system access portability wrappers and convenience routines. Fix "util.h" not to declare it - or other routines moved to "epan/filesystem.c" a while ago. svn path=/trunk/; revision=3858
2001-06-05Enable "Match Selected" only if there's a field selected *and* we can doGuy Harris1-4/+3
a "Match Selected" on it - we can't do a "Match Selected" if the field has no value (e.g., FT_NULL) and has a length of 0. If we unselect the current packet, we don't have a protocol tree, so we don't have a currently selected field - clear the "Match Selected" menu item and the display in the status line of information about the currently selected field. Move the low-level statusbar manipulation into "gtk/main.c", in routines whose API doesn't expose anything GTK+-ish. "close_cap_file()" calls one of those routines to clear out the status bar, so it doesn't need to take a pointer to the statusbar widget as an argument. "clear_tree_and_hex_views()" is purely a display-manipulating routine; move it to "gtk/proto_draw.c". Extract from "tree_view_unselect_row_cb()" an "unselect_field()" routine to do all the work that needs to be done if the currently selected protocol tree row is unselected, and call it if the currently selected packet list row is unselected (if it's unselected, there *is* no protocol tree, so no row can be selected), as well as from "tree_view_unselect_row_cb()". Before pushing a new field-description message onto the statusbar, pop the old one off. Get rid of an unused variable (set, but not used). svn path=/trunk/; revision=3513
2001-05-31Support for "-N" flag enabling selected forms of name resolution, fromGuy Harris1-26/+63
Joerg Meyer. Support for saving to the preferences file the settings for all types of name resolution. Do a case-insensitive check for "true" and "false" in Boolean preference settings. svn path=/trunk/; revision=3489
2001-04-15There's no "enable name resolution in captures" preference in Ethereal,Guy Harris1-3/+4
and never was - there's only an Ethereal-wide "enable name resolution" preference. Name it just "name_resolve". Replace all tests of "g_resolving_actif" with tests of "prefs.name_resolv", and replace all code that sets "g_resolving_actif" with code that sets "prefs.name_resolv", so that the setting of "prefs.name_resolv" actually affects whether names are resolved or not. svn path=/trunk/; revision=3300
2001-04-09last_open_dir needs a trailing slash in order for the GTK+Gilbert Ramirez1-24/+7
file-selection dialogue to open the directory and show its contents, otherwise it opens the parent directory and shows *its* contents. svn path=/trunk/; revision=3279
2001-02-01Create a more modular type system for the FT_* types. Put themGilbert Ramirez1-4/+4
into epan/ftypes. Re-write display filter routines using Lemon parser instead of yacc. Besides using a different tool, the new grammar is much simpler, while the display filter engine itself is more powerful and more easily extended. Add dftest executable, to test display filter "bytecode" generation. Add option to "configure" to build dftest or randpkt, both of which are not built by default. Implement Ed Warnicke's ideas about dranges in the new display filter and ftype code. Remove type FT_TEXT_ONLY in favor of FT_NONE, and have protocols registered as FT_PROTOCOL. Thus, FT_NONE is used only for simple labels in the proto tree, while FT_PROTOCOL is used for protocols. This was necessary for being able to make byte slices (ranges) out of protocols, like "frame[0:3]" Win32 Makefile.nmake's will be added tonight. svn path=/trunk/; revision=2967
2001-01-21Give various filter constructing/editing dialog boxes titles to reflectGuy Harris1-2/+6
what they were popped up for. svn path=/trunk/; revision=2923
2001-01-21In the process of destroying a filter editing dialog box, we get aGuy Harris1-3/+7
selection change event on the list of filters. Unfortunately, this can happen after some other widgets in that dialog box have already been destroyed - including some of the widgets that such a selection change event can change. This sometimes happened when "filter_prefs_delete()" hadn't been called, so the mechanism we had been using, with a Boolean datum attached to the dialog box, set in "filter_prefs_delete()" before we actually destroy the dialog box, wasn't sufficient to keep that from happening. Attach to the top-level window data items containing pointers to the widgets changed when a filter is selected from the list, give each of those widgets their own destroy callbacks, clear the pointer attached to the top-level widget when the widget is destroyed, and don't do anything to the widget when a filter is selected from the list if the pointer for that widget is null, as that means the widget's been destroyed and we *can't* do anything to it. Not all filter editing dialogs created on behalf of a "Filter:" button next to a text entry box should, when you click "OK", activate the text entry box; if the text entry box is part of a dialog box with multiple widgets, the user might not have filled in all of the items in that dialog box, so you shouldn't activate it for them. Add a mechanism by which, when creating a filter editing dialog box, you can specify whether the "OK" button should just fill in the text entry box or should fill it in and also activate it. svn path=/trunk/; revision=2922
2001-01-02Add a dialog box for constructing expressions that test a field in theGuy Harris1-2/+2
display tree, based on Jeff Foster's dialog box for selecting fields. Make the dialog box for browsing filters into a dialog box for constructing filters; make the "Apply" button and the "OK" button apply the filter in the text entry box in the dialog, not the currently selected filter (selecting a filter puts it in that text entry box, but the user may edit it afterwards, or may use the aforementioned dialog box to construct a filter not in the list). Get rid of extra declarations of "m_r_font" and "m_b_font" in "proto_draw.c"; they're declared in "gtk/gtkglobals.h", which it includes. svn path=/trunk/; revision=2805
2000-10-19Move the declaration of "g_resolving_actif" from the top-levelGuy Harris1-1/+2
"globals.h" file to "epan/resolv.h", as it's exported by "epan/resolv.c", have files that use "g_resolving_actif" include "resolv.h", and don't have "epan/resolv.c" include "globals.h" so that it doesn't drag in, for example, headers that, in turn, drag in GTK+ headers. svn path=/trunk/; revision=2517
2000-08-21Frames in the packet list can now be marked by the user usingLaurent Deniel1-7/+36
the middle mouse button. The marked packets are displayed in reverse video but this should change in the future (the color should be configurable via the GUI). Then, the marked packets can be saved (via the "Save as" window dialog). Other features will be added in the future (I am waiting for your comments and wishes). svn path=/trunk/; revision=2322
2000-08-11Miscellaneous code cleaningLaurent Deniel1-19/+1
- add <stdarg.h> or <varargs.h> in snprintf.h and remove those inclusions in the other #ifdef NEED_SNPRINTF_H codes - remove the check of multiple inclusions in source (.c) code (there is a bit loss of _cpp_ performance, but I prefer the gain of code reading and maintenance; and nowadays, disk caches and VM are correctly optimized ;-). - protect all (well almost) header files against multiple inclusions - add header (i.e. GPL license) in some include files - reorganize a bit the way header files are included: First: #include <system_include_files> #include <external_package_include_files (e.g. gtk, glib etc.)> Then #include "ethereal_include_files" with the correct HAVE_XXX or NEED_XXX protections. - add some HAVE_XXX checks before including some system header files - add the same HAVE_XXX in wiretap as in ethereal Please forgive me, if I break something (I've only compiled and regression tested on Linux). svn path=/trunk/; revision=2254
2000-07-31Add a routine to check whether a file is a directory or not.Guy Harris1-28/+17
To test whether a file the user selected to be opened from the file selection box is really a directory (so that we can point the file selection box at it, rather than trying to open the directory as a capture file, which wouldn't work), use the routine in question. To make the GTK+ file selection box start out in the last directory from which we opened a file, use "gtk_file_selection_complete()", rather than "chdir()"ing to that directory. Those changes keep us from "chdir()"ing all over the place; that way, if Ethereal dumps core, the core dump shows up in the directory from which it was run, rather than in the directory from which you last opened or into which you last saved a file. svn path=/trunk/; revision=2190
2000-07-20Use ESD_TYPE_CRIT for most errors (the model used by various GUIs seemsGuy Harris1-2/+2
to use "warning" dialog boxes only to warn the user "if you do that, bad things may happen" *and* to offer them the option either to drive on or quit, so perhaps ESD_TYPE_CRIT should be used for all errors). However, put "Ethereal: Error" rather than "Ethereal: Critical" in the title bar, in the hopes that it'll make it clearer that Something Bad Happened. If the user specifies that captures should be saved to a user-specified file rather than a temporary file, report errors trying to create that file with "file_open_error_message()". Make the "for_writing" argument to "file_open_error_message()" a "gboolean", as it's either TRUE (if the file is being opened for writing) or FALSE (if it's being opened for reading). Report EISDIR as "XXX is a directory (folder), not a file.". svn path=/trunk/; revision=2143
2000-07-03If the user clicks the "Cancel" button in a progress-bar dialog box forGuy Harris1-7/+11
reading a capture file, we should just clean up and return so that Ethereal continues running with no capture file loaded, unless the read is being done as a result of Ethereal being run with the "-r" flag, in which case we still exit (although we may eventually choose to continue running with no capture file loaded even in that case). svn path=/trunk/; revision=2104
2000-06-27Add routines to Wiretap to allow a client of Wiretap to get:Guy Harris1-5/+35
a pointer to the "wtap_pkthdr" structure for an open capture file; a pointer to the "wtap_pseudo_header" union for an open capture file; a pointer to the packet buffer for an open capture file; so that a program using "wtap_read()" in a loop can get at those items. Keep, in a "capture_file" structure, an indicator of whether: no file is open; a file is open, and being read; a file is open, and is being read, but the user tried to quit out of reading the file (e.g., by doing "File/Quit"); a file is open, and has been completely read. Abort if we try to close a capture that's being read if the user hasn't tried to quit out of the read. Have "File/Quit" check if a file is being read; if so, just set the state indicator to "user tried to quit out of it", so that the code reading the file can do what's appropriate to clean up, rather than closing the file out from under that code and causing crashes. Have "read_cap_file()" read the capture file with a loop using "wtap_read()", rather than by using "wtap_loop()"; have it check after reading each packet whether the user tried to abort the read and, if so, close the capture and return an indication that the read was aborted by the user. Otherwise, return an indication of whether the read completely succeeded or failed in the middle (and, if it failed, return the error code through a pointer). Have "continue_tail_cap_file()" read the capture file with a loop using "wtap_read()", rather than by using "wtap_loop()"; have it check after reading each packet whether the user tried to abort the read and, if so, quit the loop, and after the loop finishes (even if it read no packets), return an indication that the read was aborted by the user if that happened. Otherwise, return an indication of whether the read completely succeeded or failed in the middle (and, if it failed, return the error code through a pointer). Have "finish_tail_cap_file()" read the capture file with a loop using "wtap_read()", rather than by using "wtap_loop()"; have it check after reading each packet whether the user tried to abort the read and, if so, quit the loop, and after the loop finishes (even if it read no packets), close the capture and return an indication that the read was aborted by the user if that happened. Otherwise, return an indication of whether the read completely succeeded or failed in the middle (and, if it failed, return the error code through a pointer). Have their callers check whether the read was aborted or not and, if it was, bail out in the appropriate fashion (exit if it's reading a file specified by "-r" on the command line; exit the main loop if it's reading a file specified with File->Open; kill the capture child if it's "continue_tail_cap_file()"; exit the main loop if it's "finish_tail_cap_file()". svn path=/trunk/; revision=2095
2000-06-27Patch from Ben Fowler to rename the global variable "cf" to "cfile", toGuy Harris1-22/+22
make it easier to use grep to find all references to it without getting a lot of false hits and to check, after allocating the memory chunk for "frame_data" structures, that the allocation succeeded. svn path=/trunk/; revision=2092
2000-06-02Add a "Enable name resolution" check box to the File Open dialogue.Gilbert Ramirez1-3/+21
svn path=/trunk/; revision=2035
2000-05-08Catch the ESC key in the file selection dialog boxes popped up forGuy Harris1-1/+12
"File->Open", "File->Save As", and the "File:" buttons in the Capture Preferences and Print dialog boxes, and make it cancel the file selection dialog box. svn path=/trunk/; revision=1921
2000-04-10Have separate global variables for the current "File:Open" andGuy Harris1-26/+48
"File:Save {As}" dialog boxes, if any. svn path=/trunk/; revision=1827
2000-04-01Split "filter_dialog_cb()" into "filter_dialog_cb()", which pops up aGuy Harris1-2/+38
"global" dialog box when "Edit:Filters" is selected, so that the list of filters can be edited, and "filter_browse_cb()", which pops up a dialog box associated with a "Filter:" button and a text entry widget attached to that button, so that a filter can be selected or saved (although it also supports the same editing that the "global" dialog box does). Have "filter_dialog_cb()" connect the window in which the "Filter:" button lives and the filter dialog box, so that: if the window in which the "Filter:" button lives goes away, so does the filter dialog box (as it no longer has a text widget into which it can stuff the selected filter); if the "Filter:" button is clicked when there's already a filter dialog box open, we just reactivate that existing dialog box rather than popping up a new one. Also keep a pointer to the "global" filter dialog box, so that we also arrange that there's only one of them (by reactivating the existing on if "Edit:Filters" is selected when there's already a "global" filter dialog box open). Keep around pointers to the dialog boxes that contain the "Filter:" buttons, so that we can arrange that there be only one of them (that was a side-effect of an earlier attempt at fixing the problems described above, but it's still useful for keeping multiple competing dialog boxes from being open - there's more of that to be done). Make the pointer to the "Open Capture File" dialog box widget static to "file_dlg.c" - nobody outside of "file_dlg.c cares about it. svn path=/trunk/; revision=1774
2000-02-12Move the declarations of the routines in "gtk/file_dlg.c" out ofGuy Harris1-4/+2
"gtk/main.h" and into a new "gtk/file_dlg.h" file. svn path=/trunk/; revision=1620
2000-02-12Make the routines internal to the filter-editing dialog box static.Guy Harris1-4/+2
Declare the one routine exported by "gtk/filter_prefs.c" in "gtk/filter_prefs.h" rather than in "gtk/main.h". Declare "E_FILT_TE_PTR_KEY" there, as well, rather than in "prefs_dlg.h", as the filter-editing dialog box is no longer a preference tab. Don't include "prefs_dlg.h" unless the stuff declared therein is of interest. Fix "gtk/find_dlg.c" to fire up the filter-editing dialog box, not the no-longer-extant preferences tab for filters, if the "Filter:" button is clicked. svn path=/trunk/; revision=1619
2000-01-25Provide a "get_dirname()" routine, that takes a pathname and returnsGuy Harris1-16/+38
either a pointer to the directory part of the pathname (after stomping on the pathname separator with a '\0', so don't use this on pathnames you plan to use afterwards), or NULL if the pathname contains no directory part, and make it handle Win32 pathnames on Win32 systems. Use it to get the containing directory of the currently open file, so that the "chdir()" stuff we do to cause the "File:Open" dialog box to show you files in the directory in which you last looked works on Win32 systems. svn path=/trunk/; revision=1555
2000-01-03Take the "simple_dialog()" stuff out of "ui_util.h" and "gtk/ui_util.c",Guy Harris1-3/+3
and move it to "simple_dialog.h" and "gtk/simple_dialog.c". svn path=/trunk/; revision=1414
2000-01-01A little hack for the really lazy (i.e., me). Allow users to type aGilbert Ramirez1-1/+19
directory name in the filename box in the file open dialoge box. If what you type is a directory, the file selection gui chdir's to that diretory and shows you the files in that directory. svn path=/trunk/; revision=1405
1999-12-10Jerry Talkington's patch to remove the filter stuff fromGuy Harris1-2/+2
"Edit:Preferences" and put it directly under "Edit:Filters", and to add an "Apply" button to it, which makes the currently selected filter the current filter and applies it to the current capture. svn path=/trunk/; revision=1275
1999-12-09Move the GTK+ implementations of various UI utilities out of "util.c"Guy Harris1-3/+3
into "gtk/ui_util.c", and move the declarations of those UI utilities out of "util.h" into "ui_util.h". (The header file is in the top-level directory, rather than the "gtk" directory, because it declares window-system-independent interfaces to routines with window-system-dependent implementations.) Add to "gtk/ui_util.c" a routine to set the window and icon title. Use that routine to make the title of an Ethereal top-level window be {filename} - Ethereal if there's a capture open, and have "{filename}" be "<capture>" if it's a temporary capture file. svn path=/trunk/; revision=1255
1999-12-06Add support for saving files in a format other than the one they're inGuy Harris1-15/+129
and other than "libpcap", now that Wiretap can write files other than "libpcap". svn path=/trunk/; revision=1225
1999-11-30Allow the user to save either all of the current capture, or only theGuy Harris1-62/+73
packets that are currently being displayed from that capture. Centralize the code to control whether "File:Save" and "File:Save As" are enabled (and *always* have "File:Save As" enabled if you have a capture; "File:Save" is enabled only if you have a live capture you've not yet saved, although it does the same thing as "File:Save As"). Have the "save_file" member of a "capture_file" structure represent *only* the file currently being *written* to by a capture, and, if there is no capture currently in progress, have it be NULL; the name of the file currently being *displayed" is in the "filename" member, and an "is_tempfile" member indicates whether it's a temporary file for a live capture or not. Have "close_cap_file()" delete the current capture file if it's a temporary capture file that hasn't been saved (in its entirety - saving selected frames doesn't count). Do the same (if there *is* a current capture file) when exiting. The "Ready to load or capture" message is the only statusbar message in the "main" context; "close_cap_file()" should never pop it, it should only pop whatever message exists in the "file" context, and thus has no need to take, as an argument, the context for the message it should pop. Update the man page to reflect the new behavior of "File:Save" and "File:Save As", and to reflect recent changes to "Display:Match Selected". svn path=/trunk/; revision=1170
1999-10-20Move GTK-related stuff out of globals.h and put it in gtk/gtkglobals.hGilbert Ramirez1-1/+4
svn path=/trunk/; revision=896
1999-10-12Have "dfilter_compile()" return 0 on success and 1 on failure, andGuy Harris1-7/+4
return the pointer to the compiled filter through a pointer argument. Have it check whether the filter is a null filter and, if so, free up the filter and supply a filter pointer, rather than obliging its callers to check whether the filter actually has any code. (Well, they may want to check if the filter is null, so that they don't save a pointer to the filter text, e.g. so that the display filter displays as "none" rather than as a blank string in the summary box.) In the process, fix the check in "gtk/file_dlg.c" that tests whether the read filter compiled successfully. svn path=/trunk/; revision=812
1999-10-11When a new display filter is to be applied, don't set "cf.dfilter" orGuy Harris1-4/+3
"cf.dfcode" if the new filter doesn't compile, because the filter currently in effect will be the one that was last applied - just free up the text of the new filter, and whatever memory was allocated for the new filter code. This means we allocate a new dfilter when a new filter is to be applied, rather than recycling stuff from the old filter, as we want the old filter code to remain around if the new filter doesn't compile. This means that "cf.dfilter" and "cf.dfcode" will be null if there's no filter in effect. svn path=/trunk/; revision=803
1999-10-08Include "main.h", to pull in the external declarations of severalGuy Harris1-1/+5
routines defined in this file. svn path=/trunk/; revision=786
1999-10-02Don't initialize the file name field in the "File/Open" dialog box withGuy Harris1-14/+1
the name of the current save file - we no longer have the "-F" flag, and "-S" automatically reads from the capture file as packets arrive, so there's no need to manually open the capture file. svn path=/trunk/; revision=757
1999-10-02Get rid of "-F" - "-S" works, and has a more convenient UI.Guy Harris1-2/+2
Print a usage message if an illegal command-line flag is seen. Clean up the usage message a bit. svn path=/trunk/; revision=755
1999-10-02Move the declaration of global variables involved with packet captureGuy Harris1-1/+5
from "globals.h" to "capture.h". Only "capture.c" needs to include <pcap.h>; move the include of <pcap.h> from "capture.h" to "capture.c". We no longer need any DLT_ defines (that's handled inside Wiretap); remove the defines of DLT_ from "capture.h". svn path=/trunk/; revision=753
1999-09-23If we forcibly turn off "fork_mode" if the user doesn't enable "UpdateGuy Harris1-3/+3
list of packets in real time" in the "Capture/Start" dialog box, "ethereal -F" won't work - you get your choice of non-forked capture or "-S". Don't have "fork_mode" track "sync_mode"; instead, in those places where we check for "fork_mode", check for "sync_mode" as well. svn path=/trunk/; revision=711
1999-09-09Put RCS IDs (and a copyright notice and GPL notice) in several files,Guy Harris1-0/+25
and fix up the introductory comment on some other files. svn path=/trunk/; revision=640