[9425] in The GTK GIMP ToolKit mailing list archive
[gtk-list] Re: Detecting window from button
daemon@ATHENA.MIT.EDU (Martin Schulze)
Mon Oct 19 19:59:46 1998
Date: Tue, 20 Oct 1998 01:45:21 +0200
From: Martin Schulze <joey@finlandia.Infodrom.North.DE>
To: Havoc Pennington <rhpennin@midway.uchicago.edu>
Cc: gtk-list@redhat.com
Reply-To: Martin Schulze <joey@infodrom.north.de>
In-Reply-To: <Pine.GSO.3.95.981019155130.22731D-100000@harper.uchicago.edu>; from Havoc Pennington on Mon, Oct 19, 1998 at 03:54:49PM -0500
Resent-From: gtk-list@redhat.com
Havoc Pennington wrote:
>
> 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);
> }
Oh! It is *that* easy? I feel ashamed.
> > 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.
But can I connect a button to the delete_event handler? The argument
list is different:
gint pipe_delete(GtkWidget *widget, GdkEvent *event, gpointer data)
void callback_func(GtkWidget* button, GtkWidget* dialog)
Or do I miss something here?
Regards,
Joey
--
All language designers are arrogant. Goes with the territory...
-- Larry Wall
--
To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null