[gimp] app: append insensitive reason to GimpAction proxy tooltip.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: append insensitive reason to GimpAction proxy tooltip.
- Date: Fri, 23 Apr 2021 17:49:04 +0000 (UTC)
commit 13a02aea236821707e2636f016ff415f1c4cb10c
Author: Jehan <jehan girinstud io>
Date: Fri Apr 23 19:45:48 2021 +0200
app: append insensitive reason to GimpAction proxy tooltip.
With my previous commit, I improved the search action display and search
algorithm (which was returning wrong results), but we had lost showing
the non-sensitive reason in menu item tooltips. This fixes it, by
actually appending the reason, but only in the end, on the GtkWidget
tooltip (not in the action's tooltip itself).
app/widgets/gimpaction.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
---
diff --git a/app/widgets/gimpaction.c b/app/widgets/gimpaction.c
index e3954b19be..982e8f5322 100644
--- a/app/widgets/gimpaction.c
+++ b/app/widgets/gimpaction.c
@@ -399,12 +399,30 @@ static void
gimp_action_set_proxy_tooltip (GimpAction *action,
GtkWidget *proxy)
{
- const gchar *tooltip = gimp_action_get_tooltip (action);
+ const gchar *tooltip;
+ const gchar *reason = NULL;
+ gchar *escaped_reason = NULL;
+ gchar *markup;
- if (tooltip)
- gimp_help_set_help_data (proxy, tooltip,
- g_object_get_qdata (G_OBJECT (proxy),
- GIMP_HELP_ID));
+ tooltip = gimp_action_get_tooltip (action);
+
+ gimp_action_get_sensitive (action, &reason);
+ if (reason)
+ escaped_reason = g_markup_escape_text (reason, -1);
+
+ markup = g_strdup_printf ("%s%s" /* Action tooltip */
+ "<i><span weight='light'>%s</span></i>", /* Inactive reason */
+ tooltip,
+ escaped_reason && tooltip ? "\n" : "",
+ escaped_reason);
+
+ if (tooltip || escaped_reason)
+ gimp_help_set_help_data_with_markup (proxy, markup,
+ g_object_get_qdata (G_OBJECT (proxy),
+ GIMP_HELP_ID));
+
+ g_free (escaped_reason);
+ g_free (markup);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]