You are not logged in.

#1 2012-08-27 13:54:24

post-factum
Member
From: /cz
Registered: 2008-09-12
Posts: 156
Website

[SOLVED] No popup by Claws Mail on new messages

Hi.

Using Claws Mail 3.8.1 + notification plugin (tried both trayicon.so and notification_plugin.so) results in no popup on new mail arrival.

libnotify is installed, of course. DE — Xfce 4.10. System is up-to-date with pacman -Syu. No testing repos are enabled.

notify-send command works well. Turpial shows popups as well. No strange debug/error output was observed after launching Claws Mail from console.

How should I force popup notifications to appear?

Last edited by post-factum (2012-08-28 12:31:11)


uname == latest pf-kernel

Offline

#2 2012-08-28 12:30:38

post-factum
Member
From: /cz
Registered: 2008-09-12
Posts: 156
Website

Re: [SOLVED] No popup by Claws Mail on new messages

Fixed by recompiling Claws Mail notification_plugin.so with the following patch:

diff --git a/src/notification_core.c b/src/notification_core.c
index 6831068..73076d7 100644
--- a/src/notification_core.c
+++ b/src/notification_core.c
@@ -286,7 +286,8 @@ gboolean notification_notified_hash_msginfo_update(MsgInfoUpdate *msg_update)
   g_return_val_if_fail(msg_update != NULL, FALSE);
 
   if((msg_update->flags & MSGINFO_UPDATE_FLAGS) &&
-     !MSG_IS_NEW(msg_update->msginfo->flags)) {
+     !MSG_IS_NEW(msg_update->msginfo->flags) &&
+     !MSG_IS_UNREAD(msg_update->msginfo->flags)) {
 
     MsgInfo *msg;
     gchar *msgid;
@@ -340,15 +341,15 @@ static gboolean notification_traverse_hash_startup(GNode *node, gpointer data)
   FolderItem *item = (FolderItem*) node->data;
   gint new_msgs_left;
 
-  if(!(item->new_msgs))
+  if(!(item->new_msgs + item->unread_msgs))
     return FALSE;
 
-  new_msgs_left = item->new_msgs;
+  new_msgs_left = item->new_msgs + item->unread_msgs;
   msg_list = folder_item_get_msg_list(item);
 
   for(walk = msg_list; walk; walk = g_slist_next(walk)) {
     MsgInfo *msg = (MsgInfo*) walk->data;
-    if(MSG_IS_NEW(msg->flags)) {
+    if(MSG_IS_NEW(msg->flags) || MSG_IS_UNREAD(msg->flags)) {
       gchar *msgid;
 
       if(msg->msgid)
@@ -398,7 +399,7 @@ void notification_new_unnotified_msgs(FolderItemUpdateData *update_data)
     MsgInfo *msg;
     msg = (MsgInfo*) walk->data;
 
-    if(MSG_IS_NEW(msg->flags)) {
+    if(MSG_IS_NEW(msg->flags) || MSG_IS_UNREAD(msg->flags)) {
       gchar *msgid;
 
       if(msg->msgid)
diff --git a/src/notification_popup.c b/src/notification_popup.c
index c69c8c7..e66ece5 100644
--- a/src/notification_popup.c
+++ b/src/notification_popup.c
@@ -101,6 +101,9 @@ void notification_popup_msg(MsgInfo *msginfo)
   if(!msginfo || !notify_config.popup_show)
     return;
 
+  if(!notify_config.popup_unread_also && !MSG_IS_NEW(msginfo->flags))
+    return;
+
   if(notify_config.popup_folder_specific) {
     guint id;
     GSList *list;
diff --git a/src/notification_prefs.c b/src/notification_prefs.c
index 52e3a3a..49f2305 100644
--- a/src/notification_prefs.c
+++ b/src/notification_prefs.c
@@ -105,6 +105,7 @@ typedef struct {
 	GtkWidget *popup_cont_color_sel;
 #else /* HAVE_LIBNOTIFY */
 	GtkWidget *popup_display_folder_name;
+	GtkWidget *popup_unread_also;
 #endif /* HAVE_LIBNOTIFY */
 }NotifyPopupPage;
 NotifyPopupPage popup_page;
@@ -246,6 +247,9 @@ PrefParam
 #else /* HAVE_LIBNOTIFY */
 				{	"popup_display_folder_name", "FALSE", &notify_config.popup_display_folder_name,
 					P_BOOL, NULL, NULL, NULL},
+        { "popup_unread_also", "FALSE", &notify_config.popup_unread_also,
+          P_BOOL, NULL, NULL, NULL},
+
 #endif /* HAVE_LIBNOTIFY */
 #endif
 
@@ -1120,6 +1124,17 @@ static void notify_create_popup_page(PrefsPage *page, GtkWindow *window,
 	gtk_widget_show(checkbox);
 	gtk_widget_show(hbox);
 	popup_page.popup_display_folder_name = checkbox;
+
+  hbox = gtk_hbox_new(FALSE, 10);
+  gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+  checkbox = gtk_check_button_new_with_label(_("Notify on unread also"));
+  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox),
+      notify_config.popup_unread_also);
+  gtk_box_pack_start(GTK_BOX(hbox), checkbox, FALSE, FALSE, 0);
+  gtk_widget_show(checkbox);
+  gtk_widget_show(hbox);
+  popup_page.popup_unread_also = checkbox;
+
 #endif /* HAVE_LIBNOTIFY */
 
 	notify_popup_enable_set_sensitivity
@@ -1168,6 +1183,9 @@ static void notify_save_popup(PrefsPage *page)
 #else /* HAVE_LIBNOTIFY */
 	notify_config.popup_display_folder_name =
 	gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(popup_page.popup_display_folder_name));
+  notify_config.popup_unread_also =
+  gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(popup_page.popup_unread_also));
+
 #endif /* HAVE_LIBNOTIFY */
 }
 
diff --git a/src/notification_prefs.h b/src/notification_prefs.h
index 684f6ca..8a5d626 100644
--- a/src/notification_prefs.h
+++ b/src/notification_prefs.h
@@ -72,6 +72,7 @@ typedef struct {
   gulong           popup_color_fg;
 #else /* HAVE_LIBNOTIFY */
   gboolean         popup_display_folder_name;
+  gboolean         popup_unread_also;
 #endif /* HAVE_LIBNOTIFY */
 #endif /* Popup */
 #ifdef NOTIFICATION_COMMAND

uname == latest pf-kernel

Offline

#3 2013-05-14 02:40:53

Xyne
Forum Fellow
Registered: 2008-08-03
Posts: 6,965
Website

Re: [SOLVED] No popup by Claws Mail on new messages

I came to the forum looking for a way to restore the missing tray icon and I was very happy when I found your patch. big_smile

Here's a working PKGBUILD:

# $Id$
# Maintainer: Andreas Radke <andyrtr@archlinux.org>

pkgname=claws-mail
pkgver=3.9.1
pkgrel=2
pkgdesc="A GTK+ based e-mail client."
arch=('i686' 'x86_64')
license=('GPL3')
url="http://www.claws-mail.org"
depends=('gtk2' 'gnutls' 'startup-notification' 'pilot-link' 'enchant'
         'gpgme' 'libetpan>=1.1' 'libsm' 'db' 'dbus-glib' 'hicolor-icon-theme' 'desktop-file-utils')
makedepends=('compface' 'spamassassin' 'bogofilter' 'valgrind'
             # dependencies for plugins
             'libsoup' 'libgdata' 'webkitgtk2' 'libnotify' 'libcanberra' 'poppler-glib' 'pygtk')
             #'libchamplain' needed for geolocation plugin, disabled for now - most time it's not compatible with current gnome releases
optdepends=('python2:           needed for some tools and python plugin'
            'perl:              needed for some tools and perl plugin'
            'spamassassin:      adds support for spamfiltering'
            'bogofilter:        adds support for spamfiltering'
            'libnotify:         for notification plugin'
            'libcanberra:       for notification plugin'
            'dbus:              for notification plugin'
            'libxml2:           for gtkhtml2_viewer and rssyl plugins'
            'curl:              for gtkhtml2_viewer, vcalendar, rssyl and spamreport plugins'
            'libarchive:        for archive plugin and various other plugins'
            'libytnef:          for tnef_parse plugin'
            'webkitgtk2:        for the fancy webkit html plugin'
            'libsoup:           for the fancy webkit html plugin'
	        'libgdata:          for gdata plugin'
	        'poppler-glib:      for pdf viewer plugin'
	        'ghostscript:       for pdf viewer plugin')
replaces=('sylpheed-claws' 'claws-mail-extra-plugins')
conflicts=('claws-mail-extra-plugins')
provides=('claws')
options=(!libtool)
install=claws-mail.install
source=(http://downloads.sourceforge.net/sourceforge/sylpheed-claws/${pkgname}-${pkgver}.tar.bz2
fix_notification_plugin.patch)
md5sums=('8adc734912ff1b83545cb12850100473'
         '6ee176e2b65d62e30d46f9b07189a3a2')

prepare() {
  cd "${srcdir}/${pkgname}-${pkgver}/src/plugins/notification"
  patch -p2 < "${srcdir}/fix_notification_plugin.patch"
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"

  # fixes for python2
  export PYTHON="/usr/bin/python2"
  sed -i 's@^#!.*python.*@#!/usr/bin/python2@' tools/*.py
  sed -i 's:python -c:python2 -c:g' configure

  ./configure --prefix=/usr --disable-static \
    --enable-enchant \
    --enable-gnutls \
    --enable-ldap \
    --enable-crash-dialog \
    --enable-pgpmime-plugin \
    --enable-spamassassin-plugin \
    --enable-bogofilter-plugin \
    --enable-jpilot \
    #--help
  make
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  make DESTDIR="${pkgdir}" install

  # build and install extra tools
  cd tools
  make
   # all executables and .conf files ; only top directory
  find -maxdepth 1 -type f -and -perm /111 -or -name '*.conf' | while read i ; do
      install -D -m755 "${i}" \
        "${pkgdir}/usr/lib/claws-mail/tools/${i}"
  done
}

I have just added a "prepare" function to the current PKGBUILD, so there may be other things in need up an update.

For those wondering what happened to the TrayIcon plugin, it is now part of the Notification plugin.

Steps to re-enable:
Configuration -> Plugins -> load -> notification.so
Preferences -> Plugins/Notification/SysTrayicon -> Enable Trayicon
big_smile

Please post your patch upstream and open a bug report for this.


edit
For the lazy: http://xyne.archlinux.ca/tmp/pkgbuilds/ … src.tar.gz


edit2
gah, just saw the date
I'm too tired to think straight right now. The icon hasn't been missing since August last year, yet this solved the problem for me right now, so it seems to be the same issue. I recuse myself from deciding if this is thread is still relevant. Time to stop posting.

Last edited by Xyne (2013-05-14 02:50:43)


My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB