Review: Needs Fixing

1. we don't appear to use "error" except for testing for failure, and on 
failure list will be NULL anyway so that test is redundant. Let's remove the 
error variable altogether.

2. g_slist_free() is NULL-safe, so there "if (list != NULL)" test before 
g_slist_free(list) is unnecessary.

3. I think we're also leaking the "evo" variable in greeter mode.

What would you think about moving it to a standalone function like this:

static gboolean
calendar_app_is_usable (void)
{
        /* confirm that it's installed... */
        gchar *evo = g_find_program_in_path("evolution");
        if (evo == NULL)
                return FALSE;
        g_debug ("found evolution at '%s'", evo);
        g_free (evo);

        /* confirm that there's an account set up */
        GSList *accounts_list = gconf_client_get_list (gconf, 
"/apps/evolution/mail/accounts", GCONF_VALUE_STRING, NULL);
        g_debug ("found %u evolution accounts", g_slist_length(accounts_list));
        const gboolean is_configured = accounts_list != NULL;
        g_slist_free (accounts_list);
        return is_configured;
}

-- 
https://code.launchpad.net/~jjardon/indicator-datetime/fix-836017/+merge/77932
Your team ayatana-commits is subscribed to branch lp:indicator-datetime.

_______________________________________________
Mailing list: https://launchpad.net/~ayatana-commits
Post to     : ayatana-commits@lists.launchpad.net
Unsubscribe : https://launchpad.net/~ayatana-commits
More help   : https://help.launchpad.net/ListHelp

Reply via email to