vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);
}
-GtkListStore *generate_store()
+static GtkListStore *
+category_generate_store()
{
GtkTreeIter iter;
GtkListStore *store;
while (SQLITE_ROW == sqlite3_step(_stmt_selall_cat)) {
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
- CAT_ID, sqlite3_column_int(_stmt_selall_cat,
- 0), CAT_ENABLED,
- sqlite3_column_int(_stmt_selall_cat, 3),
- CAT_LABEL,
- sqlite3_column_text(_stmt_selall_cat, 1),
- CAT_DESC,
- sqlite3_column_text(_stmt_selall_cat, 2),
- CAT_POI_CNT,
- sqlite3_column_int(_stmt_selall_cat, 4), -1);
+ CAT_ID, sqlite3_column_int(_stmt_selall_cat, 0),
+ CAT_ENABLED, sqlite3_column_int(_stmt_selall_cat, 3),
+ CAT_LABEL, sqlite3_column_text(_stmt_selall_cat, 1),
+ CAT_DESC, sqlite3_column_text(_stmt_selall_cat, 2),
+ CAT_POI_CNT, sqlite3_column_int(_stmt_selall_cat, 6), -1);
}
sqlite3_reset(_stmt_selall_cat);
return store;
}
-gboolean category_add(GtkWidget * widget, GtkWidget * tree_view)
+gboolean
+category_add(GtkWidget * widget, GtkWidget * tree_view)
{
GtkListStore *store;
printf("%s()\n", __PRETTY_FUNCTION__);
if (category_dialog(0)) {
- store = generate_store();
+ store = category_generate_store();
gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view),
GTK_TREE_MODEL(store));
g_object_unref(G_OBJECT(store));
memset(&val, 0, sizeof(val));
gtk_tree_model_get_value(store, &iter, 0, &val);
if (category_dialog(g_value_get_uint(&val))) {
- GtkListStore *new_store = generate_store();
+ GtkListStore *new_store = category_generate_store();
gtk_tree_view_set_model(GTK_TREE_VIEW(tree_view),
GTK_TREE_MODEL(new_store));
g_object_unref(G_OBJECT(new_store));
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area),
btn_add = gtk_button_new_with_label(_("Add")));
- store = generate_store();
+ store = category_generate_store();
if (!store)
return TRUE;
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree_view), TRUE);
renderer = gtk_cell_renderer_text_new();
- column =
- gtk_tree_view_column_new_with_attributes(_("ID"), renderer, "text",
- CAT_ID, NULL);
+ column = gtk_tree_view_column_new_with_attributes(_("ID"), renderer, "text", CAT_ID, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
gtk_tree_view_column_set_max_width(column, 1);
renderer = gtk_cell_renderer_toggle_new();
g_signal_connect(renderer, "toggled",
G_CALLBACK(category_toggled), store);
- column =
- gtk_tree_view_column_new_with_attributes(_("Enabled"), renderer,
+ column = gtk_tree_view_column_new_with_attributes(_("Enabled"), renderer,
"active", CAT_ENABLED,
NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
+ gtk_tree_view_column_set_sort_column_id (column, CAT_ENABLED);
g_object_unref(G_OBJECT(store));
renderer = gtk_cell_renderer_text_new();
- column =
- gtk_tree_view_column_new_with_attributes(_("Label"), renderer,
+ column = gtk_tree_view_column_new_with_attributes(_("Label"), renderer,
"text", CAT_LABEL, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
+ gtk_tree_view_column_set_sort_column_id (column, CAT_LABEL);
renderer = gtk_cell_renderer_text_new();
- column =
- gtk_tree_view_column_new_with_attributes(_("Description"), renderer,
+ column = gtk_tree_view_column_new_with_attributes(_("Description"), renderer,
"text", CAT_DESC, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
renderer = gtk_cell_renderer_text_new();
- column =
- gtk_tree_view_column_new_with_attributes(_("# POIs"), renderer,
+ column = gtk_tree_view_column_new_with_attributes(_("# POIs"), renderer,
"text", CAT_POI_CNT, NULL);
gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), column);
+ gtk_tree_view_column_set_sort_column_id (column, CAT_POI_CNT);
gtk_window_set_default_size(GTK_WINDOW(dialog), 500, 300);
gtk_widget_show_all(dialog);