Hope I’m in right place…
I have a GtkTreeView developed with Glade. I originally implemented it with Gtk-Perl. Am now in process of porting to C. In C, when the GtkTreeStore is populated, the expanders will not work. They worked in Perl. I basically translated the Perl code to C, and I believe I have duplicated the steps. It’s populated from a database, and, if I call gtk_tree_view_expand_all(), the data is there. The window acts as if its sensitivity is turned off, but I cannot find anything about sensitivity for a TreeView. Below is part of code - I eliminated the code for the mainline data for brevity and clarity, but if I try the part I’ve provided, I still get disabled expanders. I may have eliminated some variable definitions but here is the code:
This is a MenuItem Activate callback. It’s probably something evident but I cannot figure it out.
void
on_full_itemized_list1_print(GtkMenuItem *mi, GtkTreeView *view)
{
PGconn *myConn;
GtkTreeStore *model = GTK_TREE_STORE(gtk_tree_view_get_model(view));
GPtrArray *expanded_rows = NULL;
gchar *IncExp[] = {"inc", "exp", NULL};
gchar **inex = IncExp;
while (*inex != NULL)
{
gchar yr[10];
GtkTreeIter topIter;
// Create top iter
if (PQntuples(cgyRslt) > 0)
{
GString *ttl;
ttl = g_string_new(yr);
g_string_append(ttl,
(strcmp(*inex, "inc") == 0) ? " INCOME" : " EXPENSE");
gtk_tree_store_append(model, &topIter, NULL);
gtk_tree_store_set(model, &topIter, 0, ttl->str, -1);
g_string_free(ttl, TRUE);
}
for (int thisCgy = 0; thisCgy < PQntuples(cgyRslt); thisCgy++)
{
PGresult *listRslt;
gchar cgyName[50];
strncpy(cgyName, PQgetvalue(cgyRslt, thisCgy, 1), sizeof(cgyName));
if ((listRslt != NULL) && (PQntuples(listRslt) > 0))
{
GtkTreeIter cgyNameItr, monthIter;
gchar markupCgyName[50];
// Set a Category name Iter
gtk_tree_store_append(model, &cgyNameItr, &topIter);
gtk_tree_store_set(model, &cgyNameItr, 1, cgyName, -1);
}
}
++inex; // Last line in LOOP
}
}