Scan directories using GIO.
[rox-filer.git] / ROX-Filer / src / filer.h
blobf0deb2bd2e11868f93a63d6725f16935d8018261
1 /*
2 * ROX-Filer, filer for the ROX desktop project
3 * By Thomas Leonard, <tal197@users.sourceforge.net>.
4 */
6 #ifndef _FILER_H
7 #define _FILER_H
9 #include <gio/gio.h>
10 #include <gtk/gtk.h>
12 enum {
13 RESIZE_STYLE = 0,
14 RESIZE_ALWAYS = 1,
15 RESIZE_NEVER = 2,
18 typedef enum
20 OPEN_SHIFT = 0x01, /* Do ShiftOpen */
21 OPEN_SAME_WINDOW = 0x02, /* Directories open in same window */
22 OPEN_CLOSE_WINDOW = 0x04, /* Opening files closes the window */
23 OPEN_FROM_MINI = 0x08, /* Non-dir => close minibuffer */
24 } OpenFlags;
26 typedef enum
28 FILER_NEEDS_RESCAN = 0x01, /* Call may_rescan after scanning */
29 FILER_UPDATING = 0x02, /* (scanning) items may already exist */
30 FILER_CREATE_THUMBS = 0x04, /* Create thumbs when scan ends */
31 } FilerFlags;
33 /* Numbers used in options */
34 typedef enum
36 VIEW_TYPE_COLLECTION = 0, /* Icons view */
37 VIEW_TYPE_DETAILS = 1 /* TreeView details list */
38 } ViewType;
40 /* Filter types */
41 typedef enum
43 FILER_SHOW_ALL, /* Show all files, modified by show_hidden */
44 FILER_SHOW_GLOB, /* Show files that match a glob pattern */
45 } FilterType;
47 /* iter's next method has just returned the clicked item... */
48 typedef void (*TargetFunc)(FilerWindow *filer_window,
49 ViewIter *iter,
50 gpointer data);
52 struct _FilerWindow
54 GtkWidget *window;
55 GtkBox *toplevel_vbox, *view_hbox;
56 gboolean scanning; /* State of the 'scanning' indicator */
57 gchar *sym_path; /* Path the user sees */
58 gchar *real_path; /* realpath(sym_path) */
59 ViewIface *view;
60 ViewType view_type;
61 gboolean temp_item_selected;
62 gboolean show_hidden;
63 gboolean filter_directories;
64 FilerFlags flags;
65 SortType sort_type;
66 GtkSortType sort_order;
68 DetailsType details_type;
69 DisplayStyle display_style;
70 DisplayStyle display_style_wanted;
72 Directory *directory;
74 gboolean had_cursor; /* (before changing directory) */
75 char *auto_select; /* If it we find while scanning */
77 GtkWidget *message; /* The 'Running as ...' message */
79 GtkWidget *minibuffer_area; /* The hbox to show/hide */
80 GtkWidget *minibuffer_label; /* The operation name */
81 GtkWidget *minibuffer; /* The text entry */
82 int mini_cursor_base; /* XXX */
83 MiniType mini_type;
85 FilterType filter;
86 gchar *filter_string; /* Glob or regexp pattern */
87 gchar *regexp; /* Compiled regexp pattern */
88 /* TRUE if hidden files are shown because the minibuffer leafname
89 * starts with a dot.
91 gboolean temp_show_hidden;
93 TargetFunc target_cb;
94 gpointer target_data;
96 GtkWidget *toolbar;
97 GtkWidget *toolbar_text;
98 GtkWidget *scrollbar;
100 gint open_timeout; /* Will resize and show window... */
102 GtkStateType selection_state; /* for drawing selection */
104 gboolean show_thumbs;
105 GList *thumb_queue; /* paths to thumbnail */
106 GtkWidget *thumb_bar, *thumb_progress;
107 int max_thumbs; /* total for this batch */
109 gint auto_scroll; /* Timer */
111 char *window_id; /* For remote control */
114 extern FilerWindow *window_with_focus;
115 extern GList *all_filer_windows;
116 extern GHashTable *child_to_filer;
117 extern Option o_filer_auto_resize, o_unique_filer_windows;
118 extern Option o_filer_size_limit;
120 /* Prototypes */
121 void filer_init(void);
122 FilerWindow *filer_opendir(const char *path, FilerWindow *src_win, const gchar *wm_class);
123 FilerWindow *filer_opendir_gfile(GFile *path, FilerWindow *src_win, const gchar *wm_class);
124 gboolean filer_update_dir(FilerWindow *filer_window, gboolean warning);
125 void filer_update_all(void);
126 DirItem *filer_selected_item(FilerWindow *filer_window);
127 void change_to_parent(FilerWindow *filer_window);
128 void full_refresh(void);
129 void filer_openitem(FilerWindow *filer_window, ViewIter *iter, OpenFlags flags);
130 void filer_check_mounted(const char *real_path);
131 void filer_close_recursive(const char *path);
132 void filer_change_to(FilerWindow *filer_window,
133 const char *path, const char *from);
134 gboolean filer_exists(FilerWindow *filer_window);
135 FilerWindow *filer_get_by_id(const char *id);
136 void filer_set_id(FilerWindow *, const char *id);
137 void filer_open_parent(FilerWindow *filer_window);
138 void filer_detach_rescan(FilerWindow *filer_window);
139 void filer_target_mode(FilerWindow *filer_window,
140 TargetFunc fn,
141 gpointer data,
142 const char *reason);
143 GList *filer_selected_items(FilerWindow *filer_window);
144 void filer_create_thumb(FilerWindow *filer_window, const gchar *pathname);
145 void filer_cancel_thumbnails(FilerWindow *filer_window);
146 void filer_set_title(FilerWindow *filer_window);
147 void filer_create_thumbs(FilerWindow *filer_window);
148 void filer_add_tip_details(FilerWindow *filer_window,
149 GString *tip, DirItem *item);
150 void filer_selection_changed(FilerWindow *filer_window, gint time);
151 void filer_lost_selection(FilerWindow *filer_window, guint time);
152 void filer_window_set_size(FilerWindow *filer_window, int w, int h);
153 gboolean filer_window_delete(GtkWidget *window,
154 GdkEvent *unused,
155 FilerWindow *filer_window);
156 void filer_set_view_type(FilerWindow *filer_window, ViewType type);
157 void filer_window_toggle_cursor_item_selected(FilerWindow *filer_window);
158 void filer_perform_action(FilerWindow *filer_window, GdkEventButton *event);
159 gint filer_motion_notify(FilerWindow *filer_window, GdkEventMotion *event);
160 gint filer_key_press_event(GtkWidget *widget, GdkEventKey *event,
161 FilerWindow *filer_window);
162 void filer_set_autoscroll(FilerWindow *filer_window, gboolean auto_scroll);
163 void filer_refresh(FilerWindow *filer_window);
165 gboolean filer_match_filter(FilerWindow *filer_window, DirItem *item);
166 gboolean filer_set_filter(FilerWindow *filer_window,
167 FilterType type, const gchar *filter_string);
168 void filer_set_filter_directories(FilerWindow *fwin, gboolean filter_directories);
169 void filer_set_hidden(FilerWindow *fwin, gboolean hidden);
170 void filer_next_selected(FilerWindow *filer_window, int dir);
171 void filer_save_settings(FilerWindow *fwin);
173 #endif /* _FILER_H */