diff options
Diffstat (limited to 'widgets/misc/e-multi-config-dialog.c')
-rw-r--r-- | widgets/misc/e-multi-config-dialog.c | 50 |
1 files changed, 40 insertions, 10 deletions
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; } |