[gnome-documents/gnome-3-16] preview: Implement dark-mode in the content



commit 86c8e29ad503afe0cfe0f76180f203f7821ab033
Author: Alessandro Bono <shadow openaliasbox org>
Date:   Thu Apr 9 22:18:44 2015 +0200

    preview: Implement dark-mode in the content
    
    https://bugzilla.gnome.org/show_bug.cgi?id=747132

 src/preview.js |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/preview.js b/src/preview.js
index 393a067..6b5bb54 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -139,6 +139,9 @@ const PreviewView = new Lang.Class({
         let showPlaces = Application.application.lookup_action('places');
         let showPlacesId = showPlaces.connect('activate', Lang.bind(this, this._showPlaces));
 
+        let nightModeId = Application.application.connect('action-state-changed::night-mode',
+            Lang.bind(this, this._updateNightMode));
+
         this._togglePresentation = Application.application.lookup_action('present-current');
         let presentCurrentId = Application.application.connect('action-state-changed::present-current',
             Lang.bind(this, this._onPresentStateChanged));
@@ -160,6 +163,7 @@ const PreviewView = new Lang.Class({
                 rotRight.disconnect(rotRightId);
                 showPlaces.disconnect(showPlacesId);
                 Application.application.disconnect(presentCurrentId);
+                Application.application.disconnect(nightModeId);
             }));
     },
 
@@ -559,6 +563,15 @@ const PreviewView = new Lang.Class({
             this._showPlaces.enabled = hasMultiplePages;
 
             this._model.connect('page-changed', Lang.bind(this, this._onPageChanged));
+
+            this._updateNightMode();
+        }
+    },
+
+    _updateNightMode: function() {
+        if (this._model) {
+            let nightMode = Application.settings.get_boolean('night-mode');
+            this._model.set_inverted_colors(nightMode);
         }
     },
 


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