clean up after 0.5.3 sync
authorPaul Mangan <paul@claws-mail.org>
Tue, 21 Aug 2001 11:37:22 +0000 (11:37 +0000)
committerPaul Mangan <paul@claws-mail.org>
Tue, 21 Aug 2001 11:37:22 +0000 (11:37 +0000)
ChangeLog.claws
src/account.c
src/folderview.c
src/mainwindow.c
src/summaryview.c

index 17a3001a55fe4fe01cedf73f844fdb72968ca36c..da468cef1c9fa66870bc1981af4d372f2c39bac9 100644 (file)
@@ -1,3 +1,22 @@
+2001-08-21 [paul]
+
+       clean up after sync with sylpheed 0.5.3 release
+
+       * src/account.c, src/mainwindow.c
+               replace folderview_update_all() with
+               folderview_update_all_node()
+
+       * src/folderview.c
+               remove folderview_update_all()
+               fix re-introduced font mess, see Christoph's
+               entry 2001-06-24
+
+       * src/summaryview.c
+               remove prev_msgnum
+                use sylpheed's small font instead of
+               gtk default font for summary view
+
+
 2001-08-17 [paul]
 
        * configure.in
index 94bf40ec34e0acd54b539ee14f9e5fcf518bebf3..0dc2913c874768962c138487736ebfccaed6084e 100644 (file)
@@ -568,7 +568,7 @@ static void account_edit_prefs(void)
            ac_prefs->folder && strcmp(ac_name, ac_prefs->account_name) != 0) {
                folder_set_name(FOLDER(ac_prefs->folder),
                                ac_prefs->account_name);
-               folderview_update_all();
+               folderview_update_all_node();
        }
 
        account_clist_set();
@@ -591,7 +591,7 @@ static void account_delete(void)
        ac_prefs = gtk_clist_get_row_data(clist, row);
        if (ac_prefs->folder) {
                folder_destroy(FOLDER(ac_prefs->folder));
-               folderview_update_all();
+               folderview_update_all_node();
        }
        account_destroy(ac_prefs);
        account_clist_set();
index e480319822b04b1520268c78f1c7a20cff459744..6e82c9c44939b7c05fa1a34acbbf8c1a3bdcb789 100644 (file)
@@ -91,6 +91,8 @@ static GList *folderview_list = NULL;
 static GdkFont *normalfont;
 static GdkFont *boldfont;
 
+static GtkStyle *normal_style;
+static GtkStyle *normal_color_style;
 static GtkStyle *bold_style;
 static GtkStyle *bold_color_style;
 
@@ -439,6 +441,13 @@ void folderview_init(FolderView *folderview)
                bold_color_style = gtk_style_copy(bold_style);
                bold_color_style->fg[GTK_STATE_NORMAL] = folderview->color_new;
        }
+       if (!normal_style) {
+               normal_style = gtk_style_copy(gtk_widget_get_style(ctree));
+               normal_style->font = normalfont;
+               normal_color_style = gtk_style_copy(normal_style);
+               normal_color_style->fg[GTK_STATE_NORMAL] = folderview->color_new;
+       }
+
 }
 
 void folderview_set(FolderView *folderview)
@@ -665,28 +674,6 @@ void folderview_update_tree(Folder *folder)
        gtk_widget_destroy(window);
 }
 
-void folderview_update_all(void)
-{
-       GList *list;
-       GtkWidget *window;
-
-       window = label_window_create(_("Updating all folders..."));
-
-       list = folder_get_list();
-       for (; list != NULL; list = list->next) {
-               Folder *folder = list->data;
-
-               if (!folder->scan_tree) continue;
-               folder_set_ui_func(folder, folderview_scan_tree_func, NULL);
-               folder->scan_tree(folder);
-               folder_set_ui_func(folder, NULL, NULL);
-       }
-
-       folder_write_list();
-       folderview_set_all();
-       gtk_widget_destroy(window);
-}
-
 void folderview_update_all_node(void)
 {
        GList *list;
@@ -813,7 +800,7 @@ static gboolean folderview_have_unread_children(FolderView *folderview,
 static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
 {
        GtkCTree *ctree = GTK_CTREE(folderview->ctree);
-       GtkStyle *style, *prev_style, *ctree_style;
+       GtkStyle *style = NULL;
        GtkCTreeNode *parent;
        FolderItem *item;
        GdkPixmap *xpm, *openxpm;
@@ -919,20 +906,11 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
                gtk_ctree_node_set_text(ctree, node, COL_TOTAL,  itos(item->total));
        }
 
-       ctree_style = gtk_widget_get_style(GTK_WIDGET(ctree));
-       prev_style = gtk_ctree_node_get_row_style(ctree, node);
-       if (!prev_style)
-               prev_style = ctree_style;
-       style = gtk_style_copy(prev_style);
-       if (!style) return;
+       if (item->stype == F_TRASH) return;
 
        if (item->stype == F_QUEUE) {
                /* highlight queue folder if there are any messages */
                use_bold = use_color = (item->total > 0);
-       } else if (item->stype == F_TRASH) {
-               /* Never highlight trash */
-               use_bold = FALSE;
-               use_color = FALSE;
        } else {
                /* if unread messages exist, print with bold font */
                use_bold = (item->unread > 0) || add_unread_mark;
@@ -943,29 +921,31 @@ static void folderview_update_node(FolderView *folderview, GtkCTreeNode *node)
                         folderview_have_new_children(folderview, node));
        }
 
-       if (use_bold && boldfont)
-               style->font = boldfont;
-       else
-               style->font = normalfont;
+       gtk_ctree_node_set_foreground(ctree, node, NULL);
 
-       if (use_color) {
-               style->fg[GTK_STATE_NORMAL]   = folderview->color_new;
-               style->fg[GTK_STATE_SELECTED] = folderview->color_new;
-       } else {
+       if (use_bold && use_color)
+               style = bold_color_style;
+       else if (use_bold) {
+               style = bold_style;
                if (item->op_count > 0) {
-                       if (boldfont)
-                               style->font = boldfont;
-                       style->fg[GTK_STATE_NORMAL]   =
-                               folderview->color_op;
-                       style->fg[GTK_STATE_SELECTED] =
-                               folderview->color_op;
+                       gtk_ctree_node_set_foreground(ctree, node,
+                                                     &folderview->color_op);
                } else {
-                       style->fg[GTK_STATE_NORMAL] =
-                               ctree_style->fg[GTK_STATE_NORMAL];
-                       style->fg[GTK_STATE_SELECTED] =
-                               ctree_style->fg[GTK_STATE_SELECTED];
+                       style = bold_style;
                }
        }
+       else if (use_color) {
+               style = normal_color_style;
+               gtk_ctree_node_set_foreground(ctree, node,
+                                             &folderview->color_new);
+       }
+       else if (item->op_count > 0) {
+               style = normal_color_style;
+               gtk_ctree_node_set_foreground(ctree, node,
+                                             &folderview->color_op);
+       } else {
+               style = normal_style;
+       }
 
        gtk_ctree_node_set_row_style(ctree, node, style);
 
index 0d9c9663df5715628f75ee3481e6faff29425c0c..ae39c01930ead353a4572ec43b812bffcce576ed 100644 (file)
@@ -1937,7 +1937,7 @@ static void update_folderview_cb(MainWindow *mainwin, guint action,
                                 GtkWidget *widget)
 {
        summary_show(mainwin->summaryview, NULL, FALSE);
-       folderview_update_all();
+       folderview_update_all_node();
 }
 
 static void new_folder_cb(MainWindow *mainwin, guint action,
index 6ebe8f23d8378c3cc44d1818aad19e43fa0fc393..7337fd1c52afca4884c03b32ae9dd1cd0e1b4f94 100644 (file)
@@ -111,6 +111,9 @@ static GdkFont *smallfont;
 static GtkStyle *bold_style;
 static GtkStyle *bold_marked_style;
 static GtkStyle *bold_deleted_style;
+static GtkStyle *small_style;
+static GtkStyle *small_marked_style;
+static GtkStyle *small_deleted_style;
 
 static GdkPixmap *folderxpm;
 static GdkBitmap *folderxpmmask;
@@ -787,11 +790,24 @@ void summary_init(SummaryView *summaryview)
                                    S_COL_MIME, pixmap);
        gtk_widget_show(pixmap);
 
+       if (!small_style) {
+               small_style = gtk_style_copy
+                       (gtk_widget_get_style(summaryview->ctree));
+               if (!smallfont)
+                       smallfont = gdk_fontset_load(SMALL_FONT);
+               small_style->font = smallfont;
+               small_marked_style = gtk_style_copy(small_style);
+               small_marked_style->fg[GTK_STATE_NORMAL] =
+                       summaryview->color_marked;
+               small_deleted_style = gtk_style_copy(small_style);
+               small_deleted_style->fg[GTK_STATE_NORMAL] =
+                       summaryview->color_dim;
+       }
        if (!bold_style) {
                bold_style = gtk_style_copy
                        (gtk_widget_get_style(summaryview->ctree));
                if (!boldfont)
-                       boldfont = gdk_fontset_load(prefs_common.boldfont);
+                       boldfont = gdk_fontset_load(BOLD_FONT);
                bold_style->font = boldfont;
                bold_marked_style = gtk_style_copy(bold_style);
                bold_marked_style->fg[GTK_STATE_NORMAL] =
@@ -801,12 +817,27 @@ void summary_init(SummaryView *summaryview)
                        summaryview->color_dim;
        }
 
-       if (!smallfont)
-               smallfont = gdk_fontset_load(SMALL_FONT);
+       /* if (!smallfont)
+               smallfont = gdk_fontset_load(SMALL_FONT);*/
+
+       if (!small_style) {
+               small_style = gtk_style_copy
+                       (gtk_widget_get_style(summaryview->ctree));
+               if (!smallfont)
+                       smallfont = gdk_fontset_load(SMALL_FONT);
+               small_style->font = smallfont;
+               small_marked_style = gtk_style_copy(small_style);
+               small_marked_style->fg[GTK_STATE_NORMAL] =
+                       summaryview->color_marked;
+               small_deleted_style = gtk_style_copy(small_style);
+               small_deleted_style->fg[GTK_STATE_NORMAL] =
+                       summaryview->color_dim;
+       }
 
        style = gtk_style_copy(gtk_widget_get_style
                                (summaryview->statlabel_folder));
-       if (smallfont) style->font = smallfont;
+       /* if (smallfont) style->font = smallfont;*/
+
        gtk_widget_set_style(summaryview->statlabel_folder, style);
        gtk_widget_set_style(summaryview->statlabel_select, style);
        gtk_widget_set_style(summaryview->statlabel_msgs, style);
@@ -892,7 +923,6 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
        GSList *mlist = NULL;
        gchar *buf;
        gboolean is_refresh;
-       guint prev_msgnum = 0;
        guint selected_msgnum = 0;
        guint displayed_msgnum = 0;
 
@@ -925,6 +955,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item,
                        summary_write_cache(summaryview);
                else
                        return FALSE;
+               folder_update_op_count();
        }
        else if (!summaryview->filtering_happened) {
                summary_write_cache(summaryview);
@@ -2427,26 +2458,32 @@ static void summary_set_row_marks(SummaryView *summaryview, GtkCTreeNode *row)
                                          deletedxpm, deletedxpmmask);
                if (style)
                        style = bold_deleted_style;
-               else
+               else {
+                       style = small_deleted_style;
+               }
                        gtk_ctree_node_set_foreground
                                (ctree, row, &summaryview->color_dim);
        } else if (MSG_IS_MARKED(flags)) {
-               gtk_ctree_node_set_pixmap(ctree, row, S_COL_MARK,
+               gtk_ctree_node_set_pixmap(ctree, row, S_COL_MARK,
                                          markxpm, markxpmmask);
        } else if (MSG_IS_MOVE(flags)) {
                gtk_ctree_node_set_text(ctree, row, S_COL_MARK, "o");
                if (style)
                        style = bold_marked_style;
-               else
+               else {
+                       style = small_marked_style;
+               }
                        gtk_ctree_node_set_foreground
                                (ctree, row, &summaryview->color_marked);
        } else if (MSG_IS_COPY(flags)) {
                gtk_ctree_node_set_text(ctree, row, S_COL_MARK, "O");
                 if (style)
                        style = bold_marked_style;
-               else
-               gtk_ctree_node_set_foreground(ctree, row,
-                                             &summaryview->color_marked);
+               else {
+                       style = small_marked_style;
+               }
+                       gtk_ctree_node_set_foreground
+                               (ctree, row, &summaryview->color_marked);
        }
        else if ((global_scoring ||
                  summaryview->folder_item->prefs->scoring) &&
@@ -2465,6 +2502,8 @@ static void summary_set_row_marks(SummaryView *summaryview, GtkCTreeNode *row)
        } else {
                gtk_ctree_node_set_text(ctree, row, S_COL_MIME, NULL);
        }
+        if (!style)
+               style = small_style;
 
        gtk_ctree_node_set_row_style(ctree, row, style);
 }