From 98297fbb8b916425a8ea63671853411e80ced51e Mon Sep 17 00:00:00 2001 From: Michael Zucci Date: Thu, 23 Jun 2005 04:18:03 +0000 Subject: Initial import svn path=/trunk/; revision=29570 --- plugins/default-mailer/ChangeLog | 55 ++++++++++++++++++ plugins/default-mailer/Makefile.am | 38 ++++++++++++ ...olution-mail-prompts-checkdefault.schemas.in.in | 16 ++++++ plugins/default-mailer/default-mailer.c | 67 ++++++++++++++++++++++ .../org-gnome-default-mailer.eplug.xml | 20 +++++++ .../org-gnome-default-mailer.error.xml | 11 ++++ 6 files changed, 207 insertions(+) create mode 100644 plugins/default-mailer/ChangeLog create mode 100644 plugins/default-mailer/Makefile.am create mode 100644 plugins/default-mailer/apps-evolution-mail-prompts-checkdefault.schemas.in.in create mode 100644 plugins/default-mailer/default-mailer.c create mode 100644 plugins/default-mailer/org-gnome-default-mailer.eplug.xml create mode 100644 plugins/default-mailer/org-gnome-default-mailer.error.xml diff --git a/plugins/default-mailer/ChangeLog b/plugins/default-mailer/ChangeLog new file mode 100644 index 0000000000..84aa991e20 --- /dev/null +++ b/plugins/default-mailer/ChangeLog @@ -0,0 +1,55 @@ +2005-06-23 Not Zed + + * Makefile.am: Changed the way the i18n stuff and xml building is + done for the 'new way'. + + * default-mailer.c: fixed e-error header move and removed some + other unecessary includes. + +2005-03-24 Jonathan Dieter + * default-mailer.c: removed code to put a checkbox in the + configuration menu, changed procedure names to avoid + namespace pollution. + + * org-gnome-default-mailer.eplug.in: removed definitions + to put a checkbox in the configuration menu. + + * apps-evolution-mail-prompts-checkdefault.schema.in.in: + schema for GConf key /apps/evolution/mail/prompts/checkdefault. + + * Makefile.am: added steps to build GConf schema. + +2005-03-17 Jonathan Dieter + + * default-mailer.c: renamed from default-mail-client-check.c + Renamed modules to fit new name and cleaned up code. Fixed + small memory leak. + + * org-gnome-default-mailer.xml: renamed from + org-gnome-default-mail-client-check.xml. + + * org-gnome-default-mailer.eplug.in: renamed from + org-gnome-default-mail-client-check.eplug.in. + + * Makefile.am: Fixed references to fit new file names. + +2005-03-15 Jonathan Dieter + + * default-mail-client-check.c (check_default_mail_client): + Removed gtk_message_dialog() call and replaced with + e_error(). + + * Makefile.am: added necessary steps to build xml. + + * org-gnome-default-mail-client-check.xml: define the + message box that shows up on startup. + +2005-03-07 Jonathan Dieter + + * default-mail-client-check.c: Plugin implementation. + + * org-gnome-default-mail-client-check.eplug.in: define the + default mail client check plugin. + + * Makefile.am: build the default mail client check plugin. + diff --git a/plugins/default-mailer/Makefile.am b/plugins/default-mailer/Makefile.am new file mode 100644 index 0000000000..8d1017d5d0 --- /dev/null +++ b/plugins/default-mailer/Makefile.am @@ -0,0 +1,38 @@ +INCLUDES = \ + -I$(top_srcdir) \ + $(EVOLUTION_MAIL_CFLAGS) + +@EVO_PLUGIN_RULE@ + +error_DATA = org-gnome-default-mailer.error +errordir = $(privdatadir)/errors + +plugin_DATA = org-gnome-default-mailer.eplug +plugin_LTLIBRARIES = liborg-gnome-default-mailer.la + +liborg_gnome_default_mailer_la_SOURCES = default-mailer.c +liborg_gnome_default_mailer_la_LDFLAGS = -module -avoid-version + +schemadir = $(GCONF_SCHEMA_FILE_DIR) +schema_in_files = apps-evolution-mail-prompts-checkdefault.schemas.in.in +schema_DATA = $(schema_in_files:.schemas.in.in=-$(BASE_VERSION).schemas) + +%-$(BASE_VERSION).schemas.in: %.schemas.in.in + cp $< $@ + +@INTLTOOL_SCHEMAS_RULE@ + +install-data-local: + if test -z "$(DESTDIR)" ; then \ + for p in $(schema_DATA) ; do \ + GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $$p; \ + done \ + fi + +EXTRA_DIST = \ + org-gnome-default-mailer.eplug.xml \ + org-gnome-default-mailer.error.xml \ + $(schema_in_files) + +BUILT_SOURCES = org-gnome-default-mailer.eplug \ + org-gnome-default-mailer.error diff --git a/plugins/default-mailer/apps-evolution-mail-prompts-checkdefault.schemas.in.in b/plugins/default-mailer/apps-evolution-mail-prompts-checkdefault.schemas.in.in new file mode 100644 index 0000000000..cdcaf7892a --- /dev/null +++ b/plugins/default-mailer/apps-evolution-mail-prompts-checkdefault.schemas.in.in @@ -0,0 +1,16 @@ + + + + /schemas/apps/evolution/mail/prompts/checkdefault + /apps/evolution/mail/prompts/checkdefault + evolution-mail + bool + true + + Check whether Evolution is the default mailer + Every time Evolution starts, check whether or not it is the default mailer. + + + + + 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 + * + * 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 +#include + +#include +#include + +#include +#include + +#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); + } +} diff --git a/plugins/default-mailer/org-gnome-default-mailer.eplug.xml b/plugins/default-mailer/org-gnome-default-mailer.eplug.xml new file mode 100644 index 0000000000..29617d7fb1 --- /dev/null +++ b/plugins/default-mailer/org-gnome-default-mailer.eplug.xml @@ -0,0 +1,20 @@ + + + + + <_description>Checks whether Evolution is the default mail client on startup. + + + + + + + diff --git a/plugins/default-mailer/org-gnome-default-mailer.error.xml b/plugins/default-mailer/org-gnome-default-mailer.error.xml new file mode 100644 index 0000000000..fe9cf5a409 --- /dev/null +++ b/plugins/default-mailer/org-gnome-default-mailer.error.xml @@ -0,0 +1,11 @@ + + + + + <_title>Evolution + <_secondary>Do you want to make Evolution your default e-mail client? +