From 140b9c15b1233ae0b27e60cef1909488a2576da0 Mon Sep 17 00:00:00 2001 From: Darin Adler Date: Wed, 31 Jan 2001 19:43:13 +0000 Subject: reviewed by: Michael Engber Fix bug 6192 ("mapped before underway" warning when clicking on any sidebar tab). * src/nautilus-view-frame.c: (nautilus_view_frame_map): Remove inappropriate check of state, and replace it with a simple NULL check that handles the failed case. * libnautilus-extensions/nautilus-directory-background.c: (nautilus_file_background_is_set): Fixed backwards logic by removing an erroneous "!". * libnautilus-extensions/nautilus-icon-factory.c: Formatting tweaks. * src/file-manager/fm-directory-view.c: Formatting tweak. * src/nautilus-application.c: (nautilus_application_startup): Fixed comment. (check_for_and_run_as_super_user): Formatting tweak. --- src/file-manager/fm-directory-view.c | 3 ++- src/nautilus-application.c | 21 +++++++++++---------- src/nautilus-view-frame.c | 22 ++++++++-------------- 3 files changed, 21 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index 20c7cac09..fee47f6b4 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -3214,7 +3214,8 @@ real_update_menus (FMDirectoryView *view) background = fm_directory_view_get_background (view); nautilus_bonobo_set_sensitive (view->details->ui, FM_DIRECTORY_VIEW_COMMAND_RESET_BACKGROUND, - background && nautilus_file_background_is_set (background)); + background != NULL + && nautilus_file_background_is_set (background)); nautilus_bonobo_set_label_for_menu_item_and_command (view->details->ui, diff --git a/src/nautilus-application.c b/src/nautilus-application.c index 15dfe6507..f4fbea408 100644 --- a/src/nautilus-application.c +++ b/src/nautilus-application.c @@ -371,7 +371,7 @@ nautilus_application_startup (NautilusApplication *application, case OAF_REG_SUCCESS: /* We are registered with OAF and all is right with the world. */ case OAF_REG_ALREADY_ACTIVE: - /* Another copy of . */ + /* Another copy of nautilus already is running and registered. */ message = NULL; detailed_message = NULL; break; @@ -583,24 +583,25 @@ check_for_and_run_as_super_user (void) { GtkWidget *warning_dlg; gint result; + if (geteuid () != 0) { return TRUE; } - warning_dlg = gnome_message_box_new ( - _("You are running Nautilus as root.\n\n" - "As root, you can damage your system if you are not careful, and\n" - "Nautilus will not stop you from doing it."), - GNOME_MESSAGE_BOX_WARNING, - GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); - + warning_dlg = gnome_message_box_new + (_("You are running Nautilus as root.\n\n" + "As root, you can damage your system if you are not careful, and\n" + "Nautilus will not stop you from doing it."), + GNOME_MESSAGE_BOX_WARNING, + GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL, NULL); + result = gnome_dialog_run_and_close (GNOME_DIALOG (warning_dlg)); - + /* If they pressed cancel, quit the application */ if (result == 1) { return FALSE; } - + return TRUE; } diff --git a/src/nautilus-view-frame.c b/src/nautilus-view-frame.c index 062f757b2..6f8c5fc50 100644 --- a/src/nautilus-view-frame.c +++ b/src/nautilus-view-frame.c @@ -1195,7 +1195,12 @@ nautilus_view_frame_set_label (NautilusViewFrame *view, view->details->label = g_strdup (label); } -/* Calls activate on the underlying control frame. */ +/* Activate the underlying control frame whenever the view is mapped. + * This causes the view to merge its menu items, for example. For + * sidebar panels, it might be a little late to merge them at map + * time, especially since we don't unmerge them at unmap time (not + * until destroy time). + */ static void nautilus_view_frame_map (GtkWidget *view_as_widget) { @@ -1205,20 +1210,9 @@ nautilus_view_frame_map (GtkWidget *view_as_widget) NAUTILUS_CALL_PARENT_CLASS (GTK_WIDGET_CLASS, map, (view_as_widget)); - switch (view->details->state) { - case VIEW_FRAME_EMPTY: - case VIEW_FRAME_NO_LOCATION: - case VIEW_FRAME_WAITING: - g_warning ("a view frame was mapped before it was underway"); - break; - case VIEW_FRAME_FAILED: - return; - case VIEW_FRAME_UNDERWAY: - case VIEW_FRAME_LOADED: - break; + if (view->details->control_frame != NULL) { + bonobo_control_frame_control_activate (view->details->control_frame); } - - bonobo_control_frame_control_activate (view->details->control_frame); } static Nautilus_History * -- cgit v1.2.1