From 34779818ce998b432cdab9dac0e62e08db054bd6 Mon Sep 17 00:00:00 2001 From: Antoine Fontaine <antoine.fontaine@epfl.ch> Date: Fri, 20 Mar 2020 17:04:21 +0100 Subject: [PATCH] allow using a back swipe to go back to course list fixes https://gitlab.gnugen.ch/afontain/moodle/issues/32. --- data/ui/gui-window.ui | 21 ++++++++++++++++----- src/gui-window.c | 3 +++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/data/ui/gui-window.ui b/data/ui/gui-window.ui index 1753bae..519aeeb 100644 --- a/data/ui/gui-window.ui +++ b/data/ui/gui-window.ui @@ -3,6 +3,12 @@ <interface> <requires lib="gtk+" version="3.16"/> <requires lib="libhandy" version="0.0"/> + <object class="HdySwipeGroup"> + <swipeables> + <swipeable name="header_box"/> + <swipeable name="content_box"/> + </swipeables> + </object> <object class="GtkPopoverMenu" id="menu_popover"> <child> <object class="GtkBox"> @@ -56,9 +62,8 @@ <child> <object class="HdyLeaflet" id="header_box"> <property name="visible">True</property> - <property name="mode-transition-type">slide</property> - <property name="child-transition-type">slide</property> - <property name="visible-child-name" bind-source="content_box" bind-property="visible-child-name" bind-flags="sync-create"/> + <property name="transition-type" bind-source="content_box" bind-property="transition-type" bind-flags="sync-create"/> + <property name="visible-child-name" bind-source="content_box" bind-property="visible-child-name" bind-flags="bidirectional"/> <child> <object class="GtkHeaderBar" id="header_bar"> <property name="visible">True</property> @@ -79,6 +84,9 @@ <class name="sidebar"/> </style> </object> + <packing> + <property name="allow_visible">False</property> + </packing> </child> <child> <object class="GtkHeaderBar" id="sub_header_bar"> @@ -141,8 +149,8 @@ <object class="HdyLeaflet" id="content_box"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="mode_transition_type">slide</property> - <property name="child_transition_type">slide</property> + <property name="can-swipe-back">True</property> + <property name="transition_type">over</property> <child> <object class="GtkStackSidebar" id="sidebar"> <property name="width_request">270</property> @@ -163,6 +171,9 @@ <class name="sidebar"/> </style> </object> + <packing> + <property name="allow_visible">False</property> + </packing> </child> <child> <object class="GtkScrolledWindow" id="scrolled_window"> diff --git a/src/gui-window.c b/src/gui-window.c index 75bf4a3..ddd3ec1 100644 --- a/src/gui-window.c +++ b/src/gui-window.c @@ -321,6 +321,9 @@ gui_window_init (GuiWindow *self) entries, G_N_ELEMENTS (entries), self); + hdy_leaflet_set_can_swipe_back (self->header_box, TRUE); + hdy_leaflet_set_can_swipe_back (self->content_box, TRUE); + initialize_moodle_provider (self->settings); update_moodle_index (self); -- GitLab