[dconf-editor: 3/5] Remove night-light-monitor




commit 90cd0f5389e37d8316cf8bce4ddd791b9835112a
Author: Maximiliano Sandoval R <msandova gnome org>
Date:   Wed Jul 27 16:40:01 2022 +0200

    Remove night-light-monitor
    
    With proper dark mode support backed in GNOME 42 this gets in the way of
    using the proper color-scheme.
    
    Reverts 0069cd4679a8450e026de7113c60aa93e4fac131.

 build-aux/ca.desrt.dconf-editor.json     |   3 +-
 editor/adaptative-window.vala            |  67 ----------
 editor/base-headerbar.vala               |   1 -
 editor/ca.desrt.dconf-editor.gschema.xml |   7 -
 editor/dconf-editor.vala                 |  22 +--
 editor/dconf-headerbar.vala              |   3 +-
 editor/dconf-window.vala                 |   4 +-
 editor/meson.build                       |   1 -
 editor/night-light-monitor.vala          | 222 -------------------------------
 9 files changed, 5 insertions(+), 325 deletions(-)
---
diff --git a/build-aux/ca.desrt.dconf-editor.json b/build-aux/ca.desrt.dconf-editor.json
index 4684c3df..d3e69a80 100644
--- a/build-aux/ca.desrt.dconf-editor.json
+++ b/build-aux/ca.desrt.dconf-editor.json
@@ -13,8 +13,7 @@
         "--filesystem=host:ro",
         "--env=DCONF_USER_CONFIG_DIR=.config/dconf",
         "--env=GIO_EXTRA_MODULES=/app/lib/gio/modules/",
