[shotwell/wip/phako/dark: 6/16] wip: Remove custom background color handling



commit 93ac6d37508d73ce71cfc9d1858a9daa7f265815
Author: Jens Georg <mail+gitkraken jensge org>
Date:   Sun Apr 1 10:49:50 2018 +0200

    wip: Remove custom background color handling

 src/CheckerboardLayout.vala |   23 +++++++++--------------
 src/main.vala               |    1 +
 2 files changed, 10 insertions(+), 14 deletions(-)
---
diff --git a/src/CheckerboardLayout.vala b/src/CheckerboardLayout.vala
index 82f301f..bd1d3a1 100644
--- a/src/CheckerboardLayout.vala
+++ b/src/CheckerboardLayout.vala
@@ -501,6 +501,7 @@ public abstract class CheckerboardItem : ThumbnailView {
 
     protected virtual void paint_shadow(Cairo.Context ctx, Dimensions dimensions, Gdk.Point origin, 
         int radius, float initial_alpha) { 
+        #if 0
         double rgb_all = 0.0;
         
         // top right corner
@@ -531,6 +532,7 @@ public abstract class CheckerboardItem : ThumbnailView {
         ctx.rectangle(origin.x + dimensions.width, origin.y + radius, 
             radius, dimensions.height - radius);
         ctx.fill();
+        #endif
     }
 
     protected void paint_shadow_in_corner(Cairo.Context ctx, int x, int y, 
@@ -871,6 +873,7 @@ public class CheckerboardLayout : Gtk.DrawingArea {
     private bool reflow_needed = false;
     
     public CheckerboardLayout(ViewCollection view) {
+        this.get_style_context().add_class("content-view");
         this.view = view;
         
         clear_drag_select();
@@ -885,9 +888,6 @@ public class CheckerboardLayout : Gtk.DrawingArea {
         view.geometries_altered.connect(on_geometries_altered);
         view.items_selected.connect(on_items_selection_changed);
         view.items_unselected.connect(on_items_selection_changed);
-        
-
-        Config.Facade.get_instance().colors_changed.connect(on_colors_changed);
 
         // CheckerboardItems offer tooltips
         has_tooltip = true;
@@ -916,8 +916,6 @@ public class CheckerboardLayout : Gtk.DrawingArea {
         
         if (parent != null)
             parent.size_allocate.disconnect(on_viewport_resized);
-
-        Config.Facade.get_instance().colors_changed.disconnect(on_colors_changed);
     }
     
     public void set_adjustments(Gtk.Adjustment hadjustment, Gtk.Adjustment vadjustment) {
@@ -1903,10 +1901,13 @@ public class CheckerboardLayout : Gtk.DrawingArea {
 
     private void set_colors(bool in_focus = true) {
         // set up selected/unselected colors
-        selected_color = Config.Facade.get_instance().get_selected_color(in_focus);
-        unselected_color =  Config.Facade.get_instance().get_unselected_color();
+        var val = get_style_context().get_property("border-color", Gtk.StateFlags.SELECTED); 
//Config.Facade.get_instance().get_unselected_color();
+        selected_color = *(Gdk.RGBA*)val.get_boxed();
+        Config.Facade.get_instance().get_selected_color(in_focus);
+        val = get_style_context().get_property("color", Gtk.StateFlags.NORMAL); 
//Config.Facade.get_instance().get_unselected_color();
+
+        unselected_color = *(Gdk.RGBA*)val.get_boxed();
         border_color =  Config.Facade.get_instance().get_border_color();
-        bg_color = Config.Facade.get_instance().get_bg_color();
     }
     
     public override void size_allocate(Gtk.Allocation allocation) {
@@ -2000,12 +2001,6 @@ public class CheckerboardLayout : Gtk.DrawingArea {
         return (item != null) ? item.query_tooltip(x, y, tooltip) : false;
     }
     
-    private void on_colors_changed() {
-        invalidate_transparent_background();
-        queue_draw();
-        set_colors();
-    }
-
     public override bool focus_in_event(Gdk.EventFocus event) {
         set_colors(true);
         items_dirty("focus_in_event", view.get_selected());
diff --git a/src/main.vala b/src/main.vala
index 1dda0cb..7ad6f73 100644
--- a/src/main.vala
+++ b/src/main.vala
@@ -355,6 +355,7 @@ void main(string[] args) {
     try {
         Gtk.init_with_args(ref args, _("[FILE]"), CommandlineOptions.get_options(),
             Resources.APP_GETTEXT_PACKAGE);
+        //Gtk.Settings.get_default().gtk_application_prefer_dark_theme = true;
     } catch (Error e) {
         print(e.message + "\n");
         print(_("Run “%s --help” to see a full list of available command line options.\n"), args[0]);


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