Problems using the GtkCellPixbufRenderer



Hello,

I'm sure I'm making some newbie mistake, but I am having problems getting
the GtkCellPixbufRenderer class to work even after looking at the example
provided with GTK.  Here's what I'm doing:

   . . .  Declare the xpm data - use data from GTK example . . .
   static const char  *xpb_data[] = {
   "16 16 6 1",
   "       c None s None",
   ".      c black",
   "X      c red",
   "o      c yellow",
   "O      c #808080",
   "#      c white",
   "                ",
      "       ..       ",
   "     ..XX.      ",
   "   ..XXXXX.     ",
   " ..XXXXXXXX.    ",
   ".ooXXXXXXXXX.   ",
   "..ooXXXXXXXXX.  ",
   ".X.ooXXXXXXXXX. ",
   ".XX.ooXXXXXX..  ",
   " .XX.ooXXX..#O  ",
   "  .XX.oo..##OO. ",
   "   .XX..##OO..  ",
   "    .X.#OO..    ",
   "     ..O..      ",
   "      ..        ",
   "                "
   };
   
   . . .  Normal GTK setup code - gtk_init, etc.. . .

   . . .  Populate the tree model, which includes the following: . . .
   . . .
   /*  Create a pixbuf.  */
   pixbuf = gdk_pixbuf_new_from_xpm_data( xpb_data );

   . . .

         /*  Specify the pixbuf for the current column.  */
         gtk_tree_store_set( store,            &mid_row_iter,
                             NAME_COLUMN,      name,
                             TIMELINE_COLUMN,  pixbuf,
                             -1
                           );

   . . .  Create a pixbuf renderer and specify that renderer when the TreeView
          column is created . . .

   /*  Second column - the timeline.  Try a pixbuf.  */
   renderer = gtk_cell_renderer_pixbuf_new();
   column = gtk_tree_view_column_new_with_attributes( "Timeline", renderer,
                                                      "pixbuf", TIMELINE_COLUMN,
                                                      NULL
                                                    );
   gtk_tree_view_append_column( GTK_TREE_VIEW( *view ), column );


When I run the program, I get the following errors:

(tmp:3616): GLib-GObject-WARNING **: unable to set property `pixbuf' of type `GdkPixbuf' from value of type `gchararray'

(tmp:3616): GLib-GObject-WARNING **: unable to set property `pixbuf' of type `GdkPixbuf' from value of type `gchararray'

(tmp:3616): GLib-GObject-WARNING **: unable to set property `pixbuf' of type `GdkPixbuf' from value of type `gchararray'

. . .

What am I doing wrong?


Brad



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