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



You should probably use em_utils_prompt_user for the actual asking. Assuming it will do the key thing right (although it behaves a bit strangely). If it doesn't you should do something similar, using e_error to build the dialogue, rather than gtk_dialog directly. It should save you work, and make them visually consistent.

Okay, i rewrote the code to use em_utils_prompt_user, I ended upp adding
a new error in mail-errors.xml.

Feel free to rename the function and the error id.

Niklas

When Evolution is launched I first check the "prompt key" and if needed
the default mail app key. I don't know how useful this is if say the user first selects Evolution as his/hers default app. and checks "Don't ask this again". Later another application changes the default mail app. key, then Evolution will not notify the user the next time it's started (Since the prompt flag is still false). Should I add something which fixes this to Tools->Settings or is this to be taken care of by gconf-editor or some similar Gnome application?

One annoying thing exists though, the first time the user launches Evolution both the wizard and the default mail app. dialog box appears, since I added my function check_default_mail_app() to the end of mail_component_init. But surely anyone with more experience from the code knows a better place to put the check.


It should probably go in the shell somewhere in this version of evolution. Although this will have to target 2.2 anyway, since 2.0 is frozen; we might not have the wizard anymore in 2.2. So uh, i guess leave it in the mailer for now.

There's some minor formatting consistencies, and i'm_no_fan_of_sentences_for_function_names if they can be avoided.

--
	*Michael Zucchi* <notzed ximian com <mailto:notzed ximian com>>
/"born to die, live to work, it's all downhill from here"/
Novell's Evolution <http://codeblogs.ximian.com/blogs/evolution/> and Free Software <http://www.gnu.org/philosophy/free-sw.html> Developer



? .mail-component.c.swp
? default_mailer.diff
? mail-component.c-backup
? mail-component.diff
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	16 Aug 2004 13:08:21 -0000
@@ -829,6 +829,47 @@ mail_component_class_init (MailComponent
 	epv->upgradeFromVersion      = impl_upgradeFromVersion;
 }
 
+static void 
+check_default_mail_app (void) 
+{
+	GConfClient *client;
+	GConfValue *val;
+	gboolean prompt;
+	gchar *mailapp;
+	
+	gconf_init (0, NULL, NULL);
+	client = gconf_client_get_default ();
+
+	val = gconf_client_get (client, "/apps/evolution/mail/prompts/default_mailer", NULL);
+	if (val) 
+		prompt = gconf_value_get_bool (val);
+	else
+		prompt = TRUE;
+
+	val = gconf_client_get (client, "/desktop/gnome/url-handlers/mailto", NULL);
+	if (val) {
+		mailapp = (gchar *) gconf_value_get_string(val);
+		if (strcmp (mailapp, "evolution") == 0)
+			prompt = FALSE;
+		g_free (mailapp);
+	} else 
+		prompt = TRUE;
+	
+
+	if (prompt == TRUE) 
+		if (em_utils_prompt_user (NULL, "/apps/evolution/mail/prompts/default_mailer", 
+					 "mail:check-default-mail-app", NULL)) 
+			gconf_client_set_string (client, "/desktop/gnome/url-handlers/mailto", 
+					         "evolution", NULL);
+
+	g_object_unref (client);
+}
+
+static void
+mail_default_mailer_check (void) 
+{
+}
+
 static void
 mail_component_init (MailComponent *component)
 {
@@ -857,6 +898,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	16 Aug 2004 13:08:21 -0000
@@ -315,5 +315,13 @@ 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="check-default-mail-app" type="question" default="GTK_RESPONSE_YES">
+  <primary>Evolution is not your current mail application</primary>
+  <secondary>Do you want it to be?</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]