3 * Copyright (C) 2008 The Geeqie Team
5 * Author: Laurent Monin
7 * This software is released under the GNU General Public License (GNU GPL).
8 * Please read the included file COPYING for more information.
9 * This software comes with no warranty of any kind, use at your own risk!
13 #include "view_file.h"
16 #include "view_file_list.h"
17 #include "view_file_icon.h"
20 void vf_thumb_set(ViewFile *vf, gint enable);
21 void vf_marks_set(ViewFile *vf, gint enable);
22 void vf_sort_set(ViewFile *vf, SortType type, gint ascend);
24 FileData *vf_index_get_data(ViewFile *vf, gint row);
25 gchar *vf_index_get_path(ViewFile *vf, gint row);
26 gint vf_index_by_path(ViewFile *vf, const gchar *path);
27 gint vf_index_by_fd(ViewFile *vf, FileData *in_fd);
28 gint vf_count(ViewFile *vf, gint64 *bytes);
29 GList *vf_get_list(ViewFile *vf);
31 gint vf_index_is_selected(ViewFile *vf, gint row);
32 gint vf_selection_count(ViewFile *vf, gint64 *bytes);
33 GList *vf_selection_get_list(ViewFile *vf);
34 GList *vf_selection_get_list_by_index(ViewFile *vf);
36 void vf_select_all(ViewFile *vf);
37 void vf_select_none(ViewFile *vf);
38 void vf_select_by_path(ViewFile *vf, const gchar *path);
39 void vf_select_by_fd(ViewFile *vf, FileData *fd);
41 void vf_mark_to_selection(ViewFile *vf, gint mark, MarkToSelectionMode mode);
42 void vf_selection_to_mark(ViewFile *vf, gint mark, SelectionToMarkMode mode);
44 void vf_select_marked(ViewFile *vf, gint mark);
45 void vf_mark_selected(ViewFile *vf, gint mark, gint value);
47 gint vf_maint_renamed(ViewFile *vf, FileData *fd);
48 gint vf_maint_removed(ViewFile *vf, FileData *fd, GList *ignore_list);
49 gint vf_maint_moved(ViewFile *vf, FileData *fd, GList *ignore_list);
52 static gint vf_press_key_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
59 static gint vf_press_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
66 static gint vf_release_cb(GtkWidget *widget, GdkEventKey *event, gpointer data)
73 static void vf_dnd_init(ViewFile *vf)
77 gint vf_refresh(ViewFile *vf)
84 gint vf_set_path(ViewFile *vf, const gchar *path)
89 static void vf_destroy_cb(GtkWidget *widget, gpointer data)
95 g_signal_handlers_disconnect_matched(G_OBJECT(vf->popup), G_SIGNAL_MATCH_DATA,
97 gtk_widget_destroy(vf->popup);
104 ViewFile *vf_new(FileViewType type, const gchar *path)
108 vf = g_new0(ViewFile, 1);
113 vf->sort_method = SORT_NAME;
114 vf->sort_ascend = TRUE;
116 vf->thumbs_running = FALSE;
117 vf->thumbs_count = 0;
118 vf->thumbs_loader = NULL;
119 vf->thumbs_filedata = NULL;
123 vf->widget = gtk_scrolled_window_new(NULL, NULL);
124 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(vf->widget), GTK_SHADOW_IN);
125 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(vf->widget),
126 GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
128 vf->listview = NULL; /* FIXME */
130 g_signal_connect(G_OBJECT(vf->widget), "destroy",
131 G_CALLBACK(vf_destroy_cb), vf);
133 g_signal_connect(G_OBJECT(vf->listview), "key_press_event",
134 G_CALLBACK(vf_press_key_cb), vf);
135 g_signal_connect(G_OBJECT(vf->listview), "button_press_event",
136 G_CALLBACK(vf_press_cb), vf);
137 g_signal_connect(G_OBJECT(vf->listview), "button_release_event",
138 G_CALLBACK(vf_release_cb), vf);
140 gtk_container_add(GTK_CONTAINER(vf->widget), vf->listview);
141 gtk_widget_show(vf->listview);
145 if (path) vf_set_path(vf, path);
150 void vf_set_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gpointer data), gpointer data)
152 vf->func_status = func;
153 vf->data_status = data;
156 void vf_set_thumb_status_func(ViewFile *vf, void (*func)(ViewFile *vf, gdouble val, const gchar *text, gpointer data), gpointer data)
158 vf->func_thumb_status = func;
159 vf->data_thumb_status = data;
162 void vf_set_layout(ViewFile *vf, LayoutWindow *layout)