Discussion:
glade: populating table/list with headers
Saku Masukita
2011-11-12 19:29:07 UTC
Permalink
Hello,

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?

Thanks,

Saku
Tristan Van Berkom
2011-11-13 00:13:18 UTC
Permalink
Post by Saku Masukita
Hello,
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
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.

Cheers,
-Tristan


_______________________________________________
Glade-devel maillist - Glade-***@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-devel
Saku Masukita
2012-01-14 19:54:48 UTC
Permalink
Hi,

Sorry for the late reply...
Post by Tristan Van Berkom
Post by Saku Masukita
Hello,
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
`GtkTreeView'

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

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

Thanks,

Saku
Post by Tristan Van Berkom
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.
Cheers,
-Tristan
Tristan Van Berkom
2012-01-15 05:42:52 UTC
Permalink
Post by Saku Masukita
Hi,
Sorry for the late reply...
On Sun, Nov 13, 2011 at 1:13 AM, Tristan Van Berkom
Post by Saku Masukita
Hello,
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???
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
`GtkTreeView'
(glade:9725): Gtk-WARNING **: GtkContainerClass::add not implemented
for `GtkTreeView'
Gtk-ERROR **: GtkBox child GladeEditorTable minimum height: -4 < 0
Trace/breakpoint trap
This is a very well known GTK+ bug which was in fact fixed almost
two full months ago in GTK+ git master.

I don't know why but it seems most distributions of GTK+ still
have this bug (because I hear a lot about it), to track the progress
of this you can follow:
https://bugzilla.gnome.org/show_bug.cgi?id=660139

It seems the fix should be available in an upcoming 3.2 release
(as per Benjamin's (Company's) comment that the fix has been
backported to the 3.2 branch).

If you can't get your hands on a recent version of GTK+ that
contains the fix, I can give you a quick pointer on how
to hack around that with Glade sources:

o cd ~/path/to/glade/sources/
o grep -r gtk_grid_set_column_spacing .
o grep -r gtk_grid_set_row_spacing
o edit any of column/row spacing assigned to a GtkGrid
in Glade, you can simply remove these lines or change
the set value to '0'
o recompile and install Glade

That will avoid the crash for the time being.

Sorry for the inconvenience.

Cheers,
-Tristan
Post by Saku Masukita
Thanks,
Saku
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.
Cheers,
-Tristan
_______________________________________________
Glade-devel maillist - Glade-***@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-devel
Saku Masukita
2012-01-15 13:02:53 UTC
Permalink
Post by Tristan Van Berkom
This is a very well known GTK+ bug which was in fact fixed almost
two full months ago in GTK+ git master.
I don't know why but it seems most distributions of GTK+ still
have this bug (because I hear a lot about it), to track the progress
https://bugzilla.gnome.org/show_bug.cgi?id=660139
It seems the fix should be available in an upcoming 3.2 release
(as per Benjamin's (Company's) comment that the fix has been
backported to the 3.2 branch).
If you can't get your hands on a recent version of GTK+ that
contains the fix, I can give you a quick pointer on how
o cd ~/path/to/glade/sources/
o grep -r gtk_grid_set_column_spacing .
o grep -r gtk_grid_set_row_spacing
o edit any of column/row spacing assigned to a GtkGrid
in Glade, you can simply remove these lines or change
the set value to '0'
o recompile and install Glade
That will avoid the crash for the time being.
Sorry for the inconvenience.
Cheers,
-Tristan
Hi Tristan,

I have done the following: first I ran upate manager on Ubuntu to update all
my packages including gtklib but that did not fix the problem. So I
downloaded
and installed the following:

gtk+-3.2.3.tar.xz
glade-3.10.2.tar.xz

So I open the glade file...

---------------------------------------------------------------------------------------------------------------------------------------

$ glade whm.glade
Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"
GladeUI-Message: No displayable values for property
GtkMessageDialog::message-type
GladeUI-Message: No displayable values for property GtkTreeSelection::mode
GladeUI-Message: 14 missing displayable value for
GtkCellRendererAccel::accel-mods

(glade:11355): GladeUI-CRITICAL **: Unable to load module
'gtksourceview-3.0' from any search paths

(glade:11355): GladeUI-WARNING **: Failed to load external library
'gtksourceview-3.0'

(glade:11355): GladeUI-WARNING **: We could not find the symbol
"gtk_source_view_get_type"

(glade:11355): GladeUI-WARNING **: Could not get the type from
"GtkSourceView"

(glade:11355): GladeUI-WARNING **: Failed to load the GType for
'GtkSourceView'

(glade:11355): GladeUI-WARNING **: Tried to include undefined widget class
'GtkSourceView' in a widget group
Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"
GladeUI-Message: The DevHelp installed on your system is too old, devhelp
feature will be disabled.

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

---------------------------------------------------------------------------------------------------------------------------------------------------

I add the TreeView to my file. RIght click -> Edit... and get the following:

(glade:11355): Gtk-WARNING **: GtkContainerClass::add not implemented for
`GtkTreeView'

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

---------------------------------------------------------------------------------------------------------------------------------------------------

Why am I getting this message when I have downloaded and installed all the
latest versions
of gtklib and glade?

I desperately need a way to add a table with headers to my glade file.

Thank you for your help,

