diff --git a/gnome/src/ui.xml b/gnome/src/ui.xml index 52058b4947b5fea98095d8f4f8435b447dcd0be8..8331e2c51dbe378f3ae98a8a481713faff420fe8 100644 --- a/gnome/src/ui.xml +++ b/gnome/src/ui.xml @@ -8,6 +8,7 @@ <menuitem name="OnHoldMenu" action="OnHold"/> <menuitem action="InstantMessaging"/> <menuitem action="Record"/> + <menuitem action="MuteCall"/> <separator/> <menuitem action="AccountAssistant"/> <separator/> @@ -49,6 +50,7 @@ <toolitem name="TransferToolbar" action="Transfer"/> <toolitem name="InstantMessagingToolbar" action="InstantMessaging"/> <toolitem name="RecordToolbar" action="Record"/> + <toolitem name="MuteCallToolbar" action="MuteCall"/> <!-- FIXME: commented out because it is responsible for #7495 --> <!-- separator/--> <toolitem name="VoicemailToolbar" action="Voicemail"/> diff --git a/gnome/src/uimanager.c b/gnome/src/uimanager.c index 5c2fdf7074f90122c4ec705c3ed0942efbc8f2aa..06c514a5330f367eab30afac6f376bdd822af822 100644 --- a/gnome/src/uimanager.c +++ b/gnome/src/uimanager.c @@ -65,6 +65,7 @@ static GtkWidget *toolbar_; static guint transferButtonConnId_; //The button toggled signal connection ID static guint recordButtonConnId_; //The button toggled signal connection ID +static guint muteCallButtonId_; //The button toggled signal connection ID static GtkAction * pickUpAction_; static GtkWidget * pickUpWidget_; @@ -79,7 +80,9 @@ static GtkWidget * transferToolbar_; static GtkAction * copyAction_; static GtkAction * pasteAction_; static GtkAction * recordAction_; +static GtkAction * muteCallAction_; static GtkWidget * recordWidget_; +static GtkWidget * muteCallWidget_; static GtkAction * voicemailAction_; static GtkWidget * voicemailToolbar_; static GtkWidget * imToolbar_; @@ -127,6 +130,7 @@ update_actions() g_object_ref(hangUpWidget_); g_object_ref(recordWidget_); + g_object_ref(muteCallWidget_); g_object_ref(holdToolbar_); g_object_ref(offHoldToolbar_); @@ -140,6 +144,7 @@ update_actions() remove_from_toolbar(hangUpWidget_); remove_from_toolbar(recordWidget_); + remove_from_toolbar(muteCallWidget_); remove_from_toolbar(transferToolbar_); remove_from_toolbar(historyButton_); @@ -153,7 +158,9 @@ update_actions() gtk_widget_set_sensitive(holdToolbar_, FALSE); gtk_widget_set_sensitive(offHoldToolbar_, FALSE); gtk_action_set_sensitive(recordAction_, FALSE); + gtk_action_set_sensitive(muteCallAction_, FALSE); gtk_widget_set_sensitive(recordWidget_, FALSE); + gtk_widget_set_sensitive(muteCallWidget_, FALSE); gtk_action_set_sensitive(copyAction_, FALSE); if (addrbook) @@ -285,15 +292,20 @@ update_actions() gtk_widget_set_sensitive(holdToolbar_, TRUE); gtk_widget_set_sensitive(transferToolbar_, TRUE); gtk_action_set_sensitive(recordAction_, TRUE); + gtk_action_set_sensitive(muteCallAction_, TRUE); add_to_toolbar(toolbar_, holdToolbar_, pos++); add_to_toolbar(toolbar_, transferToolbar_, pos++); add_to_toolbar(toolbar_, recordWidget_, pos++); + add_to_toolbar(toolbar_, muteCallWidget_, pos++); g_signal_handler_block(transferToolbar_, transferButtonConnId_); gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transferToolbar_), FALSE); g_signal_handler_unblock(transferToolbar_, transferButtonConnId_); g_signal_handler_block(recordWidget_, recordButtonConnId_); + g_signal_handler_block(muteCallWidget_, muteCallButtonId_); gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(recordWidget_), FALSE); + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(muteCallWidget_), FALSE); g_signal_handler_unblock(recordWidget_, recordButtonConnId_); + g_signal_handler_unblock(muteCallWidget_, muteCallButtonId_); if (instant_messaging_enabled) { gtk_action_set_sensitive(imAction_, TRUE); @@ -313,15 +325,20 @@ update_actions() gtk_widget_set_sensitive(holdToolbar_, TRUE); gtk_widget_set_sensitive(transferToolbar_, TRUE); gtk_action_set_sensitive(recordAction_, TRUE); + gtk_action_set_sensitive(muteCallAction_, TRUE); add_to_toolbar(toolbar_, holdToolbar_, pos++); add_to_toolbar(toolbar_, transferToolbar_, pos++); add_to_toolbar(toolbar_, recordWidget_, pos++); + add_to_toolbar(toolbar_, muteCallWidget_, pos++); g_signal_handler_block(transferToolbar_, transferButtonConnId_); gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(transferToolbar_), FALSE); g_signal_handler_unblock(transferToolbar_, transferButtonConnId_); g_signal_handler_block(recordWidget_, recordButtonConnId_); + g_signal_handler_block(muteCallWidget_, muteCallButtonId_); gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(recordWidget_), TRUE); + gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(muteCallWidget_), TRUE); g_signal_handler_unblock(recordWidget_, recordButtonConnId_); + g_signal_handler_unblock(muteCallWidget_, muteCallButtonId_); if (instant_messaging_enabled) { gtk_action_set_sensitive(imAction_, TRUE); @@ -374,10 +391,12 @@ update_actions() gtk_action_set_sensitive(hangUpAction_, TRUE); gtk_widget_set_sensitive(holdToolbar_, TRUE); gtk_action_set_sensitive(recordAction_, TRUE); + gtk_action_set_sensitive(muteCallAction_, TRUE); int pos = 1; add_to_toolbar(toolbar_, hangUpWidget_, pos++); add_to_toolbar(toolbar_, holdToolbar_, pos++); add_to_toolbar(toolbar_, recordWidget_, pos++); + add_to_toolbar(toolbar_, muteCallWidget_, pos++); if (instant_messaging_enabled) { gtk_action_set_sensitive(imAction_, TRUE); @@ -401,9 +420,11 @@ update_actions() gtk_action_set_sensitive(hangUpAction_, TRUE); gtk_widget_set_sensitive(holdToolbar_, TRUE); gtk_action_set_sensitive(recordAction_, TRUE); + gtk_action_set_sensitive(muteCallAction_, TRUE); add_to_toolbar(toolbar_, hangUpWidget_, pos++); add_to_toolbar(toolbar_, holdToolbar_, pos++); add_to_toolbar(toolbar_, recordWidget_, pos++); + add_to_toolbar(toolbar_, muteCallWidget_, pos++); if (instant_messaging_enabled) { gtk_action_set_sensitive(imAction_, TRUE); @@ -419,9 +440,11 @@ update_actions() gtk_action_set_sensitive(hangUpAction_, TRUE); gtk_widget_set_sensitive(offHoldToolbar_, TRUE); gtk_action_set_sensitive(recordAction_, TRUE); + gtk_action_set_sensitive(muteCallAction_, TRUE); add_to_toolbar(toolbar_, hangUpWidget_, pos++); add_to_toolbar(toolbar_, offHoldToolbar_, pos++); add_to_toolbar(toolbar_, recordWidget_, pos++); + add_to_toolbar(toolbar_, muteCallWidget_, pos++); if (instant_messaging_enabled) { gtk_action_set_sensitive(imAction_, TRUE); @@ -722,6 +745,13 @@ call_record(void) sflphone_rec_call(); } +static void +call_mute(void) +{ + DEBUG("UIManager: Mute call button pressed"); +// sflphone_mute_call(); +} + static void start_playback_record_cb(void) { @@ -1068,6 +1098,7 @@ static const GtkActionEntry menu_entries[] = { static const GtkToggleActionEntry toggle_menu_entries[] = { { "Transfer", GTK_STOCK_TRANSFER, N_("_Transfer"), "<control>T", N_("Transfer the call"), NULL, TRUE }, { "Record", GTK_STOCK_MEDIA_RECORD, N_("_Record"), "<control>R", N_("Record the current conversation"), NULL, TRUE }, + { "MuteCall", GTK_STOCK_MEDIA_RECORD, N_("_MuteCall"), "<control>M", N_("Mute microphone for this call"), NULL, TRUE }, { "Toolbar", NULL, N_("_Show toolbar"), "<control>T", N_("Show the toolbar"), NULL, TRUE }, { "Dialpad", NULL, N_("_Dialpad"), "<control>D", N_("Show the dialpad"), G_CALLBACK(dialpad_bar_cb), TRUE }, { "VolumeControls", NULL, N_("_Volume controls"), "<control>V", N_("Show the volume controls"), G_CALLBACK(volume_bar_cb), TRUE }, @@ -1077,7 +1108,7 @@ static const GtkToggleActionEntry toggle_menu_entries[] = { GtkUIManager *uimanager_new(void) { - gint nb_entries = addrbook ? 7 : 6; + gint nb_entries = addrbook ? 8 : 7; GtkWidget *window = get_main_window(); GtkUIManager *ui_manager = gtk_ui_manager_new(); @@ -1193,7 +1224,7 @@ void show_popup_menu(GtkWidget *my_widget, GdkEventButton *event) { // TODO update the selection to make sure the call under the mouse is the call selected - 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, mute = FALSE; gboolean accounts = FALSE; // conference type boolean @@ -1232,6 +1263,7 @@ show_popup_menu(GtkWidget *my_widget, GdkEventButton *event) hold = TRUE; record = TRUE; im = TRUE; + mute = TRUE; break; case CALL_STATE_BUSY: case CALL_STATE_FAILURE: @@ -1340,6 +1372,20 @@ show_popup_menu(GtkWidget *my_widget, GdkEventButton *event) gtk_widget_show(menu_items); } + if (mute) { + GtkWidget *menu_items = gtk_image_menu_item_new_with_mnemonic(_("_Mute")); + GtkWidget *image = gtk_image_new_from_stock(GTK_STOCK_MEDIA_RECORD, + GTK_ICON_SIZE_MENU); + gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menu_items), image); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_items); + g_signal_connect(G_OBJECT(menu_items), "activate", + G_CALLBACK(call_mute), + NULL); + gtk_widget_show(menu_items); + } + + + if (im) { // do not display message if instant messaging is disabled gboolean instant_messaging_enabled = TRUE; @@ -1564,15 +1610,59 @@ GtkWidget * create_menus(GtkUIManager *ui_manager) { GtkWidget *menu_bar = gtk_ui_manager_get_widget(ui_manager, "/MenuBar"); + if(menu_bar == NULL) { + ERROR("Could not create menu bar"); + } + pickUpAction_ = gtk_ui_manager_get_action(ui_manager, "/MenuBar/CallMenu/PickUp"); + if(pickUpAction_ == NULL) { + ERROR("Could not create pick up action"); + } + newCallAction_ = gtk_ui_manager_get_action(ui_manager, "/MenuBar/CallMenu/NewCall"); + if(newCallAction_ == NULL) { + ERROR("Could not create new call action"); + } + hangUpAction_ = gtk_ui_manager_get_action(ui_manager, "/MenuBar/CallMenu/HangUp"); + if(hangUpAction_ == NULL) { + ERROR("Could not create hangup action"); + } + holdMenu_ = gtk_ui_manager_get_widget(ui_manager, "/MenuBar/CallMenu/OnHoldMenu"); + if(holdMenu_ == NULL) { + ERROR("Could not create hold menu widget"); + } + recordAction_ = gtk_ui_manager_get_action(ui_manager, "/MenuBar/CallMenu/Record"); + if(recordAction_ == NULL) { + ERROR("Could not create record action"); + } + + muteCallAction_ = gtk_ui_manager_get_action(ui_manager, "/MenuBar/CallMenu/MuteCall"); + if(muteCallAction_ == NULL) { + ERROR("Could not create mute call action"); + } + imAction_ = gtk_ui_manager_get_action(ui_manager, "/MenuBar/CallMenu/InstantMessaging"); + if(imAction_ == NULL) { + ERROR("Could not create instant messaging action"); + } + copyAction_ = gtk_ui_manager_get_action(ui_manager, "/MenuBar/EditMenu/Copy"); + if(copyAction_ == NULL) { + ERROR("Could not create copy action"); + } + pasteAction_ = gtk_ui_manager_get_action(ui_manager, "/MenuBar/EditMenu/Paste"); + if(pasteAction_ == NULL) { + ERROR("Could not create paste action"); + } + volumeToggle_ = gtk_ui_manager_get_action(ui_manager, "/MenuBar/ViewMenu/VolumeControls"); + if(volumeToggle_ == NULL) { + ERROR("Could not create volume toggle action"); + } // Set the toggle buttons gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(gtk_ui_manager_get_action(ui_manager, "/MenuBar/ViewMenu/Dialpad")), eel_gconf_get_boolean(CONF_SHOW_DIALPAD)); @@ -1592,32 +1682,75 @@ create_toolbar_actions(GtkUIManager *ui_manager) { toolbar_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions"); - holdToolbar_ = gtk_ui_manager_get_widget(ui_manager, - "/ToolbarActions/OnHoldToolbar"); - offHoldToolbar_ = gtk_ui_manager_get_widget(ui_manager, - "/ToolbarActions/OffHoldToolbar"); - transferToolbar_ = gtk_ui_manager_get_widget(ui_manager, - "/ToolbarActions/TransferToolbar"); - voicemailAction_ = gtk_ui_manager_get_action(ui_manager, - "/ToolbarActions/Voicemail"); - voicemailToolbar_ = gtk_ui_manager_get_widget(ui_manager, - "/ToolbarActions/VoicemailToolbar"); - newCallWidget_ = gtk_ui_manager_get_widget(ui_manager, - "/ToolbarActions/NewCallToolbar"); - pickUpWidget_ = gtk_ui_manager_get_widget(ui_manager, - "/ToolbarActions/PickUpToolbar"); - hangUpWidget_ = gtk_ui_manager_get_widget(ui_manager, - "/ToolbarActions/HangUpToolbar"); - recordWidget_ = gtk_ui_manager_get_widget(ui_manager, - "/ToolbarActions/RecordToolbar"); - imToolbar_ = gtk_ui_manager_get_widget(ui_manager, - "/ToolbarActions/InstantMessagingToolbar"); - historyButton_ = gtk_ui_manager_get_widget(ui_manager, - "/ToolbarActions/HistoryToolbar"); - playRecordWidget_ = gtk_ui_manager_get_widget(ui_manager, - "/ToolbarActions/StartPlaybackRecordToolbar"); - stopRecordWidget_ = gtk_ui_manager_get_widget(ui_manager, - "/ToolbarActions/StopPlaybackRecordToolbar"); + holdToolbar_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions/OnHoldToolbar"); + if(holdToolbar_ == NULL) { + ERROR("Could not create on hold toolbar widget"); + } + + offHoldToolbar_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions/OffHoldToolbar"); + if(offHoldToolbar_ == NULL) { + ERROR("Could not create off hold toolbar widget"); + } + + transferToolbar_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions/TransferToolbar"); + if(transferToolbar_ == NULL) { + ERROR("Could not create transfer toolbar widget"); + } + + voicemailAction_ = gtk_ui_manager_get_action(ui_manager, "/ToolbarActions/Voicemail"); + if(voicemailAction_ == NULL) { + ERROR("Could not create voicemail action"); + } + + voicemailToolbar_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions/VoicemailToolbar"); + if(voicemailToolbar_ == NULL) { + ERROR("Could not create voicemail toolbar widget"); + } + + newCallWidget_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions/NewCallToolbar"); + if(newCallWidget_ == NULL) { + ERROR("Could not create new call widget"); + } + + pickUpWidget_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions/PickUpToolbar"); + if(pickUpWidget_ == NULL) { + ERROR("Could not create pick up toolbar widget"); + } + + hangUpWidget_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions/HangUpToolbar"); + if(hangUpWidget_ == NULL) { + ERROR("Could not create hang up toolbar widget"); + } + + recordWidget_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions/RecordToolbar"); + if(recordWidget_ == NULL) { + ERROR("Could not create record toolbar widget"); + } + + muteCallWidget_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions/MuteCallToolbar"); + if(muteCallWidget_ == NULL) { + ERROR("Could not create mute call widget"); + } + + imToolbar_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions/InstantMessagingToolbar"); + if(imToolbar_ == NULL) { + ERROR("Could not create instant messaging widget"); + } + + historyButton_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions/HistoryToolbar"); + if(historyButton_ == NULL) { + ERROR("Could not create history button widget"); + } + + playRecordWidget_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions/StartPlaybackRecordToolbar"); + if(playRecordWidget_ == NULL) { + ERROR("Could not create play record widget"); + } + + stopRecordWidget_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions/StopPlaybackRecordToolbar"); + if(stopRecordWidget_ == NULL) { + ERROR("Could not create stop record widget"); + } if (addrbook) contactButton_ = gtk_ui_manager_get_widget(ui_manager, "/ToolbarActions/AddressbookToolbar"); @@ -1625,6 +1758,7 @@ create_toolbar_actions(GtkUIManager *ui_manager) // Set the handler ID for the transfer transferButtonConnId_ = g_signal_connect(G_OBJECT(transferToolbar_), "toggled", G_CALLBACK(call_transfer_cb), NULL); recordButtonConnId_ = g_signal_connect(G_OBJECT(recordWidget_), "toggled", G_CALLBACK(call_record), NULL); + muteCallButtonId_ = g_signal_connect(G_OBJECT(muteCallWidget_), "toggled", G_CALLBACK(call_mute), NULL); active_calltree_tab = current_calls_tab; return toolbar_;