fm-directory-view.h 6.02 KB
Newer Older
Ettore Perazzoli's avatar
Ettore Perazzoli committed
1
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2
/* fm-directory-view.h
Ettore Perazzoli's avatar
Ettore Perazzoli committed
3
 *
Elliot Lee's avatar
Elliot Lee committed
4
 * Copyright (C) 1999, 2000  Free Software Foundaton
5
 * Copyright (C) 2000  Eazel, Inc.
Ettore Perazzoli's avatar
Ettore Perazzoli committed
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this program; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Author: Ettore Perazzoli
 */

25 26 27 28 29
#ifndef FM_DIRECTORY_VIEW_H
#define FM_DIRECTORY_VIEW_H

#include <gtk/gtkscrolledwindow.h>
#include <libnautilus/ntl-content-view-frame.h>
30
#include <libnautilus/nautilus-directory.h>
Ettore Perazzoli's avatar
Ettore Perazzoli committed
31 32


33

34
enum _FMDirectoryViewSortType {
35
	FM_DIRECTORY_VIEW_SORT_NONE,
36 37
	FM_DIRECTORY_VIEW_SORT_BYNAME,
	FM_DIRECTORY_VIEW_SORT_BYSIZE,
38 39
	FM_DIRECTORY_VIEW_SORT_BYTYPE,
	FM_DIRECTORY_VIEW_SORT_BYMTIME
Ettore Perazzoli's avatar
Ettore Perazzoli committed
40
};
41
typedef enum _FMDirectoryViewSortType FMDirectoryViewSortType;
Ettore Perazzoli's avatar
Ettore Perazzoli committed
42 43


44 45
typedef struct _FMDirectoryView      FMDirectoryView;
typedef struct _FMDirectoryViewClass FMDirectoryViewClass;
Ettore Perazzoli's avatar
Ettore Perazzoli committed
46

47 48 49
#define FM_TYPE_DIRECTORY_VIEW			(fm_directory_view_get_type ())
#define FM_DIRECTORY_VIEW(obj)			(GTK_CHECK_CAST ((obj), FM_TYPE_DIRECTORY_VIEW, FMDirectoryView))
#define FM_DIRECTORY_VIEW_CLASS(klass)		(GTK_CHECK_CLASS_CAST ((klass), FM_TYPE_DIRECTORY_VIEW, FMDirectoryViewClass))
50 51
#define FM_IS_DIRECTORY_VIEW(obj)		(GTK_CHECK_TYPE ((obj), FM_TYPE_DIRECTORY_VIEW))
#define FM_IS_DIRECTORY_VIEW_CLASS(klass)	(GTK_CHECK_CLASS_TYPE ((obj), FM_TYPE_DIRECTORY_VIEW))
Ettore Perazzoli's avatar
Ettore Perazzoli committed
52

53
typedef struct _FMDirectoryViewDetails FMDirectoryViewDetails;
Ettore Perazzoli's avatar
Ettore Perazzoli committed
54

55 56 57
struct _FMDirectoryView {
	GtkScrolledWindow parent;
	FMDirectoryViewDetails *details;
Ettore Perazzoli's avatar
Ettore Perazzoli committed
58 59
};

60
struct _FMDirectoryViewClass {
61
	GtkScrolledWindowClass parent_class;
62

63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
	/* The 'clear' signal is emitted to empty the view of its contents.
	 * It must be replaced by each subclass.
	 */
	void 	(* clear) 		 (FMDirectoryView *view);
	
	/* The 'begin_adding_entries' signal is emitted before a set of entries
	 * are added to the view. It can be replaced by a subclass to do any 
	 * necessary preparation for a set of new entries. The default
	 * implementation does nothing.
	 */
	void 	(* begin_adding_entries) (FMDirectoryView *view);
	
	/* The 'add_entry' signal is emitted to add one entry to the view.
	 * It must be replaced by each subclass.
	 */
	void 	(* add_entry) 		 (FMDirectoryView *view, 
79
					  NautilusFile *file);
80

81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
	/* The 'done_adding_entries' signal is emitted after a set of entries
	 * are added to the view. It can be replaced by a subclass to do any 
	 * necessary cleanup (typically, cleanup for code in begin_adding_entries).
	 * The default implementation does nothing.
	 */
	void 	(* done_adding_entries)  (FMDirectoryView *view);
	
	/* The 'begin_loading' signal is emitted before any of the contents
	 * of a directory are added to the view. It can be replaced by a 
	 * subclass to do any necessary preparation to start dealing with a
	 * new directory. The default implementation does nothing.
	 */
	void 	(* begin_loading) 	 (FMDirectoryView *view);

	/* get_selection is not a signal; it is just a function pointer for
	 * subclasses to replace (override). Subclasses must replace it
	 * with a function that returns a newly-allocated GList of
98
	 * NautilusFile pointers.
99
	 */
100 101
	NautilusFileList *
		(* get_selection) 	 (FMDirectoryView *view);
Ettore Perazzoli's avatar
Ettore Perazzoli committed
102 103 104
};


105

106
/* GtkObject support */
107
GtkType                   fm_directory_view_get_type                 (void);
108

109
/* Component embedding support */
110
NautilusContentViewFrame *fm_directory_view_get_view_frame           (FMDirectoryView         *view);
111

112
/* URI handling */
113 114
void                      fm_directory_view_load_uri                 (FMDirectoryView         *view,
								      const char              *uri);
115

116
/* Functions callable from the user interface and elsewhere. */
117 118 119 120 121
GList *                   fm_directory_view_get_selection            (FMDirectoryView         *view);
void                      fm_directory_view_stop                     (FMDirectoryView         *view);
void                      fm_directory_view_sort                     (FMDirectoryView         *view,
								      FMDirectoryViewSortType  sort_type,
								      gboolean                 reverse_sort);
122

123 124 125 126
/* Wrappers for signal emitters. These are normally called 
 * only by FMDirectoryView itself. They have corresponding signals
 * that observers might want to connect with.
 */
127 128 129
void                      fm_directory_view_clear                    (FMDirectoryView         *view);
void                      fm_directory_view_begin_adding_entries     (FMDirectoryView         *view);
void                      fm_directory_view_add_entry                (FMDirectoryView         *view,
130
								      NautilusFile            *file);
131 132
void                      fm_directory_view_done_adding_entries      (FMDirectoryView         *view);
void                      fm_directory_view_begin_loading            (FMDirectoryView         *view);
133 134 135 136
				       			 
/* Hooks for subclasses to call. These are normally called only by 
 * FMDirectoryView and its subclasses 
 */
137
void                      fm_directory_view_activate_entry           (FMDirectoryView         *view,
138
								      NautilusFile            *file);
139 140
void                      fm_directory_view_notify_selection_changed (FMDirectoryView         *view);
NautilusDirectory *       fm_directory_view_get_model                (FMDirectoryView         *view);
141 142 143
void                      fm_directory_view_popup_background_context_menu  (FMDirectoryView *view);
void                      fm_directory_view_popup_item_context_menu  (FMDirectoryView *view,
								      NautilusFile *file); 
144

145
#endif /* FM_DIRECTORY_VIEW_H */