[gnumeric] GUI: Style the stf fixed-width ruler.



commit b2db10af0e38c6423f0b1e1aba9b30f0e7f871cb
Author: Morten Welinder <terra gnome org>
Date:   Thu Apr 25 20:23:43 2013 -0400

    GUI: Style the stf fixed-width ruler.

 src/dialogs/ChangeLog               |    7 +++++++
 src/dialogs/dialog-stf-fixed-page.c |   11 ++++++++++-
 src/dialogs/dialog-stf.c            |    2 ++
 src/gnumeric.css                    |    8 ++++++++
 4 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index d8764dc..d73f300 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,3 +1,10 @@
+2013-04-25  Morten Welinder  <terra gnome org>
+
+       * dialog-stf.c (stf_dialog): Name the dialog.
+
+       * dialog-stf-fixed-page.c (cb_treeview_draw): Get the color from
+       css.
+
 2013-04-24  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * mean-tests.ui: change dialog title
diff --git a/src/dialogs/dialog-stf-fixed-page.c b/src/dialogs/dialog-stf-fixed-page.c
index d365007..b9445c2 100644
--- a/src/dialogs/dialog-stf-fixed-page.c
+++ b/src/dialogs/dialog-stf-fixed-page.c
@@ -555,6 +555,8 @@ cb_treeview_draw (GtkWidget *widget,
        int height;
        GtkAllocation a;
        GdkWindow *bin_window;
+       GdkRGBA ruler_color;
+       GtkStyleContext *context;
 
        if (ruler_x < 0)
                return FALSE;
@@ -566,10 +568,17 @@ cb_treeview_draw (GtkWidget *widget,
        gtk_widget_get_allocation (widget, &a);
        height = a.height;
 
+       context = gtk_widget_get_style_context (GTK_WIDGET (pagedata->dialog));
+       gtk_style_context_save (context);
+       gtk_style_context_add_region (context, "fixed-format-ruler", 0);
+       gtk_style_context_get_color (context, GTK_STATE_FLAG_NORMAL,
+                                    &ruler_color);
+       gtk_style_context_restore (context);
+
        cairo_save (cr);
        cairo_rectangle (cr, ruler_x, 0, ruler_x + 1, height);
        cairo_clip (cr);
-       cairo_set_source_rgb (cr, 1.0, 0, 0);
+       gdk_cairo_set_source_rgba (cr, &ruler_color);
        cairo_move_to (cr, ruler_x, 0);
        cairo_line_to (cr, ruler_x, height);
        cairo_stroke (cr);
diff --git a/src/dialogs/dialog-stf.c b/src/dialogs/dialog-stf.c
index dc51d11..30f5e56 100644
--- a/src/dialogs/dialog-stf.c
+++ b/src/dialogs/dialog-stf.c
@@ -289,6 +289,8 @@ stf_dialog (WBCGtk *wbcg,
        pagedata.finish_button    = go_gtk_builder_get_widget (gui, "finish_button");
        pagedata.parseoptions = NULL;
 
+       gtk_widget_set_name (GTK_WIDGET (pagedata.dialog), "stf-import");
+
        stf_dialog_main_page_init   (gui, &pagedata);
        stf_dialog_csv_page_init    (gui, &pagedata);
        stf_dialog_fixed_page_init  (gui, &pagedata);
diff --git a/src/gnumeric.css b/src/gnumeric.css
index f332696..c37b167 100644
--- a/src/gnumeric.css
+++ b/src/gnumeric.css
@@ -218,3 +218,11 @@ GtkDialog GtkTextView.function-help {
 }
 
 /* ------------------------------------------------------------------------- */
+/* This is the vertical line used in the fixed-width part of the stf */
+/* import dialog to show where a new column division will be placed */
+
+GtkDialog#stf-import fixed-format-ruler {
+  color: red;
+}
+
+/* ------------------------------------------------------------------------- */


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