GtkCellRendererProgress pulse behavior



Dear gtk-app-devel mailing list,

I'm not sure if this is a bug or an error on my part so I decided to put it here and see what 
you guys and gals think.
I have a program with a gtktreeview which includes a column that uses gtkcellrendererprogress.
Using the new pulse property of the treeview progress bar, I want to first pulse while the program
waits for something and then use that progress bar to show progress. My problem is that after
one row pulses and then enters into progress mode (by setting pulse back to -1), any rows I add
won't pulse but just sit there as if pulse was 0 but not being incremented, even though I am changing
it. What follows in an example I brewed up:

#include <gtk/gtk.h>

enum {
TEST_PROGRESS,
TEST_PULSE,
TEST_COLS
};

GtkListStore * store;

void ex1(GtkTreeIter * it);
void ex2(GtkTreeIter * it2);

int main(){

  GtkWidget * window;
  GtkCellRenderer * rend;
  GtkTreeViewColumn * col;
  GtkWidget * tree;
  GtkTreeIter it;
  int i;
  
  gtk_init(NULL,NULL);   
  
  //set up list and window
  window=gtk_window_new(GTK_WINDOW_TOPLEVEL);  
  store=gtk_list_store_new(TEST_COLS,G_TYPE_INT,G_TYPE_INT);                       
  tree=gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));  

  rend=gtk_cell_renderer_progress_new();
  col=gtk_tree_view_column_new_with_attributes("Percentage",rend,
                                               "value",TEST_PROGRESS,
                                               "pulse",TEST_PULSE,NULL);
  gtk_tree_view_append_column(GTK_TREE_VIEW(tree),col);
   
  gtk_container_add(GTK_CONTAINER(window),tree);
  gtk_widget_show_all(window);
  
  /*test data    
    just an example; in my program it has to pulse for a while, then
    show % */
    
  gtk_list_store_append(store,&it);
   
  //pulse a bunch of times
  for (i=0;i<79;i++)
  gtk_list_store_set(store,&it,TEST_PULSE,i,-1);
 
  ex1(&it);
  //ex2(&it);
  
  //now for second item
  gtk_list_store_append(store,&it);


  //pulse a bunch of times
  for (i=0;i<158;i++)
  gtk_list_store_set(store,&it,TEST_PULSE,i,-1);

  gtk_main();
  return 0;
}

void ex2(GtkTreeIter * it){
// resets pulse property to -1, then shows %

  gtk_list_store_set(store,it,TEST_PULSE,-1,-1);
  gtk_list_store_set(store,it,TEST_PROGRESS,50,-1);
}

void ex1(GtkTreeIter * it){
// put pulse to g_maxint to indicate completion

  gtk_list_store_set(store,it,TEST_PULSE,G_MAXINT,-1);
}

What to look at here is ex1 and ex2. The way the code is now, the first row pulses and ex1
executes and will show completion by setting pulse to G_MAXINT. Then a second row is added
and seems to pulse. But if one comments out the line
ex1(&it)
and we run ex2(&it) instead, the first row will enter into progress mode and the second
row does not seem to pulse.

I am using gtk 2.12.2, glib 2.14.5 and pango 1.19.3

Thanks!
-Thomas Flynn (tflyn at hunter dot cuny dot edu)



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