The visible columns in the detailed list view should be configurable in a similar way to what Nautilus does. For storage (-> ThunarPreferences), we should use a GBoxed type, which serializes the list of visible columns to a string. Each column is assigned an alpha character (e.g. name -> 'a', type -> 'b', size -> 'c', etc.). E.g. "CAb" is then size (visible), name (visible) and type (invisible).
Better idea: Separate the ThunarColumn by visible and special columns: Index: thunar-enum-types.c =================================================================== --- thunar-enum-types.c (revision 19869) +++ thunar-enum-types.c (working copy) @@ -59,13 +59,13 @@ { { THUNAR_COLUMN_DATE_ACCESSED, "THUNAR_COLUMN_DATE_ACCESSED", "date-accessed", }, { THUNAR_COLUMN_DATE_MODIFIED, "THUNAR_COLUMN_DATE_MODIFIED", "date-modified", }, - { THUNAR_COLUMN_FILE, "THUNAR_COLUMN_FILE", "file", }, { THUNAR_COLUMN_MIME_TYPE, "THUNAR_COLUMN_MIME_TYPE", "mime-type", }, { THUNAR_COLUMN_NAME, "THUNAR_COLUMN_NAME", "name", }, { THUNAR_COLUMN_PERMISSIONS, "THUNAR_COLUMN_PERMISSIONS", "permissions", }, - { THUNAR_COLUMN_REAL_NAME, "THUNAR_COLUMN_REAL_NAME", "real-name", }, { THUNAR_COLUMN_SIZE, "THUNAR_COLUMN_SIZE", "size", }, { THUNAR_COLUMN_TYPE, "THUNAR_COLUMN_TYPE", "type", }, + { THUNAR_COLUMN_FILE, "THUNAR_COLUMN_FILE", "file", }, + { THUNAR_COLUMN_REAL_NAME, "THUNAR_COLUMN_REAL_NAME", "real-name", }, { 0, NULL, NULL, }, }; Index: thunar-enum-types.h =================================================================== --- thunar-enum-types.h (revision 19869) +++ thunar-enum-types.h (working copy) @@ -60,19 +60,29 @@ * * Columns exported by #ThunarListModel using the #GtkTreeModel * interface. + * + * Keep this in sync with the #ThunarColumnModel class. **/ typedef enum { + /* visible columns */ THUNAR_COLUMN_DATE_ACCESSED, THUNAR_COLUMN_DATE_MODIFIED, - THUNAR_COLUMN_FILE, THUNAR_COLUMN_MIME_TYPE, THUNAR_COLUMN_NAME, THUNAR_COLUMN_PERMISSIONS, - THUNAR_COLUMN_REAL_NAME, THUNAR_COLUMN_SIZE, THUNAR_COLUMN_TYPE, + + /* special, internal columns */ + THUNAR_COLUMN_FILE, + THUNAR_COLUMN_REAL_NAME, + + /* number of columns */ THUNAR_N_COLUMNS, + + /* number of visible columns */ + THUNAR_N_VISIBLE_COLUMNS = THUNAR_COLUMN_FILE, } ThunarColumn; GType thunar_column_get_type (void) G_GNUC_CONST G_GNUC_INTERNAL; Add a class ThunarColumnModel, which contains the information about the columns: typedef struct _ThunarColumnModelClass ThunarColumnModelClass; typedef struct _ThunarColumnModel ThunarColumnModel; #define THUNAR_TYPE_COLUMN_MODEL (thunar_column_model_get_type ()) GType thunar_column_model_get_type (void) G_GNUC_CONST; ThunarColumnModel *thunar_column_model_get_default (void); const ThunarColumn *thunar_column_model_get_column_order (ThunarColumnModel *column_model, gint *n_columns); const gchar *thunar_column_model_get_column_name (ThunarColumnModel *column_model, ThunarColumn column); gboolean thunar_column_model_get_column_visible (ThunarColumnModel *column_model, ThunarColumn column); void thunar_column_model_set_column_visible (ThunarColumnModel *column_model, ThunarColumn column, gboolean visible); gint thunar_column_model_get_column_width (ThunarColumnModel *column_model, ThunarColumn column); void thunar_column_model_set_column_width (ThunarColumnModel *column_model, ThunarColumn column, gint width);
Moving to 0.3.0beta1.
Committed with revision 20363. 2006-03-12 Benedikt Meurer <benny@xfce.org> * thunar/thunar-enum-types.{c,h}, thunar/thunar-list-model.c, thunar/thunar-path-entry.c: Rename THUNAR_COLUMN_REAL_NAME to THUNAR_COLUMN_FILE_NAME. * thunar/thunar-enum-types.{c,h}, thunar/thunar-list-model.c: Add new list model columns THUNAR_COLUMN_GROUP and THUNAR_COLUMN_OWNER. * thunar/thunar-enum-types.{c,h}: Divide ThunarColumns into visible and special columns. * thunar/thunar-text-renderer.c(thunar_text_renderer_get_size): Improve guessing the required width for text columns. * thunar/thunar-text-renderer.c(thunar_text_renderer_set_widget): Set fixed height for the text render. * thunar/thunar-preferences.c, docs/README.thunarrc: Add preferences for the configurable detailed list view columns. Bug #1351. * thunar/thunar-column-editor.{c,h}, thunar/thunar-column-model.{c,h}, thunar/Makefile.am: Import ThunarColumnModel and ThunarColumnEditor classes. The ThunarColumnModel class handles the order, visibility and fixed widths of columns. The ThunarColumnEditor class provides a dialog to configure the ThunarColumnModel. Bug #1351. * thunar/thunar-details-view.{c,h}, thunar/thunar-details-view-ui.xml, thunar/Makefile.am: Use column order and visibility from the ThunarColumnOrder. Add "Configure Columns..." menu item to "View", which pops up the ThunarColumnEditor. For fixed column mode, we use the fixed height mode provided by GtkTreeView, which speeds up the detailed list view a lot, esp. with older Pango version. Bug #1351.