[evolution-patches] Ask user to make evolution default mail app bug #127526 (Mail)



This is a patch for bug 127526, I've sent a couple of mails concerning the same bug a few weeks ago. But I didn't recieve an answer to what
I think is the final patch for this so I'm sending it again.

Niklas

? default_mailer.diff
? mail-component.c-backup
? mail-component.diff
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.3434
diff -u -p -r1.3434 ChangeLog
--- ChangeLog	16 Aug 2004 03:31:21 -0000	1.3434
+++ ChangeLog	20 Aug 2004 10:36:26 -0000
@@ -1,3 +1,13 @@
+2004-08-19 Niklas Nylund <ninylund abo fi>
+
+	Fix for bug #12752
+
+	* mail-component.c: Added check_default_mail_app(void)
+	* mail-component.c (mail_component_init): Calls check_default_mail_app()
+	* mail-errors.xml: Added "ask-set-mail-app" error, check_default_mail_app() uses it.
+	* evolution-mail.schemas.in.in: Added /schemas/apps/evolution/mail/prompts/default_mailer bool
+	key. This is used in check_default_mail_app in.
+
 2004-08-13  Not Zed  <NotZed Ximian com>
 
 	* em-utils.c (em_utils_message_to_html): don't include the
Index: evolution-mail.schemas.in.in
===================================================================
RCS file: /cvs/gnome/evolution/mail/evolution-mail.schemas.in.in,v
retrieving revision 1.17
diff -u -p -r1.17 evolution-mail.schemas.in.in
--- evolution-mail.schemas.in.in	10 May 2004 19:35:38 -0000	1.17
+++ evolution-mail.schemas.in.in	20 Aug 2004 10:36:26 -0000
@@ -646,6 +646,21 @@
       </locale>
     </schema>
 
+    <schema>
+      <key>/schemas/apps/evolution/mail/prompts/default_mailer</key>
+      <applyto>/apps/evolution/mail/prompts/default_mailer</applyto>
+      <owner>evolution-mail</owner>
+      <type>bool</type>
+      <default>true</default>
+      <locale name="C">
+         <short>Should Evolution check if it's set as default mail application</short>
+         <long>
+	 Should a Yes/No dialog box appear when Evolution launches asking if the
+	 user wants Evolution to be the default mail application.
+         </long>
+      </locale>
+    </schema>
+
     <!-- Trash settings -->
 
     <schema>
Index: mail-component.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-component.c,v
retrieving revision 1.95
diff -u -p -r1.95 mail-component.c
--- mail-component.c	26 Jul 2004 06:41:39 -0000	1.95
+++ mail-component.c	20 Aug 2004 10:36:26 -0000
@@ -829,6 +829,33 @@ mail_component_class_init (MailComponent
 	epv->upgradeFromVersion      = impl_upgradeFromVersion;
 }
 
+static void 
+check_default_mail_app (void) 
+{
+	GConfClient *client;
+	gboolean prompt;
+	gchar *mailapp;
+	
+	client = gconf_client_get_default ();
+
+	prompt = gconf_client_get_bool (client, "/apps/evolution/mail/prompts/default_mailer", NULL);
+	if (!prompt) {
+		g_object_unref (client);
+		return;
+	}
+
+	mailapp = gconf_client_get_string (client, "/desktop/gnome/url-handlers/mailto", NULL);
+	if (mailapp && !strcmp (mailapp, "evolution")) {
+		g_free (mailapp);
+
+		if (em_utils_prompt_user (NULL, "/apps/evolution/mail/prompts/default_mailer", 
+					  "mail:ask-set-mail-app", NULL)) 
+			gconf_client_set_string (client, "/desktop/gnome/url-handlers/mailto", 
+						 "evolution", NULL);
+	}
+	g_object_unref (client);
+}
+
 static void
 mail_component_init (MailComponent *component)
 {
@@ -857,6 +884,8 @@ mail_component_init (MailComponent *comp
 	
 	offline = mail_offline_handler_new();
 	bonobo_object_add_interface((BonoboObject *)component, (BonoboObject *)offline);
+
+	check_default_mail_app();
 }
 
 /* Public API.  */
Index: mail-errors.xml
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-errors.xml,v
retrieving revision 1.4
diff -u -p -r1.4 mail-errors.xml
--- mail-errors.xml	29 Jul 2004 06:47:31 -0000	1.4
+++ mail-errors.xml	20 Aug 2004 10:36:26 -0000
@@ -315,5 +315,14 @@ You can choose to ignore this folder, ov
  <primary>Could not connect to {0}. Groupwise account setup is incomplete. You may need to setup  the account again</primary>
 </error>
 
+ <error id="ask-set-mail-app" type="question" default="GTK_RESPONSE_YES">
+  <primary>Evolution is not your current mail application.</primary>
+  <secondary>Evolution can change your GNOME settings to use Evolution as the system mail application.
+  
+Would you like change your default mail application to Evolution?</secondary>
+  <button stock="gtk-no" response="GTK_RESPONSE_NO"/>
+  <button stock="gtk-yes" response="GTK_RESPONSE_YES"/>
+ </error>
+
 </error-list>
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]