annotate src/view_dir_list.c @ 392:5a73f2e1bf79

Fix new folder feature in dirlist mode, it was broken by revision 481.
author zas_
date Wed, 16 Apr 2008 22:31:52 +0000
parents b78077f65eff
children 4a5e1377f3d7
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
4 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * 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
10 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
11
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 250
diff changeset
12 #include "main.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
13 #include "view_dir_list.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15 #include "dnd.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 #include "dupe.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 #include "filelist.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 #include "layout.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "layout_image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 #include "layout_util.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 #include "utilops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 #include "ui_bookmark.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 #include "ui_menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 #include "ui_tree_edit.h"
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 373
diff changeset
26 #include "view_dir.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 #include <gdk/gdkkeysyms.h> /* for keyboard values */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29
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 #define VDLIST_PAD 4
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32
380
5afe77bb563a Introduce a new struct ViewDir to handle directory views common
zas_
parents: 373
diff changeset
33 #define VDLIST_INFO(_vd_, _part_) (((ViewDirInfoList *)(_vd_->info))->_part_)
9
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 static gint vdlist_auto_scroll_notify_cb(GtkWidget *widget, gint x, gint y, gpointer data);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37
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 * misc
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 *-----------------------------------------------------------------------------
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
383
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 381
diff changeset
44 gint vdlist_find_row(ViewDir *vd, FileData *fd, GtkTreeIter *iter)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47 gint valid;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48 gint row = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
50 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 valid = gtk_tree_model_get_iter_first(store, iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 while (valid)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54 FileData *fd_n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55 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
56 if (fd_n == fd) return 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 valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store), iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59 row++;
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 return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
63 }
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
388
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 385
diff changeset
66 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
67 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
68 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 gint n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 if (!path)
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 if (row) *row = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77 n = 0;
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
78 work = VDLIST_INFO(vd, list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
79 while (work)
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 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 if (strcmp(fd->path, path) == 0)
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 if (row) *row = n;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
85 return fd;
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 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
88 n++;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 }
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 if (row) *row = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 return NULL;
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
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 * dnd
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
98 *-----------------------------------------------------------------------------
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101 static GtkTargetEntry vdlist_dnd_drop_types[] = {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102 { "text/uri-list", 0, TARGET_URI_LIST }
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 static gint vdlist_dnd_drop_types_count = 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
106 static void vdlist_dest_set(ViewDir *vd, gint enable)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
107 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108 if (enable)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
109 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
110 gtk_drag_dest_set(vd->view,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
112 vdlist_dnd_drop_types, vdlist_dnd_drop_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
113 GDK_ACTION_MOVE | GDK_ACTION_COPY);
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
116 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
117 gtk_drag_dest_unset(vd->view);
9
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 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121 static void vdlist_dnd_get(GtkWidget *widget, GdkDragContext *context,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122 GtkSelectionData *selection_data, guint info,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
123 guint time, gpointer data)
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 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
126 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
127 gchar *text = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128 gint length = 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
130 if (!vd->click_fd) return;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132 switch (info)
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 case TARGET_URI_LIST:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
135 case TARGET_TEXT_PLAIN:
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
136 list = g_list_prepend(NULL, vd->click_fd);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 112
diff changeset
137 text = uri_text_from_filelist(list, &length, (info == TARGET_TEXT_PLAIN));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
138 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
139 break;
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 (text)
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 gtk_selection_data_set (selection_data, selection_data->target,
64
04ff0df3ad2f Mon Aug 15 17:13:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 44
diff changeset
144 8, (guchar *)text, length);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
145 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
146 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 static void vdlist_dnd_begin(GtkWidget *widget, GdkDragContext *context, gpointer data)
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 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152
383
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 381
diff changeset
153 vd_color_set(vd, vd->click_fd, TRUE);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
154 vdlist_dest_set(vd, FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 }
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 static void vdlist_dnd_end(GtkWidget *widget, GdkDragContext *context, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
159 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160
383
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 381
diff changeset
161 vd_color_set(vd, vd->click_fd, FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 if (context->action == GDK_ACTION_MOVE)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
165 vdlist_refresh(vd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 }
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
167 vdlist_dest_set(vd, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
168 }
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 static void vdlist_dnd_drop_receive(GtkWidget *widget,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 GdkDragContext *context, gint x, gint y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172 GtkSelectionData *selection_data, guint info,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 guint time, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
175 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178 FileData *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
180 vd->click_fd = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget), x, y,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183 &tpath, NULL, NULL, NULL))
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 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
191 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
192
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193 if (!fd) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195 if (info == TARGET_URI_LIST)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
196 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 gint active;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 112
diff changeset
200 list = uri_filelist_from_text((gchar *)selection_data->data, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201 if (!list) return;
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 active = access_file(fd->path, W_OK | X_OK);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204
383
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 381
diff changeset
205 vd_color_set(vd, fd, TRUE);
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 381
diff changeset
206 vd->popup = vd_drop_menu(vd, active);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
207 gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, NULL, NULL, 0, time);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
209 vd->drop_fd = fd;
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
210 vd->drop_list = list;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 #if 0
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
215 static gint vdlist_get_row_visibility(ViewDir *vd, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 GtkTreeIter iter;
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 GdkRectangle vrect;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 GdkRectangle crect;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224
389
b78077f65eff Merge few more vdlist/vdtree functions.
zas_
parents: 388
diff changeset
225 if (!fd || vd_find_row(vd, fd, &iter) < 0) return 0;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
227 column = gtk_tree_view_get_column(GTK_TREE_VIEW(vd->view), 0);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
228 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
229 tpath = gtk_tree_model_get_path(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
231 gtk_tree_view_get_visible_rect(GTK_TREE_VIEW(vd->view), &vrect);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
232 gtk_tree_view_get_cell_area(GTK_TREE_VIEW(vd->view), tpath, column, &crect);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233 printf("window: %d + %d; cell: %d + %d\n", vrect.y, vrect.height, crect.y, crect.height);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
236 if (crect.y + crect.height < vrect.y) return -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
237 if (crect.y > vrect.y + vrect.height) return 1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 return 0;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240 #endif
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
242 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
243 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
245
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
246 if (GTK_WIDGET_REALIZED(vd->view) &&
389
b78077f65eff Merge few more vdlist/vdtree functions.
zas_
parents: 388
diff changeset
247 vd_find_row(vd, fd, &iter) >= 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
252 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253 tpath = gtk_tree_model_get_path(store, &iter);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
254 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
255 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
256 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
257
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
258 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
259 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
260 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
262 static void vdlist_drop_update(ViewDir *vd, gint x, gint y)
9
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 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
265 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266 FileData *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
268 if (gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(vd->view), x, y,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 &tpath, NULL, NULL, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271 GtkTreeModel *store;
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 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 gtk_tree_path_free(tpath);
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 if (fd != vd->drop_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280 {
383
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 381
diff changeset
281 vd_color_set(vd, vd->drop_fd, FALSE);
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 381
diff changeset
282 vd_color_set(vd, fd, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
285 vd->drop_fd = fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
288 static void vdlist_dnd_drop_scroll_cancel(ViewDir *vd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
290 if (vd->drop_scroll_id != -1) g_source_remove(vd->drop_scroll_id);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
291 vd->drop_scroll_id = -1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 static gint vdlist_auto_scroll_idle_cb(gpointer data)
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 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
298 if (vd->drop_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
300 GdkWindow *window;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 gint x, y;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
302 gint w, h;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
304 window = vd->view->window;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 gdk_window_get_pointer(window, &x, &y, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306 gdk_drawable_get_size(window, &w, &h);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307 if (x >= 0 && x < w && y >= 0 && y < h)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
309 vdlist_drop_update(vd, x, y);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 }
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
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
313 vd->drop_scroll_id = -1;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
315 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
316
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317 static gint vdlist_auto_scroll_notify_cb(GtkWidget *widget, gint x, gint y, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
319 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
321 if (!vd->drop_fd || vd->drop_list) return FALSE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
323 if (vd->drop_scroll_id == -1) vd->drop_scroll_id = g_idle_add(vdlist_auto_scroll_idle_cb, vd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
324
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328 static gint vdlist_dnd_drop_motion(GtkWidget *widget, GdkDragContext *context,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329 gint x, gint y, guint time, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
331 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
333 vd->click_fd = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
335 if (gtk_drag_get_source_widget(context) == vd->view)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
337 /* from same window */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338 gdk_drag_status(context, 0, time);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
340 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
342 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343 gdk_drag_status(context, context->suggested_action, time);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
344 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
346 vdlist_drop_update(vd, x, y);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
348 if (vd->drop_fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
349 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
350 GtkAdjustment *adj = gtk_tree_view_get_vadjustment(GTK_TREE_VIEW(vd->view));
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
351 widget_auto_scroll_start(vd->view, adj, -1, -1, vdlist_auto_scroll_notify_cb, vd);
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
354 return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
356
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
357 static void vdlist_dnd_drop_leave(GtkWidget *widget, GdkDragContext *context, guint time, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
358 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
359 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360
383
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 381
diff changeset
361 if (vd->drop_fd != vd->click_fd) vd_color_set(vd, vd->drop_fd, FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
362
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
363 vd->drop_fd = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
364 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
365
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
366 static void vdlist_dnd_init(ViewDir *vd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
368 gtk_drag_source_set(vd->view, GDK_BUTTON1_MASK | GDK_BUTTON2_MASK,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
369 dnd_file_drag_types, dnd_file_drag_types_count,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370 GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
371 g_signal_connect(G_OBJECT(vd->view), "drag_data_get",
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
372 G_CALLBACK(vdlist_dnd_get), vd);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
373 g_signal_connect(G_OBJECT(vd->view), "drag_begin",
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
374 G_CALLBACK(vdlist_dnd_begin), vd);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
375 g_signal_connect(G_OBJECT(vd->view), "drag_end",
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
376 G_CALLBACK(vdlist_dnd_end), vd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
378 vdlist_dest_set(vd, TRUE);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
379 g_signal_connect(G_OBJECT(vd->view), "drag_data_received",
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
380 G_CALLBACK(vdlist_dnd_drop_receive), vd);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
381 g_signal_connect(G_OBJECT(vd->view), "drag_motion",
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
382 G_CALLBACK(vdlist_dnd_drop_motion), vd);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
383 g_signal_connect(G_OBJECT(vd->view), "drag_leave",
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
384 G_CALLBACK(vdlist_dnd_drop_leave), vd);
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
387 /*
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 * main
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390 *-----------------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
391 */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
392
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
393 static void vdlist_select_row(ViewDir *vd, FileData *fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
395 if (fd && vd->select_func)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
396 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 gchar *path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
399 path = g_strdup(fd->path);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
400 vd->select_func(vd, path, vd->select_data);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
401 g_free(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
402 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
403 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
404
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
405 const gchar *vdlist_row_get_path(ViewDir *vd, gint row)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
406 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
408
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
409 fd = g_list_nth_data(VDLIST_INFO(vd, list), row);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
410
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411 if (fd) return fd->path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413 return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
415
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
416 static void vdlist_populate(ViewDir *vd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 GtkListStore *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
419 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
420
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
421 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
422 gtk_list_store_clear(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
423
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
424 work = VDLIST_INFO(vd, list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
425 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
426 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
427 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
428 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
429 GdkPixbuf *pixbuf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
430
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
431 fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
432
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
433 if (access_file(fd->path, R_OK | X_OK) && fd->name)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
434 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
435 if (fd->name[0] == '.' && fd->name[1] == '\0')
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
437 pixbuf = vd->pf->open;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
438 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439 else if (fd->name[0] == '.' && fd->name[1] == '.' && fd->name[2] == '\0')
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
440 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
441 pixbuf = vd->pf->parent;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
443 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
444 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
445 pixbuf = vd->pf->close;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
446 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
447 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
448 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
449 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
450 pixbuf = vd->pf->deny;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
451 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 gtk_list_store_append(store, &iter);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 gtk_list_store_set(store, &iter,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455 DIR_COLUMN_POINTER, fd,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
456 DIR_COLUMN_ICON, pixbuf,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
457 DIR_COLUMN_NAME, fd->name, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
458
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
459 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
460 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
461
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
462 vd->click_fd = NULL;
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
463 vd->drop_fd = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
464 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
465
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
466 gint vdlist_set_path(ViewDir *vd, const gchar *path)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
467 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
468 gint ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
469 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
470 gchar *old_path = NULL;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 112
diff changeset
471 gchar *filepath;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
472
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
473 if (!path) return FALSE;
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
474 if (vd->path && strcmp(path, vd->path) == 0) return TRUE;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
475
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
476 if (vd->path)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
477 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
478 gchar *base;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
479
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
480 base = remove_level_from_path(vd->path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
481 if (strcmp(base, path) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
482 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
483 old_path = g_strdup(filename_from_path(vd->path));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
484 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
485 g_free(base);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
486 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
487
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
488 g_free(vd->path);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
489 vd->path = g_strdup(path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
490
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
491 filelist_free(VDLIST_INFO(vd, list));
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
492 VDLIST_INFO(vd, list) = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
493
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
494 ret = filelist_read(vd->path, NULL, &VDLIST_INFO(vd, list));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
495
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
496 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
497
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
498 /* add . and .. */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
499
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
500 if (strcmp(vd->path, "/") != 0)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
501 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
502 filepath = g_strconcat(vd->path, "/", "..", NULL);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 112
diff changeset
503 fd = file_data_new_simple(filepath);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
504 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
505 g_free(filepath);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
506 }
373
61a3c8b05b24 Add a new option in Preferences > Filtering to allow the
zas_
parents: 356
diff changeset
507
61a3c8b05b24 Add a new option in Preferences > Filtering to allow the
zas_
parents: 356
diff changeset
508 if (options->file_filter.show_dot_directory)
61a3c8b05b24 Add a new option in Preferences > Filtering to allow the
zas_
parents: 356
diff changeset
509 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
510 filepath = g_strconcat(vd->path, "/", ".", NULL);
373
61a3c8b05b24 Add a new option in Preferences > Filtering to allow the
zas_
parents: 356
diff changeset
511 fd = file_data_new_simple(filepath);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
512 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
513 g_free(filepath);
61a3c8b05b24 Add a new option in Preferences > Filtering to allow the
zas_
parents: 356
diff changeset
514 }
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
516 vdlist_populate(vd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
517
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518 if (old_path)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
519 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
520 /* scroll to make last path visible */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
521 FileData *found = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
522 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
523
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
524 work = VDLIST_INFO(vd, list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
525 while (work && !found)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
526 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
527 FileData *fd = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
528 if (strcmp(old_path, fd->name) == 0) found = fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
529 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
530 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
531
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
532 if (found) vdlist_scroll_to_row(vd, found, 0.5);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
533
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
534 g_free(old_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
535 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
536 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
537
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
538 if (GTK_WIDGET_REALIZED(vd->view))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
539 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
540 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
541 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
542
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
543 return ret;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
544 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
545
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
546 void vdlist_refresh(ViewDir *vd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
547 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
548 gchar *path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
549
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
550 path = g_strdup(vd->path);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
551 vd->path = NULL;
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
552 vdlist_set_path(vd, path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
553 g_free(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
554 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
555
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
556 static void vdlist_menu_position_cb(GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
557 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
558 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
559 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
560 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
561 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
562 gint cw, ch;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
563
389
b78077f65eff Merge few more vdlist/vdtree functions.
zas_
parents: 388
diff changeset
564 if (vd_find_row(vd, vd->click_fd, &iter) < 0) return;
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
565 store = gtk_tree_view_get_model(GTK_TREE_VIEW(vd->view));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
566 tpath = gtk_tree_model_get_path(store, &iter);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
567 tree_view_get_cell_clamped(GTK_TREE_VIEW(vd->view), tpath, 0, TRUE, x, y, &cw, &ch);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
568 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
569 *y += ch;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
570 popup_menu_position_clamp(menu, x, y, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
571 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
572
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
573 static gint vdlist_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
574 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
575 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
578 if (event->keyval != GDK_Menu) return FALSE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
579
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
580 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
581 if (tpath)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
582 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
584 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
586 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
587 gtk_tree_model_get_iter(store, &iter, tpath);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
588 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &vd->click_fd, -1);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
589
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
590 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
592 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
594 vd->click_fd = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596
383
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 381
diff changeset
597 vd_color_set(vd, vd->click_fd, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
598
388
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 385
diff changeset
599 vd->popup = vd_pop_menu(vd, vd->click_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
600
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
601 gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, vdlist_menu_position_cb, vd, 0, GDK_CURRENT_TIME);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
602
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
603 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
604 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
605
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
606 static gint vdlist_press_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
608 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
609 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
610 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611 FileData *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
612
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
613 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
614 &tpath, NULL, NULL, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
616 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
617
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
620 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 gtk_tree_view_set_cursor(GTK_TREE_VIEW(widget), tpath, NULL, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
625 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
626 vd_color_set(vd, vd->click_fd, TRUE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
627
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
628 if (bevent->button == 3)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629 {
388
5186f8e38cb8 Make directory view popup menu common and move it to view_dir.{c,h}.
zas_
parents: 385
diff changeset
630 vd->popup = vd_pop_menu(vd, vd->click_fd);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
631 gtk_menu_popup(GTK_MENU(vd->popup), NULL, NULL, NULL, NULL,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
632 bevent->button, bevent->time);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
635 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
636 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
637
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
638 static gint vdlist_release_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
640 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
641 GtkTreePath *tpath;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
642 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
643 FileData *fd = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
644
383
499d7ba62261 Move some dnd common code from view_dir_list.c and view_dir_tree.c
zas_
parents: 381
diff changeset
645 vd_color_set(vd, vd->click_fd, FALSE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
646
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
647 if (bevent->button != 1) return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
648
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
649 if ((bevent->x != 0 || bevent->y != 0) &&
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
650 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
651 &tpath, NULL, NULL, NULL))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
652 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
653 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
654
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
655 store = gtk_tree_view_get_model(GTK_TREE_VIEW(widget));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
656 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
657 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
658 gtk_tree_path_free(tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
659 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
660
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
661 if (fd && vd->click_fd == fd)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
662 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
663 vdlist_select_row(vd, vd->click_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
664 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
665
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
666 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
667 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
668
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
669 static void vdlist_select_cb(GtkTreeView *tview, GtkTreePath *tpath, GtkTreeViewColumn *column, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
670 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
671 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
672 GtkTreeModel *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
673 GtkTreeIter iter;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
674 FileData *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
675
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
676 store = gtk_tree_view_get_model(tview);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
677 gtk_tree_model_get_iter(store, &iter, tpath);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
678 gtk_tree_model_get(store, &iter, DIR_COLUMN_POINTER, &fd, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
679
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
680 vdlist_select_row(vd, fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
681 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
682
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
683 static GdkColor *vdlist_color_shifted(GtkWidget *widget)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
684 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
685 static GdkColor color;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
686 static GtkWidget *done = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
687
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
688 if (done != widget)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
689 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
690 GtkStyle *style;
384
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
691
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
692 style = gtk_widget_get_style(widget);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
693 memcpy(&color, &style->base[GTK_STATE_NORMAL], sizeof(color));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
694 shift_color(&color, -1, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
695 done = widget;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
696 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
697
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
698 return &color;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
699 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
700
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
701 static void vdlist_color_cb(GtkTreeViewColumn *tree_column, GtkCellRenderer *cell,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
702 GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
703 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
704 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
705 gboolean set;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
706
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
707 gtk_tree_model_get(tree_model, iter, DIR_COLUMN_COLOR, &set, -1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
708 g_object_set(G_OBJECT(cell),
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
709 "cell-background-gdk", vdlist_color_shifted(vd->view),
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
710 "cell-background-set", set, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
711 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
712
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
713 static void vdlist_destroy_cb(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
714 {
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
715 ViewDir *vd = data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
716
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
717 vdlist_dnd_drop_scroll_cancel(vd);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
718 widget_auto_scroll_stop(vd->view);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
719
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
720 filelist_free(VDLIST_INFO(vd, list));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
721 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
722
384
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
723 ViewDir *vdlist_new(ViewDir *vd, const gchar *path)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
724 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
725 GtkListStore *store;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
726 GtkTreeSelection *selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
727 GtkTreeViewColumn *column;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
728 GtkCellRenderer *renderer;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
729
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
730 vd->info = g_new0(ViewDirInfoList, 1);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
731 vd->type = DIRVIEW_LIST;
384
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
732 vd->widget_destroy_cb = vdlist_destroy_cb;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
733
384
392dd6541d51 Merge parts of view_dir_list/tree constructors/destructors to
zas_
parents: 383
diff changeset
734 VDLIST_INFO(vd, list) = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
735
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
736 store = gtk_list_store_new(4, G_TYPE_POINTER, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_BOOLEAN);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
737 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
738 g_object_unref(store);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
739
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
740 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(vd->view), FALSE);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
741 gtk_tree_view_set_enable_search(GTK_TREE_VIEW(vd->view), FALSE);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
742 g_signal_connect(G_OBJECT(vd->view), "row_activated",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
743
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
744 G_CALLBACK(vdlist_select_cb), vd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
745
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
746 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vd->view));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
747 gtk_tree_selection_set_mode(selection, GTK_SELECTION_NONE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
748
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
749 column = gtk_tree_view_column_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
750 gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
751
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
752 renderer = gtk_cell_renderer_pixbuf_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
753 gtk_tree_view_column_pack_start(column, renderer, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
754 gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", DIR_COLUMN_ICON);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
755 gtk_tree_view_column_set_cell_data_func(column, renderer, vdlist_color_cb, vd, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
756
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
757 renderer = gtk_cell_renderer_text_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
758 gtk_tree_view_column_pack_start(column, renderer, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
759 gtk_tree_view_column_add_attribute(column, renderer, "text", DIR_COLUMN_NAME);
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
760 gtk_tree_view_column_set_cell_data_func(column, renderer, vdlist_color_cb, vd, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
761
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
762 gtk_tree_view_append_column(GTK_TREE_VIEW(vd->view), column);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
763
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
764 g_signal_connect(G_OBJECT(vd->view), "key_press_event",
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
765 G_CALLBACK(vdlist_press_key_cb), vd);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
766 gtk_container_add(GTK_CONTAINER(vd->widget), vd->view);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
767 gtk_widget_show(vd->view);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
768
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
769 vdlist_dnd_init(vd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
770
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
771 g_signal_connect(G_OBJECT(vd->view), "button_press_event",
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
772 G_CALLBACK(vdlist_press_cb), vd);
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
773 g_signal_connect(G_OBJECT(vd->view), "button_release_event",
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
774 G_CALLBACK(vdlist_release_cb), vd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
775
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
776 if (path) vdlist_set_path(vd, path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
777
381
ff63dcb0425c Rename vdl occurences to vd.
zas_
parents: 380
diff changeset
778 return vd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
779 }