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




Ok just some minor things below.

I figure this can go into the plugin branch once this is sorted, since we haven't branched the trunk yet, and otherwise the patch will get lost again.

I'm actually thinking this could be done via an eplugin event handler too, but since there is'nt any such event defined yet, it can wait.

On Tue, 2004-08-17 at 15:46 +0300, Niklas Nylund wrote:
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    17 Aug 2004 12:42:08 -0000
@@ -829,6 +829,42 @@ 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);

don't call gconf_init here.  it should already be initialised by here surely?  left over from prototype i guess?

+       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;

I would just use gconf_client_get_bool.  Let the schema provide the default; this also lets administrators override the default.

+       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;
again i would just use gconf_client_get_string here.
If it is NULL or if it isn't evolution, then prompt == true

+
+       if (prompt == TRUE)
+               if (em_utils_prompt_user (NULL, "/apps/evolution/mail/prompts/default_mailer",
+                                        "mail:check-default-mail-app", NULL))

you can combine this if into a single _expression_, makes it a bit more readable to me (less indenting).

if (prompt
   && em_utils_prompt_user( ...))

+                       gconf_client_set_string (client, "/desktop/gnome/url-handlers/mailto",
+                                                "evolution", NULL);
+
+       g_object_unref (client);
+}
+
 static void
 mail_component_init (MailComponent *component)
 {
@@ -857,6 +893,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     17 Aug 2004 12:42:08 -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>
Add a full stop at the end.
+  <secondary>Do you want it to be?</secondary>
Hmm, could probably be a tad more verbose here.  Perhaps:
Evolution can change your GNOME settings to use Evolution as the system mail application.

Would you like change your default mail application to Evolution?
+  <button stock="gtk-no" response="GTK_RESPONSE_NO"/>
+  <button stock="gtk-yes" response="GTK_RESPONSE_YES"/>

the yes response should probably have "Set mail application" or something, rather than ok, to fit in with the other dialogues these days.  although that particular string seems longish for a button.

--
Michael Zucchi <notzed ximian com>
"born to die, live to work, it's all downhill from here"
Novell's Evolution and Free Software Developer


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