1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
4
* Copyright (C) 1999, 2000 Free Software Foundaton
5
* Copyright (C) 2000, 2001 Eazel, Inc.
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License as
9
* published by the Free Software Foundation; either version 2 of the
10
* License, or (at your option) any later version.
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* General Public License for more details.
17
* You should have received a copy of the GNU General Public
18
* License along with this program; if not, write to the
19
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
* Boston, MA 02111-1307, USA.
22
* Authors: Ettore Perazzoli
23
* Darin Adler <darin@bentspoon.com>
24
* John Sullivan <sullivan@eazel.com>
25
* Pavel Cisler <pavel@eazel.com>
28
#ifndef FM_DIRECTORY_VIEW_H
29
#define FM_DIRECTORY_VIEW_H
32
#include "gof-directory-async.h"
34
#include "marlin-window-columns.h"
35
#include "gof-window-slot.h"
38
typedef struct FMDirectoryView FMDirectoryView;
39
typedef struct FMDirectoryViewClass FMDirectoryViewClass;
41
#define FM_TYPE_DIRECTORY_VIEW fm_directory_view_get_type()
42
#define FM_DIRECTORY_VIEW(obj) \
43
(G_TYPE_CHECK_INSTANCE_CAST ((obj), FM_TYPE_DIRECTORY_VIEW, FMDirectoryView))
44
#define FM_DIRECTORY_VIEW_CLASS(klass) \
45
(G_TYPE_CHECK_CLASS_CAST ((klass), FM_TYPE_DIRECTORY_VIEW, FMDirectoryViewClass))
46
#define FM_IS_DIRECTORY_VIEW(obj) \
47
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), FM_TYPE_DIRECTORY_VIEW))
48
#define FM_IS_DIRECTORY_VIEW_CLASS(klass) \
49
(G_TYPE_CHECK_CLASS_TYPE ((klass), FM_TYPE_DIRECTORY_VIEW))
50
#define FM_DIRECTORY_VIEW_GET_CLASS(obj) \
51
(G_TYPE_INSTANCE_GET_CLASS ((obj), FM_TYPE_DIRECTORY_VIEW, FMDirectoryViewClass))
53
typedef struct FMDirectoryViewDetails FMDirectoryViewDetails;
55
struct FMDirectoryView {
56
GtkScrolledWindow parent;
57
FMDirectoryViewDetails *details;
60
struct FMDirectoryViewClass {
61
GtkScrolledWindowClass parent_class;
63
/* The 'clear' signal is emitted to empty the view of its contents.
64
* It must be replaced by each subclass.
66
// void (* clear) (FMDirectoryView *view);
68
/* The 'begin_file_changes' signal is emitted before a set of files
69
* are added to the view. It can be replaced by a subclass to do any
70
* necessary preparation for a set of new files. The default
71
* implementation does nothing.
73
//void (* begin_file_changes) (FMDirectoryView *view);
75
/* The 'add_file' signal is emitted to add one file to the view.
76
* It must be replaced by each subclass.
78
void (* add_file) (FMDirectoryView *view,
80
GOFDirectoryAsync *directory);
82
void (* remove_file) (FMDirectoryView *view,
84
GOFDirectoryAsync *directory);
86
/* The 'file_changed' signal is emitted to signal a change in a file,
87
* including the file being removed.
88
* It must be replaced by each subclass.
90
void (* file_changed) (FMDirectoryView *view,
92
GOFDirectoryAsync *directory);
94
/* The 'end_file_changes' signal is emitted after a set of files
95
* are added to the view. It can be replaced by a subclass to do any
96
* necessary cleanup (typically, cleanup for code in begin_file_changes).
97
* The default implementation does nothing.
99
//void (* end_file_changes) (FMDirectoryView *view);
101
//void (* flush_added_files) (FMDirectoryView *view);
103
/* The 'begin_loading' signal is emitted before any of the contents
104
* of a directory are added to the view. It can be replaced by a
105
* subclass to do any necessary preparation to start dealing with a
106
* new directory. The default implementation does nothing.
108
void (* begin_loading) (FMDirectoryView *view);
110
/* The 'end_loading' signal is emitted after all of the contents
111
* of a directory are added to the view. It can be replaced by a
112
* subclass to do any necessary clean-up. The default implementation
115
* If all_files_seen is true, the handler may assume that
116
* no load error ocurred, and all files of the underlying
117
* directory were loaded.
119
* Otherwise, end_loading was emitted due to cancellation,
120
* which usually means that not all files are available.
122
void (* end_loading) (FMDirectoryView *view,
123
gboolean all_files_seen);
125
/* The 'load_error' signal is emitted when the directory model
126
* reports an error in the process of monitoring the directory's
127
* contents. The load error indicates that the process of
128
* loading the contents has ended, but the directory is still
129
* being monitored. The default implementation handles common
130
* load failures like ACCESS_DENIED.
132
void (* load_error) (FMDirectoryView *view,
135
/* Function pointers that don't have corresponding signals */
137
/* reset_to_defaults is a function pointer that subclasses must
138
* override to set sort order, zoom level, etc to match default
141
void (* reset_to_defaults) (FMDirectoryView *view);
143
/* get_selection is not a signal; it is just a function pointer for
144
* subclasses to replace (override). Subclasses must replace it
145
* with a function that returns a newly-allocated GList of
148
GList * (* get_selection) (FMDirectoryView *view);
150
/* get_selection_for_file_transfer is a function pointer for
151
* subclasses to replace (override). Subclasses must replace it
152
* with a function that returns a newly-allocated GList of
153
* GOFFile pointers. The difference from get_selection is
154
* that any files in the selection that also has a parent folder
155
* in the selection is not included.
157
GList * (* get_selection_for_file_transfer)(FMDirectoryView *view);
159
/* select_all is a function pointer that subclasses must override to
160
* select all of the items in the view */
161
void (* select_all) (FMDirectoryView *view);
163
/* set_selection is a function pointer that subclasses must
164
* override to select the specified items (and unselect all
165
* others). The argument is a list of GOFFiles. */
167
void (* set_selection) (FMDirectoryView *view,
170
/* invert_selection is a function pointer that subclasses must
171
* override to invert selection. */
173
void (* invert_selection) (FMDirectoryView *view);
175
/* Return an array of locations of selected icons in their view. */
176
//GArray * (* get_selected_icon_locations) (FMDirectoryView *view);
178
guint (* get_item_count) (FMDirectoryView *view);
180
/* bump_zoom_level is a function pointer that subclasses must override
181
* to change the zoom level of an object. */
182
/*void (* bump_zoom_level) (FMDirectoryView *view,
183
int zoom_increment);*/
185
/* zoom_to_level is a function pointer that subclasses must override
186
* to set the zoom level of an object to the specified level. */
187
/*void (* zoom_to_level) (FMDirectoryView *view,
188
NautilusZoomLevel level);*/
190
//NautilusZoomLevel (* get_zoom_level) (FMDirectoryView *view);
192
/* restore_default_zoom_level is a function pointer that subclasses must override
193
* to restore the zoom level of an object to a default setting. */
194
//void (* restore_default_zoom_level) (FMDirectoryView *view);
196
/* can_zoom_in is a function pointer that subclasses must override to
197
* return whether the view is at maximum size (furthest-in zoom level) */
198
//gboolean (* can_zoom_in) (FMDirectoryView *view);
200
/* can_zoom_out is a function pointer that subclasses must override to
201
* return whether the view is at minimum size (furthest-out zoom level) */
202
//gboolean (* can_zoom_out) (FMDirectoryView *view);
204
/* reveal_selection is a function pointer that subclasses may
205
* override to make sure the selected items are sufficiently
206
* apparent to the user (e.g., scrolled into view). By default,
209
void (* reveal_selection) (FMDirectoryView *view);
211
/* get_background is a function pointer that subclasses must
212
* override to return the EelBackground for this view.
214
//GtkWidget * (* get_background_widget) (FMDirectoryView *view);
216
/* merge_menus is a function pointer that subclasses can override to
217
* add their own menu items to the window's menu bar.
218
* If overridden, subclasses must call parent class's function.
220
//void (* merge_menus) (FMDirectoryView *view);
221
//void (* unmerge_menus) (FMDirectoryView *view);
223
/* update_menus is a function pointer that subclasses can override to
224
* update the sensitivity or wording of menu items in the menu bar.
225
* It is called (at least) whenever the selection changes. If overridden,
226
* subclasses must call parent class's function.
228
//void (* update_menus) (FMDirectoryView *view);
230
/* sort_files is a function pointer that subclasses can override
231
* to provide a sorting order to determine which files should be
232
* presented when only a partial list is provided.
234
int (* compare_files) (FMDirectoryView *view,
238
/* get_emblem_names_to_exclude is a function pointer that subclasses
239
* may override to specify a set of emblem names that should not
240
* be displayed with each file. By default, all emblems returned by
241
* GOFFile are displayed.
243
//char ** (* get_emblem_names_to_exclude) (FMDirectoryView *view);
245
/* file_limit_reached is a function pointer that subclasses may
246
* override to control what happens when a directory is loaded
247
* that has more files than Nautilus can handle. The default
248
* implmentation puts up a dialog box that is appropriate to
249
* display when the user explicitly tried to visit a location that
250
* they would think of as a normal directory.
252
//void (* file_limit_reached) (FMDirectoryView *view);
254
/* supports_properties is a function pointer that subclasses may
255
* override to control whether the "Show Properties" menu item
256
* should be enabled for selected items. The default implementation
259
//gboolean (* supports_properties) (FMDirectoryView *view);
261
/* supports_zooming is a function pointer that subclasses may
262
* override to control whether or not the zooming control and
263
* menu items should be enabled. The default implementation
266
//gboolean (* supports_zooming) (FMDirectoryView *view);
268
/* using_manual_layout is a function pointer that subclasses may
269
* override to control whether or not items can be freely positioned
270
* on the user-visible area.
271
* Note that this value is not guaranteed to be constant within the
272
* view's lifecycle. */
273
//gboolean (* using_manual_layout) (FMDirectoryView *view);
275
/* is_read_only is a function pointer that subclasses may
276
* override to control whether or not the user is allowed to
277
* change the contents of the currently viewed directory. The
278
* default implementation checks the permissions of the
281
gboolean (* is_read_only) (FMDirectoryView *view);
283
/* is_empty is a function pointer that subclasses must
284
* override to report whether the view contains any items.
286
gboolean (* is_empty) (FMDirectoryView *view);
288
/* supports_creating_files is a function pointer that subclasses may
289
* override to control whether or not new items can be created.
290
* be accepted. The default implementation checks whether the
291
* user has write permissions for the viewed directory, and whether
292
* the viewed directory is in the trash.
294
gboolean (* supports_creating_files) (FMDirectoryView *view);
296
/* accepts_dragged_files is a function pointer that subclasses may
297
* override to control whether or not files can be dropped in this
298
* location. The default implementation returns TRUE.
300
//gboolean (* accepts_dragged_files) (FMDirectoryView *view);
302
/*gboolean (* can_rename_file) (FMDirectoryView *view,
304
/* select_all specifies whether the whole filename should be selected
305
* or only its basename (i.e. everything except the extension)
307
void (* start_renaming_file) (FMDirectoryView *view,
309
gboolean select_all);
311
/*gboolean (* file_still_belongs) (FMDirectoryView *view,
313
GOFDirectoryAsync *directory);
316
/* convert *point from widget's coordinate system to a coordinate
317
* system used for specifying file operation positions, which is view-specific.
319
* This is used by the the icon view, which converts the screen position to a zoom
320
* level-independent coordinate system.
322
/*void (* widget_to_file_operation_position) (FMDirectoryView *view,
326
/* Preference change callbacks, overriden by icon and list views.
327
* Icon and list views respond by synchronizing to the new preference
328
* values and forcing an update if appropriate.
330
/*void (* text_attribute_names_changed) (FMDirectoryView *view);
331
void (* embedded_text_policy_changed) (FMDirectoryView *view);
332
void (* image_display_policy_changed) (FMDirectoryView *view);
333
void (* click_policy_changed) (FMDirectoryView *view);
334
void (* sort_directories_first_changed) (FMDirectoryView *view);
336
void (* emblems_changed) (FMDirectoryView *view);
338
void (* set_is_active) (FMDirectoryView *view,
342
/* Signals used only for keybindings */
343
/*gboolean (* trash) (FMDirectoryView *view);
344
gboolean (* delete) (FMDirectoryView *view);*/
348
/* GObject support */
349
GType fm_directory_view_get_type (void);
350
void fm_directory_view_add_subdirectory (FMDirectoryView *view, GOFDirectoryAsync *directory);
351
void fm_directory_view_remove_subdirectory (FMDirectoryView *view, GOFDirectoryAsync *directory);
352
void fm_directory_view_column_add_location (FMDirectoryView *dview, GFile *location);
353
void fm_directory_view_column_add_preview (FMDirectoryView *dview, GFile *location);
354
void fm_directory_view_set_active_slot (FMDirectoryView *dview);
355
void fm_directory_view_load_location (FMDirectoryView *directory_view, GFile *location);
358
#endif /* FM_DIRECTORY_VIEW_H */