summaryrefslogtreecommitdiff
path: root/libnautilus-private/nautilus-window-info.h
blob: d798a7711f5a51db68eecd24997e599693b63da7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-

   nautilus-window-info.h: Interface for nautilus windows
 
   Copyright (C) 2004 Red Hat Inc.
  
   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: Alexander Larsson <alexl@redhat.com>
*/

#ifndef NAUTILUS_WINDOW_INFO_H
#define NAUTILUS_WINDOW_INFO_H

#include <glib-object.h>
#include <libnautilus-private/nautilus-view.h>
#include <gtk/gtk.h>

G_BEGIN_DECLS

typedef enum
{
	NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT,
	NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_ENABLE,
	NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DISABLE
} NautilusWindowShowHiddenFilesMode;


typedef enum {
	NAUTILUS_WINDOW_OPEN_ACCORDING_TO_MODE,
	NAUTILUS_WINDOW_OPEN_IN_SPATIAL,
	NAUTILUS_WINDOW_OPEN_IN_NAVIGATION
} NautilusWindowOpenMode;

typedef enum {
	/* used in spatial mode */
	NAUTILUS_WINDOW_OPEN_FLAG_CLOSE_BEHIND = 1<<0,
	/* used in navigation mode */
	NAUTILUS_WINDOW_OPEN_FLAG_NEW_WINDOW = 1<<1,
	NAUTILUS_WINDOW_OPEN_FLAG_NEW_TAB = 1<<2
} NautilusWindowOpenFlags;

typedef	enum {
	NAUTILUS_WINDOW_SPATIAL,
	NAUTILUS_WINDOW_NAVIGATION,
	NAUTILUS_WINDOW_DESKTOP
} NautilusWindowType;

#define NAUTILUS_TYPE_WINDOW_INFO           (nautilus_window_info_get_type ())
#define NAUTILUS_WINDOW_INFO(obj)           (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_WINDOW_INFO, NautilusWindowInfo))
#define NAUTILUS_IS_WINDOW_INFO(obj)        (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_WINDOW_INFO))
#define NAUTILUS_WINDOW_INFO_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NAUTILUS_TYPE_WINDOW_INFO, NautilusWindowInfoIface))

#ifndef NAUTILUS_WINDOW_DEFINED
#define NAUTILUS_WINDOW_DEFINED
/* Using NautilusWindow for the vtable to make implementing this in 
 * NautilusWindow easier */
typedef struct NautilusWindow          NautilusWindow;
#endif

#ifndef NAUTILUS_WINDOW_SLOT_DEFINED
#define NAUTILUS_WINDOW_SLOT_DEFINED
typedef struct NautilusWindowSlot      NautilusWindowSlot;
#endif


typedef NautilusWindowSlot              NautilusWindowSlotInfo;
typedef NautilusWindow                  NautilusWindowInfo;

typedef struct _NautilusWindowInfoIface NautilusWindowInfoIface;

typedef void (* NautilusWindowGoToCallback) (NautilusWindow *window,
                                             GError *error,
                                             gpointer user_data);

struct _NautilusWindowInfoIface 
{
	GTypeInterface g_iface;

	/* signals: */

        void           (* loading_uri)              (NautilusWindowInfo *window,
						     const char        *uri);
	/* Emitted when the view in the window changes the selection */
        void           (* selection_changed)        (NautilusWindowInfo *window);
        void           (* title_changed)            (NautilusWindowInfo *window,
						     const char         *title);
        void           (* hidden_files_mode_changed)(NautilusWindowInfo *window);
  
	/* VTable: */
	/* A view calls this once after a load_location, once it starts loading the
	 * directory. Might be called directly, or later on the mainloop.
	 * This can also be called at any other time if the view needs to
	 * re-load the location. But the view needs to call load_complete first if
	 * its currently loading. */
	void (* report_load_underway) (NautilusWindowInfo *window,
				       NautilusView *view);
	/* A view calls this once after reporting load_underway, when the location
	   has been fully loaded, or when the load was stopped
	   (by an error or by the user). */
	void (* report_load_complete) (NautilusWindowInfo *window,
				       NautilusView *view);
	/* This can be called at any time when there has been a catastrophic failure of
	   the view. It will result in the view being removed. */
	void (* report_view_failed)   (NautilusWindowInfo *window,
				       NautilusView *view);
	void (* report_selection_changed) (NautilusWindowInfo *window);
	
