Commit 314f4084 authored by Emmanuel Milou's avatar Emmanuel Milou

Improve ergonomy when switching between history, main tab and address book

parent e47a6eae
...@@ -28,7 +28,7 @@ sflphone_gtk_SOURCES = \ ...@@ -28,7 +28,7 @@ sflphone_gtk_SOURCES = \
menus.c \ menus.c \
calltab.c \ calltab.c \
calltree.c \ calltree.c \
historyfilter.c \ searchfilter.c \
actions.c \ actions.c \
configwindow.c \ configwindow.c \
accountlist.c \ accountlist.c \
...@@ -43,7 +43,7 @@ sflphone_gtk_SOURCES = \ ...@@ -43,7 +43,7 @@ sflphone_gtk_SOURCES = \
noinst_HEADERS = actions.h dbus.h sflnotify.h mainwindow.h calllist.h dialpad.h audioconf.h codeclist.h assistant.h \ noinst_HEADERS = actions.h dbus.h sflnotify.h mainwindow.h calllist.h dialpad.h audioconf.h codeclist.h assistant.h \
callmanager-glue.h errors.h sflphone_const.h configurationmanager-glue.h instance-glue.h menus.h calltab.h calltree.h configwindow.h \ callmanager-glue.h errors.h sflphone_const.h configurationmanager-glue.h instance-glue.h menus.h calltab.h calltree.h configwindow.h \
accountlist.h accountwindow.h marshaller.h sliders.h $(STATUSICON_HEADER) timestamp.h historyfilter.c reqaccount.h addressbook-config.h accountlist.h accountwindow.h marshaller.h sliders.h $(STATUSICON_HEADER) timestamp.h searchfilter.h reqaccount.h addressbook-config.h
EXTRA_DIST = marshaller.list EXTRA_DIST = marshaller.list
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <menus.h> #include <menus.h>
#include <statusicon.h> #include <statusicon.h>
#include <calltab.h> #include <calltab.h>
#include <historyfilter.h> #include <searchfilter.h>
#include <contactlist/eds.h> #include <contactlist/eds.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
guint voice_mails; guint voice_mails;
void void
sflphone_notify_voice_mail ( const gchar* accountID , guint count ) sflphone_notify_voice_mail ( const gchar* accountID , guint count )
{ {
gchar *id; gchar *id;
...@@ -71,7 +71,7 @@ sflphone_notify_voice_mail ( const gchar* accountID , guint count ) ...@@ -71,7 +71,7 @@ sflphone_notify_voice_mail ( const gchar* accountID , guint count )
} }
} }
void void
status_bar_display_account( call_t* c) status_bar_display_account( call_t* c)
{ {
gchar* msg; gchar* msg;
...@@ -87,7 +87,7 @@ status_bar_display_account( call_t* c) ...@@ -87,7 +87,7 @@ status_bar_display_account( call_t* c)
} }
gboolean gboolean
sflphone_quit () sflphone_quit ()
{ {
gboolean quit = FALSE; gboolean quit = FALSE;
...@@ -110,7 +110,7 @@ sflphone_quit () ...@@ -110,7 +110,7 @@ sflphone_quit ()
return quit; return quit;
} }
void void
sflphone_hold(call_t * c ) sflphone_hold(call_t * c )
{ {
c->state = CALL_STATE_HOLD; c->state = CALL_STATE_HOLD;
...@@ -118,7 +118,7 @@ sflphone_hold(call_t * c ) ...@@ -118,7 +118,7 @@ sflphone_hold(call_t * c )
update_menus(); update_menus();
} }
void void
sflphone_ringing(call_t * c ) sflphone_ringing(call_t * c )
{ {
c->state = CALL_STATE_RINGING; c->state = CALL_STATE_RINGING;
...@@ -126,7 +126,7 @@ sflphone_ringing(call_t * c ) ...@@ -126,7 +126,7 @@ sflphone_ringing(call_t * c )
update_menus(); update_menus();
} }
void void
sflphone_hung_up( call_t * c) sflphone_hung_up( call_t * c)
{ {
call_list_remove( current_calls, c->callID); call_list_remove( current_calls, c->callID);
...@@ -244,7 +244,7 @@ gboolean sflphone_init() ...@@ -244,7 +244,7 @@ gboolean sflphone_init()
} }
} }
void void
sflphone_hang_up() sflphone_hang_up()
{ {
call_t * selectedCall = call_get_selected(current_calls); call_t * selectedCall = call_get_selected(current_calls);
...@@ -292,7 +292,7 @@ sflphone_hang_up() ...@@ -292,7 +292,7 @@ sflphone_hang_up()
} }
void void
sflphone_pick_up() sflphone_pick_up()
{ {
call_t * selectedCall = call_get_selected(active_calltree); call_t * selectedCall = call_get_selected(active_calltree);
...@@ -330,7 +330,7 @@ sflphone_pick_up() ...@@ -330,7 +330,7 @@ sflphone_pick_up()
} }
} }
void void
sflphone_on_hold () sflphone_on_hold ()
{ {
call_t * selectedCall = call_get_selected(current_calls); call_t * selectedCall = call_get_selected(current_calls);
...@@ -352,7 +352,7 @@ sflphone_on_hold () ...@@ -352,7 +352,7 @@ sflphone_on_hold ()
} }
} }
void void
sflphone_off_hold () sflphone_off_hold ()
{ {
call_t * selectedCall = call_get_selected(current_calls); call_t * selectedCall = call_get_selected(current_calls);
...@@ -371,7 +371,7 @@ sflphone_off_hold () ...@@ -371,7 +371,7 @@ sflphone_off_hold ()
} }
void void
sflphone_fail( call_t * c ) sflphone_fail( call_t * c )
{ {
c->state = CALL_STATE_FAILURE; c->state = CALL_STATE_FAILURE;
...@@ -379,7 +379,7 @@ sflphone_fail( call_t * c ) ...@@ -379,7 +379,7 @@ sflphone_fail( call_t * c )
update_menus(); update_menus();
} }
void void
sflphone_busy( call_t * c ) sflphone_busy( call_t * c )
{ {
c->state = CALL_STATE_BUSY; c->state = CALL_STATE_BUSY;
...@@ -387,7 +387,7 @@ sflphone_busy( call_t * c ) ...@@ -387,7 +387,7 @@ sflphone_busy( call_t * c )
update_menus(); update_menus();
} }
void void
sflphone_current( call_t * c ) sflphone_current( call_t * c )
{ {
if( c->state != CALL_STATE_HOLD ) if( c->state != CALL_STATE_HOLD )
...@@ -397,7 +397,7 @@ sflphone_current( call_t * c ) ...@@ -397,7 +397,7 @@ sflphone_current( call_t * c )
update_menus(); update_menus();
} }
void void
sflphone_record( call_t * c ) sflphone_record( call_t * c )
{ {
if( c->state != CALL_STATE_HOLD ) if( c->state != CALL_STATE_HOLD )
...@@ -407,7 +407,7 @@ sflphone_record( call_t * c ) ...@@ -407,7 +407,7 @@ sflphone_record( call_t * c )
update_menus(); update_menus();
} }
void void
sflphone_set_transfert() sflphone_set_transfert()
{ {
call_t * c = call_get_selected(current_calls); call_t * c = call_get_selected(current_calls);
...@@ -421,7 +421,7 @@ sflphone_set_transfert() ...@@ -421,7 +421,7 @@ sflphone_set_transfert()
toolbar_update_buttons(); toolbar_update_buttons();
} }
void void
sflphone_unset_transfert() sflphone_unset_transfert()
{ {
call_t * c = call_get_selected(current_calls); call_t * c = call_get_selected(current_calls);
...@@ -435,7 +435,7 @@ sflphone_unset_transfert() ...@@ -435,7 +435,7 @@ sflphone_unset_transfert()
toolbar_update_buttons(); toolbar_update_buttons();
} }
void void
sflphone_incoming_call (call_t * c) sflphone_incoming_call (call_t * c)
{ {
c->history_state = MISSED; c->history_state = MISSED;
...@@ -443,10 +443,10 @@ sflphone_incoming_call (call_t * c) ...@@ -443,10 +443,10 @@ sflphone_incoming_call (call_t * c)
call_list_add( history, c ); call_list_add( history, c );
update_call_tree_add( current_calls , c ); update_call_tree_add( current_calls , c );
update_menus(); update_menus();
switch_tab(current_calls); display_calltree (current_calls);
} }
void void
process_dialing(call_t * c, guint keyval, gchar * key) process_dialing(call_t * c, guint keyval, gchar * key)
{ {
// We stop the tone // We stop the tone
...@@ -521,7 +521,7 @@ process_dialing(call_t * c, guint keyval, gchar * key) ...@@ -521,7 +521,7 @@ process_dialing(call_t * c, guint keyval, gchar * key)
} }
call_t * call_t *
sflphone_new_call() sflphone_new_call()
{ {
...@@ -551,7 +551,7 @@ sflphone_new_call() ...@@ -551,7 +551,7 @@ sflphone_new_call()
} }
void void
sflphone_keypad( guint keyval, gchar * key) sflphone_keypad( guint keyval, gchar * key)
{ {
call_t * c = call_get_selected(current_calls); call_t * c = call_get_selected(current_calls);
...@@ -567,7 +567,7 @@ sflphone_keypad( guint keyval, gchar * key) ...@@ -567,7 +567,7 @@ sflphone_keypad( guint keyval, gchar * key)
case 65307: /* ESCAPE */ case 65307: /* ESCAPE */
break; break;
default: default:
switch_tab(current_calls); display_calltree (current_calls);
process_dialing(sflphone_new_call(), keyval, key); process_dialing(sflphone_new_call(), keyval, key);
break; break;
} }
...@@ -668,7 +668,7 @@ sflphone_keypad( guint keyval, gchar * key) ...@@ -668,7 +668,7 @@ sflphone_keypad( guint keyval, gchar * key)
break; break;
} }
} }
} }
/* /*
* Place a call with the current account. * Place a call with the current account.
...@@ -676,7 +676,7 @@ sflphone_keypad( guint keyval, gchar * key) ...@@ -676,7 +676,7 @@ sflphone_keypad( guint keyval, gchar * key)
* registered account of the account list * registered account of the account list
* Else, popup an error message * Else, popup an error message
*/ */
void void
sflphone_place_call ( call_t * c ) sflphone_place_call ( call_t * c )
{ {
...@@ -749,7 +749,7 @@ sflphone_place_call ( call_t * c ) ...@@ -749,7 +749,7 @@ sflphone_place_call ( call_t * c )
} }
void void
sflphone_display_selected_codec (const gchar* codecName) sflphone_display_selected_codec (const gchar* codecName)
{ {
call_t * selectedCall = call_get_selected(current_calls); call_t * selectedCall = call_get_selected(current_calls);
...@@ -767,14 +767,14 @@ sflphone_display_selected_codec (const gchar* codecName) ...@@ -767,14 +767,14 @@ sflphone_display_selected_codec (const gchar* codecName)
} }
gchar* gchar*
sflphone_get_current_codec_name() sflphone_get_current_codec_name()
{ {
call_t * selectedCall = call_get_selected(current_calls); call_t * selectedCall = call_get_selected(current_calls);
return dbus_get_current_codec_name(selectedCall); return dbus_get_current_codec_name(selectedCall);
} }
void void
sflphone_rec_call() sflphone_rec_call()
{ {
call_t * selectedCall = call_get_selected(current_calls); call_t * selectedCall = call_get_selected(current_calls);
...@@ -801,7 +801,7 @@ sflphone_rec_call() ...@@ -801,7 +801,7 @@ sflphone_rec_call()
} }
/* Internal to action - set the __CURRENT_ACCOUNT variable */ /* Internal to action - set the __CURRENT_ACCOUNT variable */
void void
sflphone_set_current_account() sflphone_set_current_account()
{ {
if( account_list_get_size() > 0 ) if( account_list_get_size() > 0 )
...@@ -810,7 +810,7 @@ sflphone_set_current_account() ...@@ -810,7 +810,7 @@ sflphone_set_current_account()
/* Internal to action - get the codec list */ /* Internal to action - get the codec list */
void void
sflphone_fill_codec_list() sflphone_fill_codec_list()
{ {
......
...@@ -37,9 +37,11 @@ GtkToolItem * hangupButton; ...@@ -37,9 +37,11 @@ GtkToolItem * hangupButton;
GtkToolItem * holdButton; GtkToolItem * holdButton;
GtkToolItem * transfertButton; GtkToolItem * transfertButton;
GtkToolItem * unholdButton; GtkToolItem * unholdButton;
// GtkToolItem * historyButton;
GtkToolItem * mailboxButton; GtkToolItem * mailboxButton;
GtkToolItem * recButton; GtkToolItem * recButton;
GtkToolItem * historyButton;
GtkToolItem * contactButton;
guint transfertButtonConnId; //The button toggled signal connection ID guint transfertButtonConnId; //The button toggled signal connection ID
void void
...@@ -117,18 +119,18 @@ call_button( GtkWidget *widget UNUSED, gpointer data UNUSED) ...@@ -117,18 +119,18 @@ call_button( GtkWidget *widget UNUSED, gpointer data UNUSED)
call_list_add(current_calls, new_call); call_list_add(current_calls, new_call);
update_call_tree_add(current_calls, new_call); update_call_tree_add(current_calls, new_call);
sflphone_place_call(new_call); sflphone_place_call(new_call);
switch_tab(current_calls); display_calltree (current_calls);
} }
else else
{ {
sflphone_new_call(); sflphone_new_call();
switch_tab(current_calls); display_calltree(current_calls);
} }
} }
else else
{ {
sflphone_new_call(); sflphone_new_call();
switch_tab(current_calls); display_calltree(current_calls);
} }
} }
...@@ -177,123 +179,19 @@ unhold( GtkWidget *widget UNUSED, gpointer data UNUSED) ...@@ -177,123 +179,19 @@ unhold( GtkWidget *widget UNUSED, gpointer data UNUSED)
sflphone_off_hold(); sflphone_off_hold();
} }
static void static void toggle_button_cb (GtkToggleToolButton *widget, gpointer user_data)
show_current_calls_tab(GtkToggleToolButton *toggle_tool_button UNUSED,
gpointer user_data UNUSED)
{ {
GtkTreeSelection *sel; calltab_t * to_switch;
gchar* msg; gboolean toggle;
// temporary display in status bar
msg = g_strdup("Current calls");
statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT);
g_free(msg);
active_calltree = current_calls;
gtk_widget_hide(history->tree);
gtk_widget_hide(contacts->tree);
gtk_widget_show(current_calls->tree);
printf("current calls toggle\n");
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (active_calltree->view));
g_signal_emit_by_name(sel, "changed");
toolbar_update_buttons();
}
static void
show_history_tab(GtkToggleToolButton *toggle_tool_button UNUSED,
gpointer user_data UNUSED)
{
GtkTreeSelection *sel;
gchar* msg;
// temporary display in status bar
msg = g_strdup("History");
statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT);
g_free(msg);
active_calltree = history;
gtk_widget_hide(current_calls->tree);
gtk_widget_hide(contacts->tree);
gtk_widget_show(history->tree);
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (active_calltree->view));
g_signal_emit_by_name(sel, "changed");
toolbar_update_buttons();
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(histfilter));
}
static void
handler_async_search (GList *hits, gpointer user_data) {
GtkTreeSelection *sel; to_switch = (calltab_t*) user_data;
GList *i; toggle = gtk_toggle_tool_button_get_active (widget);
GdkPixbuf *photo = NULL;
AddressBook_Config *addressbook_config;
call_t *j;
// Load the parameters
addressbook_load_parameters (&addressbook_config);
// freeing calls
while((j = (call_t *)g_queue_pop_tail (contacts->callQueue)) != NULL)
{
free_call_t(j);
}
// reset previous results
reset_call_tree(contacts);
call_list_reset(contacts);
for (i = hits; i != NULL; i = i->next)
{
Hit *entry;
entry = i->data;
if (entry)
{
/* Get the photo */
if (addressbook_display (addressbook_config, ADDRESSBOOK_DISPLAY_CONTACT_PHOTO))
photo = entry->photo;
/* Create entry for business phone information */
if (addressbook_display (addressbook_config, ADDRESSBOOK_DISPLAY_PHONE_BUSINESS))
create_new_entry_in_contactlist (entry->name, entry->phone_business, CONTACT_PHONE_BUSINESS, photo);
/* Create entry for home phone information */
if (addressbook_display (addressbook_config, ADDRESSBOOK_DISPLAY_PHONE_HOME))
create_new_entry_in_contactlist (entry->name, entry->phone_home, CONTACT_PHONE_HOME, photo);
/* Create entry for mobile phone information */
if (addressbook_display (addressbook_config, ADDRESSBOOK_DISPLAY_PHONE_MOBILE))
create_new_entry_in_contactlist (entry->name, entry->phone_mobile, CONTACT_PHONE_MOBILE, photo);
}
free_hit(entry);
}
g_list_free(hits);
active_calltree = contacts; g_print ("%i\n", toggle);
gtk_widget_hide(current_calls->tree);
gtk_widget_hide(history->tree);
gtk_widget_show(contacts->tree);
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (active_calltree->view));
g_signal_emit_by_name(sel, "changed");
toolbar_update_buttons();
(toggle)? display_calltree (to_switch) : display_calltree (current_calls);
} }
static void
show_contacts_tab(GtkToggleToolButton *toggle_tool_button UNUSED,
gpointer user_data UNUSED)
{
gchar* msg;
// temporary display in status bar
msg = g_strdup("Contacts");
statusbar_push_message( msg , __MSG_ACCOUNT_DEFAULT);
g_free(msg);
// do an asynchronous search
search_async (gtk_entry_get_text (GTK_ENTRY (filter_entry)), 50, &handler_async_search, NULL);
}
void create_new_entry_in_contactlist (gchar *contact_name, gchar *contact_phone, contact_type_t type, GdkPixbuf *photo){ void create_new_entry_in_contactlist (gchar *contact_name, gchar *contact_phone, contact_type_t type, GdkPixbuf *photo){
...@@ -354,7 +252,7 @@ call_mailbox( GtkWidget* widget UNUSED, gpointer data UNUSED) ...@@ -354,7 +252,7 @@ call_mailbox( GtkWidget* widget UNUSED, gpointer data UNUSED)
update_call_tree_add( current_calls , mailbox_call ); update_call_tree_add( current_calls , mailbox_call );
update_menus(); update_menus();
sflphone_place_call( mailbox_call ); sflphone_place_call( mailbox_call );
switch_tab(current_calls); display_calltree(current_calls);
} }
...@@ -545,7 +443,7 @@ void row_activated(GtkTreeView *tree_view UNUSED, ...@@ -545,7 +443,7 @@ void row_activated(GtkTreeView *tree_view UNUSED,
call_list_add(current_calls, new_call); call_list_add(current_calls, new_call);
update_call_tree_add(current_calls, new_call); update_call_tree_add(current_calls, new_call);
sflphone_place_call(new_call); sflphone_place_call(new_call);
switch_tab(current_calls); display_calltree(current_calls);
} }
} }
} }
...@@ -625,22 +523,24 @@ create_toolbar () ...@@ -625,22 +523,24 @@ create_toolbar ()
gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(transfertButton), -1); gtk_toolbar_insert(GTK_TOOLBAR(ret), GTK_TOOL_ITEM(transfertButton), -1);
image = gtk_image_new_from_file( ICONS_DIR "/history2.svg"); image = gtk_image_new_from_file( ICONS_DIR "/history2.svg");
historyButton = gtk_tool_button_new(image, _("History")); historyButton = gtk_toggle_tool_button_new();
gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (historyButton), image);
#if GTK_CHECK_VERSION(2,12,0)