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

Proposed by Neil J. Patel
Status: Merged
Merged at revision: not available
Proposed branch: lp:~indicator-applet-developers/evolution-indicator/ignore-inactive-accounts
Merge into: lp:evolution-indicator
Diff against target: None lines
To merge this branch: bzr merge lp:~indicator-applet-developers/evolution-indicator/ignore-inactive-accounts
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+11864@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Neil J. Patel (njpatel) wrote :

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.

Revision history for this message
Ted Gould (ted) wrote :

On Wed, 2009-09-16 at 11:00 +0000, Neil J. Patel wrote:
> 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.

Looks good, excited about the feature!

  review approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/evolution-indicator.c'
2--- src/evolution-indicator.c 2009-09-10 16:44:38 +0000
3+++ src/evolution-indicator.c 2009-09-16 10:50:38 +0000
4@@ -106,6 +106,8 @@
5
6 gint reap_type;
7
8+ gboolean enabled;
9+
10 } ParserData;
11
12 enum {
13@@ -468,7 +470,21 @@
14
15 if (g_strcmp0 (element_name, "account") == 0)
16 {
17- data->name = g_strdup (attribute_values[0]);
18+ gint i = 0;
19+
20+ while (attribute_names[i] != NULL)
21+ {
22+ if (g_strcmp0 (attribute_names[i], "name") == 0)
23+ {
24+ data->name = g_strdup (attribute_values[i]);
25+ }
26+ else if (g_strcmp0 (attribute_names[i], "enabled") == 0)
27+ {
28+ if (g_strcmp0 (attribute_values[i], "false") == 0)
29+ data->enabled = FALSE;
30+ }
31+ i++;
32+ }
33 }
34 else if (g_strcmp0 (element_name, "url") == 0)
35 data->reap_type = REAP_URL;
36@@ -501,6 +517,10 @@
37
38 data->url = g_strdup (tokens[0]);
39
40+ /* Accounts with no configured way to receive mail will not have a URL */
41+ if (!data->url)
42+ data->enabled = FALSE;
43+
44 g_strfreev (tokens);
45 }
46 }
47@@ -550,7 +570,7 @@
48 {
49 gchar *account_info = a->data;
50 GMarkupParseContext *context;
51- ParserData data = { NULL, NULL, REAP_NONE };
52+ ParserData data = { NULL, NULL, NULL, NULL, 0, TRUE };
53 IndicateIndicator *indicator;
54
55 /* Parse account XML to get some useful details about the account */
56@@ -575,21 +595,26 @@
57 g_debug ("New account: %s (%s)", data.name, data.url);
58 }
59
60+ if (!data.enabled)
61+ indicate_indicator_hide (indicator);
62+
63 /* Fake a time */
64 g_time_val_add (&timeval, -1000000 * 60 * i);
65 indicate_indicator_set_property_time (indicator,
66- INDICATE_INDICATOR_MESSAGES_PROP_TIME,
67+ INDICATE_INDICATOR_MESSAGES_PROP_TIME,
68 &timeval);
69
70+ i++;
71+
72 /* Clean up */
73 g_free (data.url);
74 g_free (data.name);
75 g_free (data.parent);
76 g_free (data.last_parent);
77+ data.reap_type = REAP_NONE;
78+ data.enabled = TRUE;
79
80 g_markup_parse_context_free (context);
81-
82- i++;
83 }
84
85 g_slist_foreach (old_list, (GFunc)g_object_unref, NULL);

Subscribers

People subscribed via source and target branches