← Back to team overview

ayatana-commits team mailing list archive

[Branch ~indicator-applet-developers/evolution-indicator/trunk] Rev 44: modified:

 

Merge authors:
  Neil J. Patel (njpatel)
Related merge proposals:
  https://code.launchpad.net/~indicator-applet-developers/evolution-indicator/fix-preferences/+merge/11351
  proposed by: Neil J. Patel (njpatel)
  review: Approve - Ted Gould (ted)
------------------------------------------------------------
revno: 44 [merge]
committer: Neil Jagdish Patel <neil.patel@xxxxxxxxxxxxx>
branch nick: trunk
timestamp: Tue 2009-09-08 13:58:19 +0100
message:
  modified:
    po/Makefile.in.in
    src/evolution-indicator.c
  pending merges:
    Neil Jagdish Patel 2009-09-08 modified:
      Neil Jagdish Patel 2009-09-08 modified:
      Neil Jagdish Patel 2009-09-08 modified:
      Neil Jagdish Patel 2009-08-25 modified:
  
      - Move the preferences group to the top of the tab
      - Add support for changing the strings used depending on the number of
        configured accounts
modified:
  po/Makefile.in.in
  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 'po/Makefile.in.in'
--- po/Makefile.in.in	2009-04-03 21:42:17 +0000
+++ po/Makefile.in.in	2009-09-08 10:18:17 +0000
@@ -56,7 +56,7 @@
 
 PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; else echo "$(ALL_LINGUAS)"; fi)
 
-USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep '^$$lang$$' $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep '^$$lang$$'`"; then printf "$$lang "; fi; done; fi)
+USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep \^$$lang$$ $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep \^$$lang$$`"; then printf "$$lang "; fi; done; fi)
 
 USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
 

=== modified file 'src/evolution-indicator.c'
--- src/evolution-indicator.c	2009-04-22 14:01:50 +0000
+++ src/evolution-indicator.c	2009-09-08 10:26:58 +0000
@@ -52,11 +52,16 @@
 #define SHOW_BUBBLE       CONF_DIR"/show_bubble"
 #define SHOW_NEW_IN_PANEL CONF_DIR"/show_new_messages_in_panel"
 
+#define ACCOUNT_DIR "/apps/evolution/mail"
+#define ACCOUNTS    ACCOUNT_DIR"/accounts"
+
 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 NotifyNotification *notification   = NULL;
 static ca_context         *canberra_cxt   = NULL;
 static ca_proplist        *canberra_props = NULL;
@@ -71,6 +76,7 @@
 static guint         play_sound_id  = 0;
 static guint         show_bubble_id = 0;
 static guint         show_count_id  = 0;
+static guint         accounts_id    = 0;
 
 static gint message_count = 0;
 
@@ -325,6 +331,47 @@
   g_debug ("EI: Show Bubbles %s", show_bubble ? "true" : "false");
 }
 
+static void
+update_accounts (void)
+{
+  GSList *accounts;
+  GError *error = NULL;
+
+  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)",
+                 error ? error->message : "unknown");
+      if (error)
+        g_error_free (error);
+      
+      /* We could have this as 0 too, as it won't effect anything. It just
+       * seems to make more sense to have it default at 1
+       */
+      n_accounts = 1;
+    }
+  else
+    {
+      n_accounts = g_slist_length (accounts);
+
+      g_slist_free (accounts);
+    }
+
+  g_debug ("Number of email accounts: %d", n_accounts);
+}
+
+static void
+on_accounts_changed (GConfClient *gclient,
+                     guint        id,
+                     GConfEntry  *entry,
+                     gpointer     data)
+{
+  update_accounts ();
+}
+
 int
 e_plugin_lib_enable (EPluginLib *ep, int enable)
 {
@@ -379,13 +426,18 @@
     show_bubble_id = gconf_client_notify_add (client, SHOW_BUBBLE, 
                              show_bubble_changed, NULL, NULL, NULL);
 
-
     show_count = gconf_client_get_bool (client, 
                                         SHOW_NEW_IN_PANEL, 
                                         NULL);
     show_count_id = gconf_client_notify_add (client, SHOW_NEW_IN_PANEL, 
                              show_new_in_panel_changed, NULL, NULL, NULL);
 
+    gconf_client_add_dir (client, ACCOUNT_DIR,GCONF_CLIENT_PRELOAD_NONE, NULL);
+    update_accounts ();
+    accounts_id = gconf_client_notify_add (client, ACCOUNTS,
+                                           on_accounts_changed, NULL,
+                                           NULL, NULL);
+
     if (show_count)
     {
       indicate_server_show (INDICATE_SERVER (mail_server));
@@ -397,6 +449,7 @@
     gconf_client_notify_remove (client, play_sound_id);
     gconf_client_notify_remove (client, show_bubble_id);
     gconf_client_notify_remove (client, show_count_id);
+    gconf_client_notify_remove (client, accounts_id);
 
     g_object_unref (client);      client = NULL;
     g_object_unref (mail_server); mail_server = NULL;
@@ -494,6 +547,8 @@
 
     frame = (GtkWidget*)data->parent->parent->parent;
 
+    gtk_box_reorder_child (GTK_BOX (frame->parent), frame, 0);
+
     box = gtk_hbox_new (FALSE, 0);
     gtk_frame_set_label_widget (GTK_FRAME (frame), box);
     gtk_widget_show (frame);
@@ -506,7 +561,8 @@
     label2 = gtk_label_new (" ");
 
     combo = gtk_combo_box_new_text ();
-    gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Inbox"));
+    gtk_combo_box_append_text (GTK_COMBO_BOX (combo),
+                               n_accounts > 1 ? _("Any Inbox") : _("Inbox"));
     gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Any Folder"));
     gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 
                               only_inbox ? 0 : 1);