[gtk/issue-1681] treeview: Don't show empty tooltips



commit 2934482aeee453eab0369d034a66526eddba2658
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Feb 18 17:44:17 2019 +0000

    treeview: Don't show empty tooltips
    
    If the column used for the GtkTreeView:tooltip-column contains NULL
    we're already skipping a tooltip; let's ignore empty strings as well,
    as an empty tooltip is pretty much pointless.
    
    Close #1681

 gtk/gtktreeview.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 97442c7fba..e5296108a1 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -16424,6 +16424,7 @@ gtk_tree_view_set_tooltip_query_cb (GtkWidget  *widget,
   GtkTreePath *path;
   GtkTreeModel *model;
   GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
+  const char *transformed_str = NULL;
 
   if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (widget),
                                          &x, &y,
@@ -16446,7 +16447,8 @@ gtk_tree_view_set_tooltip_query_cb (GtkWidget  *widget,
 
   g_value_unset (&value);
 
-  if (!g_value_get_string (&transformed))
+  transformed_str = g_value_get_string (&transformed);
+  if (transformed_str == NULL || *transformed_str == '\0')
     {
       g_value_unset (&transformed);
       gtk_tree_path_free (path);
@@ -16454,7 +16456,7 @@ gtk_tree_view_set_tooltip_query_cb (GtkWidget  *widget,
       return FALSE;
     }
 
-  gtk_tooltip_set_markup (tooltip, g_value_get_string (&transformed));
+  gtk_tooltip_set_markup (tooltip, transformed_str);
   gtk_tree_view_set_tooltip_row (tree_view, tooltip, path);
 
   gtk_tree_path_free (path);


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