← Back to team overview

ayatana-commits team mailing list archive

lp:~indicator-applet-developers/evolution-indicator/multiple-mailbox-indication into lp:evolution-indicator

 

Neil J. Patel has proposed merging lp:~indicator-applet-developers/evolution-indicator/multiple-mailbox-indication into lp:evolution-indicator.

Requested reviews:
    Indicator Applet Developers (indicator-applet-developers)

So, this branch adds support for the latest indicator API. It

- Removes the old "mail-server" object
- Creates a simple server using ref_default ()
- Creates 1 indicator per account, using the user-defined name
- Changes the way we set the unread count by changing it per account
- Cleans them all out when evolution sends the 'read' signal
- Shows the evolution window when the user clicks on the server or indicators (still working on how to show the individual accounts when they click on them).

They'll be other bits and pieces, but I've been testing for a bit and it seems to work fine with ~4 accounts.
-- 
https://code.launchpad.net/~indicator-applet-developers/evolution-indicator/multiple-mailbox-indication/+merge/11464
Your team ayatana-commits is subscribed to branch lp:evolution-indicator.
=== modified file '.bzrignore'
--- .bzrignore	2009-08-04 16:58:03 +0000
+++ .bzrignore	2009-09-09 17:04:22 +0000
@@ -56,3 +56,4 @@
 src/mail-server.lo
 src/org-freedesktop-evolution-indicator.eplug
 src/xutils.lo
+autom4te.cache

=== modified file 'configure.ac'
--- configure.ac	2009-08-04 17:15:06 +0000
+++ configure.ac	2009-09-09 17:02:23 +0000
@@ -1,6 +1,7 @@
 AC_PREREQ(2.53)
-AC_INIT(evolution-indicator, 0.1.16, [])
+AC_INIT(evolution-indicator, 0.1.17, [])
 AM_INIT_AUTOMAKE()
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
 AC_CONFIG_SRCDIR(src/evolution-indicator.c)
 AM_CONFIG_HEADER(config.h)
 AM_MAINTAINER_MODE

=== modified file 'src/Makefile.am'
--- src/Makefile.am	2009-04-03 21:46:11 +0000
+++ src/Makefile.am	2009-09-09 17:02:23 +0000
@@ -9,8 +9,6 @@
 liborg_freedesktop_evolution_indicator_la_SOURCES = \
 	e-shell.h \
 	evolution-indicator.c \
-	mail-server.c \
-	mail-server.h \
   xutils.c \
   xutils.h
 

=== modified file 'src/evolution-indicator.c'
--- src/evolution-indicator.c	2009-09-08 10:26:58 +0000
+++ src/evolution-indicator.c	2009-09-09 18:26:17 +0000
@@ -25,14 +25,15 @@
 #include <string.h>
 #include <glib.h>
 #include <glib/gi18n-lib.h>
+#include <glib/gprintf.h>
 
 #include <gconf/gconf.h>
 
 #include <canberra.h>
 #include <libnotify/notify.h>
-#include <libindicate/indicator-message.h>
 
 #include <time.h>
+#include <string.h>
 
 #include <e-util/e-config.h>
 #include <mail/em-utils.h>
@@ -42,8 +43,11 @@
 #include <shell/e-component-view.h>
 #include <shell/es-event.h>
 
+#include <libindicate/server.h>
+#include <libindicate/indicator.h>
+#include <libindicate/indicator-messages.h>
+
 #include "e-shell.h"
-#include "mail-server.h"
 #include "xutils.h"
 
 #define CONF_DIR          "/apps/evolution/eplugin/evolution_indicator"
@@ -55,12 +59,15 @@
 #define ACCOUNT_DIR "/apps/evolution/mail"
 #define ACCOUNTS    ACCOUNT_DIR"/accounts"
 
+#define EVOLUTION_DESKTOP_FILE "/usr/share/applications/evolution-mail.desktop"
+
 static EShell       *evo_shell   = NULL;
-static MailServer   *mail_server = NULL;
 static GStaticMutex  mlock       = G_STATIC_MUTEX_INIT;
 static GConfClient  *client      = NULL;
 
-static gint          n_accounts  = 0;
+static IndicateServer *server     = NULL;
+static GSList         *indicators = NULL;
+static gint            n_accounts = 0;
 
 static NotifyNotification *notification   = NULL;
 static ca_context         *canberra_cxt   = NULL;
