[goffice] GOPatternSel: add tooptips.



commit f7dbcfda4f90ecdbcac3c542ca9d8a1183bd0ebb
Author: Morten Welinder <terra gnome org>
Date:   Fri Feb 20 22:31:45 2015 -0500

    GOPatternSel: add tooptips.

 ChangeLog                         |    3 +++
 NEWS                              |    1 +
 goffice/gtk/go-pattern-selector.c |   36 +++++++++++++++++++++++++++++++++++-
 po/POTFILES.in                    |    1 +
 4 files changed, 40 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3ab3acf..2149586 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2015-02-20  Morten Welinder  <terra gnome org>
 
+       * goffice/gtk/go-pattern-selector.c (go_pattern_tooltip_func): New
+       function.
+
        * goffice/gtk/go-gradient-selector.c (go_gradient_tooltip_func):
        New function.
 
diff --git a/NEWS b/NEWS
index 5e70c31..56dbf2b 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Morten:
        * Activate font part of graph theming.
        * Plug leaks.
        * Add tooltips to gradient selector.
+       * Add tooltips to pattern selector.
 
 --------------------------------------------------------------------------
 goffice 0.10.20:
diff --git a/goffice/gtk/go-pattern-selector.c b/goffice/gtk/go-pattern-selector.c
index d3c4278..96ce443 100644
--- a/goffice/gtk/go-pattern-selector.c
+++ b/goffice/gtk/go-pattern-selector.c
@@ -21,6 +21,7 @@
 
 #include <goffice/goffice-config.h>
 #include <goffice/goffice.h>
+#include <glib/gi18n-lib.h>
 
 typedef struct {
        GOColor foreground;
@@ -58,6 +59,38 @@ go_pattern_palette_render_func (cairo_t *cr,
        cairo_pattern_destroy (cr_pattern);
 }
 
+static const char *
+go_pattern_tooltip_func (int index, gpointer data)
+{
+       switch ((GOPatternType)index) {
+       case GO_PATTERN_SOLID: return _("Solid background");
+       case GO_PATTERN_GREY75: return _("75% background");
+       case GO_PATTERN_GREY50: return _("50% background");
+       case GO_PATTERN_GREY25: return _("25% background");
+       case GO_PATTERN_GREY125: return _("12.5% background");
+       case GO_PATTERN_GREY625: return _("6.25% background");
+       case GO_PATTERN_HORIZ: return _("Horizontal stripes");
+       case GO_PATTERN_VERT: return _("Vertical stripes");
+       case GO_PATTERN_REV_DIAG: return _("Reverse diagonal stripes");
+       case GO_PATTERN_DIAG: return _("Diagonal stripes");
+       case GO_PATTERN_DIAG_CROSS: return _("Diagonal crosshatch");
+       case GO_PATTERN_THICK_DIAG_CROSS: return _("Thick diagonal crosshatch");
+       case GO_PATTERN_THIN_HORIZ: return _("Thin horizontal stripes");
+       case GO_PATTERN_THIN_VERT: return _("Thin vertical stripes");
+       case GO_PATTERN_THIN_REV_DIAG: return _("Thin reverse diagonal stripes");
+       case GO_PATTERN_THIN_DIAG: return _("Thin diagonal stripes");
+       case GO_PATTERN_THIN_HORIZ_CROSS: return _("Thin horizontal crosshatch");
+       case GO_PATTERN_THIN_DIAG_CROSS: return _("Thin diagonal crosshatch");
+       case GO_PATTERN_FOREGROUND_SOLID: return _("Solid foreground");
+       case GO_PATTERN_SMALL_CIRCLES: return _("Small circles");
+       case GO_PATTERN_SEMI_CIRCLES: return _("Semi-circles");
+       case GO_PATTERN_THATCH: return _("Thatch");
+       case GO_PATTERN_LARGE_CIRCLES: return _("Large circles");
+       case GO_PATTERN_BRICKS: return _("Bricks");
+       default: return NULL;
+       }
+}
+
 /**
  * go_pattern_selector_new:
  * @initial_type: pattern type initially selected
@@ -80,7 +113,8 @@ go_pattern_selector_new (GOPatternType initial_type,
        state->background = GO_COLOR_BLACK;
 
        palette = go_palette_new (GO_PATTERN_MAX, 1.0, 5,
-                                 go_pattern_palette_render_func, NULL,
+                                 go_pattern_palette_render_func,
+                                 go_pattern_tooltip_func,
                                  state, g_free);
        go_palette_show_automatic (GO_PALETTE (palette),
                                   CLAMP (default_type, 0, GO_PATTERN_MAX - 1),
diff --git a/po/POTFILES.in b/po/POTFILES.in
index c95cafc..3524e13 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -109,6 +109,7 @@ goffice/gtk/go-image-sel.c
 goffice/gtk/go-locale-sel.c
 goffice/gtk/go-optionmenu.c
 goffice/gtk/go-palette.c
+goffice/gtk/go-pattern-sel.c
 goffice/gtk/go-rotation-sel.c
 [type: gettext/glade]goffice/gtk/go-rotation-sel.ui
 goffice/gtk/go-math-editor.c


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