Mercurial > geeqie.yaz
comparison src/view_dir.c @ 380:5afe77bb563a
Introduce a new struct ViewDir to handle directory views common
data.
Specific data is now in ViewDirInfoList and ViewDirInfoTree.
Type of directory view can be specified with enum DirViewType.
This is saved to rc file as layout.dir_view_type, which replace
layout.view_as_tree.
Code was modified to reflect these changes.
This is a first to move to merge common code of view_dir_list.c
and view_dir_tree.c and ease the introduction of new types
of directory view.
author | zas_ |
---|---|
date | Wed, 16 Apr 2008 14:45:22 +0000 |
parents | |
children | 499d7ba62261 |
comparison
equal
deleted
inserted
replaced
379:a430eb2e3c95 | 380:5afe77bb563a |
---|---|
1 /* | |
2 * Geeqie | |
3 * (C) 2008 Vladimir Nadvornik | |
4 * | |
5 * Author: Laurent Monin | |
6 * | |
7 * This software is released under the GNU General Public License (GNU GPL). | |
8 * Please read the included file COPYING for more information. | |
9 * This software comes with no warranty of any kind, use at your own risk! | |
10 */ | |
11 | |
12 #include "main.h" | |
13 #include "view_dir.h" | |
14 | |
15 #include "view_dir_list.h" | |
16 #include "view_dir_tree.h" | |
17 | |
18 GtkRadioActionEntry menu_view_dir_radio_entries[] = { | |
19 { "FolderList", NULL, N_("List"), "<meta>L", NULL, DIRVIEW_LIST }, | |
20 { "FolderTree", NULL, N_("Tr_ee"), "<control>T", NULL, DIRVIEW_TREE }, | |
21 }; | |
22 | |
23 ViewDir *vd_new(DirViewType type, const gchar *path) | |
24 { | |
25 ViewDir *vd = NULL; | |
26 | |
27 switch(type) | |
28 { | |
29 case DIRVIEW_LIST: vd = vdlist_new(path); break; | |
30 case DIRVIEW_TREE: vd = vdtree_new(path); break; | |
31 } | |
32 | |
33 return vd; | |
34 } | |
35 | |
36 void vd_set_select_func(ViewDir *vd, | |
37 void (*func)(ViewDir *vd, const gchar *path, gpointer data), gpointer data) | |
38 { | |
39 vd->select_func = func; | |
40 vd->select_data = data; | |
41 } | |
42 | |
43 void vd_set_layout(ViewDir *vd, LayoutWindow *layout) | |
44 { | |
45 vd->layout = layout; | |
46 } | |
47 | |
48 gint vd_set_path(ViewDir *vd, const gchar *path) | |
49 { | |
50 gint ret = FALSE; | |
51 | |
52 switch(vd->type) | |
53 { | |
54 case DIRVIEW_LIST: ret = vdlist_set_path(vd, path); break; | |
55 case DIRVIEW_TREE: ret = vdtree_set_path(vd, path); break; | |
56 } | |
57 | |
58 return ret; | |
59 } | |
60 | |
61 void vd_refresh(ViewDir *vd) | |
62 { | |
63 switch(vd->type) | |
64 { | |
65 case DIRVIEW_LIST: return vdlist_refresh(vd); | |
66 case DIRVIEW_TREE: return vdtree_refresh(vd); | |
67 } | |
68 } | |
69 | |
70 const gchar *vd_row_get_path(ViewDir *vd, gint row) | |
71 { | |
72 const gchar *ret = NULL; | |
73 | |
74 switch(vd->type) | |
75 { | |
76 case DIRVIEW_LIST: ret = vdlist_row_get_path(vd, row); break; | |
77 case DIRVIEW_TREE: ret = vdtree_row_get_path(vd, row); break; | |
78 } | |
79 | |
80 return ret; | |
81 } | |
82 |