[Evolution-hackers] [BOUNTY] Bug 127526 - Patch



Hi evolution hackers :

Trying to do something creative at my vacations and I was tempted by the
bounties. So here I'm writing to *big* guys like you with a simple
patch. I'm new in software development so don't be _so_ rude. I'm trying
to learn.

The idea is to ask the user if he/she want to make evolution as the
default mailer so:

A new boolean gconf key should be created
"/apps/evolution/mail/promts/not_question_default_mailer", if the
question will be show to the user , if is TRUE the user will not be see.
(somewhere in the evolution configuration we need a way to change this
key, suggestions?).

Also check the question dialog for ui changes and misspelled words.

-- 
Andres de Barbara <adebarbara fi uba ar>
Index: mail-component.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-component.c,v
retrieving revision 1.40
diff -u -r1.40 mail-component.c
--- mail-component.c	9 Jan 2004 06:52:41 -0000	1.40
+++ mail-component.c	14 Jan 2004 04:37:11 -0000
@@ -505,12 +505,70 @@
 	/* mail_autoreceive_setup (); EPFIXME keep it off for testing */
 	
 	setup_search_context (component);
+
+	ask_evolution_default_mailer ();
 	
 	/* EPFIXME not sure about this.  */
 	go_online (component);
 }
 
+void 
+ask_evolution_default_mailer (void)
+{
+	
+        GtkWidget *dialog, *check,*alignment;
+        GConfClient *client;
+        char *default_mailer;
+        int result;
+	gboolean not_question_default_mailer;
+
+        client = gconf_client_get_default ();
+                                                                                                                             
+        default_mailer = gconf_client_get_string (client,
+                                                  "/desktop/gnome/url-handlers/mailto/command",
+                                                  NULL);
+        not_question_default_mailer = gconf_client_get_bool (client,
+                                                             "/apps/evolution/mail/prompts/not_question_default_mailer",
+                                                             NULL);
+        
+        if ((!default_mailer || strncmp("evolution",default_mailer,9) != 0) && !not_question_default_mailer) {
+                dialog = gtk_message_dialog_new (NULL,
+                	                         GTK_DIALOG_DESTROY_WITH_PARENT,
+		   			         GTK_MESSAGE_QUESTION,
+						 GTK_BUTTONS_YES_NO,
+                                                 _("Would you like to make Evolution your default mail aplication?")); 
 
+	        check = gtk_check_button_new_with_label (_("Don't ask this question again"));
+		alignment = gtk_alignment_new (0.5, 0.5, 0.66, 0.0);
+		
+		gtk_container_set_border_width (GTK_CONTAINER (alignment), 5);
+		gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox),alignment);
+		gtk_container_add (GTK_CONTAINER (alignment), check);
+	        gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_NO);
+		gtk_widget_show_all (dialog);	
+		
+		result = gtk_dialog_run (GTK_DIALOG (dialog));
+	                                                                                                             
+	        if (result == GTK_RESPONSE_YES) {
+	                gconf_client_set_string (client,
+	                                         "/desktop/gnome/url-handlers/mailto/command",
+	                                         "evolution \"%s\"", NULL);
+	                gconf_client_set_bool (client,
+	                                       "/desktop/gnome/url-handlers/mailto/enable",
+	                                       TRUE, NULL);
+	        }
+	        gconf_client_set_bool (client,
+	                               "/apps/evolution/mail/prompts/not_question_default_mailer",
+	                               gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)),
+	                               NULL);
+	
+		gtk_widget_destroy (dialog);
+        }
+        if (default_mailer)
+        	g_free (default_mailer
+        g_object_unref (client);
+}
+ 
 /* Public API.  */
 
 MailComponent *
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/mail/ChangeLog,v
retrieving revision 1.2981
diff -u -r1.2981 ChangeLog
--- ChangeLog	9 Jan 2004 06:52:41 -0000	1.2981
+++ ChangeLog	14 Jan 2004 04:37:28 -0000
@@ -1,3 +1,11 @@
+2004-01-14 Andres de Barbara <adebarbara fi uba ar>
+
+	** See bounty 127526
+
+	* mail-component.c (ask_evolution_default_mailer): new function
+	to ask if evolution should be the default mailer.
+	* (mail_component_init): now call ask_evolution_default_mailer.
+
 2004-01-09  Not Zed  <NotZed Ximian com>
 
 	** See bug 52696.


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