mail-notification

Fork of Jean-Yves Lefort's mail-notification, a tray icon to notify of new mail
git clone https://code.djc.id.au/git/mail-notification/
commit 20de687670e621c4c1e6ee22d6e52caa09387d7c
parent 6f945b0268d2f0f020aebb90dee8b7e714a01479
Author: Dan Callaghan <djc@djc.id.au>
Date:   Sat,  6 Nov 2010 16:19:52 +1000

updated Evolution backend to build correctly, supporting 2.30 and higher

Based on mail-notification-5.4-evolution.patch from Fedora:
http://pkgs.fedoraproject.org/gitweb/?p=mail-notification.git;a=blob;f=mail-notification-5.4-evolution.patch;h=647e64a4eac1afe0ce819bb44d2f9a328e89a0b4;hb=0a002ddd116bd02343a4f9bbf4d0efdf594557ee

Diffstat:
Msrc/mn-evolution-client.gob | 2+-
Msrc/mn-evolution-folder-tree-server.gob | 9++++++++-
Msrc/mn-evolution-plugin.c | 2+-
Msrc/mn-evolution-server.gob | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
4 files changed, 74 insertions(+), 5 deletions(-)
diff --git a/src/mn-evolution-client.gob b/src/mn-evolution-client.gob
@@ -33,7 +33,7 @@
  * from unreferencing the proxy, so provide an eternal singleton
  * proxy.
  */
