gui: Properly manage ref counts of combo box and tree view models.
[pspp] / src / ui / gui / checkbox-treeview.c
index 837fcc789550e13b0463dc28987ca5c34c967985..324943ab84364f743040503379d086acdddf9b0e 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2007  Free Software Foundation
+   Copyright (C) 2007, 2012  Free Software Foundation
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -55,18 +55,20 @@ treeview_create_checkbox_model (GtkTreeView *treeview,
 
   list = gtk_list_store_new (N_CHECKBOX_COLUMNS,
                             G_TYPE_STRING, G_TYPE_BOOLEAN);
-  gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (list));
 
   for (i = 0; i < n_items; i++)
     {
       GtkTreeIter iter;
       gtk_list_store_append (list, &iter);
       gtk_list_store_set (list, &iter,
-                          CHECKBOX_COLUMN_LABEL, items[i].label,
+                          CHECKBOX_COLUMN_LABEL, gettext (items[i].label),
                           CHECKBOX_COLUMN_SELECTED,
                          (default_items & (1u << i)) != 0,
                           -1);
     }
+
+  gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (list));
+  g_object_unref (list);
 }
 
 static void