Commit 0a3c5c87 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

details on default account development

parent 5ce4b58c
/*
* 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,
......@@ -109,6 +110,18 @@ account_list_get_nth ( guint n )
return g_queue_peek_nth (accountQueue, n);
}
gchar *
account_list_get_default( )
{
return DEFAULT_ACCOUNT;
}
void
account_list_set_default(const gchar * accountID)
{
DEFAULT_ACCOUNT = g_strdup(accountID);
}
const gchar * account_state_name(account_state_t s)
{
gchar * state;
......
/*
* 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,
......@@ -68,6 +69,9 @@ typedef struct {
GHashTable * properties;
} account_t;
gchar * DEFAULT_ACCOUNT;
/** This function initialize the account list. */
void account_list_init ();
......@@ -97,6 +101,15 @@ guint account_list_get_size ( );
* @return An account or NULL */
account_t * account_list_get_nth ( guint n );
/** Return the account's id chosen as default
* @return The default account */
gchar * account_list_get_default( );
/** This function sets an account as default
* @param n The position of the account you want to select
*/
void account_list_set_default(const gchar * accountID);
/** This function maps account_state_t enums to a description.
* @param s The state
* @return The full text description of the state */
......
......@@ -102,4 +102,5 @@ void sflphone_keypad ( guint keyval, gchar * key);
void sflphone_place_call ( call_t * c );
void sflphone_fill_account_list();
#endif
......@@ -27,6 +27,9 @@
GtkListStore * store;
GtkWidget *view;
GtkWidget * account_store;
GtkWidget *item;
GtkWidget * toolbar;
GtkToolItem * callButton;
GtkToolItem * pickupButton;
......@@ -36,9 +39,6 @@ GtkToolItem * transfertButton;
GtkToolItem * unholdButton;
guint transfertButtonConnId; //The button toggled signal connection ID
// list of the accounts to be displayed when the arrow beside the call button is pressed
// should be used to set a default account to make output calls
GtkWidget *accounts_list;
/**
* Show popup menu
......@@ -256,33 +256,40 @@ void row_activated(GtkTreeView *tree_view,
}
}
void
fast_fill_account_list()
{
int i;
for( i = 0; i < account_list_get_size(); i++)
{
account_t * a = account_list_get_nth (i);
if (a)
{
item = gtk_check_menu_item_new_with_label(g_hash_table_lookup(a->properties, ACCOUNT_ALIAS));
gtk_menu_shell_append (GTK_MENU_SHELL (account_store), item);
gtk_widget_show(item);
}
}
}
GtkWidget *
create_toolbar (){
GtkWidget *ret;
GtkWidget *image;
GtkWidget *item1;
GtkWidget *item2;
GtkWidget *item3;
ret = gtk_toolbar_new();
toolbar = ret;
accounts_list = gtk_menu_new();
item1 = gtk_menu_item_new_with_label("Compte A");
gtk_container_add(GTK_CONTAINER(accounts_list), item1);
gtk_widget_show(item1);
item2 = gtk_menu_item_new();
gtk_container_add(GTK_CONTAINER(accounts_list), item2);
item3 = gtk_menu_item_new();
gtk_container_add(GTK_CONTAINER(accounts_list), item3);
account_store = gtk_menu_new();
fast_fill_account_list();
image = gtk_image_new_from_file( ICONS_DIR "/call.svg");
callButton = gtk_menu_tool_button_new (image, "Place a Call");
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(callButton), GTK_WIDGET(accounts_list));
gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(callButton), GTK_WIDGET(account_store));
g_signal_connect (G_OBJECT (callButton), "clicked",
G_CALLBACK (call_button), NULL);
gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(callButton), -1);
......
/*
* 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,
......@@ -35,6 +36,7 @@ GtkWidget * deleteButton;
GtkWidget * defaultButton;
account_t * selectedAccount;
account_t * defaultAccount;
/** Fills the treelist with accounts */
void
......@@ -158,6 +160,10 @@ create_accounts_tab()
GtkTreeSelection *sel;
GtkWidget *label;
GtkTreeIter iter;
GValue val;
val.g_type = G_TYPE_POINTER;
selectedAccount = NULL;
ret = gtk_vbox_new(FALSE, 10);
......@@ -191,6 +197,9 @@ create_accounts_tab()
G_CALLBACK (select_account),
account_store);
gtk_tree_model_get_value(GTK_TREE_MODEL(account_store), &iter, 3, &val);
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(account_store),
2, GTK_SORT_ASCENDING);
......@@ -199,6 +208,7 @@ create_accounts_tab()
rend,
"markup", 0,
NULL);
g_object_set(G_OBJECT(rend), "weight", "bold", NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW(view), col);
rend = gtk_cell_renderer_text_new();
......@@ -285,11 +295,6 @@ show_config_window ()
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), tab, gtk_label_new("Accounts"));
gtk_notebook_page_num(GTK_NOTEBOOK(notebook), tab);
/*
GtkWidget* blob;//create_blob_tab();
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), blob, gtk_label_new("Audio"));
gtk_notebook_page_num(GTK_NOTEBOOK(notebook), blob);
*/
gtk_dialog_run (dialog);
dialogOpen = FALSE;
......
Supports Markdown
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