Revision 3212

View differences:

libsylph/prefs_common.c
1 1
/*
2 2
 * LibSylph -- E-Mail client library
3
 * Copyright (C) 1999-2012 Hiroyuki Yamamoto
3
 * Copyright (C) 1999-2013 Hiroyuki Yamamoto
4 4
 *
5 5
 * This library is free software; you can redistribute it and/or
6 6
 * modify it under the terms of the GNU Lesser General Public
......
51 51
	 &prefs_common.enable_newmsg_notify_sound, P_BOOL},
52 52
	{"newmsg_notify_sound", NULL, &prefs_common.newmsg_notify_sound,
53 53
	 P_STRING},
54
	{"enable_newmsg_notify_window", "TRUE",
55
	 &prefs_common.enable_newmsg_notify_window, P_BOOL},
54 56

  
55 57
	{"inc_local", "FALSE", &prefs_common.inc_local, P_BOOL},
56 58
	{"filter_on_inc_local", "TRUE", &prefs_common.filter_on_inc, P_BOOL},
libsylph/prefs_common.h
1 1
/*
2 2
 * LibSylph -- E-Mail client library
3
 * Copyright (C) 1999-2012 Hiroyuki Yamamoto
3
 * Copyright (C) 1999-2013 Hiroyuki Yamamoto
4 4
 *
5 5
 * This library is free software; you can redistribute it and/or
6 6
 * modify it under the terms of the GNU Lesser General Public
......
341 341
	gboolean show_attach_tab;            /* Message - Attachment */
342 342
	gboolean show_attached_files_first;  /* Message - Attachment */
343 343
	gint attach_toolbutton_pos;          /* Message - Attachment */
344

  
345
	gboolean enable_newmsg_notify_window; /* Receive */
344 346
};
345 347

  
346 348
extern PrefsCommon prefs_common;
src/inc.c
207 207
	}
