aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2002-10-01 04:02:36 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2002-10-01 04:02:36 +0800
commit44a1f8aeec2c3a49a5fab8e67cd583c39fe54c3f (patch)
treebedc80fa63602741377e4e8a9c5a56ec8ff62fe4 /widgets/misc
parent669f24d00da9504b2ba4be9446f49d3d5310f1c7 (diff)
downloadgsoc2013-evolution-44a1f8aeec2c3a49a5fab8e67cd583c39fe54c3f.tar
gsoc2013-evolution-44a1f8aeec2c3a49a5fab8e67cd583c39fe54c3f.tar.gz
gsoc2013-evolution-44a1f8aeec2c3a49a5fab8e67cd583c39fe54c3f.tar.bz2
gsoc2013-evolution-44a1f8aeec2c3a49a5fab8e67cd583c39fe54c3f.tar.lz
gsoc2013-evolution-44a1f8aeec2c3a49a5fab8e67cd583c39fe54c3f.tar.xz
gsoc2013-evolution-44a1f8aeec2c3a49a5fab8e67cd583c39fe54c3f.tar.zst
gsoc2013-evolution-44a1f8aeec2c3a49a5fab8e67cd583c39fe54c3f.zip
[Add a small delay to the switching of pages in the multi-config
dialog. This makes keyboard navigation slightly nicer, and also happens to fix mysterious bug #28931.] New constant SWITCH_PAGE_INTERVAL. New members set_page_timeout_id and set_page_timeout_page in EMultiConfigDialogPrivate. (init): Initialize new member variables. (table_cursor_change_callback): Set up a timeout instead of switching right away. (set_page_timeout_callback): Timeout function to switch page after a small delay. (impl_destroy): Remove a pending timeout. svn path=/trunk/; revision=18267
Diffstat (limited to 'widgets/misc')
-rw-r--r--widgets/misc/ChangeLog16
-rw-r--r--widgets/misc/e-multi-config-dialog.c50
2 files changed, 56 insertions, 10 deletions
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 617675e35c..88fcdff23c 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,3 +1,19 @@
+2002-09-30 Ettore Perazzoli <ettore@ximian.com>
+
+ [Add a small delay to the switching of pages in the multi-config
+ dialog. This makes keyboard navigation slightly nicer, and also
+ happens to fix mysterious bug #28931.]
+
+ * e-multi-config-dialog.c: New constant SWITCH_PAGE_INTERVAL. New
+ members set_page_timeout_id and set_page_timeout_page in
+ EMultiConfigDialogPrivate.
+ (init): Initialize new member variables.
+ (table_cursor_change_callback): Set up a timeout instead of
+ switching right away.
+ (set_page_timeout_callback): Timeout function to switch page after
+ a small delay.
+ (impl_destroy): Remove a pending timeout.
+
2002-09-27 Ettore Perazzoli <ettore@ximian.com>
* e-multi-config-dialog.c (create_page_container): Don't set up
diff --git a/widgets/misc/e-multi-config-dialog.c b/widgets/misc/e-multi-config-dialog.c
index 1a9ddc4a02..c34493d8bd 100644
--- a/widgets/misc/e-multi-config-dialog.c
+++ b/widgets/misc/e-multi-config-dialog.c
@@ -36,12 +36,12 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
-#define d(x)
-
#define PARENT_TYPE gnome_dialog_get_type ()
static GnomeDialogClass *parent_class = NULL;
+#define SWITCH_PAGE_INTERVAL 250
+
struct _EMultiConfigDialogPrivate {
@@ -53,6 +53,9 @@ struct _EMultiConfigDialogPrivate {
GtkWidget *notebook;
int num_unapplied;
+
+ int set_page_timeout_id;
+ int set_page_timeout_page;
};
@@ -147,6 +150,25 @@ page_changed_callback (EConfigPage *page,
update_buttons (dialog);
}
+/* Timeout for switching pages (so it's more comfortable navigating with the
+ keyboard). */
+
+static int
+set_page_timeout_callback (void *data)
+{
+ EMultiConfigDialog *multi_config_dialog;
+ EMultiConfigDialogPrivate *priv;
+
+ multi_config_dialog = E_MULTI_CONFIG_DIALOG (data);
+ priv = multi_config_dialog->priv;
+
+ gtk_notebook_set_page (GTK_NOTEBOOK (priv->notebook), priv->set_page_timeout_page);
+
+ priv->set_page_timeout_id = 0;
+ return FALSE;
+}
+
+
/* Button handling. */
@@ -200,7 +222,12 @@ table_cursor_change_callback (ETable *etable,
dialog = E_MULTI_CONFIG_DIALOG (data);
priv = dialog->priv;
- gtk_notebook_set_page (GTK_NOTEBOOK (priv->notebook), row);
+ if (priv->set_page_timeout_id == 0)
+ priv->set_page_timeout_id = g_timeout_add (SWITCH_PAGE_INTERVAL,
+ set_page_timeout_callback,
+ dialog);
+
+ priv->set_page_timeout_page = row;
}
@@ -215,6 +242,9 @@ impl_destroy (GtkObject *object)
dialog = E_MULTI_CONFIG_DIALOG (object);
priv = dialog->priv;
+ if (priv->set_page_timeout_id != 0)
+ g_source_remove (priv->set_page_timeout_id);
+
g_slist_free (priv->pages);
g_free (priv);
@@ -289,8 +319,6 @@ fill_in_pixbufs (EMultiConfigDialog *dialog, int row)
colors[1] = RGB_COLOR (canvas->style->bg [GTK_STATE_ACTIVE]);
colors[2] = RGB_COLOR (canvas->style->base [GTK_STATE_NORMAL]);
- d(g_print ("%x %x", colors[1], canvas->style->bg [GTK_STATE_ACTIVE].green));
-
for (i = 0; i < 3; i++) {
GdkPixbuf *pixbuf = gdk_pixbuf_composite_color_simple (original,
gdk_pixbuf_get_width (original),
@@ -399,11 +427,13 @@ init (EMultiConfigDialog *multi_config_dialog)
FALSE /* auto_shrink */);
priv = g_new (EMultiConfigDialogPrivate, 1);
- priv->pages = NULL;
- priv->list_e_table = list_e_table;
- priv->list_e_table_model = list_e_table_model;
- priv->notebook = notebook;
- priv->num_unapplied = 0;
+ priv->pages = NULL;
+ priv->list_e_table = list_e_table;
+ priv->list_e_table_model = list_e_table_model;
+ priv->notebook = notebook;
+ priv->num_unapplied = 0;
+ priv->set_page_timeout_id = 0;
+ priv->set_page_timeout_page = 0;
multi_config_dialog->priv = priv;
}