gui: Properly manage ref counts of combo box and tree view models.
[pspp] / src / ui / gui / aggregate-dialog.c
index 2ebb844ed5422273713dff074c04c445583b4649..7a48fce850603eec83e7672ee92af4688cd19564 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2010, 2011  Free Software Foundation
+   Copyright (C) 2010, 2011, 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
@@ -35,6 +35,7 @@
 #include "dict-display.h"
 
 #include "executor.h"
+#include "builder-wrapper.h"
 #include "helper.h"
 
 #include <gtk/gtk.h>
@@ -171,14 +172,12 @@ choose_filename (struct aggregate *fd)
 
   filter = gtk_file_filter_new ();
   gtk_file_filter_set_name (filter, _("System Files (*.sav)"));
-  gtk_file_filter_add_pattern (filter, "*.sav");
-  gtk_file_filter_add_pattern (filter, "*.SAV");
+  gtk_file_filter_add_mime_type (filter, "application/x-spss-sav");
   gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
 
   filter = gtk_file_filter_new ();
   gtk_file_filter_set_name (filter, _("Portable Files (*.por) "));
-  gtk_file_filter_add_pattern (filter, "*.por");
-  gtk_file_filter_add_pattern (filter, "*.POR");
+  gtk_file_filter_add_mime_type (filter, "application/x-spss-por");
   gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), filter);
 
 
@@ -227,6 +226,7 @@ populate_combo_model (GtkComboBox *cb)
   gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (cb), renderer, "text", 0);
 
   gtk_combo_box_set_model (GTK_COMBO_BOX (cb), GTK_TREE_MODEL (list));
+  g_object_unref (list);
 }
 
 
@@ -528,6 +528,7 @@ aggregate_dialog (PsppireDataWindow *dw)
                                             G_TYPE_DOUBLE);
 
     psppire_acr_set_model (PSPPIRE_ACR (fd.summary_acr), list);
+    g_object_unref (list);
 
     psppire_acr_set_get_value_func (PSPPIRE_ACR (fd.summary_acr),
                                                 get_summary_spec, &fd);