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

Re: progress bar not updating in gtk+-2.14.5



Hi.

I've compiled your sample on Windows XP with Gtk+ 2.14.3 and on Gentoo
with Gtk+ 2.14.5 and cannot reproduce your behavior (the sample works
here as it should). What OS are you using? May be there is an errror
introduced when the Gtk+ is packed for you distro?


2008/12/23 Chisheng Huang <cph chi-square-works com>:
> Hi,
>
> The attached code will pop up a window with a progress bar in it.
> The fill fraction goes from 0.0 to 1.0 gradually and is reset to 0.0
> when it's bigger than 1.0.  With GTK+ 2.12.10, the appearance of the
> progress bar is constantly updated.  However, with GTK+ 2.14.5, the
> progress bar always remains empty.  Is this change of updating behaviour
> from 2.12.10 to 2.14.5 a bug or an intended feature?  If it's a feature,
> what extra functions do I have to call to make a progess bar update?
>
> Best wishes,
>
> -cph
>
> --------------------------------- cut ---------------------------------
> #include <gtk/gtk.h>
>
> static void destroy( GtkWidget *widget,
>                     gpointer   timeout)
> {
>  g_source_remove (GPOINTER_TO_UINT (timeout));
>  gtk_main_quit ();
> }
>
> static gboolean
> update_pbar (GtkProgressBar *pbar)
> {
>  gdouble frac = gtk_progress_bar_get_fraction (pbar) + 0.01;
>  if (frac > 1.0)
>    frac = 0.0;
>  g_print ("%f\n", frac);
>  gtk_progress_bar_set_fraction (pbar, frac);
>  return TRUE;
> }
>
> int main( int   argc,
>          char *argv[] )
> {
>    GtkWidget *window;
>    GtkWidget *pbar;
>    guint timeout_id;
>
>    gtk_init (&argc, &argv);
>
>    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
>    g_signal_connect (G_OBJECT (window), "destroy",
>                      G_CALLBACK (destroy), &timeout_id);
>    gtk_container_set_border_width (GTK_CONTAINER (window), 10);
>
>    pbar = gtk_progress_bar_new ();
>    timeout_id = g_timeout_add (100, (GSourceFunc) update_pbar, pbar);
>    gtk_container_add (GTK_CONTAINER (window), pbar);
>
>    gtk_widget_show (pbar);
>    gtk_widget_show (window);
>    gtk_main ();
>
>    return 0;
> }
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>



-- 
Tadej Borovšak
00386 (0)40 613 131
tadeboro gmail com
tadej borovsak gmail com


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