static GdkBitmap *newxpmmask;
static GdkPixmap *unreadxpm;
static GdkBitmap *unreadxpmmask;
+static GdkPixmap *draftsxpm;
+static GdkBitmap *draftsxpmmask;
+static GdkPixmap *draftsopenxpm;
+static GdkBitmap *draftsopenxpmmask;
static void folderview_select_node (FolderView *folderview,
GtkCTreeNode *node);
stock_pixmap_gdk(ctree, STOCK_PIXMAP_QUEUE_CLOSE_HRM, &queuehrmxpm, &queuehrmxpmmask);
stock_pixmap_gdk(ctree, STOCK_PIXMAP_QUEUE_OPEN, &queueopenxpm, &queueopenxpmmask);
stock_pixmap_gdk(ctree, STOCK_PIXMAP_QUEUE_OPEN_HRM, &queueopenhrmxpm, &queueopenhrmxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_DRAFTS_CLOSE, &draftsxpm, &draftsxpmmask);
+ stock_pixmap_gdk(ctree, STOCK_PIXMAP_DRAFTS_OPEN, &draftsopenxpm, &draftsopenxpmmask);
/* CLAWS: titles for "New" and "Unread" show new & unread pixmaps
* instead text (text overflows making them unreadable and ugly) */
gtk_clist_set_column_widget(GTK_CLIST(ctree),COL_NEW,hbox_new);
gtk_clist_set_column_widget(GTK_CLIST(ctree),COL_UNREAD,hbox_unread);
-
-
- if (!normalfont)
- normalfont = gtkut_font_load(NORMAL_FONT);
- if (!boldfont)
- boldfont = gtkut_font_load(BOLD_FONT);
-
+ if (!normalfont) {
+ if (gtkut_font_load(NORMAL_FONT) == NULL) {
+ GtkStyle *style = gtk_style_new();
+ normalfont = style->font;
+ gdk_font_ref(normalfont);
+ gtk_style_unref(style);
+ }
+ else
+ normalfont = gtkut_font_load(NORMAL_FONT);
+ }
+
+ if (!boldfont) {
+ if (gtkut_font_load(BOLD_FONT) == NULL) {
+ GtkStyle *style = gtk_style_new();
+ boldfont = style->font;
+ gdk_font_ref(boldfont);
+ gtk_style_unref(style);
+ }
+ else
+ boldfont = gtkut_font_load(BOLD_FONT);
+ }
+
if (!bold_style) {
bold_style = gtk_style_copy(gtk_widget_get_style(ctree));
bold_style->font = boldfont;
else if (folder->type == F_IMAP && folder->account &&
folder->account->recv_server)
rootpath = folder->account->recv_server;
+ else if (folder->type == F_NEWS && folder->account &&
+ folder->account->nntp_server)
+ rootpath = folder->account->nntp_server;
else
return;
}
#endif
-void folderview_check_new(Folder *folder)
+/** folderview_check_new()
+ * Scan and update the folder and return the
+ * count the number of new messages since last check.
+ * \param folder the folder to check for new messages
+ * \return the number of new messages since last check
+ */
+gint folderview_check_new(Folder *folder)
{
GList *list;
FolderItem *item;
FolderView *folderview;
GtkCTree *ctree;
GtkCTreeNode *node;
+ gint new_msgs = 0;
+ gint former_new_msgs = 0;
+ gint former_new = 0;
for (list = folderview_list; list != NULL; list = list->next) {
folderview = (FolderView *)list->data;
if (!folder && !FOLDER_IS_LOCAL(item->folder)) continue;
folderview_scan_tree_func(item->folder, item, NULL);
+ former_new = item->new;
if (folder_item_scan(item) < 0) {
if (folder && !FOLDER_IS_LOCAL(folder))
break;
}
folderview_update_node(folderview, node);
+ new_msgs += item->new;
+ former_new_msgs += former_new;
}
gtk_widget_set_sensitive(folderview->ctree, TRUE);
}
folder_write_list();
+ /* Number of new messages since last check is the just the difference
+ * between former_new_msgs and new_msgs. If new_msgs is less than
+ * former_new_msgs, that would mean another session accessed the folder
+ * and the result is not well defined.
+ */
+ new_msgs = (former_new_msgs < new_msgs ? new_msgs - former_new_msgs : 0);
+ return new_msgs;
}
void folderview_check_new_all(void)
item->name);
break;
case F_DRAFT:
- xpm = folderxpm;
- mask = folderxpmmask;
- if (item->hide_read_msgs) {
- openxpm = folderopenhrmxpm;
- openmask = folderopenhrmxpmmask;
- } else {
- openxpm = folderopenxpm;
- openmask = folderopenxpmmask;
- }
+ xpm = draftsxpm;
+ mask = draftsxpmmask;
+ openxpm = draftsopenxpm;
+ openmask = draftsopenxpmmask;
name = g_strdup(FOLDER_IS_LOCAL(item->folder) &&
!strcmp2(item->name, DRAFT_DIR) ? _("Drafts") :
item->name);
} else {
if (item->folder->type == F_NEWS &&
item->path &&
- !strcmp2(item->name, item->path) &&
- prefs_common.ng_abbrev_len < strlen(item->path))
- name = get_abbrev_newsgroup_name(item->path, prefs_common.ng_abbrev_len);
+ !strcmp2(item->name, item->path))
+ name = get_abbrev_newsgroup_name
+ (item->path,
+ prefs_common.ng_abbrev_len);
else
name = g_strdup(item->name);
}
}
/* Open Folder */
- buf = g_strdup_printf(_("Opening Folder %s..."), item->path);
+ buf = g_strdup_printf(_("Opening Folder %s..."), item->path ?
+ item->path : "(null)");
debug_print("%s\n", buf);
STATUSBAR_PUSH(folderview->mainwin, buf);
g_free(buf);
/* Show messages */
summary_set_prefs_from_folderitem(folderview->summaryview, item);
opened = summary_show(folderview->summaryview, item);
-
+
folder_clean_cache_memory();
if (!opened) {
folder_item_remove(item);
gtk_ctree_remove_node(ctree, folderview->selected);
folder_write_list();
+
+ prefs_filtering_delete_path(name);
}
static void folderview_rm_news_server_cb(FolderView *folderview, guint action,
g_return_if_fail(item != NULL);
g_return_if_fail(item->folder != NULL);
-#if CLAWS
- prefs_folder_item_create(folderview, item);
-#else
- /*
- * CLAWS: wait till Hiro has completed his stuff
- */
if (item->parent == NULL && item->folder->account)
account_open(item->folder->account);
- else
- prefs_folder_item_open(item);
-#endif
+ else {
+ summary_save_prefs_to_folderitem(folderview->summaryview, item);
+ prefs_folder_item_create(folderview, item);
+ }
}
static void folderview_recollapse_nodes(FolderView *folderview, GtkCTreeNode *node)