[gtk+/filesystemmodel] Put the list of column types in a macro
- From: Federico Mena Quintero <federico src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+/filesystemmodel] Put the list of column types in a macro
- Date: Fri, 11 Sep 2009 21:15:14 +0000 (UTC)
commit 5a80b1fb2d16944e9e2e64d40666a74a7dff530e
Author: Federico Mena Quintero <federico novell com>
Date: Fri Sep 11 14:28:36 2009 -0500
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>
gtk/gtkfilechooserdefault.c | 58 +++++++++++++++----------------------------
1 files changed, 20 insertions(+), 38 deletions(-)
---
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 1469990..6538b02 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,
@@ -6650,20 +6664,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);
@@ -8811,18 +8815,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,
@@ -9115,18 +9108,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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]