[goffice] GOGradientSel: add tooltips.



commit 4dde1b43e9fcab3f3e84af6c66549639fc179208
Author: Morten Welinder <terra gnome org>
Date:   Fri Feb 20 22:23:36 2015 -0500

    GOGradientSel: add tooltips.

 ChangeLog                          |    5 ++++
 NEWS                               |    1 +
 goffice/gtk/go-gradient-selector.c |   45 +++++++++++++++++++++++++++++++++++-
 po/POTFILES.in                     |    1 +
 4 files changed, 51 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 8e95733..3ab3acf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-20  Morten Welinder  <terra gnome org>
+
+       * goffice/gtk/go-gradient-selector.c (go_gradient_tooltip_func):
+       New function.
+
 2015-02-17  Morten Welinder  <terra gnome org>
 
        * goffice/utils/go-style.c (go_style_set_font_desc): Doc fix.
diff --git a/NEWS b/NEWS
index d885858..5e70c31 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Morten:
        * Fix rendering of dotted lines.  [#744419]
        * Activate font part of graph theming.
        * Plug leaks.
+       * Add tooltips to gradient selector.
 
 --------------------------------------------------------------------------
 goffice 0.10.20:
diff --git a/goffice/gtk/go-gradient-selector.c b/goffice/gtk/go-gradient-selector.c
index 87b2cfe..f4adb2c 100644
--- a/goffice/gtk/go-gradient-selector.c
+++ b/goffice/gtk/go-gradient-selector.c
@@ -21,6 +21,7 @@
 
 #include <goffice/goffice-config.h>
 #include <goffice/goffice.h>
+#include <glib/gi18n-lib.h>
 
 typedef struct {
        GOColor start_color;
@@ -84,6 +85,47 @@ go_gradient_swatch_render_func (cairo_t *cr,
        cairo_pattern_destroy (cr_pattern);
 }
 
+static const char *
+go_gradient_tooltip_func (int index, gpointer data)
+{
+       switch ((GOGradientDirection)index) {
+       case GO_GRADIENT_N_TO_S:
+               return _("Up");
+       case GO_GRADIENT_S_TO_N:
+               return _("Down");
+       case GO_GRADIENT_N_TO_S_MIRRORED:
+               return _("Vertical from middle");
+       case GO_GRADIENT_S_TO_N_MIRRORED:
+               return _("Vertical from middle");
+       case GO_GRADIENT_W_TO_E:
+               return _("Left");
+       case GO_GRADIENT_E_TO_W:
+               return _("Right");
+       case GO_GRADIENT_W_TO_E_MIRRORED:
+               return _("Horizontal from middle");
+       case GO_GRADIENT_E_TO_W_MIRRORED:
+               return _("Horizontal to middle");
+       case GO_GRADIENT_NW_TO_SE:
+               return _("Up and left");
+       case GO_GRADIENT_SE_TO_NW:
+               return _("Down and right");
+       case GO_GRADIENT_NW_TO_SE_MIRRORED:
+               return _("Diagonal from middle");
+       case GO_GRADIENT_SE_TO_NW_MIRRORED:
+               return _("Diagonal from middle");
+       case GO_GRADIENT_NE_TO_SW:
+               return _("Up and right");
+       case GO_GRADIENT_SW_TO_NE:
+               return _("Down and left");
+       case GO_GRADIENT_SW_TO_NE_MIRRORED:
+               return _("Reverse diagonal from middle");
+       case GO_GRADIENT_NE_TO_SW_MIRRORED:
+               return _("Reverse diagonal to middle");
+       default:
+               return NULL;
+       }
+}
+
 /**
  * go_selector_new_gradient:
  * @initial_direction: initially selected direction
@@ -107,7 +149,8 @@ go_selector_new_gradient (GOGradientDirection initial_direction,
        state->stop_color = GO_COLOR_WHITE;
 
        palette = go_palette_new (GO_GRADIENT_MAX, 1.0, 4,
-                                 go_gradient_swatch_render_func, NULL,
+                                 go_gradient_swatch_render_func,
+                                 go_gradient_tooltip_func,
                                  state, g_free);
        go_palette_show_automatic (GO_PALETTE (palette),
                                   CLAMP (default_direction, 0, GO_GRADIENT_MAX -1),
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 2c5d991..c95cafc 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -102,6 +102,7 @@ goffice/gtk/go-font-sel-dialog.c
 [type: gettext/glade]goffice/gtk/go-font-sel.ui
 goffice/gtk/go-format-sel.c
 [type: gettext/glade]goffice/gtk/go-format-sel.ui
+goffice/gtk/go-gradient-sel.c
 [type: gettext/glade]goffice/gtk/go-image-save-dialog-extra.ui
 goffice/gtk/go-image-sel.c
 [type: gettext/glade]goffice/gtk/go-image-sel.ui


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