# HG changeset patch # User zas_ # Date 1209814453 0 # Node ID fe675761d09130344f39184cfc3c7edeff1ed676 # Parent cca1c3b1b9483391a0b86cf3d3e39fc8fab8de6f Replace Layout icon_view field by more generic file_view_type. Replace option layout.view_as_icons by layout.file_view_type. diff -r cca1c3b1b948 -r fe675761d091 src/layout.c --- a/src/layout.c Sat May 03 10:31:37 2008 +0000 +++ b/src/layout.c Sat May 03 11:34:13 2008 +0000 @@ -26,6 +26,7 @@ #include "pixbuf_util.h" #include "utilops.h" #include "view_dir.h" +#include "view_file.h" #include "view_file_list.h" #include "view_file_icon.h" #include "ui_bookmark.h" @@ -742,7 +743,11 @@ static GtkWidget *layout_list_new(LayoutWindow *lw) { - if (lw->icon_view) + GtkWidget *widget = NULL; + + switch (lw->file_view_type) + { + case FILEVIEW_ICON: { lw->vfi = vficon_new(NULL); vficon_set_layout(lw->vfi, lw); @@ -751,19 +756,26 @@ vficon_set_thumb_status_func(lw->vfi, layout_icon_thumb_cb, lw); /* FIXME vficon_marks_set(lw->vfi, lw->marks_enabled); */ - return lw->vfi->widget; + widget = lw->vfi->widget; } - - lw->vfl = vflist_new(NULL); - vflist_set_layout(lw->vfl, lw); + break; + case FILEVIEW_LIST: + { + lw->vfl = vflist_new(NULL); + vflist_set_layout(lw->vfl, lw); - vflist_set_status_func(lw->vfl, layout_list_status_cb, lw); - vflist_set_thumb_status_func(lw->vfl, layout_list_thumb_cb, lw); + vflist_set_status_func(lw->vfl, layout_list_status_cb, lw); + vflist_set_thumb_status_func(lw->vfl, layout_list_thumb_cb, lw); + + vflist_marks_set(lw->vfl, lw->marks_enabled); + vflist_thumbs_set(lw->vfl, lw->thumbs_enabled); - vflist_marks_set(lw->vfl, lw->marks_enabled); - vflist_thumbs_set(lw->vfl, lw->thumbs_enabled); + widget = lw->vfl->widget; + } + break; + } - return lw->vfl->widget; + return widget; } static void layout_list_sync_thumb(LayoutWindow *lw) @@ -1162,24 +1174,24 @@ return TRUE; } -void layout_views_set(LayoutWindow *lw, DirViewType type, gint icons) +void layout_views_set(LayoutWindow *lw, DirViewType dir_view_type, FileViewType file_view_type) { if (!layout_valid(&lw)) return; - if (lw->dir_view_type == type && lw->icon_view == icons) return; + if (lw->dir_view_type == dir_view_type && lw->file_view_type == file_view_type) return; - lw->dir_view_type = type; - lw->icon_view = icons; + lw->dir_view_type = dir_view_type; + lw->file_view_type = file_view_type; layout_style_set(lw, -1, NULL); } -gint layout_views_get(LayoutWindow *lw, DirViewType *type, gint *icons) +gint layout_views_get(LayoutWindow *lw, DirViewType *dir_view_type, FileViewType *file_view_type) { if (!layout_valid(&lw)) return FALSE; - *type = lw->dir_view_type; - *icons = lw->icon_view; + *dir_view_type = lw->dir_view_type; + *file_view_type = lw->file_view_type; return TRUE; } @@ -1918,7 +1930,7 @@ layout_config_parse(options->layout.style, options->layout.order, &lw->dir_location, &lw->file_location, &lw->image_location); lw->dir_view_type = CLAMP(options->layout.dir_view_type, 0, VIEW_DIR_TYPES_COUNT - 1); - lw->icon_view = options->layout.view_as_icons; + lw->file_view_type = CLAMP(options->layout.file_view_type, 0, VIEW_FILE_TYPES_COUNT - 1); /* divider positions */ diff -r cca1c3b1b948 -r fe675761d091 src/layout.h --- a/src/layout.h Sat May 03 10:31:37 2008 +0000 +++ b/src/layout.h Sat May 03 11:34:13 2008 +0000 @@ -68,8 +68,8 @@ gint layout_geometry_get(LayoutWindow *lw, gint *x, gint *y, gint *w, gint *h); gint layout_geometry_get_dividers(LayoutWindow *lw, gint *h, gint *v); -void layout_views_set(LayoutWindow *lw, DirViewType type, gint icons); -gint layout_views_get(LayoutWindow *lw, DirViewType *type, gint *icons); +void layout_views_set(LayoutWindow *lw, DirViewType dir_view_type, FileViewType file_view_type); +gint layout_views_get(LayoutWindow *lw, DirViewType *dir_view_type, FileViewType *file_view_type); void layout_status_update(LayoutWindow *lw, const gchar *text); diff -r cca1c3b1b948 -r fe675761d091 src/layout_util.c --- a/src/layout_util.c Sat May 03 10:31:37 2008 +0000 +++ b/src/layout_util.c Sat May 03 11:34:13 2008 +0000 @@ -514,7 +514,7 @@ if (lw->full_screen) layout_image_full_screen_stop(lw); - layout_views_set(lw, lw->dir_view_type, (gtk_radio_action_get_current_value(action) == 1)); + layout_views_set(lw, lw->dir_view_type, (gtk_radio_action_get_current_value(action) == 1) ? FILEVIEW_ICON : FILEVIEW_LIST); } static void layout_menu_view_dir_as_cb(GtkRadioAction *action, GtkRadioAction *current, gpointer data) @@ -523,7 +523,7 @@ if (lw->full_screen) layout_image_full_screen_stop(lw); - layout_views_set(lw, (DirViewType) gtk_radio_action_get_current_value(action), lw->icon_view); + layout_views_set(lw, (DirViewType) gtk_radio_action_get_current_value(action), lw->file_view_type); } static void layout_menu_view_in_new_window_cb(GtkAction *action, gpointer data) @@ -1581,7 +1581,7 @@ radio_action_set_current_value(GTK_RADIO_ACTION(action), lw->dir_view_type); action = gtk_action_group_get_action(lw->action_group, "ViewIcons"); - gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->icon_view); + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->file_view_type); action = gtk_action_group_get_action(lw->action_group, "FloatTools"); gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->tools_float); @@ -1613,10 +1613,10 @@ action = gtk_action_group_get_action(lw->action_group, "Thumbnails"); gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action), lw->thumbs_enabled); - g_object_set(action, "sensitive", !lw->icon_view, NULL); + g_object_set(action, "sensitive", (lw->file_view_type == FILEVIEW_LIST), NULL); gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(lw->thumb_button), lw->thumbs_enabled); - gtk_widget_set_sensitive(lw->thumb_button, !lw->icon_view); + gtk_widget_set_sensitive(lw->thumb_button, (lw->file_view_type == FILEVIEW_LIST)); } void layout_util_sync(LayoutWindow *lw) diff -r cca1c3b1b948 -r fe675761d091 src/main.c --- a/src/main.c Sat May 03 10:31:37 2008 +0000 +++ b/src/main.c Sat May 03 11:34:13 2008 +0000 @@ -1214,7 +1214,7 @@ layout_geometry_get_dividers(NULL, &options->layout.main_window.hdivider_pos, &options->layout.main_window.vdivider_pos); - layout_views_get(NULL, &options->layout.dir_view_type, &options->layout.view_as_icons); + layout_views_get(NULL, &options->layout.dir_view_type, &options->layout.file_view_type); options->layout.show_thumbnails = layout_thumb_get(NULL); options->layout.show_marks = layout_marks_get(NULL); diff -r cca1c3b1b948 -r fe675761d091 src/options.c --- a/src/options.c Sat May 03 10:31:37 2008 +0000 +++ b/src/options.c Sat May 03 11:34:13 2008 +0000 @@ -73,6 +73,7 @@ options->image_overlay.common.template_string = NULL; options->layout.dir_view_type = DIRVIEW_LIST; + options->layout.file_view_type = FILEVIEW_LIST; options->layout.float_window.h = 450; options->layout.float_window.vdivider_pos = -1; options->layout.float_window.w = 260; @@ -94,7 +95,6 @@ options->layout.tools_float = FALSE; options->layout.tools_hidden = FALSE; options->layout.tools_restore_state = FALSE; - options->layout.view_as_icons = FALSE; options->lazy_image_sync = FALSE; options->mousewheel_scrolls = FALSE; diff -r cca1c3b1b948 -r fe675761d091 src/options.h --- a/src/options.h Sat May 03 10:31:37 2008 +0000 +++ b/src/options.h Sat May 03 11:34:13 2008 +0000 @@ -141,8 +141,8 @@ gchar *order; gint style; - gint view_as_icons; DirViewType dir_view_type; + FileViewType file_view_type; gint show_thumbnails; gint show_marks; diff -r cca1c3b1b948 -r fe675761d091 src/rcfile.c --- a/src/rcfile.c Sat May 03 10:31:37 2008 +0000 +++ b/src/rcfile.c Sat May 03 11:34:13 2008 +0000 @@ -338,8 +338,8 @@ WRITE_INT(layout.style); WRITE_CHAR(layout.order); - WRITE_BOOL(layout.view_as_icons); WRITE_UINT(layout.dir_view_type); + WRITE_UINT(layout.file_view_type); WRITE_BOOL(layout.show_marks); WRITE_BOOL(layout.show_thumbnails); WRITE_SEPARATOR(); @@ -637,8 +637,11 @@ READ_INT(layout.style); READ_CHAR(layout.order); - READ_BOOL(layout.view_as_icons); + + COMPAT_READ_UINT(layout.view_as_icons, layout.file_view_type); /* 2008/05/03 */ + READ_UINT(layout.dir_view_type); + READ_UINT(layout.file_view_type); READ_BOOL(layout.show_marks); READ_BOOL(layout.show_thumbnails); diff -r cca1c3b1b948 -r fe675761d091 src/typedefs.h --- a/src/typedefs.h Sat May 03 10:31:37 2008 +0000 +++ b/src/typedefs.h Sat May 03 11:34:13 2008 +0000 @@ -507,7 +507,6 @@ ViewFileIcon *vfi; GtkWidget *file_view; - gint icon_view; SortType sort_method; gint sort_ascend; diff -r cca1c3b1b948 -r fe675761d091 src/view_dir.c --- a/src/view_dir.c Sat May 03 10:31:37 2008 +0000 +++ b/src/view_dir.c Sat May 03 11:34:13 2008 +0000 @@ -458,7 +458,7 @@ ViewDir *vd = data; DirViewType new_type = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), VIEW_DIR_AS_SUBMENU_KEY)); - layout_views_set(vd->layout, new_type, vd->layout->icon_view); + layout_views_set(vd->layout, new_type, vd->layout->file_view_type); } static void vd_pop_menu_refresh_cb(GtkWidget *widget, gpointer data) diff -r cca1c3b1b948 -r fe675761d091 src/view_file.h --- a/src/view_file.h Sat May 03 10:31:37 2008 +0000 +++ b/src/view_file.h Sat May 03 11:34:13 2008 +0000 @@ -12,4 +12,6 @@ #ifndef VIEW_FILE_H #define VIEW_FILE_H +#define VIEW_FILE_TYPES_COUNT 2 + #endif /* VIEW_FILE_H */