-/* Notification plugin for Claws-Mail
+/* Notification plugin for Claws Mail
* Copyright (C) 2005-2007 Holger Berndt and the Claws Mail Team.
*
* This program is free software; you can redistribute it and/or modify
*/
/* This module is of course inspired by the trayicon plugin which is
- * shipped with Claws-Mail, copyrighted by the Claws-Mail Team. */
+ * shipped with Claws Mail, copyrighted by the Claws Mail Team. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#include "gtk/gtkutils.h"
#include "inc.h"
-static void notification_trayicon_account_list_reset(const gchar *name,
- gpointer callback);
+static void notification_trayicon_account_list_reset(const gchar *,
+ gpointer,
+ gboolean);
static GdkPixbuf* notification_trayicon_create(void);
static GtkWidget *focused_widget = NULL;
static GtkActionEntry trayicon_popup_menu_entries[] = {
- {"SysTrayiconPopup", NULL, "SysTrayiconPopup" },
+ {"SysTrayiconPopup", NULL, "SysTrayiconPopup", NULL, NULL, NULL },
{"SysTrayiconPopup/GetMail", NULL, N_("_Get Mail"), NULL, NULL, G_CALLBACK(trayicon_get_all_cb) },
{"SysTrayiconPopup/GetMailAcc", NULL, N_("_Get Mail from account"), NULL, NULL, NULL },
- {"SysTrayiconPopup/---", NULL, "---" },
+ {"SysTrayiconPopup/---", NULL, "---", NULL, NULL, NULL },
{"SysTrayiconPopup/Email", NULL, N_("_Email"), NULL, NULL, G_CALLBACK(trayicon_compose_cb) },
{"SysTrayiconPopup/EmailAcc", NULL, N_("E_mail from account"), NULL, NULL, NULL },
{"SysTrayiconPopup/OpenAB", NULL, N_("Open A_ddressbook"), NULL, NULL, G_CALLBACK(trayicon_addressbook_cb) },
static GtkToggleActionEntry trayicon_popup_toggle_menu_entries[] =
{
- {"SysTrayiconPopup/ToggleOffline", NULL, N_("_Work Offline"), NULL, NULL, G_CALLBACK(trayicon_toggle_offline_cb) },
+ {"SysTrayiconPopup/ToggleOffline", NULL, N_("_Work Offline"), NULL, NULL, G_CALLBACK(trayicon_toggle_offline_cb), FALSE },
#ifdef HAVE_LIBNOTIFY
- {"SysTrayiconPopup/ShowBubbles", NULL, N_("Show Trayicon Notifications"), NULL, NULL, G_CALLBACK(trayicon_toggle_notify_cb) },
+ {"SysTrayiconPopup/ShowBubbles", NULL, N_("Show Trayicon Notifications"), NULL, NULL, G_CALLBACK(trayicon_toggle_notify_cb), FALSE },
#endif
};
FolderItem *list_item = (FolderItem*) list->data;
list_identifier = folder_item_get_identifier(list_item);
- if(!strcmp2(list_identifier, identifier))
+ if(!g_strcmp0(list_identifier, identifier))
found = TRUE;
g_free(list_identifier);
}
static void notification_trayicon_account_list_reset(const gchar *menuname,
- gpointer callback)
+ gpointer callback,
+ gboolean receive)
{
GList *cur_ac;
GtkWidget *menu, *submenu;
for(cur_ac = account_list; cur_ac != NULL; cur_ac = cur_ac->next) {
ac_prefs = (PrefsAccount *)cur_ac->data;
+ /* accounts list for receiving: skip SMTP-only accounts */
+ if (receive && ac_prefs->protocol == A_NONE)
+ continue;
+
menuitem = gtk_menu_item_new_with_label
(ac_prefs->account_name ? ac_prefs->account_name
: _("Untitled"));
{
if (notify_config.trayicon_enabled) {
notification_trayicon_account_list_reset("/Menus/SysTrayiconPopup/GetMailAcc",
- (gpointer)trayicon_get_from_account_cb);
+ (gpointer)trayicon_get_from_account_cb, TRUE);
notification_trayicon_account_list_reset("/Menus/SysTrayiconPopup/EmailAcc",
- (gpointer)trayicon_compose_acc_cb);
+ (gpointer)trayicon_compose_acc_cb, FALSE);
}
return FALSE;
}
cm_toggle_menu_set_active("SysTrayiconPopup/ShowBubbles", notify_config.trayicon_popup_enabled);
#endif
cm_menu_set_sensitive("SysTrayiconPopup/GetMail", mainwin->lock_count == 0);
+ cm_menu_set_sensitive("SysTrayiconPopup/GetMailAcc", mainwin->lock_count == 0);
+ cm_menu_set_sensitive("SysTrayiconPopup/Exit", mainwin->lock_count == 0);
updating_menu = FALSE;
if(prefs_common_get_prefs()->confirm_on_exit) {
if(alertpanel(_("Exit"), _("Exit Claws Mail?"),
GTK_STOCK_CANCEL, GTK_STOCK_OK,
- NULL) != G_ALERTALTERNATE) {
+ NULL, ALERTFOCUS_FIRST) != G_ALERTALTERNATE) {
return;
}
manage_window_focus_in(mainwin->window, NULL, NULL);
/* Make sure text is valid UTF8 */
utf8_str = notification_validate_utf8_str(text);
- g_free(text);
- if(from) g_free(from);
- if(subj) g_free(subj);
+ g_free(text);
+ g_free(from);
+ g_free(subj);
if(foldname) g_free(foldname);
}
else if(popup.num_calendar) {
"%d new mail messages arrived",
popup.num_mail),
popup.num_mail);
- tmp = g_strdup_printf("%s%s%s",utf8_str,str_empty?"":"\n",msg);
+ tmp = g_strdup_printf("%s%s%s",utf8_str,"",msg);
g_free(msg);
g_free(utf8_str);
utf8_str = tmp;