From 95d63098be0ef98971969262d3df4c9ed692aa79 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Sun, 9 Jul 2000 02:20:57 +0000 Subject: Don't display the annoying "Cannot display..." view in the shell when an error occurs while opening a view. Instead, avoid moving the selection to it. Not the ideal solution, but a definite improvement. svn path=/trunk/; revision=3995 --- shell/ChangeLog | 6 ++++++ shell/e-shell-view.c | 48 +++++++++--------------------------------------- 2 files changed, 15 insertions(+), 39 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index 6f9d490190..ca0a178947 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,9 @@ +2000-07-08 Ettore Perazzoli + + * e-shell-view.c (e_shell_view_display_uri): Don't update the + current URI if there are problems creating a view for it. + (show_error): Remove. Not used anymore. + 2000-07-08 Ettore Perazzoli * e-shell-view-menu.c: Cleanup some unused menu items and added diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index ceea7ee97f..fc211e8727 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -34,6 +34,7 @@ #include "widgets/misc/e-clipped-label.h" #include "e-util/e-util.h" +#include "e-util/e-gui-utils.h" #include "e-shell-constants.h" #include "e-shell-folder-title-bar.h" @@ -632,31 +633,6 @@ set_current_notebook_page (EShellView *shell_view, bonobo_control_frame_control_activate (control_frame); } -static void -show_error (EShellView *shell_view, - const char *uri) -{ - EShellViewPrivate *priv; - GtkWidget *label; - GtkNotebook *notebook; - char *s; - - priv = shell_view->priv; - - s = g_strdup_printf (_("Cannot open location: %s"), uri); - label = e_clipped_label_new (s); - g_free (s); - - gtk_widget_show (label); - - notebook = GTK_NOTEBOOK (priv->notebook); - - gtk_notebook_remove_page (notebook, 0); - gtk_notebook_prepend_page (notebook, label, NULL); - - set_current_notebook_page (shell_view, 0); -} - /* Create a new view for @uri with @control. It assumes a view for @uri does not exist yet. */ static GtkWidget * get_control_for_uri (EShellView *shell_view, @@ -777,10 +753,8 @@ create_new_view_for_uri (EShellView *shell_view, priv = shell_view->priv; control = get_control_for_uri (shell_view, uri); - if (control == NULL) { - show_error (shell_view, uri); + if (control == NULL) return FALSE; - } gtk_widget_show (control); @@ -821,31 +795,27 @@ e_shell_view_display_uri (EShellView *shell_view, } retval = TRUE; + goto end; } - g_free (priv->uri); - priv->uri = g_strdup (uri); - if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) != 0) { - show_error (shell_view, uri); - return FALSE; + retval = FALSE; + goto end; } control = g_hash_table_lookup (priv->uri_to_control, uri); if (control != NULL) { g_assert (GTK_IS_WIDGET (control)); show_existing_view (shell_view, uri, control); - retval = TRUE; - goto end; - } - - if (! create_new_view_for_uri (shell_view, uri)) { - show_error (shell_view, uri); + } else if (! create_new_view_for_uri (shell_view, uri)) { retval = FALSE; goto end; } + g_free (priv->uri); + priv->uri = g_strdup (uri); + retval = TRUE; end: -- cgit v1.2.3