annotate src/view_dir_list.c @ 880:71fc4b084e7e

French translation was updated.
author zas_
date Fri, 04 Jul 2008 22:49:04 +0000
parents ee33d2ddb661
children c414002a1f27
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
1 /*
196
f6e307c7bad6 rename GQview -> Geeqie over the code
nadvornik
parents: 138
diff changeset
2 * Geeqie
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
3 * (C) 2004 John Ellis
475
48c8e49b571c updated copyright in source files
nadvornik
parents: 448
diff changeset
4 * Copyright (C) 2008 The Geeqie Team
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
10 * This software comes with no warranty of any kind, use at your own risk!
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
12
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 250
diff changeset
13 #include "main.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 #include "view_dir_list.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 #include "dnd.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 #include "dupe.h"
586
905688aa2317 split filelist.c to filefilter.c and filedata.c
nadvornik
parents: 475
diff changeset
18 #include "filedata.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "layout.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 #include "layout_image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 #include "layout_util.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 #include "utilops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "ui_bookmark.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 #include "ui_menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 #include "ui_tree_edit.h"
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 373
diff changeset
27 #include "view_dir.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29 #include <gdk/gdkkeysyms.h> /* for keyboard values */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 373
diff changeset
32 #define VDLIST_INFO(_vd_, _part_) (((ViewDirInfoList *)(_vd_->info))->_part_)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37 * misc
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40
383
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 381
diff changeset
41 gint vdlist_find_row(ViewDir *vd, FileData *fd, GtkTreeIter *iter)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 gint valid;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 gint row = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
47 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48 valid = gtk_tree_model_get_iter_first(store, iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49 while (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 FileData *fd_n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 gtk_tree_model_get(GTK_TREE_MODEL(store), iter, DIR_COLUMN_POINTER, &fd_n, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53 if (fd_n == fd) return row;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56 row++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
62
388
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 385
diff changeset
63 FileData *vdlist_row_by_path(ViewDir *vd, const gchar *path, gint *row)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
64 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
67
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
68 if (!path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70 if (row) *row = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74 n = 0;
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
75 work = VDLIST_INFO(vd, list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
78 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79 if (strcmp(fd->path, path) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
80 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81 if (row) *row = n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 return fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
84 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
85 n++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
86 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
87
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
88 if (row) *row = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94 * dnd
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
95 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
98 static void vdlist_scroll_to_row(ViewDir *vd, FileData *fd, gfloat y_align)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101
394
4a5e1377f3d7 Merge dirlist/dirview dnd code.
zas_
parents: 389
diff changeset
102 if (GTK_WIDGET_REALIZED(vd->view) && vd_find_row(vd, fd, &iter) >= 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
106
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
107 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108 tpath = gtk_tree_model_get_path(store, &iter);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
109 gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(vd->view), tpath, NULL, TRUE, y_align, 0.0);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
110 gtk_tree_view_set_cursor(GTK_TREE_VIEW(vd->view), tpath, NULL, FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
112
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
113 if (!GTK_WIDGET_HAS_FOCUS(vd->view)) gtk_widget_grab_focus(vd->view);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
116
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
117 /*
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
118 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 * main
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120 *-----------------------------------------------------------------------------
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 406
diff changeset
121 */
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122
396
a01535f52b56 Merge few more functions to view_dir.c.
zas_
parents: 395
diff changeset
123 void vdlist_select_row(ViewDir *vd, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
124 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
125 if (fd && vd->select_func)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
126 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
127 gchar *path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129 path = g_strdup(fd->path);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
130 vd->select_func(vd, path, vd->select_data);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131 g_free(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
133 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
135 const gchar *vdlist_row_get_path(ViewDir *vd, gint row)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
136 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
137 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
138
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
139 fd = g_list_nth_data(VDLIST_INFO(vd, list), row);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
140
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
141 if (fd) return fd->path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
142
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
145
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
146 static void vdlist_populate(ViewDir *vd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148 GtkListStore *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
151 store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view)));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152 gtk_list_store_clear(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
154 work = VDLIST_INFO(vd, list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 GdkPixbuf *pixbuf;
825
ee33d2ddb661 Optionnally display directory's date in list view.
zas_
parents: 783
diff changeset
160 const gchar *date = "";
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164 if (access_file(fd->path, R_OK | X_OK) && fd->name)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 if (fd->name[0] == '.' && fd->name[1] == '\0')
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
167 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
168 pixbuf = vd->pf->open;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170 else if (fd->name[0] == '.' && fd->name[1] == '.' && fd->name[2] == '\0')
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
172 pixbuf = vd->pf->parent;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
176 pixbuf = vd->pf->close;
825
ee33d2ddb661 Optionnally display directory's date in list view.
zas_
parents: 783
diff changeset
177 if (options->layout.show_directory_date)
ee33d2ddb661 Optionnally display directory's date in list view.
zas_
parents: 783
diff changeset
178 date = text_from_time(fd->date);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
183 pixbuf = vd->pf->deny;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 gtk_list_store_append(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187 gtk_list_store_set(store, &iter,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 DIR_COLUMN_POINTER, fd,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 DIR_COLUMN_ICON, pixbuf,
825
ee33d2ddb661 Optionnally display directory's date in list view.
zas_
parents: 783
diff changeset
190 DIR_COLUMN_NAME, fd->name,
ee33d2ddb661 Optionnally display directory's date in list view.
zas_
parents: 783
diff changeset
191 DIR_COLUMN_DATE, date,
ee33d2ddb661 Optionnally display directory's date in list view.
zas_
parents: 783
diff changeset
192 -1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
197 vd->click_fd = NULL;
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
198 vd->drop_fd = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
201 gint vdlist_set_fd(ViewDir *vd, FileData *dir_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 gint ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 gchar *old_path = NULL;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 112
diff changeset
206 gchar *filepath;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
208 if (!dir_fd) return FALSE;
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
209 if (vd->dir_fd == dir_fd) return TRUE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
211 if (vd->dir_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 gchar *base;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
215 base = remove_level_from_path(vd->dir_fd->path);
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
216 if (strcmp(base, dir_fd->path) == 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
218 old_path = g_strdup(vd->dir_fd->name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 g_free(base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
223 file_data_unref(vd->dir_fd);
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
224 vd->dir_fd = file_data_ref(dir_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
226 filelist_free(VDLIST_INFO(vd, list));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
228 ret = filelist_read(vd->dir_fd, NULL, &VDLIST_INFO(vd, list));
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
229 VDLIST_INFO(vd, list) = filelist_sort(VDLIST_INFO(vd, list), SORT_NAME, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 /* add . and .. */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
233 if (strcmp(vd->dir_fd->path, G_DIR_SEPARATOR_S) != 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
235 filepath = g_build_filename(vd->dir_fd->path, "..", NULL);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 112
diff changeset
236 fd = file_data_new_simple(filepath);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
237 VDLIST_INFO(vd, list) = g_list_prepend(VDLIST_INFO(vd, list), fd);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 112
diff changeset
238 g_free(filepath);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 }
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 406
diff changeset
240
373
61a3c8b05b24 Add a new option in Preferences > Filtering to allow the
zas_
parents: 356
diff changeset
241 if (options->file_filter.show_dot_directory)
61a3c8b05b24 Add a new option in Preferences > Filtering to allow the
zas_
parents: 356
diff changeset
242 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
243 filepath = g_build_filename(vd->dir_fd->path, ".", NULL);
373
61a3c8b05b24 Add a new option in Preferences > Filtering to allow the
zas_
parents: 356
diff changeset
244 fd = file_data_new_simple(filepath);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
245 VDLIST_INFO(vd, list) = g_list_prepend(VDLIST_INFO(vd, list), fd);
373
61a3c8b05b24 Add a new option in Preferences > Filtering to allow the
zas_
parents: 356
diff changeset
246 g_free(filepath);
61a3c8b05b24 Add a new option in Preferences > Filtering to allow the
zas_
parents: 356
diff changeset
247 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
249 vdlist_populate(vd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 if (old_path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
252 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253 /* scroll to make last path visible */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254 FileData *found = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
255 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
257 work = VDLIST_INFO(vd, list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
258 while (work && !found)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
259 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
260 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261 if (strcmp(old_path, fd->name) == 0) found = fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
262 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
263 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
264
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
265 if (found) vdlist_scroll_to_row(vd, found, 0.5);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267 g_free(old_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
271 if (GTK_WIDGET_REALIZED(vd->view))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
273 gtk_tree_view_scroll_to_point(GTK_TREE_VIEW(vd->view), 0, 0);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
278
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
279 void vdlist_refresh(ViewDir *vd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280 {
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
281 FileData *dir_fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
283 dir_fd = vd->dir_fd;
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
284 vd->dir_fd = NULL;
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
285 vdlist_set_fd(vd, dir_fd);
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
286 file_data_unref(dir_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288
401
0a2e1b130a25 Add some wrappers in view_dir.c and simplify even more.
zas_
parents: 397
diff changeset
289 gint vdlist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
291 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 GtkTreePath *tpath;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 406
diff changeset
293
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 if (event->keyval != GDK_Menu) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
296 gtk_tree_view_get_cursor(GTK_TREE_VIEW(vd->view), &tpath, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 if (tpath)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303 gtk_tree_model_get_iter(store, &iter, tpath);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
304 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &vd->click_fd, -1);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 406
diff changeset
305
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
310 vd->click_fd = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312
383
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 381
diff changeset
313 vd_color_set(vd, vd->click_fd, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314
388
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 385
diff changeset
315 vd->popup = vd_pop_menu(vd, vd->click_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
316
395
c359fc2c5a1f Move common menu position callback to view_dir.c.
zas_
parents: 394
diff changeset
317 gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, vd_menu_position_cb, vd, 0, GDK_CURRENT_TIME);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
321
401
0a2e1b130a25 Add some wrappers in view_dir.c and simplify even more.
zas_
parents: 397
diff changeset
322 gint vdlist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
324 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327 FileData *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), bevent->x, bevent->y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 &tpath, NULL, NULL, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
333
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
335 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
337 gtk_tree_view_set_cursor(GTK_TREE_VIEW(widget), tpath, NULL, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
340
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
341 vd->click_fd = fd;
383
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 381
diff changeset
342 vd_color_set(vd, vd->click_fd, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343
448
a73cc0fa14d0 Use explicit names for mouse buttons instead of numbers.
zas_
parents: 442
diff changeset
344 if (bevent->button == MOUSE_BUTTON_RIGHT)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345 {
388
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 385
diff changeset
346 vd->popup = vd_pop_menu(vd, vd->click_fd);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
347 gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, NULL, NULL,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
348 bevent->button, bevent->time);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
349 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
350
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
351 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
352 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
353
401
0a2e1b130a25 Add some wrappers in view_dir.c and simplify even more.
zas_
parents: 397
diff changeset
354 void vdlist_destroy_cb(GtkWidget *widget, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
356 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
357
394
4a5e1377f3d7 Merge dirlist/dirview dnd code.
zas_
parents: 389
diff changeset
358 vd_dnd_drop_scroll_cancel(vd);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
359 widget_auto_scroll_stop(vd->view);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
361 filelist_free(VDLIST_INFO(vd, list));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
362 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
363
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 780
diff changeset
364 ViewDir *vdlist_new(ViewDir *vd, FileData *dir_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
365 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366 GtkListStore *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
368 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
369 GtkCellRenderer *renderer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
371 vd->info = g_new0(ViewDirInfoList, 1);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
372 vd->type = DIRVIEW_LIST;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
373
384
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
374 VDLIST_INFO(vd, list) = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
375
825
ee33d2ddb661 Optionnally display directory's date in list view.
zas_
parents: 783
diff changeset
376 store = gtk_list_store_new(5, G_TYPE_POINTER, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_STRING);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
377 vd->view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
378 g_object_unref(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
379
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
380 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(vd->view), FALSE);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
381 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(vd->view), FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
382
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
383 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vd->view));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
384 gtk_tree_selection_set_mode(selection, GTK_SELECTION_NONE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
385
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
386 column = gtk_tree_view_column_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
387 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
388
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
389 renderer = gtk_cell_renderer_pixbuf_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390 gtk_tree_view_column_pack_start(column, renderer, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
391 gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", DIR_COLUMN_ICON);
396
a01535f52b56 Merge few more functions to view_dir.c.
zas_
parents: 395
diff changeset
392 gtk_tree_view_column_set_cell_data_func(column, renderer, vd_color_cb, vd, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
393
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394 renderer = gtk_cell_renderer_text_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
395 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
396 gtk_tree_view_column_add_attribute(column, renderer, "text", DIR_COLUMN_NAME);
396
a01535f52b56 Merge few more functions to view_dir.c.
zas_
parents: 395
diff changeset
397 gtk_tree_view_column_set_cell_data_func(column, renderer, vd_color_cb, vd, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398
825
ee33d2ddb661 Optionnally display directory's date in list view.
zas_
parents: 783
diff changeset
399 renderer = gtk_cell_renderer_text_new();
ee33d2ddb661 Optionnally display directory's date in list view.
zas_
parents: 783
diff changeset
400 gtk_tree_view_column_pack_start(column, renderer, TRUE);
ee33d2ddb661 Optionnally display directory's date in list view.
zas_
parents: 783
diff changeset
401 gtk_tree_view_column_add_attribute(column, renderer, "text", DIR_COLUMN_DATE);
ee33d2ddb661 Optionnally display directory's date in list view.
zas_
parents: 783
diff changeset
402 gtk_tree_view_column_set_cell_data_func(column, renderer, vd_color_cb, vd, NULL);
ee33d2ddb661 Optionnally display directory's date in list view.
zas_
parents: 783
diff changeset
403
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
404 gtk_tree_view_append_column(GTK_TREE_VIEW(vd->view), column);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
405
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
406 return vd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407 }