Commit Graph

142 Commits

Author SHA1 Message Date
Guy Harris 7453e28dc0 Use the modal version of the bad display filter alert box.
svn path=/trunk/; revision=43078
2012-06-04 19:44:48 +00:00
Guy Harris afa17a95b0 Make the "Export Selected Packets As..." code path more like the "Save
As..." code path.

Extract the code for the "do you want to overwrite this file" and "OK,
you do - are you aware it's {user-immutable, read-only}?" code paths
into a common routine for use by both of those and, potentially, other
save/export/etc. code paths in the future.

For "Save As", allow us to save atop the current capture file, as that's
just what "Save" does if there are unsaved changes, and "safe save"
makes that work.  *Don't* allow that for "Export Selected Packets
As...", however.

The file chooser is run as a modal dialog, so we don't need to worry
about creating more than one of them or about the number of marked
packets etc. being changed out from under us.  Get rid of a bunch of
static variables.

svn path=/trunk/; revision=43060
2012-06-04 10:27:59 +00:00
Guy Harris eb03bb0290 Add some more routines to main.c that handle updates to "auto scroll in
live capture" and colorization, so that the ones in main_menubar.c don't
have to know about anything other than the main menubar.

Move some toolbar routines that should only be used by routines in
main.c into a main_toolbar_private.h header.

svn path=/trunk/; revision=43053
2012-06-04 03:15:05 +00:00
Guy Harris 9c44d87610 Have a main_update_for_unsaved_changes() routine that, if changes are
made to the capture file (adding/removing/editing comments, for now) or
if a capture file with unsaved changes are unsaved, updates the menu
bar, the toolbar, *and* the titlebar, which now has a GNOME-style "*" to
indicate unsaved changes.

Make set_menus_for_capture_file() a private interface between main.c and
main_menubar.c, and have its callers, such as
main_update_for_unsaved_changes(), be responsible for updating the
toolbar as well.

svn path=/trunk/; revision=43051
2012-06-04 02:24:42 +00:00
Guy Harris dbfb305368 g_filename_display_basename() returns a g_mallocated string, so its
callers either need to free it or their callers need to free it or....

This means that cf_get_display_name() must always return a g_mallocated
string and its callers or... must free it.

For some of those callers, create a new set_window_title() routine to do
the work - they're all using the same pattern.

svn path=/trunk/; revision=43047
2012-06-03 22:03:05 +00:00
Guy Harris 742b22dd43 Move routines that handle the main window title bar out of
ui/gtk/gui_utils.c into ui/gtk/main_titlebar.c, and the declaration of
one of them out of ui/ui_util.h into ui/gtk/main_titlebar.h, and rename
them to clarify that they work on the window name and titlebar.

svn path=/trunk/; revision=43041
2012-06-03 18:35:34 +00:00
Anders Broman dbc4b09004 From Evan Huus Convert a bunch more GTK-2 calls to their cross-version ws_ equivalent
svn path=/trunk/; revision=43009
2012-06-02 23:53:04 +00:00
Guy Harris 6014035703 Use GTK+'s GtkMessageDialog for the questions we ask in the process of
saving files, and run it modal (which we're already doing with the
GtkFileChooserDialog); this means less callback-based state machine
stuff, simplifying the code paths a bit.

If we're saving a file before closing it, don't bother reloading it
after saving it.

svn path=/trunk/; revision=42855
2012-05-25 21:25:55 +00:00
Guy Harris c2bb7956c2 "Save As" always saves everything and, when the save is done, makes the
new file the current file, as is the case in most if not all other GUI
applications.

A new "Export Specified Packets" menu option allows you to specify which
packets to write out, with the default being the displayed packets (and
those on which the displayed packets depend for, e.g.  reassembly), and
never makes the resulting file the current file.

The two operations are conceptually distinct.  Lumping them into one
menu item, with the default for "Save As" being "displayed packets only"
and thus making it behave like the latter operation, was causing some
confusion; see, for example, bug 6640.

Make the dialog popped up if you try to "Save As" or "Export Specified
Packets" on top of an existing file ask the "do you want to do this?"
question in the main part of the message, and note in the secondary text
that doing that will overwrite what's in the file; that matches what
TextEdit on OS X and the GNOME text editor say.

svn path=/trunk/; revision=42792
2012-05-22 22:17:57 +00:00
Guy Harris 90c43120ca The GUI's state machine requires that, when reloading a capture after a
save, we post capture file callback events similar to the ones posted
when reading a capture - otherwise, the reload will leave the welcome
screen up.

Rename cf_cb_file_save_reload_finished to cf_cb_file_reload_finished,
add a cf_cb_file_reload_started callback, have them work similarly to
read_finished and read_started except that the reload uses "Reloading"
in the progress bar and status bar.

Clean up some indentation while we're at it.

svn path=/trunk/; revision=42764
2012-05-22 03:52:12 +00:00
Guy Harris 4a9b825c49 Change the "user_saved" member of a capture_file structure to
"unsaved_changes", and have it be TRUE iff changes have been made to the
file since it was read - *not* if it's a temporary file from a live
capture.

Check the "is_tempfile" member, and the "unsaved_changes" member, when
appropriate.

Just have a set_toolbar_for_capture_file() routine that updates the
"save", "close", and "reload" toolbar as appropriate, given a
capture_file structure - absorb the function of
set_toolbar_for_unsaved_capture_file() into it.

svn path=/trunk/; revision=42721
2012-05-20 08:56:06 +00:00
Anders Broman 77074a5a37 From Evan Huus: - Make sure that unsupported link-layer types *always* have a dlt of -1 in the `device.links` list so that we can tell if they're unsupported. - When building the combo-box of link-layer types, make the unsupported ones insensitive (disabled), and be sure to default to a supported one if we have one. - Compiling a capture filter requires a supported link-layer type, so disable the 'Compile BPF' button if there are none. - It is not always a programming error to have no active pointer in the combo-box, as this can happen when all the available entries are unsupported (and thus disabled). Don't abort with g_assert_not_reached() when this happens. - Unlock the `pcap_compile_mtx` mutex in all cases after compiling a packet filter. This was causing a deadlock (complete program hang) if you tried to compile two different filters in a row on the same interface. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7135
svn path=/trunk/; revision=42410
2012-05-04 04:35:43 +00:00
ruengeler 0819722ad8 Fix bug #7178 reported by aparan
svn path=/trunk/; revision=42206
2012-04-23 12:34:16 +00:00
Anders Broman a094f232ea From Martin Kaiser: menus, main window title, icons are not reset when capture is interrupted before any data arrives. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7129
svn path=/trunk/; revision=42149
2012-04-20 05:20:04 +00:00
Guy Harris 53155a11c0 Get rid of the error code argument to scan_local_interfaces(); nobody
uses it once it's filled in.

From Evan Huus: in scan_local_interfaces(), pass NULL to
capture_interface_list(), as we don't use the error string (and don't
free it, either).

In fill_capture_box(), for CANT_GET_INTERFACE_LIST, include the error
string in the report, and free it, in all cases, when we're done with
it.

svn path=/trunk/; revision=42089
2012-04-15 23:03:58 +00:00
Guy Harris 6b1c5a9e0d From Evan Huus: free if_string when we're done with it. Fixes bug 7093.
From me: don't bother initializing if_string in its definition, as if
it's used at all it's set to a different value before all uses.

svn path=/trunk/; revision=42073
2012-04-14 18:04:12 +00:00
Anders Broman 7330ec7035 From Evan Huus: Memory leak in scan_local_interfaces. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7086
svn path=/trunk/; revision=42061
2012-04-14 07:44:51 +00:00
Guy Harris 7ee4c2fb40 Make the comment I added, saying what scan_local_interfaces() does, more
accurate.

svn path=/trunk/; revision=41713
2012-03-21 06:37:34 +00:00
Guy Harris 7f5162352f scan_local_interfaces() isn't in capture_opts.c; don't declare it in
capture_opts.h.  (It arguably belongs somewhere other than in a file in
ui/gtk, but, if so, move it there, e.g. to something in ui.)

svn path=/trunk/; revision=41712
2012-03-21 06:31:39 +00:00
Guy Harris 40a034b3f5 Fix 4-space tabs.
svn path=/trunk/; revision=41708
2012-03-21 06:10:17 +00:00
Guy Harris cd1debf183 Add an explicit capture_cb_capture_failed indication for the case where
we weren't even able to start a capture, rather than delivering a fake
"capture start" indication and relying on a later "capture file closed"
indication - for a capture that was never opened in the first place - to
handle GUI cleanups.

Don't deliver any GUI indications in cf_close() if we didn't have a
capture file open in the first place.

Clear the status bar and welcome header if that indication is delivered.

If we start a capture from the command line with the -k flag, don't show
the captured packet information unless the capture actually starts.

svn path=/trunk/; revision=41521
2012-03-13 08:36:25 +00:00
Guy Harris dce6f88487 SystemConfiguration framework, not IOKit?
svn path=/trunk/; revision=41519
2012-03-13 05:02:48 +00:00
Guy Harris b85eebdd7e Suggest a better way of getting the interface type on OS X.
svn path=/trunk/; revision=41518
2012-03-13 05:02:16 +00:00
Guy Harris fa64659e93 Closing a capture file has nothing to do with the list of interfaces on
which to do a live capture; don't clear the latter list when closing the
capture file.

collect_ifaces() should clear out the existing list of interfaces before
filling that list up with the interfaces selected by the user.  In
addition, when it frees up interfaces in that list, it should free up
the strings attached to those interfaces.

svn path=/trunk/; revision=41517
2012-03-13 03:48:27 +00:00
Guy Harris 681c29c5d5 Don't close the currently loaded capture file in capture_start(), do so
in its callers; when starting a capture with "wireshark -k", there's no
capture file to close, and closing it might be provoking some UI actions
that cause crashes on Windows.

Don't copy the list of selected interfaces to the list of capture
interfaces in capture_start(), either, do that in the callers; we were
already doing that in one place and, in one of the remaining cases,
namely "wireshark -k", we should do so only if no capture interfaces
were supplied on the command line.  (I.e., the set of interfaces on
which we want to capture depends on where in the UI the capture is being
started.)

svn path=/trunk/; revision=41491
2012-03-11 20:08:54 +00:00
Guy Harris 42df48aab0 capture_opts_add_opt() does just fine at adding an interface to the
capture options, so don't special-case the -i option.

svn path=/trunk/; revision=41477
2012-03-11 07:10:48 +00:00
Michael Tüxen 64ba56a080 From Irene Ruengeler: Whitespace changes.
svn path=/trunk/; revision=41174
2012-02-24 12:54:15 +00:00
Michael Tüxen b1fa4c19e6 From Irene Ruengeler:
* Add support in the GUI for pipes.
* Allow the local interfaces to be rescanned via the GUI.
* Allow remote interfaces to be added and deleted.
The GUI can be extended to support other ways of capturing.

svn path=/trunk/; revision=41105
2012-02-21 11:59:41 +00:00
Jörg Mayer a206a11e7e include "../util.h" -> include "ui/util.h"
svn path=/trunk/; revision=41048
2012-02-17 12:46:50 +00:00
Guy Harris 96b89de3e9 Capitalize the "P" in "Packet" in "Add or Edit Packet Comment". Add
"..." after it, as it pops up a dialog box to let you actually type in a
comment.

Add "Add or Edit Packet Comment" to the menubar's Edit menu.

svn path=/trunk/; revision=41005
2012-02-12 23:09:14 +00:00
Anders Broman 15d8fe8baa Get the comment and put it in the textview.
svn path=/trunk/; revision=40985
2012-02-12 16:18:25 +00:00
Martin Mathieson 203d9589f3 Initialise a variable to avoid warning.
svn path=/trunk/; revision=40916
2012-02-07 11:12:17 +00:00
Alexis La Goutte ee590fdd58 Fix some Dead Store (Dead assignement/Dead increment) Warning found by Clang
svn path=/trunk/; revision=40889
2012-02-06 22:02:03 +00:00
Michael Tüxen 3d3346bc7e Try to make the buildbots happy.
svn path=/trunk/; revision=40726
2012-01-25 20:26:34 +00:00
Michael Tüxen 14b1a44c0f Third try. This time pipes and stdin are supported and the
test scripts are passed.

Use a global list containing all interfaces and only change
properties of the entries when changes are made in the GUI.
Do not misuse the list of interfaces specified on the command
line anymore.

This patch does not provide any new functionality, it just
provides the base for future extensions like removing
remote interface, mulitple airpcap devices and multiple
pipes.

This patch was provided by Irene Ruengeler.

svn path=/trunk/; revision=40715
2012-01-25 13:04:32 +00:00
Michael Tüxen 4fece25e7f We need a 3rd try. (After learning how to run the testuite on Windows locally).
svn path=/trunk/; revision=40695
2012-01-24 17:12:56 +00:00
Michael Tüxen b0819f5a80 (Try to) make the buildbot happy.
svn path=/trunk/; revision=40694
2012-01-24 16:40:16 +00:00
Michael Tüxen 08d6785412 Second try. This time pipes and stdin are supported.
Use a global list containing all interfaces and only change
properties of the entries when changes are made in the GUI.
Do not misuse the list of interfaces specified on the command
line anymore.

This patch does not provide any new functionality, it just
provides the base for future extensions like removing
remote interface, mulitple airpcap devices and multiple
pipes.

This patch was provided by Irene Ruengeler.


svn path=/trunk/; revision=40693
2012-01-24 16:05:26 +00:00
Guy Harris dacb4133e8 Restructure the recent file code so that recent.c is GUI-independent;
move it to the top-level source directory for now, and move
ui/gtk/recent.h to the ui directory.

svn path=/trunk/; revision=40561
2012-01-18 19:38:34 +00:00
Guy Harris d7b2aad043 Move some headers for UI stuff, and the alert_box.c UI-specific file, to
the ui directory.  (Perhaps some other files that would be used by all
flavors of Wireshark, for any GUI toolkit or for someting such as
ncurses, and not for any command-line tool such as TShark, should be
moved there as well.)

Shuffle some #includes to put the "ui/XXX.h" includes together.

svn path=/trunk/; revision=40529
2012-01-16 01:07:52 +00:00
Jörg Mayer 89ac6f314f More .. -> ../.. changes after gtk/ move
svn path=/trunk/; revision=40523
2012-01-15 22:40:03 +00:00
Jörg Mayer be706c6380 Move gtk to ui/gtk.
This looses the last checkin to gtk, will add this manually back.

svn path=/trunk/; revision=40518
2012-01-15 21:59:11 +00:00