Commit 0b7dd069 authored by Aline Gondim Santos's avatar Aline Gondim Santos Committed by Sébastien Blin
Browse files

plugins: add callId to API

fix file chooser dialog confirmation button string
fix infinity loop when toggling more than one mediahandler

Change-Id: I68a5dbecab287bd4c306e5c4053d367a0c9d8197
parent e20171fe
......@@ -744,24 +744,25 @@ on_search_participant(GtkSearchEntry* search_entry, CurrentCallView* self)
}
static void
activate_media_handler(GtkToggleButton* switchBtn, GParamSpec*, CurrentCallView* self)
activate_media_handler(GtkToggleButton* switchBtn, GParamSpec*, CurrentCallView* view)
{
auto priv = CURRENT_CALL_VIEW_GET_PRIVATE(self);
g_return_if_fail(IS_CURRENT_CALL_VIEW(view));
auto* priv = CURRENT_CALL_VIEW_GET_PRIVATE(view);
auto rowIdx = 0;
while (auto* children = gtk_list_box_get_row_at_index(GTK_LIST_BOX(priv->list_media_handlers_available), rowIdx)) {
auto* label = get_mediahandler_label(GTK_LIST_BOX_ROW(children));
auto* btn = get_mediahandler_btn(GTK_LIST_BOX_ROW(children));
bool toggled = false;
if (switchBtn == btn) {
auto toggled = gtk_toggle_button_get_active(btn);
QString mediaHandlerID = QString::fromStdString((gchar*)g_object_get_data(G_OBJECT(label), "mediaHandlerID"));
auto callToToggle = priv->cpp->conversation->callId;
if (!priv->cpp->conversation->confId.isEmpty())
callToToggle = priv->cpp->conversation->confId;
priv->cpp->lrc_.getPluginModel().toggleCallMediaHandler(mediaHandlerID);
auto mediaHandlerStatus = priv->cpp->lrc_.getPluginModel().getCallMediaHandlerStatus();
toggled = !mediaHandlerStatus["name"].isEmpty() && mediaHandlerStatus["name"] == mediaHandlerID;
priv->cpp->lrc_.getPluginModel().toggleCallMediaHandler(mediaHandlerID, callToToggle, toggled);
auto mediaHandlerStatus = priv->cpp->lrc_.getPluginModel().getCallMediaHandlerStatus(callToToggle)[callToToggle];
}
gtk_toggle_button_set_active (btn, toggled);
++rowIdx;
}
......@@ -1069,11 +1070,17 @@ CppImpl::add_media_handler(lrc::api::plugin::MediaHandlerDetails mediaHandlerDet
QString bestName = _("No name!");
auto* mediaHandlerImage = gtk_image_new_from_icon_name("application-x-addon-symbolic", GTK_ICON_SIZE_LARGE_TOOLBAR);
auto mediaHandlerStatus = lrc_.getPluginModel().getCallMediaHandlerStatus();
auto mediaHandlerStatus = lrc_.getPluginModel().getCallMediaHandlerStatus(conversation->callId)[conversation->callId];
bool isActive = false;
if (!mediaHandlerDetails.name.isEmpty()) {
bestName = mediaHandlerDetails.name;
isActive = (mediaHandlerStatus["name"] == mediaHandlerDetails.id);
if (!mediaHandlerStatus.isEmpty()) {
for (const auto& toggledMediaHandler : mediaHandlerStatus)
if (toggledMediaHandler == mediaHandlerDetails.id) {
isActive = true;
break;
}
}
}
std::string mediaHandlerID = (mediaHandlerDetails.id).toStdString();
......@@ -1966,7 +1973,6 @@ CppImpl::update_view()
else
{
gtk_widget_hide(widgets->togglebutton_activate_plugin);
lrc_.getPluginModel().toggleCallMediaHandler(_(""));
}
}
......
......@@ -126,7 +126,7 @@ choose_jpl_file(PluginSettingsView *self)
GTK_FILE_CHOOSER_ACTION_OPEN,
_("_Cancel"),
GTK_RESPONSE_CANCEL,
_("_Save"),
_("_Open"),
GTK_RESPONSE_ACCEPT,
NULL);
res = gtk_dialog_run (GTK_DIALOG(dialog));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment