[gnome-commander] Changes style colors if desktop env theme should be respected, fixes bgo#398734



commit 92904e0641f0c2babf79df23979b152c5143d6ab
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Sat Oct 22 00:10:07 2016 +0200

    Changes style colors if desktop env theme should be respected, fixes bgo#398734

 src/gnome-cmd-style.cc |   75 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 75 insertions(+), 0 deletions(-)
---
diff --git a/src/gnome-cmd-style.cc b/src/gnome-cmd-style.cc
index d7b77b5..0890052 100644
--- a/src/gnome-cmd-style.cc
+++ b/src/gnome-cmd-style.cc
@@ -62,6 +62,22 @@ inline GtkStyle *create_list_style (GnomeCmdColorTheme *cols, const gchar *font_
         style->base[GTK_STATE_NORMAL] = *cols->norm_bg;
         style->base[GTK_STATE_ACTIVE] = *cols->norm_bg;
     }
+    else
+    {
+        GtkWidget *widget = gtk_combo_new ();
+        GtkStyle *default_style = gtk_rc_get_style(widget);
+        gtk_widget_destroy (widget);
+
+        if(default_style)
+        {
+            gtk_style_lookup_color (default_style, "tooltip_fg_color", &style->fg[GTK_STATE_SELECTED]);
+            gtk_style_lookup_color (default_style, "fg_color", &style->fg[GTK_STATE_NORMAL]);
+            gtk_style_lookup_color (default_style, "fg_color", &style->text[GTK_STATE_NORMAL]);
+            gtk_style_lookup_color (default_style, "tooltip_bg_color", &style->bg[GTK_STATE_SELECTED]);
+            gtk_style_lookup_color (default_style, "bg_color", &style->base[GTK_STATE_NORMAL]);
+            gtk_style_lookup_color (default_style, "bg_color", &style->base[GTK_STATE_ACTIVE]);
+        }
+    }
 
     return style;
 }
@@ -93,6 +109,22 @@ inline GtkStyle *create_alt_list_style (GnomeCmdColorTheme *cols, const gchar *f
         style->base[GTK_STATE_NORMAL] = *cols->alt_bg;
         style->base[GTK_STATE_ACTIVE] = *cols->alt_bg;
     }
+    else
+    {
+        GtkWidget *widget = gtk_combo_new ();
+        GtkStyle *default_style = gtk_rc_get_style(widget);
+        gtk_widget_destroy (widget);
+
+        if(default_style)
+        {
+            gtk_style_lookup_color (default_style, "tooltip_fg_color", &style->fg[GTK_STATE_SELECTED]);
+            gtk_style_lookup_color (default_style, "selected_bg_color", &style->fg[GTK_STATE_NORMAL]);
+            gtk_style_lookup_color (default_style, "selected_bg_color", &style->text[GTK_STATE_NORMAL]);
+            gtk_style_lookup_color (default_style, "tooltip_bg_color", &style->bg[GTK_STATE_SELECTED]);
+            gtk_style_lookup_color (default_style, "selected_fg_color", &style->base[GTK_STATE_NORMAL]);
+            gtk_style_lookup_color (default_style, "selected_fg_color", &style->base[GTK_STATE_ACTIVE]);
+        }
+    }
 
     return style;
 }
@@ -125,6 +157,28 @@ inline GtkStyle *create_sel_list_style (GnomeCmdColorTheme *cols, const gchar *f
         style->base[GTK_STATE_NORMAL] = *cols->sel_bg;
         style->base[GTK_STATE_ACTIVE] = *cols->sel_bg;
     }
+    else
+    {
+        GtkWidget *widget = gtk_combo_new ();
+        GtkStyle *default_style = gtk_rc_get_style(widget);
+        gtk_widget_destroy (widget);
+
+        if(default_style)
+        {
+            gtk_style_lookup_color (default_style, "selected_fg_color", &style->fg[GTK_STATE_SELECTED]);
+            if (!gtk_style_lookup_color (default_style, "selected_fg_color", &style->fg[GTK_STATE_NORMAL]))
+                gdk_color_parse("#ffffff", &style->fg[GTK_STATE_NORMAL]);
+            gtk_style_lookup_color (default_style, "text_color", &style->text[GTK_STATE_NORMAL]);
+            gtk_style_lookup_color (default_style, "bg_color", &style->bg[GTK_STATE_SELECTED]);
+            if(!gtk_style_lookup_color (default_style, "selected_bg_color", &style->bg[GTK_STATE_NORMAL]))
+                gdk_color_parse("#000000", &style->bg[GTK_STATE_NORMAL]);
+            if(!gtk_style_lookup_color (default_style, "selected_bg_color", &style->base[GTK_STATE_NORMAL]))
+                gdk_color_parse("#000000", &style->base[GTK_STATE_NORMAL]);
+            if(!gtk_style_lookup_color (default_style, "selected_bg_color", &style->base[GTK_STATE_ACTIVE]))
+                gdk_color_parse("#000000", &style->base[GTK_STATE_ACTIVE]);
+        }
+    }
+
 
     return style;
 }
@@ -157,6 +211,27 @@ inline GtkStyle *create_alt_sel_list_style (GnomeCmdColorTheme *cols, const gcha
         style->base[GTK_STATE_NORMAL] = *cols->sel_bg;
         style->base[GTK_STATE_ACTIVE] = *cols->sel_bg;
     }
+    else
+    {
+        GtkWidget *widget = gtk_combo_new ();
+        GtkStyle *default_style = gtk_rc_get_style(widget);
+        gtk_widget_destroy (widget);
+
+        if(default_style)
+        {
+            gtk_style_lookup_color (default_style, "selected_fg_color", &style->fg[GTK_STATE_SELECTED]);
+            if (!gtk_style_lookup_color (default_style, "selected_fg_color", &style->fg[GTK_STATE_NORMAL]))
+                gdk_color_parse("#ffffff", &style->fg[GTK_STATE_NORMAL]);
+            gtk_style_lookup_color (default_style, "text_color", &style->text[GTK_STATE_NORMAL]);
+            gtk_style_lookup_color (default_style, "bg_color", &style->bg[GTK_STATE_SELECTED]);
+            if(!gtk_style_lookup_color (default_style, "selected_bg_color", &style->bg[GTK_STATE_NORMAL]))
+                gdk_color_parse("#000000", &style->bg[GTK_STATE_NORMAL]);
+            if(!gtk_style_lookup_color (default_style, "selected_bg_color", &style->base[GTK_STATE_NORMAL]))
+                gdk_color_parse("#000000", &style->base[GTK_STATE_NORMAL]);
+            if(!gtk_style_lookup_color (default_style, "selected_bg_color", &style->base[GTK_STATE_ACTIVE]))
+                gdk_color_parse("#000000", &style->base[GTK_STATE_ACTIVE]);
+        }
+    }
 
     return style;
 }


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