comparison src/layout.c @ 556:fe675761d091

Replace Layout icon_view field by more generic file_view_type. Replace option layout.view_as_icons by layout.file_view_type.
author zas_
date Sat, 03 May 2008 11:34:13 +0000
parents cca1c3b1b948
children c0e47b628f76
comparison
equal deleted inserted replaced
555:cca1c3b1b948 556:fe675761d091
24 #include "menu.h" 24 #include "menu.h"
25 #include "pixbuf-renderer.h" 25 #include "pixbuf-renderer.h"
26 #include "pixbuf_util.h" 26 #include "pixbuf_util.h"
27 #include "utilops.h" 27 #include "utilops.h"
28 #include "view_dir.h" 28 #include "view_dir.h"
29 #include "view_file.h"
29 #include "view_file_list.h" 30 #include "view_file_list.h"
30 #include "view_file_icon.h" 31 #include "view_file_icon.h"
31 #include "ui_bookmark.h" 32 #include "ui_bookmark.h"
32 #include "ui_fileops.h" 33 #include "ui_fileops.h"
33 #include "ui_menu.h" 34 #include "ui_menu.h"
740 layout_status_update_progress(lw, val, text); 741 layout_status_update_progress(lw, val, text);
741 } 742 }
742 743
743 static GtkWidget *layout_list_new(LayoutWindow *lw) 744 static GtkWidget *layout_list_new(LayoutWindow *lw)
744 { 745 {
745 if (lw->icon_view) 746 GtkWidget *widget = NULL;
747
748 switch (lw->file_view_type)
749 {
750 case FILEVIEW_ICON:
746 { 751 {
747 lw->vfi = vficon_new(NULL); 752 lw->vfi = vficon_new(NULL);
748 vficon_set_layout(lw->vfi, lw); 753 vficon_set_layout(lw->vfi, lw);
749 754
750 vficon_set_status_func(lw->vfi, layout_icon_status_cb, lw); 755 vficon_set_status_func(lw->vfi, layout_icon_status_cb, lw);
751 vficon_set_thumb_status_func(lw->vfi, layout_icon_thumb_cb, lw); 756 vficon_set_thumb_status_func(lw->vfi, layout_icon_thumb_cb, lw);
752 /* FIXME vficon_marks_set(lw->vfi, lw->marks_enabled); */ 757 /* FIXME vficon_marks_set(lw->vfi, lw->marks_enabled); */
753 758
754 return lw->vfi->widget; 759 widget = lw->vfi->widget;
755 } 760 }
756 761 break;
757 lw->vfl = vflist_new(NULL); 762 case FILEVIEW_LIST:
758 vflist_set_layout(lw->vfl, lw); 763 {
759 764 lw->vfl = vflist_new(NULL);
760 vflist_set_status_func(lw->vfl, layout_list_status_cb, lw); 765 vflist_set_layout(lw->vfl, lw);
761 vflist_set_thumb_status_func(lw->vfl, layout_list_thumb_cb, lw); 766
762 767 vflist_set_status_func(lw->vfl, layout_list_status_cb, lw);
763 vflist_marks_set(lw->vfl, lw->marks_enabled); 768 vflist_set_thumb_status_func(lw->vfl, layout_list_thumb_cb, lw);
764 vflist_thumbs_set(lw->vfl, lw->thumbs_enabled); 769
765 770 vflist_marks_set(lw->vfl, lw->marks_enabled);
766 return lw->vfl->widget; 771 vflist_thumbs_set(lw->vfl, lw->thumbs_enabled);
772
773 widget = lw->vfl->widget;
774 }
775 break;
776 }
777
778 return widget;
767 } 779 }
768 780
769 static void layout_list_sync_thumb(LayoutWindow *lw) 781 static void layout_list_sync_thumb(LayoutWindow *lw)
770 { 782 {
771 if (lw->vfl) vflist_thumb_set(lw->vfl, lw->thumbs_enabled); 783 if (lw->vfl) vflist_thumb_set(lw->vfl, lw->thumbs_enabled);
1160 } 1172 }
1161 1173
1162 return TRUE; 1174 return TRUE;
1163 } 1175 }
1164 1176
1165 void layout_views_set(LayoutWindow *lw, DirViewType type, gint icons) 1177 void layout_views_set(LayoutWindow *lw, DirViewType dir_view_type, FileViewType file_view_type)
1166 { 1178 {
1167 if (!layout_valid(&lw)) return; 1179 if (!layout_valid(&lw)) return;
1168 1180
1169 if (lw->dir_view_type == type && lw->icon_view == icons) return; 1181 if (lw->dir_view_type == dir_view_type && lw->file_view_type == file_view_type) return;
1170 1182
1171 lw->dir_view_type = type; 1183 lw->dir_view_type = dir_view_type;
1172 lw->icon_view = icons; 1184 lw->file_view_type = file_view_type;
1173 1185
1174 layout_style_set(lw, -1, NULL); 1186 layout_style_set(lw, -1, NULL);
1175 } 1187 }
1176 1188
1177 gint layout_views_get(LayoutWindow *lw, DirViewType *type, gint *icons) 1189 gint layout_views_get(LayoutWindow *lw, DirViewType *dir_view_type, FileViewType *file_view_type)
1178 { 1190 {
1179 if (!layout_valid(&lw)) return FALSE; 1191 if (!layout_valid(&lw)) return FALSE;
1180 1192
1181 *type = lw->dir_view_type; 1193 *dir_view_type = lw->dir_view_type;
1182 *icons = lw->icon_view; 1194 *file_view_type = lw->file_view_type;
1183 1195
1184 return TRUE; 1196 return TRUE;
1185 } 1197 }
1186 1198
1187 /* 1199 /*
1916 /* default layout */ 1928 /* default layout */
1917 1929
1918 layout_config_parse(options->layout.style, options->layout.order, 1930 layout_config_parse(options->layout.style, options->layout.order,
1919 &lw->dir_location, &lw->file_location, &lw->image_location); 1931 &lw->dir_location, &lw->file_location, &lw->image_location);
1920 lw->dir_view_type = CLAMP(options->layout.dir_view_type, 0, VIEW_DIR_TYPES_COUNT - 1); 1932 lw->dir_view_type = CLAMP(options->layout.dir_view_type, 0, VIEW_DIR_TYPES_COUNT - 1);
1921 lw->icon_view = options->layout.view_as_icons; 1933 lw->file_view_type = CLAMP(options->layout.file_view_type, 0, VIEW_FILE_TYPES_COUNT - 1);
1922 1934
1923 /* divider positions */ 1935 /* divider positions */
1924 1936
1925 if (options->layout.save_window_positions) 1937 if (options->layout.save_window_positions)
1926 { 1938 {