diff options
author | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-08-23 02:10:05 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-08-23 02:10:05 +0800 |
commit | 779f0e51a43643d7ff762fcb5553f607eab63e7e (patch) | |
tree | cdef62c60937333c30ba88cd2b06777d023dcf16 /plugins | |
parent | 68d581d982c23a71fac38342835b2cf902771241 (diff) | |
download | gsoc2013-evolution-779f0e51a43643d7ff762fcb5553f607eab63e7e.tar.gz gsoc2013-evolution-779f0e51a43643d7ff762fcb5553f607eab63e7e.tar.zst gsoc2013-evolution-779f0e51a43643d7ff762fcb5553f607eab63e7e.zip |
** Fix for bug #350823
svn path=/trunk/; revision=32634
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/default-mailer/ChangeLog | 8 | ||||
-rw-r--r-- | plugins/default-mailer/default-mailer.c | 35 |
2 files changed, 41 insertions, 2 deletions
diff --git a/plugins/default-mailer/ChangeLog b/plugins/default-mailer/ChangeLog index 1620c006e1..7ac2540480 100644 --- a/plugins/default-mailer/ChangeLog +++ b/plugins/default-mailer/ChangeLog @@ -1,3 +1,11 @@ +2006-08-22 Srinivasa Ragavan <sragavan@novell.com> + + ** Fix for bug #350823 + + * default-mailer.c: (evolution_is_default_mailer), + (org_gnome_default_mailer_check_default): Patch from Matthew Barnes + to make it robust as well as invokes the right component. + 2006-02-27 Srinivasa Ragavan <sragavan@novell.com> * default-mailer.c (org_gnome_default_mailer_check_default): Used diff --git a/plugins/default-mailer/default-mailer.c b/plugins/default-mailer/default-mailer.c index d8d9c1b445..a8a1b8d037 100644 --- a/plugins/default-mailer/default-mailer.c +++ b/plugins/default-mailer/default-mailer.c @@ -31,9 +31,40 @@ #define GCONF_KEY_CHECKDEFAULT "/apps/evolution/mail/prompts/checkdefault" #define GCONF_KEY_MAILTO_ENABLED "/desktop/gnome/url-handlers/mailto/enabled" #define GCONF_KEY_MAILTO_COMMAND "/desktop/gnome/url-handlers/mailto/command" +#define EVOLUTION_MAILTO_COMMAND "evolution --component=mail %s" void org_gnome_default_mailer_check_default (EPlugin *ep, ESEventTargetUpgrade *target); +static gboolean +evolution_is_default_mailer (const gchar *mailto_command) +{ + gint argc; + gchar **argv; + gchar *basename; + gboolean is_default; + + if (mailto_command == NULL) + return FALSE; + + g_debug ("mailto URL command: %s", mailto_command); + + /* tokenize the mailto command */ + if (!g_shell_parse_argv (mailto_command, &argc, &argv, NULL)) + return FALSE; + + g_assert (argc > 0); + + /* check the basename of the first token */ + basename = g_path_get_basename (argv[0]); + g_debug ("mailto URL program: %s", basename); + is_default = g_str_has_prefix (basename, "evolution"); + g_free (basename); + + g_strfreev (argv); + + return is_default; +} + void org_gnome_default_mailer_check_default (EPlugin *ep, ESEventTargetUpgrade *target) { @@ -54,11 +85,11 @@ org_gnome_default_mailer_check_default (EPlugin *ep, ESEventTargetUpgrade *targe mailer = gconf_client_get_string(client, GCONF_KEY_MAILTO_COMMAND, NULL); /* Check whether we are the default mailer */ - if(mailer == NULL || (strcmp(mailer, "@evolution %s") != 0 && strcmp(mailer, "evolution %s") != 0)) { + if (!evolution_is_default_mailer (mailer)) { /* Ask whether we should be the default mailer */ if(em_utils_prompt_user(NULL, GCONF_KEY_CHECKDEFAULT, "org.gnome.default.mailer:check-default", NULL)) { gconf_client_set_bool(client, GCONF_KEY_MAILTO_ENABLED, TRUE, NULL); - gconf_client_set_string(client, GCONF_KEY_MAILTO_COMMAND, "evolution %s", NULL); + gconf_client_set_string(client, GCONF_KEY_MAILTO_COMMAND, EVOLUTION_MAILTO_COMMAND, NULL); } } |