-class MN:Evolution:Client
+class MN:Evolution:Client from G:Object
 {
   public DBusGProxy *proxy;
   property POINTER proxy (link, export, type = DBusGProxy *);
diff --git a/src/mn-evolution-folder-tree-server.gob b/src/mn-evolution-folder-tree-server.gob
@@ -23,7 +23,10 @@
 
 %{
 #include <dbus/dbus.h>
+#include <libedataserver/eds-version.h>
+#if !EDS_CHECK_VERSION(2,29,0)
 #include <mail/mail-component.h>
+#endif
 #include <mail/em-folder-tree.h>
 #include "mn-evolution-plugin.h"
 #include "mn-evolution.h"
@@ -31,7 +34,7 @@
 #include "mn-evolution-folder-tree-server-dbus.h"
 %}
 
-class MN:Evolution:Folder:Tree:Server
+class MN:Evolution:Folder:Tree:Server from G:Object
 {
   /* the GdkNativeWindow, which we also use as our ID */
   private guint32 id;
@@ -59,10 +62,14 @@ class MN:Evolution:Folder:Tree:Server
 
   constructor (self)
   {
+#if EDS_CHECK_VERSION(2,29,0)
+    selfp->tree = em_folder_tree_new();
+#else
     EMFolderTreeModel *model;
 
     model = mail_component_peek_tree_model(mail_component_peek());
     selfp->tree = em_folder_tree_new_with_model(model);
+#endif
 
     selfp->plug = gtk_plug_new((GdkNativeWindow) selfp->id);
     gtk_container_add(GTK_CONTAINER(selfp->plug), selfp->tree);
diff --git a/src/mn-evolution-plugin.c b/src/mn-evolution-plugin.c
@@ -204,7 +204,7 @@ connect_to_session_bus (void)
 }
 
 int
-e_plugin_lib_enable (EPluginLib *ep, int enable)
+e_plugin_lib_enable (EPlugin *ep, int enable)
 {
   static gboolean enabled = FALSE;
   GError *err = NULL;
diff --git a/src/mn-evolution-server.gob b/src/mn-evolution-server.gob
@@ -25,10 +25,16 @@
 #include <stdio.h>
 #include <libintl.h>
 #include <gobject/gvaluecollector.h>
+#include <libedataserver/eds-version.h>
 #include <camel/camel-folder.h>
+#if EDS_CHECK_VERSION(2,29,0)
+#include <shell/e-shell.h>
+#include <mail/e-mail-browser.h>
+#else
 #include <mail/em-folder-view.h>
 #include <mail/em-format.h>
 #include <mail/em-message-browser.h>
+#endif
 #include <mail/em-utils.h>
 #include <mail/mail-session.h>
 #include <mail/mail-tools.h>
@@ -64,7 +70,7 @@ typedef enum
  * interface methods are run from a main loop callback.
  */
 
-class MN:Evolution:Server
+class MN:Evolution:Server from G:Object
 {
   signal NONE (STRING)
     void folder_changed (self, const char *uri (check null));
@@ -92,10 +98,18 @@ class MN:Evolution:Server
     info = g_new0(FolderInfo, 1);
     info->uri = g_strdup(uri);
     info->folder = folder;
+#if EDS_CHECK_VERSION(2,31,0)
+    g_object_ref(folder);
+#else
     camel_object_ref(folder);
+#endif
 
     /* uncache the folder when it is deleted */
+#if EDS_CHECK_VERSION(2,31,0)
+    g_signal_connect(folder, "deleted", G_CALLBACK(self_folder_deleted_cb), info);
+#else
     camel_object_hook_event(folder, "deleted", self_folder_deleted_cb, info);
+#endif
 
     g_hash_table_replace(folders, info->uri, info);
   }
@@ -103,8 +117,13 @@ class MN:Evolution:Server
   private void
     folder_info_free (FolderInfo *info (check null))
   {
+#if EDS_CHECK_VERSION(2,31,0)
+    g_signal_handlers_disconnect_by_func(info->folder, self_folder_deleted_cb, info);
+    g_object_unref(info->folder);
+#else
     camel_object_unhook_event(info->folder, "deleted", self_folder_deleted_cb, info);
     camel_object_unref(info->folder);
+#endif
     g_free(info->uri);
     g_free(info);
   }
@@ -134,7 +153,11 @@ class MN:Evolution:Server
 	if (info)
 	  {
 	    folder = info->folder;
+#if EDS_CHECK_VERSION(2,31,0)
+            g_object_ref(folder);
+#else
 	    camel_object_ref(folder);
+#endif
 	  }
       }
     else
@@ -142,7 +165,11 @@ class MN:Evolution:Server
 
     if (! folder)
       {
-	folder = mail_tool_uri_to_folder(uri, 0, NULL);
+	folder = mail_tool_uri_to_folder(uri, 0,
+#if EDS_CHECK_VERSION(2,91,0)
+                NULL,
+#endif
+                NULL);
 	if (folder)
 	  self_cache_folder(uri, folder);
 	else
@@ -235,14 +262,23 @@ class MN:Evolution:Server
 
 	for (i = 0; i < summary->len; i++)
 	  {
+#if EDS_CHECK_VERSION(2,23,5)
+            char *uid = summary->pdata[i];
+            CamelMessageInfo *info = camel_folder_get_message_info(folder, uid);
+#else
 	    CamelMessageInfo *info = summary->pdata[i];
+#endif
 
 	    if ((camel_message_info_flags(info) & CAMEL_MESSAGE_SEEN) == 0)
 	      g_ptr_array_add(*ret, self_camel_message_info_to_dbus_struct(info));
 	  }
 
 	camel_folder_free_summary(folder, summary);
+#if EDS_CHECK_VERSION(2,31,0)
+        g_object_unref(folder);
+#else
 	camel_object_unref(folder);
+#endif
       }
 
     GDK_THREADS_LEAVE();
@@ -264,7 +300,11 @@ class MN:Evolution:Server
     if (folder)
       {
 	*ret = g_strdup(camel_folder_get_name(folder));
+#if EDS_CHECK_VERSION(2,31,0)
+        g_object_unref(folder);
+#else
 	camel_object_unref(folder);
+#endif
       }
 
     GDK_THREADS_LEAVE();
@@ -285,6 +325,19 @@ class MN:Evolution:Server
     folder = self_lookup_folder(folder_uri, err);
     if (folder)
       {
+#if EDS_CHECK_VERSION(2,29,0)
+        EShell *shell;
+        EShellBackend *shell_backend;
+        GtkWidget *browser;
+
+        shell = e_shell_get_default ();
+        shell_backend = e_shell_get_backend_by_name (shell, "mail");
+
+        browser = e_mail_browser_new (shell_backend);
+        e_mail_reader_set_folder (E_MAIL_READER (browser), folder, folder_uri);
+        e_mail_reader_set_message (E_MAIL_READER (browser), message_uid);
+        gtk_widget_show (browser);
+#else
 	GtkWidget *browser;
 
 	/* modelled after Evolution's handleuri_got_folder() */
@@ -295,8 +348,13 @@ class MN:Evolution:Server
 	em_folder_view_set_folder((EMFolderView *) browser, folder, folder_uri);
 	em_folder_view_set_message((EMFolderView *) browser, message_uid, FALSE);
 	gtk_widget_show(((EMMessageBrowser *) browser)->window);
+#endif
 
+#if EDS_CHECK_VERSION(2,31,0)
+        g_object_unref(folder);
+#else
 	camel_object_unref(folder);
+#endif
       }
 
     GDK_THREADS_LEAVE();
@@ -320,7 +378,11 @@ class MN:Evolution:Server
     if (folder)
       {
 	status = camel_folder_set_message_flags(folder, message_uid, flags, flags);
+#if EDS_CHECK_VERSION(2,31,0)
+        g_object_unref(folder);
+#else
 	camel_object_unref(folder);
+#endif
 
 	if (! status)
 	  g_set_error(err,