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



Some gui stuff: 

	The patchs are untested. It have been imposible to build evolution to
me. Please I need comments.


-- 
Andres de Barbara <adebarbara fi uba ar>
Index: em-mailer-prefs.c
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-mailer-prefs.c,v
retrieving revision 1.4
diff -u -r1.4 em-mailer-prefs.c
--- em-mailer-prefs.c	11 Dec 2003 19:24:10 -0000	1.4
+++ em-mailer-prefs.c	14 Jan 2004 22:45:49 -0000
@@ -29,7 +29,7 @@
 
 #include "em-mailer-prefs.h"
 
-#include <gal/util/e-iconv.h>
+
 #include <gtkhtml/gtkhtml-properties.h>
 #include <libxml/tree.h>
 #include "widgets/misc/e-charset-picker.h"
@@ -474,6 +474,12 @@
 	g_signal_connect (gnome_file_entry_gtk_entry (prefs->notify_sound_file), "changed",
 			  G_CALLBACK (settings_changed), prefs);
 	g_free (buf);
+
+	/* Default Mailer Question*/
+	bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/prompts/not_question_default_mailer", NULL);
+	prefs->set_default_mailer = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkQuestionDefaultMailer"));
+	gtk_toggle_button_set_active (prefs->not_question_default, bool);
+	g_signal_connect (prefs->not_question_default, "toggled", G_CALLBACK (settings_changed), prefs);
 	
 	/* Mail  Fonts */
 	font = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/fonts/monospace", NULL);
@@ -724,6 +730,10 @@
 	cstring = gtk_entry_get_text (GTK_ENTRY (entry));
 	gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/notify/sound", cstring, NULL);
 	
+	/* Default Mailer Question*/
+	gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/prompts/not_question_default_mailer",
+			       gtk_toggle_button_get_active (prefs->not_question_default), NULL);
+	
 	/* HTML Mail */
 	if (gtk_toggle_button_get_active (prefs->images_always))
 		val = MAIL_CONFIG_HTTP_ALWAYS;
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 22:45:06 -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: mail-config.glade
===================================================================
RCS file: /cvs/gnome/evolution/mail/mail-config.glade,v
retrieving revision 1.127
diff -u -r1.127 mail-config.glade
--- mail-config.glade	7 Jan 2004 23:45:09 -0000	1.127
+++ mail-config.glade	14 Jan 2004 22:51:44 -0000
@@ -3989,6 +3989,53 @@
 	      <property name="fill">True</property>
 	    </packing>
 	  </child>
+
+	  <child>
+	    <widget class="GtkFrame" id="frameEvolutioDefaultMailer">
+	      <property name="visible">True</property>
+	      <property name="label_xalign">0</property>
+	      <property name="label_yalign">0.5</property>
+	      <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+
+	      <child>
+		<widget class="GtkCheckButton" id="chkQuestionDefaultMailer">
+		  <property name="border_width">6</property>
+		  <property name="visible">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label" translatable="yes">Don't ask me again</property>
+		  <property name="use_underline">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="active">False</property>
+		  <property name="inconsistent">False</property>
+		  <property name="draw_indicator">True</property>
+		</widget>
+	      </child>
+
+	      <child>
+		<widget class="GtkLabel" id="label476">
+		  <property name="visible">True</property>
+		  <property name="label" translatable="yes">Default Mailer Question</property>
+		  <property name="use_underline">False</property>
+		  <property name="use_markup">False</property>
+		  <property name="justify">GTK_JUSTIFY_LEFT</property>
+		  <property name="wrap">False</property>
+		  <property name="selectable">False</property>
+		  <property name="xalign">0.5</property>
+		  <property name="yalign">0.5</property>
+		  <property name="xpad">0</property>
+		  <property name="ypad">0</property>
+		</widget>
+		<packing>
+		  <property name="type">label_item</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="padding">0</property>
+	      <property name="expand">True</property>
+	      <property name="fill">True</property>
+	    </packing>
+	  </child>
 	</widget>
 	<packing>
 	  <property name="tab_expand">False</property>
Index: em-mailer-prefs.h
===================================================================
RCS file: /cvs/gnome/evolution/mail/em-mailer-prefs.h,v
retrieving revision 1.5
diff -u -r1.5 em-mailer-prefs.h
--- em-mailer-prefs.h	11 Dec 2003 04:56:12 -0000	1.5
+++ em-mailer-prefs.h	14 Jan 2004 22:47:12 -0000
@@ -85,6 +85,9 @@
 	GtkToggleButton *notify_beep;
 	GtkToggleButton *notify_play_sound;
 	GnomeFileEntry *notify_sound_file;
+
+	/* Default Mailer Question */
+	GtkToggleButton not_question_default;
 	
 	/* HTML Mail tab */
 	GnomeFontPicker *font_variable;


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