diff options
author | jacob berkman <jacob@ximian.com> | 2001-06-26 04:30:42 +0800 |
---|---|---|
committer | Jacob Berkman <jberkman@src.gnome.org> | 2001-06-26 04:30:42 +0800 |
commit | 4d5ccfcb23509552645597c073fd0fa311701ded (patch) | |
tree | a790571c62af8d91671d5a905b737286e77ea416 /shell/e-shell-view.c | |
parent | b655dc216eaab23a6f2d2e9a278b4f5dd4fdfa3a (diff) | |
download | gsoc2013-evolution-4d5ccfcb23509552645597c073fd0fa311701ded.tar.gz gsoc2013-evolution-4d5ccfcb23509552645597c073fd0fa311701ded.tar.zst gsoc2013-evolution-4d5ccfcb23509552645597c073fd0fa311701ded.zip |
display a selected uri in a timeout rather than right away, so the UI
2001-06-25 jacob berkman <jacob@ximian.com>
* 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
Diffstat (limited to 'shell/e-shell-view.c')
-rw-r--r-- | shell/e-shell-view.c | 60 |
1 files changed, 57 insertions, 3 deletions
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)); |