summaryrefslogtreecommitdiff
path: root/gtk/gtkfilechooserdefault.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@novell.com>2009-09-11 14:28:36 -0500
committerBenjamin Otte <otte@gnome.org>2009-10-15 22:06:19 +0200
commitc39e8af7f4f527dbee1b01e5ae4c14d93c58185d (patch)
tree379fa58eb191c694e6ba25cece47ba8a1b1e7b24 /gtk/gtkfilechooserdefault.c
parent4c242317b0e621f87500e41c1043b5bea223d17c (diff)
downloadgdk-pixbuf-c39e8af7f4f527dbee1b01e5ae4c14d93c58185d.tar.gz
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>
Diffstat (limited to 'gtk/gtkfilechooserdefault.c')
-rw-r--r--gtk/gtkfilechooserdefault.c58
1 files changed, 20 insertions, 38 deletions
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 9d0593b1c..67d0ee5ec 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -209,6 +209,20 @@ enum {
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 */
enum {
GTK_TREE_MODEL_ROW,
@@ -6748,20 +6762,10 @@ set_list_model (GtkFileChooserDefault *impl,
impl->browse_files_model =
_gtk_file_system_model_new_for_directory (impl->current_folder,
- MODEL_ATTRIBUTES,
- file_system_model_set,
- impl,
- MODEL_COL_NUM_COLUMNS,
- 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);
+ MODEL_ATTRIBUTES,
+ file_system_model_set,
+ impl,
+ MODEL_COLUMN_TYPES);
_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,
- 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 */
- );
+ MODEL_COLUMN_TYPES);
gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->search_model),
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,
- 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 */
- );
+ MODEL_COLUMN_TYPES);
_gtk_file_system_model_set_filter (impl->recent_model,
impl->current_filter);