@@ -87,6 +94,24 @@
 int         e_plugin_lib_enable               (EPluginLib *ep, int enable);
 GtkWidget * e_plugin_lib_get_configure_widget (EPlugin *epl);
 
+static void show_evolution (gpointer arg0, gpointer arg1);
+
+typedef struct {
+  gchar *url;
+  gchar *name;
+  gchar *parent;
+  gchar *last_parent;
+
+  gint reap_type;
+
+} ParserData;
+
+enum {
+  REAP_NONE = 0,
+  REAP_URL,
+  REAP_NAME
+};
+
 static GtkWidget *
 get_cfg_widget (void)
 {
@@ -157,6 +182,26 @@
   return FALSE;
 }
 
+static gint
+get_indicator_unread_count (IndicateIndicator *indicator)
+{
+  return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (indicator), "unread"));
+}
+
+static void
+set_indicator_unread_count (IndicateIndicator *indicator, gint count)
+{
+  gchar buf[21];
+
+  g_sprintf (buf, "%d", count);
+  indicate_indicator_set_property (indicator,
+                                   INDICATE_INDICATOR_MESSAGES_PROP_COUNT,
+                                   buf);
+  g_object_set_data (G_OBJECT (indicator),
+                     "unread",
+                     GINT_TO_POINTER (count));
+}
+
 void
 org_gnome_mail_new_notify (EPlugin *ep, EMEventTargetFolder *t)
 {
@@ -185,8 +230,36 @@
  
   if (show_count)
   {
-    /* Update libindicate */
-    mail_server_set_message_count (mail_server, message_count);
+    IndicateIndicator *indicator = NULL;
+    GSList *i;
+
+    for (i = indicators; i; i = i->next)
+      {
+        IndicateIndicator *indi = i->data;
+
+        if (g_strstr_len (t->uri,
+                          -1,
+                          indicate_indicator_get_property (indi, "url")))
+          {
+            indicator = indi;
+            break;
+          }
+      }
+      if (indicator)
+        {
+          gint count;
+            
+          count = get_indicator_unread_count (indicator);
+          set_indicator_unread_count (indicator, count + t->new);
+
+          indicate_indicator_set_property (indicator,
+                                           INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION,
+                                           "true");
+        }
+      else
+        {
+          g_warning ("Unable to find account that matches %s", t->uri);
+        }
   }
 
   /* Show bubble */
@@ -248,19 +321,28 @@
 void
 org_gnome_mail_read_notify (EPlugin *ep, EMEventTargetMessage *t)
 {
-	g_return_if_fail (t != NULL);
+  GSList *i;
+  
+  g_return_if_fail (t != NULL);
 
 	g_static_mutex_lock (&mlock);
 
   g_debug ("EI: mail_read_notify");
 
-  message_count = 0;
-
-  if (show_count)
-  {
-    mail_server_set_message_count (mail_server, message_count);
-  }
-  
+  for (i = indicators; i; i = i->next)
+    {
+      IndicateIndicator *indicator = i->data;
+
+      set_indicator_unread_count (indicator, 0);
+      indicate_indicator_set_property (indicator,
+                                       INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION,
+                                       "false");
+
+      g_debug ("Setting %s to 0 unread messages",
+               indicate_indicator_get_property (indicator, "name"));
+
+    }
+
   g_static_mutex_unlock (&mlock);
 }
 
@@ -309,8 +391,8 @@
 
   show_count = gconf_value_get_bool (value);
 
-  show_count ? indicate_server_show (INDICATE_SERVER (mail_server))
-             : indicate_server_hide (INDICATE_SERVER (mail_server));
+  show_count ? indicate_server_show (server)
+             : indicate_server_hide (server);
 
   g_debug ("EI: Messages in panel %s", 
            show_count ? "true" : "false");
@@ -331,19 +413,110 @@
   g_debug ("EI: Show Bubbles %s", show_bubble ? "true" : "false");
 }
 
+static IndicateIndicator *
+find_indicator_for_url (GSList *indicator_list, const gchar *url)
+{
+  GSList *i;
+
+  for (i = indicator_list; i; i = i->next)
+    {
+      IndicateIndicator *indicator = i->data;
+
+      if (g_strcmp0 (indicate_indicator_get_property (indicator, "url"), url)
+          == 0)
+        return indicator;
+    }
+  return NULL;
+}
+
+static IndicateIndicator *
+create_indicator (const gchar *url, const gchar *name)
+{
+  IndicateIndicator *indicator;
+
+  indicator = indicate_indicator_new ();
+  indicate_indicator_set_property (indicator,
+                                   INDICATE_INDICATOR_MESSAGES_PROP_NAME,
+                                   name);
+  indicate_indicator_set_property (indicator,
+                                   "url",
+                                   url);
+  set_indicator_unread_count (indicator, 0);
+  indicate_indicator_show (indicator);
+
+  /* FIXME: I need to find a way to show a mailbox individually */
+  g_signal_connect (indicator, "user-display",
+                    G_CALLBACK (show_evolution), NULL);
+
+  return indicator;
+}
+
+static void
+start_element_handler (GMarkupParseContext *context,
+                       const gchar         *element_name,
+                       const gchar        **attribute_names,
+                       const gchar        **attribute_values,
+                       gpointer             user_data,
+                       GError             **error)
+{
+  ParserData *data = (ParserData *)user_data;
+
+  if (g_strcmp0 (element_name, "account") == 0)
+    {
+      data->name = g_strdup (attribute_values[0]);
+    }
+  else if (g_strcmp0 (element_name, "url") == 0)
+    data->reap_type = REAP_URL;
+  else
+    data->reap_type = REAP_NONE;
+
+  if (data->last_parent)
+    g_free (data->last_parent);
+  
+  data->last_parent = data->parent;
+  data->parent = g_strdup (element_name);
+}
+
+static void
+text_handler (GMarkupParseContext *context,
+              const gchar         *text,
+              gsize                text_len,
+              gpointer             user_data,
+              GError             **error)
+{
+  ParserData *data = (ParserData *)user_data;
+
+  if (!data->url
+      && data->reap_type == REAP_URL
+      && g_strcmp0(data->last_parent, "source") == 0)
+    {
+      gchar **tokens;
+
+      tokens = g_strsplit (text, ";", 2);
+
+      data->url = g_strdup (tokens[0]);
+
+      g_strfreev (tokens);
+    }
+}
+
 static void
 update_accounts (void)
 {
-  GSList *accounts;
-  GError *error = NULL;
-
+  GSList   *accounts;
+  GError   *error = NULL;
+  gint      i = 0;
+  GTimeVal  timeval = { 0, };
+  
+  g_get_current_time (&timeval);
   accounts = gconf_client_get_list (client,
                                     ACCOUNTS,
                                     GCONF_VALUE_STRING,
                                     &error);
   if (accounts == NULL || error)
     {
-      g_warning ("Unable to determine number of accounts, defaulting to '1' (%s)",
+      g_warning ("Unable to determine number of accounts, "
+                 "defaulting to '1' (%s)",
                  error ? error->message : "unknown");
       if (error)
         g_error_free (error);
@@ -355,8 +528,69 @@
     }
   else
     {
+      GSList *old_list;
+      GSList *a;
+      static GMarkupParser parser = {
+          start_element_handler,
+          NULL,
+          text_handler,
+          NULL,
+          NULL
+      };
+
+      old_list = indicators;
+      indicators = NULL;
+      
+      for (a = accounts; a; a = a->next)
+        {
+          gchar               *account_info = a->data;
+          GMarkupParseContext *context;
+          ParserData           data = { NULL, NULL, REAP_NONE };
+          IndicateIndicator   *indicator;
+                                        
+          /* Parse account XML to get some useful details about the account */
+          context = g_markup_parse_context_new (&parser, 0, &data, NULL);
+          g_markup_parse_context_parse (context,
+                                        account_info,
+                                        strlen (account_info),
+                                        NULL);
+
+          /* Check to see account already exists and, if not, create it */
+          indicator = find_indicator_for_url (indicators, data.url);
+          if (indicator)
+            {
+              old_list = g_slist_remove (old_list, indicator);
+              indicators = g_slist_append (indicators, indicator);
+            }
+          else
+            {
+              indicator = create_indicator (data.url, data.name);
+              indicators = g_slist_append (indicators, indicator);
+
+              g_debug ("New account: %s (%s)", data.name, data.url);
+            }
+
+          /* Fake a time */
+          g_time_val_add (&timeval, -1000000 * 60 * i);
+          indicate_indicator_set_property_time (indicator,
+                                         INDICATE_INDICATOR_MESSAGES_PROP_TIME,
+                                                &timeval);
+
+          /* Clean up */
+          g_free (data.url);
+          g_free (data.name);
+          g_free (data.parent);
+          g_free (data.last_parent);
+          
+          g_markup_parse_context_free (context);
+
+          i++;
+        }
+
+      g_slist_foreach (old_list, (GFunc)g_object_unref, NULL);
+      g_slist_free (old_list);
+
       n_accounts = g_slist_length (accounts);
-
       g_slist_free (accounts);
     }
 
@@ -405,7 +639,11 @@
       }
     }
 
