ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-dev: Re: [Wireshark-dev] Issues with most usage of GtkFileChooserDialog ?

From: Bill Meier <wmeier@xxxxxxxxxxx>
Date: Wed, 20 May 2009 23:15:15 -0400
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