From fcb7d41216b32d39072eda0d47c17d5dccc482da Mon Sep 17 00:00:00 2001 From: Darin Adler Date: Thu, 30 Nov 2000 00:06:07 +0000 Subject: reviewed by: Pavel Cisler 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. --- src/nautilus-sidebar.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/nautilus-sidebar.c') diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c index 2e9d90f52..8317e4f43 100644 --- a/src/nautilus-sidebar.c +++ b/src/nautilus-sidebar.c @@ -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); -- cgit v1.2.1