Made toplevel container widgets set a border-width (including toplevel

2003-04-25  Jeffrey Stedfast  <fejj@ximian.com>

	* 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  <fejj@ximian.com>

	* 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
This commit is contained in:
Jeffrey Stedfast
2003-04-28 16:00:47 +00:00
committed by Jeffrey Stedfast
parent d4876ac1ad
commit aea82dfd60
6 changed files with 2594 additions and 2430 deletions

View File

@ -1,3 +1,27 @@
2003-04-25 Jeffrey Stedfast <fejj@ximian.com>
* 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 <fejj@ximian.com>
* 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.
2003-04-24 Radek Doulik <rodo@ximian.com>
* mail-display.c (html_button_press_event): as below

View File

@ -148,6 +148,23 @@
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/mail/display/mime_types</key>
<applyto>/apps/evolution/mail/display/mime_types</applyto>
<owner>evolution-mail</owner>
<type>list</type>
<list_type>string</list_type>
<default></default>
<locale name="C">
<short>List of mime types to check for bonobo component viewers</short>
<long>
If there isn't a builtin viewer for a particular mime-type inside Evolution,
any mime-types appearing in this list which map to a bonobo-component viewer
in GNOME's mime-type database may be used for displaying content.
</long>
</locale>
</schema>
<schema>
<key>/schemas/apps/evolution/mail/display/xmailer_mask</key>
<applyto>/apps/evolution/mail/display/xmailer_mask</applyto>

View File

@ -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)
{

File diff suppressed because it is too large Load Diff

View File

@ -107,6 +107,8 @@ GSList *mail_config_get_labels (void);
const char *mail_config_get_label_color_by_name (const char *name);
const char *mail_config_get_label_color_by_index (int index);
const char **mail_config_get_allowable_mime_types (void);
void mail_config_service_set_save_passwd (EAccountService *service, gboolean save_passwd);
gboolean mail_config_find_account (EAccount *account);

View File

@ -371,6 +371,27 @@ component_supports (Bonobo_ServerInfo *component, const char *mime_type)
return FALSE;
}
static gboolean
mime_type_uses_evolution_component (const char *mime_type)
{
return (!strcmp (mime_type, "text/x-vcard") || !strcmp (mime_type, "text/calendar"));
}
static gboolean
mime_type_can_use_component (const char *mime_type)
{
const char **mime_types;
int i;
mime_types = mail_config_get_allowable_mime_types ();
for (i = 0; mime_types[i]; i++) {
if (!strcmp (mime_types[i], mime_type))
return TRUE;
}
return FALSE;
}
/**
* mail_lookup_handler:
* @mime_type: a MIME type
@ -423,23 +444,27 @@ mail_lookup_handler (const char *mime_type)
goto reg;
}
/* Try for the first matching component. (we don't use get_short_list_comps
* as that will return NULL if the oaf files don't have the short_list properties
* defined). */
components = gnome_vfs_mime_get_all_components (mime_type);
for (iter = components; iter; iter = iter->next) {
if (component_supports (iter->data, mime_type)) {
handler->generic = FALSE;
handler->is_bonobo = TRUE;
handler->builtin = handle_via_bonobo;
handler->component = Bonobo_ServerInfo_duplicate (iter->data);
gnome_vfs_mime_component_list_free (components);
goto reg;
/* only allow using a bonobo component if it is an evo-component or the user has
* specified that we can use a bonobo-component by setting the gconf key */
if (mime_type_uses_evolution_component (mime_type) || mime_type_can_use_component (mime_type)) {
/* Try for the first matching component. (we don't use get_short_list_comps
* as that will return NULL if the oaf files don't have the short_list properties
* defined). */
components = gnome_vfs_mime_get_all_components (mime_type);
for (iter = components; iter; iter = iter->next) {
if (component_supports (iter->data, mime_type)) {
handler->generic = FALSE;
handler->is_bonobo = TRUE;
handler->builtin = handle_via_bonobo;
handler->component = Bonobo_ServerInfo_duplicate (iter->data);
gnome_vfs_mime_component_list_free (components);
goto reg;
}
}
gnome_vfs_mime_component_list_free (components);
}
gnome_vfs_mime_component_list_free (components);
/* Try for a generic builtin match. */
p = strchr (mime_type, '/');
if (p == NULL)