← Back to team overview

ayatana-commits team mailing list archive

[Branch ~indicator-applet-developers/evolution-indicator/trunk] Rev 77: Use libunity to set count on launcher

 

Merge authors:
  Ken VanDine (ken-vandine)
Related merge proposals:
  https://code.launchpad.net/~ken-vandine/evolution-indicator/unity_counter/+merge/50821
  proposed by: Ken VanDine (ken-vandine)
  review: Approve - Conor Curran (cjcurran)
------------------------------------------------------------
revno: 77 [merge]
committer: Ted Gould <ted@xxxxxxxx>
branch nick: trunk
timestamp: Thu 2011-03-03 13:03:35 -0600
message:
  Use libunity to set count on launcher
modified:
  configure.ac
  src/evolution-indicator.c


--
lp:evolution-indicator
https://code.launchpad.net/~indicator-applet-developers/evolution-indicator/trunk

Your team ayatana-commits is subscribed to branch lp:evolution-indicator.
To unsubscribe from this branch go to https://code.launchpad.net/~indicator-applet-developers/evolution-indicator/trunk/+edit-subscription
=== modified file 'configure.ac'
--- configure.ac	2011-02-07 15:30:00 +0000
+++ configure.ac	2011-02-25 18:17:25 +0000
@@ -66,6 +66,7 @@
                   libnotify
                   libcanberra
                   gtkhtml-editor-3.14
+                  unity
                   )
 AC_SUBST(DEPS_CFLAGS)
 AC_SUBST(DEPS_LIBS)

=== modified file 'src/evolution-indicator.c'
--- src/evolution-indicator.c	2011-02-07 15:30:00 +0000
+++ src/evolution-indicator.c	2011-02-25 18:17:25 +0000
@@ -46,6 +46,8 @@
 #include <libindicate/indicator.h>
 #include <libindicate/indicator-messages.h>
 
+#include <unity.h>
+
 #include "xutils.h"
 
 #define CONF_DIR          "/apps/evolution/eplugin/evolution_indicator"
@@ -71,6 +73,8 @@
 static GSList         *indicators = NULL;
 static gint            n_accounts = 0;
 
+static UnityLauncherEntry       *launcher = NULL;
+
 static NotifyNotification *notification   = NULL;
 static ca_context         *canberra_cxt   = NULL;
 static ca_proplist        *canberra_props = NULL;
@@ -276,6 +280,8 @@
       }
     }
 
+  update_unity_launcher_count ();
+
   /* Show bubble */
   if (show_bubble)
   {
@@ -358,9 +364,37 @@
     }
   message_count = 0;
 
+  update_unity_launcher_count ();
+
   g_static_mutex_unlock (&mlock);
 }
 
+void
+update_unity_launcher_count ()
+{
+  GSList *i;
+  int count = 0;
+
+  g_debug ("EI: update_unity_launcher_count");
+
+  for (i = indicators; i; i = i->next)
+  {
+    IndicateIndicator *indicator = i->data;
+
+    count = count + get_indicator_unread_count (indicator);
+
+    g_debug ("EI: Setting count to %d unread messages", count);
+
+  }
+  unity_launcher_entry_set_count (launcher, count);
+  if (count > 0)
+  {
+    unity_launcher_entry_set_count_visible (launcher, TRUE);
+  } else {
+    unity_launcher_entry_set_count_visible (launcher, FALSE);
+  }
+}
+
 /*
  * GCONF CLIENTS
  */
@@ -731,6 +765,8 @@
 	dbusmenu_server_set_root(menu_server, root);
 	indicate_server_set_menu(server, menu_server);
 
+    launcher = unity_launcher_entry_get_for_desktop_file (EVOLUTION_DESKTOP_FILE);
+
     client = gconf_client_get_default ();
     gconf_client_add_dir (client, CONF_DIR, GCONF_CLIENT_PRELOAD_NONE, NULL);
 
@@ -998,6 +1034,7 @@
 
     }
     message_count = 0;
+    update_unity_launcher_count ();
   }
   else
   {