diff options
-rw-r--r-- | mail/ChangeLog | 15 | ||||
-rw-r--r-- | mail/mail-config-gui.c | 22 | ||||
-rw-r--r-- | mail/mail-config.c | 25 | ||||
-rw-r--r-- | mail/mail-config.glade | 52 | ||||
-rw-r--r-- | mail/mail-config.glade.h | 1 | ||||
-rw-r--r-- | mail/mail-config.h | 3 | ||||
-rw-r--r-- | 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 <rhult@hem.passagen.se> + + * 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 <peterw@helixcode.com> * 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? */ @@ -1914,15 +1915,23 @@ format_toggled (GtkWidget *widget, MailDialog *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, MailDialog *dialog) { 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 @@ <fill>False</fill> </child> </widget> + + <widget> + <class>GtkHBox</class> + <name>hbox7</name> + <homogeneous>False</homogeneous> + <spacing>0</spacing> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + + <widget> + <class>GtkLabel</class> + <name>labelTimeout</name> + <label>Mark message as seen [ms]: </label> + <justify>GTK_JUSTIFY_CENTER</justify> + <wrap>False</wrap> + <xalign>0.5</xalign> + <yalign>0.5</yalign> + <xpad>0</xpad> + <ypad>0</ypad> + <child> + <padding>0</padding> + <expand>False</expand> + <fill>False</fill> + </child> + </widget> + + <widget> + <class>GtkSpinButton</class> + <name>spinTimeout</name> + <can_focus>True</can_focus> + <climb_rate>1</climb_rate> + <digits>0</digits> + <numeric>True</numeric> + <update_policy>GTK_UPDATE_ALWAYS</update_policy> + <snap>False</snap> + <wrap>False</wrap> + <value>1500</value> + <lower>0</lower> + <upper>10000</upper> + <step>100</step> + <page>1000</page> + <page_size>1000</page_size> + <child> + <padding>0</padding> + <expand>True</expand> + <fill>True</fill> + </child> + </widget> + </widget> </widget> <widget> 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) |