From bf166a12fba39baa7d17ffd40c2a32131f8689c5 Mon Sep 17 00:00:00 2001 From: hiro Date: Wed, 19 Mar 2014 08:33:29 +0000 Subject: made the display period of notification window configurable. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3355 ee746299-78ed-0310-b773-934348b2243d --- ChangeLog | 8 +++++++ NEWS | 3 ++- libsylph/prefs_common.c | 4 +++- libsylph/prefs_common.h | 4 +++- src/inc.c | 2 +- src/notificationwindow.c | 15 ++++++++----- src/prefs_common_dialog.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++- 7 files changed, 81 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f0730de..ece4e253 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2014-03-19 + + * libsylph/prefs_common.[ch] + src/inc.c + src/notificationwindow.c + src/prefs_common_dialog.c: made the display period of notification + window configurable. + 2014-03-19 * manual/ja/sylpheed.sgml: updated Japanese manual. diff --git a/NEWS b/NEWS index ffea3e20..4d3904eb 100644 --- a/NEWS +++ b/NEWS @@ -6,12 +6,13 @@ Changes of Sylpheed * SSL certificate hostname is validated now (#167). * The Japanese manual was modified so that IE correctly detect its character encoding. - * The rightmost column of folder view and summary view became easy to + * The rightmost column of folder view and summary view became easier to resize. * Appropriate columns of folder view, summary view, etc. are auto-expanded by window resize when using GTK+ 2.14 or later. * The initial setup dialog is now resizabe. * PGP encrypt-to-self feature was added. + * The display period of notification window became configurable. * 3.4.0beta7 (development) diff --git a/libsylph/prefs_common.c b/libsylph/prefs_common.c index d1917818..2d3184cc 100644 --- a/libsylph/prefs_common.c +++ b/libsylph/prefs_common.c @@ -1,6 +1,6 @@ /* * LibSylph -- E-Mail client library - * Copyright (C) 1999-2013 Hiroyuki Yamamoto + * Copyright (C) 1999-2014 Hiroyuki Yamamoto * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -53,6 +53,8 @@ static PrefParam param[] = { P_STRING}, {"enable_newmsg_notify_window", "TRUE", &prefs_common.enable_newmsg_notify_window, P_BOOL}, + {"notify_window_period", "10", + &prefs_common.notify_window_period, P_INT}, {"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 3fafae52..e9062eda 100644 --- a/libsylph/prefs_common.h +++ b/libsylph/prefs_common.h @@ -1,6 +1,6 @@ /* * LibSylph -- E-Mail client library - * Copyright (C) 1999-2013 Hiroyuki Yamamoto + * Copyright (C) 1999-2014 Hiroyuki Yamamoto * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -349,6 +349,8 @@ struct _PrefsCommon gboolean alt_prefer_html; /* Message */ gint save_file_type; + + gint notify_window_period; /* Receive */ }; extern PrefsCommon prefs_common; diff --git a/src/inc.c b/src/inc.c index 1fd0cb31..8f638668 100644 --- a/src/inc.c +++ b/src/inc.c @@ -250,7 +250,7 @@ static void inc_finished(MainWindow *mainwin, IncResult *result) } } - notification_window_open(buf, str->str, 5); + notification_window_open(buf, str->str, prefs_common.notify_window_period); } g_string_free(str, TRUE); diff --git a/src/notificationwindow.c b/src/notificationwindow.c index 018871cd..38681911 100644 --- a/src/notificationwindow.c +++ b/src/notificationwindow.c @@ -163,10 +163,10 @@ gint notification_window_open(const gchar *message, const gchar *submessage, if (y < 0) y = 0; gtk_window_move(GTK_WINDOW(window), x, y); - if (timeout == 0) - timeout = 1; - notify_window.notify_tag = g_timeout_add(timeout * 1000, - notify_timeout_cb, NULL); + if (timeout > 0) { + notify_window.notify_tag = g_timeout_add(timeout * 1000, + notify_timeout_cb, NULL); + } debug_print("notification window created\n"); @@ -280,8 +280,11 @@ static gboolean nwin_motion_notify(GtkWidget *widget, GdkEventMotion *event, notify_window.notify_event_count = 0; gtk_window_move(GTK_WINDOW(notify_window.window), notify_window.x, notify_window.y); - notify_window.notify_tag = g_timeout_add(notify_window.timeout * 1000, - notify_timeout_cb, NULL); + if (notify_window.timeout > 0) { + notify_window.notify_tag = + g_timeout_add(notify_window.timeout * 1000, + notify_timeout_cb, NULL); + } return FALSE; } diff --git a/src/prefs_common_dialog.c b/src/prefs_common_dialog.c index 598c6393..4a7bdbe7 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-2013 Hiroyuki Yamamoto + * Copyright (C) 1999-2014 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 @@ -70,6 +70,8 @@ static struct Receive { GtkWidget *checkbtn_scan_after_inc; GtkWidget *checkbtn_newmsg_notify_window; + GtkWidget *spinbtn_notifywin; + GtkObject *spinbtn_notifywin_adj; #ifdef G_OS_WIN32 GtkWidget *checkbtn_newmsg_sound; GtkWidget *entry_newmsg_sound; @@ -329,6 +331,8 @@ static PrefsUIData ui_data[] = { #endif {"enable_newmsg_notify_window", &receive.checkbtn_newmsg_notify_window, prefs_set_data_from_toggle, prefs_set_toggle}, + {"notify_window_period", &receive.spinbtn_notifywin, + prefs_set_data_from_spinbtn, prefs_set_spinbtn}, #ifndef G_OS_WIN32 {"inc_local", &receive.checkbtn_local, @@ -854,6 +858,11 @@ static void prefs_receive_create(void) GtkWidget *frame_notify; GtkWidget *checkbtn_newmsg_notify_window; + GtkWidget *hbox_notifywin; + GtkWidget *hbox_spc; + GtkWidget *label_notifywin; + GtkObject *spinbtn_notifywin_adj; + GtkWidget *spinbtn_notifywin; GtkWidget *checkbtn_newmsg_notify; GtkWidget *label_newmsg_notify; GtkWidget *entry_newmsg_notify; @@ -931,6 +940,49 @@ static void prefs_receive_create(void) (vbox4, checkbtn_newmsg_notify_window, _("Show notification window when new messages arrive")); + hbox_notifywin = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox_notifywin); + gtk_box_pack_start (GTK_BOX (vbox4), hbox_notifywin, FALSE, FALSE, 0); + + hbox_spc = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox_spc); + gtk_box_pack_start (GTK_BOX (hbox_notifywin), hbox_spc, FALSE, FALSE, 0); + gtk_widget_set_size_request (hbox_spc, 12, -1); + + label_notifywin = gtk_label_new (_("Display window for")); + gtk_widget_show (label_notifywin); + gtk_box_pack_start (GTK_BOX (hbox_notifywin), label_notifywin, FALSE, FALSE, 0); + + spinbtn_notifywin_adj = gtk_adjustment_new (10, 0, 1000, 1, 10, 0); + spinbtn_notifywin = gtk_spin_button_new + (GTK_ADJUSTMENT (spinbtn_notifywin_adj), 1, 0); + gtk_widget_show (spinbtn_notifywin); + gtk_box_pack_start (GTK_BOX (hbox_notifywin), spinbtn_notifywin, FALSE, FALSE, 0); + gtk_widget_set_size_request (spinbtn_notifywin, 64, -1); + gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spinbtn_notifywin), TRUE); + + label_notifywin = gtk_label_new (_("second(s)")); + gtk_widget_show (label_notifywin); + gtk_box_pack_start (GTK_BOX (hbox_notifywin), label_notifywin, FALSE, FALSE, 0); + + SET_TOGGLE_SENSITIVITY(checkbtn_newmsg_notify_window, hbox_notifywin); + + hbox_notifywin = gtk_hbox_new (FALSE, 8); + gtk_widget_show (hbox_notifywin); + gtk_box_pack_start (GTK_BOX (vbox4), hbox_notifywin, FALSE, FALSE, 0); + + hbox_spc = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox_spc); + gtk_box_pack_start (GTK_BOX (hbox_notifywin), hbox_spc, FALSE, FALSE, 0); + gtk_widget_set_size_request (hbox_spc, 12, -1); + + label_notifywin = gtk_label_new (_("0: don't auto-close")); + gtk_widget_show (label_notifywin); + gtk_box_pack_start (GTK_BOX (hbox_notifywin), label_notifywin, FALSE, FALSE, 0); + gtkut_widget_set_small_font_size (label_notifywin); + + SET_TOGGLE_SENSITIVITY(checkbtn_newmsg_notify_window, hbox_notifywin); + #ifdef G_OS_WIN32 PACK_CHECK_BUTTON (vbox4, checkbtn_newmsg_sound, @@ -1023,6 +1075,8 @@ static void prefs_receive_create(void) receive.checkbtn_scan_after_inc = checkbtn_scan_after_inc; receive.checkbtn_newmsg_notify_window = checkbtn_newmsg_notify_window; + receive.spinbtn_notifywin = spinbtn_notifywin; + receive.spinbtn_notifywin_adj = spinbtn_notifywin_adj; #ifdef G_OS_WIN32 receive.checkbtn_newmsg_sound = checkbtn_newmsg_sound; receive.entry_newmsg_sound = entry_newmsg_sound; -- cgit v1.2.3