mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-25 02:36:07 +00:00
reviewed by: Pavel Cisler <pavel@eazel.com>
Fixed some problems with callbacks that are left around after the object is destroyed. * src/nautilus-window-manage-views.h: * src/nautilus-window-manage-views.c: (viewed_file_changed_callback): Changed to be a normal callback, not a "connect_object" callback, and simplified the logic. (cancel_viewed_file_changed_callback): Added a function to cancel the callback, which is needed both when the window is destroyed and when the viewed file changes. (update_for_new_location): Cancel the old callback before setting up the new one so we don't leave behind callbacks for old locations. Also use the new nautilus_window_set_viewed_file function so the callbacks set up in nautilus-window.c can be managed properly. (free_location_change): Moved part of nautilus_window_free_load_info in here. This function frees all the stuff that's used in the location change process; shared by destroy and "cancel" code. Also fixed a bug where it wouldn't free the "error_views". (cancel_location_change): Moved the rest of nautilus_window_free_load_info in here and made this use the new function. (disconnect_view): Made this private now that the code to disconnect the views is inside this file. (disconnect_view_callback), (nautilus_window_manage_views_destroy): Moved the code to clean up from nautilus-window.c in here. Added cleanup for the location change fields and for the viewd_file_changed callback. * src/nautilus-window.c: (nautilus_window_destroy): Call a new function to do the nautilus-window-manage-views.c part of the destroy and moved some code in there. Cancel the view-as callback too. (create_view_as_menu_item), (replace_special_current_view_in_view_as_menu), (nautilus_window_synch_view_as_menu): Renamed. The words "view as menu" are clearer than "content view menu". (chose_component_callback): Got rid of code that tries to handle bad values for callback data. The callback must be cancelled, because you can't call NAUTILUS_IS_WINDOW on a freed window and expect it to behave predictably. (cancel_chose_component_callback): Function to cancel the callback, called at both destroy time and before adding a new one. (view_menu_choose_view_callback): Cancel the old callback before adding a new one. (view_menu_vfs_method_callback): Simplify logic a bit. (load_view_as_menu_callback): Renamed. (cancel_view_as_callback): Function to cancel the callback, called at both destroy time and before adding a new one. (nautilus_window_load_view_as_menu): Cancel the old callback before adding a new one. Also renamed. (nautilus_window_set_viewed_file): A new function that cancels the callbacks on the file object before switching to a new one. * libnautilus-extensions/nautilus-program-choosing.c: (nautilus_cancel_choose_component_for_file): Implemented missing cancel function, needed by new window code. * src/nautilus-window-private.h: * src/nautilus-window-menus.c: (bookmarks_menu_add_bookmark_callback), (add_bookmark_for_current_location): Made the function local to this file since it's both defined and used here. * libnautilus-extensions/nautilus-glib-extensions.c: * libnautilus-extensions/nautilus-volume-monitor.c: * libnautilus/nautilus-undo-transaction.c: * libnautilus/nautilus-view.c: * librsvg/rsvg.c: Added missing "static" to make some local non-"nautilus_"-prefixed globals be internal instead of external. * src/nautilus-sidebar.c: Formatting tweaks, added FIXME.
This commit is contained in:
parent
f85dc70aad
commit
fcb7d41216
78
ChangeLog
78
ChangeLog
|
@ -1,3 +1,81 @@
|
|||
2000-11-29 Darin Adler <darin@eazel.com>
|
||||
|
||||
reviewed by: Pavel Cisler <pavel@eazel.com>
|
||||
|
||||
Fixed some problems with callbacks that are left around after
|
||||
the object is destroyed.
|
||||
|
||||
* src/nautilus-window-manage-views.h:
|
||||
* src/nautilus-window-manage-views.c:
|
||||
(viewed_file_changed_callback): Changed to be a normal callback,
|
||||
not a "connect_object" callback, and simplified the logic.
|
||||
(cancel_viewed_file_changed_callback): Added a function to cancel
|
||||
the callback, which is needed both when the window is destroyed
|
||||
and when the viewed file changes.
|
||||
(update_for_new_location): Cancel the old callback before setting
|
||||
up the new one so we don't leave behind callbacks for old locations.
|
||||
Also use the new nautilus_window_set_viewed_file function so the
|
||||
callbacks set up in nautilus-window.c can be managed properly.
|
||||
(free_location_change): Moved part of
|
||||
nautilus_window_free_load_info in here. This function frees all
|
||||
the stuff that's used in the location change process; shared by
|
||||
destroy and "cancel" code. Also fixed a bug where it wouldn't free
|
||||
the "error_views".
|
||||
(cancel_location_change): Moved the rest of
|
||||
nautilus_window_free_load_info in here and made this use the new
|
||||
function.
|
||||
(disconnect_view): Made this private now that the code to
|
||||
disconnect the views is inside this file.
|
||||
(disconnect_view_callback),
|
||||
(nautilus_window_manage_views_destroy): Moved the code to clean up
|
||||
from nautilus-window.c in here. Added cleanup for the location
|
||||
change fields and for the viewd_file_changed callback.
|
||||
|
||||
* src/nautilus-window.c:
|
||||
(nautilus_window_destroy): Call a new function to do the
|
||||
nautilus-window-manage-views.c part of the destroy and moved some
|
||||
code in there. Cancel the view-as callback too.
|
||||
(create_view_as_menu_item),
|
||||
(replace_special_current_view_in_view_as_menu),
|
||||
(nautilus_window_synch_view_as_menu): Renamed. The words "view as
|
||||
menu" are clearer than "content view menu".
|
||||
(chose_component_callback): Got rid of code that tries to handle
|
||||
bad values for callback data. The callback must be cancelled,
|
||||
because you can't call NAUTILUS_IS_WINDOW on a freed window and
|
||||
expect it to behave predictably.
|
||||
(cancel_chose_component_callback): Function to cancel the callback,
|
||||
called at both destroy time and before adding a new one.
|
||||
(view_menu_choose_view_callback): Cancel the old callback before
|
||||
adding a new one.
|
||||
(view_menu_vfs_method_callback): Simplify logic a bit.
|
||||
(load_view_as_menu_callback): Renamed.
|
||||
(cancel_view_as_callback): Function to cancel the callback, called
|
||||
at both destroy time and before adding a new one.
|
||||
(nautilus_window_load_view_as_menu): Cancel the old callback before
|
||||
adding a new one. Also renamed.
|
||||
(nautilus_window_set_viewed_file): A new function that cancels the
|
||||
callbacks on the file object before switching to a new one.
|
||||
|
||||
* libnautilus-extensions/nautilus-program-choosing.c:
|
||||
(nautilus_cancel_choose_component_for_file): Implemented missing
|
||||
cancel function, needed by new window code.
|
||||
|
||||
* src/nautilus-window-private.h:
|
||||
* src/nautilus-window-menus.c:
|
||||
(bookmarks_menu_add_bookmark_callback),
|
||||
(add_bookmark_for_current_location): Made the function local to
|
||||
this file since it's both defined and used here.
|
||||
|
||||
* libnautilus-extensions/nautilus-glib-extensions.c:
|
||||
* libnautilus-extensions/nautilus-volume-monitor.c:
|
||||
* libnautilus/nautilus-undo-transaction.c:
|
||||
* libnautilus/nautilus-view.c:
|
||||
* librsvg/rsvg.c:
|
||||
Added missing "static" to make some local non-"nautilus_"-prefixed
|
||||
globals be internal instead of external.
|
||||
|
||||
* src/nautilus-sidebar.c: Formatting tweaks, added FIXME.
|
||||
|
||||
2000-11-29 Ramiro Estrugo <ramiro@eazel.com>
|
||||
|
||||
* nautilus.spec.in:
|
||||
|
|
|
@ -43,7 +43,7 @@ typedef struct {
|
|||
gboolean keys_known_to_be_strings;
|
||||
} HashTableToFree;
|
||||
|
||||
GList *hash_tables_to_free_at_exit;
|
||||
static GList *hash_tables_to_free_at_exit;
|
||||
|
||||
/* We will need this for nautilus_unsetenv if there is no unsetenv. */
|
||||
#if !defined (HAVE_SETENV)
|
||||
|
|
|
@ -263,7 +263,38 @@ nautilus_choose_component_for_file (NautilusFile *file,
|
|||
choose_component_callback,
|
||||
choose_data);
|
||||
g_list_free (attributes);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_cancel_choose_component_for_file (NautilusFile *file,
|
||||
NautilusComponentChoiceCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
ChooseComponentCallbackData search_criteria;
|
||||
ChooseComponentCallbackData *choose_data;
|
||||
|
||||
if (choose_component_hash_table == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Search for an existing choose in progress. */
|
||||
search_criteria.file = file;
|
||||
search_criteria.callback = callback;
|
||||
search_criteria.callback_data = callback_data;
|
||||
choose_data = g_hash_table_lookup (choose_component_hash_table,
|
||||
&search_criteria);
|
||||
if (choose_data == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Stop it. */
|
||||
g_hash_table_remove (choose_component_hash_table,
|
||||
choose_data);
|
||||
nautilus_file_cancel_call_when_ready (file,
|
||||
choose_component_callback,
|
||||
choose_data);
|
||||
choose_component_destroy (choose_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_choose_application_for_file:
|
||||
|
|
|
@ -80,15 +80,15 @@ struct NautilusVolumeMonitorDetails
|
|||
guint mount_volume_timer_id;
|
||||
};
|
||||
|
||||
NautilusVolumeMonitor *global_volume_monitor = NULL;
|
||||
static NautilusVolumeMonitor *global_volume_monitor = NULL;
|
||||
|
||||
const char * const state_names[] = {
|
||||
static const char * const state_names[] = {
|
||||
"ACTIVE",
|
||||
"INACTIVE",
|
||||
"EMPTY"
|
||||
};
|
||||
|
||||
const char * const type_names[] = {
|
||||
static const char * const type_names[] = {
|
||||
"CDROM",
|
||||
"FLOPPY",
|
||||
"LOCAL_DISK",
|
||||
|
|
|
@ -43,7 +43,7 @@ typedef struct {
|
|||
gboolean keys_known_to_be_strings;
|
||||
} HashTableToFree;
|
||||
|
||||
GList *hash_tables_to_free_at_exit;
|
||||
static GList *hash_tables_to_free_at_exit;
|
||||
|
||||
/* We will need this for nautilus_unsetenv if there is no unsetenv. */
|
||||
#if !defined (HAVE_SETENV)
|
||||
|
|
|
@ -263,7 +263,38 @@ nautilus_choose_component_for_file (NautilusFile *file,
|
|||
choose_component_callback,
|
||||
choose_data);
|
||||
g_list_free (attributes);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_cancel_choose_component_for_file (NautilusFile *file,
|
||||
NautilusComponentChoiceCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
ChooseComponentCallbackData search_criteria;
|
||||
ChooseComponentCallbackData *choose_data;
|
||||
|
||||
if (choose_component_hash_table == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Search for an existing choose in progress. */
|
||||
search_criteria.file = file;
|
||||
search_criteria.callback = callback;
|
||||
search_criteria.callback_data = callback_data;
|
||||
choose_data = g_hash_table_lookup (choose_component_hash_table,
|
||||
&search_criteria);
|
||||
if (choose_data == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Stop it. */
|
||||
g_hash_table_remove (choose_component_hash_table,
|
||||
choose_data);
|
||||
nautilus_file_cancel_call_when_ready (file,
|
||||
choose_component_callback,
|
||||
choose_data);
|
||||
choose_component_destroy (choose_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* nautilus_choose_application_for_file:
|
||||
|
|
|
@ -80,15 +80,15 @@ struct NautilusVolumeMonitorDetails
|
|||
guint mount_volume_timer_id;
|
||||
};
|
||||
|
||||
NautilusVolumeMonitor *global_volume_monitor = NULL;
|
||||
static NautilusVolumeMonitor *global_volume_monitor = NULL;
|
||||
|
||||
const char * const state_names[] = {
|
||||
static const char * const state_names[] = {
|
||||
"ACTIVE",
|
||||
"INACTIVE",
|
||||
"EMPTY"
|
||||
};
|
||||
|
||||
const char * const type_names[] = {
|
||||
static const char * const type_names[] = {
|
||||
"CDROM",
|
||||
"FLOPPY",
|
||||
"LOCAL_DISK",
|
||||
|
|
|
@ -61,7 +61,7 @@ static void undo_atom_list_undo_and_free
|
|||
|
||||
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusUndoTransaction, nautilus_undo_transaction, BONOBO_OBJECT_TYPE)
|
||||
|
||||
POA_Nautilus_Undo_Transaction__epv libnautilus_Nautilus_Undo_Transaction_epv =
|
||||
static POA_Nautilus_Undo_Transaction__epv libnautilus_Nautilus_Undo_Transaction_epv =
|
||||
{
|
||||
NULL,
|
||||
&impl_Nautilus_Undo_Transaction__get_undo_menu_item,
|
||||
|
|
|
@ -74,7 +74,7 @@ static void nautilus_view_initialize_class (NautilusViewClass *klass)
|
|||
|
||||
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusView, nautilus_view, BONOBO_OBJECT_TYPE)
|
||||
|
||||
POA_Nautilus_View__epv libnautilus_Nautilus_View_epv =
|
||||
static POA_Nautilus_View__epv libnautilus_Nautilus_View_epv =
|
||||
{
|
||||
NULL,
|
||||
&impl_Nautilus_View_load_location,
|
||||
|
|
|
@ -1358,7 +1358,7 @@ rsvg_entity_decl (void *data, const xmlChar *name, int type,
|
|||
g_hash_table_insert (entities, dupname, entity);
|
||||
}
|
||||
|
||||
xmlSAXHandler rsvgSAXHandlerStruct = {
|
||||
static xmlSAXHandler rsvgSAXHandlerStruct = {
|
||||
NULL, /* internalSubset */
|
||||
NULL, /* isStandalone */
|
||||
NULL, /* hasInternalSubset */
|
||||
|
@ -1386,7 +1386,7 @@ xmlSAXHandler rsvgSAXHandlerStruct = {
|
|||
NULL, /* getParameterEntity */
|
||||
};
|
||||
|
||||
xmlSAXHandlerPtr rsvgSAXHandler = &rsvgSAXHandlerStruct;
|
||||
static xmlSAXHandlerPtr rsvgSAXHandler = &rsvgSAXHandlerStruct;
|
||||
|
||||
GdkPixbuf *
|
||||
rsvg_render_file (FILE *f, double zoom)
|
||||
|
|
|
@ -117,9 +117,9 @@ static void add_command_buttons (NautilusSidebar *sidebar,
|
|||
|
||||
static void nautilus_sidebar_update_all (NautilusSidebar *sidebar);
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1245: hardwired sizes */
|
||||
#define DEFAULT_TAB_COLOR "rgb:9999/9999/9999"
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1245: hardwired sizes */
|
||||
#define SIDEBAR_MINIMUM_WIDTH 1
|
||||
#define SIDEBAR_MINIMUM_HEIGHT 400
|
||||
|
||||
|
@ -1217,9 +1217,14 @@ add_command_buttons (NautilusSidebar *sidebar, GList *application_list)
|
|||
FALSE, FALSE,
|
||||
0);
|
||||
|
||||
/* FIXME bugzilla.eazel.com 2510: Security hole? Can't use a string from the
|
||||
* MIME file as a printf format string without first
|
||||
* checking it over somehow.
|
||||
/* FIXME bugzilla.eazel.com 2510: Security hole?
|
||||
* Unsafe to use a string from the MIME file as a
|
||||
* printf format string without first checking it over
|
||||
* somehow. We can do a search and replace on the "%s"
|
||||
* part instead, which should work.
|
||||
*/
|
||||
/* FIXME: Doing a +7 does not turn a URI into a path
|
||||
* name.
|
||||
*/
|
||||
temp_str = g_strdup_printf
|
||||
("'%s'",
|
||||
|
@ -1239,7 +1244,7 @@ add_command_buttons (NautilusSidebar *sidebar, GList *application_list)
|
|||
|
||||
/* Catch-all button after all the others. */
|
||||
temp_button = gtk_button_new_with_label (_("Open with..."));
|
||||
gtk_signal_connect (GTK_OBJECT (temp_button), "clicked",
|
||||
gtk_signal_connect (GTK_OBJECT (temp_button), "clicked",
|
||||
open_with_callback, NULL);
|
||||
gtk_object_set_user_data (GTK_OBJECT (temp_button), sidebar);
|
||||
gtk_widget_show (temp_button);
|
||||
|
|
|
@ -90,18 +90,19 @@
|
|||
|
||||
static GtkWindow *bookmarks_window = NULL;
|
||||
|
||||
static void append_bookmark_to_menu (NautilusWindow *window,
|
||||
NautilusBookmark *bookmark,
|
||||
const char *parent_path,
|
||||
guint index_in_parent,
|
||||
gboolean is_in_bookmarks_menu);
|
||||
static void append_dynamic_bookmarks (NautilusWindow *window);
|
||||
static NautilusBookmarkList *get_bookmark_list (void);
|
||||
static void refresh_go_menu (NautilusWindow *window);
|
||||
static void refresh_bookmarks_menu (NautilusWindow *window);
|
||||
static void schedule_refresh_go_menu (NautilusWindow *window);
|
||||
static void schedule_refresh_bookmarks_menu (NautilusWindow *window);
|
||||
static void edit_bookmarks (NautilusWindow *window);
|
||||
static void append_bookmark_to_menu (NautilusWindow *window,
|
||||
NautilusBookmark *bookmark,
|
||||
const char *parent_path,
|
||||
guint index_in_parent,
|
||||
gboolean is_in_bookmarks_menu);
|
||||
static void append_dynamic_bookmarks (NautilusWindow *window);
|
||||
static NautilusBookmarkList *get_bookmark_list (void);
|
||||
static void refresh_go_menu (NautilusWindow *window);
|
||||
static void refresh_bookmarks_menu (NautilusWindow *window);
|
||||
static void schedule_refresh_go_menu (NautilusWindow *window);
|
||||
static void schedule_refresh_bookmarks_menu (NautilusWindow *window);
|
||||
static void edit_bookmarks (NautilusWindow *window);
|
||||
static void add_bookmark_for_current_location (NautilusWindow *window);
|
||||
|
||||
/* User level things */
|
||||
static guint convert_verb_to_user_level (const char *verb);
|
||||
|
@ -474,7 +475,7 @@ bookmarks_menu_add_bookmark_callback (BonoboUIComponent *component,
|
|||
gpointer user_data,
|
||||
const char *verb)
|
||||
{
|
||||
nautilus_window_add_bookmark_for_current_location (NAUTILUS_WINDOW (user_data));
|
||||
add_bookmark_for_current_location (NAUTILUS_WINDOW (user_data));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1022,13 +1023,13 @@ nautilus_bookmarks_exiting (void)
|
|||
}
|
||||
|
||||
/**
|
||||
* nautilus_window_add_bookmark_for_current_location
|
||||
* add_bookmark_for_current_location
|
||||
*
|
||||
* Add a bookmark for the displayed location to the bookmarks menu.
|
||||
* Does nothing if there's already a bookmark for the displayed location.
|
||||
*/
|
||||
void
|
||||
nautilus_window_add_bookmark_for_current_location (NautilusWindow *window)
|
||||
static void
|
||||
add_bookmark_for_current_location (NautilusWindow *window)
|
||||
{
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
|
||||
|
||||
|
|
|
@ -103,26 +103,24 @@ enum {
|
|||
ARG_APP
|
||||
};
|
||||
|
||||
/* Other static variables */
|
||||
static GList *history_list = NULL;
|
||||
|
||||
static void nautilus_window_initialize_class (NautilusWindowClass *klass);
|
||||
static void nautilus_window_initialize (NautilusWindow *window);
|
||||
static void nautilus_window_destroy (GtkObject *object);
|
||||
static void nautilus_window_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void nautilus_window_realize (GtkWidget *widget);
|
||||
static void update_sidebar_panels_from_preferences (NautilusWindow *window);
|
||||
static void sidebar_panels_changed_callback (gpointer user_data);
|
||||
static void nautilus_window_show (GtkWidget *widget);
|
||||
static void nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
||||
gpointer callback_data);
|
||||
static void nautilus_window_initialize_class (NautilusWindowClass *klass);
|
||||
static void nautilus_window_initialize (NautilusWindow *window);
|
||||
static void nautilus_window_destroy (GtkObject *object);
|
||||
static void nautilus_window_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void nautilus_window_realize (GtkWidget *widget);
|
||||
static void update_sidebar_panels_from_preferences (NautilusWindow *window);
|
||||
static void sidebar_panels_changed_callback (gpointer user_data);
|
||||
static void nautilus_window_show (GtkWidget *widget);
|
||||
static void cancel_view_as_callback (NautilusWindow *window);
|
||||
|
||||
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusWindow,
|
||||
nautilus_window,
|
||||
|
@ -447,10 +445,14 @@ nautilus_window_constructed (NautilusWindow *window)
|
|||
* It gets shown later, if the view-frame contains something zoomable.
|
||||
*/
|
||||
window->zoom_control = nautilus_zoom_control_new ();
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_in", nautilus_window_zoom_in, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_out", nautilus_window_zoom_out, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_level", nautilus_window_zoom_to_level, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_fit", nautilus_window_zoom_to_fit, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_in",
|
||||
nautilus_window_zoom_in, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_out",
|
||||
nautilus_window_zoom_out, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_level",
|
||||
nautilus_window_zoom_to_level, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_fit",
|
||||
nautilus_window_zoom_to_fit, GTK_OBJECT (window));
|
||||
gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show (location_bar_box);
|
||||
|
@ -527,7 +529,7 @@ nautilus_window_constructed (NautilusWindow *window)
|
|||
|
||||
/* watch for throbber locatoin changes, too */
|
||||
gtk_signal_connect (GTK_OBJECT (window->throbber), "location_changed",
|
||||
goto_uri_callback, window);
|
||||
goto_uri_callback, window);
|
||||
|
||||
/* Set initial sensitivity of some buttons & menu items
|
||||
* now that they're all created.
|
||||
|
@ -589,16 +591,6 @@ nautilus_window_get_arg (GtkObject *object,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
view_disconnect (gpointer data, gpointer user_data)
|
||||
{
|
||||
g_assert (NAUTILUS_IS_WINDOW (user_data));
|
||||
g_assert (NAUTILUS_IS_VIEW_FRAME (data));
|
||||
|
||||
nautilus_window_disconnect_view (NAUTILUS_WINDOW (user_data),
|
||||
NAUTILUS_VIEW_FRAME (data));
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_destroy (GtkObject *object)
|
||||
{
|
||||
|
@ -606,39 +598,33 @@ nautilus_window_destroy (GtkObject *object)
|
|||
|
||||
window = NAUTILUS_WINDOW (object);
|
||||
|
||||
/* Let go of the UI. */
|
||||
/* Handle the part of destroy that's private to the view
|
||||
* management.
|
||||
*/
|
||||
nautilus_window_manage_views_destroy (window);
|
||||
|
||||
/* Get rid of all callbacks. */
|
||||
|
||||
cancel_view_as_callback (window);
|
||||
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SIDEBAR_PANELS_NAMESPACE,
|
||||
sidebar_panels_changed_callback,
|
||||
NULL);
|
||||
nautilus_window_remove_bookmarks_menu_callback (window);
|
||||
nautilus_window_remove_go_menu_callback (window);
|
||||
nautilus_window_toolbar_remove_theme_callback (window);
|
||||
|
||||
/* Get rid of all owned objects. */
|
||||
|
||||
if (window->details->shell_ui != NULL) {
|
||||
bonobo_ui_component_unset_container (window->details->shell_ui);
|
||||
bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui));
|
||||
}
|
||||
|
||||
/* Cancel the callback for the View As menu update, if any */
|
||||
nautilus_file_cancel_call_when_ready (window->details->viewed_file,
|
||||
nautilus_window_real_load_content_view_menu,
|
||||
window);
|
||||
|
||||
/* Let go of the file for the current location */
|
||||
nautilus_file_unref (window->details->viewed_file);
|
||||
|
||||
g_free (window->details->dead_view_name);
|
||||
|
||||
/* Dont keep track of sidebar panel changes no more */
|
||||
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SIDEBAR_PANELS_NAMESPACE,
|
||||
sidebar_panels_changed_callback,
|
||||
NULL);
|
||||
|
||||
nautilus_window_remove_bookmarks_menu_callback (window);
|
||||
nautilus_window_remove_go_menu_callback (window);
|
||||
nautilus_window_toolbar_remove_theme_callback (window);
|
||||
|
||||
/* Disconnect view signals here so they don't trigger when
|
||||
* views are destroyed normally.
|
||||
*/
|
||||
g_list_foreach (window->sidebar_panels, view_disconnect, window);
|
||||
g_list_free (window->sidebar_panels);
|
||||
|
||||
nautilus_window_disconnect_view (window, window->content_view);
|
||||
|
||||
nautilus_view_identifier_free (window->content_view_id);
|
||||
|
||||
g_free (window->location);
|
||||
|
@ -845,7 +831,7 @@ nautilus_window_size_request (GtkWidget *widget,
|
|||
*/
|
||||
|
||||
static void
|
||||
view_menu_switch_views_callback (GtkWidget *widget, gpointer data)
|
||||
view_as_menu_switch_views_callback (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
NautilusWindow *window;
|
||||
NautilusViewIdentifier *identifier;
|
||||
|
@ -861,7 +847,7 @@ view_menu_switch_views_callback (GtkWidget *widget, gpointer data)
|
|||
|
||||
/* Note: The identifier parameter ownership is handed off to the menu item. */
|
||||
static GtkWidget *
|
||||
create_content_view_menu_item (NautilusWindow *window, NautilusViewIdentifier *identifier)
|
||||
create_view_as_menu_item (NautilusWindow *window, NautilusViewIdentifier *identifier)
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
char *menu_label;
|
||||
|
@ -872,7 +858,7 @@ create_content_view_menu_item (NautilusWindow *window, NautilusViewIdentifier *i
|
|||
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item),
|
||||
"activate",
|
||||
view_menu_switch_views_callback,
|
||||
view_as_menu_switch_views_callback,
|
||||
NULL);
|
||||
|
||||
/* Store copy of iid in item; free when item destroyed. */
|
||||
|
@ -905,7 +891,7 @@ new_gtk_separator (void)
|
|||
* content view isn't already in the "View as" option menu.
|
||||
*/
|
||||
static void
|
||||
replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
||||
replace_special_current_view_in_view_as_menu (NautilusWindow *window)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *first_menu_item;
|
||||
|
@ -929,7 +915,7 @@ replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
|||
gtk_menu_prepend (GTK_MENU (menu), new_gtk_separator ());
|
||||
}
|
||||
|
||||
new_menu_item = create_content_view_menu_item (window, nautilus_view_identifier_copy (window->content_view_id));
|
||||
new_menu_item = create_view_as_menu_item (window, nautilus_view_identifier_copy (window->content_view_id));
|
||||
gtk_object_set_data (GTK_OBJECT (new_menu_item), "current content view", GINT_TO_POINTER (TRUE));
|
||||
gtk_menu_prepend (GTK_MENU (menu), new_menu_item);
|
||||
|
||||
|
@ -938,7 +924,7 @@ replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
|||
}
|
||||
|
||||
/**
|
||||
* nautilus_window_synch_content_view_menu:
|
||||
* nautilus_window_synch_view_as_menu:
|
||||
*
|
||||
* Set the visible item of the "View as" option menu to
|
||||
* match the current content view.
|
||||
|
@ -946,7 +932,7 @@ replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
|||
* @window: The NautilusWindow whose "View as" option menu should be synched.
|
||||
*/
|
||||
void
|
||||
nautilus_window_synch_content_view_menu (NautilusWindow *window)
|
||||
nautilus_window_synch_view_as_menu (NautilusWindow *window)
|
||||
{
|
||||
GList *children, *child;
|
||||
GtkWidget *menu;
|
||||
|
@ -972,7 +958,7 @@ nautilus_window_synch_content_view_menu (NautilusWindow *window)
|
|||
}
|
||||
|
||||
if (matching_index == -1) {
|
||||
replace_special_current_view_in_content_view_menu (window);
|
||||
replace_special_current_view_in_view_as_menu (window);
|
||||
matching_index = 0;
|
||||
}
|
||||
|
||||
|
@ -985,29 +971,34 @@ nautilus_window_synch_content_view_menu (NautilusWindow *window)
|
|||
static void
|
||||
chose_component_callback (NautilusViewIdentifier *identifier, gpointer callback_data)
|
||||
{
|
||||
/* Can't assume callback_data is a valid NautilusWindow, because
|
||||
* it might be garbage if the program is exiting when this dialog
|
||||
* is up.
|
||||
*/
|
||||
NautilusWindow *window;
|
||||
|
||||
window = NAUTILUS_WINDOW (callback_data);
|
||||
if (identifier != NULL) {
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (callback_data));
|
||||
nautilus_window_set_content_view (NAUTILUS_WINDOW (callback_data), identifier);
|
||||
nautilus_window_set_content_view (window, identifier);
|
||||
}
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1334:
|
||||
* There should be some global way to signal that the
|
||||
* file type associations have changed, so that the places that
|
||||
* display these lists can react. For now, hardwire this case, which
|
||||
* is the most obvious one by far.
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1334: There should be some global
|
||||
* way to signal that the file type associations have changed,
|
||||
* so that the places that display these lists can react. For
|
||||
* now, hardwire this case, which is the most obvious one by
|
||||
* far.
|
||||
*/
|
||||
if (NAUTILUS_IS_WINDOW (callback_data)) {
|
||||
nautilus_window_load_content_view_menu (NAUTILUS_WINDOW (callback_data));
|
||||
nautilus_window_load_view_as_menu (window);
|
||||
}
|
||||
|
||||
static void
|
||||
cancel_chose_component_callback (NautilusWindow *window)
|
||||
{
|
||||
if (window->details->viewed_file != NULL) {
|
||||
nautilus_cancel_choose_component_for_file (window->details->viewed_file,
|
||||
chose_component_callback,
|
||||
window);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
view_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
||||
view_as_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
NautilusWindow *window;
|
||||
|
||||
|
@ -1016,14 +1007,18 @@ view_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
|||
|
||||
window = NAUTILUS_WINDOW (gtk_object_get_data (GTK_OBJECT (widget), "window"));
|
||||
|
||||
/* Set the option menu back to its previous setting (Don't leave it
|
||||
* on this dialog-producing "View as Other..." setting). If the menu choice
|
||||
* causes a content view change, this will be updated again later,
|
||||
* in nautilus_window_load_content_view_menu. Do this right away so
|
||||
* the user never sees the option menu set to "View as Other...".
|
||||
/* Set the option menu back to its previous setting (Don't
|
||||
* leave it on this dialog-producing "View as Other..."
|
||||
* setting). If the menu choice causes a content view change,
|
||||
* this will be updated again later, in
|
||||
* nautilus_window_load_view_as_menu. Do this right away so
|
||||
* the user never sees the option menu set to "View as
|
||||
* Other...".
|
||||
*/
|
||||
nautilus_window_synch_content_view_menu (window);
|
||||
nautilus_window_synch_view_as_menu (window);
|
||||
|
||||
/* Call back when the user chose the component. */
|
||||
cancel_chose_component_callback (window);
|
||||
nautilus_choose_component_for_file (window->details->viewed_file,
|
||||
GTK_WINDOW (window),
|
||||
chose_component_callback,
|
||||
|
@ -1031,28 +1026,30 @@ view_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
|||
}
|
||||
|
||||
static void
|
||||
view_menu_vfs_method_callback (GtkWidget *widget, gpointer data)
|
||||
view_as_menu_vfs_method_callback (GtkWidget *widget, gpointer callback_data)
|
||||
{
|
||||
gpointer object_data;
|
||||
NautilusWindow *window;
|
||||
char *new_location;
|
||||
char *method;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (gtk_object_get_data (GTK_OBJECT (widget), "window")));
|
||||
|
||||
window = NAUTILUS_WINDOW (gtk_object_get_data (GTK_OBJECT (widget), "window"));
|
||||
method = (char *) (gtk_object_get_data (GTK_OBJECT (widget), "method"));
|
||||
g_return_if_fail (method);
|
||||
|
||||
object_data = gtk_object_get_data (GTK_OBJECT (widget), "window");
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (object_data));
|
||||
window = NAUTILUS_WINDOW (object_data);
|
||||
|
||||
method = (char *) gtk_object_get_data (GTK_OBJECT (widget), "method");
|
||||
g_return_if_fail (method != NULL);
|
||||
|
||||
new_location = g_strdup_printf ("%s#%s:/",window->location,method);
|
||||
nautilus_window_goto_uri (window, new_location);
|
||||
g_free (new_location);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
||||
gpointer callback_data)
|
||||
load_view_as_menu_callback (NautilusFile *file,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GList *components;
|
||||
char *method;
|
||||
|
@ -1071,7 +1068,7 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
/* Add a menu item for each view in the preferred list for this location. */
|
||||
components = nautilus_mime_get_short_list_components_for_file (window->details->viewed_file);
|
||||
for (p = components; p != NULL; p = p->next) {
|
||||
menu_item = create_content_view_menu_item
|
||||
menu_item = create_view_as_menu_item
|
||||
(window, nautilus_view_identifier_new_from_content_view (p->data));
|
||||
gtk_menu_append (GTK_MENU (new_menu), menu_item);
|
||||
}
|
||||
|
@ -1082,10 +1079,11 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
* one way trip if you choose one of these view menu items, but
|
||||
* it's better than nothing.
|
||||
*/
|
||||
method = nautilus_mime_get_short_list_methods_for_file (window->details->viewed_file);
|
||||
/* FIXME bugzilla.eazel.com 2466: Name of the function is plural, but it returns only
|
||||
* one item. That must be fixed.
|
||||
/* FIXME bugzilla.eazel.com 2466: The name of the following
|
||||
* function is plural, but it returns only one item. That must
|
||||
* be fixed.
|
||||
*/
|
||||
method = nautilus_mime_get_short_list_methods_for_file (window->details->viewed_file);
|
||||
if (method != NULL) {
|
||||
label = g_strdup_printf (_("View as %s..."), method);
|
||||
menu_item = gtk_menu_item_new_with_label (label);
|
||||
|
@ -1096,7 +1094,7 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
g_strdup (method), g_free);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item),
|
||||
"activate",
|
||||
view_menu_vfs_method_callback,
|
||||
view_as_menu_vfs_method_callback,
|
||||
NULL);
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_append (GTK_MENU (new_menu), menu_item);
|
||||
|
@ -1113,7 +1111,7 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
gtk_object_set_data (GTK_OBJECT (menu_item), "window", window);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item),
|
||||
"activate",
|
||||
view_menu_choose_view_callback,
|
||||
view_as_menu_choose_view_callback,
|
||||
NULL);
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_append (GTK_MENU (new_menu), menu_item);
|
||||
|
@ -1124,12 +1122,19 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
gtk_option_menu_set_menu (GTK_OPTION_MENU (window->view_as_option_menu),
|
||||
new_menu);
|
||||
|
||||
nautilus_window_synch_view_as_menu (window);
|
||||
}
|
||||
|
||||
nautilus_window_synch_content_view_menu (window);
|
||||
static void
|
||||
cancel_view_as_callback (NautilusWindow *window)
|
||||
{
|
||||
nautilus_file_cancel_call_when_ready (window->details->viewed_file,
|
||||
load_view_as_menu_callback,
|
||||
window);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_load_content_view_menu (NautilusWindow *window)
|
||||
nautilus_window_load_view_as_menu (NautilusWindow *window)
|
||||
{
|
||||
GList *attributes;
|
||||
|
||||
|
@ -1137,9 +1142,11 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
|
||||
attributes = nautilus_mime_actions_get_full_file_attributes ();
|
||||
|
||||
/* FIXME: need to cancel this when appropriate... */
|
||||
nautilus_file_call_when_ready (window->details->viewed_file, attributes,
|
||||
nautilus_window_real_load_content_view_menu, window);
|
||||
cancel_view_as_callback (window);
|
||||
nautilus_file_call_when_ready (window->details->viewed_file,
|
||||
attributes,
|
||||
load_view_as_menu_callback,
|
||||
window);
|
||||
|
||||
g_list_free (attributes);
|
||||
}
|
||||
|
@ -1751,3 +1758,18 @@ nautilus_window_get_ui_container (NautilusWindow *window)
|
|||
|
||||
return bonobo_object_corba_objref (BONOBO_OBJECT (window->details->ui_container));
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_set_viewed_file (NautilusWindow *window,
|
||||
NautilusFile *file)
|
||||
{
|
||||
if (window->details->viewed_file == file) {
|
||||
return;
|
||||
}
|
||||
|
||||
nautilus_file_ref (file);
|
||||
cancel_view_as_callback (window);
|
||||
cancel_chose_component_callback (window);
|
||||
nautilus_file_unref (window->details->viewed_file);
|
||||
window->details->viewed_file = file;
|
||||
}
|
||||
|
|
|
@ -103,26 +103,24 @@ enum {
|
|||
ARG_APP
|
||||
};
|
||||
|
||||
/* Other static variables */
|
||||
static GList *history_list = NULL;
|
||||
|
||||
static void nautilus_window_initialize_class (NautilusWindowClass *klass);
|
||||
static void nautilus_window_initialize (NautilusWindow *window);
|
||||
static void nautilus_window_destroy (GtkObject *object);
|
||||
static void nautilus_window_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void nautilus_window_realize (GtkWidget *widget);
|
||||
static void update_sidebar_panels_from_preferences (NautilusWindow *window);
|
||||
static void sidebar_panels_changed_callback (gpointer user_data);
|
||||
static void nautilus_window_show (GtkWidget *widget);
|
||||
static void nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
||||
gpointer callback_data);
|
||||
static void nautilus_window_initialize_class (NautilusWindowClass *klass);
|
||||
static void nautilus_window_initialize (NautilusWindow *window);
|
||||
static void nautilus_window_destroy (GtkObject *object);
|
||||
static void nautilus_window_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void nautilus_window_realize (GtkWidget *widget);
|
||||
static void update_sidebar_panels_from_preferences (NautilusWindow *window);
|
||||
static void sidebar_panels_changed_callback (gpointer user_data);
|
||||
static void nautilus_window_show (GtkWidget *widget);
|
||||
static void cancel_view_as_callback (NautilusWindow *window);
|
||||
|
||||
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusWindow,
|
||||
nautilus_window,
|
||||
|
@ -447,10 +445,14 @@ nautilus_window_constructed (NautilusWindow *window)
|
|||
* It gets shown later, if the view-frame contains something zoomable.
|
||||
*/
|
||||
window->zoom_control = nautilus_zoom_control_new ();
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_in", nautilus_window_zoom_in, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_out", nautilus_window_zoom_out, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_level", nautilus_window_zoom_to_level, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_fit", nautilus_window_zoom_to_fit, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_in",
|
||||
nautilus_window_zoom_in, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_out",
|
||||
nautilus_window_zoom_out, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_level",
|
||||
nautilus_window_zoom_to_level, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_fit",
|
||||
nautilus_window_zoom_to_fit, GTK_OBJECT (window));
|
||||
gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show (location_bar_box);
|
||||
|
@ -527,7 +529,7 @@ nautilus_window_constructed (NautilusWindow *window)
|
|||
|
||||
/* watch for throbber locatoin changes, too */
|
||||
gtk_signal_connect (GTK_OBJECT (window->throbber), "location_changed",
|
||||
goto_uri_callback, window);
|
||||
goto_uri_callback, window);
|
||||
|
||||
/* Set initial sensitivity of some buttons & menu items
|
||||
* now that they're all created.
|
||||
|
@ -589,16 +591,6 @@ nautilus_window_get_arg (GtkObject *object,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
view_disconnect (gpointer data, gpointer user_data)
|
||||
{
|
||||
g_assert (NAUTILUS_IS_WINDOW (user_data));
|
||||
g_assert (NAUTILUS_IS_VIEW_FRAME (data));
|
||||
|
||||
nautilus_window_disconnect_view (NAUTILUS_WINDOW (user_data),
|
||||
NAUTILUS_VIEW_FRAME (data));
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_destroy (GtkObject *object)
|
||||
{
|
||||
|
@ -606,39 +598,33 @@ nautilus_window_destroy (GtkObject *object)
|
|||
|
||||
window = NAUTILUS_WINDOW (object);
|
||||
|
||||
/* Let go of the UI. */
|
||||
/* Handle the part of destroy that's private to the view
|
||||
* management.
|
||||
*/
|
||||
nautilus_window_manage_views_destroy (window);
|
||||
|
||||
/* Get rid of all callbacks. */
|
||||
|
||||
cancel_view_as_callback (window);
|
||||
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SIDEBAR_PANELS_NAMESPACE,
|
||||
sidebar_panels_changed_callback,
|
||||
NULL);
|
||||
nautilus_window_remove_bookmarks_menu_callback (window);
|
||||
nautilus_window_remove_go_menu_callback (window);
|
||||
nautilus_window_toolbar_remove_theme_callback (window);
|
||||
|
||||
/* Get rid of all owned objects. */
|
||||
|
||||
if (window->details->shell_ui != NULL) {
|
||||
bonobo_ui_component_unset_container (window->details->shell_ui);
|
||||
bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui));
|
||||
}
|
||||
|
||||
/* Cancel the callback for the View As menu update, if any */
|
||||
nautilus_file_cancel_call_when_ready (window->details->viewed_file,
|
||||
nautilus_window_real_load_content_view_menu,
|
||||
window);
|
||||
|
||||
/* Let go of the file for the current location */
|
||||
nautilus_file_unref (window->details->viewed_file);
|
||||
|
||||
g_free (window->details->dead_view_name);
|
||||
|
||||
/* Dont keep track of sidebar panel changes no more */
|
||||
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SIDEBAR_PANELS_NAMESPACE,
|
||||
sidebar_panels_changed_callback,
|
||||
NULL);
|
||||
|
||||
nautilus_window_remove_bookmarks_menu_callback (window);
|
||||
nautilus_window_remove_go_menu_callback (window);
|
||||
nautilus_window_toolbar_remove_theme_callback (window);
|
||||
|
||||
/* Disconnect view signals here so they don't trigger when
|
||||
* views are destroyed normally.
|
||||
*/
|
||||
g_list_foreach (window->sidebar_panels, view_disconnect, window);
|
||||
g_list_free (window->sidebar_panels);
|
||||
|
||||
nautilus_window_disconnect_view (window, window->content_view);
|
||||
|
||||
nautilus_view_identifier_free (window->content_view_id);
|
||||
|
||||
g_free (window->location);
|
||||
|
@ -845,7 +831,7 @@ nautilus_window_size_request (GtkWidget *widget,
|
|||
*/
|
||||
|
||||
static void
|
||||
view_menu_switch_views_callback (GtkWidget *widget, gpointer data)
|
||||
view_as_menu_switch_views_callback (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
NautilusWindow *window;
|
||||
NautilusViewIdentifier *identifier;
|
||||
|
@ -861,7 +847,7 @@ view_menu_switch_views_callback (GtkWidget *widget, gpointer data)
|
|||
|
||||
/* Note: The identifier parameter ownership is handed off to the menu item. */
|
||||
static GtkWidget *
|
||||
create_content_view_menu_item (NautilusWindow *window, NautilusViewIdentifier *identifier)
|
||||
create_view_as_menu_item (NautilusWindow *window, NautilusViewIdentifier *identifier)
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
char *menu_label;
|
||||
|
@ -872,7 +858,7 @@ create_content_view_menu_item (NautilusWindow *window, NautilusViewIdentifier *i
|
|||
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item),
|
||||
"activate",
|
||||
view_menu_switch_views_callback,
|
||||
view_as_menu_switch_views_callback,
|
||||
NULL);
|
||||
|
||||
/* Store copy of iid in item; free when item destroyed. */
|
||||
|
@ -905,7 +891,7 @@ new_gtk_separator (void)
|
|||
* content view isn't already in the "View as" option menu.
|
||||
*/
|
||||
static void
|
||||
replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
||||
replace_special_current_view_in_view_as_menu (NautilusWindow *window)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *first_menu_item;
|
||||
|
@ -929,7 +915,7 @@ replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
|||
gtk_menu_prepend (GTK_MENU (menu), new_gtk_separator ());
|
||||
}
|
||||
|
||||
new_menu_item = create_content_view_menu_item (window, nautilus_view_identifier_copy (window->content_view_id));
|
||||
new_menu_item = create_view_as_menu_item (window, nautilus_view_identifier_copy (window->content_view_id));
|
||||
gtk_object_set_data (GTK_OBJECT (new_menu_item), "current content view", GINT_TO_POINTER (TRUE));
|
||||
gtk_menu_prepend (GTK_MENU (menu), new_menu_item);
|
||||
|
||||
|
@ -938,7 +924,7 @@ replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
|||
}
|
||||
|
||||
/**
|
||||
* nautilus_window_synch_content_view_menu:
|
||||
* nautilus_window_synch_view_as_menu:
|
||||
*
|
||||
* Set the visible item of the "View as" option menu to
|
||||
* match the current content view.
|
||||
|
@ -946,7 +932,7 @@ replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
|||
* @window: The NautilusWindow whose "View as" option menu should be synched.
|
||||
*/
|
||||
void
|
||||
nautilus_window_synch_content_view_menu (NautilusWindow *window)
|
||||
nautilus_window_synch_view_as_menu (NautilusWindow *window)
|
||||
{
|
||||
GList *children, *child;
|
||||
GtkWidget *menu;
|
||||
|
@ -972,7 +958,7 @@ nautilus_window_synch_content_view_menu (NautilusWindow *window)
|
|||
}
|
||||
|
||||
if (matching_index == -1) {
|
||||
replace_special_current_view_in_content_view_menu (window);
|
||||
replace_special_current_view_in_view_as_menu (window);
|
||||
matching_index = 0;
|
||||
}
|
||||
|
||||
|
@ -985,29 +971,34 @@ nautilus_window_synch_content_view_menu (NautilusWindow *window)
|
|||
static void
|
||||
chose_component_callback (NautilusViewIdentifier *identifier, gpointer callback_data)
|
||||
{
|
||||
/* Can't assume callback_data is a valid NautilusWindow, because
|
||||
* it might be garbage if the program is exiting when this dialog
|
||||
* is up.
|
||||
*/
|
||||
NautilusWindow *window;
|
||||
|
||||
window = NAUTILUS_WINDOW (callback_data);
|
||||
if (identifier != NULL) {
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (callback_data));
|
||||
nautilus_window_set_content_view (NAUTILUS_WINDOW (callback_data), identifier);
|
||||
nautilus_window_set_content_view (window, identifier);
|
||||
}
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1334:
|
||||
* There should be some global way to signal that the
|
||||
* file type associations have changed, so that the places that
|
||||
* display these lists can react. For now, hardwire this case, which
|
||||
* is the most obvious one by far.
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1334: There should be some global
|
||||
* way to signal that the file type associations have changed,
|
||||
* so that the places that display these lists can react. For
|
||||
* now, hardwire this case, which is the most obvious one by
|
||||
* far.
|
||||
*/
|
||||
if (NAUTILUS_IS_WINDOW (callback_data)) {
|
||||
nautilus_window_load_content_view_menu (NAUTILUS_WINDOW (callback_data));
|
||||
nautilus_window_load_view_as_menu (window);
|
||||
}
|
||||
|
||||
static void
|
||||
cancel_chose_component_callback (NautilusWindow *window)
|
||||
{
|
||||
if (window->details->viewed_file != NULL) {
|
||||
nautilus_cancel_choose_component_for_file (window->details->viewed_file,
|
||||
chose_component_callback,
|
||||
window);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
view_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
||||
view_as_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
NautilusWindow *window;
|
||||
|
||||
|
@ -1016,14 +1007,18 @@ view_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
|||
|
||||
window = NAUTILUS_WINDOW (gtk_object_get_data (GTK_OBJECT (widget), "window"));
|
||||
|
||||
/* Set the option menu back to its previous setting (Don't leave it
|
||||
* on this dialog-producing "View as Other..." setting). If the menu choice
|
||||
* causes a content view change, this will be updated again later,
|
||||
* in nautilus_window_load_content_view_menu. Do this right away so
|
||||
* the user never sees the option menu set to "View as Other...".
|
||||
/* Set the option menu back to its previous setting (Don't
|
||||
* leave it on this dialog-producing "View as Other..."
|
||||
* setting). If the menu choice causes a content view change,
|
||||
* this will be updated again later, in
|
||||
* nautilus_window_load_view_as_menu. Do this right away so
|
||||
* the user never sees the option menu set to "View as
|
||||
* Other...".
|
||||
*/
|
||||
nautilus_window_synch_content_view_menu (window);
|
||||
nautilus_window_synch_view_as_menu (window);
|
||||
|
||||
/* Call back when the user chose the component. */
|
||||
cancel_chose_component_callback (window);
|
||||
nautilus_choose_component_for_file (window->details->viewed_file,
|
||||
GTK_WINDOW (window),
|
||||
chose_component_callback,
|
||||
|
@ -1031,28 +1026,30 @@ view_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
|||
}
|
||||
|
||||
static void
|
||||
view_menu_vfs_method_callback (GtkWidget *widget, gpointer data)
|
||||
view_as_menu_vfs_method_callback (GtkWidget *widget, gpointer callback_data)
|
||||
{
|
||||
gpointer object_data;
|
||||
NautilusWindow *window;
|
||||
char *new_location;
|
||||
char *method;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (gtk_object_get_data (GTK_OBJECT (widget), "window")));
|
||||
|
||||
window = NAUTILUS_WINDOW (gtk_object_get_data (GTK_OBJECT (widget), "window"));
|
||||
method = (char *) (gtk_object_get_data (GTK_OBJECT (widget), "method"));
|
||||
g_return_if_fail (method);
|
||||
|
||||
object_data = gtk_object_get_data (GTK_OBJECT (widget), "window");
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (object_data));
|
||||
window = NAUTILUS_WINDOW (object_data);
|
||||
|
||||
method = (char *) gtk_object_get_data (GTK_OBJECT (widget), "method");
|
||||
g_return_if_fail (method != NULL);
|
||||
|
||||
new_location = g_strdup_printf ("%s#%s:/",window->location,method);
|
||||
nautilus_window_goto_uri (window, new_location);
|
||||
g_free (new_location);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
||||
gpointer callback_data)
|
||||
load_view_as_menu_callback (NautilusFile *file,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GList *components;
|
||||
char *method;
|
||||
|
@ -1071,7 +1068,7 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
/* Add a menu item for each view in the preferred list for this location. */
|
||||
components = nautilus_mime_get_short_list_components_for_file (window->details->viewed_file);
|
||||
for (p = components; p != NULL; p = p->next) {
|
||||
menu_item = create_content_view_menu_item
|
||||
menu_item = create_view_as_menu_item
|
||||
(window, nautilus_view_identifier_new_from_content_view (p->data));
|
||||
gtk_menu_append (GTK_MENU (new_menu), menu_item);
|
||||
}
|
||||
|
@ -1082,10 +1079,11 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
* one way trip if you choose one of these view menu items, but
|
||||
* it's better than nothing.
|
||||
*/
|
||||
method = nautilus_mime_get_short_list_methods_for_file (window->details->viewed_file);
|
||||
/* FIXME bugzilla.eazel.com 2466: Name of the function is plural, but it returns only
|
||||
* one item. That must be fixed.
|
||||
/* FIXME bugzilla.eazel.com 2466: The name of the following
|
||||
* function is plural, but it returns only one item. That must
|
||||
* be fixed.
|
||||
*/
|
||||
method = nautilus_mime_get_short_list_methods_for_file (window->details->viewed_file);
|
||||
if (method != NULL) {
|
||||
label = g_strdup_printf (_("View as %s..."), method);
|
||||
menu_item = gtk_menu_item_new_with_label (label);
|
||||
|
@ -1096,7 +1094,7 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
g_strdup (method), g_free);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item),
|
||||
"activate",
|
||||
view_menu_vfs_method_callback,
|
||||
view_as_menu_vfs_method_callback,
|
||||
NULL);
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_append (GTK_MENU (new_menu), menu_item);
|
||||
|
@ -1113,7 +1111,7 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
gtk_object_set_data (GTK_OBJECT (menu_item), "window", window);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item),
|
||||
"activate",
|
||||
view_menu_choose_view_callback,
|
||||
view_as_menu_choose_view_callback,
|
||||
NULL);
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_append (GTK_MENU (new_menu), menu_item);
|
||||
|
@ -1124,12 +1122,19 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
gtk_option_menu_set_menu (GTK_OPTION_MENU (window->view_as_option_menu),
|
||||
new_menu);
|
||||
|
||||
nautilus_window_synch_view_as_menu (window);
|
||||
}
|
||||
|
||||
nautilus_window_synch_content_view_menu (window);
|
||||
static void
|
||||
cancel_view_as_callback (NautilusWindow *window)
|
||||
{
|
||||
nautilus_file_cancel_call_when_ready (window->details->viewed_file,
|
||||
load_view_as_menu_callback,
|
||||
window);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_load_content_view_menu (NautilusWindow *window)
|
||||
nautilus_window_load_view_as_menu (NautilusWindow *window)
|
||||
{
|
||||
GList *attributes;
|
||||
|
||||
|
@ -1137,9 +1142,11 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
|
||||
attributes = nautilus_mime_actions_get_full_file_attributes ();
|
||||
|
||||
/* FIXME: need to cancel this when appropriate... */
|
||||
nautilus_file_call_when_ready (window->details->viewed_file, attributes,
|
||||
nautilus_window_real_load_content_view_menu, window);
|
||||
cancel_view_as_callback (window);
|
||||
nautilus_file_call_when_ready (window->details->viewed_file,
|
||||
attributes,
|
||||
load_view_as_menu_callback,
|
||||
window);
|
||||
|
||||
g_list_free (attributes);
|
||||
}
|
||||
|
@ -1751,3 +1758,18 @@ nautilus_window_get_ui_container (NautilusWindow *window)
|
|||
|
||||
return bonobo_object_corba_objref (BONOBO_OBJECT (window->details->ui_container));
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_set_viewed_file (NautilusWindow *window,
|
||||
NautilusFile *file)
|
||||
{
|
||||
if (window->details->viewed_file == file) {
|
||||
return;
|
||||
}
|
||||
|
||||
nautilus_file_ref (file);
|
||||
cancel_view_as_callback (window);
|
||||
cancel_chose_component_callback (window);
|
||||
nautilus_file_unref (window->details->viewed_file);
|
||||
window->details->viewed_file = file;
|
||||
}
|
||||
|
|
|
@ -117,9 +117,9 @@ static void add_command_buttons (NautilusSidebar *sidebar,
|
|||
|
||||
static void nautilus_sidebar_update_all (NautilusSidebar *sidebar);
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1245: hardwired sizes */
|
||||
#define DEFAULT_TAB_COLOR "rgb:9999/9999/9999"
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1245: hardwired sizes */
|
||||
#define SIDEBAR_MINIMUM_WIDTH 1
|
||||
#define SIDEBAR_MINIMUM_HEIGHT 400
|
||||
|
||||
|
@ -1217,9 +1217,14 @@ add_command_buttons (NautilusSidebar *sidebar, GList *application_list)
|
|||
FALSE, FALSE,
|
||||
0);
|
||||
|
||||
/* FIXME bugzilla.eazel.com 2510: Security hole? Can't use a string from the
|
||||
* MIME file as a printf format string without first
|
||||
* checking it over somehow.
|
||||
/* FIXME bugzilla.eazel.com 2510: Security hole?
|
||||
* Unsafe to use a string from the MIME file as a
|
||||
* printf format string without first checking it over
|
||||
* somehow. We can do a search and replace on the "%s"
|
||||
* part instead, which should work.
|
||||
*/
|
||||
/* FIXME: Doing a +7 does not turn a URI into a path
|
||||
* name.
|
||||
*/
|
||||
temp_str = g_strdup_printf
|
||||
("'%s'",
|
||||
|
@ -1239,7 +1244,7 @@ add_command_buttons (NautilusSidebar *sidebar, GList *application_list)
|
|||
|
||||
/* Catch-all button after all the others. */
|
||||
temp_button = gtk_button_new_with_label (_("Open with..."));
|
||||
gtk_signal_connect (GTK_OBJECT (temp_button), "clicked",
|
||||
gtk_signal_connect (GTK_OBJECT (temp_button), "clicked",
|
||||
open_with_callback, NULL);
|
||||
gtk_object_set_user_data (GTK_OBJECT (temp_button), sidebar);
|
||||
gtk_widget_show (temp_button);
|
||||
|
|
|
@ -103,26 +103,24 @@ enum {
|
|||
ARG_APP
|
||||
};
|
||||
|
||||
/* Other static variables */
|
||||
static GList *history_list = NULL;
|
||||
|
||||
static void nautilus_window_initialize_class (NautilusWindowClass *klass);
|
||||
static void nautilus_window_initialize (NautilusWindow *window);
|
||||
static void nautilus_window_destroy (GtkObject *object);
|
||||
static void nautilus_window_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void nautilus_window_realize (GtkWidget *widget);
|
||||
static void update_sidebar_panels_from_preferences (NautilusWindow *window);
|
||||
static void sidebar_panels_changed_callback (gpointer user_data);
|
||||
static void nautilus_window_show (GtkWidget *widget);
|
||||
static void nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
||||
gpointer callback_data);
|
||||
static void nautilus_window_initialize_class (NautilusWindowClass *klass);
|
||||
static void nautilus_window_initialize (NautilusWindow *window);
|
||||
static void nautilus_window_destroy (GtkObject *object);
|
||||
static void nautilus_window_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void nautilus_window_realize (GtkWidget *widget);
|
||||
static void update_sidebar_panels_from_preferences (NautilusWindow *window);
|
||||
static void sidebar_panels_changed_callback (gpointer user_data);
|
||||
static void nautilus_window_show (GtkWidget *widget);
|
||||
static void cancel_view_as_callback (NautilusWindow *window);
|
||||
|
||||
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusWindow,
|
||||
nautilus_window,
|
||||
|
@ -447,10 +445,14 @@ nautilus_window_constructed (NautilusWindow *window)
|
|||
* It gets shown later, if the view-frame contains something zoomable.
|
||||
*/
|
||||
window->zoom_control = nautilus_zoom_control_new ();
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_in", nautilus_window_zoom_in, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_out", nautilus_window_zoom_out, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_level", nautilus_window_zoom_to_level, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_fit", nautilus_window_zoom_to_fit, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_in",
|
||||
nautilus_window_zoom_in, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_out",
|
||||
nautilus_window_zoom_out, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_level",
|
||||
nautilus_window_zoom_to_level, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_fit",
|
||||
nautilus_window_zoom_to_fit, GTK_OBJECT (window));
|
||||
gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show (location_bar_box);
|
||||
|
@ -527,7 +529,7 @@ nautilus_window_constructed (NautilusWindow *window)
|
|||
|
||||
/* watch for throbber locatoin changes, too */
|
||||
gtk_signal_connect (GTK_OBJECT (window->throbber), "location_changed",
|
||||
goto_uri_callback, window);
|
||||
goto_uri_callback, window);
|
||||
|
||||
/* Set initial sensitivity of some buttons & menu items
|
||||
* now that they're all created.
|
||||
|
@ -589,16 +591,6 @@ nautilus_window_get_arg (GtkObject *object,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
view_disconnect (gpointer data, gpointer user_data)
|
||||
{
|
||||
g_assert (NAUTILUS_IS_WINDOW (user_data));
|
||||
g_assert (NAUTILUS_IS_VIEW_FRAME (data));
|
||||
|
||||
nautilus_window_disconnect_view (NAUTILUS_WINDOW (user_data),
|
||||
NAUTILUS_VIEW_FRAME (data));
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_destroy (GtkObject *object)
|
||||
{
|
||||
|
@ -606,39 +598,33 @@ nautilus_window_destroy (GtkObject *object)
|
|||
|
||||
window = NAUTILUS_WINDOW (object);
|
||||
|
||||
/* Let go of the UI. */
|
||||
/* Handle the part of destroy that's private to the view
|
||||
* management.
|
||||
*/
|
||||
nautilus_window_manage_views_destroy (window);
|
||||
|
||||
/* Get rid of all callbacks. */
|
||||
|
||||
cancel_view_as_callback (window);
|
||||
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SIDEBAR_PANELS_NAMESPACE,
|
||||
sidebar_panels_changed_callback,
|
||||
NULL);
|
||||
nautilus_window_remove_bookmarks_menu_callback (window);
|
||||
nautilus_window_remove_go_menu_callback (window);
|
||||
nautilus_window_toolbar_remove_theme_callback (window);
|
||||
|
||||
/* Get rid of all owned objects. */
|
||||
|
||||
if (window->details->shell_ui != NULL) {
|
||||
bonobo_ui_component_unset_container (window->details->shell_ui);
|
||||
bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui));
|
||||
}
|
||||
|
||||
/* Cancel the callback for the View As menu update, if any */
|
||||
nautilus_file_cancel_call_when_ready (window->details->viewed_file,
|
||||
nautilus_window_real_load_content_view_menu,
|
||||
window);
|
||||
|
||||
/* Let go of the file for the current location */
|
||||
nautilus_file_unref (window->details->viewed_file);
|
||||
|
||||
g_free (window->details->dead_view_name);
|
||||
|
||||
/* Dont keep track of sidebar panel changes no more */
|
||||
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SIDEBAR_PANELS_NAMESPACE,
|
||||
sidebar_panels_changed_callback,
|
||||
NULL);
|
||||
|
||||
nautilus_window_remove_bookmarks_menu_callback (window);
|
||||
nautilus_window_remove_go_menu_callback (window);
|
||||
nautilus_window_toolbar_remove_theme_callback (window);
|
||||
|
||||
/* Disconnect view signals here so they don't trigger when
|
||||
* views are destroyed normally.
|
||||
*/
|
||||
g_list_foreach (window->sidebar_panels, view_disconnect, window);
|
||||
g_list_free (window->sidebar_panels);
|
||||
|
||||
nautilus_window_disconnect_view (window, window->content_view);
|
||||
|
||||
nautilus_view_identifier_free (window->content_view_id);
|
||||
|
||||
g_free (window->location);
|
||||
|
@ -845,7 +831,7 @@ nautilus_window_size_request (GtkWidget *widget,
|
|||
*/
|
||||
|
||||
static void
|
||||
view_menu_switch_views_callback (GtkWidget *widget, gpointer data)
|
||||
view_as_menu_switch_views_callback (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
NautilusWindow *window;
|
||||
NautilusViewIdentifier *identifier;
|
||||
|
@ -861,7 +847,7 @@ view_menu_switch_views_callback (GtkWidget *widget, gpointer data)
|
|||
|
||||
/* Note: The identifier parameter ownership is handed off to the menu item. */
|
||||
static GtkWidget *
|
||||
create_content_view_menu_item (NautilusWindow *window, NautilusViewIdentifier *identifier)
|
||||
create_view_as_menu_item (NautilusWindow *window, NautilusViewIdentifier *identifier)
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
char *menu_label;
|
||||
|
@ -872,7 +858,7 @@ create_content_view_menu_item (NautilusWindow *window, NautilusViewIdentifier *i
|
|||
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item),
|
||||
"activate",
|
||||
view_menu_switch_views_callback,
|
||||
view_as_menu_switch_views_callback,
|
||||
NULL);
|
||||
|
||||
/* Store copy of iid in item; free when item destroyed. */
|
||||
|
@ -905,7 +891,7 @@ new_gtk_separator (void)
|
|||
* content view isn't already in the "View as" option menu.
|
||||
*/
|
||||
static void
|
||||
replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
||||
replace_special_current_view_in_view_as_menu (NautilusWindow *window)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *first_menu_item;
|
||||
|
@ -929,7 +915,7 @@ replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
|||
gtk_menu_prepend (GTK_MENU (menu), new_gtk_separator ());
|
||||
}
|
||||
|
||||
new_menu_item = create_content_view_menu_item (window, nautilus_view_identifier_copy (window->content_view_id));
|
||||
new_menu_item = create_view_as_menu_item (window, nautilus_view_identifier_copy (window->content_view_id));
|
||||
gtk_object_set_data (GTK_OBJECT (new_menu_item), "current content view", GINT_TO_POINTER (TRUE));
|
||||
gtk_menu_prepend (GTK_MENU (menu), new_menu_item);
|
||||
|
||||
|
@ -938,7 +924,7 @@ replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
|||
}
|
||||
|
||||
/**
|
||||
* nautilus_window_synch_content_view_menu:
|
||||
* nautilus_window_synch_view_as_menu:
|
||||
*
|
||||
* Set the visible item of the "View as" option menu to
|
||||
* match the current content view.
|
||||
|
@ -946,7 +932,7 @@ replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
|||
* @window: The NautilusWindow whose "View as" option menu should be synched.
|
||||
*/
|
||||
void
|
||||
nautilus_window_synch_content_view_menu (NautilusWindow *window)
|
||||
nautilus_window_synch_view_as_menu (NautilusWindow *window)
|
||||
{
|
||||
GList *children, *child;
|
||||
GtkWidget *menu;
|
||||
|
@ -972,7 +958,7 @@ nautilus_window_synch_content_view_menu (NautilusWindow *window)
|
|||
}
|
||||
|
||||
if (matching_index == -1) {
|
||||
replace_special_current_view_in_content_view_menu (window);
|
||||
replace_special_current_view_in_view_as_menu (window);
|
||||
matching_index = 0;
|
||||
}
|
||||
|
||||
|
@ -985,29 +971,34 @@ nautilus_window_synch_content_view_menu (NautilusWindow *window)
|
|||
static void
|
||||
chose_component_callback (NautilusViewIdentifier *identifier, gpointer callback_data)
|
||||
{
|
||||
/* Can't assume callback_data is a valid NautilusWindow, because
|
||||
* it might be garbage if the program is exiting when this dialog
|
||||
* is up.
|
||||
*/
|
||||
NautilusWindow *window;
|
||||
|
||||
window = NAUTILUS_WINDOW (callback_data);
|
||||
if (identifier != NULL) {
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (callback_data));
|
||||
nautilus_window_set_content_view (NAUTILUS_WINDOW (callback_data), identifier);
|
||||
nautilus_window_set_content_view (window, identifier);
|
||||
}
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1334:
|
||||
* There should be some global way to signal that the
|
||||
* file type associations have changed, so that the places that
|
||||
* display these lists can react. For now, hardwire this case, which
|
||||
* is the most obvious one by far.
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1334: There should be some global
|
||||
* way to signal that the file type associations have changed,
|
||||
* so that the places that display these lists can react. For
|
||||
* now, hardwire this case, which is the most obvious one by
|
||||
* far.
|
||||
*/
|
||||
if (NAUTILUS_IS_WINDOW (callback_data)) {
|
||||
nautilus_window_load_content_view_menu (NAUTILUS_WINDOW (callback_data));
|
||||
nautilus_window_load_view_as_menu (window);
|
||||
}
|
||||
|
||||
static void
|
||||
cancel_chose_component_callback (NautilusWindow *window)
|
||||
{
|
||||
if (window->details->viewed_file != NULL) {
|
||||
nautilus_cancel_choose_component_for_file (window->details->viewed_file,
|
||||
chose_component_callback,
|
||||
window);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
view_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
||||
view_as_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
NautilusWindow *window;
|
||||
|
||||
|
@ -1016,14 +1007,18 @@ view_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
|||
|
||||
window = NAUTILUS_WINDOW (gtk_object_get_data (GTK_OBJECT (widget), "window"));
|
||||
|
||||
/* Set the option menu back to its previous setting (Don't leave it
|
||||
* on this dialog-producing "View as Other..." setting). If the menu choice
|
||||
* causes a content view change, this will be updated again later,
|
||||
* in nautilus_window_load_content_view_menu. Do this right away so
|
||||
* the user never sees the option menu set to "View as Other...".
|
||||
/* Set the option menu back to its previous setting (Don't
|
||||
* leave it on this dialog-producing "View as Other..."
|
||||
* setting). If the menu choice causes a content view change,
|
||||
* this will be updated again later, in
|
||||
* nautilus_window_load_view_as_menu. Do this right away so
|
||||
* the user never sees the option menu set to "View as
|
||||
* Other...".
|
||||
*/
|
||||
nautilus_window_synch_content_view_menu (window);
|
||||
nautilus_window_synch_view_as_menu (window);
|
||||
|
||||
/* Call back when the user chose the component. */
|
||||
cancel_chose_component_callback (window);
|
||||
nautilus_choose_component_for_file (window->details->viewed_file,
|
||||
GTK_WINDOW (window),
|
||||
chose_component_callback,
|
||||
|
@ -1031,28 +1026,30 @@ view_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
|||
}
|
||||
|
||||
static void
|
||||
view_menu_vfs_method_callback (GtkWidget *widget, gpointer data)
|
||||
view_as_menu_vfs_method_callback (GtkWidget *widget, gpointer callback_data)
|
||||
{
|
||||
gpointer object_data;
|
||||
NautilusWindow *window;
|
||||
char *new_location;
|
||||
char *method;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (gtk_object_get_data (GTK_OBJECT (widget), "window")));
|
||||
|
||||
window = NAUTILUS_WINDOW (gtk_object_get_data (GTK_OBJECT (widget), "window"));
|
||||
method = (char *) (gtk_object_get_data (GTK_OBJECT (widget), "method"));
|
||||
g_return_if_fail (method);
|
||||
|
||||
object_data = gtk_object_get_data (GTK_OBJECT (widget), "window");
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (object_data));
|
||||
window = NAUTILUS_WINDOW (object_data);
|
||||
|
||||
method = (char *) gtk_object_get_data (GTK_OBJECT (widget), "method");
|
||||
g_return_if_fail (method != NULL);
|
||||
|
||||
new_location = g_strdup_printf ("%s#%s:/",window->location,method);
|
||||
nautilus_window_goto_uri (window, new_location);
|
||||
g_free (new_location);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
||||
gpointer callback_data)
|
||||
load_view_as_menu_callback (NautilusFile *file,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GList *components;
|
||||
char *method;
|
||||
|
@ -1071,7 +1068,7 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
/* Add a menu item for each view in the preferred list for this location. */
|
||||
components = nautilus_mime_get_short_list_components_for_file (window->details->viewed_file);
|
||||
for (p = components; p != NULL; p = p->next) {
|
||||
menu_item = create_content_view_menu_item
|
||||
menu_item = create_view_as_menu_item
|
||||
(window, nautilus_view_identifier_new_from_content_view (p->data));
|
||||
gtk_menu_append (GTK_MENU (new_menu), menu_item);
|
||||
}
|
||||
|
@ -1082,10 +1079,11 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
* one way trip if you choose one of these view menu items, but
|
||||
* it's better than nothing.
|
||||
*/
|
||||
method = nautilus_mime_get_short_list_methods_for_file (window->details->viewed_file);
|
||||
/* FIXME bugzilla.eazel.com 2466: Name of the function is plural, but it returns only
|
||||
* one item. That must be fixed.
|
||||
/* FIXME bugzilla.eazel.com 2466: The name of the following
|
||||
* function is plural, but it returns only one item. That must
|
||||
* be fixed.
|
||||
*/
|
||||
method = nautilus_mime_get_short_list_methods_for_file (window->details->viewed_file);
|
||||
if (method != NULL) {
|
||||
label = g_strdup_printf (_("View as %s..."), method);
|
||||
menu_item = gtk_menu_item_new_with_label (label);
|
||||
|
@ -1096,7 +1094,7 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
g_strdup (method), g_free);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item),
|
||||
"activate",
|
||||
view_menu_vfs_method_callback,
|
||||
view_as_menu_vfs_method_callback,
|
||||
NULL);
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_append (GTK_MENU (new_menu), menu_item);
|
||||
|
@ -1113,7 +1111,7 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
gtk_object_set_data (GTK_OBJECT (menu_item), "window", window);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item),
|
||||
"activate",
|
||||
view_menu_choose_view_callback,
|
||||
view_as_menu_choose_view_callback,
|
||||
NULL);
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_append (GTK_MENU (new_menu), menu_item);
|
||||
|
@ -1124,12 +1122,19 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
gtk_option_menu_set_menu (GTK_OPTION_MENU (window->view_as_option_menu),
|
||||
new_menu);
|
||||
|
||||
nautilus_window_synch_view_as_menu (window);
|
||||
}
|
||||
|
||||
nautilus_window_synch_content_view_menu (window);
|
||||
static void
|
||||
cancel_view_as_callback (NautilusWindow *window)
|
||||
{
|
||||
nautilus_file_cancel_call_when_ready (window->details->viewed_file,
|
||||
load_view_as_menu_callback,
|
||||
window);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_load_content_view_menu (NautilusWindow *window)
|
||||
nautilus_window_load_view_as_menu (NautilusWindow *window)
|
||||
{
|
||||
GList *attributes;
|
||||
|
||||
|
@ -1137,9 +1142,11 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
|
||||
attributes = nautilus_mime_actions_get_full_file_attributes ();
|
||||
|
||||
/* FIXME: need to cancel this when appropriate... */
|
||||
nautilus_file_call_when_ready (window->details->viewed_file, attributes,
|
||||
nautilus_window_real_load_content_view_menu, window);
|
||||
cancel_view_as_callback (window);
|
||||
nautilus_file_call_when_ready (window->details->viewed_file,
|
||||
attributes,
|
||||
load_view_as_menu_callback,
|
||||
window);
|
||||
|
||||
g_list_free (attributes);
|
||||
}
|
||||
|
@ -1751,3 +1758,18 @@ nautilus_window_get_ui_container (NautilusWindow *window)
|
|||
|
||||
return bonobo_object_corba_objref (BONOBO_OBJECT (window->details->ui_container));
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_set_viewed_file (NautilusWindow *window,
|
||||
NautilusFile *file)
|
||||
{
|
||||
if (window->details->viewed_file == file) {
|
||||
return;
|
||||
}
|
||||
|
||||
nautilus_file_ref (file);
|
||||
cancel_view_as_callback (window);
|
||||
cancel_chose_component_callback (window);
|
||||
nautilus_file_unref (window->details->viewed_file);
|
||||
window->details->viewed_file = file;
|
||||
}
|
||||
|
|
|
@ -81,7 +81,10 @@
|
|||
*/
|
||||
#define MAX_URI_IN_DIALOG_LENGTH 60
|
||||
|
||||
static void connect_view (NautilusWindow *window, NautilusViewFrame *view);
|
||||
static void connect_view (NautilusWindow *window,
|
||||
NautilusViewFrame *view);
|
||||
static void disconnect_view (NautilusWindow *window,
|
||||
NautilusViewFrame *view);
|
||||
|
||||
static void
|
||||
change_selection (NautilusWindow *window,
|
||||
|
@ -409,24 +412,38 @@ update_up_button (NautilusWindow *window)
|
|||
}
|
||||
|
||||
static void
|
||||
viewed_file_changed_callback (NautilusWindow *window)
|
||||
viewed_file_changed_callback (NautilusFile *file,
|
||||
NautilusWindow *window)
|
||||
{
|
||||
g_assert (NAUTILUS_IS_FILE (file));
|
||||
g_assert (NAUTILUS_IS_WINDOW (window));
|
||||
|
||||
/* FIXME: is the below really the right thing to do for all
|
||||
cases? */
|
||||
g_assert (window->details->viewed_file == file);
|
||||
|
||||
/* Close window if the file it's viewing has been deleted. */
|
||||
if (nautilus_file_is_gone (window->details->viewed_file)) {
|
||||
/* FIXME: Is closing the window really the right thing to do
|
||||
* for all cases?
|
||||
*/
|
||||
if (nautilus_file_is_gone (file)) {
|
||||
nautilus_window_close (window);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
cancel_viewed_file_changed_callback (NautilusWindow *window)
|
||||
{
|
||||
if (window->details->viewed_file != NULL) {
|
||||
gtk_signal_disconnect_by_func (GTK_OBJECT (window->details->viewed_file),
|
||||
viewed_file_changed_callback,
|
||||
window);
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle the changes for the NautilusWindow itself. */
|
||||
static void
|
||||
update_for_new_location (NautilusWindow *window)
|
||||
{
|
||||
char *new_location;
|
||||
NautilusFile *file;
|
||||
|
||||
g_assert (window->pending_ni != NULL);
|
||||
|
||||
|
@ -452,15 +469,17 @@ update_for_new_location (NautilusWindow *window)
|
|||
g_free (window->location);
|
||||
window->location = new_location;
|
||||
|
||||
/* Create a NautilusFile for this location, so we can
|
||||
* check if it goes away.
|
||||
/* Create a NautilusFile for this location, so we can catch it
|
||||
* if it goes away.
|
||||
*/
|
||||
nautilus_file_unref (window->details->viewed_file);
|
||||
window->details->viewed_file = nautilus_file_get (window->location);
|
||||
gtk_signal_connect_object_while_alive (GTK_OBJECT (window->details->viewed_file),
|
||||
"changed",
|
||||
viewed_file_changed_callback,
|
||||
GTK_OBJECT (window));
|
||||
cancel_viewed_file_changed_callback (window);
|
||||
file = nautilus_file_get (window->location);
|
||||
nautilus_window_set_viewed_file (window, file);
|
||||
gtk_signal_connect (GTK_OBJECT (file),
|
||||
"changed",
|
||||
viewed_file_changed_callback,
|
||||
window);
|
||||
nautilus_file_unref (file);
|
||||
|
||||
/* Clear the selection. */
|
||||
nautilus_g_list_free_deep (window->selection);
|
||||
|
@ -470,7 +489,7 @@ update_for_new_location (NautilusWindow *window)
|
|||
update_up_button (window);
|
||||
|
||||
/* Set up the content view menu for this new location. */
|
||||
nautilus_window_load_content_view_menu (window);
|
||||
nautilus_window_load_view_as_menu (window);
|
||||
|
||||
/* Check if the back and forward buttons need enabling or disabling. */
|
||||
nautilus_window_allow_back (window, window->back_list != NULL);
|
||||
|
@ -506,7 +525,7 @@ location_has_really_changed (NautilusWindow *window)
|
|||
/* Switch to the new content view. */
|
||||
if (window->new_content_view != NULL) {
|
||||
if (GTK_WIDGET (window->new_content_view)->parent == NULL) {
|
||||
nautilus_window_disconnect_view (window, window->content_view);
|
||||
disconnect_view (window, window->content_view);
|
||||
nautilus_window_set_content_view_widget (window, window->new_content_view);
|
||||
}
|
||||
gtk_object_unref (GTK_OBJECT (window->new_content_view));
|
||||
|
@ -518,7 +537,7 @@ location_has_really_changed (NautilusWindow *window)
|
|||
* views in the menu are for the old location).
|
||||
*/
|
||||
if (window->pending_ni == NULL) {
|
||||
nautilus_window_synch_content_view_menu (window);
|
||||
nautilus_window_synch_view_as_menu (window);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -536,28 +555,6 @@ location_has_really_changed (NautilusWindow *window)
|
|||
update_title (window);
|
||||
}
|
||||
|
||||
/* This is called when we are done loading to get rid of the load_info structure. */
|
||||
static void
|
||||
nautilus_window_free_load_info (NautilusWindow *window)
|
||||
{
|
||||
if (window->pending_ni != NULL) {
|
||||
nautilus_navigation_info_free (window->pending_ni);
|
||||
window->pending_ni = NULL;
|
||||
}
|
||||
|
||||
window->error_views = NULL;
|
||||
window->new_content_view = NULL;
|
||||
window->cancel_tag = NULL;
|
||||
window->views_shown = FALSE;
|
||||
window->view_bombed_out = FALSE;
|
||||
window->view_activation_complete = FALSE;
|
||||
window->cv_progress_initial = FALSE;
|
||||
window->cv_progress_done = FALSE;
|
||||
window->cv_progress_error = FALSE;
|
||||
window->sent_update_view = FALSE;
|
||||
window->reset_to_idle = FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
handle_unreadable_location (NautilusWindow *window, const char *uri)
|
||||
{
|
||||
|
@ -796,15 +793,32 @@ handle_view_failure (NautilusWindow *window,
|
|||
}
|
||||
|
||||
static void
|
||||
cancel_location_change (NautilusWindow *window)
|
||||
free_location_change (NautilusWindow *window)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
if (window->cancel_tag != NULL) {
|
||||
nautilus_navigation_info_cancel (window->cancel_tag);
|
||||
window->cancel_tag = NULL;
|
||||
}
|
||||
|
||||
if (window->pending_ni != NULL) {
|
||||
nautilus_navigation_info_free (window->pending_ni);
|
||||
window->pending_ni = NULL;
|
||||
}
|
||||
|
||||
if (window->new_content_view != NULL) {
|
||||
gtk_widget_unref (GTK_WIDGET (window->new_content_view));
|
||||
window->new_content_view = NULL;
|
||||
}
|
||||
|
||||
nautilus_gtk_object_list_free (window->error_views);
|
||||
window->error_views = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
cancel_location_change (NautilusWindow *window)
|
||||
{
|
||||
GList *node;
|
||||
|
||||
if (window->pending_ni != NULL) {
|
||||
set_displayed_location
|
||||
(window, window->location == NULL ? "" : window->location);
|
||||
|
@ -820,15 +834,20 @@ cancel_location_change (NautilusWindow *window)
|
|||
}
|
||||
}
|
||||
|
||||
if (window->new_content_view != NULL) {
|
||||
gtk_widget_unref (GTK_WIDGET (window->new_content_view));
|
||||
}
|
||||
|
||||
nautilus_window_free_load_info (window);
|
||||
|
||||
nautilus_window_allow_stop (window, FALSE);
|
||||
}
|
||||
|
||||
free_location_change (window);
|
||||
|
||||
window->views_shown = FALSE;
|
||||
window->view_bombed_out = FALSE;
|
||||
window->view_activation_complete = FALSE;
|
||||
window->cv_progress_initial = FALSE;
|
||||
window->cv_progress_done = FALSE;
|
||||
window->cv_progress_error = FALSE;
|
||||
window->sent_update_view = FALSE;
|
||||
window->reset_to_idle = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
load_view_for_new_location (NautilusWindow *window)
|
||||
{
|
||||
|
@ -1415,7 +1434,7 @@ nautilus_window_set_sidebar_panels (NautilusWindow *window,
|
|||
(char *) nautilus_view_frame_get_iid (sidebar_panel),
|
||||
compare_view_identifier_with_iid);
|
||||
if (found_node == NULL) {
|
||||
nautilus_window_disconnect_view (window, sidebar_panel);
|
||||
disconnect_view (window, sidebar_panel);
|
||||
nautilus_window_remove_sidebar_panel (window, sidebar_panel);
|
||||
} else {
|
||||
identifier = (NautilusViewIdentifier *) found_node->data;
|
||||
|
@ -1722,8 +1741,8 @@ connect_view (NautilusWindow *window, NautilusViewFrame *view)
|
|||
#undef CONNECT
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_disconnect_view (NautilusWindow *window, NautilusViewFrame *view)
|
||||
static void
|
||||
disconnect_view (NautilusWindow *window, NautilusViewFrame *view)
|
||||
{
|
||||
GtkObject *view_object;
|
||||
|
||||
|
@ -1743,3 +1762,26 @@ nautilus_window_disconnect_view (NautilusWindow *window, NautilusViewFrame *view
|
|||
FOR_EACH_NAUTILUS_WINDOW_SIGNAL (DISCONNECT)
|
||||
#undef DISCONNECT
|
||||
}
|
||||
|
||||
static void
|
||||
disconnect_view_callback (gpointer list_item_data, gpointer callback_data)
|
||||
{
|
||||
disconnect_view (NAUTILUS_WINDOW (callback_data),
|
||||
NAUTILUS_VIEW_FRAME (list_item_data));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nautilus_window_manage_views_destroy (NautilusWindow *window)
|
||||
{
|
||||
free_location_change (window);
|
||||
|
||||
/* Disconnect view signals here so they don't trigger when
|
||||
* views are destroyed.
|
||||
*/
|
||||
g_list_foreach (window->sidebar_panels, disconnect_view_callback, window);
|
||||
disconnect_view (window, window->content_view);
|
||||
|
||||
/* Cancel callbacks. */
|
||||
cancel_viewed_file_changed_callback (window);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "nautilus-window.h"
|
||||
|
||||
void nautilus_window_manage_views_destroy (NautilusWindow *window);
|
||||
void nautilus_window_open_location (NautilusWindow *window,
|
||||
const char *location);
|
||||
void nautilus_window_open_location_in_new_window (NautilusWindow *window,
|
||||
|
@ -43,7 +44,5 @@ void nautilus_window_begin_location_change (NautilusWindow *wi
|
|||
const char *location,
|
||||
NautilusLocationChangeType type,
|
||||
guint distance);
|
||||
void nautilus_window_disconnect_view (NautilusWindow *window,
|
||||
NautilusViewFrame *view);
|
||||
|
||||
#endif /* NAUTILUS_WINDOW_MANAGE_VIEWS_H */
|
||||
|
|
|
@ -90,18 +90,19 @@
|
|||
|
||||
static GtkWindow *bookmarks_window = NULL;
|
||||
|
||||
static void append_bookmark_to_menu (NautilusWindow *window,
|
||||
NautilusBookmark *bookmark,
|
||||
const char *parent_path,
|
||||
guint index_in_parent,
|
||||
gboolean is_in_bookmarks_menu);
|
||||
static void append_dynamic_bookmarks (NautilusWindow *window);
|
||||
static NautilusBookmarkList *get_bookmark_list (void);
|
||||
static void refresh_go_menu (NautilusWindow *window);
|
||||
static void refresh_bookmarks_menu (NautilusWindow *window);
|
||||
static void schedule_refresh_go_menu (NautilusWindow *window);
|
||||
static void schedule_refresh_bookmarks_menu (NautilusWindow *window);
|
||||
static void edit_bookmarks (NautilusWindow *window);
|
||||
static void append_bookmark_to_menu (NautilusWindow *window,
|
||||
NautilusBookmark *bookmark,
|
||||
const char *parent_path,
|
||||
guint index_in_parent,
|
||||
gboolean is_in_bookmarks_menu);
|
||||
static void append_dynamic_bookmarks (NautilusWindow *window);
|
||||
static NautilusBookmarkList *get_bookmark_list (void);
|
||||
static void refresh_go_menu (NautilusWindow *window);
|
||||
static void refresh_bookmarks_menu (NautilusWindow *window);
|
||||
static void schedule_refresh_go_menu (NautilusWindow *window);
|
||||
static void schedule_refresh_bookmarks_menu (NautilusWindow *window);
|
||||
static void edit_bookmarks (NautilusWindow *window);
|
||||
static void add_bookmark_for_current_location (NautilusWindow *window);
|
||||
|
||||
/* User level things */
|
||||
static guint convert_verb_to_user_level (const char *verb);
|
||||
|
@ -474,7 +475,7 @@ bookmarks_menu_add_bookmark_callback (BonoboUIComponent *component,
|
|||
gpointer user_data,
|
||||
const char *verb)
|
||||
{
|
||||
nautilus_window_add_bookmark_for_current_location (NAUTILUS_WINDOW (user_data));
|
||||
add_bookmark_for_current_location (NAUTILUS_WINDOW (user_data));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1022,13 +1023,13 @@ nautilus_bookmarks_exiting (void)
|
|||
}
|
||||
|
||||
/**
|
||||
* nautilus_window_add_bookmark_for_current_location
|
||||
* add_bookmark_for_current_location
|
||||
*
|
||||
* Add a bookmark for the displayed location to the bookmarks menu.
|
||||
* Does nothing if there's already a bookmark for the displayed location.
|
||||
*/
|
||||
void
|
||||
nautilus_window_add_bookmark_for_current_location (NautilusWindow *window)
|
||||
static void
|
||||
add_bookmark_for_current_location (NautilusWindow *window)
|
||||
{
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (window));
|
||||
|
||||
|
|
|
@ -30,9 +30,8 @@
|
|||
#include "nautilus-window.h"
|
||||
#include <bonobo/bonobo-ui-component.h>
|
||||
#include <bonobo/bonobo-ui-container.h>
|
||||
#include <libnautilus-extensions/nautilus-undo-manager.h>
|
||||
|
||||
/* FIXME bugzilla.eazel.com 2575: Need to migrate window fields into here. */
|
||||
/* FIXME bugzilla.eazel.com 2575: Migrate more fields into here. */
|
||||
struct NautilusWindowDetails
|
||||
{
|
||||
/* Bonobo. */
|
||||
|
@ -78,41 +77,42 @@ struct NautilusWindowDetails
|
|||
#define NAUTILUS_WINDOW_DEFAULT_WIDTH 700
|
||||
#define NAUTILUS_WINDOW_DEFAULT_HEIGHT 550
|
||||
|
||||
void nautilus_window_set_status (NautilusWindow *window,
|
||||
const char *status);
|
||||
void nautilus_window_back_or_forward (NautilusWindow *window,
|
||||
gboolean back,
|
||||
guint distance);
|
||||
void nautilus_window_load_content_view_menu (NautilusWindow *window);
|
||||
void nautilus_window_synch_content_view_menu (NautilusWindow *window);
|
||||
void nautilus_send_history_list_changed (void);
|
||||
void nautilus_add_to_history_list (NautilusBookmark *bookmark);
|
||||
GList * nautilus_get_history_list (void);
|
||||
void nautilus_window_add_bookmark_for_current_location (NautilusWindow *window);
|
||||
void nautilus_window_initialize_menus (NautilusWindow *window);
|
||||
void nautilus_window_initialize_toolbars (NautilusWindow *window);
|
||||
void nautilus_window_go_back (NautilusWindow *window);
|
||||
void nautilus_window_go_forward (NautilusWindow *window);
|
||||
void nautilus_window_go_up (NautilusWindow *window);
|
||||
void nautilus_window_update_find_menu_item (NautilusWindow *window);
|
||||
void nautilus_window_toolbar_remove_theme_callback (NautilusWindow *window);
|
||||
NautilusUndoManager *nautilus_window_get_undo_manager (NautilusWindow *window);
|
||||
void nautilus_window_remove_bookmarks_menu_callback (NautilusWindow *window);
|
||||
void nautilus_window_remove_go_menu_callback (NautilusWindow *window);
|
||||
void nautilus_window_remove_bookmarks_menu_items (NautilusWindow *window);
|
||||
void nautilus_window_remove_go_menu_items (NautilusWindow *window);
|
||||
void nautilus_window_update_show_hide_menu_items (NautilusWindow *window);
|
||||
void nautilus_window_zoom_in (NautilusWindow *window);
|
||||
void nautilus_window_zoom_out (NautilusWindow *window);
|
||||
void nautilus_window_zoom_to_level (NautilusWindow *window,
|
||||
double level);
|
||||
void nautilus_window_zoom_to_fit (NautilusWindow *window);
|
||||
void nautilus_window_set_content_view_widget (NautilusWindow *window,
|
||||
NautilusViewFrame *content_view);
|
||||
void nautilus_window_add_sidebar_panel (NautilusWindow *window,
|
||||
NautilusViewFrame *sidebar_panel);
|
||||
void nautilus_window_remove_sidebar_panel (NautilusWindow *window,
|
||||
NautilusViewFrame *sidebar_panel);
|
||||
Bonobo_UIContainer nautilus_window_get_ui_container (NautilusWindow *window);
|
||||
void nautilus_window_set_status (NautilusWindow *window,
|
||||
const char *status);
|
||||
void nautilus_window_back_or_forward (NautilusWindow *window,
|
||||
gboolean back,
|
||||
guint distance);
|
||||
void nautilus_window_load_view_as_menu (NautilusWindow *window);
|
||||
void nautilus_window_synch_view_as_menu (NautilusWindow *window);
|
||||
void nautilus_window_initialize_menus (NautilusWindow *window);
|
||||
void nautilus_window_initialize_toolbars (NautilusWindow *window);
|
||||
void nautilus_window_go_back (NautilusWindow *window);
|
||||
void nautilus_window_go_forward (NautilusWindow *window);
|
||||
void nautilus_window_go_up (NautilusWindow *window);
|
||||
void nautilus_window_update_find_menu_item (NautilusWindow *window);
|
||||
void nautilus_window_toolbar_remove_theme_callback (NautilusWindow *window);
|
||||
void nautilus_window_remove_bookmarks_menu_callback (NautilusWindow *window);
|
||||
void nautilus_window_remove_go_menu_callback (NautilusWindow *window);
|
||||
void nautilus_window_remove_bookmarks_menu_items (NautilusWindow *window);
|
||||
void nautilus_window_remove_go_menu_items (NautilusWindow *window);
|
||||
void nautilus_window_update_show_hide_menu_items (NautilusWindow *window);
|
||||
void nautilus_window_zoom_in (NautilusWindow *window);
|
||||
void nautilus_window_zoom_out (NautilusWindow *window);
|
||||
void nautilus_window_zoom_to_level (NautilusWindow *window,
|
||||
double level);
|
||||
void nautilus_window_zoom_to_fit (NautilusWindow *window);
|
||||
void nautilus_window_set_content_view_widget (NautilusWindow *window,
|
||||
NautilusViewFrame *content_view);
|
||||
void nautilus_window_add_sidebar_panel (NautilusWindow *window,
|
||||
NautilusViewFrame *sidebar_panel);
|
||||
void nautilus_window_remove_sidebar_panel (NautilusWindow *window,
|
||||
NautilusViewFrame *sidebar_panel);
|
||||
Bonobo_UIContainer nautilus_window_get_ui_container (NautilusWindow *window);
|
||||
void nautilus_window_set_viewed_file (NautilusWindow *window,
|
||||
NautilusFile *file);
|
||||
|
||||
void nautilus_send_history_list_changed (void);
|
||||
void nautilus_add_to_history_list (NautilusBookmark *bookmark);
|
||||
GList * nautilus_get_history_list (void);
|
||||
|
||||
#endif /* NAUTILUS_WINDOW_PRIVATE_H */
|
||||
|
|
|
@ -103,26 +103,24 @@ enum {
|
|||
ARG_APP
|
||||
};
|
||||
|
||||
/* Other static variables */
|
||||
static GList *history_list = NULL;
|
||||
|
||||
static void nautilus_window_initialize_class (NautilusWindowClass *klass);
|
||||
static void nautilus_window_initialize (NautilusWindow *window);
|
||||
static void nautilus_window_destroy (GtkObject *object);
|
||||
static void nautilus_window_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void nautilus_window_realize (GtkWidget *widget);
|
||||
static void update_sidebar_panels_from_preferences (NautilusWindow *window);
|
||||
static void sidebar_panels_changed_callback (gpointer user_data);
|
||||
static void nautilus_window_show (GtkWidget *widget);
|
||||
static void nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
||||
gpointer callback_data);
|
||||
static void nautilus_window_initialize_class (NautilusWindowClass *klass);
|
||||
static void nautilus_window_initialize (NautilusWindow *window);
|
||||
static void nautilus_window_destroy (GtkObject *object);
|
||||
static void nautilus_window_set_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_get_arg (GtkObject *object,
|
||||
GtkArg *arg,
|
||||
guint arg_id);
|
||||
static void nautilus_window_size_request (GtkWidget *widget,
|
||||
GtkRequisition *requisition);
|
||||
static void nautilus_window_realize (GtkWidget *widget);
|
||||
static void update_sidebar_panels_from_preferences (NautilusWindow *window);
|
||||
static void sidebar_panels_changed_callback (gpointer user_data);
|
||||
static void nautilus_window_show (GtkWidget *widget);
|
||||
static void cancel_view_as_callback (NautilusWindow *window);
|
||||
|
||||
NAUTILUS_DEFINE_CLASS_BOILERPLATE (NautilusWindow,
|
||||
nautilus_window,
|
||||
|
@ -447,10 +445,14 @@ nautilus_window_constructed (NautilusWindow *window)
|
|||
* It gets shown later, if the view-frame contains something zoomable.
|
||||
*/
|
||||
window->zoom_control = nautilus_zoom_control_new ();
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_in", nautilus_window_zoom_in, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_out", nautilus_window_zoom_out, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_level", nautilus_window_zoom_to_level, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_fit", nautilus_window_zoom_to_fit, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_in",
|
||||
nautilus_window_zoom_in, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_out",
|
||||
nautilus_window_zoom_out, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_level",
|
||||
nautilus_window_zoom_to_level, GTK_OBJECT (window));
|
||||
gtk_signal_connect_object (GTK_OBJECT (window->zoom_control), "zoom_to_fit",
|
||||
nautilus_window_zoom_to_fit, GTK_OBJECT (window));
|
||||
gtk_box_pack_end (GTK_BOX (location_bar_box), window->zoom_control, FALSE, FALSE, 0);
|
||||
|
||||
gtk_widget_show (location_bar_box);
|
||||
|
@ -527,7 +529,7 @@ nautilus_window_constructed (NautilusWindow *window)
|
|||
|
||||
/* watch for throbber locatoin changes, too */
|
||||
gtk_signal_connect (GTK_OBJECT (window->throbber), "location_changed",
|
||||
goto_uri_callback, window);
|
||||
goto_uri_callback, window);
|
||||
|
||||
/* Set initial sensitivity of some buttons & menu items
|
||||
* now that they're all created.
|
||||
|
@ -589,16 +591,6 @@ nautilus_window_get_arg (GtkObject *object,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
view_disconnect (gpointer data, gpointer user_data)
|
||||
{
|
||||
g_assert (NAUTILUS_IS_WINDOW (user_data));
|
||||
g_assert (NAUTILUS_IS_VIEW_FRAME (data));
|
||||
|
||||
nautilus_window_disconnect_view (NAUTILUS_WINDOW (user_data),
|
||||
NAUTILUS_VIEW_FRAME (data));
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_destroy (GtkObject *object)
|
||||
{
|
||||
|
@ -606,39 +598,33 @@ nautilus_window_destroy (GtkObject *object)
|
|||
|
||||
window = NAUTILUS_WINDOW (object);
|
||||
|
||||
/* Let go of the UI. */
|
||||
/* Handle the part of destroy that's private to the view
|
||||
* management.
|
||||
*/
|
||||
nautilus_window_manage_views_destroy (window);
|
||||
|
||||
/* Get rid of all callbacks. */
|
||||
|
||||
cancel_view_as_callback (window);
|
||||
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SIDEBAR_PANELS_NAMESPACE,
|
||||
sidebar_panels_changed_callback,
|
||||
NULL);
|
||||
nautilus_window_remove_bookmarks_menu_callback (window);
|
||||
nautilus_window_remove_go_menu_callback (window);
|
||||
nautilus_window_toolbar_remove_theme_callback (window);
|
||||
|
||||
/* Get rid of all owned objects. */
|
||||
|
||||
if (window->details->shell_ui != NULL) {
|
||||
bonobo_ui_component_unset_container (window->details->shell_ui);
|
||||
bonobo_object_unref (BONOBO_OBJECT (window->details->shell_ui));
|
||||
}
|
||||
|
||||
/* Cancel the callback for the View As menu update, if any */
|
||||
nautilus_file_cancel_call_when_ready (window->details->viewed_file,
|
||||
nautilus_window_real_load_content_view_menu,
|
||||
window);
|
||||
|
||||
/* Let go of the file for the current location */
|
||||
nautilus_file_unref (window->details->viewed_file);
|
||||
|
||||
g_free (window->details->dead_view_name);
|
||||
|
||||
/* Dont keep track of sidebar panel changes no more */
|
||||
nautilus_preferences_remove_callback (NAUTILUS_PREFERENCES_SIDEBAR_PANELS_NAMESPACE,
|
||||
sidebar_panels_changed_callback,
|
||||
NULL);
|
||||
|
||||
nautilus_window_remove_bookmarks_menu_callback (window);
|
||||
nautilus_window_remove_go_menu_callback (window);
|
||||
nautilus_window_toolbar_remove_theme_callback (window);
|
||||
|
||||
/* Disconnect view signals here so they don't trigger when
|
||||
* views are destroyed normally.
|
||||
*/
|
||||
g_list_foreach (window->sidebar_panels, view_disconnect, window);
|
||||
g_list_free (window->sidebar_panels);
|
||||
|
||||
nautilus_window_disconnect_view (window, window->content_view);
|
||||
|
||||
nautilus_view_identifier_free (window->content_view_id);
|
||||
|
||||
g_free (window->location);
|
||||
|
@ -845,7 +831,7 @@ nautilus_window_size_request (GtkWidget *widget,
|
|||
*/
|
||||
|
||||
static void
|
||||
view_menu_switch_views_callback (GtkWidget *widget, gpointer data)
|
||||
view_as_menu_switch_views_callback (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
NautilusWindow *window;
|
||||
NautilusViewIdentifier *identifier;
|
||||
|
@ -861,7 +847,7 @@ view_menu_switch_views_callback (GtkWidget *widget, gpointer data)
|
|||
|
||||
/* Note: The identifier parameter ownership is handed off to the menu item. */
|
||||
static GtkWidget *
|
||||
create_content_view_menu_item (NautilusWindow *window, NautilusViewIdentifier *identifier)
|
||||
create_view_as_menu_item (NautilusWindow *window, NautilusViewIdentifier *identifier)
|
||||
{
|
||||
GtkWidget *menu_item;
|
||||
char *menu_label;
|
||||
|
@ -872,7 +858,7 @@ create_content_view_menu_item (NautilusWindow *window, NautilusViewIdentifier *i
|
|||
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item),
|
||||
"activate",
|
||||
view_menu_switch_views_callback,
|
||||
view_as_menu_switch_views_callback,
|
||||
NULL);
|
||||
|
||||
/* Store copy of iid in item; free when item destroyed. */
|
||||
|
@ -905,7 +891,7 @@ new_gtk_separator (void)
|
|||
* content view isn't already in the "View as" option menu.
|
||||
*/
|
||||
static void
|
||||
replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
||||
replace_special_current_view_in_view_as_menu (NautilusWindow *window)
|
||||
{
|
||||
GtkWidget *menu;
|
||||
GtkWidget *first_menu_item;
|
||||
|
@ -929,7 +915,7 @@ replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
|||
gtk_menu_prepend (GTK_MENU (menu), new_gtk_separator ());
|
||||
}
|
||||
|
||||
new_menu_item = create_content_view_menu_item (window, nautilus_view_identifier_copy (window->content_view_id));
|
||||
new_menu_item = create_view_as_menu_item (window, nautilus_view_identifier_copy (window->content_view_id));
|
||||
gtk_object_set_data (GTK_OBJECT (new_menu_item), "current content view", GINT_TO_POINTER (TRUE));
|
||||
gtk_menu_prepend (GTK_MENU (menu), new_menu_item);
|
||||
|
||||
|
@ -938,7 +924,7 @@ replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
|||
}
|
||||
|
||||
/**
|
||||
* nautilus_window_synch_content_view_menu:
|
||||
* nautilus_window_synch_view_as_menu:
|
||||
*
|
||||
* Set the visible item of the "View as" option menu to
|
||||
* match the current content view.
|
||||
|
@ -946,7 +932,7 @@ replace_special_current_view_in_content_view_menu (NautilusWindow *window)
|
|||
* @window: The NautilusWindow whose "View as" option menu should be synched.
|
||||
*/
|
||||
void
|
||||
nautilus_window_synch_content_view_menu (NautilusWindow *window)
|
||||
nautilus_window_synch_view_as_menu (NautilusWindow *window)
|
||||
{
|
||||
GList *children, *child;
|
||||
GtkWidget *menu;
|
||||
|
@ -972,7 +958,7 @@ nautilus_window_synch_content_view_menu (NautilusWindow *window)
|
|||
}
|
||||
|
||||
if (matching_index == -1) {
|
||||
replace_special_current_view_in_content_view_menu (window);
|
||||
replace_special_current_view_in_view_as_menu (window);
|
||||
matching_index = 0;
|
||||
}
|
||||
|
||||
|
@ -985,29 +971,34 @@ nautilus_window_synch_content_view_menu (NautilusWindow *window)
|
|||
static void
|
||||
chose_component_callback (NautilusViewIdentifier *identifier, gpointer callback_data)
|
||||
{
|
||||
/* Can't assume callback_data is a valid NautilusWindow, because
|
||||
* it might be garbage if the program is exiting when this dialog
|
||||
* is up.
|
||||
*/
|
||||
NautilusWindow *window;
|
||||
|
||||
window = NAUTILUS_WINDOW (callback_data);
|
||||
if (identifier != NULL) {
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (callback_data));
|
||||
nautilus_window_set_content_view (NAUTILUS_WINDOW (callback_data), identifier);
|
||||
nautilus_window_set_content_view (window, identifier);
|
||||
}
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1334:
|
||||
* There should be some global way to signal that the
|
||||
* file type associations have changed, so that the places that
|
||||
* display these lists can react. For now, hardwire this case, which
|
||||
* is the most obvious one by far.
|
||||
|
||||
/* FIXME bugzilla.eazel.com 1334: There should be some global
|
||||
* way to signal that the file type associations have changed,
|
||||
* so that the places that display these lists can react. For
|
||||
* now, hardwire this case, which is the most obvious one by
|
||||
* far.
|
||||
*/
|
||||
if (NAUTILUS_IS_WINDOW (callback_data)) {
|
||||
nautilus_window_load_content_view_menu (NAUTILUS_WINDOW (callback_data));
|
||||
nautilus_window_load_view_as_menu (window);
|
||||
}
|
||||
|
||||
static void
|
||||
cancel_chose_component_callback (NautilusWindow *window)
|
||||
{
|
||||
if (window->details->viewed_file != NULL) {
|
||||
nautilus_cancel_choose_component_for_file (window->details->viewed_file,
|
||||
chose_component_callback,
|
||||
window);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
view_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
||||
view_as_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
||||
{
|
||||
NautilusWindow *window;
|
||||
|
||||
|
@ -1016,14 +1007,18 @@ view_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
|||
|
||||
window = NAUTILUS_WINDOW (gtk_object_get_data (GTK_OBJECT (widget), "window"));
|
||||
|
||||
/* Set the option menu back to its previous setting (Don't leave it
|
||||
* on this dialog-producing "View as Other..." setting). If the menu choice
|
||||
* causes a content view change, this will be updated again later,
|
||||
* in nautilus_window_load_content_view_menu. Do this right away so
|
||||
* the user never sees the option menu set to "View as Other...".
|
||||
/* Set the option menu back to its previous setting (Don't
|
||||
* leave it on this dialog-producing "View as Other..."
|
||||
* setting). If the menu choice causes a content view change,
|
||||
* this will be updated again later, in
|
||||
* nautilus_window_load_view_as_menu. Do this right away so
|
||||
* the user never sees the option menu set to "View as
|
||||
* Other...".
|
||||
*/
|
||||
nautilus_window_synch_content_view_menu (window);
|
||||
nautilus_window_synch_view_as_menu (window);
|
||||
|
||||
/* Call back when the user chose the component. */
|
||||
cancel_chose_component_callback (window);
|
||||
nautilus_choose_component_for_file (window->details->viewed_file,
|
||||
GTK_WINDOW (window),
|
||||
chose_component_callback,
|
||||
|
@ -1031,28 +1026,30 @@ view_menu_choose_view_callback (GtkWidget *widget, gpointer data)
|
|||
}
|
||||
|
||||
static void
|
||||
view_menu_vfs_method_callback (GtkWidget *widget, gpointer data)
|
||||
view_as_menu_vfs_method_callback (GtkWidget *widget, gpointer callback_data)
|
||||
{
|
||||
gpointer object_data;
|
||||
NautilusWindow *window;
|
||||
char *new_location;
|
||||
char *method;
|
||||
|
||||
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (gtk_object_get_data (GTK_OBJECT (widget), "window")));
|
||||
|
||||
window = NAUTILUS_WINDOW (gtk_object_get_data (GTK_OBJECT (widget), "window"));
|
||||
method = (char *) (gtk_object_get_data (GTK_OBJECT (widget), "method"));
|
||||
g_return_if_fail (method);
|
||||
|
||||
object_data = gtk_object_get_data (GTK_OBJECT (widget), "window");
|
||||
g_return_if_fail (NAUTILUS_IS_WINDOW (object_data));
|
||||
window = NAUTILUS_WINDOW (object_data);
|
||||
|
||||
method = (char *) gtk_object_get_data (GTK_OBJECT (widget), "method");
|
||||
g_return_if_fail (method != NULL);
|
||||
|
||||
new_location = g_strdup_printf ("%s#%s:/",window->location,method);
|
||||
nautilus_window_goto_uri (window, new_location);
|
||||
g_free (new_location);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
||||
gpointer callback_data)
|
||||
load_view_as_menu_callback (NautilusFile *file,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GList *components;
|
||||
char *method;
|
||||
|
@ -1071,7 +1068,7 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
/* Add a menu item for each view in the preferred list for this location. */
|
||||
components = nautilus_mime_get_short_list_components_for_file (window->details->viewed_file);
|
||||
for (p = components; p != NULL; p = p->next) {
|
||||
menu_item = create_content_view_menu_item
|
||||
menu_item = create_view_as_menu_item
|
||||
(window, nautilus_view_identifier_new_from_content_view (p->data));
|
||||
gtk_menu_append (GTK_MENU (new_menu), menu_item);
|
||||
}
|
||||
|
@ -1082,10 +1079,11 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
* one way trip if you choose one of these view menu items, but
|
||||
* it's better than nothing.
|
||||
*/
|
||||
method = nautilus_mime_get_short_list_methods_for_file (window->details->viewed_file);
|
||||
/* FIXME bugzilla.eazel.com 2466: Name of the function is plural, but it returns only
|
||||
* one item. That must be fixed.
|
||||
/* FIXME bugzilla.eazel.com 2466: The name of the following
|
||||
* function is plural, but it returns only one item. That must
|
||||
* be fixed.
|
||||
*/
|
||||
method = nautilus_mime_get_short_list_methods_for_file (window->details->viewed_file);
|
||||
if (method != NULL) {
|
||||
label = g_strdup_printf (_("View as %s..."), method);
|
||||
menu_item = gtk_menu_item_new_with_label (label);
|
||||
|
@ -1096,7 +1094,7 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
g_strdup (method), g_free);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item),
|
||||
"activate",
|
||||
view_menu_vfs_method_callback,
|
||||
view_as_menu_vfs_method_callback,
|
||||
NULL);
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_append (GTK_MENU (new_menu), menu_item);
|
||||
|
@ -1113,7 +1111,7 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
gtk_object_set_data (GTK_OBJECT (menu_item), "window", window);
|
||||
gtk_signal_connect (GTK_OBJECT (menu_item),
|
||||
"activate",
|
||||
view_menu_choose_view_callback,
|
||||
view_as_menu_choose_view_callback,
|
||||
NULL);
|
||||
gtk_widget_show (menu_item);
|
||||
gtk_menu_append (GTK_MENU (new_menu), menu_item);
|
||||
|
@ -1124,12 +1122,19 @@ nautilus_window_real_load_content_view_menu (NautilusFile *file,
|
|||
gtk_option_menu_set_menu (GTK_OPTION_MENU (window->view_as_option_menu),
|
||||
new_menu);
|
||||
|
||||
nautilus_window_synch_view_as_menu (window);
|
||||
}
|
||||
|
||||
nautilus_window_synch_content_view_menu (window);
|
||||
static void
|
||||
cancel_view_as_callback (NautilusWindow *window)
|
||||
{
|
||||
nautilus_file_cancel_call_when_ready (window->details->viewed_file,
|
||||
load_view_as_menu_callback,
|
||||
window);
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_load_content_view_menu (NautilusWindow *window)
|
||||
nautilus_window_load_view_as_menu (NautilusWindow *window)
|
||||
{
|
||||
GList *attributes;
|
||||
|
||||
|
@ -1137,9 +1142,11 @@ nautilus_window_load_content_view_menu (NautilusWindow *window)
|
|||
|
||||
attributes = nautilus_mime_actions_get_full_file_attributes ();
|
||||
|
||||
/* FIXME: need to cancel this when appropriate... */
|
||||
nautilus_file_call_when_ready (window->details->viewed_file, attributes,
|
||||
nautilus_window_real_load_content_view_menu, window);
|
||||
cancel_view_as_callback (window);
|
||||
nautilus_file_call_when_ready (window->details->viewed_file,
|
||||
attributes,
|
||||
load_view_as_menu_callback,
|
||||
window);
|
||||
|
||||
g_list_free (attributes);
|
||||
}
|
||||
|
@ -1751,3 +1758,18 @@ nautilus_window_get_ui_container (NautilusWindow *window)
|
|||
|
||||
return bonobo_object_corba_objref (BONOBO_OBJECT (window->details->ui_container));
|
||||
}
|
||||
|
||||
void
|
||||
nautilus_window_set_viewed_file (NautilusWindow *window,
|
||||
NautilusFile *file)
|
||||
{
|
||||
if (window->details->viewed_file == file) {
|
||||
return;
|
||||
}
|
||||
|
||||
nautilus_file_ref (file);
|
||||
cancel_view_as_callback (window);
|
||||
cancel_chose_component_callback (window);
|
||||
nautilus_file_unref (window->details->viewed_file);
|
||||
window->details->viewed_file = file;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue