← Back to team overview

ayatana-commits team mailing list archive

lp:~indicator-applet-developers/evolution-indicator/fix-preferences into lp:evolution-indicator

 

Neil J. Patel has proposed merging lp:~indicator-applet-developers/evolution-indicator/fix-preferences into lp:evolution-indicator.

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

This branch handles the changes to evolution-indicator to make it fit into the preferences mockup on https://wiki.ubuntu.com/MessagingMenu#Evolution.

It handles:

1. Moving the "When new mail arrives in blah" group to the top of the General page, and
2. Giving evolution-indicator an idea about how many accounts the user has configured, so it can amend the text in the '...Arrives In Inbox' text to '...Arrives In Any Inbox' if there is more than one account.

The work to make evolution-indicator show separate mailboxes in the messaging-menu will build on the code here (update_accounts will do much more, as will the accounts_changed callback).

The remaining work to the preferences window is out-of-scope for evolution-indicator, and  rather needs to be a patch to evolution itself.
-- 
https://code.launchpad.net/~indicator-applet-developers/evolution-indicator/fix-preferences/+merge/11351
Your team ayatana-commits is subscribed to branch lp:evolution-indicator.
=== 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);


Follow ups