Re: [evolution-patches] fix for bug #127526



On Rab, 2005-06-08 at 20:37 +0800, Not Zed wrote:
> We already have a 'dont ask this again' widget code, it is based on
> e-error.  You must use that.  Look at what the other questions do.
> Absolutely no need to write a whole new piece of code to do the same
> thing!

Hi,

this is the updated patch using em_utils_prompt_user()
thanks

-- 
Mohammad <mdamt at gnome dot org>
http://aksi.mdamt.net/log/
--- mail-component.c	2005-06-08 21:50:34.472689992 +0300
+++ mail-component.c.patch	2005-06-08 21:49:13.368019776 +0300
@@ -930,6 +930,33 @@
 	mepv->test = impl_mail_test;
 }
 
+void
+default_app_dialog (void)
+{
+	gchar *default_app;
+	GConfClient *gconf = mail_config_get_gconf_client();
+
+	default_app = gconf_client_get_string (gconf,
+			"/desktop/gnome/url-handlers/mailto", NULL);
+
+	if (default_app != NULL) {
+		if (g_str_has_prefix (default_app, "evolution")) {
+			g_free (default_app);
+			return;
+		}
+		g_free (default_app);
+	}
+
+	if (em_utils_prompt_user (NULL,"/apps/evolution/mail/prompts/default_mailer",
+				   "mail:ask-default-app", NULL)) {
+		gconf_client_set_string (gconf, 
+					"/desktop/gnome/url-handlers/mailto/command", 
+					"evolution %s", NULL);
+		gconf_client_set_bool (gconf, 
+				"/desktop/gnome/url-handlers/mailto/enabled", TRUE, NULL);
+	}
+}
+
 static void
 mail_component_init (MailComponent *component)
 {
@@ -958,6 +985,7 @@
 	
 	offline = mail_offline_handler_new();
 	bonobo_object_add_interface((BonoboObject *)component, (BonoboObject *)offline);
+	default_app_dialog ();
 }
 
 /* Public API.  */
--- mail.error.xml	2005-06-08 21:50:34.640664456 +0300
+++ mail.error.xml.patch	2005-06-08 21:49:53.793874112 +0300
@@ -357,5 +357,13 @@
     <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>   
     <button stock="gtk-yes" response="GTK_RESPONSE_YES"/>
   </error>
+
+  <error id="ask-default-app" type="question" default="GTK_RESPONSE_YES">
+  <_primary>Would you like to make Evolution your default mail application?</_primary>
+  <_secondary xml:space="preserve">Answering yes will make Evolution to be called everytime any applications need to use email</_secondary>
+  <button stock="gtk-no" response="GTK_RESPONSE_NO"/>
+  <button _label="gtk-yes" response="GTK_RESPONSE_YES"/>
+ </error>
+
 </error-list>
 
--- evolution-mail.schemas.in.in	2005-06-08 21:55:42.481865480 +0300
+++ evolution-mail.schemas.in.in.patch	2005-06-08 21:55:24.561589776 +0300
@@ -661,6 +661,20 @@
       </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>false</default>
+      <locale name="C">
+         <short>Prompt on </short>
+         <long>
+          Prompt the user whether the user wants to display the default mailer application dialog.
+         </long>
+      </locale>
+    </schema>
+		
     <!-- Trash settings -->
 
     <schema>


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