208 208

  
209 209
	if (new_messages > 0 && !block_notify) {
210
		gchar buf[1024];
211 210
		GString *str;
212 211
		gint c = 0;
213 212

  
......
233 232
		trayicon_set_tooltip(str->str);
234 233
		trayicon_set_notify(TRUE);
235 234

  
236
		g_snprintf(buf, sizeof(buf), _("Sylpheed: %d new messages"), new_messages);
237
		g_string_truncate(str, 0);
238
		if (result) {
239
			for (cur = result->msg_summaries; cur != NULL; cur = cur->next) {
240
				IncMsgSummary *summary = cur->data;
241
				gchar *markup;
235
		if (prefs_common.enable_newmsg_notify_window) {
236
			gchar buf[1024];
242 237

  
243
				if (str->len > 0)
244
					g_string_append_c(str, '\n');
245
				markup = g_markup_printf_escaped("<b>%s</b>  %s", summary->subject, summary->from);
246
				g_string_append(str, markup);
247
				g_free(markup);
238
			g_snprintf(buf, sizeof(buf), _("Sylpheed: %d new messages"), new_messages);
239
			g_string_truncate(str, 0);
240
			if (result) {
241
				for (cur = result->msg_summaries; cur != NULL; cur = cur->next) {
242
					IncMsgSummary *summary = cur->data;
243
					gchar *markup;
244

  
245
					if (str->len > 0)
246
						g_string_append_c(str, '\n');
247
					markup = g_markup_printf_escaped("<b>%s</b>  %s", summary->subject, summary->from);
248
					g_string_append(str, markup);
249
					g_free(markup);
250
				}
248 251
			}
252

  
253
			notification_window_create(buf, str->str, 5);
249 254
		}
250 255

  
251
		notification_window_create(buf, str->str, 5);
252

  
253 256
		g_string_free(str, TRUE);
254 257
	}
255 258

  
......
1591 1594
		    fltinfo->actions[FLT_ACTION_MARK_READ] == FALSE) {
1592 1595
			inc_session->new_msgs++;
1593 1596

  
1594
			if (inc_dialog->result && msginfo->subject && g_slist_length(inc_dialog->result->msg_summaries) < 5) {
1597
			if (inc_dialog->result &&
1598
			    msginfo->subject && msginfo->fromname &&
1599
			    g_slist_length(inc_dialog->result->msg_summaries) < 5) {
1595 1600
				IncMsgSummary *summary;
1596 1601
				summary = g_new(IncMsgSummary, 1);
1597 1602
				summary->subject = g_strdup(msginfo->subject);
src/prefs_common_dialog.c
1 1
/*
2 2
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3
 * Copyright (C) 1999-2012 Hiroyuki Yamamoto
3
 * Copyright (C) 1999-2013 Hiroyuki Yamamoto
4 4
 *
5 5
 * This program is free software; you can redistribute it and/or modify
6 6
 * it under the terms of the GNU General Public License as published by
......
68 68

  
69 69
	GtkWidget *checkbtn_chkonstartup;
70 70
	GtkWidget *checkbtn_scan_after_inc;
71

  
72
	GtkWidget *checkbtn_newmsg_notify_window;
71 73
#ifdef G_OS_WIN32
72 74
	GtkWidget *checkbtn_newmsg_sound;
73 75
	GtkWidget *entry_newmsg_sound;
......
323 325
	{"newmsg_notify_sound", &receive.entry_newmsg_sound,
324 326
	 prefs_set_data_from_entry, prefs_set_entry},
325 327
#endif
328
	{"enable_newmsg_notify_window", &receive.checkbtn_newmsg_notify_window,
329
	 prefs_set_data_from_toggle, prefs_set_toggle},
326 330

  
327 331
#ifndef G_OS_WIN32
328 332
	{"inc_local", &receive.checkbtn_local,
......
830 834
	GtkWidget *vbox1;
831 835
	GtkWidget *vbox2;
832 836
	GtkWidget *vbox3;
837
	GtkWidget *vbox4;
833 838
	GtkWidget *hbox;
834 839

  
835 840
	GtkWidget *hbox_autochk;
......
842 847
	GtkWidget *checkbtn_scan_after_inc;
843 848

  
844 849
	GtkWidget *frame_notify;
850
	GtkWidget *checkbtn_newmsg_notify_window;
845 851
	GtkWidget *checkbtn_newmsg_notify;
846 852
	GtkWidget *label_newmsg_notify;
847 853
	GtkWidget *entry_newmsg_notify;
......
911 917
	gtk_container_add (GTK_CONTAINER (frame_notify), vbox3);
912 918
	gtk_container_set_border_width (GTK_CONTAINER (vbox3), 8);
913 919

  
920
	vbox4 = gtk_vbox_new (FALSE, 0);
921
	gtk_widget_show (vbox4);
922
	gtk_box_pack_start (GTK_BOX (vbox3), vbox4, FALSE, FALSE, 0);
923

  
924
	PACK_CHECK_BUTTON
925
		(vbox4, checkbtn_newmsg_notify_window,
926
		 _("Show notification window when new messages arrive"));
927

  
914 928
#ifdef G_OS_WIN32
915 929
	PACK_CHECK_BUTTON
916
		(vbox3, checkbtn_newmsg_sound,
930
		(vbox4, checkbtn_newmsg_sound,
917 931
		 _("Play sound when new messages arrive"));
918 932

  
919 933
	hbox = gtk_hbox_new (FALSE, 8);
......
936 950
			 entry_newmsg_sound);
937 951

  
938 952
	SET_TOGGLE_SENSITIVITY (checkbtn_newmsg_sound, hbox);
939
#endif
940 953

  
941 954
	PACK_CHECK_BUTTON
942 955
		(vbox3, checkbtn_newmsg_notify,
943 956
		 _("Execute command when new messages arrive"));
957
#else
958
	PACK_CHECK_BUTTON
959
		(vbox4, checkbtn_newmsg_notify,
960
		 _("Execute command when new messages arrive"));
961
#endif
944 962

  
945 963
	hbox = gtk_hbox_new (FALSE, 8);
946 964
	gtk_widget_show (hbox);
......
998 1016
	receive.checkbtn_chkonstartup   = checkbtn_chkonstartup;
999 1017
	receive.checkbtn_scan_after_inc = checkbtn_scan_after_inc;
1000 1018

  
1019
	receive.checkbtn_newmsg_notify_window = checkbtn_newmsg_notify_window;
1001 1020
#ifdef G_OS_WIN32
1002 1021
	receive.checkbtn_newmsg_sound   = checkbtn_newmsg_sound;
1003 1022
	receive.entry_newmsg_sound      = entry_newmsg_sound;
ChangeLog
1 1
2013-02-08
2 2

  
3
	* libsylph/prefs_common.[ch]
4
	  src/prefs_common_dialog.c
5
	  src/inc.c: added option: 'Show notification window when new messages
6
	  arrive'
7

  
8
2013-02-08
9

  
3 10
	* src/inc.[ch]
4 11
	  src/notificationwindow.[ch]: implemented new message notification
5 12
	  popup window.

Also available in: Unified diff