[gnumeric] GUI: Improve tooltip.



commit 27e41887864e971769ba2b0025583495e0f5daf9
Author: Morten Welinder <terra gnome org>
Date:   Wed Jun 16 13:44:45 2010 -0400

    GUI: Improve tooltip.

 src/widgets/ChangeLog             |    5 ++++
 src/widgets/gnumeric-expr-entry.c |   38 +++++++++++++++++++++++++++---------
 2 files changed, 33 insertions(+), 10 deletions(-)
---
diff --git a/src/widgets/ChangeLog b/src/widgets/ChangeLog
index 721ffeb..2762ff7 100644
--- a/src/widgets/ChangeLog
+++ b/src/widgets/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-16  Morten Welinder  <terra gnome org>
+
+	* gnumeric-expr-entry.c (gee_set_tooltip): Use symbolic name for
+	unicode characters.  Add argument discription to tooltip.
+
 2010-06-16  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* gnumeric-expr-entry.c (gee_create_tooltip): place the
diff --git a/src/widgets/gnumeric-expr-entry.c b/src/widgets/gnumeric-expr-entry.c
index b4ed0b8..e61b2b0 100644
--- a/src/widgets/gnumeric-expr-entry.c
+++ b/src/widgets/gnumeric-expr-entry.c
@@ -41,6 +41,11 @@
 #include <gdk/gdkkeysyms.h>
 #include <string.h>
 
+#define UNICODE_LEFT_ARROW "\xe2\xac\x85"
+#define UNICODE_RIGHT_ARROW "\xe2\x9e\xa1"
+#define UNICODE_CROSS_AND_SKULLBONES "\xe2\x98\xa0"
+#define UNICODE_ELLIPSIS "\xe2\x80\xa6"
+
 typedef struct {
 	GnmRangeRef ref;
 	int	    text_start;
@@ -677,6 +682,7 @@ gee_set_tooltip (GnmExprEntry *gee, GnmFunc *fd, gint args)
 	gchar sep = go_locale_get_arg_sep ();
 	gint min, max, i;
 	gboolean first = TRUE;
+	char *extra = NULL;
 
 	if (gee->tooltip.fd) {
 		if (gee->tooltip.fd == fd && gee->tooltip.args == args)
@@ -702,11 +708,15 @@ gee_set_tooltip (GnmExprEntry *gee, GnmFunc *fd, gint args)
 			else
 				g_string_append_c (str, sep);
 			if (i == args) {
-				g_string_append (str, "\xe2\x9e\xa1");
-				gee_set_tooltip_argument (str, arg_name, i >= min);
-				g_string_append (str, "\xe2\xac\x85");
-			} else
-				gee_set_tooltip_argument (str, arg_name, i >= min);
+				extra = g_strdup_printf
+					(_("%s: %s"),
+					 arg_name,
+					 gnm_func_get_arg_description (fd, i));
+				g_string_append (str, UNICODE_RIGHT_ARROW);
+			}
+			gee_set_tooltip_argument (str, arg_name, i >= min);
+			if (i == args)
+				g_string_append (str, UNICODE_LEFT_ARROW);
 			g_free (arg_name);
 		} else
 			break;
@@ -715,13 +725,21 @@ gee_set_tooltip (GnmExprEntry *gee, GnmFunc *fd, gint args)
 		if (!first)
 			g_string_append_c (str, sep);
 		g_string_append 
-			(str, (args >= i && args < max) ? 
-			 "\xe2\x9e\xa1\xe2\x80\xa6\xe2\xac\x85" 
-			 : "\xe2\x80\xa6");
+			(str, (args >= i && args < max)
+			 ? UNICODE_RIGHT_ARROW UNICODE_ELLIPSIS UNICODE_LEFT_ARROW
+			 : UNICODE_ELLIPSIS);
+	}
+	if (args >= max) {
+		g_string_append (str, UNICODE_RIGHT_ARROW UNICODE_CROSS_AND_SKULLBONES UNICODE_LEFT_ARROW);
+		extra = g_strdup_printf (_("Too many arguments for %s"),
+					 gnm_func_get_name (fd));
 	}
-	if (args >= max)
-		g_string_append (str, "\xe2\x9e\xa1\xe2\x98\xa0\xe2\xac\x85");
 	g_string_append_c (str, ')');
+	if (extra) {
+		g_string_append_c (str, '\n');
+		g_string_append (str, extra);
+		g_free (extra);
+	}
 
 	gee->tooltip.tooltip = gee_create_tooltip (gee, str->str);
 	gee->tooltip.args = args;



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