static MsgInfo *mh_parse_msg(const gchar *file, FolderItem *item) { MsgInfo *msginfo; MsgFlags flags; cm_return_val_if_fail(item != NULL, NULL); cm_return_val_if_fail(file != NULL, NULL); flags.perm_flags = MSG_NEW|MSG_UNREAD; flags.tmp_flags = 0; if (folder_has_parent_of_type(item, F_QUEUE)) { MSG_SET_TMP_FLAGS(flags, MSG_QUEUED); } else if (folder_has_parent_of_type(item, F_DRAFT)) { MSG_SET_TMP_FLAGS(flags, MSG_DRAFT); } msginfo = procheader_parse_file(file, flags, FALSE, FALSE); if (!msginfo) return NULL; msginfo->msgnum = atoi(file); msginfo->folder = item; return msginfo; }
static void set_sensitivity(GtkUIManager *ui_manager, FolderItem *item) { gboolean folder_is_normal = item != NULL && item->stype == F_NORMAL && !folder_has_parent_of_type(item, F_OUTBOX) && !folder_has_parent_of_type(item, F_DRAFT) && !folder_has_parent_of_type(item, F_QUEUE) && !folder_has_parent_of_type(item, F_TRASH); #define SET_SENS(name, sens) \ cm_menu_set_sensitive_full(ui_manager, "Popup/"name, sens) SET_SENS("FolderViewPopup/CreateNewFolder", item && item->stype != F_INBOX); SET_SENS("FolderViewPopup/RenameFolder", item && item->stype == F_NORMAL && folder_item_parent(item) != NULL); SET_SENS("FolderViewPopup/MoveFolder", folder_is_normal && folder_item_parent(item) != NULL); SET_SENS("FolderViewPopup/DeleteFolder", item && item->stype == F_NORMAL && folder_item_parent(item) != NULL); SET_SENS("FolderViewPopup/CheckNewMessages", folder_item_parent(item) == NULL); SET_SENS("FolderViewPopup/CheckNewFolders", folder_item_parent(item) == NULL); SET_SENS("FolderViewPopup/RebuildTree", folder_item_parent(item) == NULL); SET_SENS("FolderViewPopup/RemoveMailbox", folder_item_parent(item) == NULL); #undef SET_SENS }
static gboolean my_folder_item_update_hook(gpointer source, gpointer data) { FolderItemUpdateData *update_data = source; FolderType ftype; gchar *uistr; g_return_val_if_fail(source != NULL, FALSE); if (folder_has_parent_of_type(update_data->item, F_DRAFT)) return FALSE; #if defined(NOTIFICATION_LCDPROC) || defined(NOTIFICATION_TRAYICON) || defined(NOTIFICATION_INDICATOR) notification_update_msg_counts(NULL); #else if(notify_config.urgency_hint_new || notify_config.urgency_hint_unread) notification_update_msg_counts(NULL); #endif /* Check if the folder types is to be notified about */ ftype = update_data->item->folder->klass->type; uistr = update_data->item->folder->klass->uistr; if(!notify_include_folder_type(ftype, uistr)) return FALSE; if(update_data->update_flags & F_ITEM_UPDATE_MSGCNT) { #ifdef NOTIFICATION_BANNER notification_update_banner(); #endif #if defined(NOTIFICATION_POPUP) || defined(NOTIFICATION_COMMAND) notification_new_unnotified_msgs(update_data); #endif } return FALSE; }
/* Helper function for foldercheck_insert_gnode_in_store */ static void foldercheck_append_item(GtkTreeStore *store, FolderItem *item, GtkTreeIter *iter, GtkTreeIter *parent) { gchar *name, *tmpname; GdkPixbuf *pixbuf, *pixbuf_open; name = tmpname = folder_item_get_name(item); if (item->stype != F_NORMAL && FOLDER_IS_LOCAL(item->folder)) { switch (item->stype) { case F_INBOX: if (!strcmp2(item->name, INBOX_DIR)) name = "Inbox"; break; case F_OUTBOX: if (!strcmp2(item->name, OUTBOX_DIR)) name = "Sent"; break; case F_QUEUE: if (!strcmp2(item->name, QUEUE_DIR)) name = "Queue"; break; case F_TRASH: if (!strcmp2(item->name, TRASH_DIR)) name = "Trash"; break; case F_DRAFT: if (!strcmp2(item->name, DRAFT_DIR)) name = "Drafts"; break; default: break; } } if (folder_has_parent_of_type(item, F_QUEUE) && item->total_msgs > 0) { name = g_strdup_printf("%s (%d)", name, item->total_msgs); } else if (item->unread_msgs > 0) { name = g_strdup_printf("%s (%d)", name, item->unread_msgs); } else name = g_strdup(name); pixbuf = item->no_select ? foldernoselect_pixbuf : folder_pixbuf; pixbuf_open = item->no_select ? foldernoselectopen_pixbuf : folderopen_pixbuf; /* insert this node */ gtk_tree_store_append(store, iter, parent); gtk_tree_store_set(store, iter, FOLDERCHECK_FOLDERNAME, name, FOLDERCHECK_FOLDERITEM, item, FOLDERCHECK_PIXBUF, pixbuf, FOLDERCHECK_PIXBUF_OPEN, pixbuf_open, -1); g_free(tmpname); }
static void set_sensitivity(GtkUIManager *ui_manager, FolderItem *item) { gboolean folder_is_normal = item != NULL && item->stype == F_NORMAL && !folder_has_parent_of_type(item, F_OUTBOX) && !folder_has_parent_of_type(item, F_DRAFT) && !folder_has_parent_of_type(item, F_QUEUE) && !folder_has_parent_of_type(item, F_JUNK) && !folder_has_parent_of_type(item, F_TRASH); #define SET_SENS(name, sens) \ cm_menu_set_sensitive_full(ui_manager, "Popup/"name, sens) SET_SENS("FolderViewPopup/CreateNewFolder", item && item->no_sub == FALSE); SET_SENS("FolderViewPopup/RenameFolder", item && item->stype == F_NORMAL && folder_item_parent(item) != NULL); SET_SENS("FolderViewPopup/MoveFolder", item && folder_is_normal && folder_item_parent(item) != NULL); SET_SENS("FolderViewPopup/DeleteFolder", item && item->stype == F_NORMAL && folder_item_parent(item) != NULL); SET_SENS("FolderViewPopup/CheckNewMessages", folder_item_parent(item) == NULL); SET_SENS("FolderViewPopup/CheckNewFolders", folder_item_parent(item) == NULL); SET_SENS("FolderViewPopup/RebuildTree", folder_item_parent(item) == NULL); SET_SENS("FolderViewPopup/Synchronise", item ? (folder_item_parent(item) != NULL && folder_want_synchronise(item->folder)) : FALSE); SET_SENS("FolderViewPopup/DownloadMessages", item && !item->no_select); SET_SENS("FolderViewPopup/CheckNewMessages", folder_item_parent(item) == NULL); SET_SENS("FolderViewPopup/CheckNewFolders", folder_item_parent(item) == NULL); SET_SENS("FolderViewPopup/RebuildTree", folder_item_parent(item) == NULL); SET_SENS("FolderViewPopup/Subscriptions/Unsubscribe", item && item->stype == F_NORMAL && folder_item_parent(item) != NULL); SET_SENS("FolderViewPopup/Subscriptions/Subscribe", TRUE); if (item && item->folder && item->folder->account) cm_toggle_menu_set_active_full(ui_manager, "Popup/FolderViewPopup/Subscriptions/ShowOnlySubs", item->folder->account->imap_subsonly); #undef SET_SENS }
static void foldersel_append_item(GtkTreeStore *store, FolderItem *item, GtkTreeIter *iter, GtkTreeIter *parent) { gchar *name, *tmpname; GdkPixbuf *pixbuf, *pixbuf_open; gboolean use_color; PangoWeight weight = PANGO_WEIGHT_NORMAL; GdkColor *foreground = NULL; static GdkColor color_noselect = {0, COLOR_DIM, COLOR_DIM, COLOR_DIM}; static GdkColor color_new; gtkut_convert_int_to_gdk_color(prefs_common.color_new, &color_new); name = tmpname = folder_item_get_name(item); if (item->stype != F_NORMAL && FOLDER_IS_LOCAL(item->folder)) { switch (item->stype) { case F_INBOX: if (!strcmp2(item->name, INBOX_DIR)) name = _("Inbox"); break; case F_OUTBOX: if (!strcmp2(item->name, OUTBOX_DIR)) name = _("Sent"); break; case F_QUEUE: if (!strcmp2(item->name, QUEUE_DIR)) name = _("Queue"); break; case F_TRASH: if (!strcmp2(item->name, TRASH_DIR)) name = _("Trash"); break; case F_DRAFT: if (!strcmp2(item->name, DRAFT_DIR)) name = _("Drafts"); break; default: break; } } if (folder_has_parent_of_type(item, F_QUEUE) && item->total_msgs > 0) { name = g_strdup_printf("%s (%d)", name, item->total_msgs); } else if (item->unread_msgs > 0) { name = g_strdup_printf("%s (%d)", name, item->unread_msgs); } else name = g_strdup(name); pixbuf = item->no_select ? foldernoselect_pixbuf : folder_pixbuf; pixbuf_open = item->no_select ? foldernoselectopen_pixbuf : folderopen_pixbuf; if (folder_has_parent_of_type(item, F_DRAFT) || folder_has_parent_of_type(item, F_OUTBOX) || folder_has_parent_of_type(item, F_TRASH)) { use_color = FALSE; } else if (folder_has_parent_of_type(item, F_QUEUE)) { use_color = (item->total_msgs > 0); if (item->total_msgs > 0) weight = PANGO_WEIGHT_BOLD; } else { if (item->unread_msgs > 0) weight = PANGO_WEIGHT_BOLD; use_color = (item->new_msgs > 0); } if (item->no_select) foreground = &color_noselect; else if (use_color) foreground = &color_new; /* insert this node */ gtk_tree_store_append(store, iter, parent); gtk_tree_store_set(store, iter, FOLDERSEL_FOLDERNAME, name, FOLDERSEL_FOLDERITEM, item, FOLDERSEL_PIXBUF, pixbuf, FOLDERSEL_PIXBUF_OPEN, pixbuf_open, FOLDERSEL_FOREGROUND, foreground, FOLDERSEL_BOLD, weight, -1); g_free(tmpname); }