[dconf-editor] Move some methods.



commit 0e327d0eb173ea486372c2cbc252cd1087e87d83
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Thu Jan 10 14:12:24 2019 +0100

    Move some methods.

 editor/bookmarks-headerbar.vala | 105 +++++++++++++++++++---------------------
 editor/dconf-headerbar.vala     |  29 +++++------
 2 files changed, 62 insertions(+), 72 deletions(-)
---
diff --git a/editor/bookmarks-headerbar.vala b/editor/bookmarks-headerbar.vala
index 7b119d5..ee5f8b9 100644
--- a/editor/bookmarks-headerbar.vala
+++ b/editor/bookmarks-headerbar.vala
@@ -31,6 +31,15 @@ private abstract class BookmarksHeaderBar : BrowserHeaderBar, AdaptativeWidget
         register_bookmarks_modes ();
     }
 
+    private string bookmark_name = "/";
+    internal override void set_path (ViewType type, string path)
+    {
+        bookmark_name = BookmarksList.get_bookmark_name (type, path);
+
+        bookmarks_button.set_path (type, path);
+        base.set_path (type, path);
+    }
+
     protected override void set_window_size (AdaptativeWidget.WindowSize new_size)
     {
         bool _disable_popovers = disable_popovers;
@@ -41,26 +50,6 @@ private abstract class BookmarksHeaderBar : BrowserHeaderBar, AdaptativeWidget
             update_bookmarks_button_visibility (/* run transitions */ true);
     }
 
-    private void update_bookmarks_button_visibility (bool transition)
-    {
-        bookmarks_revealer.set_transition_duration (transition ? 300 : 0);
-
-        if (!disable_popovers && no_in_window_mode)
-            set_bookmarks_button_visibility (/* visibility */ true, ref bookmarks_revealer, ref 
bookmarks_button);
-        else
-        {
-            bookmarks_button.active = false;
-            set_bookmarks_button_visibility (/* visibility */ false, ref bookmarks_revealer, ref 
bookmarks_button);
-        }
-    }
-    private static inline void set_bookmarks_button_visibility (bool visibility,
-                                                            ref Revealer bookmarks_revealer,
-                                                            ref Bookmarks bookmarks_button)
-    {
-        bookmarks_button.sensitive = visibility;
-        bookmarks_revealer.set_reveal_child (visibility);
-    }
-
     /*\
     * * bookmarks widget
     \*/
@@ -108,6 +97,26 @@ private abstract class BookmarksHeaderBar : BrowserHeaderBar, AdaptativeWidget
         update_bookmarks_icons (bookmarks_variant);
     }
 
+    private void update_bookmarks_button_visibility (bool transition)
+    {
+        bookmarks_revealer.set_transition_duration (transition ? 300 : 0);
+
+        if (!disable_popovers && no_in_window_mode)
+            set_bookmarks_button_visibility (/* visibility */ true, ref bookmarks_revealer, ref 
bookmarks_button);
+        else
+        {
+            bookmarks_button.active = false;
+            set_bookmarks_button_visibility (/* visibility */ false, ref bookmarks_revealer, ref 
bookmarks_button);
+        }
+    }
+    private static inline void set_bookmarks_button_visibility (bool visibility,
+                                                            ref Revealer bookmarks_revealer,
+                                                            ref Bookmarks bookmarks_button)
+    {
+        bookmarks_button.sensitive = visibility;
+        bookmarks_revealer.set_reveal_child (visibility);
+    }
+
     /*\
     * * use-bookmarks mode
     \*/
@@ -222,41 +231,6 @@ private abstract class BookmarksHeaderBar : BrowserHeaderBar, AdaptativeWidget
 
     internal void update_bookmark_icon (string bookmark, BookmarkIcon icon) { 
bookmarks_button.update_bookmark_icon (bookmark, icon); }
 
-    /*\
-    * * should move back
-    \*/
-
-    private string bookmark_name = "/";
-
-    internal override void set_path (ViewType type, string path)
-    {
-        bookmark_name = BookmarksList.get_bookmark_name (type, path);
-
-        bookmarks_button.set_path (type, path);
-        base.set_path (type, path);
-    }
-
-    internal void click_bookmarks_button ()
-    {
-        hide_hamburger_menu ();
-        if (bookmarks_button.sensitive)
-            bookmarks_button.clicked ();
-    }
-
-    internal void bookmark_current_path ()
-    {
-        hide_hamburger_menu ();
-        bookmarks_button.bookmark_current_path ();
-        update_hamburger_menu ();
-    }
-
-    internal void unbookmark_current_path ()
-    {
-        hide_hamburger_menu ();
-        bookmarks_button.unbookmark_current_path ();
-        update_hamburger_menu ();
-    }
-
     /*\
     * * hamburger menu
     \*/
@@ -319,6 +293,27 @@ private abstract class BookmarksHeaderBar : BrowserHeaderBar, AdaptativeWidget
         return BaseWindow.no_copy_text (out copy_text);
     }
 
+    internal void click_bookmarks_button ()
+    {
+        hide_hamburger_menu ();
+        if (bookmarks_button.sensitive)
+            bookmarks_button.clicked ();
+    }
+
+    internal void bookmark_current_path ()
+    {
+        hide_hamburger_menu ();
+        bookmarks_button.bookmark_current_path ();
+        update_hamburger_menu ();
+    }
+
+    internal void unbookmark_current_path ()
+    {
+        hide_hamburger_menu ();
+        bookmarks_button.unbookmark_current_path ();
+        update_hamburger_menu ();
+    }
+
     /*\
     * * popovers methods
     \*/
diff --git a/editor/dconf-headerbar.vala b/editor/dconf-headerbar.vala
index 184e731..5dca7e0 100644
--- a/editor/dconf-headerbar.vala
+++ b/editor/dconf-headerbar.vala
@@ -50,6 +50,14 @@ private class DConfHeaderBar : BookmarksHeaderBar, AdaptativeWidget
         Object (night_light_monitor: _night_light_monitor, about_action_label: _("About Dconf Editor"));
     }
 
+    private bool is_folder_view = true;
+    internal override void set_path (ViewType type, string path)
+    {
+        is_folder_view = type == ViewType.FOLDER;
+
+        base.set_path (type, path);
+    }
+
     protected override void set_window_size (AdaptativeWidget.WindowSize new_size)
     {
         base.set_window_size (new_size);
@@ -61,11 +69,11 @@ private class DConfHeaderBar : BookmarksHeaderBar, AdaptativeWidget
     * * modifications buttons and actions
     \*/
 
-    private Button      show_modifications_button;
-    private MenuButton  modification_actions_button;
+    private Button      show_modifications_button;      // for selecting as stack child only
+    private MenuButton  modification_actions_button;    // for selecting as stack child only
     private MenuButton  modifications_actions_button;
-    private GLib.Menu   changes_pending_menu;
-    private GLib.Menu   quit_delayed_mode_menu;
+    private GLib.Menu   changes_pending_menu;           // for selecting as menu only
+    private GLib.Menu   quit_delayed_mode_menu;         // for selecting as menu only
 
     private static void add_show_modifications_button (out Button show_modifications_button, ref Stack 
quit_button_stack)
     {
@@ -149,19 +157,6 @@ private class DConfHeaderBar : BookmarksHeaderBar, AdaptativeWidget
         }
     }
 
-    /*\
-    * * should move back
-    \*/
-
-    private bool is_folder_view = true;
-
-    internal override void set_path (ViewType type, string path)
-    {
-        is_folder_view = type == ViewType.FOLDER;
-
-        base.set_path (type, path);
-    }
-
     /*\
     * * hamburger menu
     \*/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]