nautilus-window-private.h 11.6 KB
Newer Older
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2 3 4 5 6

/*
 *  Nautilus
 *
 *  Copyright (C) 1999, 2000 Red Hat, Inc.
7
 *  Copyright (C) 1999, 2000, 2001 Eazel, Inc.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *
 *  Nautilus 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.
 *
 *  Nautilus 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
23
 *  Authors: Elliot Lee <sopwith@redhat.com>
24
 *           Darin Adler <darin@bentspoon.com>
25 26 27
 *
 */

28 29
#ifndef NAUTILUS_WINDOW_PRIVATE_H
#define NAUTILUS_WINDOW_PRIVATE_H
30

31
#include "nautilus-window.h"
32 33 34
#include "nautilus-spatial-window.h"
#include "nautilus-navigation-window.h"

35 36
#include <bonobo/bonobo-ui-component.h>
#include <bonobo/bonobo-ui-container.h>
37
#include <bonobo/bonobo-ui-toolbar-button-item.h>
38
#include <libnautilus-private/nautilus-directory.h>
39

40 41 42 43
typedef enum {
        NAUTILUS_LOCATION_CHANGE_STANDARD,
        NAUTILUS_LOCATION_CHANGE_BACK,
        NAUTILUS_LOCATION_CHANGE_FORWARD,
44
        NAUTILUS_LOCATION_CHANGE_RELOAD,
45 46
        NAUTILUS_LOCATION_CHANGE_REDIRECT,
        NAUTILUS_LOCATION_CHANGE_FALLBACK
47 48
} NautilusLocationChangeType;

49
/* FIXME bugzilla.gnome.org 42575: Migrate more fields into here. */
50 51
struct NautilusWindowDetails
{
Alexander Larsson's avatar
Alexander Larsson committed
52 53 54
        GtkWidget *table;
        GtkWidget *statusbar;
        GtkWidget *menubar;
55 56

        GtkWidget *extra_location_widgets;
Alexander Larsson's avatar
Alexander Larsson committed
57 58 59 60
        
        GtkUIManager *ui_manager;
        GtkActionGroup *main_action_group; /* owned by ui_manager */
        guint help_message_cid;
61

62
        /* Menus. */
Alexander Larsson's avatar
Alexander Larsson committed
63 64
        guint extensions_menu_merge_id;
        GtkActionGroup *extensions_menu_action_group;
65

66 67 68 69
        GtkActionGroup *bookmarks_action_group;
        guint refresh_bookmarks_menu_idle_id;
        guint bookmarks_merge_id;
        
70
        /* Current location. */
Alexander Larsson's avatar
Alexander Larsson committed
71
        GFile *location;
72
	char *title;
73
	NautilusFile *viewed_file;
74
        gboolean viewed_file_seen;
75
	gboolean viewed_file_in_trash;
76
	gboolean allow_stop;
77

78 79 80
        /* New location. */
        NautilusLocationChangeType location_change_type;
        guint location_change_distance;
Alexander Larsson's avatar
Alexander Larsson committed
81
        GFile *pending_location;
82
        char *pending_scroll_to;
83
        GList *pending_selection;
Alexander Larsson's avatar
Alexander Larsson committed
84
        NautilusFile *determine_view_file;
Alexander Larsson's avatar
Alexander Larsson committed
85 86 87
        GCancellable *mount_cancellable;
        GError *mount_error;
        gboolean tried_mount;
88

89
        /* View As choices */
Alexander Larsson's avatar
Alexander Larsson committed
90 91 92 93 94
        GtkActionGroup *view_as_action_group; /* owned by ui_manager */
        GtkRadioAction *view_as_radio_action;
        GtkRadioAction *extra_viewer_radio_action;
        guint short_list_merge_id;
        guint extra_viewer_merge_id;
95
        GList *short_list_viewers;
Alexander Larsson's avatar
Alexander Larsson committed
96
        char *extra_viewer;
97

98
        /* Deferred location change. */
Alexander Larsson's avatar
Alexander Larsson committed
99
        GFile *location_to_change_to_at_idle;
100
        guint location_change_at_idle_id;
101

Alexander Larsson's avatar
Alexander Larsson committed
102
        NautilusWindowShowHiddenFilesMode show_hidden_files_mode;
103
        gboolean search_mode;
104 105

        GCancellable *find_mount_cancellable;
106 107 108 109 110 111

	/* Ensures that we do not react on signals of a
	 * view that is re-used as new view when its loading
	 * is cancelled
	 */
	gboolean temporarily_ignore_view_signals;
112 113 114 115
};

struct _NautilusNavigationWindowDetails {
        GtkWidget *content_paned;
116
        GtkWidget *content_box;
Alexander Larsson's avatar
Alexander Larsson committed
117 118
        GtkActionGroup *navigation_action_group; /* owned by ui_manager */
        
119 120
        /* Location bar */
        gboolean temporary_navigation_bar;
121
        gboolean temporary_location_bar;
122
        gboolean temporary_search_bar;
123

Martin Wehner's avatar
Martin Wehner committed
124 125
        GtkWidget *location_button;

126 127
        /* Side Pane */
        int side_pane_width;
Alexander Larsson's avatar
Alexander Larsson committed
128
        NautilusSidebar *current_side_panel;
129 130

	/* Menus */
Alexander Larsson's avatar
Alexander Larsson committed
131 132 133 134
        GtkActionGroup *go_menu_action_group;
	guint refresh_go_menu_idle_id;
        guint go_menu_merge_id;
        
135
        /* Toolbar */
Alexander Larsson's avatar
Alexander Larsson committed
136 137
        GtkWidget *toolbar;
        GtkWidget *location_bar;
138

Alexander Larsson's avatar
Alexander Larsson committed
139 140 141
        guint extensions_toolbar_merge_id;
        GtkActionGroup *extensions_toolbar_action_group;
        
142
	/* Throbber */
Alexander Larsson's avatar
Alexander Larsson committed
143 144
        gboolean    throbber_active;
        GtkWidget  *throbber;
145 146
};

147 148 149
#define NAUTILUS_MENU_PATH_BACK_ITEM			"/menu/Go/Back"
#define NAUTILUS_MENU_PATH_FORWARD_ITEM			"/menu/Go/Forward"
#define NAUTILUS_MENU_PATH_UP_ITEM			"/menu/Go/Up"
150

151
#define NAUTILUS_MENU_PATH_RELOAD_ITEM			"/menu/View/Reload"
152 153 154
#define NAUTILUS_MENU_PATH_ZOOM_IN_ITEM			"/menu/View/Zoom Items Placeholder/Zoom In"
#define NAUTILUS_MENU_PATH_ZOOM_OUT_ITEM		"/menu/View/Zoom Items Placeholder/Zoom Out"
#define NAUTILUS_MENU_PATH_ZOOM_NORMAL_ITEM		"/menu/View/Zoom Items Placeholder/Zoom Normal"
155

156 157 158 159 160
#define NAUTILUS_COMMAND_BACK				"/commands/Back"
#define NAUTILUS_COMMAND_FORWARD			"/commands/Forward"
#define NAUTILUS_COMMAND_UP				"/commands/Up"

#define NAUTILUS_COMMAND_RELOAD				"/commands/Reload"
161
#define NAUTILUS_COMMAND_BURN_CD			"/commands/Burn CD"
162 163 164 165 166
#define NAUTILUS_COMMAND_STOP				"/commands/Stop"
#define NAUTILUS_COMMAND_ZOOM_IN			"/commands/Zoom In"
#define NAUTILUS_COMMAND_ZOOM_OUT			"/commands/Zoom Out"
#define NAUTILUS_COMMAND_ZOOM_NORMAL			"/commands/Zoom Normal"

167
/* window geometry */
168 169 170 171 172 173
/* These are very small, and a Nautilus window at this tiny size is *almost*
 * completely unusable. However, if all the extra bits (sidebar, location bar, etc)
 * are turned off, you can see an icon or two at this size. See bug 5946.
 */
#define NAUTILUS_WINDOW_MIN_WIDTH			200
#define NAUTILUS_WINDOW_MIN_HEIGHT			200
174

175 176
#define NAUTILUS_SPATIAL_WINDOW_MIN_WIDTH			100
#define NAUTILUS_SPATIAL_WINDOW_MIN_HEIGHT			100
177 178 179 180 181
#define NAUTILUS_SPATIAL_WINDOW_DEFAULT_WIDTH			500
#define NAUTILUS_SPATIAL_WINDOW_DEFAULT_HEIGHT			300

#define NAUTILUS_NAVIGATION_WINDOW_DEFAULT_WIDTH        800
#define NAUTILUS_NAVIGATION_WINDOW_DEFAULT_HEIGHT       550
182 183 184

typedef void (*NautilusBookmarkFailedCallback) (NautilusWindow *window,
                                                NautilusBookmark *bookmark);
185

186 187
void               nautilus_window_set_status                            (NautilusWindow    *window,
                                                                          const char        *status);
