diff options
author | Larry Ewing <lewing@ximian.com> | 2003-04-09 17:52:32 +0800 |
---|---|---|
committer | Larry Ewing <lewing@src.gnome.org> | 2003-04-09 17:52:32 +0800 |
commit | 60ba84e6a404f0553479b546234cb9d1ddec73ba (patch) | |
tree | 109b6691f9804f856bfd31f5e43450144473c144 /mail | |
parent | 1034abae465596ec3fca34910c772eaef569287f (diff) | |
download | gsoc2013-evolution-60ba84e6a404f0553479b546234cb9d1ddec73ba.tar.gz gsoc2013-evolution-60ba84e6a404f0553479b546234cb9d1ddec73ba.tar.zst gsoc2013-evolution-60ba84e6a404f0553479b546234cb9d1ddec73ba.zip |
set sensitivity of font pickers based on share setting.
2003-04-09 Larry Ewing <lewing@ximian.com>
* mail-preferences.c (font_share_changed): set sensitivity of
font pickers based on share setting.
(mail_preferences_construct): initialize font prefs.
(mail_preferences_apply): set the font prefs.
(font_changed): add gnome-font-picker changed function.
* mail-preferences.h: add font pref widgets.
* mail-config.c (mail_config_init): add notify to on fonts dir.
(config_write_fonts): write out a gtkrc that overrides the gtkhtml
fonts settings based on the gconf keys.
* mail-config.glade: move display font setttings to mail prefs.
* evolution-mail.schemas: add font settings.
svn path=/trunk/; revision=20779
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 18 | ||||
-rw-r--r-- | mail/evolution-mail.schemas | 40 | ||||
-rw-r--r-- | mail/mail-config.c | 74 | ||||
-rw-r--r-- | mail/mail-config.glade | 307 | ||||
-rw-r--r-- | mail/mail-preferences.c | 74 | ||||
-rw-r--r-- | mail/mail-preferences.h | 4 |
6 files changed, 356 insertions, 161 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index a1c03ee6d8..e0d1e3d11b 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,21 @@ +2003-04-09 Larry Ewing <lewing@ximian.com> + + * mail-preferences.c (font_share_changed): set sensitivity of + font pickers based on share setting. + (mail_preferences_construct): initialize font prefs. + (mail_preferences_apply): set the font prefs. + (font_changed): add gnome-font-picker changed function. + + * mail-preferences.h: add font pref widgets. + + * mail-config.c (mail_config_init): add notify to on fonts dir. + (config_write_fonts): write out a gtkrc that overrides the gtkhtml + fonts settings based on the gconf keys. + + * mail-config.glade: move display font setttings to mail prefs. + + * evolution-mail.schemas: add font settings. + 2003-04-08 Jeffrey Stedfast <fejj@ximian.com> * mail-callbacks.c (do_view_message): Add a check for a NULL uid diff --git a/mail/evolution-mail.schemas b/mail/evolution-mail.schemas index 2bc9aeda19..569db01947 100644 --- a/mail/evolution-mail.schemas +++ b/mail/evolution-mail.schemas @@ -233,6 +233,46 @@ </schema> <schema> + <key>/schemas/apps/evolution/mail/display/fonts/variable/</key> + <applyto>/apps/evolution/mail/display/fonts/variable</applyto> + <owner>evolution-mail</owner> + <type>string</type> + <locale name="C"> + <short>Variable width font</short> + <long> + The variable width font for mail display + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/mail/display/fonts/monospace</key> + <applyto>/apps/evolution/mail/display/fonts/monospace</applyto> + <owner>evolution-mail</owner> + <type>string</type> + <locale name="C"> + <short>Terminal font</short> + <long> + The terminal font for mail display + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/mail/display/fonts/use_custom</key> + <applyto>/apps/evolution/mail/display/fonts/use_custom</applyto> + <owner>evolution-mail</owner> + <type>bool</type> + <default>144</default> + <locale name="C"> + <short>Use custom fonts</short> + <long> + Use custom fonts for displaying mail + </long> + </locale> + </schema> + + <schema> <key>/schemas/apps/evolution/mail/display/thread_list</key> <applyto>/apps/evolution/mail/display/thread_list</applyto> <owner>evolution-mail</owner> diff --git a/mail/mail-config.c b/mail/mail-config.c index 71758dc3bc..e66ede44f6 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -85,12 +85,14 @@ typedef struct { GSList *labels; guint label_notify_id; + guint font_notify_id; } MailConfig; static MailConfig *config = NULL; static guint config_write_timeout = 0; #define MAIL_CONFIG_IID "OAFIID:GNOME_Evolution_MailConfig_Factory" +#define MAIL_CONFIG_RC "/gtkrc-mail-fonts" /* signatures */ MailConfigSignature * @@ -393,6 +395,52 @@ config_cache_labels (void) } static void +config_write_fonts (void) +{ + char *filename; + FILE *rc; + gboolean custom; + char *fix_font; + char *var_font; + + if (!evolution_dir) { + g_warning ("evolution_dir empty", filename); + return; + } + + filename = g_build_filename (evolution_dir, MAIL_CONFIG_RC, NULL); + rc = fopen (filename, "w"); + + if (!rc) { + g_warning ("unable to open %s", filename); + g_free (filename); + return; + } + g_free (filename); + + custom = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/fonts/use_custom", NULL); + var_font = gconf_client_get_string (config->gconf, "/apps/evolution/mail/display/fonts/variable", NULL); + fix_font = gconf_client_get_string (config->gconf, "/apps/evolution/mail/display/fonts/monospace", NULL); + + + fprintf (rc, "style \"evolution-mail-custom-fonts\" {\n"); + if (custom && var_font && fix_font) { + fprintf (rc, + " GtkHTML::fixed_font_name = \"%s\"\n" + " font_name = \"%s\"\n", + fix_font, var_font); + } + fprintf (rc, "}\n\n"); + + fprintf (rc, "widget \"*.MailDisplay.*.GtkHTML\" style \"evolution-mail-custom-fonts\"\n"); + fprintf (rc, "widget \"*.FolderBrowser.*.GtkHTML.\" style \"evolution-mail-custom-fonts\"\n"); + + if (fclose (rc) == 0) + gtk_rc_reparse_all (); + +} + +static void gconf_labels_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) { @@ -400,10 +448,18 @@ gconf_labels_changed (GConfClient *client, guint cnxn_id, config_cache_labels (); } +static void +gconf_fonts_changed (GConfClient *client, guint cnxn_id, + GConfEntry *entry, gpointer user_data) +{ + config_write_fonts (); +} + /* Config struct routines */ void mail_config_init (void) { + char *filename; if (config) return; @@ -411,13 +467,27 @@ mail_config_init (void) config->gconf = gconf_client_get_default (); mail_config_clear (); - + + /* + config_write_fonts (); + filename = g_build_filename (evolution_dir, MAIL_CONFIG_RC, NULL); + */ + filename = g_build_filename (g_get_home_dir (), "/evolution", MAIL_CONFIG_RC, NULL); + gtk_rc_parse (filename); + g_free (filename); + + gconf_client_add_dir (config->gconf, "/apps/evolution/mail/display/fonts", + GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); + config->font_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/display/fonts", + gconf_fonts_changed, NULL, NULL, NULL); + + gconf_client_add_dir (config->gconf, "/apps/evolution/mail/labels", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); config->label_notify_id = gconf_client_notify_add (config->gconf, "/apps/evolution/mail/labels", gconf_labels_changed, NULL, NULL, NULL); - + config_cache_labels (); config_read_signatures (); diff --git a/mail/mail-config.glade b/mail/mail-config.glade index cfd7abd6f7..dce4679adb 100644 --- a/mail/mail-config.glade +++ b/mail/mail-config.glade @@ -3068,6 +3068,174 @@ For example: "Work" or "Personal"</property> <property name="spacing">3</property> <child> + <widget class="GtkFrame" id="frame3"> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> + + <child> + <widget class="GtkVBox" id="vbox161"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkCheckButton" id="radFontUseSame"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_Use the same fonts as other applications</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkTable" id="tblScreen"> + <property name="border_width">4</property> + <property name="visible">True</property> + <property name="n_rows">2</property> + <property name="n_columns">2</property> + <property name="homogeneous">False</property> + <property name="row_spacing">4</property> + <property name="column_spacing">6</property> + + <child> + <widget class="GtkLabel" id="lblScreenVariable"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Standard Font:</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_RIGHT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="mnemonic_widget">radFontVariable</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GnomeFontPicker" id="radFontFixed"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="title" translatable="yes">Select HTML fixed width font</property> + <property name="mode">GNOME_FONT_PICKER_MODE_FONT_INFO</property> + <property name="show_size">True</property> + <property name="use_font_in_label">False</property> + <property name="label_font_size">14</property> + <signal name="font_set" handler="changed"/> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GnomeFontPicker" id="radFontVariable"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="title" translatable="yes">Select HTML variable width font</property> + <property name="mode">GNOME_FONT_PICKER_MODE_FONT_INFO</property> + <property name="show_size">True</property> + <property name="use_font_in_label">False</property> + <property name="label_font_size">14</property> + <signal name="font_set" handler="changed"/> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label444"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Terminal Font:</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_RIGHT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="mnemonic_widget">radFontFixed</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> + + <child> + <widget class="GtkLabel" id="label460"> + <property name="visible">True</property> + <property name="label" translatable="yes">Message Fonts</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="type">label_item</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> <widget class="GtkFrame" id="frameMessageDisplay"> <property name="visible">True</property> <property name="label_xalign">0</property> @@ -3403,8 +3571,8 @@ For example: "Work" or "Personal"</property> </widget> <packing> <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> + <property name="expand">True</property> + <property name="fill">True</property> </packing> </child> @@ -5131,140 +5299,7 @@ For example: "Work" or "Personal"</property> <property name="spacing">4</property> <child> - <widget class="GtkFrame" id="frame3"> - <property name="visible">True</property> - <property name="label_xalign">0</property> - <property name="label_yalign">0.5</property> - <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property> - - <child> - <widget class="GtkTable" id="tblScreen"> - <property name="border_width">4</property> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">4</property> - <property name="column_spacing">6</property> - - <child> - <widget class="GtkLabel" id="lblScreenVariable"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Variable-width:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">screen_variable</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label444"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Fixed-width:</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="mnemonic_widget">screen_fixed</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GnomeFontPicker" id="screen_fixed"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="title" translatable="yes">Select HTML fixed width font</property> - <property name="mode">GNOME_FONT_PICKER_MODE_FONT_INFO</property> - <property name="show_size">True</property> - <property name="use_font_in_label">False</property> - <property name="label_font_size">14</property> - <signal name="font_set" handler="changed"/> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - - <child> - <widget class="GnomeFontPicker" id="screen_variable"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="title" translatable="yes">Select HTML variable width font</property> - <property name="mode">GNOME_FONT_PICKER_MODE_FONT_INFO</property> - <property name="show_size">True</property> - <property name="use_font_in_label">False</property> - <property name="label_font_size">14</property> - <signal name="font_set" handler="changed"/> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - <property name="y_options"></property> - </packing> - </child> - </widget> - </child> - - <child> - <widget class="GtkLabel" id="label460"> - <property name="visible">True</property> - <property name="label" translatable="yes">On Screen fonts</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">label_item</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> + <placeholder/> </child> <child> diff --git a/mail/mail-preferences.c b/mail/mail-preferences.c index 7fc9f19e6e..dad50e251a 100644 --- a/mail/mail-preferences.c +++ b/mail/mail-preferences.c @@ -136,6 +136,30 @@ settings_changed (GtkWidget *widget, gpointer user_data) } static void +font_share_changed (GtkWidget *w, gpointer user_data) +{ + MailPreferences *prefs = (MailPreferences *) user_data; + gboolean use_custom; + + use_custom = !gtk_toggle_button_get_active (prefs->font_share); + + gtk_widget_set_sensitive (GTK_WIDGET (prefs->font_fixed), use_custom); + gtk_widget_set_sensitive (GTK_WIDGET (prefs->font_variable), use_custom); + + if (prefs->control) + evolution_config_control_changed (prefs->control); +} + +static void +font_changed (GnomeFontPicker *fontpicker, gchar *arg1, gpointer user_data) +{ + MailPreferences *prefs = (MailPreferences *) user_data; + + if (prefs->control) + evolution_config_control_changed (prefs->control); +} + +static void color_set (GtkWidget *widget, guint r, guint g, guint b, guint a, gpointer user_data) { MailPreferences *prefs = (MailPreferences *) user_data; @@ -184,18 +208,13 @@ option_menu_connect (GtkOptionMenu *omenu, gpointer user_data) static void mail_preferences_construct (MailPreferences *prefs) { - GtkWidget *widget, *toplevel, *menu; - const char *text; - GSList *list, *l; + GtkWidget *toplevel, *menu; + GSList *list; GladeXML *gui; gboolean bool; + char *font; int i, val; char *buf; - char *names[][2] = { - { "anim_check", "chkShowAnimatedImages" }, - { "magic_links_check", "chkAutoDetectLinks" }, - { NULL, NULL } - }; gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "preferences_tab", NULL); prefs->gui = gui; @@ -272,6 +291,23 @@ mail_preferences_construct (MailPreferences *prefs) G_CALLBACK (settings_changed), prefs); g_free (buf); + /* Mail Fonts */ + font = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/fonts/monospace", NULL); + prefs->font_fixed = GNOME_FONT_PICKER (glade_xml_get_widget (gui, "radFontFixed")); + gnome_font_picker_set_font_name (prefs->font_fixed, font); + g_signal_connect (prefs->font_fixed, "font-set", G_CALLBACK (font_changed), prefs); + + font = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/fonts/variable", NULL); + prefs->font_variable = GNOME_FONT_PICKER (glade_xml_get_widget (gui, "radFontVariable")); + gnome_font_picker_set_font_name (prefs->font_variable, font); + g_signal_connect (prefs->font_variable, "font-set", G_CALLBACK (font_changed), prefs); + + bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/display/fonts/use_custom", NULL); + prefs->font_share = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radFontUseSame")); + gtk_toggle_button_set_active (prefs->font_share, !bool); + g_signal_connect (prefs->font_share, "toggled", G_CALLBACK (font_share_changed), prefs); + font_share_changed (GTK_WIDGET (prefs->font_share), prefs); + /* HTML Mail tab */ /* Loading Images */ @@ -288,20 +324,6 @@ mail_preferences_construct (MailPreferences *prefs) gtk_toggle_button_set_active (prefs->images_always, val == MAIL_CONFIG_HTTP_ALWAYS); g_signal_connect (prefs->images_always, "toggled", G_CALLBACK (settings_changed), prefs); -#warning "gtkhtml prop manager" -#if 0 - prefs->pman = GTK_HTML_PROPMANAGER (gtk_html_propmanager_new (prefs->gconf)); - g_signal_connect (prefs->pman, "changed", G_CALLBACK (settings_changed), prefs); - g_object_ref (prefs->pman); - - gtk_html_propmanager_set_names (prefs->pman, names); - gtk_html_propmanager_set_gui (prefs->pman, gui, NULL); - for (i = 0; names[i][0] != NULL; i++) { - widget = glade_xml_get_widget (gui, names[i][1]); - g_signal_connect (widget, "toggled", G_CALLBACK (settings_changed), prefs); - } -#endif - prefs->prompt_unwanted_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptWantHTML")); bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/prompts/unwanted_html", NULL); gtk_toggle_button_set_active (prefs->prompt_unwanted_html, bool); @@ -418,7 +440,13 @@ mail_preferences_apply (MailPreferences *prefs) #if 0 gtk_html_propmanager_apply (prefs->pman); #endif - + gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/display/fonts/variable", + gnome_font_picker_get_font_name (prefs->font_variable), NULL); + gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/display/fonts/monospace", + gnome_font_picker_get_font_name (prefs->font_fixed), NULL); + gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/display/fonts/use_custom", + !gtk_toggle_button_get_active (prefs->font_share), NULL); + gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/prompts/unwanted_html", gtk_toggle_button_get_active (prefs->prompt_unwanted_html), NULL); diff --git a/mail/mail-preferences.h b/mail/mail-preferences.h index 10cfc9fb67..210f1e3e15 100644 --- a/mail/mail-preferences.h +++ b/mail/mail-preferences.h @@ -34,6 +34,7 @@ extern "C" { #include <gconf/gconf-client.h> #include <libgnomeui/gnome-file-entry.h> #include <libgnomeui/gnome-color-picker.h> +#include <libgnomeui/gnome-font-picker.h> #warning "gtkhtml-propmanger" /*#include <gtkhtml/gtkhtml-propmanager.h>*/ @@ -81,6 +82,9 @@ struct _MailPreferences { GnomeFileEntry *notify_sound_file; /* HTML Mail tab */ + GnomeFontPicker *font_variable; + GnomeFontPicker *font_fixed; + GtkToggleButton *font_share; /* Loading Images */ GtkToggleButton *images_always; |