WIP: before removing item_toggled()
This commit is contained in:
parent
271206f4ec
commit
cc899e13c9
|
@ -32,7 +32,6 @@ struct _TreeItem
|
||||||
{
|
{
|
||||||
const char *label;
|
const char *label;
|
||||||
gboolean AA;
|
gboolean AA;
|
||||||
gboolean BB;
|
|
||||||
gboolean CC;
|
gboolean CC;
|
||||||
TreeItem *children;
|
TreeItem *children;
|
||||||
};
|
};
|
||||||
|
@ -42,7 +41,6 @@ enum
|
||||||
{
|
{
|
||||||
COLUMN_0,
|
COLUMN_0,
|
||||||
COLUMN_1,
|
COLUMN_1,
|
||||||
COLUMN_2,
|
|
||||||
|
|
||||||
VISIBLE_COLUMN,
|
VISIBLE_COLUMN,
|
||||||
WORLD_COLUMN,
|
WORLD_COLUMN,
|
||||||
|
@ -52,33 +50,33 @@ enum
|
||||||
/* tree data */
|
/* tree data */
|
||||||
static TreeItem item_name_0[] =
|
static TreeItem item_name_0[] =
|
||||||
{
|
{
|
||||||
{ "A", TRUE, TRUE, TRUE, NULL },
|
{ "A", TRUE, TRUE, NULL },
|
||||||
{ "B", FALSE, TRUE, FALSE, NULL },
|
{ "B", FALSE, TRUE, NULL },
|
||||||
{ "C", FALSE, TRUE, FALSE, NULL },
|
{ "C", FALSE, TRUE, NULL },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static TreeItem item_name_1[] =
|
static TreeItem item_name_1[] =
|
||||||
{
|
{
|
||||||
{ "A", FALSE, TRUE, FALSE, NULL },
|
{ "A", FALSE, TRUE, NULL },
|
||||||
{ "B", FALSE, FALSE, FALSE, NULL },
|
{ "B", FALSE, FALSE, NULL },
|
||||||
{ "C", FALSE, FALSE, TRUE, NULL },
|
{ "C", FALSE, TRUE, NULL },
|
||||||
{ "D", FALSE, TRUE, TRUE, NULL },
|
{ "D", FALSE, TRUE, NULL },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static TreeItem item_name_2[] =
|
static TreeItem item_name_2[] =
|
||||||
{
|
{
|
||||||
{ "A", FALSE, FALSE, FALSE, NULL },
|
{ "A", FALSE, FALSE, NULL },
|
||||||
{ "B", FALSE, FALSE, TRUE, NULL },
|
{ "B", FALSE, TRUE, NULL },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static TreeItem toplevel[] =
|
static TreeItem root[] =
|
||||||
{
|
{
|
||||||
{ "IT-0", FALSE, FALSE, FALSE, item_name_0 },
|
{ "IT-0", FALSE, FALSE, item_name_0 },
|
||||||
{ "IT-1", FALSE, FALSE, FALSE, item_name_1 },
|
{ "IT-1", FALSE, FALSE, item_name_1 },
|
||||||
{ "IT-2", FALSE, FALSE, FALSE, item_name_2 },
|
{ "IT-2", FALSE, FALSE, item_name_2 },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -88,7 +86,7 @@ create_model (void)
|
||||||
{
|
{
|
||||||
GtkTreeStore *model;
|
GtkTreeStore *model;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
TreeItem *item_0 = toplevel;
|
TreeItem *item_0 = root;
|
||||||
|
|
||||||
/* create tree store */
|
/* create tree store */
|
||||||
model = gtk_tree_store_new (NUM_COLUMNS,
|
model = gtk_tree_store_new (NUM_COLUMNS,
|
||||||
|
@ -107,7 +105,6 @@ create_model (void)
|
||||||
gtk_tree_store_set (model, &iter,
|
gtk_tree_store_set (model, &iter,
|
||||||
COLUMN_0, item_0->label,
|
COLUMN_0, item_0->label,
|
||||||
COLUMN_1, FALSE,
|
COLUMN_1, FALSE,
|
||||||
COLUMN_2, FALSE,
|
|
||||||
VISIBLE_COLUMN, FALSE,
|
VISIBLE_COLUMN, FALSE,
|
||||||
WORLD_COLUMN, FALSE,
|
WORLD_COLUMN, FALSE,
|
||||||
-1);
|
-1);
|
||||||
|
@ -121,7 +118,6 @@ create_model (void)
|
||||||
gtk_tree_store_set (model, &child_iter,
|
gtk_tree_store_set (model, &child_iter,
|
||||||
COLUMN_0, item_1->label,
|
COLUMN_0, item_1->label,
|
||||||
COLUMN_1, item_1->AA,
|
COLUMN_1, item_1->AA,
|
||||||
COLUMN_2, item_1->BB,
|
|
||||||
VISIBLE_COLUMN, TRUE,
|
VISIBLE_COLUMN, TRUE,
|
||||||
WORLD_COLUMN, item_1->CC,
|
WORLD_COLUMN, item_1->CC,
|
||||||
-1);
|
-1);
|
||||||
|
@ -135,7 +131,7 @@ create_model (void)
|
||||||
return GTK_TREE_MODEL (model);
|
return GTK_TREE_MODEL (model);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void // https://www.gnu.org/software/guile-gnome/docs/gtk/html/GtkCellRendererToggle.html
|
||||||
item_toggled (GtkCellRendererToggle *cell,
|
item_toggled (GtkCellRendererToggle *cell,
|
||||||
char *path_str,
|
char *path_str,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
|
@ -186,7 +182,7 @@ add_columns (GtkTreeView *treeview)
|
||||||
g_object_set (renderer, "xalign", 0.0, NULL);
|
g_object_set (renderer, "xalign", 0.0, NULL);
|
||||||
g_object_set_data (G_OBJECT (renderer), "column", (int *)COLUMN_1);
|
g_object_set_data (G_OBJECT (renderer), "column", (int *)COLUMN_1);
|
||||||
|
|
||||||
g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
|
// g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
|
||||||
|
|
||||||
col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, "Col 1", renderer, "active",
|
col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, "Col 1", renderer, "active",
|
||||||
COLUMN_1, "visible", VISIBLE_COLUMN, "activatable", WORLD_COLUMN, NULL);
|
COLUMN_1, "visible", VISIBLE_COLUMN, "activatable", WORLD_COLUMN, NULL);
|
||||||
|
@ -195,16 +191,6 @@ add_columns (GtkTreeView *treeview)
|
||||||
// gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column), GTK_TREE_VIEW_COLUMN_FIXED);
|
// gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column), GTK_TREE_VIEW_COLUMN_FIXED);
|
||||||
// gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
// gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
||||||
|
|
||||||
/* BB column */
|
|
||||||
renderer = gtk_cell_renderer_toggle_new ();
|
|
||||||
g_object_set (renderer, "xalign", 0.0, NULL);
|
|
||||||
g_object_set_data (G_OBJECT (renderer), "column", (int *)COLUMN_2);
|
|
||||||
|
|
||||||
g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
|
|
||||||
|
|
||||||
col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, "Col 2", renderer, "active",
|
|
||||||
COLUMN_2, "visible", VISIBLE_COLUMN, NULL);
|
|
||||||
|
|
||||||
/* column = */ gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
|
/* column = */ gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
|
||||||
// gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column), GTK_TREE_VIEW_COLUMN_FIXED);
|
// gtk_tree_view_column_set_sizing (GTK_TREE_VIEW_COLUMN (column), GTK_TREE_VIEW_COLUMN_FIXED);
|
||||||
// gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
// gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
||||||
|
|
Loading…
Reference in New Issue