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
=== 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 @@
106106
107 gint reap_type;107 gint reap_type;
108108
109 gboolean enabled;
110
109} ParserData;111} ParserData;
110112
111enum {113enum {
@@ -468,7 +470,21 @@
468470
469 if (g_strcmp0 (element_name, "account") == 0)471 if (g_strcmp0 (element_name, "account") == 0)
470 {472 {
471 data->name = g_strdup (attribute_values[0]);473 gint i = 0;
474
475 while (attribute_names[i] != NULL)
476 {
477 if (g_strcmp0 (attribute_names[i], "name") == 0)
478 {
479 data->name = g_strdup (attribute_values[i]);
480 }
481 else if (g_strcmp0 (attribute_names[i], "enabled") == 0)
482 {
483 if (g_strcmp0 (attribute_values[i], "false") == 0)
484 data->enabled = FALSE;
485 }
486 i++;
487 }
472 }488 }
473 else if (g_strcmp0 (element_name, "url") == 0)489 else if (g_strcmp0 (element_name, "url") == 0)
474 data->reap_type = REAP_URL;490 data->reap_type = REAP_URL;
@@ -501,6 +517,10 @@
501517
502 data->url = g_strdup (tokens[0]);518 data->url = g_strdup (tokens[0]);
503519
520 /* Accounts with no configured way to receive mail will not have a URL */
521 if (!data->url)
522 data->enabled = FALSE;
523
504 g_strfreev (tokens);524 g_strfreev (tokens);
505 }525 }
506}526}
@@ -550,7 +570,7 @@
550 {570 {
551 gchar *account_info = a->data;571 gchar *account_info = a->data;
552 GMarkupParseContext *context;572 GMarkupParseContext *context;
553 ParserData data = { NULL, NULL, REAP_NONE };573 ParserData data = { NULL, NULL, NULL, NULL, 0, TRUE };
554 IndicateIndicator *indicator;574 IndicateIndicator *indicator;
555 575
556 /* Parse account XML to get some useful details about the account */576 /* Parse account XML to get some useful details about the account */
@@ -575,21 +595,26 @@
575 g_debug ("New account: %s (%s)", data.name, data.url);595 g_debug ("New account: %s (%s)", data.name, data.url);
576 }596 }
577597
598 if (!data.enabled)
599 indicate_indicator_hide (indicator);
600
578 /* Fake a time */601 /* Fake a time */
579 g_time_val_add (&timeval, -1000000 * 60 * i);602 g_time_val_add (&timeval, -1000000 * 60 * i);
580 indicate_indicator_set_property_time (indicator,603 indicate_indicator_set_property_time (indicator,
581 INDICATE_INDICATOR_MESSAGES_PROP_TIME,604 INDICATE_INDICATOR_MESSAGES_PROP_TIME,
582 &timeval);605 &timeval);
583606
607 i++;
608
584 /* Clean up */609 /* Clean up */
585 g_free (data.url);610 g_free (data.url);
586 g_free (data.name);611 g_free (data.name);
587 g_free (data.parent);612 g_free (data.parent);
588 g_free (data.last_parent);613 g_free (data.last_parent);
614 data.reap_type = REAP_NONE;
615 data.enabled = TRUE;
589 616
590 g_markup_parse_context_free (context);617 g_markup_parse_context_free (context);
591
592 i++;
593 }618 }
594619
595 g_slist_foreach (old_list, (GFunc)g_object_unref, NULL);620 g_slist_foreach (old_list, (GFunc)g_object_unref, NULL);

Subscribers

People subscribed via source and target branches