[Glade-devel] callbacks



Hi at all,

i followed a discussion about the callbacks with glade in witch people speaks 
about the possibility to change the inteface.c file, but i learned from the 
glade tutorial... 
http://www.kplug.org/glade_tutorial/glade2_tutorial/quick_tour2.html

...that i should not change that file, because it will be overwitten every 
time glade builds the code of my application.

I need a way to exchange pointers to widget between different callbacks 
function. Is there a way without declaring a global variable?

For example my actual callbacks.c is like this:

/*Initialized in main.c with the pointer to the main window*/
extern GtkWidget *Main;
[...]

void
on_connectFileMenuButton_activate      (GtkMenuItem     *menuitem,
                                        gpointer         user_data)
{
  GtkWidget *progress=lookup_widget(Main,"progressbar");
  short int i;
  gdouble fraction;
  GtkWidget *connecting=create_Connecting();
  for(i=0;i<=100;i++)
    {
      fraction=((gdouble)i)/100;
      gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress),fraction);
      sleep(0.9);
    }
  gtk_widget_show(connecting);

}


in this case i cannot obtain a pointer to the progressbar placed into the main 
window, because the menuitem is a little window that contains: "File, Edit" 
and so on... (therefore an approach like:   
lookup_widget(menuitem,"progressbar"), or 
lookup_widget(gtk_widget_get_toplevel(menuitem),"progressbar") does not 
work).
My problem will be addressed if i could pass data into 
user_data variable, but i don't know how to do that without changing the 
interface.c
Can someone help me?

Thanks 

Alberto





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