<br><br><div><span class="gmail_quote">2006/5/19, Eero Tamminen &lt;<a href="mailto:eero.tamminen@movial.fi">eero.tamminen@movial.fi</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>&gt; gtk_banner_show_animation(app, &quot;Searching&quot;);<br>&gt; slow_searching_function();<br>&gt; gtk_banner_close(app);<br><br>Are you calling the gtk mainloop (or otherwise letting the widget<br>process events) occasionally from the slow_searching_function()
<br>so that:<br>- banner can process the expose events and draw itself<br>- animation can refresh itself<br>?<br><br>Note that it's a very bad idea to thread the UI code, because that will<br>make debugging any bugs you have MUCH harder.&nbsp;&nbsp;If you want to use threads,
<br>you should thread only well-isolated functionality (e.g. reading data<br>from a socket to a buffer) which interactions with the rest of the your<br>and libraries code you know very well (at least concerning the thread
<br>safety).<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Eero<br><br>_______________________________________________<br>maemo-developers mailing list<br><a href="mailto:maemo-developers@maemo.org">maemo-developers@maemo.org</a><br><a href="https://maemo.org/mailman/listinfo/maemo-developers">
https://maemo.org/mailman/listinfo/maemo-developers</a><br></blockquote></div><br>
<br>
<br>
Hello,<br>
<br>
<br>
<br>
/* For another example: */<br>
<br>
<br>
<br>
#include &lt;hildon-widgets/hildon-app.h&gt;<br>
#include &lt;hildon-widgets/hildon-appview.h&gt;<br>
#include &lt;hildon-widgets/gtk-infoprint.h&gt;<br>
#include &lt;gtk/gtk.h&gt;<br>
<br>
<br>
<br>
static gint infoprint_type = 1;<br>
<br>
<br>
/* Callback to show infoprints */<br>
void show_infoprint(GtkButton * widget, HildonApp * app)<br>
{<br>
&nbsp;&nbsp;&nbsp; switch (infoprint_type) {<br>
&nbsp;&nbsp;&nbsp; case 1:&nbsp; /* no animation, only sleep */<br>
/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_infoprint(GTK_WINDOW(app), &quot;Hi there!&quot;); */<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_banner_show_animation(GTK_WINDOW(app), &quot;Hi there!&quot;);<br>
&nbsp;&nbsp;&nbsp; sleep(5);<br>
&nbsp;&nbsp;&nbsp; gtk_banner_close( GTK_WINDOW(app) );<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
<br>
&nbsp;&nbsp;&nbsp; case 2: /* animation AFTER the sleep, I don't understand. */<br>
/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_infoprint_with_icon_stock(GTK_WINDOW(app),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&quot;This is save icon&quot;, GTK_STOCK_SAVE);*/<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_banner_show_animation(GTK_WINDOW(app), &quot;Hi there!&quot;);<br>
&nbsp;&nbsp;&nbsp; sleep(5);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
<br>
&nbsp;&nbsp;&nbsp; case 3: /* close the banner */<br>
/*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_banner_show_bar(GTK_WINDOW(app), &quot;Info with progress bar&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_banner_set_fraction(GTK_WINDOW(app), 0.2); */<br>
&nbsp;&nbsp;&nbsp; gtk_banner_close( GTK_WINDOW(app) );<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
<br>
&nbsp;&nbsp;&nbsp; case 4:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* With fifth click, end the application */<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gtk_main_quit();<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; /* Increase the counter */<br>
&nbsp;&nbsp;&nbsp; infoprint_type++;<br>
}<br>
<br>
<br>
<br>
<br>
<br>
/* Main application */<br>
int main(int argc, char *argv[])<br>
{<br>
&nbsp;&nbsp;&nbsp; /* Create needed variables */<br>
&nbsp;&nbsp;&nbsp; HildonApp *app;<br>
&nbsp;&nbsp;&nbsp; HildonAppView *appview;<br>
&nbsp;&nbsp;&nbsp; GtkWidget *main_vbox;<br>
&nbsp;&nbsp;&nbsp; GtkWidget *button1;<br>
<br>
&nbsp;&nbsp;&nbsp; /* Initialize the GTK. */<br>
&nbsp;&nbsp;&nbsp; gtk_init(&amp;argc, &amp;argv);<br>
<br>
&nbsp;&nbsp;&nbsp; /* Create the hildon application and setup the title */<br>
&nbsp;&nbsp;&nbsp; app = HILDON_APP(hildon_app_new());<br>
&nbsp;&nbsp;&nbsp; hildon_app_set_title(app, &quot;App Title&quot;);<br>
&nbsp;&nbsp;&nbsp; hildon_app_set_two_part_title(app, TRUE);<br>
<br>
&nbsp;&nbsp;&nbsp; /* Create HildonAppView and set it to HildonApp */<br>
&nbsp;&nbsp;&nbsp; appview = HILDON_APPVIEW(hildon_appview_new(&quot;AppView Title&quot;));<br>
&nbsp;&nbsp;&nbsp; hildon_app_set_appview(app, appview);<br>
<br>
&nbsp;&nbsp;&nbsp; /* Add vbox to appview */<br>
&nbsp;&nbsp;&nbsp; main_vbox = gtk_vbox_new(FALSE, 0);<br>
&nbsp;&nbsp;&nbsp; gtk_container_add(GTK_CONTAINER(appview), main_vbox);<br>
<br>
&nbsp;&nbsp;&nbsp; /* Add button to vbox */<br>
&nbsp;&nbsp;&nbsp; button1 = gtk_button_new_with_label(&quot;Show Info&quot;);<br>
&nbsp;&nbsp;&nbsp; gtk_box_pack_start(GTK_BOX(main_vbox), button1, FALSE, TRUE, 0);<br>
<br>
&nbsp;&nbsp;&nbsp; /* Add signal listener to button */<br>
&nbsp;&nbsp;&nbsp; g_signal_connect(G_OBJECT(button1), &quot;clicked&quot;,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
G_CALLBACK(show_infoprint), app);<br>
<br>
&nbsp;&nbsp;&nbsp; /* Begin the main application */<br>
&nbsp;&nbsp;&nbsp; gtk_widget_show_all(GTK_WIDGET(app));<br>
&nbsp;&nbsp;&nbsp; gtk_main();<br>
<br>
&nbsp;&nbsp;&nbsp; /* Exit */<br>
&nbsp;&nbsp;&nbsp; return 0;<br>
}<br>
<br>
<br>
Thanks,<br>
Laci<br>