/**
 * Fills the treelist with accounts, should be called whenever the account
 * list is modified.
 */
static void account_store_fill()
{
    g_return_if_fail(account_list_dialog != NULL);
    gtk_list_store_clear(account_store);

    // IP2IP account must be first
    account_t *ip2ip = account_list_get_by_id(IP2IP_PROFILE);
    g_return_if_fail(ip2ip != NULL);
    ip2ip->state = ACCOUNT_STATE_IP2IP_READY;

    GtkTreeIter iter;
    gtk_list_store_append(account_store, &iter);

    account_store_add(&iter, ip2ip);

    for (size_t i = 0; i < account_list_get_size(); ++i) {
        account_t *a = account_list_get_nth(i);
        g_return_if_fail(a != NULL);

        // we don't want to process the IP2IP twice
        if (a != ip2ip) {
            gtk_list_store_append(account_store, &iter);
            account_store_add(&iter, a);
        }
    }
}
示例#2
0
void
sflphone_notify_voice_mail(const gchar* accountID , guint count, SFLPhoneClient *client)
{
    // We want to notify only the current account; ie the first in the list
    gchar *id = g_strdup(accountID);
    const gchar * const current_id = account_list_get_current_id();

    g_debug("sflphone_notify_voice_mail begin");

    if (g_ascii_strcasecmp(id, current_id) != 0 ||
        account_list_get_size() == 0)
        return;

    // Set the number of voice messages for the current account
    current_account_set_message_number(count);
    account_t *current = account_list_get_current();

    // Update the voicemail tool button
    update_voicemail_status();

    if (current)
        notify_voice_mails(count, current, client);

    g_debug("sflphone_notify_voice_mail end");
}
示例#3
0
guint
account_list_get_registered_accounts(void)
{
    guint res = 0;

    for (guint i = 0; i < account_list_get_size(); i++)
        if (account_list_get_nth(i)->state == (ACCOUNT_STATE_REGISTERED))
            res++;

    return res;
}
示例#4
0
static guint account_list_get_position(account_t *account)
{
    guint size = account_list_get_size();

    for (guint i = 0; i < size; i++) {
        account_t *tmp = account_list_get_nth(i);

        if (utf8_case_equal(tmp->accountID, account->accountID))
            return i;
    }

    // Not found
    return -1;
}
示例#5
0
gchar * account_list_get_ordered_list(void)
{
    gchar *order = strdup("");

    for (guint i = 0; i < account_list_get_size(); i++) {
        account_t * account = account_list_get_nth(i);
        if (account) {
            gchar *new_order = g_strconcat(order, account->accountID, "/", NULL);
            g_free(order);
            order = new_order;
        }
    }

    return order;
}