Commit 88e48a62 authored by Emmanuel Milou's avatar Emmanuel Milou

place a call with the default account

If an registered account is set by default, a call is placed with this account.
If no account is set by default, the call is made with the first registered account of the list
If a non-registered account is set as default, no call is placed and a message popup is thrown.
parent e3f4bacf
......@@ -22,6 +22,7 @@
#include <string.h>
GQueue * accountQueue;
gchar * DEFAULT_ACCOUNT=NULL;
/* GCompareFunc to compare a accountID (gchar* and a account_t) */
gint
......@@ -98,6 +99,20 @@ account_list_get_by_state (account_state_t state )
}
account_t *
account_list_get_by_id(gchar * accountID)
{
GList * c = g_queue_find_custom (accountQueue, accountID, is_accountID_struct);
if(c)
{
return (account_t *)c->data;
}
else
{
return NULL;
}
}
guint
account_list_get_size ( )
{
......@@ -120,6 +135,7 @@ void
account_list_set_default(const gchar * accountID)
{
DEFAULT_ACCOUNT = g_strdup(accountID);
g_print("DEFAULT_ACCOUNT = %s\n", DEFAULT_ACCOUNT);
}
const gchar * account_state_name(account_state_t s)
......
......@@ -70,7 +70,6 @@ typedef struct {
} account_t;
gchar * DEFAULT_ACCOUNT;
/** This function initialize the account list. */
void account_list_init ();
......@@ -116,4 +115,10 @@ void account_list_set_default(const gchar * accountID);
const gchar * account_state_name(account_state_t s);
void account_list_clear ( );
/** Return the account associated with an ID
* @param accountID The ID of the account
* @return An account or NULL */
account_t * account_list_get_by_id(gchar * accountID);
#endif
This diff is collapsed.
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
......
......@@ -113,6 +113,7 @@ default_account(GtkWidget *widget, gpointer data)
// set account as default
if(selectedAccount)
{
account_list_set_default(selectedAccount->accountID);
dbus_set_default_account(selectedAccount->accountID);
}
}
......@@ -160,9 +161,12 @@ create_accounts_tab()
GtkTreeSelection *sel;
GtkWidget *label;
GtkTreeIter iter;
GtkTreeIter iter;
GValue val;
val.g_type = G_TYPE_POINTER;
account_t* current;
//GValue id;
//val.g_type = G_TYPE;
selectedAccount = NULL;
......@@ -198,7 +202,7 @@ create_accounts_tab()
account_store);
gtk_tree_model_get_value(GTK_TREE_MODEL(account_store), &iter, 3, &val);
//current = (account_t*) g_value_get_pointer(&val);
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(account_store),
2, GTK_SORT_ASCENDING);
......@@ -208,6 +212,7 @@ create_accounts_tab()
rend,
"markup", 0,
NULL);
//if(current->accountID == account_list_get_default())
g_object_set(G_OBJECT(rend), "weight", "bold", NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW(view), col);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment