From 4d5ccfcb23509552645597c073fd0fa311701ded Mon Sep 17 00:00:00 2001 From: jacob berkman Date: Mon, 25 Jun 2001 20:30:42 +0000 Subject: display a selected uri in a timeout rather than right away, so the UI 2001-06-25 jacob berkman * e-shell-view.c: (set_folder_timeout): display a selected uri in a timeout rather than right away, so the UI feels a bit more responsive, and the tree is more navigable via keyboard (switch_on_folder_tree_click): use the timeout rather than setting the URI right away (destroy): remove the timeout if it still exists (update_for_current_uri): if there is a timeout set, don't update (e_shell_view_display_uri): remove the timeout if it exists svn path=/trunk/; revision=10490 --- shell/ChangeLog | 11 ++++++++++ shell/e-shell-view.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index 726e4ec8f7..2ec4e7d0dc 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,14 @@ +2001-06-25 jacob berkman + + * e-shell-view.c: (set_folder_timeout): display a selected uri in + a timeout rather than right away, so the UI feels a bit more + responsive, and the tree is more navigable via keyboard + (switch_on_folder_tree_click): use the timeout rather than setting + the URI right away + (destroy): remove the timeout if it still exists + (update_for_current_uri): if there is a timeout set, don't update + (e_shell_view_display_uri): remove the timeout if it exists + 2001-06-25 Ettore Perazzoli * main.c (no_views_left_cb): Call `e_shell_unregister_all()'. diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 8098eba211..8951c34926 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -83,6 +83,10 @@ struct _EShellViewPrivate { "folder_selected" */ char *delayed_selection; + /* uri to go to at timeout */ + unsigned int set_folder_timeout; + char *set_folder_uri; + /* Tooltips. */ GtkTooltips *tooltips; @@ -139,6 +143,8 @@ static guint signals[LAST_SIGNAL] = { 0 }; #define DEFAULT_URI "evolution:/local/Inbox" +#define SET_FOLDER_DELAY 250 + /* The icons for the offline/online status. */ @@ -396,6 +402,22 @@ pop_up_folder_bar (EShellView *shell_view) static void new_folder_cb (EStorageSet *storage_set, const char *path, void *data); +static int +set_folder_timeout (gpointer data) +{ + EShellView *shell_view; + EShellViewPrivate *priv; + + shell_view = E_SHELL_VIEW (data); + priv = shell_view->priv; + + /* set to 0 so we don't remove it in _display_uri() */ + priv->set_folder_timeout = 0; + e_shell_view_display_uri (shell_view, priv->set_folder_uri); + + return FALSE; +} + static void switch_on_folder_tree_click (EShellView *shell_view, const char *path) @@ -411,8 +433,9 @@ switch_on_folder_tree_click (EShellView *shell_view, return; } - e_shell_view_display_uri (shell_view, uri); - g_free (uri); + if (priv->set_folder_timeout != 0) + gtk_timeout_remove (priv->set_folder_timeout); + g_free (priv->set_folder_uri); if (priv->delayed_selection) { g_free (priv->delayed_selection); @@ -422,8 +445,16 @@ switch_on_folder_tree_click (EShellView *shell_view, shell_view); } - if (priv->folder_bar_mode == E_SHELL_VIEW_SUBWINDOW_TRANSIENT) + if (priv->folder_bar_mode == E_SHELL_VIEW_SUBWINDOW_TRANSIENT) { + e_shell_view_display_uri (shell_view, uri); popdown_transient_folder_bar (shell_view); + g_free (uri); + return; + } + + priv->set_folder_uri = uri; + + priv->set_folder_timeout = gtk_timeout_add (SET_FOLDER_DELAY, set_folder_timeout, shell_view); } @@ -880,6 +911,11 @@ destroy (GtkObject *object) g_free (priv->uri); + if (priv->set_folder_timeout != 0) + gtk_timeout_remove (priv->set_folder_timeout); + + g_free (priv->set_folder_uri); + g_free (priv); (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -976,6 +1012,9 @@ init (EShellView *shell_view) priv->sockets = NULL; + priv->set_folder_timeout = 0; + priv->set_folder_uri = NULL; + shell_view->priv = priv; } @@ -1315,6 +1354,13 @@ update_for_current_uri (EShellView *shell_view) priv = shell_view->priv; + /* if we update when there is a timeout set, the selection + * will jump around against the user's wishes. so we just + * return. + */ + if (priv->set_folder_timeout != 0) + return; + path = get_storage_set_path_from_uri (priv->uri); if (priv->uri != NULL && strcmp (priv->uri, "evolution:/My Evolution") == 0) { @@ -1806,6 +1852,14 @@ e_shell_view_display_uri (EShellView *shell_view, retval = TRUE; end: + g_free (priv->set_folder_uri); + priv->set_folder_uri = NULL; + + if (priv->set_folder_timeout != 0) { + gtk_timeout_remove (priv->set_folder_timeout); + priv->set_folder_timeout = 0; + } + update_for_current_uri (shell_view); bonobo_window_thaw (BONOBO_WINDOW (shell_view)); -- cgit v1.2.3