diff options
author | Michael Zucci <zucchi@src.gnome.org> | 2005-06-23 12:18:03 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2005-06-23 12:18:03 +0800 |
commit | 98297fbb8b916425a8ea63671853411e80ced51e (patch) | |
tree | fd22fd2bc343d8ef103b97a3d5e70b91540cb9c3 /plugins/default-mailer/default-mailer.c | |
parent | 9e42341c2c1192c506739562322f7eaa696d344d (diff) | |
download | gsoc2013-evolution-98297fbb8b916425a8ea63671853411e80ced51e.tar.gz gsoc2013-evolution-98297fbb8b916425a8ea63671853411e80ced51e.tar.zst gsoc2013-evolution-98297fbb8b916425a8ea63671853411e80ced51e.zip |
Initial import
svn path=/trunk/; revision=29570
Diffstat (limited to 'plugins/default-mailer/default-mailer.c')
-rw-r--r-- | plugins/default-mailer/default-mailer.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/plugins/default-mailer/default-mailer.c b/plugins/default-mailer/default-mailer.c new file mode 100644 index 0000000000..83f71ed2df --- /dev/null +++ b/plugins/default-mailer/default-mailer.c @@ -0,0 +1,67 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * Author: Jonathan Dieter <jdieter99@gmx.net> + * + * Copyright 2005 Jonathan Dieter + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. + * + */ + +#include <stdlib.h> +#include <string.h> + +#include <gconf/gconf-client.h> +#include <e-util/e-error.h> + +#include <mail/em-utils.h> +#include <shell/es-event.h> + +#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" + +void org_gnome_default_mailer_check_default (EPlugin *ep, ESEventTargetUpgrade *target); + +void +org_gnome_default_mailer_check_default (EPlugin *ep, ESEventTargetUpgrade *target) +{ + GConfClient *client; + gchar *mailer; + GConfValue *is_key; + + client = gconf_client_get_default (); + + /* See whether the check default mailer key has already been set */ + is_key = gconf_client_get(client, GCONF_KEY_CHECKDEFAULT, NULL); + if(!is_key) + gconf_client_set_bool(client, GCONF_KEY_CHECKDEFAULT, TRUE, NULL); + g_free(is_key); + + /* Check whether we're supposed to check whether or not we are the default mailer */ + if(gconf_client_get_bool(client, GCONF_KEY_CHECKDEFAULT, NULL)) { + 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)) { + /* 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); + } + } + + g_free(mailer); + } +} |