[9421] in The GTK GIMP ToolKit mailing list archive

home help back first fref pref prev next nref lref last post

[gtk-list] Re: Detecting window from button

daemon@ATHENA.MIT.EDU (Havoc Pennington)
Mon Oct 19 17:31:20 1998

Date: Mon, 19 Oct 1998 15:54:49 -0500 (CDT)
From: Havoc Pennington <rhpennin@midway.uchicago.edu>
To: Martin Schulze <joey@infodrom.north.de>
cc: gtk-list@redhat.com
In-Reply-To: <19981019211458.C27466@finlandia.infodrom.north.de>
Resent-From: gtk-list@redhat.com
Reply-To: gtk-list@redhat.com


On Mon, 19 Oct 1998, Martin Schulze wrote:
> 
> The new dialog has a Close button.  However the signal handler doesn't
> know which window to close.  Storing one global variable for this very
> windows isn't a solution but a bad workaround.
>

Why not pass the dialog as callback data? i.e.

gtk_signal_connect(button, "clicked", callback_func, dialog);

void callback_func(GtkWidget* button, GtkWidget* dialog)
{
	gtk_widget_destroy(dialog);
}
 
> In connection to the above scenario I wonder how it would be possible
> to disable the OK button in the main dialog until the data is
> processed (and the window is closed anyway) or the error box is
> closed.
> 

You can gtk_widget_set_sensitive(button, FALSE).

You'd need to figure out some way to do all the signals; you could
possibly connect a second callback to the error dialog which re-sensitizes
the button in the main dialog. 

Don't forget delete_event on your dialogs, that can also make them close.

Havoc


-- 
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null


home help back first fref pref prev next nref lref last post