[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
callback question
- From: Brian Wotring <brian fortnocs com>
- To: gtk-app-devel-list redhat com
- Subject: callback question
- Date: Wed, 11 Aug 1999 08:37:11 -0800
I'm new to gtk and could not find an answer in the tutorial or FAQ.
I'm creating a setup program. I would like it to be a typical setup
program with the "Back" "Continue", and "Exit" buttons. Does anybody
have any advice on how to design something like this?
My design was to remove the previous signal connected to the connect
button, then add a new one that points to the next stage.
So far, this has not been working because as soon as the continue button
is clicked once, it's as if the signal is still being sent and it skips
through all of the stages until the final stage. It's as if the
signal_destroy functions are not working. Or is it wrong to try to
destroy a signal from within it's callback method ? Or maybe I am
really missing something here...
int main()
{
GtkWidget *mainWindow;
GtkWidget *continueButton;
GtkWidget *backButton;
GtkWidget *exitButton;
/* ..set main window details here..... */
startSetup( NULL, NULL );
}
/* stage 1 */
void startSetup( GtkWidget *widget, gpointer data )
{
/* remove all old signal handlers for the buttons. */
gtk_signal_handlers_destroy( GTK_OBJECT( backButton ) );
gtk_signal_handlers_destroy( GTK_OBJECT( continueButton ) );
/* set signal handlers for continue button. */
gtk_signal_connect( GTK_OBJECT( continueButton ), "clicked",
GTK_SIGNAL_FUNC( installOptions ), ( gpointer )"continue" );
/* back is NOT an option here. */
gtk_widget_hide( backButton );
}
/* stage 2 */
void installOptions( GtkWidget *widget, gpointer data )
{
/* remove all old signal handlers for the buttons. */
gtk_signal_handlers_destroy( GTK_OBJECT( backButton ) );
gtk_signal_handlers_destroy( GTK_OBJECT( continueButton ) );
/* set signal handlers for back and continue buttons. */
gtk_signal_connect( GTK_OBJECT( backButton ), "clicked",
GTK_SIGNAL_FUNC( startSetup ), ( gpointer )"back" );
gtk_signal_connect( GTK_OBJECT( continueButton ), "clicked",
GTK_SIGNAL_FUNC( installDetails ), ( gpointer )"continue" );
/* back IS an option here. */
gtk_widget_show( backButton );
}
/* stage three */
void installDetails( GtkWidget *widget, gpointer data )
{
/* remove all old signal handlers for the buttons. */
gtk_signal_handlers_destroy( GTK_OBJECT( backButton ) );
gtk_signal_handlers_destroy( GTK_OBJECT( continueButton ) );
/* set signal handlers for back and continue buttons. */
gtk_signal_connect( GTK_OBJECT( backButton ), "clicked",
GTK_SIGNAL_FUNC( installOptions ), ( gpointer )"back" );
/* back is an option here. */
gtk_widget_show( backButton );
}
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]