aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-view.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2002-02-23 04:55:51 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2002-02-23 04:55:51 +0800
commit51b03dbcdfdc984834867a04792781ad8f073f65 (patch)
treee7a1d41940ae89408eaad53b9f6e40650ebf6b4c /shell/e-shell-view.c
parentd7ea6022c14604e845edef89e61c253804273cba (diff)
downloadgsoc2013-evolution-51b03dbcdfdc984834867a04792781ad8f073f65.tar
gsoc2013-evolution-51b03dbcdfdc984834867a04792781ad8f073f65.tar.gz
gsoc2013-evolution-51b03dbcdfdc984834867a04792781ad8f073f65.tar.bz2
gsoc2013-evolution-51b03dbcdfdc984834867a04792781ad8f073f65.tar.lz
gsoc2013-evolution-51b03dbcdfdc984834867a04792781ad8f073f65.tar.xz
gsoc2013-evolution-51b03dbcdfdc984834867a04792781ad8f073f65.tar.zst
gsoc2013-evolution-51b03dbcdfdc984834867a04792781ad8f073f65.zip
New helper function to remove all the matching URIs from the history.
* e-shell-view.c (remove_uri_from_history): New helper function to remove all the matching URIs from the history. (history_uri_matching_func): Compare function for using e_history_remove_matching. (storage_set_removed_folder_callback): Call `remove_uri_from_history()'. * e-history.c (e_history_remove_matching): New. svn path=/trunk/; revision=15803
Diffstat (limited to 'shell/e-shell-view.c')
-rw-r--r--shell/e-shell-view.c59
1 files changed, 46 insertions, 13 deletions
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 0df938d816..7d369a9037 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -316,6 +316,42 @@ setup_verb_sensitivity_for_folder (EShellView *shell_view,
bonobo_ui_component_set_prop (ui_component, "/commands/RenameFolder", "sensitive", prop, NULL);
}
+
+static void
+update_navigation_buttons (EShellView *shell_view)
+{
+ EShellViewPrivate *priv;
+
+ priv = shell_view->priv;
+
+ e_shell_folder_title_bar_update_navigation_buttons (E_SHELL_FOLDER_TITLE_BAR (priv->folder_title_bar),
+ e_history_has_prev (priv->history),
+ e_history_has_next (priv->history));
+}
+
+static int
+history_uri_matching_func (const void *a,
+ const void *b)
+{
+ const char *s1, *s2;
+
+ s1 = (const char *) a;
+ s2 = (const char *) b;
+
+ return strcmp (s1, s2);
+}
+
+static void
+remove_uri_from_history (EShellView *shell_view,
+ const char *uri)
+{
+ EShellViewPrivate *priv;
+
+ priv = shell_view->priv;
+
+ e_history_remove_matching (priv->history, uri, history_uri_matching_func);
+}
+
/* Callbacks for the EStorageSet. */
@@ -336,7 +372,16 @@ storage_set_removed_folder_callback (EStorageSet *storage_set,
priv = shell_view->priv;
uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
+
+ remove_uri_from_history (shell_view, uri);
+ update_navigation_buttons (shell_view);
+
+ /* (Note that at this point the current URI in the history might have
+ been changed and not match the current view. But we catch this case
+ when checking if this was the current view, below.) */
+
view = g_hash_table_lookup (priv->uri_to_view, uri);
+
g_free (uri);
if (view == NULL)
@@ -802,7 +847,7 @@ offline_toggle_clicked_cb (GtkButton *button,
}
-/* Handling of the navigation buttons. */
+/* Navigation button callbacks. */
static void
back_clicked_callback (EShellFolderTitleBar *title_bar,
@@ -842,18 +887,6 @@ forward_clicked_callback (EShellFolderTitleBar *title_bar,
display_uri (shell_view, new_uri, FALSE);
}
-static void
-update_navigation_buttons (EShellView *shell_view)
-{
- EShellViewPrivate *priv;
-
- priv = shell_view->priv;
-
- e_shell_folder_title_bar_update_navigation_buttons (priv->folder_title_bar,
- e_history_has_prev (priv->history),
- e_history_has_next (priv->history));
-}
-
/* Widget setup. */