[gnumeric] GUI: Theme auto filters too.



commit 2961a1034161e09e549721e9af01cef80c769d99
Author: Morten Welinder <terra gnome org>
Date:   Fri Mar 29 19:35:49 2013 -0400

    GUI: Theme auto filters too.

 NEWS                                |    1 +
 plugins/excel/ms-excel-read.c       |   28 ++++++++++++++--------------
 src/dialogs/dialog-scenarios.c      |   11 +++++++----
 src/dialogs/wbcg.ui                 |   13 -------------
 src/gnumeric.css                    |   11 +++++++++++
 src/style-color.c                   |    8 --------
 src/style-color.h                   |    8 --------
 src/wbc-gtk.c                       |    3 +++
 src/widgets/gnm-filter-combo-view.c |    8 ++++++--
 9 files changed, 42 insertions(+), 49 deletions(-)
---
diff --git a/NEWS b/NEWS
index bc0d4e4..36d4629 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Morten:
        * Introspection improvements.
        * Fix drawing of the select-all button.
        * Fix getting the detachable-toolbars setting.
+       * Style most of Gnumeric using css.
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.1
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index 7f9cec4..f935c85 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -1847,24 +1847,24 @@ excel_palette_get (GnmXLImporter *importer, gint idx)
                return style_color_white ();
        switch (idx) {
        case 0:   /* black */
-       case 64 : /* system text ? */
-       case 81 : /* tooltip text */
-       case 0x7fff : /* system text ? */
+       case 64: /* system text ? */
+       case 81: /* tooltip text */
+       case 0x7fff: /* system text ? */
                return style_color_black ();
-       case 1 :  /* white */
-       case 65 : /* system back ? */
+       case 1:  /* white */
+       case 65: /* system back ? */
                return style_color_white ();
 
-       case 80 : /* tooltip background */
-               return gnm_color_new_gdk (&gs_yellow);
+       case 80: /* tooltip background */
+               return gnm_color_new_rgb8 (0xff, 0xff, 0xe0);
 
-       case 2 : return gnm_color_new_rgb8 (0xff,    0,    0); /* red */
-       case 3 : return gnm_color_new_rgb8 (   0, 0xff,    0); /* green */
-       case 4 : return gnm_color_new_rgb8 (   0,    0, 0xff); /* blue */
-       case 5 : return gnm_color_new_rgb8 (0xff, 0xff,    0); /* yellow */
-       case 6 : return gnm_color_new_rgb8 (0xff,    0, 0xff); /* magenta */
-       case 7 : return gnm_color_new_rgb8 (   0, 0xff, 0xff); /* cyan */
-       default :
+       case 2: return gnm_color_new_rgb8 (0xff,    0,    0); /* red */
+       case 3: return gnm_color_new_rgb8 (   0, 0xff,    0); /* green */
+       case 4: return gnm_color_new_rgb8 (   0,    0, 0xff); /* blue */
+       case 5: return gnm_color_new_rgb8 (0xff, 0xff,    0); /* yellow */
+       case 6: return gnm_color_new_rgb8 (0xff,    0, 0xff); /* magenta */
+       case 7: return gnm_color_new_rgb8 (   0, 0xff, 0xff); /* cyan */
+       default:
                break;
        }
 
diff --git a/src/dialogs/dialog-scenarios.c b/src/dialogs/dialog-scenarios.c
index c688901..3117506 100644
--- a/src/dialogs/dialog-scenarios.c
+++ b/src/dialogs/dialog-scenarios.c
@@ -45,6 +45,9 @@
 #include <goffice/goffice.h>
 #include <string.h>
 
