WIP: simplifications dans builddir/demos/gtk-demo/tree_store.c
This commit is contained in:
parent
3e52de8a09
commit
0c2f313a3b
|
@ -31,24 +31,18 @@ typedef struct _TreeItem TreeItem;
|
||||||
struct _TreeItem
|
struct _TreeItem
|
||||||
{
|
{
|
||||||
const char *label;
|
const char *label;
|
||||||
gboolean alex;
|
gboolean AA;
|
||||||
gboolean havoc;
|
gboolean BB;
|
||||||
gboolean tim;
|
gboolean CC;
|
||||||
gboolean owen;
|
|
||||||
gboolean dave;
|
|
||||||
gboolean world_holiday;
|
|
||||||
TreeItem *children;
|
TreeItem *children;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* columns */
|
/* columns */
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
HOLIDAY_NAME_COLUMN = 0,
|
COLUMN_0,
|
||||||
ALEX_COLUMN,
|
COLUMN_1,
|
||||||
HAVOC_COLUMN,
|
COLUMN_2,
|
||||||
TIM_COLUMN,
|
|
||||||
OWEN_COLUMN,
|
|
||||||
DAVE_COLUMN,
|
|
||||||
|
|
||||||
VISIBLE_COLUMN,
|
VISIBLE_COLUMN,
|
||||||
WORLD_COLUMN,
|
WORLD_COLUMN,
|
||||||
|
@ -56,122 +50,36 @@ enum
|
||||||
};
|
};
|
||||||
|
|
||||||
/* tree data */
|
/* tree data */
|
||||||
static TreeItem january[] =
|
static TreeItem item_name_0[] =
|
||||||
{
|
{
|
||||||
{"New Years Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
|
{"A", TRUE, TRUE, TRUE, NULL },
|
||||||
{"Presidential Inauguration", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
|
{"B", FALSE, TRUE, FALSE, NULL },
|
||||||
{"Martin Luther King Jr. day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
|
{"C", FALSE, TRUE, FALSE, NULL },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static TreeItem february[] =
|
static TreeItem item_name_1[] =
|
||||||
{
|
{
|
||||||
{ "Presidents' Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
|
{ "A", FALSE, TRUE, FALSE, NULL },
|
||||||
{ "Groundhog Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
{ "B", FALSE, FALSE, FALSE, NULL },
|
||||||
{ "Valentine's Day", FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, NULL },
|
{ "C", FALSE, FALSE, TRUE, NULL },
|
||||||
|
{ "D", FALSE, TRUE, TRUE, NULL },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static TreeItem march[] =
|
static TreeItem item_name_2[] =
|
||||||
{
|
{
|
||||||
{ "National Tree Planting Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
{ "A", FALSE, FALSE, FALSE, NULL },
|
||||||
{ "St Patrick's Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
|
{ "B", FALSE, FALSE, TRUE, NULL },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
static TreeItem april[] =
|
|
||||||
{
|
|
||||||
{ "April Fools' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
|
|
||||||
{ "Army Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "Earth Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
|
|
||||||
{ "Administrative Professionals' Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static TreeItem may[] =
|
|
||||||
{
|
|
||||||
{ "Nurses' Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "National Day of Prayer", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "Mothers' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
|
|
||||||
{ "Armed Forces Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "Memorial Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
|
|
||||||
{ NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static TreeItem june[] =
|
|
||||||
{
|
|
||||||
{ "June Fathers' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
|
|
||||||
{ "Juneteenth (Liberation Day)", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "Flag Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
|
|
||||||
{ NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static TreeItem july[] =
|
|
||||||
{
|
|
||||||
{ "Parents' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
|
|
||||||
{ "Independence Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
|
|
||||||
{ NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static TreeItem august[] =
|
|
||||||
{
|
|
||||||
{ "Air Force Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "Coast Guard Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "Friendship Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static TreeItem september[] =
|
|
||||||
{
|
|
||||||
{ "Grandparents' Day", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
|
|
||||||
{ "Citizenship Day or Constitution Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "Labor Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
|
|
||||||
{ NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static TreeItem october[] =
|
|
||||||
{
|
|
||||||
{ "National Children's Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "Bosses' Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "Sweetest Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "Mother-in-Law's Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "Navy Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "Columbus Day", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
|
|
||||||
{ "Halloween", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, NULL },
|
|
||||||
{ NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static TreeItem november[] =
|
|
||||||
{
|
|
||||||
{ "Marine Corps Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "Veterans' Day", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
|
|
||||||
{ "Thanksgiving", FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, NULL },
|
|
||||||
{ NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
static TreeItem december[] =
|
|
||||||
{
|
|
||||||
{ "Pearl Harbor Remembrance Day", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ "Christmas", TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, NULL },
|
|
||||||
{ "Kwanzaa", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, NULL },
|
|
||||||
{ NULL }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static TreeItem toplevel[] =
|
static TreeItem toplevel[] =
|
||||||
{
|
{
|
||||||
{"January", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, january},
|
{"IT-0", FALSE, FALSE, FALSE, item_name_0},
|
||||||
{"February", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, february},
|
{"IT-1", FALSE, FALSE, FALSE, item_name_1},
|
||||||
{"March", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, march},
|
{"IT-2", FALSE, FALSE, FALSE, item_name_2},
|
||||||
{"April", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, april},
|
{ NULL }
|
||||||
{"May", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, may},
|
|
||||||
{"June", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, june},
|
|
||||||
{"July", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, july},
|
|
||||||
{"August", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, august},
|
|
||||||
{"September", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, september},
|
|
||||||
{"October", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, october},
|
|
||||||
{"November", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, november},
|
|
||||||
{"December", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, december},
|
|
||||||
{NULL}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -180,7 +88,7 @@ create_model (void)
|
||||||
{
|
{
|
||||||
GtkTreeStore *model;
|
GtkTreeStore *model;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
TreeItem *month = toplevel;
|
TreeItem *item_0 = toplevel;
|
||||||
|
|
||||||
/* create tree store */
|
/* create tree store */
|
||||||
model = gtk_tree_store_new (NUM_COLUMNS,
|
model = gtk_tree_store_new (NUM_COLUMNS,
|
||||||
|
@ -188,49 +96,40 @@ create_model (void)
|
||||||
G_TYPE_BOOLEAN,
|
G_TYPE_BOOLEAN,
|
||||||
G_TYPE_BOOLEAN,
|
G_TYPE_BOOLEAN,
|
||||||
G_TYPE_BOOLEAN,
|
G_TYPE_BOOLEAN,
|
||||||
G_TYPE_BOOLEAN,
|
|
||||||
G_TYPE_BOOLEAN,
|
|
||||||
G_TYPE_BOOLEAN,
|
|
||||||
G_TYPE_BOOLEAN);
|
G_TYPE_BOOLEAN);
|
||||||
|
|
||||||
/* add data to the tree store */
|
/* add data to the tree store */
|
||||||
while (month->label)
|
while (item_0->label)
|
||||||
{
|
{
|
||||||
TreeItem *holiday = month->children;
|
TreeItem *item_1 = item_0->children;
|
||||||
|
|
||||||
gtk_tree_store_append (model, &iter, NULL);
|
gtk_tree_store_append (model, &iter, NULL);
|
||||||
gtk_tree_store_set (model, &iter,
|
gtk_tree_store_set (model, &iter,
|
||||||
HOLIDAY_NAME_COLUMN, month->label,
|
COLUMN_0, item_0->label,
|
||||||
ALEX_COLUMN, FALSE,
|
COLUMN_1, FALSE,
|
||||||
HAVOC_COLUMN, FALSE,
|
COLUMN_2, FALSE,
|
||||||
TIM_COLUMN, FALSE,
|
|
||||||
OWEN_COLUMN, FALSE,
|
|
||||||
DAVE_COLUMN, FALSE,
|
|
||||||
VISIBLE_COLUMN, FALSE,
|
VISIBLE_COLUMN, FALSE,
|
||||||
WORLD_COLUMN, FALSE,
|
WORLD_COLUMN, FALSE,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
/* add children */
|
/* add children */
|
||||||
while (holiday->label)
|
while (item_1->label)
|
||||||
{
|
{
|
||||||
GtkTreeIter child_iter;
|
GtkTreeIter child_iter;
|
||||||
|
|
||||||
gtk_tree_store_append (model, &child_iter, &iter);
|
gtk_tree_store_append (model, &child_iter, &iter);
|
||||||
gtk_tree_store_set (model, &child_iter,
|
gtk_tree_store_set (model, &child_iter,
|
||||||
HOLIDAY_NAME_COLUMN, holiday->label,
|
COLUMN_0, item_1->label,
|
||||||
ALEX_COLUMN, holiday->alex,
|
COLUMN_1, item_1->AA,
|
||||||
HAVOC_COLUMN, holiday->havoc,
|
COLUMN_2, item_1->BB,
|
||||||
TIM_COLUMN, holiday->tim,
|
|
||||||
OWEN_COLUMN, holiday->owen,
|
|
||||||
DAVE_COLUMN, holiday->dave,
|
|
||||||
VISIBLE_COLUMN, TRUE,
|
VISIBLE_COLUMN, TRUE,
|
||||||
WORLD_COLUMN, holiday->world_holiday,
|
WORLD_COLUMN, item_1->CC,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
holiday++;
|
item_1++;
|
||||||
}
|
}
|
||||||
|
|
||||||
month++;
|
item_0++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GTK_TREE_MODEL (model);
|
return GTK_TREE_MODEL (model);
|
||||||
|
@ -270,127 +169,46 @@ add_columns (GtkTreeView *treeview)
|
||||||
{
|
{
|
||||||
int col_offset;
|
int col_offset;
|
||||||
GtkCellRenderer *renderer;
|
GtkCellRenderer *renderer;
|
||||||
GtkTreeViewColumn *column;
|
// GtkTreeViewColumn *column;
|
||||||
GtkTreeModel *model = gtk_tree_view_get_model (treeview);
|
GtkTreeModel *model = gtk_tree_view_get_model (treeview);
|
||||||
|
|
||||||
/* column for holiday names */
|
/* column for item_1 names */
|
||||||
renderer = gtk_cell_renderer_text_new ();
|
renderer = gtk_cell_renderer_text_new ();
|
||||||
g_object_set (renderer, "xalign", 0.0, NULL);
|
g_object_set (renderer, "xalign", 0.0, NULL);
|
||||||
|
|
||||||
col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
|
col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, "Col 0", renderer, "text",
|
||||||
-1, "Holiday",
|
COLUMN_0, NULL);
|
||||||
renderer, "text",
|
/* column = */ gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
|
||||||
HOLIDAY_NAME_COLUMN,
|
// gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
||||||
NULL);
|
|
||||||
column = gtk_tree_view_get_column (GTK_TREE_VIEW (treeview), col_offset - 1);
|
|
||||||
gtk_tree_view_column_set_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
|
||||||
|
|
||||||
/* alex column */
|
/* AA column */
|
||||||
renderer = gtk_cell_renderer_toggle_new ();
|
renderer = gtk_cell_renderer_toggle_new ();
|
||||||
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 *)ALEX_COLUMN);
|
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),
|
col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, "Col 1", renderer, "active",
|
||||||
-1, "Alex",
|
COLUMN_1, "visible", VISIBLE_COLUMN, "activatable", WORLD_COLUMN, NULL);
|
||||||
renderer,
|
|
||||||
"active",
|
|
||||||
ALEX_COLUMN,
|
|
||||||
"visible",
|
|
||||||
VISIBLE_COLUMN,
|
|
||||||
"activatable",
|
|
||||||
WORLD_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_set_sizing (GTK_TREE_VIEW_COLUMN (column), GTK_TREE_VIEW_COLUMN_FIXED);
|
||||||
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);
|
|
||||||
|
|
||||||
/* havoc column */
|
/* BB column */
|
||||||
renderer = gtk_cell_renderer_toggle_new ();
|
renderer = gtk_cell_renderer_toggle_new ();
|
||||||
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 *)HAVOC_COLUMN);
|
g_object_set_data (G_OBJECT (renderer), "column", (int *)COLUMN_2);
|
||||||
|
|
||||||
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),
|
col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, "Col 2", renderer, "active",
|
||||||
-1, "Havoc",
|
COLUMN_2, "visible", VISIBLE_COLUMN, NULL);
|
||||||
renderer,
|
|
||||||
"active",
|
|
||||||
HAVOC_COLUMN,
|
|
||||||
"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_set_sizing (GTK_TREE_VIEW_COLUMN (column), GTK_TREE_VIEW_COLUMN_FIXED);
|
||||||
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);
|
|
||||||
|
|
||||||
/* tim column */
|
|
||||||
renderer = gtk_cell_renderer_toggle_new ();
|
|
||||||
g_object_set (renderer, "xalign", 0.0, NULL);
|
|
||||||
g_object_set_data (G_OBJECT (renderer), "column", (int *)TIM_COLUMN);
|
|
||||||
|
|
||||||
g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
|
|
||||||
|
|
||||||
col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
|
|
||||||
-1, "Tim",
|
|
||||||
renderer,
|
|
||||||
"active",
|
|
||||||
TIM_COLUMN,
|
|
||||||
"visible",
|
|
||||||
VISIBLE_COLUMN,
|
|
||||||
"activatable",
|
|
||||||
WORLD_COLUMN, NULL);
|
|
||||||
|
|
||||||
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_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
|
||||||
|
|
||||||
/* owen column */
|
|
||||||
renderer = gtk_cell_renderer_toggle_new ();
|
|
||||||
g_object_set (renderer, "xalign", 0.0, NULL);
|
|
||||||
g_object_set_data (G_OBJECT (renderer), "column", (int *)OWEN_COLUMN);
|
|
||||||
|
|
||||||
g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
|
|
||||||
|
|
||||||
col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
|
|
||||||
-1, "Owen",
|
|
||||||
renderer,
|
|
||||||
"active",
|
|
||||||
OWEN_COLUMN,
|
|
||||||
"visible",
|
|
||||||
VISIBLE_COLUMN,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
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_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
|
||||||
|
|
||||||
/* dave column */
|
|
||||||
renderer = gtk_cell_renderer_toggle_new ();
|
|
||||||
g_object_set (renderer, "xalign", 0.0, NULL);
|
|
||||||
g_object_set_data (G_OBJECT (renderer), "column", (int *)DAVE_COLUMN);
|
|
||||||
|
|
||||||
g_signal_connect (renderer, "toggled", G_CALLBACK (item_toggled), model);
|
|
||||||
|
|
||||||
col_offset = gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview),
|
|
||||||
-1, "Dave",
|
|
||||||
renderer,
|
|
||||||
"active",
|
|
||||||
DAVE_COLUMN,
|
|
||||||
"visible",
|
|
||||||
VISIBLE_COLUMN,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
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_clickable (GTK_TREE_VIEW_COLUMN (column), TRUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
|
@ -420,7 +238,7 @@ do_tree_store (GtkWidget *do_widget)
|
||||||
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
gtk_window_set_child (GTK_WINDOW (window), vbox);
|
||||||
|
|
||||||
gtk_box_append (GTK_BOX (vbox),
|
gtk_box_append (GTK_BOX (vbox),
|
||||||
gtk_label_new ("Jonathan's Holiday Card Planning Sheet"));
|
gtk_label_new ("Learning GTK trees"));
|
||||||
|
|
||||||
sw = gtk_scrolled_window_new ();
|
sw = gtk_scrolled_window_new ();
|
||||||
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
|
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (sw), TRUE);
|
||||||
|
|
Loading…
Reference in New Issue