From 816f4bcb65d88a05ba6594e9a778d7be3e2041a0 Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandresavard@msavard.(none)>
Date: Tue, 28 Jun 2011 13:25:39 -0400
Subject: [PATCH] #6109: Add button for history playback of recorded file

---
 .../src/contacts/Makefile.am                  |  1 +
 sflphone-client-gnome/src/contacts/calltree.c | 13 ++++++----
 sflphone-client-gnome/src/dbus/dbus.h         |  3 +++
 sflphone-client-gnome/src/ui.xml              |  1 +
 sflphone-client-gnome/src/uimanager.c         | 25 +++++++++++++++++--
 5 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/sflphone-client-gnome/src/contacts/Makefile.am b/sflphone-client-gnome/src/contacts/Makefile.am
index cbaf218b5e..27a5a5a3cc 100644
--- a/sflphone-client-gnome/src/contacts/Makefile.am
+++ b/sflphone-client-gnome/src/contacts/Makefile.am
@@ -7,6 +7,7 @@ libcontacts_la_SOURCES = \
   calllist.c \
   calltab.c \
   calltree.c \
+  gtkcellrendererbutton.c \
   history.c \
   addrbookfactory.c \
   conferencelist.c
diff --git a/sflphone-client-gnome/src/contacts/calltree.c b/sflphone-client-gnome/src/contacts/calltree.c
index 8f58741464..d4483a019c 100644
--- a/sflphone-client-gnome/src/contacts/calltree.c
+++ b/sflphone-client-gnome/src/contacts/calltree.c
@@ -34,13 +34,16 @@
 #include <stdlib.h>
 #include <glib/gprintf.h>
 #include <eel-gconf-extensions.h>
-#include <calllist.h>
-#include <conferencelist.h>
-#include <mainwindow.h>
-#include <history.h>
+
+#include "dbus.h"
+#include "calllist.h"
+#include "conferencelist.h"
+#include "mainwindow.h"
+#include "history.h"
+#include "calltree.h"
 #include "uimanager.h"
 #include "actions.h"
-#include "../imwindow.h"
+#include "imwindow.h"
 #include "searchbar.h"
 
 // Messages used in menu item
diff --git a/sflphone-client-gnome/src/dbus/dbus.h b/sflphone-client-gnome/src/dbus/dbus.h
index ebdd745d98..e275d917fd 100644
--- a/sflphone-client-gnome/src/dbus/dbus.h
+++ b/sflphone-client-gnome/src/dbus/dbus.h
@@ -622,6 +622,9 @@ dbus_detach_participant (const gchar* callID);
 void
 dbus_join_participant (const gchar* sel_callID, const gchar* drag_callID);
 
+void
+dbus_create_conf_from_participant_list(const gchar **list);
+
 void
 dbus_join_conference (const gchar* sel_confID, const gchar* drag_confID);
 
diff --git a/sflphone-client-gnome/src/ui.xml b/sflphone-client-gnome/src/ui.xml
index 9d61626d0a..43c4f4799e 100644
--- a/sflphone-client-gnome/src/ui.xml
+++ b/sflphone-client-gnome/src/ui.xml
@@ -54,6 +54,7 @@
     <separator/>
     <toolitem name="VoicemailToolbar" action="Voicemail"/>
     <toolitem name="HistoryToolbar" action="History"/>
+    <toolitem name="PlayRecordToolbar" action="PlayRecord"/> 
   </toolbar>
 
   <popup name="PopupMenu">
diff --git a/sflphone-client-gnome/src/uimanager.c b/sflphone-client-gnome/src/uimanager.c
index 9f7a508f0d..50f4d0abbc 100644
--- a/sflphone-client-gnome/src/uimanager.c
+++ b/sflphone-client-gnome/src/uimanager.c
@@ -78,6 +78,8 @@ static GtkAction * voicemailAction;
 static GtkWidget * voicemailToolbar;
 static GtkWidget * imToolbar;
 static GtkAction * imAction;
