summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Clasen <matthiasc@src.gnome.org>2004-05-27 03:31:17 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2004-05-27 03:31:17 +0000
commit310fd268e7498582755fd21bcf5428794a832bc0 (patch)
tree9323eafee5beacd4743fd73599b1a82a11658958 /tests
parent7c200f8a9c9985c483f6293d79d8b4192e2e6a4a (diff)
downloadgtk+-310fd268e7498582755fd21bcf5428794a832bc0.tar.gz
Support insensitive cells in tree views and combo boxes.
Diffstat (limited to 'tests')
-rw-r--r--tests/testcombo.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/testcombo.c b/tests/testcombo.c
index 2fc79715db..157963d583 100644
--- a/tests/testcombo.c
+++ b/tests/testcombo.c
@@ -183,6 +183,26 @@ setup_combo_entry (GtkWidget *entry_box)
"klaas");
}
+static void
+set_sensitive (GtkCellLayout *cell_layout,
+ GtkCellRenderer *cell,
+ GtkTreeModel *tree_model,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ GtkTreePath *path;
+ gint *indices;
+ gboolean sensitive;
+
+ path = gtk_tree_model_get_path (tree_model, iter);
+ indices = gtk_tree_path_get_indices (path);
+
+ sensitive = indices[0] % 2;
+ gtk_tree_path_free (path);
+
+ g_object_set (cell, "sensitive", sensitive, NULL);
+}
+
int
main (int argc, char **argv)
{
@@ -259,6 +279,10 @@ main (int argc, char **argv)
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
"pixbuf", 0,
NULL);
+ gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combobox),
+ renderer,
+ set_sensitive,
+ NULL, NULL);
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox),
@@ -267,7 +291,10 @@ main (int argc, char **argv)
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), renderer,
"text", 1,
NULL);
-
+ gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combobox),
+ renderer,
+ set_sensitive,
+ NULL, NULL);
gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), 1);