Replace option layout.view_as_icons by layout.file_view_type.
#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"
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);
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;
}
+ break;
+ case FILEVIEW_LIST:
+ {
+ lw->vfl = vflist_new(NULL);
+ vflist_set_layout(lw->vfl, lw);
- 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)
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;
}
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 */
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);
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)
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)
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);
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)
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);
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;
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;
gchar *order;
gint style;
- gint view_as_icons;
DirViewType dir_view_type;
+ FileViewType file_view_type;
gint show_thumbnails;
gint show_marks;
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();
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);
ViewFileIcon *vfi;
GtkWidget *file_view;
- gint icon_view;
SortType sort_method;
gint sort_ascend;
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)
#ifndef VIEW_FILE_H
#define VIEW_FILE_H
+#define VIEW_FILE_TYPES_COUNT 2
+
#endif /* VIEW_FILE_H */