window: Use HdyLeaflet:folded
Replace the dropped fold enum property by the folded boolean one, and directly bind booleans in UI files where possible.
This commit is contained in:
parent
080e145e23
commit
0c9b828d6f
2 changed files with 6 additions and 32 deletions
|
@ -513,29 +513,7 @@ switch_to_previous_panel (CcWindow *self)
|
|||
|
||||
/* Callbacks */
|
||||
static void
|
||||
update_fold_state (CcWindow *self)
|
||||
{
|
||||
GtkWidget *header_child = hdy_leaflet_get_visible_child (self->header_box);
|
||||
HdyFold fold = hdy_leaflet_get_fold (self->header_box);
|
||||
|
||||
gtk_widget_set_visible (GTK_WIDGET (self->back_revealer), fold == HDY_FOLD_FOLDED);
|
||||
gtk_revealer_set_reveal_child (self->back_revealer, fold == HDY_FOLD_FOLDED);
|
||||
}
|
||||
|
||||
static void
|
||||
notify_header_visible_child_cb (CcWindow *self)
|
||||
{
|
||||
update_fold_state (self);
|
||||
}
|
||||
|
||||
static void
|
||||
notify_fold_cb (CcWindow *self)
|
||||
{
|
||||
update_fold_state (self);
|
||||
}
|
||||
|
||||
static void
|
||||
on_main_leaflet_fold_changed_cb (CcWindow *self)
|
||||
on_main_leaflet_folded_changed_cb (CcWindow *self)
|
||||
{
|
||||
GtkSelectionMode selection_mode;
|
||||
|
||||
|
@ -543,7 +521,7 @@ on_main_leaflet_fold_changed_cb (CcWindow *self)
|
|||
|
||||
selection_mode = GTK_SELECTION_SINGLE;
|
||||
|
||||
if (hdy_leaflet_get_fold (self->main_leaflet) == HDY_FOLD_FOLDED)
|
||||
if (hdy_leaflet_get_folded (self->main_leaflet))
|
||||
selection_mode = GTK_SELECTION_NONE;
|
||||
|
||||
cc_panel_list_set_selection_mode (self->panel_list, selection_mode);
|
||||
|
@ -915,9 +893,7 @@ cc_window_class_init (CcWindowClass *klass)
|
|||
|
||||
gtk_widget_class_bind_template_callback (widget_class, back_button_clicked_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, gdk_window_set_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, notify_header_visible_child_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, notify_fold_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_main_leaflet_fold_changed_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_main_leaflet_folded_changed_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, on_development_warning_dialog_responded_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, previous_button_clicked_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, search_entry_activate_cb);
|
||||
|
@ -944,8 +920,6 @@ cc_window_init (CcWindow *self)
|
|||
/* Add a custom CSS class on development builds */
|
||||
if (in_flatpak_sandbox ())
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)), "devel");
|
||||
|
||||
update_fold_state (self);
|
||||
}
|
||||
|
||||
CcWindow *
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="transition-type">slide</property>
|
||||
<signal name="notify::fold" handler="on_main_leaflet_fold_changed_cb" object="CcWindow" swapped="yes" />
|
||||
<signal name="notify::folded" handler="on_main_leaflet_folded_changed_cb" object="CcWindow" swapped="yes" />
|
||||
<child>
|
||||
<object class="GtkBox" id="sidebar_box">
|
||||
<property name="visible">True</property>
|
||||
|
@ -113,8 +113,6 @@
|
|||
<property name="mode-transition-duration" bind-source="main_leaflet" bind-property="mode-transition-duration" bind-flags="bidirectional|sync-create"/>
|
||||
<property name="child-transition-duration" bind-source="main_leaflet" bind-property="child-transition-duration" bind-flags="bidirectional|sync-create"/>
|
||||
<property name="transition-type" bind-source="main_leaflet" bind-property="transition-type" bind-flags="bidirectional|sync-create"/>
|
||||
<signal name="notify::visible-child" handler="notify_header_visible_child_cb" swapped="yes"/>
|
||||
<signal name="notify::fold" handler="notify_fold_cb" object="CcWindow" after="yes" swapped="yes"/>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
|
@ -214,6 +212,8 @@
|
|||
<property name="can_focus">False</property>
|
||||
<property name="transition-type">crossfade</property>
|
||||
<property name="transition-duration" bind-source="main_leaflet" bind-property="mode-transition-duration" bind-flags="bidirectional|sync-create"/>
|
||||
<property name="visible" bind-source="header_box" bind-property="folded" bind-flags="sync-create"/>
|
||||
<property name="reveal-child" bind-source="header_box" bind-property="folded" bind-flags="sync-create"/>
|
||||
<child>
|
||||
<object class="GtkButton" id="back">
|
||||
<property name="visible">True</property>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue