Re: [evolution-patches] Bug 127526: Ask user to make Evolution default mail app for GNOME




Hi Niklas,

Ahh ok, well at least it wasn't entirely our fault at least (we seem to miss a lot of patches).

Jonathan Dieter seems to be working on a patch now - which seems a bit redundant since the patches will have to be almost the same.  But I guess that may mean that you would just be wasting your time working on it again.  Unless you guys can work something out (being such a simple patch though there's probably only one way to do it, and not much scope for cooperation).

Thanks for responding,
Michael

On Mon, 2005-03-07 at 19:10 +0900, Niklas Nylund wrote:




Hi again,

The reason is that I left abroad for a year and don't have access to a machine right now where I could test Evolution. After coming here (Japan) I completely forgot about this until now ;-) I have what at least to me looks like a complete patch, fixed the last thing that met criticism but never mailed it to this list back then.

Has anything change,that would break the patch, since that time? You mentioned something about a plugin system, does it mean that this patch should be done in a completely different way?

I am trying to compile evolution right now on a remote machine, if I succeed I can test my patch as far as that it compiles. Should I do that or am I just wasting my time?

Niklas

On Mar 3, 2005, at 2:15 PM, Not Zed wrote:



Hmm, we actually had a patch all but complete for this last year, from Niklas Nylund <ninylund abo fi>, but then the thread seemed to peter out.

I don't really know what we should do about this, since the other patch was so close.

As for your patch - this functionality should now be done via the plugin interface.

Also you're using java-style mixedCaps, we don't do that anywhere, we use lower-case names for everthing, usually with _ separating words (its easier for non-english speakers apparently).

Michael

On Thu, 2005-03-03 at 00:08 +0200, Jonathan Dieter wrote:

This patch will ask the user if they would like Evolution to be the
default mailer for GNOME the first time that Evolution is run.  If the
user says "yes", Evolution sets itself to be the default mailer.  If the
user says "no", Evolution won't change anything.  There is a check box
that asks whether the user wants to be asked this question every time
Evolution is started.  If the check box is not checked, Evolution will
never ask the question again.  If it is checked, Evolution will only ask
if there is either no mailer set up or if another mailer is set as the
default one.

This is my first attempt at a patch, so any feedback would be
appreciated.  Thanks,

Jonathan Dieter
jdieter99 at gmx dot net


text/plain attachment (evolution-2.0.2-default-mailer-check.patch)
diff -Naur evolution-2.0.2/mail/mail-component.c evolution-2.0.2-new/mail/mail-component.c
--- evolution-2.0.2/mail/mail-component.c       2004-09-24 18:49:29.000000000 +0300
+++ evolution-2.0.2-new/mail/mail-component.c   2005-03-02 23:34:40.373233696 +0200
@@ -70,6 +70,9 @@
#include "e-task-bar.h"

#include <gtk/gtklabel.h>
+#include <gtk/gtk.h>
+
+#include <gconf/gconf.h>

#include <e-util/e-mktemp.h>

@@ -834,6 +837,49 @@
        epv->upgradeFromVersion      = impl_upgradeFromVersion;
}

+/* Check whether or not we are the default mailer */
+static void
+dialogCheckForDefault ()
+{
+       GtkWidget   *dialogDefaultEmailApp, *checkAlways;
+       GConfClient *gconfclientDefault;
+       gchar       *mailer;
+       gboolean    nocheckDefault, enabled;
+       gint        result;
+      
+       gconfclientDefault = gconf_client_get_default();
+       nocheckDefault = gconf_client_get_bool(gconfclientDefault, "/apps/evolution/mail/prompts/nocheckdefault", NULL);
+      
+       if(nocheckDefault == FALSE) { /* Check whether we're supposed to check whether or not we are the default mailer */
+               enabled = gconf_client_get_bool  (gconfclientDefault, "/desktop/gnome/url-handlers/mailto/enabled", NULL);
+               mailer  = gconf_client_get_string(gconfclientDefault, "/desktop/gnome/url-handlers/mailto/command", NULL);
+              
+               if(enabled == FALSE || mailer == NULL || strcmp(mailer, "@evolution %s") != 0) { /* Check whether we are the mailer */
+                       /*Create modal MessageDialog */
+                       dialogDefaultEmailApp = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "Do you want to make Evolution your default e-mail application?");
+                      
+                       checkAlways           = gtk_check_button_new_with_label("Always ask this question");
+                      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkAlways), TRUE);
+                      
+                      gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialogDefaultEmailApp)->vbox), checkAlways);
+              
+                       gtk_widget_show_all(dialogDefaultEmailApp);
+                      
+                       result = gtk_dialog_run(GTK_DIALOG(dialogDefaultEmailApp));
+                      
+                       /* Check results */
+                       if(result == GTK_RESPONSE_YES) {
+                              gconf_client_set_bool(gconfclientDefault, "/desktop/gnome/url-handlers/mailto/enabled", TRUE, NULL);
+                              gconf_client_set_string(gconfclientDefault, "/desktop/gnome/url-handlers/mailto/command", "@evolution %s", NULL);
+                       }
+                      if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkAlways)) == FALSE) {
+                              gconf_client_set_bool(gconfclientDefault, "/apps/evolution/mail/prompts/nocheckdefault", TRUE, NULL);
+                       }
+                       gtk_widget_destroy(dialogDefaultEmailApp);
+               }
+       }
+}
+
static void
mail_component_init (MailComponent *component)
{
@@ -862,6 +908,8 @@
       
        offline = mail_offline_handler_new();
        bonobo_object_add_interface((BonoboObject *)component, (BonoboObject *)offline);
+      
+       dialogCheckForDefault();
}

/* Public API.  */



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