Saku
Tristan Van Berkom
2012-01-15 14:09:05 UTC
Permalink
On Sun, Jan 15, 2012 at 6:42 AM, Tristan Van Berkom
This is a very well known GTK+ bug which was in fact fixed almost
two full months ago in GTK+ git master.
I don't know why but it seems most distributions of GTK+ still
have this bug (because I hear a lot about it), to track the progress
https://bugzilla.gnome.org/show_bug.cgi?id=660139
It seems the fix should be available in an upcoming 3.2 release
(as per Benjamin's (Company's) comment that the fix has been
backported to the 3.2 branch).
... Note that I mentioned the patch was backported to 3.2 branch
recently... that doesn't mean that there has been a release since
then.
If you can't get your hands on a recent version of GTK+ that
contains the fix, I can give you a quick pointer on how
o cd ~/path/to/glade/sources/
o grep -r gtk_grid_set_column_spacing .
o grep -r gtk_grid_set_row_spacing
o edit any of column/row spacing assigned to a GtkGrid
in Glade, you can simply remove these lines or change
the set value to '0'
o recompile and install Glade
That will avoid the crash for the time being.
Sorry for the inconvenience.
Cheers,
-Tristan
Hi Tristan,
I have done the following: first I ran upate manager on Ubuntu to update all
my packages including gtklib but that did not fix the problem. So I
downloaded
gtk+-3.2.3.tar.xz
glade-3.10.2.tar.xz
So I open the glade file...
---------------------------------------------------------------------------------------------------------------------------------------
$ glade whm.glade
Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"
GladeUI-Message: No displayable values for property
GtkMessageDialog::message-type
GladeUI-Message: No displayable values for property
GtkTreeSelection::mode
GladeUI-Message: 14 missing displayable value for
GtkCellRendererAccel::accel-mods
(glade:11355): GladeUI-CRITICAL **: Unable to load module
'gtksourceview-3.0' from any search paths
(glade:11355): GladeUI-WARNING **: Failed to load external library
'gtksourceview-3.0'
(glade:11355): GladeUI-WARNING **: We could not find the symbol
"gtk_source_view_get_type"
(glade:11355): GladeUI-WARNING **: Could not get the type from
"GtkSourceView"
(glade:11355): GladeUI-WARNING **: Failed to load the GType for
'GtkSourceView'
(glade:11355): GladeUI-WARNING **: Tried to include undefined widget
class 'GtkSourceView' in a widget group
Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"
GladeUI-Message: The DevHelp installed on your system is too old,
devhelp feature will be disabled.
assertion `GTK_IS_TREE_MODEL (cell_view->priv->model)' failed
---------------------------------------------------------------------------------------------------------------------------------------------------
(glade:11355): Gtk-WARNING **: GtkContainerClass::add not implemented
for `GtkTreeView'
Gtk-ERROR **: GtkBox child GladeEditorTable minimum height: -4 < 0
Trace/breakpoint trap
---------------------------------------------------------------------------------------------------------------------------------------------------
Why am I getting this message when I have downloaded and installed all
the latest versions
of gtklib and glade?
As I mentioned above, I don't know when GTK+ team will release a 3.2
with the fix that we need.

For now, you could take your GTK+ tarball which you downloaded,
and before compiling/installing the new GTK+, apply the patch
which is mentioned in the bug report I pointed to earlier:
https://bugzilla.gnome.org/show_bug.cgi?id=660139

Cheers,
-Tristan
I desperately need a way to add a table with headers to my glade file.
Thank you for your help,
Saku
_______________________________________________
Glade-devel maillist - Glade-***@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-devel
Saku Masukita
2012-01-17 11:03:31 UTC
Permalink
Post by Tristan Van Berkom
As I mentioned above, I don't know when GTK+ team will release a 3.2
with the fix that we need.
For now, you could take your GTK+ tarball which you downloaded,
and before compiling/installing the new GTK+, apply the patch
https://bugzilla.gnome.org/show_bug.cgi?id=660139
Cheers,
-Tristan
Hi,

Any idea of how to apply the patch?
Do I have to recompile glade once the patch is applied?
Presumably, once my glade file has no empty grids I should
be able to distribute it for use versus the unpatched version
of GTK+3 given that that is what my users will be using?

Thanks,

Saku
Tristan Van Berkom
2012-01-17 13:31:35 UTC
Permalink
On Tue, Jan 17, 2012 at 8:03 PM, Saku Masukita
On Sun, Jan 15, 2012 at 3:09 PM, Tristan Van Berkom
Post by Tristan Van Berkom
As I mentioned above, I don't know when GTK+ team will release a 3.2
with the fix that we need.
For now, you could take your GTK+ tarball which you downloaded,
and before compiling/installing the new GTK+, apply the patch
   https://bugzilla.gnome.org/show_bug.cgi?id=660139
Cheers,
        -Tristan
Hi,
Any idea of how to apply the patch?
Do I have to recompile glade once the patch is applied?
Presumably, once my glade file has no empty grids I should
be able to distribute it for use versus the unpatched version
of GTK+3 given that that is what my users will be using?
No you dont have to recompile Glade, GTK+ is api/abi stable.

To apply the patch, you can start with typing "man patch".

If that doesnt get you there, try:

cd /path/to/gtk+/sources/
patch -p1 < /path/to/patch/file

Cheers,
-Tristan
Thanks,
Saku
_______________________________________________
http://lists.ximian.com/mailman/listinfo/glade-devel
_______________________________________________
Glade-devel maillist - Glade-***@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-devel
Saku Masukita
2012-01-17 22:12:05 UTC
Permalink
On Tue, Jan 17, 2012 at 2:31 PM, Tristan Van Berkom <
Post by Tristan Van Berkom
No you dont have to recompile Glade, GTK+ is api/abi stable.
To apply the patch, you can start with typing "man patch".
cd /path/to/gtk+/sources/
patch -p1 < /path/to/patch/file
Cheers,
-Tristan
Thanks Tristan,

That did it.

Saku

Loading...