Skip to content
Snippets Groups Projects
Commit 4b50bda6 authored by Julien Bonjean's avatar Julien Bonjean
Browse files

Fixed toggle button references

parent 4ec27bb1
Branches
No related tags found
No related merge requests found
...@@ -444,7 +444,7 @@ sflphone_incoming_call (call_t * c) ...@@ -444,7 +444,7 @@ 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();
if( active_calltree == history ) switch_tab(); switch_tab(current_calls);
} }
void void
...@@ -662,8 +662,7 @@ sflphone_keypad( guint keyval, gchar * key) ...@@ -662,8 +662,7 @@ sflphone_keypad( guint keyval, gchar * key)
case 65307: /* ESCAPE */ case 65307: /* ESCAPE */
break; break;
default: default:
if( active_calltree == history ) switch_tab(current_calls);
switch_tab();
process_dialing(sflphone_new_call(), keyval, key); process_dialing(sflphone_new_call(), keyval, key);
break; break;
} }
......
...@@ -43,14 +43,6 @@ GtkToolItem * recButton; ...@@ -43,14 +43,6 @@ GtkToolItem * recButton;
guint transfertButtonConnId; //The button toggled signal connection ID guint transfertButtonConnId; //The button toggled signal connection ID
gboolean history_shown; gboolean history_shown;
void
switch_tab()
{
(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(historyButton)))?
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), FALSE):
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), TRUE);
}
/** /**
* Show popup menu * Show popup menu
*/ */
...@@ -114,18 +106,18 @@ call_button( GtkWidget *widget UNUSED, gpointer data UNUSED) ...@@ -114,18 +106,18 @@ call_button( GtkWidget *widget UNUSED, gpointer data UNUSED)
call_list_add(current_calls, newCall); call_list_add(current_calls, newCall);
update_call_tree_add(current_calls, newCall); update_call_tree_add(current_calls, newCall);
sflphone_place_call(newCall); sflphone_place_call(newCall);
if( active_calltree == history ) switch_tab(); switch_tab(current_calls);
} }
else else
{ {
sflphone_new_call(); sflphone_new_call();
if( active_calltree == history ) switch_tab(); switch_tab(current_calls);
} }
} }
else else
{ {
sflphone_new_call(); sflphone_new_call();
if( active_calltree == history ) switch_tab(); switch_tab(current_calls);
} }
} }
...@@ -174,6 +166,23 @@ unhold( GtkWidget *widget UNUSED, gpointer data UNUSED) ...@@ -174,6 +166,23 @@ unhold( GtkWidget *widget UNUSED, gpointer data UNUSED)
sflphone_off_hold(); sflphone_off_hold();
} }
static void
toggle_current_calls(GtkToggleToolButton *toggle_tool_button UNUSED,
gpointer user_data UNUSED)
{
GtkTreeSelection *sel;
active_calltree = current_calls;
gtk_widget_hide(history->tree);
gtk_widget_hide(contacts->tree);
gtk_widget_show(current_calls->tree);
history_shown = FALSE;
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (active_calltree->view));
g_signal_emit_by_name(sel, "changed");
toolbar_update_buttons();
}
static void static void
toggle_history(GtkToggleToolButton *toggle_tool_button UNUSED, toggle_history(GtkToggleToolButton *toggle_tool_button UNUSED,
gpointer user_data UNUSED) gpointer user_data UNUSED)
...@@ -241,6 +250,7 @@ toggle_contacts(GtkToggleToolButton *toggle_tool_button UNUSED, ...@@ -241,6 +250,7 @@ toggle_contacts(GtkToggleToolButton *toggle_tool_button UNUSED,
gtk_widget_hide(current_calls->tree); gtk_widget_hide(current_calls->tree);
gtk_widget_hide(history->tree); gtk_widget_hide(history->tree);
gtk_widget_show(contacts->tree); gtk_widget_show(contacts->tree);
active_calltree = contacts;
history_shown = FALSE; history_shown = FALSE;
sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (contacts->view)); sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (contacts->view));
...@@ -270,7 +280,7 @@ call_mailbox( GtkWidget* widget UNUSED, gpointer data UNUSED) ...@@ -270,7 +280,7 @@ call_mailbox( GtkWidget* widget UNUSED, gpointer data UNUSED)
update_call_tree_add( current_calls , mailboxCall ); update_call_tree_add( current_calls , mailboxCall );
update_menus(); update_menus();
sflphone_place_call( mailboxCall ); sflphone_place_call( mailboxCall );
if( active_calltree == history ) switch_tab(); switch_tab(current_calls);
} }
...@@ -465,7 +475,7 @@ void row_activated(GtkTreeView *tree_view UNUSED, ...@@ -465,7 +475,7 @@ void row_activated(GtkTreeView *tree_view UNUSED,
call_list_add(current_calls, newCall); call_list_add(current_calls, newCall);
update_call_tree_add(current_calls, newCall); update_call_tree_add(current_calls, newCall);
sflphone_place_call(newCall); sflphone_place_call(newCall);
switch_tab(); switch_tab(current_calls);
} }
} }
} }
...@@ -926,3 +936,23 @@ update_call_tree_add (calltab_t* tab, call_t * c) ...@@ -926,3 +936,23 @@ update_call_tree_add (calltab_t* tab, call_t * c)
gtk_tree_selection_select_iter(GTK_TREE_SELECTION(sel), &iter); gtk_tree_selection_select_iter(GTK_TREE_SELECTION(sel), &iter);
toolbar_update_buttons(); toolbar_update_buttons();
} }
void
switch_tab(calltab_t* tab)
{
if(active_calltree != tab)
{
if(tab == contacts)
{
toggle_contacts(NULL, NULL);
}
else if (tab == history)
{
toggle_history(NULL, NULL);
}
else
{
toggle_current_calls(NULL, NULL);
}
}
}
...@@ -71,6 +71,6 @@ void reset_call_tree (calltab_t* tab); ...@@ -71,6 +71,6 @@ void reset_call_tree (calltab_t* tab);
*/ */
GtkWidget * create_toolbar(); GtkWidget * create_toolbar();
void switch_tab( void ); void switch_tab( calltab_t* tab );
#endif #endif
...@@ -58,8 +58,7 @@ is_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer data UNUSED) ...@@ -58,8 +58,7 @@ is_visible(GtkTreeModel* model, GtkTreeIter* iter, gpointer data UNUSED)
void void
filter_entry_changed(GtkEntry* entry UNUSED, gchar* arg1 UNUSED, gpointer data UNUSED) filter_entry_changed(GtkEntry* entry UNUSED, gchar* arg1 UNUSED, gpointer data UNUSED)
{ {
gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(historyButton), TRUE); switch_tab(history);
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(histfilter));
} }
void void
......
...@@ -265,7 +265,7 @@ call_back( void * foo UNUSED) ...@@ -265,7 +265,7 @@ call_back( void * foo UNUSED)
call_list_add(current_calls, newCall); call_list_add(current_calls, newCall);
update_call_tree_add(current_calls, newCall); update_call_tree_add(current_calls, newCall);
sflphone_place_call(newCall); sflphone_place_call(newCall);
switch_tab(); switch_tab(current_calls);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment