← Back to team overview

ayatana-commits team mailing list archive

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

 

Merge authors:
  Neil J. Patel (njpatel)
Related merge proposals:
  https://code.launchpad.net/~indicator-applet-developers/evolution-indicator/ignore-inactive-accounts/+merge/11864
  proposed by: Neil J. Patel (njpatel)
  review: Approve - Ted Gould (ted)
------------------------------------------------------------
revno: 52 [merge]
committer: Neil Jagdish Patel <neil.patel@xxxxxxxxxxxxx>
branch nick: trunk
timestamp: Wed 2009-09-16 15:33:18 +0100
message:
  modified:
    src/evolution-indicator.c
  pending merges:
    Neil Jagdish Patel 2009-09-16 modified:
      Neil Jagdish Patel 2009-09-16 modified:
      Neil Jagdish Patel 2009-09-16 modified:
      Neil Jagdish Patel 2009-09-16 modified:
modified:
  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 'src/evolution-indicator.c'
--- src/evolution-indicator.c	2009-09-16 09:52:29 +0000
+++ src/evolution-indicator.c	2009-09-16 14:33:18 +0000
@@ -106,6 +106,8 @@
 
   gint reap_type;
 
+  gboolean enabled;
+
 } ParserData;
 
 enum {
@@ -469,7 +471,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;
@@ -502,6 +518,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);
     }
 }
@@ -551,7 +571,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 */
@@ -576,21 +596,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);