[evolution-patches] fix for bug #127526



Hi,

this is a patch for bug #127526
thanks.

-- 
Mohammad <mdamt at gnome dot org>
http://aksi.mdamt.net/log/
--- evolution-mail.schemas.in.in	2005-06-08 10:27:15.056812298 +0300
+++ evolution-mail.schemas.in.in.patch	2005-06-08 10:27:03.702186802 +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>
--- mail-component.h	2005-06-08 10:26:19.002598023 +0300
+++ mail-component.h.patch	2005-06-08 10:25:01.254010978 +0300
@@ -26,6 +26,7 @@
 #ifndef _MAIL_COMPONENT_H_
 #define _MAIL_COMPONENT_H_
 
+#include <gtk/gtktogglebutton.h>
 #include <bonobo/bonobo-object.h>
 #include "shell/evolution-component.h"
 #include "Evolution-Mail.h"
@@ -98,4 +99,7 @@
 struct _CamelFolder *mail_component_get_folder(MailComponent *mc, enum _mail_component_folder_t id);
 const char *mail_component_get_folder_uri(MailComponent *mc, enum _mail_component_folder_t id);
 
+void opt_out_cb (GtkToggleButton *opt_button, gpointer user_data);
+void default_app_dialog (void);
+
 #endif /* _MAIL_COMPONENT_H_ */
--- mail-component.c	2005-06-08 10:26:18.993599113 +0300
+++ mail-component.c.patch	2005-06-08 10:24:57.065518110 +0300
@@ -34,6 +34,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <glade/glade.h>
 
 #include "em-utils.h"
 #include "em-composer-utils.h"
@@ -930,6 +893,66 @@
 	mepv->test = impl_mail_test;
 }
 
+void
+opt_out_cb (GtkToggleButton *opt_button,
+		gpointer user_data)
+{
+	GConfClient *gconf = mail_config_get_gconf_client();
+
+	gconf_client_set_bool (gconf, 
+					"/apps/evolution/mail/prompts/default_mailer",
+					gtk_toggle_button_get_active (opt_button) , NULL);
+}
+
+void
+default_app_dialog (void)
+{
+	GladeXML *xml;
+	GtkDialog *dialog;
+	GtkToggleButton *option;
+	gint result;
+	gchar *default_app;
+	gboolean display_dialog;
+	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"))
+			return;
+	}
+
+	display_dialog = gconf_client_get_bool (gconf,
+			"/apps/evolution/mail/prompts/default_mailer", NULL);
+
+	if (!display_dialog) {
+		return;
+	}
+
+	xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-dialogs.glade", "default-app-dialog", NULL);
+	if (xml == NULL) {
+		return;
+	}
+	dialog = (GtkDialog *)glade_xml_get_widget (xml, 
+			"default-app-dialog");
+	option = (GtkToggleButton *)glade_xml_get_widget (xml, 
+			"show-again-button");
+	g_signal_connect(option, "toggled", G_CALLBACK(opt_out_cb), NULL);
+
+	result = gtk_dialog_run (GTK_DIALOG (dialog));
+  switch (result) {
+		case GTK_RESPONSE_YES:
+			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);
+			break;
+	}
+  gtk_widget_destroy ((GtkWidget*) dialog);
+}
+
 static void
 mail_component_init (MailComponent *component)
 {
@@ -958,6 +981,8 @@
 	
 	offline = mail_offline_handler_new();
 	bonobo_object_add_interface((BonoboObject *)component, (BonoboObject *)offline);
+
+	default_app_dialog ();
 }
 
 /* Public API.  */


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