[gtk+] g_error() as soon as we catch an invalid column type



commit dfe20ea1a8e1a97dfb10a5a7f7834ef1ebb0d81f
Author: Federico Mena Quintero <federico novell com>
Date:   Wed Aug 26 18:38:03 2009 -0500

    g_error() as soon as we catch an invalid column type
    
    There's no point in running a GtkFileSystemModel with invalid column types.
    This way we can also avoid clearing the memory of the column_types array.
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

 gtk/gtkfilesystemmodel.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c
index e2a7c4e..db3fc56 100644
--- a/gtk/gtkfilesystemmodel.c
+++ b/gtk/gtkfilesystemmodel.c
@@ -1090,6 +1090,7 @@ gtk_file_system_model_set_n_columns (GtkFileSystemModel *model,
   guint i;
 
   g_assert (model->files == NULL);
+  g_assert (n_columns > 0);
 
   model->n_columns = n_columns;
   model->column_types = g_slice_alloc0 (sizeof (GType) * n_columns);
@@ -1099,8 +1100,8 @@ gtk_file_system_model_set_n_columns (GtkFileSystemModel *model,
       GType type = va_arg (args, GType);
       if (! _gtk_tree_data_list_check_type (type))
 	{
-	  g_warning ("%s: Invalid type %s\n", G_STRLOC, g_type_name (type));
-          continue;
+	  g_error ("%s: type %s cannot be a column type for GtkFileSystemModel\n", G_STRLOC, g_type_name (type));
+          return; /* not reached */
 	}
 
       model->column_types[i] = type;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]