From 1cd648f355688ad788a81b832e8e7e7ad1aa6d1a Mon Sep 17 00:00:00 2001 From: Richard Hult Date: Wed, 16 Aug 2000 22:56:34 +0000 Subject: Use a configurable timeout. 2000-08-16 Richard Hult * mail-ops.c (cleanup_display_message): Use a configurable timeout. * mail-config.c (mail_config_set_mark_as_seen_timeout): New function for the settable mark-as-seen timeout. (mail_config_mark_as_seen_timeout): Likewise. (mail_config_write): Write the timeout setting. (config_read): Read timeout setting. * mail-config-gui.c (mail_config): Add option for the settable mark-as-seen timeout. (mail_config_apply_clicked): Likewise. (timeout_changed): New function for the timeout setting. svn path=/trunk/; revision=4859 --- mail/ChangeLog | 15 ++++++++++++++ mail/mail-config-gui.c | 22 ++++++++++++++++++++ mail/mail-config.c | 25 +++++++++++++++++++++++ mail/mail-config.glade | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ mail/mail-config.glade.h | 1 + mail/mail-config.h | 3 ++- mail/mail-ops.c | 12 +++++++++-- 7 files changed, 127 insertions(+), 3 deletions(-) diff --git a/mail/ChangeLog b/mail/ChangeLog index 88bbb72541..efa7669577 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,18 @@ +2000-08-16 Richard Hult + + * mail-ops.c (cleanup_display_message): Use a configurable timeout. + + * mail-config.c (mail_config_set_mark_as_seen_timeout): New function + for the settable mark-as-seen timeout. + (mail_config_mark_as_seen_timeout): Likewise. + (mail_config_write): Write the timeout setting. + (config_read): Read timeout setting. + + * mail-config-gui.c (mail_config): Add option for the settable + mark-as-seen timeout. + (mail_config_apply_clicked): Likewise. + (timeout_changed): New function for the timeout setting. + 2000-08-16 Peter Williams * message-thread.c (walk_containers): More (default disabled) diff --git a/mail/mail-config-gui.c b/mail/mail-config-gui.c index ea8a8d64e2..7e4c090971 100644 --- a/mail/mail-config-gui.c +++ b/mail/mail-config-gui.c @@ -169,6 +169,7 @@ typedef struct MailDialogTransportPage *page; gboolean tpagedone; GtkWidget *chkFormat; + GtkWidget *spinTimeout; } MailDialog; /* private prototypes - these are ugly, rename some of them? */ @@ -1913,6 +1914,12 @@ format_toggled (GtkWidget *widget, MailDialog *dialog) gnome_property_box_changed (GNOME_PROPERTY_BOX (dialog->dialog)); } +static void +timeout_changed (GtkWidget *widget, MailDialog *dialog) +{ + gnome_property_box_changed (GNOME_PROPERTY_BOX (dialog->dialog)); +} + static void mail_config_apply_clicked (GnomePropertyBox *property_box, gint page_num, @@ -1920,9 +1927,11 @@ mail_config_apply_clicked (GnomePropertyBox *property_box, { GtkCList *clist; GtkToggleButton *chk; + GtkSpinButton *spin; MailConfigService *t; gboolean send_html; gpointer data; + glong seen_timeout; int i; if (page_num != -1) @@ -1963,6 +1972,11 @@ mail_config_apply_clicked (GnomePropertyBox *property_box, send_html = gtk_toggle_button_get_active (chk); mail_config_set_send_html (send_html); + /* Mark as seen timeout */ + spin = GTK_SPIN_BUTTON (dialog->spinTimeout); + seen_timeout = gtk_spin_button_get_value_as_int (spin); + mail_config_set_mark_as_seen_timeout (seen_timeout); + mail_config_write (); } @@ -2129,6 +2143,14 @@ mail_config (void) GTK_SIGNAL_FUNC (format_toggled), dialog); + dialog->spinTimeout = glade_xml_get_widget (gui, "spinTimeout"); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->spinTimeout), + mail_config_mark_as_seen_timeout ()); + + gtk_signal_connect (GTK_OBJECT (dialog->spinTimeout), "changed", + GTK_SIGNAL_FUNC (timeout_changed), + dialog); + /* Listen for apply signal */ gtk_signal_connect (GTK_OBJECT (dialog->dialog), "apply", GTK_SIGNAL_FUNC (mail_config_apply_clicked), diff --git a/mail/mail-config.c b/mail/mail-config.c index b2ab45e859..da9629488e 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -47,6 +47,7 @@ typedef struct gboolean thread_list; gint paned_size; gboolean send_html; + gint seen_timeout; } MailConfig; static const char GCONFPATH[] = "/apps/Evolution/Mail"; @@ -266,6 +267,12 @@ config_read (void) config->send_html = gnome_config_get_bool (str); g_free (str); + /* Mark as seen timeout */ + str = g_strdup_printf ("=%s/config/Mail=/Display/seen_timeout=1500", + evolution_dir); + config->seen_timeout = gnome_config_get_int (str); + g_free (str); + /* Show Messages Threaded */ str = g_strdup_printf ("=%s/config/Mail=/Display/thread_list", evolution_dir); @@ -369,6 +376,12 @@ mail_config_write (void) gnome_config_set_string (str, config->transport->url); g_free (str); + /* Mark as seen timeout */ + str = g_strdup_printf ("=%s/config/Mail=/Display/seen_timeout", + evolution_dir); + gnome_config_set_int (str, config->seen_timeout); + g_free (str); + /* Format */ str = g_strdup_printf ("=%s/config/Mail=/Format/send_html", evolution_dir); @@ -441,6 +454,18 @@ mail_config_set_send_html (gboolean send_html) config->send_html = send_html; } +gint +mail_config_mark_as_seen_timeout (void) +{ + return config->seen_timeout; +} + +void +mail_config_set_mark_as_seen_timeout (gint timeout) +{ + config->seen_timeout = timeout; +} + MailConfigIdentity * mail_config_get_default_identity (void) { diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 23f1c44ab5..f3f797a3b5 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -424,6 +424,58 @@ False + + + GtkHBox + hbox7 + False + 0 + + 0 + False + False + + + + GtkLabel + labelTimeout + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkSpinButton + spinTimeout + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + False + False + 1500 + 0 + 10000 + 100 + 1000 + 1000 + + 0 + True + True + + + diff --git a/mail/mail-config.glade.h b/mail/mail-config.glade.h index 566486fe49..f1daaa4cbc 100644 --- a/mail/mail-config.glade.h +++ b/mail/mail-config.glade.h @@ -24,4 +24,5 @@ gchar *s = N_("Edit"); gchar *s = N_("Delete"); gchar *s = N_("News Sources"); gchar *s = N_("Send messages in HTML format"); +gchar *s = N_("Mark message as seen [ms]: "); gchar *s = N_("Other"); diff --git a/mail/mail-config.h b/mail/mail-config.h index 8e5be8c42d..f716373dce 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -63,7 +63,8 @@ void mail_config_set_thread_list (gboolean value); void mail_config_set_paned_size (gint size); gboolean mail_config_send_html (void); void mail_config_set_send_html (gboolean send_html); - +gint mail_config_mark_as_seen_timeout (void); +void mail_config_set_mark_as_seen_timeout (gint timeout); /* Identity Accessor functions */ MailConfigIdentity *mail_config_get_default_identity (void); diff --git a/mail/mail-ops.c b/mail/mail-ops.c index ca3d208ded..1a3ff0efe3 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -1604,14 +1604,22 @@ cleanup_display_message (gpointer in_data, gpointer op_data, if (data->msg == NULL) { mail_display_set_message (md, NULL); } else { + gint timeout = mail_config_mark_as_seen_timeout (); + if (input->ml->seen_id) gtk_timeout_remove (input->ml->seen_id); mail_display_set_message (md, CAMEL_MEDIUM (data->msg)); camel_object_unref (CAMEL_OBJECT (data->msg)); - input->ml->seen_id = - gtk_timeout_add (1500, input->timeout, input->ml); + if (timeout > 0) { + input->ml->seen_id = gtk_timeout_add (timeout, + input->timeout, + input->ml); + } else { + input->ml->seen_id = 0; + input->timeout (input->ml); + } } if (input->uid) -- cgit