Submenu dirties screen while waiting for called function to end



Hello.  I'm developing a Gnome Application.I have two small ( I hope)
questions
1) When I start a time-consuming function from a sub-menu, the sub-menu
changes to a grey box and waits for the function to end, and only after
that the dirt on my applidation window disappears, as if the window had
been 'refreshed'. Is this a normal behaviour or maybe related to my own
system settings? Can I force my submenu to disappear and refresh the
window before calling the external time-consuming function?
2) Related to point 1, I'd like to set up a progress-bar in my
GnomeAppbar to tell the user that everything is going all right. I
borrowed the following code, but  my AppWindow freezes, as in point 1,
till the end of the called function. Is that because of point 1 or
because of code mistakes?


gint display_progress_update (gpointer p)
{
static float percentage=0.0;
gtk_progress_bar_update(GTK_PROGRESS_BAR(p), percentage);
percentage+=0.1;
if (percentage>=1.0)
percentage=0.0;
return (TRUE);
}

/* this handler is invoked directly by a menu item */
void MyFunctionHandler(GtkWidget *widget, gpointer data)
{
GtkProgress *p;
guint progress;
p=gnome_appbar_get_progress(GNOME_APPBAR(appbar));
gtk_progress_set_activity_mode(GTK_PROGRESS(p),TRUE);
progress=gtk_timeout_add(100,display_progress_update,p);

MyFunction();  /* here I thought of calling the time-consuming func */

gtk_timeout_remove(progress);
}

I'm using RH 7.0 (Gtk 1.2.8 - Gnome 1.2 (I think)). my video card is
Riva TNT-2 32Mb)
Thanks in advance, sorry for  the long-posting.
Federico Bravo.





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