+#define DARK_GRAY  GO_COLOR_GREY(51)    /* "gray20" */
+#define LIGHT_GRAY GO_COLOR_GREY(199)   /* "gray78" */
+
 typedef struct {
        GenericToolState base;
 
@@ -133,7 +136,7 @@ summary_cb (int col, int row, GnmValue *v, summary_cb_t *p)
                dao_set_colors (&p->dao, 2 + p->col, 3 + *index,
                                2 + p->col, 3 + *index,
                                gnm_color_new_go (GO_COLOR_BLACK),
-                               gnm_color_new_gdk (&gs_light_gray));
+                               gnm_color_new_go (LIGHT_GRAY));
 
        } else {
                /* New cell. */
@@ -156,7 +159,7 @@ summary_cb (int col, int row, GnmValue *v, summary_cb_t *p)
                dao_set_colors (&p->dao, 2 + p->col, 3 + p->row,
                                2 + p->col, 3 + p->row,
                                gnm_color_new_go (GO_COLOR_BLACK),
-                               gnm_color_new_gdk (&gs_light_gray));
+                               gnm_color_new_go (LIGHT_GRAY));
 
                /* Insert row number into the hash table. */
                r  = g_new (int, 1);
@@ -228,10 +231,10 @@ scenario_summary (WorkbookControl *wbc,
 
        dao_set_colors (&cb.dao, 0, 0, cb.col + 1, 1,
                        gnm_color_new_go (GO_COLOR_WHITE),
-                       gnm_color_new_gdk (&gs_dark_gray));
+                       gnm_color_new_go (DARK_GRAY));
        dao_set_colors (&cb.dao, 0, 2, 0, 2 + cb.row,
                        gnm_color_new_go (GO_COLOR_BLACK),
-                       gnm_color_new_gdk (&gs_light_gray));
+                       gnm_color_new_go (LIGHT_GRAY));
 
        dao_set_align (&cb.dao, 1, 1, cb.col + 1, 1, GNM_HALIGN_RIGHT,
                       GNM_VALIGN_BOTTOM);
diff --git a/src/dialogs/wbcg.ui b/src/dialogs/wbcg.ui
index cd4a19d..d6b17d5 100644
--- a/src/dialogs/wbcg.ui
+++ b/src/dialogs/wbcg.ui
@@ -73,10 +73,8 @@
                     <property name="show_arrow">False</property>
                     <child>
                       <object class="GtkToolItem" id="selection_descriptor_item">
-                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
                         <child>
                           <object class="GtkEntry" id="selection_descriptor">
                             <property name="visible">True</property>
@@ -91,11 +89,9 @@
                     </child>
                     <child>
                       <object class="GtkToolButton" id="cancel_button">
-                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="tooltip_text" translatable="yes">Cancel change</property>
-                        <property name="use_action_appearance">False</property>
                         <property name="use_underline">True</property>
                         <property name="stock_id">gtk-cancel</property>
                       </object>
@@ -106,12 +102,10 @@
                     </child>
                     <child>
                       <object class="GtkMenuToolButton" id="ok_button">
-                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="sensitive">False</property>
                         <property name="can_focus">False</property>
                         <property name="tooltip_text" translatable="yes">Accept change</property>
-                        <property name="use_action_appearance">False</property>
                         <property name="use_underline">True</property>
                         <property name="stock_id">gtk-ok</property>
                       </object>
@@ -121,11 +115,9 @@
                     </child>
                     <child>
                       <object class="GtkToolButton" id="func_button">
-                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="tooltip_text" translatable="yes">Enter formula...</property>
-                        <property name="use_action_appearance">False</property>
                         <property name="use_underline">True</property>
                         <property name="stock_id">Gnumeric_Equal</property>
                       </object>
@@ -136,10 +128,8 @@
                     </child>
                     <child>
                       <object class="GtkToolButton" id="debug_button">
-                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
                         <property name="visible_vertical">False</property>
                         <property name="use_underline">True</property>
                         <property name="stock_id">gtk-info</property>
@@ -151,10 +141,8 @@
                     </child>
                     <child>
                       <object class="GtkToolItem" id="edit_line_entry_item">
-                        <property name="use_action_appearance">False</property>
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="use_action_appearance">False</property>
                         <child>
                           <placeholder/>
                         </child>
@@ -256,7 +244,6 @@
                   <object class="GtkLabel" id="bnotebook_placeholder">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">label</property>
                   </object>
                   <packing>
                     <property name="resize">False</property>
diff --git a/src/gnumeric.css b/src/gnumeric.css
index fdcfce9..d94ec26 100644
--- a/src/gnumeric.css
+++ b/src/gnumeric.css
@@ -184,3 +184,14 @@ GocItem.object-size.rubber-band {
 }
 
 /* ------------------------------------------------------------------------- */