	/* Returns the number of selected items in the view */	
	int  (* get_selection_count)  (NautilusWindowInfo    *window);
	
	/* Returns a list of uris for th selected items in the view, caller frees it */	
	GList *(* get_selection)      (NautilusWindowInfo    *window);

	char * (* get_current_location)  (NautilusWindowInfo *window);
	void   (* push_status)           (NautilusWindowInfo *window,
					  const char *status);
	char * (* get_title)             (NautilusWindowInfo *window);
	GList *(* get_history)           (NautilusWindowInfo *window);
	NautilusWindowType
	       (* get_window_type)       (NautilusWindowInfo *window);
	NautilusWindowShowHiddenFilesMode
	       (* get_hidden_files_mode) (NautilusWindowInfo *window);
	void   (* set_hidden_files_mode) (NautilusWindowInfo *window,
				       NautilusWindowShowHiddenFilesMode mode);

	NautilusWindowSlotInfo * (* get_active_slot) (NautilusWindowInfo *window);
	NautilusWindowSlotInfo * (* get_extra_slot)  (NautilusWindowInfo *window);

	gboolean (* get_initiated_unmount) (NautilusWindowInfo *window);
	void   (* set_initiated_unmount) (NautilusWindowInfo *window,
					  gboolean initiated_unmount);

	void   (* view_visible)        (NautilusWindowInfo *window,
					NautilusView *view);
	void   (* close_window)       (NautilusWindowInfo *window);
	GtkUIManager *     (* get_ui_manager)   (NautilusWindowInfo *window);
};

GType                             nautilus_window_info_get_type                 (void);
void                              nautilus_window_info_report_load_underway     (NautilusWindowInfo                *window,
										 NautilusView                      *view);
void                              nautilus_window_info_report_load_complete     (NautilusWindowInfo                *window,
										 NautilusView                      *view);
void                              nautilus_window_info_report_view_failed       (NautilusWindowInfo                *window,
										 NautilusView                      *view);
void                              nautilus_window_info_report_selection_changed (NautilusWindowInfo                *window);
NautilusWindowSlotInfo *          nautilus_window_info_get_active_slot          (NautilusWindowInfo                *window);
NautilusWindowSlotInfo *          nautilus_window_info_get_extra_slot           (NautilusWindowInfo                *window);
void                              nautilus_window_info_view_visible             (NautilusWindowInfo                *window,
										 NautilusView                      *view);
void                              nautilus_window_info_close                    (NautilusWindowInfo                *window);
void                              nautilus_window_info_push_status              (NautilusWindowInfo                *window,
										 const char                        *status);
NautilusWindowType                nautilus_window_info_get_window_type          (NautilusWindowInfo                *window);
char *                            nautilus_window_info_get_title                (NautilusWindowInfo                *window);
GList *                           nautilus_window_info_get_history              (NautilusWindowInfo                *window);
char *                            nautilus_window_info_get_current_location     (NautilusWindowInfo                *window);
int                               nautilus_window_info_get_selection_count      (NautilusWindowInfo                *window);
GList *                           nautilus_window_info_get_selection            (NautilusWindowInfo                *window);
NautilusWindowShowHiddenFilesMode nautilus_window_info_get_hidden_files_mode    (NautilusWindowInfo                *window);
void                              nautilus_window_info_set_hidden_files_mode    (NautilusWindowInfo                *window,
										 NautilusWindowShowHiddenFilesMode  mode);
gboolean                          nautilus_window_info_get_initiated_unmount    (NautilusWindowInfo                *window);
void                              nautilus_window_info_set_initiated_unmount    (NautilusWindowInfo                *window,
										 gboolean initiated_unmount);
GtkUIManager *                    nautilus_window_info_get_ui_manager           (NautilusWindowInfo                *window);

G_END_DECLS

#endif /* NAUTILUS_WINDOW_INFO_H */