diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-05-17 04:56:36 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-05-17 04:56:36 +0800 |
commit | 3cedfae4c21b3e2cdd53a74208f38c0e9885055f (patch) | |
tree | 33a553001856816f86305966900de187721ddcb6 /mail/folder-browser.c | |
parent | 03c399c656ca3cc0d206d15e2f0d217f045d3ee2 (diff) | |
download | gsoc2013-evolution-3cedfae4c21b3e2cdd53a74208f38c0e9885055f.tar gsoc2013-evolution-3cedfae4c21b3e2cdd53a74208f38c0e9885055f.tar.gz gsoc2013-evolution-3cedfae4c21b3e2cdd53a74208f38c0e9885055f.tar.bz2 gsoc2013-evolution-3cedfae4c21b3e2cdd53a74208f38c0e9885055f.tar.lz gsoc2013-evolution-3cedfae4c21b3e2cdd53a74208f38c0e9885055f.tar.xz gsoc2013-evolution-3cedfae4c21b3e2cdd53a74208f38c0e9885055f.tar.zst gsoc2013-evolution-3cedfae4c21b3e2cdd53a74208f38c0e9885055f.zip |
Check for a label tag when doing a lookup on the COLOR column.
2002-05-16 Jeffrey Stedfast <fejj@ximian.com>
* message-list.c (ml_tree_value_at): Check for a label tag when
doing a lookup on the COLOR column.
* mail-config.c (mail_config_get_label_color_string): Return the
colour in string format.
* folder-browser.c (set_msg_label): Replaces colourise_msg and
sets the "label" tag rather than the "colour" tag.
* mail-preferences.c (mail_preferences_apply): Call
mail_config_write() so that the settings get synced to disk.
svn path=/trunk/; revision=16938
Diffstat (limited to 'mail/folder-browser.c')
-rw-r--r-- | mail/folder-browser.c | 100 |
1 files changed, 72 insertions, 28 deletions
diff --git a/mail/folder-browser.c b/mail/folder-browser.c index b5d87685eb..c79f74ec70 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -1528,6 +1528,7 @@ hide_sender(GtkWidget *w, FolderBrowser *fb) } } +#if 0 struct _colour_data { FolderBrowser *fb; guint32 rgb; @@ -1557,6 +1558,63 @@ colourise_msg (GtkWidget *widget, gpointer user_data) g_ptr_array_free (uids, TRUE); } +static void +colour_closures_free (GPtrArray *closures) +{ + struct _colour_data *data; + int i; + + for (i = 0; i < closures->len; i++) { + data = closures->pdata[i]; + gtk_object_unref (GTK_OBJECT (data->fb)); + g_free (data); + } + g_ptr_array_free (closures, TRUE); +} +#endif + +struct _label_data { + FolderBrowser *fb; + int label; +}; + +static void +set_msg_label (GtkWidget *widget, gpointer user_data) +{ + struct _label_data *data = user_data; + GPtrArray *uids; + char *label; + int i; + + if (data->label != -1) + label = g_strdup_printf ("%d", data->label); + else + label = NULL; + + uids = g_ptr_array_new (); + message_list_foreach (data->fb->message_list, enumerate_msg, uids); + for (i = 0; i < uids->len; i++) { + camel_folder_set_message_user_tag (data->fb->folder, uids->pdata[i], "label", label); + } + g_ptr_array_free (uids, TRUE); + + g_free (label); +} + +static void +label_closures_free (GPtrArray *closures) +{ + struct _label_data *data; + int i; + + for (i = 0; i < closures->len; i++) { + data = closures->pdata[i]; + gtk_object_unref (GTK_OBJECT (data->fb)); + g_free (data); + } + g_ptr_array_free (closures, TRUE); +} + enum { SELECTION_SET = 1<<1, @@ -1594,13 +1652,13 @@ static EPopupMenu filter_menu[] = { }; static EPopupMenu label_menu[] = { - E_POPUP_PIXMAP_WIDGET_ITEM_CC (N_("None"), NULL, GTK_SIGNAL_FUNC (colourise_msg), NULL, 0), + E_POPUP_PIXMAP_WIDGET_ITEM_CC (N_("None"), NULL, GTK_SIGNAL_FUNC (set_msg_label), NULL, 0), E_POPUP_SEPARATOR, - E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (colourise_msg), NULL, 0), - E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (colourise_msg), NULL, 0), - E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (colourise_msg), NULL, 0), - E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (colourise_msg), NULL, 0), - E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (colourise_msg), NULL, 0), + E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (set_msg_label), NULL, 0), + E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (set_msg_label), NULL, 0), + E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (set_msg_label), NULL, 0), + E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (set_msg_label), NULL, 0), + E_POPUP_PIXMAP_WIDGET_ITEM_CC (NULL, NULL, GTK_SIGNAL_FUNC (set_msg_label), NULL, 0), E_POPUP_TERMINATOR }; @@ -1742,20 +1800,6 @@ setup_popup_icons (void) } } -static void -colour_closures_free (GPtrArray *closures) -{ - struct _colour_data *data; - int i; - - for (i = 0; i < closures->len; i++) { - data = closures->pdata[i]; - gtk_object_unref (GTK_OBJECT (data->fb)); - g_free (data); - } - g_ptr_array_free (closures, TRUE); -} - /* handle context menu over message-list */ static int on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, FolderBrowser *fb) @@ -1941,14 +1985,14 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event /* create the label/colour menu */ closures = g_ptr_array_new (); - label_menu[0].closure = g_new (struct _colour_data, 1); + label_menu[0].closure = g_new (struct _label_data, 1); g_ptr_array_add (closures, label_menu[0].closure); gtk_object_ref (GTK_OBJECT (fb)); - ((struct _colour_data *) label_menu[0].closure)->fb = fb; - ((struct _colour_data *) label_menu[0].closure)->rgb = COLOUR_NONE; + ((struct _label_data *) label_menu[0].closure)->fb = fb; + ((struct _label_data *) label_menu[0].closure)->label = -1; for (i = 0; i < 5; i++) { - struct _colour_data *closure; + struct _label_data *closure; GdkPixmap *pixmap; GdkColormap *map; GdkColor color; @@ -1970,10 +2014,10 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event gdk_draw_rectangle (pixmap, gc, TRUE, 0, 0, 16, 16); gdk_gc_unref (gc); - closure = g_new (struct _colour_data, 1); + closure = g_new (struct _label_data, 1); gtk_object_ref (GTK_OBJECT (fb)); closure->fb = fb; - closure->rgb = rgb; + closure->label = i; g_ptr_array_add (closures, closure); @@ -1990,8 +2034,8 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event menu = e_popup_menu_create (context_menu, enable_mask, hide_mask, fb); e_auto_kill_popup_menu_on_hide (menu); - gtk_object_set_data_full (GTK_OBJECT (menu), "colour_closures", - closures, (GtkDestroyNotify) colour_closures_free); + gtk_object_set_data_full (GTK_OBJECT (menu), "label_closures", + closures, (GtkDestroyNotify) label_closures_free); if (fdata) gtk_object_set_data_full (GTK_OBJECT (menu), "filter_data", |