From 1a034f574ac4d0a0590270180f2bd1d3daa9e7b6 Mon Sep 17 00:00:00 2001
From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
Date: Tue, 6 Oct 2009 14:11:33 -0400
Subject: [PATCH] [#1976] Fix calltree switching from history

---
 sflphone-client-gnome/src/contacts/calltree.c | 13 +++++++------
 sflphone-client-gnome/src/ui.xml              |  6 +++---
 sflphone-client-gnome/src/uimanager.c         |  4 ++++
 sflphone-client-gnome/src/uimanager.h         |  4 ++++
 4 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c
index e1428fa1c5..3df5724228 100644
--- a/sflphone-client-gnome/src/contacts/calltree.c
+++ b/sflphone-client-gnome/src/contacts/calltree.c
@@ -1158,13 +1158,14 @@ void calltree_display (calltab_t *tab) {
 
         DEBUG ("display main tab");
 
-	/*
+	
         if (active_calltree==contacts) {
             gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)contactButton, FALSE);
         } else {
             gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)historyButton, FALSE);
         }
-	*/
+		gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)currentCallsButton, TRUE);
+	
     }
 
     /* case 2: we want to display the history */
@@ -1173,10 +1174,10 @@ void calltree_display (calltab_t *tab) {
         DEBUG ("display history tab");
 
         if (active_calltree==contacts) {
-            //gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)contactButton, FALSE);
+            gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)contactButton, FALSE);
         }
 
-        //gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)historyButton, TRUE);
+        gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)historyButton, TRUE);
     }
 
     else if (tab==contacts) {
@@ -1184,10 +1185,10 @@ void calltree_display (calltab_t *tab) {
         DEBUG ("display contact tab");
 
         if (active_calltree==history) {
-            //gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)historyButton, FALSE);
+            gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)historyButton, FALSE);
         }
 
-        //gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)contactButton, TRUE);
+        gtk_toggle_tool_button_set_active ((GtkToggleToolButton*)contactButton, TRUE);
     }
 
     else
diff --git a/sflphone-client-gnome/src/ui.xml b/sflphone-client-gnome/src/ui.xml
index 6308142199..72b51160a1 100644
--- a/sflphone-client-gnome/src/ui.xml
+++ b/sflphone-client-gnome/src/ui.xml
@@ -55,9 +55,9 @@
 	</toolbar>
 
 	<toolbar name="ToolbarWindows">
-		<toolitem action="CallWindow"/>
-		<toolitem action="History"/>
-		<toolitem action="Addressbook"/>
+		<toolitem name="CallWindowToolbar" action="CallWindow"/>
+		<toolitem name="HistoryToolbar" action="History"/>
+		<toolitem name="AddressbookToolbar" action="Addressbook"/>
 	</toolbar>
 
 </ui>
diff --git a/sflphone-client-gnome/src/uimanager.c b/sflphone-client-gnome/src/uimanager.c
index b1b2e8ef58..a0a41c7912 100644
--- a/sflphone-client-gnome/src/uimanager.c
+++ b/sflphone-client-gnome/src/uimanager.c
@@ -1386,5 +1386,9 @@ GtkWidget* create_toolbar_windows (GtkUIManager *ui_manager)
 	toolbar = gtk_ui_manager_get_widget (ui_manager, "/ToolbarWindows");
 	active_calltree = current_calls;
 
+	historyButton = gtk_ui_manager_get_widget (ui_manager, "/ToolbarWindows/HistoryToolbar");
+	contactButton = gtk_ui_manager_get_widget (ui_manager, "/ToolbarWindows/AddressbookToolbar");
+	currentCallsButton = gtk_ui_manager_get_widget (ui_manager, "/ToolbarWindows/CallWindowToolbar");
+
 	return toolbar;
 }
diff --git a/sflphone-client-gnome/src/uimanager.h b/sflphone-client-gnome/src/uimanager.h
index cd8db9f1b7..09c8394b66 100644
--- a/sflphone-client-gnome/src/uimanager.h
+++ b/sflphone-client-gnome/src/uimanager.h
@@ -27,6 +27,10 @@ G_BEGIN_DECLS
 guint transfertButtonConnId; //The button toggled signal connection ID
 guint holdConnId;     //The hold_menu signal connection ID
 
+GtkWidget *historyButton;
+GtkWidget *contactButton;
+GtkWidget *currentCallsButton;
+
 gboolean uimanager_new (GtkUIManager**);
 
 G_END_DECLS
-- 
GitLab