2008-05-05 Paolo Borelli <pborelli@katamail.com>
[nautilus.git] / libnautilus-private / nautilus-window-info.c
blob5c55bdf009fdc0ecf44485dfe4673716b067b9e7
1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*-
3 nautilus-window-info.c: Interface for nautilus window
5 Copyright (C) 2004 Red Hat 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 Author: Alexander Larsson <alexl@redhat.com>
25 #include <config.h>
26 #include "nautilus-window-info.h"
28 enum {
29 LOADING_URI,
30 SELECTION_CHANGED,
31 TITLE_CHANGED,
32 HIDDEN_FILES_MODE_CHANGED,
33 LAST_SIGNAL
36 static guint nautilus_window_info_signals[LAST_SIGNAL] = { 0 };
38 static void
39 nautilus_window_info_base_init (gpointer g_class)
41 static gboolean initialized = FALSE;
43 if (! initialized) {
44 nautilus_window_info_signals[LOADING_URI] =
45 g_signal_new ("loading_uri",
46 NAUTILUS_TYPE_WINDOW_INFO,
47 G_SIGNAL_RUN_LAST,
48 G_STRUCT_OFFSET (NautilusWindowInfoIface, loading_uri),
49 NULL, NULL,
50 g_cclosure_marshal_VOID__STRING,
51 G_TYPE_NONE, 1,
52 G_TYPE_STRING);
54 nautilus_window_info_signals[SELECTION_CHANGED] =
55 g_signal_new ("selection_changed",
56 NAUTILUS_TYPE_WINDOW_INFO,
57 G_SIGNAL_RUN_LAST,
58 G_STRUCT_OFFSET (NautilusWindowInfoIface, selection_changed),
59 NULL, NULL,
60 g_cclosure_marshal_VOID__VOID,
61 G_TYPE_NONE, 0);
63 nautilus_window_info_signals[TITLE_CHANGED] =
64 g_signal_new ("title_changed",
65 NAUTILUS_TYPE_WINDOW_INFO,
66 G_SIGNAL_RUN_LAST,
67 G_STRUCT_OFFSET (NautilusWindowInfoIface, title_changed),
68 NULL, NULL,
69 g_cclosure_marshal_VOID__STRING,
70 G_TYPE_NONE, 1,
71 G_TYPE_STRING);
73 nautilus_window_info_signals[HIDDEN_FILES_MODE_CHANGED] =
74 g_signal_new ("hidden_files_mode_changed",
75 NAUTILUS_TYPE_WINDOW_INFO,
76 G_SIGNAL_RUN_LAST,
77 G_STRUCT_OFFSET (NautilusWindowInfoIface, hidden_files_mode_changed),
78 NULL, NULL,
79 g_cclosure_marshal_VOID__VOID,
80 G_TYPE_NONE, 0);
82 initialized = TRUE;
86 GType
87 nautilus_window_info_get_type (void)
89 static GType type = 0;
91 if (!type) {
92 const GTypeInfo info = {
93 sizeof (NautilusWindowInfoIface),
94 nautilus_window_info_base_init,
95 NULL,
96 NULL,
97 NULL,
98 NULL,
101 NULL
104 type = g_type_register_static (G_TYPE_INTERFACE,
105 "NautilusWindowInfo",
106 &info, 0);
107 g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
110 return type;
113 void
114 nautilus_window_info_report_load_underway (NautilusWindowInfo *window,
115 NautilusView *view)
117 g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
118 g_return_if_fail (NAUTILUS_IS_VIEW (view));
120 (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->report_load_underway) (window,
121 view);
124 void
125 nautilus_window_info_report_load_complete (NautilusWindowInfo *window,
126 NautilusView *view)
128 g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
129 g_return_if_fail (NAUTILUS_IS_VIEW (view));
131 (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->report_load_complete) (window,
132 view);
135 void
136 nautilus_window_info_report_view_failed (NautilusWindowInfo *window,
137 NautilusView *view)
139 g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
140 g_return_if_fail (NAUTILUS_IS_VIEW (view));
142 (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->report_view_failed) (window,
143 view);
146 void
147 nautilus_window_info_report_selection_changed (NautilusWindowInfo *window)
149 g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
151 (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->report_selection_changed) (window);
154 void
155 nautilus_window_info_open_location (NautilusWindowInfo *window,
156 GFile *location,
157 NautilusWindowOpenMode mode,
158 NautilusWindowOpenFlags flags,
159 GList *selection)
161 g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
163 (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->open_location) (window,
164 location,
165 mode,
166 flags,
167 selection);
170 void
171 nautilus_window_info_show_window (NautilusWindowInfo *window)
173 g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
175 (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->show_window) (window);
178 void
179 nautilus_window_info_close (NautilusWindowInfo *window)
181 g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
183 (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->close_window) (window);
186 void
187 nautilus_window_info_set_status (NautilusWindowInfo *window,
188 const char *status)
190 g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
192 (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->set_status) (window,
193 status);
196 NautilusWindowType
197 nautilus_window_info_get_window_type (NautilusWindowInfo *window)
199 g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NAUTILUS_WINDOW_SPATIAL);
201 return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_window_type) (window);
204 char *
205 nautilus_window_info_get_title (NautilusWindowInfo *window)
207 g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL);
209 return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_title) (window);
212 GList *
213 nautilus_window_info_get_history (NautilusWindowInfo *window)
215 g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL);
217 return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_history) (window);
220 NautilusBookmarkList *
221 nautilus_window_info_get_bookmark_list (NautilusWindowInfo *window)
223 g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL);
225 return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_bookmark_list) (window);
229 char *
230 nautilus_window_info_get_current_location (NautilusWindowInfo *window)
232 g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL);
234 return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_current_location) (window);
238 nautilus_window_info_get_selection_count (NautilusWindowInfo *window)
240 g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), 0);
242 return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_selection_count) (window);
245 GList *
246 nautilus_window_info_get_selection (NautilusWindowInfo *window)
248 g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL);
250 return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_selection) (window);
253 NautilusWindowShowHiddenFilesMode
254 nautilus_window_info_get_hidden_files_mode (NautilusWindowInfo *window)
256 g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT);
258 return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_hidden_files_mode) (window);
261 void
262 nautilus_window_info_set_hidden_files_mode (NautilusWindowInfo *window,
263 NautilusWindowShowHiddenFilesMode mode)
265 g_return_if_fail (NAUTILUS_IS_WINDOW_INFO (window));
267 (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->set_hidden_files_mode) (window,
268 mode);
271 GtkUIManager *
272 nautilus_window_info_get_ui_manager (NautilusWindowInfo *window)
274 g_return_val_if_fail (NAUTILUS_IS_WINDOW_INFO (window), NULL);
276 return (* NAUTILUS_WINDOW_INFO_GET_IFACE (window)->get_ui_manager) (window);