Skip to content
Snippets Groups Projects
Commit 4aba7c36 authored by Vivien Didelot's avatar Vivien Didelot
Browse files

gnome: hide video buttons for video-disabled calls

Hide the screen share toolbar button and the video sources contextual
submenu during a call if its account has the video disabled.

Issue: #51158
Change-Id: I0f5230407dad78610655ecda05d7c21532cd4526
parent b769e18a
No related branches found
No related tags found
No related merge requests found
...@@ -134,6 +134,22 @@ static void add_to_toolbar(GtkWidget *toolbar, GtkWidget *item, gint pos) ...@@ -134,6 +134,22 @@ static void add_to_toolbar(GtkWidget *toolbar, GtkWidget *item, gint pos)
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(item), pos); gtk_toolbar_insert(GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(item), pos);
} }
#ifdef SFL_VIDEO
static gboolean
is_video_call(callable_obj_t *call)
{
gboolean video_enabled = FALSE;
account_t *account = account_list_get_by_id(call->_accountID);
if (account) {
gchar *ptr = (gchar *) account_lookup(account, CONFIG_VIDEO_ENABLED);
video_enabled = g_strcmp0(ptr, "true") == 0;
}
return video_enabled;
}
#endif
static void static void
update_toolbar_for_call(callable_obj_t *selectedCall, gboolean instant_messaging_enabled, SFLPhoneClient *client) update_toolbar_for_call(callable_obj_t *selectedCall, gboolean instant_messaging_enabled, SFLPhoneClient *client)
{ {
...@@ -226,6 +242,10 @@ update_toolbar_for_call(callable_obj_t *selectedCall, gboolean instant_messaging ...@@ -226,6 +242,10 @@ update_toolbar_for_call(callable_obj_t *selectedCall, gboolean instant_messaging
} }
case CALL_STATE_CURRENT: case CALL_STATE_CURRENT:
{ {
#ifdef SFL_VIDEO
const gboolean video_enabled = is_video_call(selectedCall);
#endif
g_debug("Call State Current"); g_debug("Call State Current");
g_signal_handler_block(transferToolbar_, transferButtonConnId_); g_signal_handler_block(transferToolbar_, transferButtonConnId_);
g_signal_handler_block(recordWidget_, recordButtonConnId_); g_signal_handler_block(recordWidget_, recordButtonConnId_);
...@@ -238,6 +258,7 @@ update_toolbar_for_call(callable_obj_t *selectedCall, gboolean instant_messaging ...@@ -238,6 +258,7 @@ update_toolbar_for_call(callable_obj_t *selectedCall, gboolean instant_messaging
if (instant_messaging_enabled) if (instant_messaging_enabled)
gtk_action_set_sensitive(imAction_, TRUE); gtk_action_set_sensitive(imAction_, TRUE);
#ifdef SFL_VIDEO #ifdef SFL_VIDEO
if (video_enabled)
gtk_action_set_sensitive(screenshareAction_, TRUE); gtk_action_set_sensitive(screenshareAction_, TRUE);
#endif #endif
...@@ -249,6 +270,7 @@ update_toolbar_for_call(callable_obj_t *selectedCall, gboolean instant_messaging ...@@ -249,6 +270,7 @@ update_toolbar_for_call(callable_obj_t *selectedCall, gboolean instant_messaging
if (instant_messaging_enabled) if (instant_messaging_enabled)
add_to_toolbar(toolbar, imToolbar_, pos++); add_to_toolbar(toolbar, imToolbar_, pos++);
#ifdef SFL_VIDEO #ifdef SFL_VIDEO
if (video_enabled)
add_to_toolbar(toolbar, screenshareToolbar_, pos++); add_to_toolbar(toolbar, screenshareToolbar_, pos++);
#endif #endif
...@@ -1337,7 +1359,7 @@ show_popup_menu(GtkWidget *my_widget, GdkEventButton *event, SFLPhoneClient *cli ...@@ -1337,7 +1359,7 @@ show_popup_menu(GtkWidget *my_widget, GdkEventButton *event, SFLPhoneClient *cli
record = TRUE; record = TRUE;
im = TRUE; im = TRUE;
#ifdef SFL_VIDEO #ifdef SFL_VIDEO
video_sources = TRUE; video_sources = is_video_call(selectedCall);
#endif #endif
break; break;
case CALL_STATE_BUSY: case CALL_STATE_BUSY:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment