Re: Updating TextView and StatusBar problem



Hello,
When you use sleep() call you block your main events loop. You have to use GLib timeouts istead of sleep.
http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html

Here's the sample (untested):

static gboolean delayed_print(gchar *text)
{
gchar *s;

   print_textview(text, GTK_TEXT_VIEW(window->textview));
   s = g_strconcat(" Just printed", text, NULL);
   print_statusbar(s, GTK_STATUSBAR(window->statusbar));
   return FALSE;
}

static void my_func()
{
   print_textview("BLA\n", GTK_TEXT_VIEW(window->textview));
   print_statusbar(" Just printed BLA", GTK_STATUSBAR(window->statusbar));

   g_timeout_add(1000, delayed_print, "BLE\n");
}

   Olexiy




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