ctree bug ( or is this a feature request ?) patch included



Getting text from a ctree cell currently requires you to check to 
see if there is also a pixmap or not. This doesn't seem right to
me. I feel that if there is text in a cell gtk_ctree_node_get_text
should give it to you. The current version returns if the cell
type is not GTK_CELL_TEXT. I changed it to also return the text
if the type is GTK_CELL_PIXTEXT.

I have included the new copy of gtk_ctree_node_get_text below. I 
would like for this to be in the 1.2 branch as a bug fix.

Any comments?

Todd.

gint
gtk_ctree_node_get_text (GtkCTree      *ctree,
                         GtkCTreeNode  *node,
                         gint           column,
                         gchar        **text)
{

  GtkCellType  cell_type;
  char        *return_text;

  g_return_val_if_fail (ctree != NULL, 0);
  g_return_val_if_fail (GTK_IS_CTREE (ctree), 0);
  g_return_val_if_fail (node != NULL, 0);

  if (column < 0 || column >= GTK_CLIST (ctree)->columns)
    return 0;

  cell_type = GTK_CTREE_ROW ( node ) -> row . cell [ column ] . type;
  return_text = NULL;

  if ( ( cell_type != GTK_CELL_TEXT ) &&
       ( cell_type != GTK_CELL_PIXTEXT ) )
    return 0;

  if ( cell_type == GTK_CELL_TEXT)
    return_text = 
       GTK_CELL_TEXT (GTK_CTREE_ROW (node)->row.cell[column])->text;

  if ( cell_type == GTK_CELL_PIXTEXT )
    return_text =
      GTK_CELL_PIXTEXT (GTK_CTREE_ROW (node)->row.cell[column])->text;

  if (text)
     *text = return_text;

  return 1;
}



-- 
   ==============================================================
   | Todd Dukes                      E-MAIL:  tdukes@ibmoto.com |
   | Motorola Somerset                  Phone:   (512) 424-8008 |
   | MS OE70                                                    |
   | 6300 Bridgepoint Parkway Building #3                       |
   | Austin, Texas 78730                                        |       
   ==============================================================



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