Exemplo n.º 1
0
static void
score_cell_data (GtkTreeViewColumn *column,
                 GtkCellRenderer   *cell,
                 GtkTreeModel      *model,
                 GtkTreeIter       *iter,
                 gpointer           col)
{
  gint          score;
  gchar        *text;
  gchar        *path;
  gint          pathtype;
  gint          type;
  gint          width, old_width;
  const gchar  *key = get_key (&type);
  
  gtk_tree_model_get (model, iter, COL_PATH, &path, COL_TYPE, &pathtype, -1);
  
  score = key_score (key, path);
  if (! (pathtype & type)) {
    score -= 0xf000;
  }
  
  text = g_strdup_printf ("%d", score);
  g_object_set (cell, "text", text, NULL);
  
  /* automatic column sizing is buggy, so just make an acceptable wild guess */
  width = 8 + strlen (text) * 10;
  old_width = gtk_tree_view_column_get_fixed_width (col);
  if (old_width < width) {
    gtk_tree_view_column_set_fixed_width (col, width);
  }
  
  g_free (text);
  g_free (path);
}
Exemplo n.º 2
0
int gTree::columnWidth(int ind)
{
	GtkTreeViewColumn *col = gt_tree_view_find_column(GTK_TREE_VIEW(widget), ind);
	int w;
	
	if (!col) 
		return 0;
	
	w = gtk_tree_view_column_get_width(col);
	if (w == 0)
		w = gtk_tree_view_column_get_fixed_width(col);
	
	return w;
}
Exemplo n.º 3
0
void ui_playlist_widget_get_column_widths (GtkWidget * widget, char * * widths,
 char * * expand)
{
    int w[pw_num_cols], ex[pw_num_cols];

    for (int i = 0; i < pw_num_cols; i ++)
    {
        GtkTreeViewColumn * col = gtk_tree_view_get_column ((GtkTreeView *) widget, i);
        w[i] = gtk_tree_view_column_get_fixed_width (col);
        ex[i] = gtk_tree_view_column_get_expand (col);
    }

    * widths = int_array_to_string (w, pw_num_cols);
    * expand = int_array_to_string (ex, pw_num_cols);
}