-    mail_server = mail_server_get_default ();
+    server = indicate_server_ref_default ();
+    indicate_server_set_type (server, "message");
+    indicate_server_set_desktop_file (server, EVOLUTION_DESKTOP_FILE);
+    g_signal_connect (server, "server-display",
+                      G_CALLBACK (show_evolution), NULL);
 
     client = gconf_client_get_default ();
     gconf_client_add_dir (client, CONF_DIR, GCONF_CLIENT_PRELOAD_NONE, NULL);
@@ -440,7 +678,7 @@
 
     if (show_count)
     {
-      indicate_server_show (INDICATE_SERVER (mail_server));
+      indicate_server_show (server);
     }
   }
   else
@@ -452,7 +690,16 @@
     gconf_client_notify_remove (client, accounts_id);
 
     g_object_unref (client);      client = NULL;
-    g_object_unref (mail_server); mail_server = NULL;
+    
+    /* Free indicators */
+    g_slist_foreach (indicators, (GFunc)g_object_unref, NULL);
+    g_slist_free (indicators);
+    indicators = NULL;
+
+    /* Free server */
+    indicate_server_hide (server);
+    g_object_unref (server);
+    server = NULL;
     
     g_debug ("EI: Disabled");
   }
@@ -486,7 +733,6 @@
   g_debug ("EI: SHELL STARTUP");
   
   evo_shell = t->shell;
-  mail_server_set_e_shell (mail_server_get_default (), t->shell);
 }
 
 static void
@@ -618,3 +864,117 @@
 	
   return check;
 }
+
+/*
+ *
+ * SHOW EVOLUTION CODE
+ *
+ */
+
+/*
+ * Taken from libtomboy, (C) 2008 Novell, LGPL v2 or later
+ */
+static void
+tomboy_window_override_user_time (GtkWindow *window)
+{
+	guint32 ev_time = gtk_get_current_event_time();
+
+	if (ev_time == 0) {
+		/* 
+		 * FIXME: Global keypresses use an event filter on the root
+		 * window, which processes events before GDK sees them.
+		 */
+		//ev_time = tomboy_keybinder_get_current_event_time ();
+    ev_time = GDK_CURRENT_TIME;
+	}
+	if (ev_time == 0) {
+		gint ev_mask = gtk_widget_get_events (GTK_WIDGET(window));
+		if (!(ev_mask & GDK_PROPERTY_CHANGE_MASK)) {
+			gtk_widget_add_events (GTK_WIDGET (window),
+					       GDK_PROPERTY_CHANGE_MASK);
+		}
+
+		/* 
+		 * NOTE: Last resort for D-BUS or other non-interactive
+		 *       openings.  Causes roundtrip to server.  Lame. 
+		 */
+		ev_time = gdk_x11_get_server_time (GTK_WIDGET(window)->window);
+	}
+
+	gdk_x11_window_set_user_time (GTK_WIDGET(window)->window, ev_time);
+}
+
+static void 
+really_present_window (GtkWindow *window)
+{
+	if (!GTK_WIDGET_REALIZED (window))
+		gtk_widget_realize (GTK_WIDGET (window));
+
+	tomboy_window_override_user_time (window);
+
+	gtk_window_present (window);
+}
+
+static void
+show_evolution (gpointer arg0, gpointer arg1)
+{
+#define MAIL_ICON "evolution-mail"
+  EShell *shell = evo_shell;
+
+  g_debug ("Showing Evolution to user");
+
+  if (shell)
+  {
+    GSList    *i;
+    GList     *w;
+    GtkWindow *mail_window = NULL;
+
+    for (w = shell->priv->windows; w; w = w->next)
+    {
+      GtkWindow *window = w->data;
+
+      if (GTK_IS_WINDOW (window))
+      {
+        if (g_strcmp0 (MAIL_ICON, gtk_window_get_icon_name (window)) == 0)
+        {
+          mail_window = window;
+        }
+      }
+      else
+      {
+        g_warning ("No open windows: Wait, we're not a mac :-/");
+        return;
+      }
+    }
+
+    if (!GTK_IS_WINDOW (mail_window))
+    {
+      if (shell->priv->windows && shell->priv->windows->data)
+        mail_window = shell->priv->windows->data;
+      else
+        return;
+    }
+
+    really_present_window (mail_window);
+    for (i = indicators; i; i = i->next)
+    {
+      IndicateIndicator *indicator = i->data;
+
+      set_indicator_unread_count (indicator, 0);
+      indicate_indicator_set_property (indicator,
+                                       INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION,
+                                       "false");
+
+      g_debug ("Setting %s to 0 unread messages",
+               indicate_indicator_get_property (indicator, "name"));
+
+    }
+  }
+  else
+  {
+    g_warning ("Cannot show window, no shell");
+    return;
+  }
+}
+
+