+/* Auto filter in two versions: the first one for "all", second for others.  */
+
+GtkArrow.auto-filter {
+  color: black;
+}
+
+GtkArrow.auto-filter:active {
+  color: yellow;
+}
+
+/* ------------------------------------------------------------------------- */
diff --git a/src/style-color.c b/src/style-color.c
index 0b4f920..0821173 100644
--- a/src/style-color.c
+++ b/src/style-color.c
@@ -12,14 +12,6 @@
 #include "style-border.h"
 #include <gtk/gtk.h>
 
-/* Public _unallocated_ colours, i.e., no valid .pixel.  */
-GdkRGBA gs_black      = { 0, 0, 0, 1 };    /* "Black" */
-GdkRGBA gs_white      = { 1, 1, 1, 1 };    /* "White" */
-GdkRGBA gs_yellow     = { 1, 1, .88, 1 };    /* "LightYellow" */
-GdkRGBA gs_lavender   = { .9, .9, .98, 1 };    /* "lavender" */
-GdkRGBA gs_dark_gray  = { .2, .2, .2, 1 };    /* "gray20" */
-GdkRGBA gs_light_gray = { .78, .78, .78, 1 };    /* "gray78" */
-
 static GHashTable *style_color_hash;
 static GnmColor *sc_black;
 static GnmColor *sc_white;
diff --git a/src/style-color.h b/src/style-color.h
index e291400..561c714 100644
--- a/src/style-color.h
+++ b/src/style-color.h
@@ -18,14 +18,6 @@ struct _GnmColor {
        gboolean is_auto;
 };
 
-/* Colors used by any GnumericSheet item */
-GNM_VAR_DECL GdkRGBA gs_white;
-GNM_VAR_DECL GdkRGBA gs_light_gray;
-GNM_VAR_DECL GdkRGBA gs_dark_gray;
-GNM_VAR_DECL GdkRGBA gs_black;
-GNM_VAR_DECL GdkRGBA gs_lavender;
-GNM_VAR_DECL GdkRGBA gs_yellow;
-
 GType     gnm_color_get_type    (void);
 GnmColor *gnm_color_new_go    (GOColor c);
 GnmColor *gnm_color_new_name  (char const *name);
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 8364a59..185366f 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -1332,6 +1332,9 @@ cb_darken_foreground_attributes (PangoAttribute *attribute,
        return FALSE;
 }
 
+/* FIXME: This needs theming support.  It needs to know how close
+   colors are to the themed background and push the colors that are
+   too close away (along the light axis, presumably).  */
 static void
 darken_foreground_attributes (PangoAttrList *attrs)
 {
diff --git a/src/widgets/gnm-filter-combo-view.c b/src/widgets/gnm-filter-combo-view.c
index 049fa31..5a17997 100644
--- a/src/widgets/gnm-filter-combo-view.c
+++ b/src/widgets/gnm-filter-combo-view.c
@@ -302,8 +302,10 @@ fcombo_arrow_format (GnmFilterCombo *fcombo, GtkWidget *arrow)
        gtk_arrow_set (GTK_ARROW (arrow),
                fcombo->cond != NULL ? GTK_ARROW_RIGHT : GTK_ARROW_DOWN,
                GTK_SHADOW_IN);
-       gtk_widget_override_color (arrow, GTK_STATE_FLAG_NORMAL,
-               fcombo->cond != NULL ? &gs_yellow : &gs_black);
+       if (fcombo->cond)
+               gtk_widget_set_state_flags (arrow, GTK_STATE_FLAG_ACTIVE, FALSE);
+       else 
+               gtk_widget_unset_state_flags (arrow, GTK_STATE_FLAG_ACTIVE);
 }
 
 static GtkWidget *
@@ -311,6 +313,8 @@ fcombo_create_arrow (SheetObject *so)
 {
        GnmFilterCombo *fcombo = GNM_FILTER_COMBO (so);
        GtkWidget *arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_IN);
+       gtk_style_context_add_class (gtk_widget_get_style_context (arrow),
+                                    "auto-filter");
        fcombo_arrow_format (fcombo, arrow);
        g_signal_connect_object (G_OBJECT (so),
                "cond-changed",


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