+static GtkWidget * playRecordWidget;
+static GtkWidget * playRecordAction;
 
 static GtkWidget * editable_num;
 static GtkDialog * edit_dialog;
@@ -180,6 +182,9 @@ update_actions()
     if (eel_gconf_get_integer (HISTORY_ENABLED)) {
         gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (historyButton), -1);
         gtk_widget_set_sensitive (GTK_WIDGET (historyButton), TRUE);
+
+	if(is_inserted(GTK_WIDGET (playRecordWidget), GTK_WIDGET(toolbar)))
+	    gtk_container_remove(GTK_CONTAINER(toolbar), GTK_WIDGET(playRecordWidget));
     }
 
     // If addressbook support has been enabled and all addressbooks are loaded, display the icon
@@ -262,6 +267,8 @@ update_actions()
 
                 if (active_calltree == current_calls)
                     gtk_action_set_sensitive (GTK_ACTION (hangUpAction), TRUE);
+	        if (active_calltree == current_calls)
+		    gtk_action_set_sensitive (GTK_ACTION(playRecordAction), TRUE);
 
                 //gtk_action_set_sensitive( GTK_ACTION(newCallMenu),TRUE);
                 g_object_ref (newCallWidget);
@@ -270,6 +277,8 @@ update_actions()
 
                 if (active_calltree == current_calls)
                     gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (hangUpWidget), 1);
+		else if(active_calltree == history)
+		    gtk_toolbar_insert(GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM(playRecordWidget), 3);
 
                 break;
             case CALL_STATE_CURRENT:
@@ -703,6 +712,13 @@ call_record (void)
     sflphone_rec_call();
 }
 
+static void
+playback_record(void)
+{
+
+    DEBUG("UIManager: Playback button pressed");
+}
+
 static void
 call_configuration_assistant (void * foo UNUSED)
 {
@@ -970,6 +986,8 @@ static const GtkActionEntry menu_entries[] = {
       N_ ("Minimize to system tray"), G_CALLBACK (call_minimize) },
     { "Quit", GTK_STOCK_CLOSE, N_ ("_Quit"), "<control>Q",
       N_ ("Quit the program"), G_CALLBACK (call_quit) },
+    { "PlayRecord", GTK_STOCK_MEDIA_PLAY,  N_ ("_Playback record"), NULL,
+      N_ ("Playback recorded file"), G_CALLBACK (playback_record) },
 
     // Edit Menu
     { "Edit", NULL, N_ ("_Edit"), NULL, NULL, NULL },
@@ -1137,8 +1155,7 @@ show_popup_menu (GtkWidget *my_widget, GdkEventButton *event)
     // TODO update the selection to make sure the call under the mouse is the call selected
 
     // call type boolean
-    gboolean pickup = FALSE, hangup = FALSE, hold = FALSE, copy = FALSE,
-             record = FALSE, im = FALSE;
+    gboolean pickup = FALSE, hangup = FALSE, hold = FALSE, copy = FALSE, record = FALSE, im = FALSE;
     gboolean accounts = FALSE;
 
     // conference type boolean
@@ -1720,6 +1737,10 @@ create_toolbar_actions (GtkUIManager *ui_manager, GtkWidget **widget)
                    "/ToolbarActions/InstantMessagingToolbar");
     historyButton = gtk_ui_manager_get_widget (ui_manager,
                     "/ToolbarActions/HistoryToolbar");
+    playRecordWidget = gtk_ui_manager_get_widget(ui_manager,
+		    "/ToolbarActions/PlayRecordToolbar");
+    playRecordAction = gtk_ui_manager_get_action(ui_manager, 
+		    "/ToolbarActions/PlayRecord");
     if(abookfactory_is_addressbook_loaded()) {
         contactButton = gtk_ui_manager_get_widget (ui_manager, "/ToolbarActions/AddressbookToolbar");
     }
-- 
GitLab