=== removed file 'src/mail-server.c'
--- src/mail-server.c	2009-03-15 11:21:09 +0000
+++ src/mail-server.c	1970-01-01 00:00:00 +0000
@@ -1,352 +0,0 @@
-/*
- * Copyright (C) 2009 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as 
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * Authored by Neil Jagdish Patel <neil.patel@xxxxxxxxxxxxx>
- *
- */
-
-#include "mail-server.h"
-
-G_DEFINE_TYPE (MailServer, mail_server, INDICATE_TYPE_SERVER);
-
-#define MAIL_SERVER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj),\
-  MAIL_TYPE_SERVER, \
-  MailServerPrivate))
-
-struct _MailServerPrivate
-{
-  EShell *shell;
-  guint count;
-};
-
-enum
-{
-  PROP_0,
-
-  PROP_COUNT
-};
-
-/* Forwards */
-static gboolean mail_server_get_indicator_count (IndicateServer  *server,
-                                                 guint           *count, 
-                                                 GError          **error);
-static gboolean mail_server_get_indicator_property (IndicateServer *server,
-                                                    guint           id,
-                                                    gchar          *type,
-                                                    gchar         **value,
-                                                    GError        **error);
-
-static gboolean mail_server_show_indicator_to_user (IndicateServer *server,
-                                                    guint           id,
-                                                    GError        **error);
-
-static void really_present_window (GtkWindow *window);
-
-/* GObject stuff */
-static void
-mail_server_get_property (GObject    *object,
-                        guint       prop_id,
-                        GValue     *value,
-                        GParamSpec *pspec)
-{
-  MailServer *server = MAIL_SERVER (object);
-
-  switch (prop_id)
-  {
-    case PROP_COUNT:
-      g_value_set_uint (value, server->priv->count);
-      break;
-    
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-  }
-}
-
-static void
-mail_server_set_property (GObject      *object,
-                        guint         prop_id,
-                        const GValue *value,
-                        GParamSpec   *pspec)
-{
-  MailServer *server = MAIL_SERVER (object);
-
-  switch (prop_id)
-  {
-    case PROP_COUNT:
-      mail_server_set_message_count (server, g_value_get_uint (value));
-      break;
-
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-  }
-}
-
-
-static void
-mail_server_finalize (GObject *obj)
-{
-  MailServer *server = MAIL_SERVER (obj);
-  MailServerPrivate *priv;
-
-  g_return_if_fail (MAIL_IS_SERVER (server));
-  priv = server->priv;
-
-  G_OBJECT_CLASS (mail_server_parent_class)->finalize (obj);
-}
-
-static void
-mail_server_class_init (MailServerClass *klass)
-{
-  GParamSpec   *pspec;
-  GObjectClass *obj_class         = G_OBJECT_CLASS (klass);
-  IndicateServerClass * ind_class = INDICATE_SERVER_CLASS (klass);
-    
-  obj_class->finalize     = mail_server_finalize;
-  obj_class->set_property = mail_server_set_property;
-  obj_class->get_property = mail_server_get_property;
-
-  ind_class->get_indicator_count    = mail_server_get_indicator_count;
-  ind_class->get_indicator_property = mail_server_get_indicator_property;
-  ind_class->show_indicator_to_user = mail_server_show_indicator_to_user;
-
-  /* Property */
-  pspec = g_param_spec_uint ("count",
-                             "count",
-                             "count",
-                             0, G_MAXUINT, 0,
-                             G_PARAM_READWRITE);
-  g_object_class_install_property (obj_class, PROP_COUNT, pspec); 
-
-  g_type_class_add_private (obj_class, sizeof (MailServerPrivate));
-}
-
-static void
-mail_server_init (MailServer *server)
-{
-  MailServerPrivate *priv;
-       
-  priv = server->priv = MAIL_SERVER_GET_PRIVATE (server);
-
-  indicate_server_set_desktop_file(INDICATE_SERVER(server), "/usr/share/applications/evolution-mail.desktop");
-  indicate_server_set_type(INDICATE_SERVER(server), "message.mail");
-}
-
-/*
- * Public Functions
- */
-
-MailServer * 
-mail_server_get_default (void)
-{
-  static MailServer *server = NULL;
-  
-  if (!server)
-    server = g_object_new (MAIL_TYPE_SERVER, 
-                           NULL);
-  return server;
-}
-
-guint
-mail_server_get_message_count (MailServer *server)
-{
-  g_return_val_if_fail (MAIL_IS_SERVER (server), 0);
-
-  return server->priv->count;
-}
-
-void
-mail_server_set_message_count (MailServer *server, 
-                               guint       count)
-{
-  MailServerPrivate *priv;
-  gint i, diff;
-  gboolean added = TRUE;
-
-  g_return_if_fail (MAIL_IS_SERVER (server));
-  priv = server->priv;
-  
-  g_debug ("MAIL SERVER: Count changed: %d", count);
-
-  if (priv->count >= count)
-  {
-    added = FALSE;
-    diff = priv->count - count;
-  }
-  else
-  {
-    diff = count - priv->count;
-  }
-
-  server->priv->count = count;
-  
-  for (i = 0; i < diff; i++)
-    added ? indicate_server_emit_indicator_added (INDICATE_SERVER (server),
-                                                  i + 1, "message")
-          : indicate_server_emit_indicator_removed (INDICATE_SERVER (server), 
-                                                    diff - i, "message");
-}
-
-/*
- * Indicate Server overrides
- */
-static gboolean 
-mail_server_get_indicator_count (IndicateServer  *server,
-                                 guint           *count, 
-                                 GError         **error)
-{
-  g_return_val_if_fail (MAIL_IS_SERVER (server), FALSE);
-
-  *count = MAIL_SERVER (server)->priv->count;
-  return TRUE;
-}
-
-static gboolean 
-mail_server_get_indicator_property (IndicateServer *server,
-                                    guint           id,
-                                    gchar          *type,
-                                    gchar         **value,
-                                    GError        **error)
-{
-  g_return_val_if_fail (MAIL_IS_SERVER (server), FALSE);
-
-  if (g_strcmp0 (type, "subtype") == 0)
-  {
-    *value = g_strdup ("email");
-    return TRUE;
-  }
-
-  if (g_strcmp0 (type, "desktop") == 0)
-  {
-    /* We should probably do something clever here */
-    *value = g_strdup ("/usr/share/applications/evolution-mail.desktop");
-    return TRUE;
-  }
-
-  g_warning ("Mail Server does not support the \"%s\" property", type);
-
-  return FALSE;
-}
-
-static gboolean 
-mail_server_show_indicator_to_user (IndicateServer *server,
-                                    guint           id,
-                                    GError        **error)
-{
-#define MAIL_ICON "evolution-mail"
-  MailServerPrivate *priv;
-
-  g_return_val_if_fail (MAIL_IS_SERVER (server), FALSE);
-  priv = MAIL_SERVER (server)->priv;
-
-  g_debug ("MAIL SERVER: Show Evolution to user");
-
-  if (priv->shell)
-  {
-    GList *w;
-    GtkWindow *mail_window = NULL;
-
-    for (w = priv->shell->priv->windows; w; w = w->next)
-    {
-      GtkWindow *window = w->data;
-
-      if (GTK_IS_WINDOW (window))
-      {
-        if (g_strcmp0 (MAIL_ICON, gtk_window_get_icon_name (window)) == 0)
-        {
-          mail_window = window;
-        }
-      }
-      else
-      {
-        g_warning ("No open windows: Wait, we're not a mac :-/");
-        return FALSE;
-      }
-    }
-
-    if (!GTK_IS_WINDOW (mail_window))
-    {
-      if (priv->shell->priv->windows && priv->shell->priv->windows->data)
-        mail_window = priv->shell->priv->windows->data;
-      else
-        return FALSE;
-    }
-
-    really_present_window (mail_window);
-    mail_server_set_message_count (MAIL_SERVER (server), 0);
-  }
-  else
-  {
-    g_warning ("Cannot show window, no shell");
-    return FALSE;
-  }
-
-  return TRUE;
-}
-
-void
-mail_server_set_e_shell (MailServer *server,
-                         EShell     *shell)
-{
-  g_return_if_fail (MAIL_IS_SERVER (server));
-
-  server->priv->shell = shell;
-}
-
-
-/*
- * Taken from libtomboy, (C) 2008 Novell, LGPL v2 or later
- */
-
-static void
-tomboy_window_override_user_time (GtkWindow *window)
-{
-	guint32 ev_time = gtk_get_current_event_time();
-
-	if (ev_time == 0) {
-		/* 
-		 * FIXME: Global keypresses use an event filter on the root
-		 * window, which processes events before GDK sees them.
-		 */
-		//ev_time = tomboy_keybinder_get_current_event_time ();
-    ev_time = GDK_CURRENT_TIME;
-	}
-	if (ev_time == 0) {
-		gint ev_mask = gtk_widget_get_events (GTK_WIDGET(window));
-		if (!(ev_mask & GDK_PROPERTY_CHANGE_MASK)) {
-			gtk_widget_add_events (GTK_WIDGET (window),
-					       GDK_PROPERTY_CHANGE_MASK);
-		}
-
-		/* 
-		 * NOTE: Last resort for D-BUS or other non-interactive
-		 *       openings.  Causes roundtrip to server.  Lame. 
-		 */
-		ev_time = gdk_x11_get_server_time (GTK_WIDGET(window)->window);
-	}
-
-	gdk_x11_window_set_user_time (GTK_WIDGET(window)->window, ev_time);
-}
-
-static void 
-really_present_window (GtkWindow *window)
-{
-	if (!GTK_WIDGET_REALIZED (window))
-		gtk_widget_realize (GTK_WIDGET (window));
-
-	tomboy_window_override_user_time (window);
-
-	gtk_window_present (window);
-}
-

