aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2013-02-08 06:58:26 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2013-02-08 06:58:26 +0000
commit25f4e280ba5ed4126f72c18a78f0b2bde961d1bd (patch)
treeed0b4b7ebb293b497f6913da05d0286f5ba2cce5 /src
parent6224779aca608fd457f1cb0d24ff516afe72694d (diff)
added option: 'Show notification window when new messages arrive'
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3212 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/inc.c37
-rw-r--r--src/prefs_common_dialog.c25
2 files changed, 43 insertions, 19 deletions
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;