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
This commit is contained in:
@ -1,3 +1,14 @@
|
|||||||
|
2002-02-22 Ettore Perazzoli <ettore@ximian.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2002-02-22 Ettore Perazzoli <ettore@ximian.com>
|
2002-02-22 Ettore Perazzoli <ettore@ximian.com>
|
||||||
|
|
||||||
* e-shell-view.c (update_navigation_buttons): New.
|
* e-shell-view.c (update_navigation_buttons): New.
|
||||||
|
@ -234,5 +234,29 @@ e_history_add (EHistory *history,
|
|||||||
priv->current_item = priv->current_item->next;
|
priv->current_item = priv->current_item->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_history_remove_matching (EHistory *history,
|
||||||
|
const void *data,
|
||||||
|
GCompareFunc compare_func)
|
||||||
|
{
|
||||||
|
EHistoryPrivate *priv;
|
||||||
|
GList *p;
|
||||||
|
|
||||||
|
g_return_if_fail (history != NULL);
|
||||||
|
g_return_if_fail (E_IS_HISTORY (history));
|
||||||
|
g_return_if_fail (compare_func != NULL);
|
||||||
|
|
||||||
|
priv = history->priv;
|
||||||
|
|
||||||
|
for (p = priv->items; p != NULL; p = p->next) {
|
||||||
|
if ((* compare_func) (data, p->data) == 0) {
|
||||||
|
if (priv->items == priv->current_item)
|
||||||
|
priv->items = priv->current_item = g_list_remove_link (priv->items, p);
|
||||||
|
else
|
||||||
|
priv->items = g_list_remove_link (priv->items, p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
E_MAKE_TYPE (e_history, "EHistory", EHistory, class_init, init, GTK_TYPE_OBJECT)
|
E_MAKE_TYPE (e_history, "EHistory", EHistory, class_init, init, GTK_TYPE_OBJECT)
|
||||||
|
@ -77,6 +77,10 @@ void *e_history_get_current (EHistory *history);
|
|||||||
void e_history_add (EHistory *history,
|
void e_history_add (EHistory *history,
|
||||||
void *data);
|
void *data);
|
||||||
|
|
||||||
|
void e_history_remove_matching (EHistory *history,
|
||||||
|
const void *data,
|
||||||
|
GCompareFunc compare_func);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
@ -316,6 +316,42 @@ setup_verb_sensitivity_for_folder (EShellView *shell_view,
|
|||||||
bonobo_ui_component_set_prop (ui_component, "/commands/RenameFolder", "sensitive", prop, NULL);
|
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. */
|
/* Callbacks for the EStorageSet. */
|
||||||
|
|
||||||
@ -336,7 +372,16 @@ storage_set_removed_folder_callback (EStorageSet *storage_set,
|
|||||||
priv = shell_view->priv;
|
priv = shell_view->priv;
|
||||||
|
|
||||||
uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
|
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);
|
view = g_hash_table_lookup (priv->uri_to_view, uri);
|
||||||
|
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
|
|
||||||
if (view == NULL)
|
if (view == NULL)
|
||||||
@ -802,7 +847,7 @@ offline_toggle_clicked_cb (GtkButton *button,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Handling of the navigation buttons. */
|
/* Navigation button callbacks. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
back_clicked_callback (EShellFolderTitleBar *title_bar,
|
back_clicked_callback (EShellFolderTitleBar *title_bar,
|
||||||
@ -842,18 +887,6 @@ forward_clicked_callback (EShellFolderTitleBar *title_bar,
|
|||||||
display_uri (shell_view, new_uri, FALSE);
|
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. */
|
/* Widget setup. */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user