Re: colors in mailbox-list
- From: Darko Obradovic <dobradovic gmx de>
- To: balsa-list gnome org
- Subject: Re: colors in mailbox-list
- Date: Fri, 1 Aug 2003 16:20:46 +0200
Am 28.07.2003 15:27 schrieb(en) Peter Bloomfield:
> On 07/21/2003, Darko Obradovic wrote:
>> running into the first problem:
>>
>> in "src/balsa-index.c" there is a function "bndx_set_style[_func]".
>> it is supposed to change the style for unread nodes, but I can't
>> see where the attribute for "bold/normal" is set. I only see the
>> color, and that's what I would like to remove, but obviously it's
>> the only function to touch styles, and so it has to change that
>> attribute as well I'm afraid. But how?
>
> Apparently, only the color is set, not the weight. You'd need to
> replace the gtk_tree_store_set to BNDX_COLOR_COLUMN with one to
> BNDX_WEIGHT_COLUMN, as in bndx_set_col_images().
I have my patch nearly finished (see attachment), but there's this one
issue left with it. This change of the color only is done for messages
which are "read" themself, but contain unread children which can't be
seen due to the tree being collapsed (read that twice if needed *g*).
That's at least what the code should do IMHO, but I don't have colors
in balsa anymore. Does it really behave that way? Does it make sense?
Current behaviour (assuming):
- unread message is bold, no color
- read message is normally weighted, no color
- read message containing unread children in an expanded subtree:
normally weighted, no color, just like a normal unread message
- read message containing unread children in a collapsed subtree:
normally weighted, in "unread" color
So I'm not sure how to handle that last case with only "bold/normal
weight" as indicator. Apart from that I doubt that the current
behaviour is consistent with anything. ;)
Could be I totally misunderstood the code, I've never seen case 4 in
action as I never have collapsed threads.
Darko Obradovic
diff -urN balsa-2.0.13/src/balsa-app.c balsa-2.0.13-no_unread_color/src/balsa-app.c
--- balsa-2.0.13/src/balsa-app.c 2003-07-16 09:18:01.000000000 +0200
+++ balsa-2.0.13-no_unread_color/src/balsa-app.c 2003-07-31 16:39:40.000000000 +0200
@@ -380,8 +380,6 @@
balsa_app.visual = gdk_visual_get_best();
balsa_app.colormap = gdk_colormap_new(balsa_app.visual, TRUE);
- gdk_color_parse(MBLIST_UNREAD_COLOR, &balsa_app.mblist_unread_color);
-
/* arp */
balsa_app.quote_str = NULL;
diff -urN balsa-2.0.13/src/balsa-app.h balsa-2.0.13-no_unread_color/src/balsa-app.h
--- balsa-2.0.13/src/balsa-app.h 2003-07-27 20:25:29.000000000 +0200
+++ balsa-2.0.13-no_unread_color/src/balsa-app.h 2003-07-31 16:38:21.000000000 +0200
@@ -68,9 +68,6 @@
#define TOTALMSGCOUNT_DEFAULT_WIDTH 45
#define INFO_FIELD_LENGTH 10
-/* Default colour for mailboxes with unread messages */
-#define MBLIST_UNREAD_COLOR "dark green"
-
/*
* Default colour for quoted text
* oh no, I used the US spelling.
@@ -254,10 +251,9 @@
gint mblist_newmsg_width;
gint mblist_totalmsg_width;
- /* Colour of mailboxes with unread messages in mailbox list */
+ /* colors */
GdkVisual *visual;
GdkColormap *colormap;
- GdkColor mblist_unread_color;
/* Colour of quoted text. */
gchar *quote_regex;
diff -urN balsa-2.0.13/src/balsa-index.c balsa-2.0.13-no_unread_color/src/balsa-index.c
--- balsa-2.0.13/src/balsa-index.c 2003-07-23 09:08:28.000000000 +0200
+++ balsa-2.0.13-no_unread_color/src/balsa-index.c 2003-07-31 18:53:09.000000000 +0200
@@ -377,8 +377,6 @@
gtk_tree_view_column_new_with_attributes(_("Subject"), renderer,
"text",
BNDX_SUBJECT_COLUMN,
- "foreground-gdk",
- BNDX_COLOR_COLUMN,
"weight",
BNDX_WEIGHT_COLUMN,
NULL);
@@ -1329,6 +1327,8 @@
- Consider storing styles locally, with or config setting
separate from the "mailbox" one. */
+ /* FIXME-NO_UNREAD_COLOR: where is weight getting set, if not here? */
+ /* disabling to see if weight gets changed without this...
if (!gtk_tree_view_row_expanded(tree_view, path)
&& thread_has_unread(index, iter)) {
gtk_tree_store_set(store, iter,
@@ -1338,6 +1338,7 @@
gtk_tree_store_set(store, iter,
BNDX_COLOR_COLUMN, NULL,
-1);
+ */
return FALSE;
}
@@ -2354,7 +2355,6 @@
GtkTreeIter old_iter;
gchar *num, *from, *subject, *date, *size;
GdkPixbuf *status, *attach;
- GdkColor *color;
PangoWeight weight;
GtkTreeIter new_iter;
@@ -2372,7 +2372,6 @@
BNDX_SUBJECT_COLUMN, &subject,
BNDX_DATE_COLUMN, &date,
BNDX_SIZE_COLUMN, &size,
- BNDX_COLOR_COLUMN, &color,
BNDX_WEIGHT_COLUMN, &weight, -1);
gtk_tree_store_append(GTK_TREE_STORE(model), &new_iter, parent_iter);
@@ -2386,7 +2385,6 @@
BNDX_SUBJECT_COLUMN, subject,
BNDX_DATE_COLUMN, date,
BNDX_SIZE_COLUMN, size,
- BNDX_COLOR_COLUMN, color,
BNDX_WEIGHT_COLUMN, weight, -1);
g_free(num);
if (status)
@@ -2397,8 +2395,6 @@
g_free(subject);
g_free(date);
g_free(size);
- if (color)
- gdk_color_free(color);
path = gtk_tree_model_get_path(model, &new_iter);
g_hash_table_replace(index->ref_table, message,
@@ -2490,7 +2486,6 @@
BNDX_SUBJECT_COLUMN, subject,
BNDX_DATE_COLUMN, date,
BNDX_SIZE_COLUMN, size,
- BNDX_COLOR_COLUMN, NULL,
BNDX_WEIGHT_COLUMN, PANGO_WEIGHT_NORMAL,
-1);
g_free(num);
@@ -2720,7 +2715,6 @@
G_TYPE_STRING, /* BNDX_SUBJECT_COLUMN */
G_TYPE_STRING, /* BNDX_DATE_COLUMN */
G_TYPE_STRING, /* BNDX_SIZE_COLUMN */
- GDK_TYPE_COLOR, /* BNDX_COLOR_COLUMN */
PANGO_TYPE_WEIGHT /* BNDX_WEIGHT_COLUMN */
);
gtk_tree_view_set_model(tree_view, GTK_TREE_MODEL(tree_store));
diff -urN balsa-2.0.13/src/balsa-index.h balsa-2.0.13-no_unread_color/src/balsa-index.h
--- balsa-2.0.13/src/balsa-index.h 2003-07-21 09:55:36.000000000 +0200
+++ balsa-2.0.13-no_unread_color/src/balsa-index.h 2003-07-31 18:43:56.000000000 +0200
@@ -91,7 +91,6 @@
BNDX_SUBJECT_COLUMN,
BNDX_DATE_COLUMN,
BNDX_SIZE_COLUMN,
- BNDX_COLOR_COLUMN,
BNDX_WEIGHT_COLUMN,
BNDX_N_COLUMNS
};
diff -urN balsa-2.0.13/src/balsa-mblist.c balsa-2.0.13-no_unread_color/src/balsa-mblist.c
--- balsa-2.0.13/src/balsa-mblist.c 2003-07-18 10:06:28.000000000 +0200
+++ balsa-2.0.13-no_unread_color/src/balsa-mblist.c 2003-07-31 17:06:37.000000000 +0200
@@ -61,7 +61,6 @@
MBNODE_COLUMN = 0, /* we use 0 in other code */
ICON_COLUMN,
NAME_COLUMN,
- COLOR_COLUMN,
WEIGHT_COLUMN,
UNREAD_COLUMN,
TOTAL_COLUMN,
@@ -156,7 +155,6 @@
static gboolean bmbl_find_data_func(GtkTreeModel * model,
GtkTreePath * path,
GtkTreeIter * iter, gpointer data);
-static void bmbl_mbnode_tab_style(BalsaMailboxNode * mbnode, gint unread);
static void bmbl_node_style(GtkTreeModel * model, GtkTreeIter * iter);
static gint bmbl_core_mailbox(LibBalsaMailbox * mailbox);
static void bmbl_do_popup(GtkTreeView * tree_view, GtkTreePath * path,
@@ -341,7 +339,6 @@
gtk_tree_view_column_pack_start(column, renderer, FALSE);
gtk_tree_view_column_set_attributes(column, renderer,
"text", NAME_COLUMN,
- "foreground-gdk", COLOR_COLUMN,
"weight", WEIGHT_COLUMN,
NULL);
gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_FIXED);
@@ -458,7 +455,6 @@
G_TYPE_POINTER, /* MBNODE_COLUMN */
GDK_TYPE_PIXBUF, /* ICON_COLUMN */
G_TYPE_STRING, /* NAME_COLUMN */
- GDK_TYPE_COLOR, /* COLOR_COLUMN */
PANGO_TYPE_WEIGHT, /* WEIGHT_COLUMN */
G_TYPE_STRING, /* UNREAD_COLUMN */
G_TYPE_STRING /* TOTAL_COLUMN */
@@ -1248,7 +1244,6 @@
(GTK_WIDGET(balsa_app.main_window), in,
GTK_ICON_SIZE_MENU, NULL),
NAME_COLUMN, name,
- COLOR_COLUMN, NULL,
WEIGHT_COLUMN, PANGO_WEIGHT_NORMAL,
UNREAD_COLUMN, "",
TOTAL_COLUMN, "",
@@ -1375,14 +1370,12 @@
/* set as unread, even if it already was */
mbnode->style |= MBNODE_STYLE_NEW_MAIL;
gtk_tree_store_set(GTK_TREE_STORE(model), iter,
- COLOR_COLUMN, &balsa_app.mblist_unread_color,
WEIGHT_COLUMN, PANGO_WEIGHT_BOLD,
-1);
} else if (mbnode->style & MBNODE_STYLE_NEW_MAIL) {
/* reset to the vanilla style */
mbnode->style &= ~MBNODE_STYLE_NEW_MAIL;
gtk_tree_store_set(GTK_TREE_STORE(model), iter,
- COLOR_COLUMN, NULL,
WEIGHT_COLUMN, PANGO_WEIGHT_NORMAL,
-1);
}
@@ -1440,49 +1433,6 @@
balsa_mblist_set_status_bar(mailbox);
}
-static void
-bmbl_mbnode_tab_style(BalsaMailboxNode *mbnode, gint unread)
-{
- BalsaIndex *index;
- GtkWidget *label;
- GList *l, *list;
- static GdkColor init_color = { 0, 0, 0, 0, };
-
- index = balsa_find_index_by_mailbox(mbnode->mailbox);
- if (index == NULL)
- return;
-
- label = gtk_notebook_get_tab_label(GTK_NOTEBOOK
- (balsa_app.main_window->notebook),
- gtk_widget_get_parent(GTK_WIDGET
- (index)));
-
- list = gtk_container_get_children(GTK_CONTAINER (label));
-
- for (l = list; l; l = l->next) {
- /* skip anything that isn't a text label */
- if (!(GTK_IS_LABEL(l->data)))
- continue;
-
- gtk_widget_modify_fg(GTK_WIDGET(l->data),
- GTK_STATE_NORMAL,
- unread ? &balsa_app.mblist_unread_color
- /* FIXME: gtk_widget_modify_fg is documented
- * as accepting NULL for the color, meaning
- * undo the effect of previous calls, but
- * this is currently not implemented
- * : NULL);
- */
- : &init_color);
-
- break;
- }
- g_list_free(list);
-
- return;
-}
-
-
/* bmbl_node_style [MBG]
*
* model: The model containing the mailbox
@@ -1511,6 +1461,7 @@
/* set the style of the unread maibox list, even if it's already
* set... in case the user has changed the colour or font since the
* last style update */
+ /* FIXME: is this really needed since colors are gone? */
icon = BALSA_PIXMAP_MBOX_TRAY_FULL;
gtk_tree_store_set(GTK_TREE_STORE(model), iter,
ICON_COLUMN,
@@ -1518,13 +1469,8 @@
(GTK_WIDGET(balsa_app.main_window),
BALSA_PIXMAP_MBOX_TRAY_FULL,
GTK_ICON_SIZE_MENU, NULL),
- COLOR_COLUMN,
- &balsa_app.mblist_unread_color,
WEIGHT_COLUMN, PANGO_WEIGHT_BOLD, -1);
- /* update the notebook label */
- bmbl_mbnode_tab_style(mbnode, 1);
-
mbnode->style |= MBNODE_STYLE_NEW_MAIL;
/* If we have a count of the unread messages, and we are showing
@@ -1553,9 +1499,7 @@
gtk_widget_render_icon
(GTK_WIDGET(balsa_app.main_window),
icon, GTK_ICON_SIZE_MENU, NULL),
- COLOR_COLUMN, NULL,
WEIGHT_COLUMN, PANGO_WEIGHT_NORMAL, -1);
- bmbl_mbnode_tab_style(mbnode, 0);
mbnode->style &= ~MBNODE_STYLE_NEW_MAIL;
}
diff -urN balsa-2.0.13/src/pref-manager.c balsa-2.0.13-no_unread_color/src/pref-manager.c
--- balsa-2.0.13/src/pref-manager.c 2003-07-27 20:25:29.000000000 +0200
+++ balsa-2.0.13-no_unread_color/src/pref-manager.c 2003-07-31 16:57:43.000000000 +0200
@@ -135,7 +135,6 @@
GtkWidget *message_title_format;
/* colours */
- GtkWidget *unread_color;
GtkWidget *quoted_color[MAX_QUOTED_COLOR];
GtkWidget *url_color;
GtkWidget *bad_address_color;
@@ -621,9 +620,6 @@
G_CALLBACK(properties_modified_cb), property_box);
/* Colour */
- g_signal_connect(G_OBJECT(pui->unread_color), "released",
- G_CALLBACK(properties_modified_cb), property_box);
-
for(i=0;i<MAX_QUOTED_COLOR;i++)
g_signal_connect(G_OBJECT(pui->quoted_color[i]), "released",
G_CALLBACK(properties_modified_cb), property_box);
@@ -889,15 +885,6 @@
gtk_editable_get_chars(GTK_EDITABLE(pui->message_title_format),
0, -1);
- /* unread mailbox color */
- gdk_colormap_free_colors(gdk_drawable_get_colormap
- (GTK_WIDGET(pbox)->window),
- &balsa_app.mblist_unread_color, 1);
- gnome_color_picker_get_i16(GNOME_COLOR_PICKER(pui->unread_color),
- &(balsa_app.mblist_unread_color.red),
- &(balsa_app.mblist_unread_color.green),
- &(balsa_app.mblist_unread_color.blue), 0);
-
/* quoted text color */
for(i=0;i<MAX_QUOTED_COLOR;i++) {
gdk_colormap_free_colors(gdk_drawable_get_colormap
@@ -1192,11 +1179,6 @@
balsa_app.message_title_format);
/* Colour */
- gnome_color_picker_set_i16(GNOME_COLOR_PICKER(pui->unread_color),
- balsa_app.mblist_unread_color.red,
- balsa_app.mblist_unread_color.green,
- balsa_app.mblist_unread_color.blue, 0);
-
for(i=0;i<MAX_QUOTED_COLOR;i++)
gnome_color_picker_set_i16(GNOME_COLOR_PICKER(pui->quoted_color[i]),
balsa_app.quoted_color[i].red,
@@ -2162,7 +2144,6 @@
{
GtkWidget *page = pm_page_new();
- pm_page_add(page, mailbox_colors_group(page));
pm_page_add(page, message_colors_group(page));
pm_page_add(page, link_color_group(page));
pm_page_add(page, composition_window_group(page));
@@ -2171,19 +2152,6 @@
}
static GtkWidget *
-mailbox_colors_group(GtkWidget * page)
-{
- GtkWidget *group;
-
- group = pm_group_new(_("Mailbox Colors"));
- pui->unread_color =
- color_box(GTK_BOX(pm_group_get_vbox(group)),
- _("Mailbox with unread messages color"));
-
- return group;
-}
-
-static GtkWidget *
message_colors_group(GtkWidget * page)
{
GtkWidget *group;
diff -urN balsa-2.0.13/src/save-restore.c balsa-2.0.13-no_unread_color/src/save-restore.c
--- balsa-2.0.13/src/save-restore.c 2003-07-27 20:25:30.000000000 +0200
+++ balsa-2.0.13-no_unread_color/src/save-restore.c 2003-07-31 16:59:35.000000000 +0200
@@ -816,9 +816,6 @@
/* Mailbox checking ... */
gnome_config_push_prefix(BALSA_CONFIG_PREFIX "MailboxList/");
- /* ... color */
- load_color("UnreadColor=" MBLIST_UNREAD_COLOR,
- &balsa_app.mblist_unread_color);
/* ... show mailbox content info */
balsa_app.mblist_show_mb_content_info =
gnome_config_get_bool("ShowMailboxContentInfo=true");
@@ -1174,7 +1171,6 @@
/* Mailbox list options */
gnome_config_push_prefix(BALSA_CONFIG_PREFIX "MailboxList/");
- save_color("UnreadColor", &balsa_app.mblist_unread_color);
gnome_config_set_bool("ShowMailboxContentInfo",
balsa_app.mblist_show_mb_content_info);
PGP signature
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]