Put the list of column types in a macro

Every call to _gtk_file_system_model_new*() gets the same list of column types,
so we now keep the list in a macro instead of having duplicated copies all around.

Signed-off-by: Federico Mena Quintero <federico@novell.com>
This commit is contained in:
Federico Mena Quintero 2009-09-11 14:28:36 -05:00 committed by Benjamin Otte
parent 4c242317b0
commit c39e8af7f4

View File

@ -209,6 +209,20 @@ enum {
MODEL_COL_NUM_COLUMNS MODEL_COL_NUM_COLUMNS
}; };
/* This list of types is passed to _gtk_file_system_model_new*() */
#define MODEL_COLUMN_TYPES \
MODEL_COL_NUM_COLUMNS, \
G_TYPE_STRING, /* MODEL_COL_NAME */ \
G_TYPE_INT64, /* MODEL_COL_SIZE */ \
G_TYPE_LONG, /* MODEL_COL_MTIME */ \
G_TYPE_FILE, /* MODEL_COL_FILE */ \
G_TYPE_STRING, /* MODEL_COL_NAME_COLLATED */ \
G_TYPE_BOOLEAN, /* MODEL_COL_IS_FOLDER */ \
GDK_TYPE_PIXBUF, /* MODEL_COL_PIXBUF */ \
G_TYPE_STRING, /* MODEL_COL_SIZE_TEXT */ \
G_TYPE_STRING, /* MODEL_COL_MTIME_TEXT */ \
PANGO_TYPE_ELLIPSIZE_MODE /* MODEL_COL_ELLIPSIZE */
/* Identifiers for target types */ /* Identifiers for target types */
enum { enum {
GTK_TREE_MODEL_ROW, GTK_TREE_MODEL_ROW,
@ -6748,20 +6762,10 @@ set_list_model (GtkFileChooserDefault *impl,
impl->browse_files_model = impl->browse_files_model =
_gtk_file_system_model_new_for_directory (impl->current_folder, _gtk_file_system_model_new_for_directory (impl->current_folder,
MODEL_ATTRIBUTES, MODEL_ATTRIBUTES,
file_system_model_set, file_system_model_set,
impl, impl,
MODEL_COL_NUM_COLUMNS, MODEL_COLUMN_TYPES);
G_TYPE_STRING,
G_TYPE_INT64,
G_TYPE_LONG,
G_TYPE_FILE,
G_TYPE_STRING,
G_TYPE_BOOLEAN,
GDK_TYPE_PIXBUF,
G_TYPE_STRING,
G_TYPE_STRING,
PANGO_TYPE_ELLIPSIZE_MODE);
_gtk_file_system_model_set_show_hidden (impl->browse_files_model, impl->show_hidden); _gtk_file_system_model_set_show_hidden (impl->browse_files_model, impl->show_hidden);
@ -8909,18 +8913,7 @@ search_setup_model (GtkFileChooserDefault *impl)
impl->search_model = _gtk_file_system_model_new (file_system_model_set, impl->search_model = _gtk_file_system_model_new (file_system_model_set,
impl, impl,
MODEL_COL_NUM_COLUMNS, MODEL_COLUMN_TYPES);
G_TYPE_STRING, /* MODEL_COL_NAME */
G_TYPE_INT64, /* MODEL_COL_SIZE */
G_TYPE_LONG, /* MODEL_COL_MTIME */
G_TYPE_FILE, /* MODEL_COL_FILE */
G_TYPE_STRING, /* MODEL_COL_NAME_COLLATED */
G_TYPE_BOOLEAN, /* MODEL_COL_IS_FOLDER */
GDK_TYPE_PIXBUF, /* MODEL_COL_PIXBUF */
G_TYPE_STRING, /* MODEL_COL_SIZE_TEXT */
G_TYPE_STRING, /* MODEL_COL_MTIME_TEXT */
PANGO_TYPE_ELLIPSIZE_MODE /* MODEL_COL_ELLIPSIZE */
);
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->search_model), gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->search_model),
MODEL_COL_NAME, MODEL_COL_NAME,
@ -9216,18 +9209,7 @@ recent_setup_model (GtkFileChooserDefault *impl)
impl->recent_model = _gtk_file_system_model_new (file_system_model_set, impl->recent_model = _gtk_file_system_model_new (file_system_model_set,
impl, impl,
MODEL_COL_NUM_COLUMNS, MODEL_COLUMN_TYPES);
G_TYPE_STRING, /* MODEL_COL_NAME */
G_TYPE_INT64, /* MODEL_COL_SIZE */
G_TYPE_LONG, /* MODEL_COL_MTIME */
G_TYPE_FILE, /* MODEL_COL_FILE */
G_TYPE_STRING, /* MODEL_COL_NAME_COLLATED */
G_TYPE_BOOLEAN, /* MODEL_COL_IS_FOLDER */
GDK_TYPE_PIXBUF, /* MODEL_COL_PIXBUF */
G_TYPE_STRING, /* MODEL_COL_SIZE_TEXT */
G_TYPE_STRING, /* MODEL_COL_MTIME_TEXT */
PANGO_TYPE_ELLIPSIZE_MODE /* MODEL_COL_ELLIPSIZE */
);
_gtk_file_system_model_set_filter (impl->recent_model, _gtk_file_system_model_set_filter (impl->recent_model,
impl->current_filter); impl->current_filter);