=== removed file 'src/mail-server.h'
--- src/mail-server.h	2009-02-04 10:45:24 +0000
+++ src/mail-server.h	1970-01-01 00:00:00 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2009 Canonical Ltd
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3 as 
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- *
- * Authored by Neil Jagdish Patel <neil.patel@xxxxxxxxxxxxx>
- *
- */
-
-#ifndef _MAIL_SERVER_H_
-#define _MAIL_SERVER_H_
-
-#include <glib.h>
-#include <glib-object.h>
-#include <libindicate/server.h>
-
-#include "e-shell.h"
-
-#define MAIL_TYPE_SERVER (mail_server_get_type ())
-
-#define MAIL_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),\
-	MAIL_TYPE_SERVER, MailServer))
-
-#define MAIL_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),\
-	MAIL_TYPE_SERVER, MailServerClass))
-
-#define MAIL_IS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
-	MAIL_TYPE_SERVER))
-
-#define MAIL_IS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),\
-	MAIL_TYPE_SERVER))
-
-#define MAIL_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),\
-	MAIL_TYPE_SERVER, MailServerClass))
-
-typedef struct _MailServer        MailServer;
-typedef struct _MailServerClass   MailServerClass;
-typedef struct _MailServerPrivate MailServerPrivate;
- 
-struct _MailServer
-{
-  IndicateServer      parent;	
-
-  MailServerPrivate *priv;
-};
-
-struct _MailServerClass
-{
-  IndicateServerClass   parent_class;
-};
-
-GType mail_server_get_type                   (void) G_GNUC_CONST;
-
-MailServer * mail_server_get_default (void);
-
-guint        mail_server_get_message_count (MailServer *server);
-void         mail_server_set_message_count (MailServer *server, 
-                                            guint       count);
-void         mail_server_set_e_shell       (MailServer *server,
-                                            EShell     *shell);
-
-#endif /* _MAIL_SERVER_H_ */


Follow ups