mainwindow: use activeCalls() api from LRC

Change-Id: I4f0e572ef9a0d1a8b381fd7fa37d0b7378e91d24
parent 7e29ea17
...@@ -333,7 +333,6 @@ public: ...@@ -333,7 +333,6 @@ public:
bool show_settings = false; bool show_settings = false;
bool is_fullscreen = false; bool is_fullscreen = false;
bool has_cleared_all_history = false; bool has_cleared_all_history = false;
uint32_t activeCalls = 0;
guint inhibitionCookie = 0; guint inhibitionCookie = 0;
int smartviewPageNum = 0; int smartviewPageNum = 0;
...@@ -1923,7 +1922,7 @@ CppImpl::slotCallStatusChanged(const std::string& callId) ...@@ -1923,7 +1922,7 @@ CppImpl::slotCallStatusChanged(const std::string& callId)
void void
CppImpl::slotCallStarted(const std::string& callId) CppImpl::slotCallStarted(const std::string& callId)
{ {
if (activeCalls == 0) { if (!lrc::api::Lrc::activeCalls().empty()) {
GtkApplication* app = gtk_window_get_application(GTK_WINDOW(self)); GtkApplication* app = gtk_window_get_application(GTK_WINDOW(self));
if (app) { if (app) {
inhibitionCookie = gtk_application_inhibit( inhibitionCookie = gtk_application_inhibit(
...@@ -1933,14 +1932,12 @@ CppImpl::slotCallStarted(const std::string& callId) ...@@ -1933,14 +1932,12 @@ CppImpl::slotCallStarted(const std::string& callId)
g_debug("Inhibition was activated."); g_debug("Inhibition was activated.");
} }
} }
activeCalls++;
} }
void void
CppImpl::slotCallEnded(const std::string& callId) CppImpl::slotCallEnded(const std::string& callId)
{ {
activeCalls--; if (lrc::api::Lrc::activeCalls().empty()) {
if (activeCalls == 0) {
GtkApplication* app = gtk_window_get_application(GTK_WINDOW(self)); GtkApplication* app = gtk_window_get_application(GTK_WINDOW(self));
if (app) { if (app) {
gtk_application_uninhibit(app, inhibitionCookie); gtk_application_uninhibit(app, inhibitionCookie);
...@@ -2247,7 +2244,7 @@ ring_main_window_can_close(RingMainWindow* self) ...@@ -2247,7 +2244,7 @@ ring_main_window_can_close(RingMainWindow* self)
{ {
g_return_val_if_fail(IS_RING_MAIN_WINDOW(self), true); g_return_val_if_fail(IS_RING_MAIN_WINDOW(self), true);
auto* priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(self)); auto* priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(self));
if (priv->cpp && (priv->cpp->activeCalls > 0)) { if (priv->cpp && !lrc::api::Lrc::activeCalls().empty()) {
auto* close_dialog = gtk_message_dialog_new(GTK_WINDOW(self), auto* close_dialog = gtk_message_dialog_new(GTK_WINDOW(self),
GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL,
_("A call is currently ongoing. Do you want to close the window and stop all current calls?")); _("A call is currently ongoing. Do you want to close the window and stop all current calls?"));
......
Markdown is supported
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