aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--libsylph/prefs_common.c4
-rw-r--r--libsylph/prefs_common.h4
-rw-r--r--src/inc.c37
-rw-r--r--src/prefs_common_dialog.c25
5 files changed, 56 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 8876ab6a..862fd598 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2013-02-08
+ * libsylph/prefs_common.[ch]
+ src/prefs_common_dialog.c
+ src/inc.c: added option: 'Show notification window when new messages
+ arrive'
+
+2013-02-08
+
* src/inc.[ch]
src/notificationwindow.[ch]: implemented new message notification
popup window.
diff --git a/libsylph/prefs_common.c b/libsylph/prefs_common.c
index 8652d9c9..46806d4e 100644
--- a/libsylph/prefs_common.c
+++ b/libsylph/prefs_common.c
@@ -1,6 +1,6 @@
/*
* LibSylph -- E-Mail client library
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2013 Hiroyuki Yamamoto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -51,6 +51,8 @@ static PrefParam param[] = {
&prefs_common.enable_newmsg_notify_sound, P_BOOL},
{"newmsg_notify_sound", NULL, &prefs_common.newmsg_notify_sound,
P_STRING},
+ {"enable_newmsg_notify_window", "TRUE",
+ &prefs_common.enable_newmsg_notify_window, P_BOOL},
{"inc_local", "FALSE", &prefs_common.inc_local, P_BOOL},
{"filter_on_inc_local", "TRUE", &prefs_common.filter_on_inc, P_BOOL},
diff --git a/libsylph/prefs_common.h b/libsylph/prefs_common.h
index ea31f6fd..471d95c8 100644
--- a/libsylph/prefs_common.h
+++ b/libsylph/prefs_common.h
@@ -1,6 +1,6 @@
/*
* LibSylph -- E-Mail client library
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2013 Hiroyuki Yamamoto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -341,6 +341,8 @@ struct _PrefsCommon
gboolean show_attach_tab; /* Message - Attachment */
gboolean show_attached_files_first; /* Message - Attachment */
gint attach_toolbutton_pos; /* Message - Attachment */
+
+ gboolean enable_newmsg_notify_window; /* Receive */
};
extern PrefsCommon prefs_common;
diff --git a/src/inc.c b/src/inc.c
index fe563df9..f90835d0 100644
--- a/src/inc.c
+++ b/src/inc.c
@@ -207,7 +207,6 @@ static void inc_finished(MainWindow *mainwin, IncResult *result)
}
if (new_messages > 0 && !block_notify) {
- gchar buf[1024];
GString *str;
gint c = 0;
@@ -233,22 +232,26 @@ static void inc_finished(MainWindow *mainwin, IncResult *result)
trayicon_set_tooltip(str->str);
trayicon_set_notify(TRUE);
- g_snprintf(buf, sizeof(buf), _("Sylpheed: %d new messages"), new_messages);
- g_string_truncate(str, 0);
- if (result) {
- for (cur = result->msg_summaries; cur != NULL; cur = cur->next) {
- IncMsgSummary *summary = cur->data;
- gchar *markup;
-
- if (str->len > 0)
- g_string_append_c(str, '\n');
- markup = g_markup_printf_escaped("<b>%s</b> %s", summary->subject, summary->from);
- g_string_append(str, markup);
- g_free(markup);
+ if (prefs_common.enable_newmsg_notify_window) {
+ gchar buf[1024];
+
+ g_snprintf(buf, sizeof(buf), _("Sylpheed: %d new messages"), new_messages);
+ g_string_truncate(str, 0);
+ if (result) {
+ for (cur = result->msg_summaries; cur != NULL; cur = cur->next) {
+ IncMsgSummary *summary = cur->data;
+ gchar *markup;
+
+ if (str->len > 0)
+ g_string_append_c(str, '\n');
+ markup = g_markup_printf_escaped("<b>%s</b> %s", summary->subject, summary->from);
+ g_string_append(str, markup);
+ g_free(markup);
+ }
}
- }
- notification_window_create(buf, str->str, 5);
+ notification_window_create(buf, str->str, 5);
+ }
g_string_free(str, TRUE);
}
@@ -1591,7 +1594,9 @@ static gint inc_drop_message(Pop3Session *session, const gchar *file)
fltinfo->actions[FLT_ACTION_MARK_READ] == FALSE) {
inc_session->new_msgs++;
- if (inc_dialog->result && msginfo->subject && g_slist_length(inc_dialog->result->msg_summaries) < 5) {
+ if (inc_dialog->result &&
+ msginfo->subject && msginfo->fromname &&
+ g_slist_length(inc_dialog->result->msg_summaries) < 5) {
IncMsgSummary *summary;
summary = g_new(IncMsgSummary, 1);
summary->subject = g_strdup(msginfo->subject);
diff --git a/src/prefs_common_dialog.c b/src/prefs_common_dialog.c
index 847a4fe6..d4c8d2bf 100644
--- a/src/prefs_common_dialog.c
+++ b/src/prefs_common_dialog.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2013 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -68,6 +68,8 @@ static struct Receive {
GtkWidget *checkbtn_chkonstartup;
GtkWidget *checkbtn_scan_after_inc;
+
+ GtkWidget *checkbtn_newmsg_notify_window;
#ifdef G_OS_WIN32
GtkWidget *checkbtn_newmsg_sound;
GtkWidget *entry_newmsg_sound;
@@ -323,6 +325,8 @@ static PrefsUIData ui_data[] = {
{"newmsg_notify_sound", &receive.entry_newmsg_sound,
prefs_set_data_from_entry, prefs_set_entry},
#endif
+ {"enable_newmsg_notify_window", &receive.checkbtn_newmsg_notify_window,
+ prefs_set_data_from_toggle, prefs_set_toggle},
#ifndef G_OS_WIN32
{"inc_local", &receive.checkbtn_local,
@@ -830,6 +834,7 @@ static void prefs_receive_create(void)
GtkWidget *vbox1;
GtkWidget *vbox2;
GtkWidget *vbox3;
+ GtkWidget *vbox4;
GtkWidget *hbox;
GtkWidget *hbox_autochk;
@@ -842,6 +847,7 @@ static void prefs_receive_create(void)
GtkWidget *checkbtn_scan_after_inc;
GtkWidget *frame_notify;
+ GtkWidget *checkbtn_newmsg_notify_window;
GtkWidget *checkbtn_newmsg_notify;
GtkWidget *label_newmsg_notify;
GtkWidget *entry_newmsg_notify;
@@ -911,9 +917,17 @@ static void prefs_receive_create(void)
gtk_container_add (GTK_CONTAINER (frame_notify), vbox3);
gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8);
+ vbox4 = gtk_vbox_new (FALSE, 0);
+ gtk_widget_show (vbox4);
+ gtk_box_pack_start (GTK_BOX (vbox3), vbox4, FALSE, FALSE, 0);
+
+ PACK_CHECK_BUTTON
+ (vbox4, checkbtn_newmsg_notify_window,
+ _("Show notification window when new messages arrive"));
+
#ifdef G_OS_WIN32
PACK_CHECK_BUTTON
- (vbox3, checkbtn_newmsg_sound,
+ (vbox4, checkbtn_newmsg_sound,
_("Play sound when new messages arrive"));
hbox = gtk_hbox_new (FALSE, 8);
@@ -936,11 +950,15 @@ static void prefs_receive_create(void)
entry_newmsg_sound);
SET_TOGGLE_SENSITIVITY (checkbtn_newmsg_sound, hbox);
-#endif
PACK_CHECK_BUTTON
(vbox3, checkbtn_newmsg_notify,
_("Execute command when new messages arrive"));
+#else
+ PACK_CHECK_BUTTON
+ (vbox4, checkbtn_newmsg_notify,
+ _("Execute command when new messages arrive"));
+#endif
hbox = gtk_hbox_new (FALSE, 8);
gtk_widget_show (hbox);
@@ -998,6 +1016,7 @@ static void prefs_receive_create(void)
receive.checkbtn_chkonstartup = checkbtn_chkonstartup;
receive.checkbtn_scan_after_inc = checkbtn_scan_after_inc;
+ receive.checkbtn_newmsg_notify_window = checkbtn_newmsg_notify_window;
#ifdef G_OS_WIN32
receive.checkbtn_newmsg_sound = checkbtn_newmsg_sound;
receive.entry_newmsg_sound = entry_newmsg_sound;