Re: [gtk-list] Detecting window from button



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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]