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