Commit 1d963276 authored by Guillaume Roguez's avatar Guillaume Roguez

ringmainwindow: refactor fullscreen functions

* move them into CppImpl.
* add toggleFullScreen.

Change-Id: I759195be4618781787c20bd36eb407a9a2a8bfe7
Reviewed-by: Sébastien Blin's avatarSébastien Blin <sebastien.blin@savoirfairelinux.com>
parent 11339f8a
......@@ -130,6 +130,9 @@ public:
void changeView(GType type, lrc::api::conversation::Info conversation = {});
WebKitChatContainer* webkitChatContainer() const;
void enterFullScreen();
void leaveFullScreen();
void toggleFullScreen();
RingMainWindow* self = nullptr; // The GTK widget itself
RingMainWindowPrivate* priv = nullptr;
......@@ -172,43 +175,12 @@ hide_view_clicked(RingMainWindow *self);
static void
ring_init_lrc(RingMainWindow *win, const std::string& accountId);
static void
enter_full_screen(RingMainWindow *self)
{
g_return_if_fail(IS_RING_MAIN_WINDOW(self));
auto priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(self));
if (!priv->cpp->is_fullscreen) {
gtk_widget_hide(priv->vbox_left_pane);
gtk_window_fullscreen(GTK_WINDOW(self));
priv->cpp->is_fullscreen = TRUE;
}
}
static void
leave_full_screen(RingMainWindow *self)
{
g_return_if_fail(IS_RING_MAIN_WINDOW(self));
auto priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(self));
if (priv->cpp->is_fullscreen) {
gtk_widget_show(priv->vbox_left_pane);
gtk_window_unfullscreen(GTK_WINDOW(self));
priv->cpp->is_fullscreen = FALSE;
}
}
static void
video_double_clicked(RingMainWindow *self)
{
g_return_if_fail(IS_RING_MAIN_WINDOW(self));
auto priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(self));
if (priv->cpp->is_fullscreen) {
leave_full_screen(self);
} else {
enter_full_screen(self);
}
auto* priv = RING_MAIN_WINDOW_GET_PRIVATE(RING_MAIN_WINDOW(self));
priv->cpp->toggleFullScreen();
}
static void
......@@ -882,7 +854,7 @@ CppImpl::CppImpl(RingMainWindow& widget)
void
CppImpl::changeView(GType type, lrc::api::conversation::Info conversation)
{
leave_full_screen(self);
leaveFullScreen();
gtk_container_remove(GTK_CONTAINER(priv->frame_call),
gtk_bin_get_child(GTK_BIN(priv->frame_call)));
......@@ -931,7 +903,8 @@ CppImpl::displayCurrentCallView(lrc::api::conversation::Info conversation)
}
} catch(...) { }
g_signal_connect_swapped(new_view, "video-double-clicked", G_CALLBACK(video_double_clicked), self);
g_signal_connect_swapped(new_view, "video-double-clicked",
G_CALLBACK(video_double_clicked), self);
return new_view;
}
......@@ -957,6 +930,35 @@ CppImpl::webkitChatContainer() const
return WEBKIT_CHAT_CONTAINER(priv->webkit_chat_container);
}
void
CppImpl::enterFullScreen()
{
if (!is_fullscreen) {
gtk_widget_hide(priv->vbox_left_pane);
gtk_window_fullscreen(GTK_WINDOW(self));
is_fullscreen = true;
}
}
void
CppImpl::leaveFullScreen()
{
if (is_fullscreen) {
gtk_widget_show(priv->vbox_left_pane);
gtk_window_unfullscreen(GTK_WINDOW(self));
is_fullscreen = false;
}
}
void
CppImpl::toggleFullScreen()
{
if (is_fullscreen)
leaveFullScreen();
else
enterFullScreen();
}
} // namespace details
//==============================================================================
......
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