188
void               nautilus_window_load_view_as_menus                    (NautilusWindow    *window);
189
void               nautilus_window_load_extension_menus                  (NautilusWindow    *window);
Alexander Larsson's avatar
Alexander Larsson committed
190
void               nautilus_window_initialize_menus                      (NautilusWindow    *window);
191
void               nautilus_window_initialize_menus_constructed          (NautilusWindow    *window);
192 193 194
void               nautilus_menus_append_bookmark_to_menu                (NautilusWindow    *window, 
                                                                          NautilusBookmark  *bookmark, 
                                                                          const char        *parent_path,
195
                                                                          const char        *parent_id,
196
                                                                          guint              index_in_parent,
Alexander Larsson's avatar
Alexander Larsson committed
197 198
                                                                          GtkActionGroup    *action_group,
                                                                          guint              merge_id,
199 200
                                                                          GCallback          refresh_callback,
                                                                          NautilusBookmarkFailedCallback failed_callback);
201
#ifdef NEW_UI_COMPLETE
202
void               nautilus_window_go_up                                 (NautilusWindow    *window);
203
#endif
204 205 206 207
void               nautilus_window_update_find_menu_item                 (NautilusWindow    *window);
void               nautilus_window_zoom_in                               (NautilusWindow    *window);
void               nautilus_window_zoom_out                              (NautilusWindow    *window);
void               nautilus_window_zoom_to_level                         (NautilusWindow    *window,
Alexander Larsson's avatar
Alexander Larsson committed
208 209
                                                                          NautilusZoomLevel  level);
void               nautilus_window_zoom_to_default                       (NautilusWindow    *window);
210
void		   nautilus_window_show_view_as_dialog			 (NautilusWindow    *window);
211
void               nautilus_window_set_content_view_widget               (NautilusWindow    *window,
Alexander Larsson's avatar
Alexander Larsson committed
212
                                                                          NautilusView       *content_view);
213 214 215 216
void               nautilus_window_set_viewed_file                       (NautilusWindow    *window,
                                                                          NautilusFile      *file);
void               nautilus_send_history_list_changed                    (void);
void               nautilus_window_add_current_location_to_history_list  (NautilusWindow    *window);
Alexander Larsson's avatar
Alexander Larsson committed
217 218
void               nautilus_remove_from_history_list_no_notify           (GFile             *location);
gboolean           nautilus_add_to_history_list_no_notify                (GFile             *location,
219 220
									  const char        *name,
									  gboolean           has_custom_name,
Alexander Larsson's avatar
Alexander Larsson committed
221
									  GIcon            *icon);
222 223
GList *            nautilus_get_history_list                             (void);
void               nautilus_window_bookmarks_preference_changed_callback (gpointer           user_data);
224
void		   nautilus_window_update_icon				 (NautilusWindow    *window);
Alexander Larsson's avatar
Alexander Larsson committed
225
void               nautilus_window_constructed                           (NautilusWindow    *window);
226 227

/* Navigation window menus */
Alexander Larsson's avatar
Alexander Larsson committed
228 229
void               nautilus_navigation_window_initialize_actions                    (NautilusNavigationWindow    *window);
void               nautilus_navigation_window_initialize_menus                      (NautilusNavigationWindow    *window);
230 231 232 233
void               nautilus_navigation_window_remove_bookmarks_menu_callback        (NautilusNavigationWindow    *window);

void               nautilus_navigation_window_remove_bookmarks_menu_items           (NautilusNavigationWindow    *window);
void               nautilus_navigation_window_update_show_hide_menu_items           (NautilusNavigationWindow     *window);
234
void               nautilus_navigation_window_update_spatial_menu_item              (NautilusNavigationWindow     *window);
Alexander Larsson's avatar
Alexander Larsson committed
235 236
void               nautilus_navigation_window_remove_go_menu_callback    (NautilusNavigationWindow    *window);
void               nautilus_navigation_window_remove_go_menu_items       (NautilusNavigationWindow    *window);
237 238 239 240

/* Navigation window toolbar */
void               nautilus_navigation_window_activate_throbber                     (NautilusNavigationWindow    *window);
void               nautilus_navigation_window_initialize_toolbars                   (NautilusNavigationWindow    *window);
241
void               nautilus_navigation_window_load_extension_toolbar_items          (NautilusNavigationWindow    *window);
242 243 244 245 246
void               nautilus_navigation_window_set_throbber_active                   (NautilusNavigationWindow    *window, 
                                                                                     gboolean                     active);
void               nautilus_navigation_window_go_back                               (NautilusNavigationWindow    *window);
void               nautilus_navigation_window_go_forward                            (NautilusNavigationWindow    *window);

Alexander Larsson's avatar
Alexander Larsson committed
247

Darin Adler's avatar
Darin Adler committed
248
#endif /* NAUTILUS_WINDOW_PRIVATE_H */