From 11ffdcba2ed0debdb522872d1e37a0626f0e7844 Mon Sep 17 00:00:00 2001 From: Antoine Fontaine <antoine.fontaine@epfl.ch> Date: Fri, 20 Mar 2020 16:29:05 +0100 Subject: [PATCH] simplify back button logic --- data/ui/gui-window.ui | 2 -- src/gui-window.c | 42 ------------------------------------------ 2 files changed, 44 deletions(-) diff --git a/data/ui/gui-window.ui b/data/ui/gui-window.ui index f523031..1753bae 100644 --- a/data/ui/gui-window.ui +++ b/data/ui/gui-window.ui @@ -59,8 +59,6 @@ <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"/> - <signal name="notify::visible-child" handler="notify_header_visible_child_cb" swapped="no"/> - <signal name="notify::fold" handler="notify_fold_cb" after="yes" swapped="no"/> <child> <object class="GtkHeaderBar" id="header_bar"> <property name="visible">True</property> diff --git a/src/gui-window.c b/src/gui-window.c index 39c192e..75bf4a3 100644 --- a/src/gui-window.c +++ b/src/gui-window.c @@ -181,27 +181,6 @@ gui_window_key_pressed_cb (GtkWidget *sender, return TRUE; } -static void -update (GuiWindow *self) -{ - GtkWidget *header_child = hdy_leaflet_get_visible_child (self->header_box); - HdyFold fold = hdy_leaflet_get_fold (self->header_box); - - g_assert (header_child == NULL || GTK_IS_HEADER_BAR (header_child)); - - hdy_header_group_set_focus (self->header_group, fold == HDY_FOLD_FOLDED ? GTK_HEADER_BAR (header_child) : NULL); -} - -static void -update_header_bar (GuiWindow *self) -{ - //const gchar *visible_child_name; - - //visible_child_name = gtk_stack_get_visible_child_name (GTK_STACK (self->stack)); - //gtk_widget_set_visible (GTK_WIDGET (self->search_button), - // g_str_equal (visible_child_name, "search-bar")); -} - static void destroy_widget (GtkWidget *w, gpointer unused) { gtk_widget_destroy (w); @@ -246,22 +225,6 @@ get_courses_cb (gpointer ptr, struct Courses courses) update_courses (self); } -static void -gui_window_notify_header_visible_child_cb (GObject *sender, - GParamSpec *pspec, - GuiWindow *self) -{ - update (self); -} - -static void -gui_window_notify_fold_cb (GObject *sender, - GParamSpec *pspec, - GuiWindow *self) -{ - update (self); -} - static void gui_window_notify_visible_child_cb (GObject *sender, GParamSpec *pspec, @@ -269,7 +232,6 @@ gui_window_notify_visible_child_cb (GObject *sender, { hdy_leaflet_set_visible_child_name (self->content_box, "content"); gtk_container_foreach (GTK_CONTAINER (self->stack), update_course_content, NULL); - update_header_bar (self); } static void @@ -316,8 +278,6 @@ gui_window_class_init (GuiWindowClass *class) //gtk_widget_class_bind_template_child (widget_class, GuiWindow, search_entry); gtk_widget_class_bind_template_child (widget_class, GuiWindow, header_group); gtk_widget_class_bind_template_callback_full (widget_class, "key_pressed_cb", G_CALLBACK(gui_window_key_pressed_cb)); - gtk_widget_class_bind_template_callback_full (widget_class, "notify_header_visible_child_cb", G_CALLBACK(gui_window_notify_header_visible_child_cb)); - gtk_widget_class_bind_template_callback_full (widget_class, "notify_fold_cb", G_CALLBACK(gui_window_notify_fold_cb)); gtk_widget_class_bind_template_callback_full (widget_class, "notify_visible_child_cb", G_CALLBACK(gui_window_notify_visible_child_cb)); gtk_widget_class_bind_template_callback_full (widget_class, "back_clicked_cb", G_CALLBACK(gui_window_back_clicked_cb)); } @@ -363,8 +323,6 @@ gui_window_init (GuiWindow *self) initialize_moodle_provider (self->settings); - update_header_bar (self); - update_moodle_index (self); hdy_leaflet_set_visible_child_name (self->content_box, "sidebar"); -- GitLab