Bizarre Notebook behavior



I'm trying to set up my notebook so if the tab's
label isn't sensitive, it doesn't go to that tab.
After whipping up some code to do this, I'm realizing
that it seems like my notebook doesn't like the
gtk_notebook_set_page() function. So, I have some barebones
code now that looks like this:

/*
** main_notebook_switch - Only switches the page if the tab is active.
*/
void main_notebook_switch(GtkNotebook *notebook, GtkWidget *page, gint page_num, gpointer user_data)
{
   printf("page = %d\n", page_num);
   gtk_signal_handler_block_by_func(GTK_OBJECT(notebook),
                                    GTK_SIGNAL_FUNC(main_notebook_switch),
                                    NULL);
   printf("hello\n");
   gtk_notebook_set_page(notebook, 5);
   gtk_signal_handler_unblock_by_func(GTK_OBJECT(notebook),
                                      GTK_SIGNAL_FUNC(main_notebook_switch),
                                      NULL);
}

When I run the program, I see the "page = x" and the
"hello", but my notebook never switches to page 5. If
I take off the signal handlers, then I get an infinite
loop (as expected). What am I doing wrong here?

Jeff Shipman           E-Mail: jeff nmt edu
Systems Programmer     Phone: (505) 835-5748
NMIMT Computer Center  http://www.nmt.edu/~jeff





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