[Glade-devel] glade: populating table/list with headers


Sorry for the late reply...

On Sun, Nov 13, 2011 at 1:13 AM, Tristan Van Berkom <tristanvb at openismus.com

On Sat, 2011-11-12 at 20:29 +0100, Saku Masukita wrote:


I need to populate a list/table in glade with some headers
which label the columns. Could anyone point me in the
right direction. Do I need to use a GtkTreeView? Is the
old CList no longer supported for this? Do I have to
build my own custom widget and import it into glade?

Hi Saku,
  If you are displaying dynamic content, and that content
might be larger than say, 5 or 10 rows of data... then you
should definitely use a GtkTreeView.

Note that the ultimate problem with the old clist widgets
was that they use an unreasonable amount of resources to
display a list of dynamic data, so you do not want to relive
that by creating widgets for each row yourself (once you have
around 100 rows it can start to take a long time just to create
those widgets).

To do this in Glade,
 o Create a GtkTreeView
 o Create a GtkListStore (it may be an option while creating the view)
 o Then select the "Edit" toolbar item with the treeview selected

, I have tried clicking on a GtkTreeView
and placing it down. A popup window shows up asking me to
enter a GtkTreeView TreeView Model. I create a new object
called liststore1. I then right click the Tree View and select
Edit and get the following errors which crash glade altogether
(I see no way on the Edit toolbar to assign datatypes). How
should I proceed???

(glade:9725): Gtk-CRITICAL **: gtk_cell_view_set_displayed_row: assertion
`GTK_IS_TREE_MODEL (cell_view->priv->model)' failed

(glade:9725): Gtk-WARNING **:
/build/buildd/gtk+3.0-3.2.0/./gtk/gtktreeview.c:1944: invalid property id
14 for "ubuntu-almost-fixed-height-mode" of type `GParamBoolean' in

(glade:9725): Gtk-WARNING **: GtkContainerClass::add not implemented for

Gtk-ERROR **: GtkBox child GladeEditorTable minimum height: -4 < 0
Trace/breakpoint trap



 o In the main page... assign data types to your list store,
   for instance you might have a column named 'name' which is
   of type 'gchararray' (GType-speak for a string)
 o Then go to the 'Hierarchy' tab of the editor
 o Press the 'Add' button on the bottom left, this will add
   a GtkTreeViewColumn to your view
 o Right Click on the newly created treeview column which appears
   in the treeview editor window
 o In this context menu you can create GtkCellRenderers to show
   data in your view... Add some renderers, a text renderer to
   render text, etc.
 o Now that you have a renderer selected, on the right hand you
   will have a list of properties... only here instead of strict
   values (which are still possible), you can attribute the cell
   renderer properties to be set from specific values in the
   GtkTreeStore which you defined earlier

   So in this final step, you say that the GtkCellRendererText:text
   property should be driven by the 'name' column which you defined
   in your GtkTreeStore as a 'gchararray' (string).

After that, in code you generally have a loop where you call
apis like gtk_list_store_append() to add the data you need.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/glade-devel/attachments/20120114/cfb64e85/attachment.html>

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