-        "--talk-name=org.freedesktop.Flatpak",
-        "--talk-name=org.gnome.SettingsDaemon.Color"
+        "--talk-name=org.freedesktop.Flatpak"
     ],
     "modules": [
         {
diff --git a/editor/adaptative-window.vala b/editor/adaptative-window.vala
index b33e6790..01acf968 100644
--- a/editor/adaptative-window.vala
+++ b/editor/adaptative-window.vala
@@ -70,53 +70,6 @@ private interface AdaptativeWidget : Object
 
 private abstract class NightTimeAwareHeaderBar : HeaderBar
 {
-    private bool night_time           = false; // no need to use NightTime here (that allows an "Unknown" 
value)
-    private bool dark_theme           = false;
-    private bool automatic_night_mode = false;
-
-    /*\
-    * * construct
-    \*/
-
-    [CCode (notify = false)] public NightLightMonitor night_light_monitor
-    {
-        protected construct
-        {
-            night_time = NightLightMonitor.NightTime.should_use_dark_theme (value.night_time);
-            dark_theme = value.dark_theme;
-            automatic_night_mode = value.automatic_night_mode;
-            // menu is already updated three times at startup, let's not add one
-
-            ulong night_time_handler = value.notify ["night-time"].connect (night_time_changed);
-            ulong dark_theme_handler = value.notify ["dark-theme"].connect (dark_theme_changed);
-            ulong auto_night_handler = value.notify ["automatic-night-mode"].connect 
(automatic_night_mode_changed);
-
-            destroy.connect (() => {
-                    value.disconnect (night_time_handler);
-                    value.disconnect (dark_theme_handler);
-                    value.disconnect (auto_night_handler);
-                });
-        }
-    }
-
-    private void night_time_changed (Object nlm, ParamSpec thing)
-    {
-        night_time = NightLightMonitor.NightTime.should_use_dark_theme (((NightLightMonitor) 
nlm).night_time);
-        update_hamburger_menu ();
-    }
-
-    private void dark_theme_changed (Object nlm, ParamSpec thing)
-    {
-        dark_theme = ((NightLightMonitor) nlm).dark_theme;
-        update_hamburger_menu ();
-    }
-
-    private void automatic_night_mode_changed (Object nlm, ParamSpec thing)
-    {
-        automatic_night_mode = ((NightLightMonitor) nlm).automatic_night_mode;
-        // menu update not needed
-    }
-
     /*\
     * * high-contrast state
     \*/
@@ -136,26 +89,6 @@ private abstract class NightTimeAwareHeaderBar : HeaderBar
     \*/
 
     protected abstract void update_hamburger_menu ();
-
-    protected void append_or_not_night_mode_entry (ref GLib.Menu section)
-    {
-        if (night_time && !highcontrast_state)
-            append_night_mode_entry (dark_theme, automatic_night_mode, ref section);
-    }
-    private static inline void append_night_mode_entry (bool dark_theme, bool auto_night, ref GLib.Menu 
section)
-    {
-        if (dark_theme)
-            /* Translators: there are three related actions: "use", "reuse" and "pause"; displayed in the 
hamburger menu at night */
-            section.append (_("Pause night mode"), "app.set-use-night-mode(false)");
-
-        else if (auto_night)
-            /* Translators: there are three related actions: "use", "reuse" and "pause"; displayed in the 
hamburger menu at night */
-            section.append (_("Reuse night mode"), "app.set-use-night-mode(true)");
-
-        else
-            /* Translators: there are three related actions: "use", "reuse" and "pause"; displayed in the 
hamburger menu at night */
-            section.append (_("Use night mode"), "app.set-use-night-mode(true)");
-    }
 }
 
 private const int LARGE_WINDOW_SIZE = 1042;
diff --git a/editor/base-headerbar.vala b/editor/base-headerbar.vala
index 8733b791..505161d8 100644
--- a/editor/base-headerbar.vala
+++ b/editor/base-headerbar.vala
@@ -96,7 +96,6 @@ private class BaseHeaderBar : NightTimeAwareHeaderBar, AdaptativeWidget
     private void append_app_actions_section (ref GLib.Menu menu)    // FIXME mnemonics?
     {
         GLib.Menu section = new GLib.Menu ();
-        append_or_not_night_mode_entry (ref section);
         append_or_not_keyboard_shortcuts_entry (has_keyboard_shortcuts, !has_a_phone_size, ref section);
         append_or_not_help_entry (has_help, ref section);
         append_about_entry (about_action_label, ref section);
diff --git a/editor/ca.desrt.dconf-editor.gschema.xml b/editor/ca.desrt.dconf-editor.gschema.xml
index 7f550a65..d5f6997c 100644
--- a/editor/ca.desrt.dconf-editor.gschema.xml
+++ b/editor/ca.desrt.dconf-editor.gschema.xml
@@ -83,13 +83,6 @@
 
 <schemalist gettext-domain='dconf-editor'>
   <schema id="ca.desrt.dconf-editor.Lib">
-    <key name="automatic-night-mode" type="b">
-      <default>false</default>
-      <!-- Translators: summary of a settings key, see 'dconf-editor /org/gnome/iagno/automatic-night-mode' 
-->
-      <summary>A flag to follow system night light</summary>
-      <!-- Translators: description of a settings key, see 'dconf-editor 
/org/gnome/iagno/automatic-night-mode' -->
-      <description>Use GNOME night light setting to activate night-mode.</description>
-    </key>
     <key name="window-width" type="i">
       <default>540</default>
       <!-- see AdaptativeWindow.width-request at data/ui/adaptative-window.ui:22 -->
diff --git a/editor/dconf-editor.vala b/editor/dconf-editor.vala
index fd0823bc..ca3ce162 100644
--- a/editor/dconf-editor.vala
+++ b/editor/dconf-editor.vala
@@ -171,7 +171,6 @@ private class ConfigurationEditor : Gtk.Application, BaseApplication
     private const GLib.ActionEntry [] action_entries =
     {
         // generic
-        { "set-use-night-mode", set_use_night_mode, "b" },
         { "copy", copy_cb, "s" },   // TODO is that really the good way to do things? (see Taquin)
 
         // quit
@@ -381,8 +380,6 @@ private class ConfigurationEditor : Gtk.Application, BaseApplication
                                                                      "<Primary>question",
                                                               "<Shift><Primary>question"}); // "<Primary>F1" 
is automatically done
 
-        init_night_mode ();
-
         Gtk.CssProvider css_provider = new Gtk.CssProvider ();
         css_provider.load_from_resource ("/ca/desrt/dconf-editor/ui/dconf-editor.css");
         Gdk.Screen? screen = Gdk.Screen.get_default ();
@@ -408,23 +405,6 @@ private class ConfigurationEditor : Gtk.Application, BaseApplication
             info (_("Looks like the DConf settings backend is used, all looks good."));
     } */
 
