← Back to team overview

ayatana-commits team mailing list archive

lp:~indicator-applet-developers/evolution-indicator/ignore-inactive-accounts into lp:evolution-indicator

 

Neil J. Patel has proposed merging lp:~indicator-applet-developers/evolution-indicator/ignore-inactive-accounts into lp:evolution-indicator.

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

Fixes two issues to do with showing accounts in the menu:

1. If the user has made an account inactive, make sure it doesn't show up, and
2. If an account doesn't have a configured way to receive email (i.e. its just there as an smtp server), then don't show it in the menu as it'll never receive mail. This matches evolutions behaviour.
-- 
https://code.launchpad.net/~indicator-applet-developers/evolution-indicator/ignore-inactive-accounts/+merge/11864
Your team ayatana-commits is subscribed to branch lp:evolution-indicator.
=== modified file 'src/evolution-indicator.c'
--- src/evolution-indicator.c	2009-09-10 16:44:38 +0000
+++ src/evolution-indicator.c	2009-09-16 10:50:38 +0000
@@ -106,6 +106,8 @@
 
   gint reap_type;
 
+  gboolean enabled;
+
 } ParserData;
 
 enum {
@@ -468,7 +470,21 @@
 
   if (g_strcmp0 (element_name, "account") == 0)
     {
-      data->name = g_strdup (attribute_values[0]);
+      gint i = 0;
+
+      while (attribute_names[i] != NULL)
+        {
+          if (g_strcmp0 (attribute_names[i], "name") == 0)
+            {
+              data->name = g_strdup (attribute_values[i]);
+            }
+          else if (g_strcmp0 (attribute_names[i], "enabled") == 0)
+            {
+              if (g_strcmp0 (attribute_values[i], "false") == 0)
+                data->enabled = FALSE;
+            }
+          i++;
+        }
     }
   else if (g_strcmp0 (element_name, "url") == 0)
     data->reap_type = REAP_URL;
@@ -501,6 +517,10 @@
 
       data->url = g_strdup (tokens[0]);
 
+      /* Accounts with no configured way to receive mail will not have a URL */
+      if (!data->url)
+        data->enabled = FALSE;
+
       g_strfreev (tokens);
     }
 }
@@ -550,7 +570,7 @@
         {
           gchar               *account_info = a->data;
           GMarkupParseContext *context;
-          ParserData           data = { NULL, NULL, REAP_NONE };
+          ParserData           data = { NULL, NULL, NULL, NULL, 0, TRUE };
           IndicateIndicator   *indicator;
                                         
           /* Parse account XML to get some useful details about the account */
@@ -575,21 +595,26 @@
               g_debug ("New account: %s (%s)", data.name, data.url);
             }
 
+          if (!data.enabled)
+            indicate_indicator_hide (indicator);
+
           /* Fake a time */
           g_time_val_add (&timeval, -1000000 * 60 * i);
           indicate_indicator_set_property_time (indicator,
-                                         INDICATE_INDICATOR_MESSAGES_PROP_TIME,
+                                     INDICATE_INDICATOR_MESSAGES_PROP_TIME,
                                                 &timeval);
 
+          i++;
+
           /* Clean up */
           g_free (data.url);
           g_free (data.name);
           g_free (data.parent);
           g_free (data.last_parent);
+          data.reap_type = REAP_NONE;
+          data.enabled = TRUE;
           
           g_markup_parse_context_free (context);
-
-          i++;
         }
 
       g_slist_foreach (old_list, (GFunc)g_object_unref, NULL);


Follow ups