From 984f8343ca6c37446c5721a621e4ce31bc8f27d4 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 29 Mar 2002 23:02:23 +0000 Subject: Restore the labels & colours options from the grave. 2002-03-29 Jeffrey Stedfast * mail-preferences.c (mail_preferences_construct): Restore the labels & colours options from the grave. (mail_preferences_apply): Save these labels & colours options. svn path=/trunk/; revision=16296 --- mail/mail-composer-prefs.c | 1 + mail/mail-config.glade | 290 +++++++++++++++++++++++++++++++++++++++++++++ mail/mail-preferences.c | 55 ++++++++- mail/mail-preferences.h | 7 ++ 4 files changed, 350 insertions(+), 3 deletions(-) (limited to 'mail') diff --git a/mail/mail-composer-prefs.c b/mail/mail-composer-prefs.c index 9b20e2fe77..6b1c703038 100644 --- a/mail/mail-composer-prefs.c +++ b/mail/mail-composer-prefs.c @@ -203,6 +203,7 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs) option_menu_connect (prefs->charset, prefs); /* Spell Checking */ + /* FIXME: do stuff with these */ prefs->spell_check = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEnableSpellChecking")); prefs->colour = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerSpellCheckColor")); prefs->language = GTK_COMBO (glade_xml_get_widget (gui, "cmboSpellCheckLanguage")); diff --git a/mail/mail-config.glade b/mail/mail-config.glade index 2994e69a90..c93f43605e 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -5078,6 +5078,296 @@ Baltic (ISO-8859-4) 0 0 + + + GtkFrame + frameColours + 4 + + 0 + GTK_SHADOW_ETCHED_IN + + + GtkTable + tableColours + 4 + 6 + 3 + False + 4 + 4 + + + GnomeColorPicker + colorLabel0 + True + True + False + Pick a color + + 1 + 2 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GnomeColorPicker + colorLabel1 + True + True + False + Pick a color + + 1 + 2 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GnomeColorPicker + colorLabel2 + True + True + False + Pick a color + + 1 + 2 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GnomeColorPicker + colorLabel3 + True + True + False + Pick a color + + 1 + 2 + 3 + 4 + 0 + 0 + False + False + False + False + True + False + + + + + GnomeColorPicker + colorLabel4 + True + True + False + Pick a color + + 1 + 2 + 4 + 5 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + txtLabel0 + True + True + True + 0 + Important + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + txtLabel1 + True + True + True + 0 + Work + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + txtLabel3 + True + True + True + 0 + Personal + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + txtLabel4 + True + True + True + 0 + To Do + + 0 + 1 + 3 + 4 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + txtLabel4 + True + True + True + 0 + Later + + 0 + 1 + 4 + 5 + 0 + 0 + False + False + False + False + True + False + + + + + GtkButton + cmdRestoreLabels + True + + GTK_RELIEF_NORMAL + + 2 + 3 + 5 + 6 + 0 + 0 + False + False + False + False + True + False + + + + + + + GtkLabel + Notebook:tab + lblColours + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + diff --git a/mail/mail-preferences.c b/mail/mail-preferences.c index 6a964c57ef..ac1e3fc4b4 100644 --- a/mail/mail-preferences.c +++ b/mail/mail-preferences.c @@ -27,6 +27,8 @@ #include "mail-preferences.h" +#include +#include #include #include "widgets/misc/e-charset-picker.h" @@ -147,6 +149,18 @@ color_set (GtkWidget *widget, guint r, guint g, guint b, guint a, gpointer user_ evolution_config_control_changed (prefs->control); } +static void +restore_labels_clicked (GtkWidget *widget, gpointer user_data) +{ + MailPreferences *prefs = (MailPreferences *) user_data; + int i; + + for (i = 0; i < 5; i++) { + e_utf8_gtk_entry_set_text (prefs->labels[i].name, U_(label_defaults[i].name)); + colorpicker_set_color (prefs->labels[i].color, label_defaults[i].color); + } +} + static void menu_changed (GtkWidget *widget, gpointer user_data) { @@ -179,6 +193,7 @@ mail_preferences_construct (MailPreferences *prefs) GtkWidget *toplevel, *menu; const char *text; GladeXML *gui; + int i; gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "preferences_tab"); prefs->gui = gui; @@ -273,7 +288,7 @@ mail_preferences_construct (MailPreferences *prefs) gtk_signal_connect (GTK_OBJECT (prefs->images_always), "toggled", toggle_button_toggled, prefs); - /* ... */ + /* Some GtkHTML settings */ /* FIXME: use the gtkhtml interfaces for these settings when lewing gets around to adding them */ prefs->show_animated = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkShowAnimatedImages")); gtk_toggle_button_set_active (prefs->show_animated, @@ -287,6 +302,7 @@ mail_preferences_construct (MailPreferences *prefs) gtk_signal_connect (GTK_OBJECT (prefs->autodetect_links), "toggled", toggle_button_toggled, prefs); + prefs->prompt_unwanted_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptWantHTML")); gtk_toggle_button_set_active (prefs->prompt_unwanted_html, mail_config_get_confirm_unwanted_html ()); gtk_signal_connect (GTK_OBJECT (prefs->prompt_unwanted_html), "toggled", @@ -302,7 +318,28 @@ mail_preferences_construct (MailPreferences *prefs) gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (prefs->pgp_path)), "changed", entry_changed, prefs); - /* FIXME: what about a label colour tab? */ + /* Labels and Colours tab */ + for (i = 0; i < 5; i++) { + char *widget_name; + + widget_name = g_strdup_printf ("txtLabel%d", i); + prefs->labels[i].name = GTK_ENTRY (glade_xml_get_widget (gui, widget_name)); + g_free (widget_name); + text = mail_config_get_label_name (i); + e_utf8_gtk_entry_set_text (prefs->labels[i].name, text ? text : ""); + gtk_signal_connect (GTK_OBJECT (prefs->labels[i].name), "changed", + entry_changed, prefs); + + widget_name = g_strdup_printf ("colorLabel%d", i); + prefs->labels[i].color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, widget_name)); + g_free (widget_name); + colorpicker_set_color (prefs->labels[i].color, mail_config_get_label_color (i)); + gtk_signal_connect (GTK_OBJECT (prefs->labels[i].color), "color_set", + color_set, prefs); + } + prefs->restore_labels = GTK_BUTTON (glade_xml_get_widget (gui, "cmdRestoreLabels")); + gtk_signal_connect (GTK_OBJECT (prefs->restore_labels), "clicked", + restore_labels_clicked, prefs); } @@ -325,7 +362,7 @@ mail_preferences_apply (MailPreferences *prefs) CamelPgpType type; char *string; guint32 rgb; - int val; + int i, val; /* General tab */ @@ -387,4 +424,16 @@ mail_preferences_apply (MailPreferences *prefs) type = string && *string ? mail_config_pgp_type_detect_from_path (string) : CAMEL_PGP_TYPE_NONE; mail_config_set_pgp_path (string && *string ? string : NULL); mail_config_set_pgp_type (type); + + /* Labels and Colours */ + for (i = 0; i < 5; i++) { + /* save the label... */ + string = e_utf8_gtk_entry_get_text (prefs->labels[i].name); + mail_config_set_label_name (i, string); + g_free (string); + + /* save the colour... */ + rgb = colorpicker_get_color (prefs->labels[i].color); + mail_config_set_label_color (i, rgb); + } } diff --git a/mail/mail-preferences.h b/mail/mail-preferences.h index 916fcb4d1f..8403bdb719 100644 --- a/mail/mail-preferences.h +++ b/mail/mail-preferences.h @@ -92,6 +92,13 @@ struct _MailPreferences { /* Security tab */ GnomeFileEntry *pgp_path; + + /* Labels and Colours tab */ + struct { + GtkEntry *name; + GnomeColorPicker *color; + } labels[5]; + GtkButton *restore_labels; }; struct _MailPreferencesClass { -- cgit