-    /*\
-    * * Night mode
-    \*/
-
-    NightLightMonitor night_light_monitor;  // keep it here or it is unrefed
-
-    private void init_night_mode ()
-    {
-        night_light_monitor = new NightLightMonitor ("/ca/desrt/dconf-editor/");
-    }
-
-    private void set_use_night_mode (SimpleAction action, Variant? gvariant)
-        requires (gvariant != null)
-    {
-        night_light_monitor.set_use_night_mode (((!) gvariant).get_boolean ());
-    }
-
     /*\
     * * Window activation
     \*/
@@ -567,7 +547,7 @@ private class ConfigurationEditor : Gtk.Application, BaseApplication
 
     private Gtk.Window get_new_window (string? schema, string? path, string? key_name)
     {
-        DConfWindow window = new DConfWindow (disable_warning, schema, path, key_name, night_light_monitor);
+        DConfWindow window = new DConfWindow (disable_warning, schema, path, key_name);
         add_window (window);
 
         return (Gtk.Window) window;
diff --git a/editor/dconf-headerbar.vala b/editor/dconf-headerbar.vala
index c5d29704..04d74a91 100644
--- a/editor/dconf-headerbar.vala
+++ b/editor/dconf-headerbar.vala
@@ -47,11 +47,10 @@ private class DConfHeaderBar : BookmarksHeaderBar, AdaptativeWidget
         register_modifications_mode ();
     }
 
-    internal static DConfHeaderBar (NightLightMonitor _night_light_monitor)
+    internal static DConfHeaderBar ()
     {
         /* Translators: usual menu entry of the hamburger menu */
         Object (about_action_label:     _("About Dconf Editor"),
-                night_light_monitor:    _night_light_monitor,
                 has_help:               false,
                 has_keyboard_shortcuts: true);
     }
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index b81751b7..1c28e0e8 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -41,11 +41,11 @@ private class DConfWindow : BookmarksWindow, AdaptativeWidget
     private DConfHeaderBar headerbar;
     private DConfView      main_view;
 
-    internal DConfWindow (bool disable_warning, string? schema, string? path, string? key_name, 
NightLightMonitor night_light_monitor)
+    internal DConfWindow (bool disable_warning, string? schema, string? path, string? key_name)
     {
         SettingsModel _model = new SettingsModel ();
         ModificationsHandler _modifications_handler = new ModificationsHandler (_model);
-        DConfHeaderBar _headerbar = new DConfHeaderBar (night_light_monitor);
+        DConfHeaderBar _headerbar = new DConfHeaderBar ();
         DConfView _main_view = new DConfView (_modifications_handler);
 
         Object (nta_headerbar               : (NightTimeAwareHeaderBar) _headerbar,
diff --git a/editor/meson.build b/editor/meson.build
index 219ead81..d2c5fdf4 100644
--- a/editor/meson.build
+++ b/editor/meson.build
@@ -95,7 +95,6 @@ sources = files(
   'modifications-handler.vala',
   'modifications-list.vala',
   'modifications-revealer.vala',
-  'night-light-monitor.vala',
   'notifications-revealer.vala',
   'overlayed-list.vala',
   'pathentry.vala',


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