diff options
author | Darin Adler <darin@src.gnome.org> | 2001-02-03 01:28:05 +0000 |
---|---|---|
committer | Darin Adler <darin@src.gnome.org> | 2001-02-03 01:28:05 +0000 |
commit | 0605af887027901f7ffbbda5361712ed0ae9d0e9 (patch) | |
tree | 35ab9c0e6dad43f23b156c6aa482f8a3b9cbc97b /src/nautilus-navigation-window.c | |
parent | cf9df316abcb262138c446c046a3e85477265dfd (diff) | |
download | nautilus-0605af887027901f7ffbbda5361712ed0ae9d0e9.tar.gz |
reviewed by: John Sullivan <sullivan@eazel.com>
Fixed bug 6163 (Need NautilusViewFrame ::
report_location_changed). This is re-adding a feature we also had
long ago, where a view reports a location change, but does not
want the location change to come back to it in the form of a
load_location call.
* src/nautilus-applicable-views.h:
* src/nautilus-applicable-views.c:
(get_view_result_from_gnome_vfs_result), (got_file_info_callback),
(got_minimum_file_info_callback),
(nautilus_determine_initial_view),
(nautilus_determine_initial_view_cancel): Changed this entire file
to have a much easier-to-understand API.
* src/nautilus-view-frame-private.h:
* src/nautilus-view-frame-corba.c: (free_location_plus_callback):
Change existing structure so it can be used for the location-change
case, which includes a title too.
(open_force_new_window): Use new structure.
(report_location_change): Implement new call.
(impl_Nautilus_ViewFrame_open_location_force_new_window): Use new
structure.
(impl_Nautilus_ViewFrame_report_location_change): Implement new
call.
* libnautilus/nautilus-view-component.idl: Add the new call.
* libnautilus/nautilus-view.h:
* libnautilus/nautilus-view.c:
(nautilus_view_report_location_change): Add the new call.
* src/nautilus-view-frame.h:
* src/nautilus-view-frame.c:
(nautilus_view_frame_initialize_class): Add new signal.
(nautilus_view_frame_report_location_change): Implement new call.
* src/nautilus-window-private.h:
* src/nautilus-window-manage-views.h:
* src/nautilus-window-manage-views.c: (update_for_new_location):
Got rid of obsolete assert. Also, no longer clear the selection.
The selection is set properly earlier, and clearing it at this
point serves no purpose.
(location_has_really_changed): Call free_location_change to share
more code. Also no reason to free "pending_ni" any more, because
we don't keep it around in the success case.
(load_new_location_in_one_view): New name.
(load_new_location_in_sidebar_panels): New name. Also take a
parameter of a view to skip.
(load_new_location_in_all_views): New function.
(set_to_pending_location_and_selection): New name, and removed
code to handle the case where there is no pending location, since
that doesn't happen. Also take a parameter of a view to skip. Also
broke out the guts into load_new_location_in_all_views.
(free_location_change): Free things by their new names. There's
also less to free now.
(cancel_location_change): Key off pending_location instead of
pending_ni. Also save code by using new function that skips a
view.
(determined_initial_view_callback): Changed name, and use new
interface. No longer need "end_reached" trick, because the new
interface handles that.
(begin_location_change): Made a static after moving all the
functions that use it in here. Also moved some of the reload
code out into nautilus_window_reload.
(report_location_change_callback): New function. Does all the
steps neede for a location change in place.
(nautilus_window_back_or_forward), (nautilus_window_reload): Moved
these two functions in here from nautilus-window.c so we could
make begin_location_change more private.
* src/nautilus-window.h:
* src/nautilus-window.c: (nautilus_window_go_to): Changed the name.
(nautilus_window_get_location): New function for callers that used
to get the location field directly.
(go_to_callback): Changed name.
* src/nautilus-desktop-window.c: (nautilus_desktop_window_new):
* src/nautilus-location-bar.c: (drag_data_received_callback):
* src/nautilus-shell.c: (open_window), (save_window_states),
(restore_window_states):
* src/nautilus-window-menus.c: (services_button_callback),
(help_menu_nautilus_manual_callback),
(help_menu_nautilus_license_callback),
(help_menu_nautilus_feedback_callback),
(activate_bookmark_in_menu_item):
* src/nautilus-window-service-ui.c: (goto_services_summary),
(goto_online_storage), (goto_software_catalog),
(goto_services_support):
* src/nautilus-window.c: (location_change_at_idle_callback),
(nautilus_window_constructed), (view_as_menu_vfs_method_callback),
(nautilus_window_go_web_search), (nautilus_window_go_home):
Use nautilus_go_to under its new name.
* src/nautilus-shell.c: (restore_window_states): Use
nautilus_istr_has_prefix instead of g_strncasecmp. Also did other
code cleanup.
* libnautilus-extensions/nautilus-gtk-extensions.h: Added a new
marshal function that I needed.
* libnautilus-extensions/nautilus-thumbnails.c: Added a FIXME.
* libnautilus-extensions/nautilus-view-identifier.h:
* libnautilus-extensions/nautilus-view-identifier.c:
(nautilus_view_identifier_copy),
(nautilus_view_identifier_compare): Use const.
* src/nautilus-application.c: (nautilus_application_startup): Only
check for root if we are actually running nautilus, not if we are
just killing off an existing copy.
(confirm_ok_to_run_as_root): Changed name of the function and
improved the wording of the message and button. Also added an
environment variable you can set to get rid of this. (Probably
should have been a preference instead, but I am officially being
lazy about this.)
Fixed bug that was revealed by the change in the loading sequence
I made. John didn't review this part:
* libnautilus-extensions/nautilus-directory-private.h:
* libnautilus-extensions/nautilus-directory-async.c:
(load_directory_state_destroy), (load_directory_done):
Separate out code to free the partly-done state so it can
be used in the cancel case.
(dequeue_pending_idle_callback): Ref the directory object
so that we won't get messed up if the callback destroys it.
(directory_load_cancel): Separated out the old part of
file_list_cancel so that we can cancel the idle part too
when we want to.
(file_list_cancel): Use the new calls to cancel the idle
part of directory loading.
(directory_load_done): Use directory_load_cancel instead of
file_list_cancel.
(nautilus_directory_stop_monitoring_file_list): Use
directory_load_cancel instead of file_list_cancel.
(nautilus_directory_async_state_changed): Added state variables to
protect cases where we re-enter this function.
Diffstat (limited to 'src/nautilus-navigation-window.c')
-rw-r--r-- | src/nautilus-navigation-window.c | 82 |
1 files changed, 32 insertions, 50 deletions
diff --git a/src/nautilus-navigation-window.c b/src/nautilus-navigation-window.c index 1a39eb185..f39dcc3aa 100644 --- a/src/nautilus-navigation-window.c +++ b/src/nautilus-navigation-window.c @@ -209,17 +209,25 @@ nautilus_window_set_status (NautilusWindow *window, const char *text) } void -nautilus_window_goto_uri (NautilusWindow *window, const char *uri) +nautilus_window_go_to (NautilusWindow *window, const char *uri) { nautilus_window_open_location (window, uri); } +char * +nautilus_window_get_location (NautilusWindow *window) +{ + g_return_val_if_fail (NAUTILUS_IS_WINDOW (window), NULL); + + return g_strdup (window->details->location); +} + static void -goto_uri_callback (GtkWidget *widget, - const char *uri, - GtkWidget *window) +go_to_callback (GtkWidget *widget, + const char *uri, + GtkWidget *window) { - nautilus_window_goto_uri (NAUTILUS_WINDOW (window), uri); + nautilus_window_go_to (NAUTILUS_WINDOW (window), uri); } static void @@ -404,7 +412,7 @@ location_change_at_idle_callback (gpointer callback_data) window->details->location_to_change_to_at_idle = NULL; window->details->location_change_at_idle_id = 0; - nautilus_window_goto_uri (window, location); + nautilus_window_go_to (window, location); g_free (location); return FALSE; @@ -473,7 +481,7 @@ nautilus_window_constructed (NautilusWindow *window) gtk_widget_show (GTK_WIDGET (window->navigation_bar)); gtk_signal_connect (GTK_OBJECT (window->navigation_bar), "location_changed", - goto_uri_callback, window); + go_to_callback, window); gtk_signal_connect (GTK_OBJECT (window->navigation_bar), "mode_changed", navigation_bar_mode_changed_callback, window); @@ -488,7 +496,7 @@ nautilus_window_constructed (NautilusWindow *window) gtk_widget_show (view_as_menu_vbox); gtk_box_pack_end (GTK_BOX (location_bar_box), view_as_menu_vbox, FALSE, FALSE, 0); - window->view_as_option_menu = gtk_option_menu_new(); + window->view_as_option_menu = gtk_option_menu_new (); gtk_box_pack_end (GTK_BOX (view_as_menu_vbox), window->view_as_option_menu, TRUE, FALSE, 0); gtk_widget_show (window->view_as_option_menu); @@ -538,7 +546,7 @@ nautilus_window_constructed (NautilusWindow *window) if (!NAUTILUS_IS_DESKTOP_WINDOW (window)) { gtk_widget_show (GTK_WIDGET (window->sidebar)); gtk_signal_connect (GTK_OBJECT (window->sidebar), "location_changed", - goto_uri_callback, window); + go_to_callback, window); e_paned_pack1 (E_PANED (window->content_hbox), GTK_WIDGET (window->sidebar), FALSE, FALSE); @@ -699,9 +707,9 @@ nautilus_window_destroy (GtkObject *object) nautilus_view_identifier_free (window->content_view_id); - g_free (window->location); - nautilus_g_list_free_deep (window->selection); - nautilus_g_list_free_deep (window->pending_selection); + g_free (window->details->location); + nautilus_g_list_free_deep (window->details->selection); + nautilus_g_list_free_deep (window->details->pending_selection); nautilus_window_clear_back_list (window); nautilus_window_clear_forward_list (window); @@ -994,7 +1002,8 @@ nautilus_window_synch_view_as_menu (NautilusWindow *window) content_view_iid = nautilus_view_frame_get_view_iid (window->content_view); for (child = children, index = 0; child != NULL; child = child->next, ++index) { - item_id = (NautilusViewIdentifier *) gtk_object_get_data (GTK_OBJECT (child->data), "identifier"); + item_id = (NautilusViewIdentifier *) gtk_object_get_data + (GTK_OBJECT (child->data), "identifier"); if (item_id != NULL && strcmp (content_view_iid, item_id->iid) == 0) { matching_index = index; break; @@ -1076,7 +1085,7 @@ view_as_menu_vfs_method_callback (GtkWidget *widget, gpointer callback_data) gpointer object_data; NautilusWindow *window; char *new_location; - char *method; + const char *method; g_return_if_fail (GTK_IS_MENU_ITEM (widget)); @@ -1084,11 +1093,11 @@ view_as_menu_vfs_method_callback (GtkWidget *widget, gpointer callback_data) g_return_if_fail (NAUTILUS_IS_WINDOW (object_data)); window = NAUTILUS_WINDOW (object_data); - method = (char *) gtk_object_get_data (GTK_OBJECT (widget), "method"); + method = (const 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); + new_location = g_strdup_printf ("%s#%s:/", window->details->location, method); + nautilus_window_go_to (window, new_location); g_free (new_location); } @@ -1229,25 +1238,6 @@ nautilus_window_remove_sidebar_panel (NautilusWindow *window, NautilusViewFrame } void -nautilus_window_back_or_forward (NautilusWindow *window, gboolean back, guint distance) -{ - GList *list; - char *uri; - - list = back ? window->back_list : window->forward_list; - g_assert (g_list_length (list) > distance); - - uri = nautilus_bookmark_get_uri (g_list_nth_data (list, distance)); - nautilus_window_begin_location_change - (window, - uri, - back ? NAUTILUS_LOCATION_CHANGE_BACK : NAUTILUS_LOCATION_CHANGE_FORWARD, - distance); - - g_free (uri); -} - -void nautilus_window_go_back (NautilusWindow *window) { nautilus_window_back_or_forward (window, TRUE, 0); @@ -1266,10 +1256,11 @@ nautilus_window_go_up (NautilusWindow *window) GnomeVFSURI *parent_uri; char *parent_uri_string; - if (window->location == NULL) + if (window->details->location == NULL) { return; + } - current_uri = gnome_vfs_uri_new (window->location); + current_uri = gnome_vfs_uri_new (window->details->location); parent_uri = gnome_vfs_uri_get_parent (current_uri); gnome_vfs_uri_unref (current_uri); @@ -1281,7 +1272,7 @@ nautilus_window_go_up (NautilusWindow *window) parent_uri_string = gnome_vfs_uri_to_string (parent_uri, GNOME_VFS_URI_HIDE_NONE); gnome_vfs_uri_unref (parent_uri); - nautilus_window_goto_uri (window, parent_uri_string); + nautilus_window_go_to (window, parent_uri_string); g_free (parent_uri_string); } @@ -1317,7 +1308,7 @@ nautilus_window_go_web_search (NautilusWindow *window) search_web_uri = nautilus_preferences_get (NAUTILUS_PREFERENCES_SEARCH_WEB_URI); g_assert (search_web_uri != NULL); - nautilus_window_goto_uri (window, search_web_uri); + nautilus_window_go_to (window, search_web_uri); g_free (search_web_uri); } @@ -1331,7 +1322,7 @@ nautilus_window_go_home (NautilusWindow *window) home_uri = nautilus_preferences_get (NAUTILUS_PREFERENCES_HOME_URI); g_assert (home_uri != NULL); - nautilus_window_goto_uri (window, home_uri); + nautilus_window_go_to (window, home_uri); g_free (home_uri); } @@ -1585,15 +1576,6 @@ nautilus_window_set_content_view_widget (NautilusWindow *window, window->content_view = new_view; } -/* reload the contents of the window */ -void -nautilus_window_reload (NautilusWindow *window) -{ - nautilus_window_begin_location_change - (window, window->location, - NAUTILUS_LOCATION_CHANGE_RELOAD, 0); -} - /** * update_sidebar_panels_from_preferences: * @window: A NautilusWindow |