Wireshark-dev: Re: [Wireshark-dev] Issues with most usage of GtkFileChooserDialog ?
Stephen Fisher wrote:
I'm not that familiar with the differences between the two other than
what the GTK docs say:
GtkFileChooserDialog - A file chooser dialog, suitable for "File/Open"
or "File/Save" commands
GtkFileChooserWidget - File chooser widget that can be embedded in other
widgets
So would you be creating a dialog and packing with a
GtkFileChooserWidget and widgets for the other options on the window?
Is that different then from extending the GtkFileChooserDialog (which is
what I assume we do now).
Yes: with GtkFileChooserDialog you have to use gtk_dialog_run after
setting up the file chooser window. gtk_dialog_handles waiting for the
chooser dialog OK/Cancel buttons to be hit; it's essentially a
mini-event loop handling only events from the file-chooser.
A typical (condensed) current Wireshark sequence using
GtkFileChooserDialog is:
<set up file chooser dialog window>
signal_connect(....,"delete-event",...)
signal_connect(....,"destroy",...)
if (gtk_dialog_run(chooser_window) == ACCEPT) {
<do_OK_cb>
else
<delete/destroy window)
return
If <accept action> is something like:
if <error>
alert_box
return
<do action>
<delete/destroy window>
<return>
then an error will return leaving the chooser window displayed but with
no "mini-event loop" (gtk_dialog_run) running and thus a "dead window"
(for the OK/Cancel buttons).
------------
Packing a GtkFileChooserWidget into a standard dialog window along with
OK/Cancel buttons & etc, should, I believe, allow Wireshark to handle
the dialog window containing the file chooser just like it handles any
other dialog window (and the way the GtkFileSelection window was handled):
connect callbacks to the OK/Cancel buttons & etc.
Bill