[dconf-editor] Make ltr_right_separator private.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Make ltr_right_separator private.
- Date: Wed, 19 Dec 2018 17:19:36 +0000 (UTC)
commit c6ade44eecb218b6ef5854a2dbd27167c185c003
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Wed Dec 12 18:31:51 2018 +0100
Make ltr_right_separator private.
editor/base-headerbar.vala | 48 +++++++++++++++++++++++++++++++++++----------
editor/dconf-headerbar.vala | 33 ++++++++++---------------------
2 files changed, 48 insertions(+), 33 deletions(-)
---
diff --git a/editor/base-headerbar.vala b/editor/base-headerbar.vala
index 63c8613..be7ae09 100644
--- a/editor/base-headerbar.vala
+++ b/editor/base-headerbar.vala
@@ -26,8 +26,7 @@ private class BaseHeaderBar : NightTimeAwareHeaderBar, AdaptativeWidget
{
center_box.valign = Align.FILL;
- register_default_mode ();
- register_about_mode ();
+ register_modes ();
}
/*\
@@ -41,8 +40,24 @@ private class BaseHeaderBar : NightTimeAwareHeaderBar, AdaptativeWidget
disable_popovers = AdaptativeWidget.WindowSize.is_phone_size (new_size)
|| AdaptativeWidget.WindowSize.is_extra_thin (new_size);
- disable_action_bar = disable_popovers
- || AdaptativeWidget.WindowSize.is_extra_flat (new_size);
+ bool _disable_action_bar = disable_popovers
+ || AdaptativeWidget.WindowSize.is_extra_flat (new_size);
+ if (disable_action_bar != _disable_action_bar)
+ {
+ disable_action_bar = _disable_action_bar;
+ if (disable_action_bar)
+ {
+ set_show_close_button (false);
+ quit_button_stack.show ();
+ ltr_right_separator.visible = current_mode_id == default_mode_id;
+ }
+ else
+ {
+ ltr_right_separator.hide ();
+ quit_button_stack.hide ();
+ set_show_close_button (true);
+ }
+ }
update_hamburger_menu ();
}
@@ -165,16 +180,29 @@ private class BaseHeaderBar : NightTimeAwareHeaderBar, AdaptativeWidget
}
}
+ private uint8 current_mode_id = default_mode_id;
+ private void register_modes ()
+ {
+ register_default_mode ();
+ register_about_mode ();
+
+ this.change_mode.connect (update_current_mode_id);
+ }
+ private void update_current_mode_id (uint8 requested_mode_id)
+ {
+ current_mode_id = requested_mode_id;
+ }
+
/*\
* * default widgets
\*/
- [GtkChild] private Button go_back_button;
- [GtkChild] private Separator ltr_left_separator;
- [GtkChild] private Label title_label;
- [GtkChild] private MenuButton info_button;
+ [GtkChild] private Button go_back_button;
+ [GtkChild] private Separator ltr_left_separator;
+ [GtkChild] private Label title_label;
+ [GtkChild] private MenuButton info_button;
+ [GtkChild] private Separator ltr_right_separator;
- [GtkChild] protected Separator ltr_right_separator; // TODO make private
[GtkChild] protected Stack quit_button_stack;
protected void set_default_widgets_states (bool show_go_back_button,
@@ -236,7 +264,7 @@ private class BaseHeaderBar : NightTimeAwareHeaderBar, AdaptativeWidget
\*/
private uint8 about_mode_id = 0;
- protected bool about_mode_on = false; // TODO make private
+ private bool about_mode_on = false;
internal void show_about_view ()
requires (about_mode_id > 0)
diff --git a/editor/dconf-headerbar.vala b/editor/dconf-headerbar.vala
index cca497b..cdb74be 100644
--- a/editor/dconf-headerbar.vala
+++ b/editor/dconf-headerbar.vala
@@ -435,33 +435,20 @@ private class DConfHeaderBar : BrowserHeaderBar
private void update_modifications_button ()
{
- if (disable_action_bar)
+ if (!disable_action_bar)
+ return;
+
+ if (modifications_mode_on)
{
- set_show_close_button (false);
- if (modifications_mode_on)
- {
- ltr_right_separator.hide ();
- quit_button_stack.hide ();
- }
- else
- {
- quit_button_stack.show ();
- if (delay_mode)
- quit_button_stack.set_visible_child (show_modifications_button);
- else
- quit_button_stack.set_visible_child_name ("quit-button");
-
- if (use_bookmarks_mode_on || edit_bookmarks_mode_on || about_mode_on)
- ltr_right_separator.hide ();
- else
- ltr_right_separator.show ();
- }
+ quit_button_stack.hide ();
}
else
{
- quit_button_stack.hide ();
- ltr_right_separator.hide ();
- set_show_close_button (true);
+ quit_button_stack.show ();
+ if (delay_mode)
+ quit_button_stack.set_visible_child (show_modifications_button);
+ else
+ quit_button_stack.set_visible_child_name ("quit-button");
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]