From aea82dfd606493e4a65f1088e631fe394746d8f0 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 28 Apr 2003 16:00:47 +0000 Subject: Made toplevel container widgets set a border-width (including toplevel 2003-04-25 Jeffrey Stedfast * mail-config.glade: Made toplevel container widgets set a border-width (including toplevel widgets within frames), set the table/hbox/vbox spacings, set the spacing between an image and the description text in hboxes to 12pts (as suggested by the HIG), Changed Add/Delete buttons to the stock Add/Remove buttons, etc 2003-04-24 Jeffrey Stedfast * mail-config.c (mail_config_init): Cache the allowable mime-types. (mail_config_get_allowable_mime_types): New public function to get an array of allowable mime-types. * mail-format.c (mail_lookup_handler): Only allow a bonobo-component handler if the mime-type is something handled by evolution or the user has specifically chosen that type as available for viewing with a bonobo component in the gconf database. (mime_type_uses_evolution_component): New convenience function. (mime_type_can_use_component): Checks gconf to see if the user has allowed the mime-type to be viewed by a component. svn path=/trunk/; revision=20983 --- mail/mail-config.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 4 deletions(-) (limited to 'mail/mail-config.c') diff --git a/mail/mail-config.c b/mail/mail-config.c index e66ede44f6..358a2c9aac 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -85,7 +85,11 @@ typedef struct { GSList *labels; guint label_notify_id; + guint font_notify_id; + + GPtrArray *mime_types; + guint mime_types_notify_id; } MailConfig; static MailConfig *config = NULL; @@ -394,6 +398,33 @@ config_cache_labels (void) config->labels = labels; } +static void +config_clear_mime_types (void) +{ + int i; + + for (i = 0; i < config->mime_types->len; i++) + g_free (config->mime_types->pdata[i]); + + g_ptr_array_set_size (config->mime_types, 0); +} + +static void +config_cache_mime_types (void) +{ + GSList *n, *nn; + + n = gconf_client_get_list (config->gconf, "/apps/evolution/mail/display/mime_types", GCONF_VALUE_STRING, NULL); + while (n != NULL) { + nn = n->next; + g_ptr_array_add (config->mime_types, n->data); + g_slist_free_1 (n); + n = nn; + } + + g_ptr_array_add (config->mime_types, NULL); +} + static void config_write_fonts (void) { @@ -450,21 +481,31 @@ gconf_labels_changed (GConfClient *client, guint cnxn_id, static void gconf_fonts_changed (GConfClient *client, guint cnxn_id, - GConfEntry *entry, gpointer user_data) + GConfEntry *entry, gpointer user_data) { config_write_fonts (); } +static void +gconf_mime_types_changed (GConfClient *client, guint cnxn_id, + GConfEntry *entry, gpointer user_data) +{ + config_clear_mime_types (); + config_cache_mime_types (); +} + /* Config struct routines */ void mail_config_init (void) { char *filename; + if (config) return; config = g_new0 (MailConfig, 1); config->gconf = gconf_client_get_default (); + config->mime_types = g_ptr_array_new (); mail_config_clear (); @@ -475,21 +516,27 @@ mail_config_init (void) 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); - + + gconf_client_add_dir (config->gconf, "/apps/evolution/mail/mime_types", + GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); + config->mime_types_notify_id = + gconf_client_notify_add (config->gconf, "/apps/evolution/mail/mime_types", + gconf_mime_types_changed, NULL, NULL, NULL); + config_cache_labels (); config_read_signatures (); + config_cache_mime_types (); config->accounts = e_account_list_new (config->gconf); } @@ -506,6 +553,7 @@ mail_config_clear (void) } config_clear_labels (); + config_clear_mime_types (); } void @@ -638,6 +686,12 @@ mail_config_get_label_color_by_index (int index) return NULL; } +const char ** +mail_config_get_allowable_mime_types (void) +{ + return (const char **) config->mime_types->pdata; +} + gboolean mail_config_find_account (EAccount *account) { -- cgit v1.2.3