Re: Show dialog after hide another
- From: Nicola Fontana <ntd entidi it>
- To: Rúben Rodrigues <ruben_gr live com pt>
- Cc: "gtk-app-devel-list gnome org" <gtk-app-devel-list gnome org>
- Subject: Re: Show dialog after hide another
- Date: Thu, 7 Sep 2017 10:22:17 +0200
Il Wed, 6 Sep 2017 16:08:07 +0000 Rúben Rodrigues <ruben_gr live com pt> scrisse:
...
void on_button_Util_Firmware_Update_clicked(GtkButton *button, gpointer
user_data)
{
GtkLabel *gLabel_Result;
FILE *fp;
gchar pcTmp[BUFSIZ];
// Fecha a janela.
gtk_widget_hide(GTK_WIDGET(gtk_widget_get_toplevel(GTK_WIDGET(button))));
// Mostra a janela de espera.
gtk_widget_show(GTK_WIDGET(gtk_builder_get_object(builder,
"Setup_Wait_dialog")));
sleep(10);
...
Hi Rúben,
this is the normal behavior in a single-threaded application: the
user interface is updated only when you release the CPU so that
the execution returns to the main loop:
https://developer.gnome.org/glib/stable/glib-The-Main-Event-Loop.html#glib-The-Main-Event-Loop.description
The rule of thumb is: never block, i.e. never put a `sleep(10)` or
something equivalent in your code otherwise you'll get what you
requested, in that case an unresponsive interface for 10 seconds.
If you have a heavy process, fork to a working thread or decompose
it in a loop that can be run incrementally with an idle callback.
Ciao.
--
Nicola
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]