contextmenus: add some options for users
In the conversations pop-up menu, make a difference between audio
and video calls.
In the video_widget add a direct option to share the current
monitor.
Change-Id: I16ab1f27d4bd710f55cb4cde5d4c5564091e4c65
Reviewed-by: Philippe Gorley <philippe.gorley@savoirfairelinux.com>
diff --git a/src/conversationpopupmenu.cpp b/src/conversationpopupmenu.cpp
index 37fdfeb..ea404ac 100644
--- a/src/conversationpopupmenu.cpp
+++ b/src/conversationpopupmenu.cpp
@@ -129,15 +129,25 @@
}
static void
-place_call(G_GNUC_UNUSED GtkWidget *menu, ConversationPopupMenuPrivate* priv)
+place_video_call(G_GNUC_UNUSED GtkWidget *menu, ConversationPopupMenuPrivate* priv)
{
try
{
auto conversation = priv->accountContainer_->info.conversationModel->filteredConversation(priv->row_);
priv->accountContainer_->info.conversationModel->placeCall(conversation.uid);
+ } catch (...) {
+ g_warning("Can't get conversation at row %i", priv->row_);
}
- catch (...)
+}
+
+static void
+place_audio_call(G_GNUC_UNUSED GtkWidget *menu, ConversationPopupMenuPrivate* priv)
+{
+ try
{
+ auto conversation = priv->accountContainer_->info.conversationModel->filteredConversation(priv->row_);
+ priv->accountContainer_->info.conversationModel->placeAudioOnlyCall(conversation.uid);
+ } catch (...) {
g_warning("Can't get conversation at row %i", priv->row_);
}
}
@@ -166,12 +176,14 @@
// we always build a menu, however in some cases some or all of the conversations will be deactivated
// we prefer this to having an empty menu because GTK+ behaves weird in the empty menu case
- auto place_call_conversation = gtk_menu_item_new_with_mnemonic(_("_Place call"));
- gtk_menu_shell_append(GTK_MENU_SHELL(self), place_call_conversation);
- g_signal_connect(place_call_conversation, "activate", G_CALLBACK(place_call), priv);
- auto copy_name = gtk_menu_item_new_with_mnemonic(_("_Copy name"));
- gtk_menu_shell_append(GTK_MENU_SHELL(self), copy_name);
- g_signal_connect(copy_name, "activate", G_CALLBACK(copy_contact_info), priv);
+ auto callId = conversation.confId.empty() ? conversation.callId : conversation.confId;
+ // Not in call
+ auto place_video_call_conversation = gtk_menu_item_new_with_mnemonic(_("Place _video call"));
+ gtk_menu_shell_append(GTK_MENU_SHELL(self), place_video_call_conversation);
+ g_signal_connect(place_video_call_conversation, "activate", G_CALLBACK(place_video_call), priv);
+ auto place_audio_call_conversation = gtk_menu_item_new_with_mnemonic(_("Place _audio call"));
+ gtk_menu_shell_append(GTK_MENU_SHELL(self), place_audio_call_conversation);
+ g_signal_connect(place_audio_call_conversation, "activate", G_CALLBACK(place_audio_call), priv);
if (contactInfo.profileInfo.type == lrc::api::profile::Type::TEMPORARY ||
contactInfo.profileInfo.type == lrc::api::profile::Type::PENDING) {
// If we can add this conversation
@@ -198,6 +210,10 @@
g_signal_connect(block_conversation_item, "activate", G_CALLBACK(block_conversation), priv);
}
+ auto copy_name = gtk_menu_item_new_with_mnemonic(_("_Copy name"));
+ gtk_menu_shell_append(GTK_MENU_SHELL(self), copy_name);
+ g_signal_connect(copy_name, "activate", G_CALLBACK(copy_contact_info), priv);
+
/* show all conversations */
gtk_widget_show_all(GTK_WIDGET(self));
} catch (const std::out_of_range&) {