From ac60e853cbee9c568b3cc066cbdadfdd7e0152c8 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Sun, 1 Jul 2001 18:30:11 +0000 Subject: Get the "Open in a New Window" shortcut right-click menu to actually work (I had removed a line by mistake), and fix a crash that would happen if user opened a new view, closed it and then created a new folder. svn path=/trunk/; revision=10657 --- shell/ChangeLog | 22 ++++++++++++++++++++++ shell/e-shell-view.c | 37 ++++++++++++++++++++++++++----------- shell/e-shortcuts-view.c | 2 +- 3 files changed, 49 insertions(+), 12 deletions(-) (limited to 'shell') diff --git a/shell/ChangeLog b/shell/ChangeLog index 396a50fa72..a7e079c1d0 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,25 @@ +2001-07-01 Ettore Perazzoli + + * e-shell-view.c: Fixing a bug that could cause Evolution to crash + if a new ShellView was created and then destroyed, and then a new + folder would appear in the folder tree. Sigh, this code with the + delayed_selection is pretty messed up, but at least this will add + some consistency to it and make it safe. + (cleanup_delayed_selection): New function to disconnect the + "new_folder_cb" callback if the `delayed_selection' is not NULL, + and also free the `delayed_selection' itself. + (new_folder_cb): Use it. + (destroy): Call it here, otherwise we might [a] leak [b] cause a + crash as soon as a new folder appears in the folder tree, as + "new_folder" gets emitted and our connected signal handler has no + EShellView to handle the signal on. + (e_shell_view_display_uri): Call it here before re-setting the + `delayed_selection'. + + * e-shortcuts-view.c (open_shortcut_in_new_window_cb): Add + invocation for `open_shortcut_helper()' back in [it was gone, for + unknown reasons]. + 2001-07-01 Ettore Perazzoli * e-storage-set-view.c (tree_drag_begin): If the node doesn't have diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index f7d40e5330..ae72420da6 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -159,6 +159,10 @@ static void update_for_current_uri (EShellView *shell_view); static void update_offline_toggle_status (EShellView *shell_view); static const char *get_storage_set_path_from_uri (const char *uri); + +/* Boo. */ +static void new_folder_cb (EStorageSet *storage_set, const char *path, void *data); + /* Utility functions. */ @@ -215,6 +219,22 @@ bonobo_widget_is_dead (BonoboWidget *bonobo_widget) return is_dead; } +static void +cleanup_delayed_selection (EShellView *shell_view) +{ + EShellViewPrivate *priv; + + priv = shell_view->priv; + + if (priv->delayed_selection != NULL) { + g_free (priv->delayed_selection); + priv->delayed_selection = NULL; + gtk_signal_disconnect_by_func (GTK_OBJECT (e_shell_get_storage_set (priv->shell)), + GTK_SIGNAL_FUNC (new_folder_cb), + shell_view); + } +} + /* Folder bar pop-up handling. */ @@ -400,8 +420,6 @@ pop_up_folder_bar (EShellView *shell_view) /* Switching views on a tree view click. */ -static void new_folder_cb (EStorageSet *storage_set, const char *path, void *data); - static int set_folder_timeout (gpointer data) { @@ -437,13 +455,7 @@ switch_on_folder_tree_click (EShellView *shell_view, gtk_timeout_remove (priv->set_folder_timeout); g_free (priv->set_folder_uri); - if (priv->delayed_selection) { - g_free (priv->delayed_selection); - priv->delayed_selection = NULL; - gtk_signal_disconnect_by_func (GTK_OBJECT (e_shell_get_storage_set (priv->shell)), - GTK_SIGNAL_FUNC (new_folder_cb), - shell_view); - } + cleanup_delayed_selection (shell_view); if (priv->folder_bar_mode == E_SHELL_VIEW_SUBWINDOW_TRANSIENT) { e_shell_view_display_uri (shell_view, uri); @@ -482,8 +494,8 @@ new_folder_cb (EStorageSet *storage_set, GTK_SIGNAL_FUNC (new_folder_cb), shell_view); g_free (priv->uri); - priv->uri = priv->delayed_selection; - priv->delayed_selection = NULL; + priv->uri = g_strdup (priv->delayed_selection); + cleanup_delayed_selection (shell_view); e_shell_view_display_uri (shell_view, priv->uri); } } @@ -915,6 +927,8 @@ destroy (GtkObject *object) g_free (priv->uri); + cleanup_delayed_selection (shell_view); + if (priv->set_folder_timeout != 0) gtk_timeout_remove (priv->set_folder_timeout); @@ -1847,6 +1861,7 @@ e_shell_view_display_uri (EShellView *shell_view, g_assert (GTK_IS_WIDGET (control)); show_existing_view (shell_view, uri, control); } else if (create_new_view_for_uri (shell_view, uri)) { + cleanup_delayed_selection (shell_view); priv->delayed_selection = g_strdup (uri); gtk_signal_connect_after (GTK_OBJECT (e_shell_get_storage_set (priv->shell)), "new_folder", GTK_SIGNAL_FUNC (new_folder_cb), shell_view); diff --git a/shell/e-shortcuts-view.c b/shell/e-shortcuts-view.c index de30fdba1c..32aa46fa56 100644 --- a/shell/e-shortcuts-view.c +++ b/shell/e-shortcuts-view.c @@ -408,7 +408,7 @@ static void open_shortcut_in_new_window_cb (GtkWidget *widget, void *data) { - + open_shortcut_helper ((ShortcutRightClickMenuData *) data, TRUE); } -- cgit v1.2.3