@@ -24,42 +24,6 @@ static GtkTreeViewColumn *treeColumn;
24
24
25
25
int timer ;
26
26
27
- static gboolean
28
- query_tooltip_cb (GtkWidget * widget , gint x , gint y ,
29
- gboolean keyboard_tip , GtkTooltip * tooltip , void * unused )
30
- {
31
- GtkTreeModel * model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeUSB ));
32
- GtkTreePath * path = NULL ;
33
- GtkTreeIter iter ;
34
- gint cellx = 0 , celly = 0 ;
35
- gchar * color ;
36
- gboolean return_val = FALSE;
37
-
38
- if (!model )
39
- return FALSE;
40
-
41
- /* This -30 is a kludge. It seems that if you don't do this, gtk_tree_view_get_path_at_pos()
42
- * gives you the wrong path, the path for the cell that is 30 or so pixels down below the
43
- * mouse. I don't know why it does that. Either we're doing something wrong, or it's a gtk-3
44
- * bug.
45
- */
46
- y = y - 30 ;
47
-
48
- if (!gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget ), x , y , & path , & treeColumn , & cellx , & celly ))
49
- return FALSE;
50
- if (!path )
51
- return FALSE;
52
- /* Get the color, if it's red, set tooltip to indicate device has no driver. */
53
- gtk_tree_model_get_iter (model , & iter , path );
54
- gtk_tree_model_get (model , & iter , COLOR_COLUMN , & color , -1 );
55
- if (color != NULL && strncmp (color , "red" , 4 ) == 0 ) {
56
- gtk_tooltip_set_text (tooltip , "This device has no attached driver" );
57
- return_val = TRUE;
58
- }
59
- gtk_tree_path_free (path );
60
- return return_val ;
61
- }
62
-
63
27
GtkWidget *
64
28
create_windowMain ()
65
29
{
@@ -94,7 +58,8 @@ create_windowMain ()
94
58
treeStore = gtk_tree_store_new (N_COLUMNS ,
95
59
G_TYPE_STRING , /* NAME_COLUMN */
96
60
G_TYPE_INT , /* DEVICE_ADDR_COLUMN */
97
- G_TYPE_STRING /* COLOR_COLUMN */ );
61
+ G_TYPE_STRING , /* COLOR_COLUMN */
62
+ G_TYPE_STRING /* TOOLTIP_COLUMN */ );
98
63
treeUSB = gtk_tree_view_new_with_model (GTK_TREE_MODEL (treeStore ));
99
64
treeRenderer = gtk_cell_renderer_text_new ();
100
65
treeColumn = gtk_tree_view_column_new_with_attributes (
@@ -104,6 +69,10 @@ create_windowMain ()
104
69
"foreground" , COLOR_COLUMN ,
105
70
NULL );
106
71
gtk_tree_view_append_column (GTK_TREE_VIEW (treeUSB ), treeColumn );
72
+ gtk_tree_view_set_tooltip_column (
73
+ GTK_TREE_VIEW (treeUSB ), TOOLTIP_COLUMN
74
+ );
75
+
107
76
gtk_widget_set_name (treeUSB , "treeUSB" );
108
77
gtk_widget_show (treeUSB );
109
78
gtk_paned_pack1 (GTK_PANED (hpaned1 ), treeUSB , FALSE, FALSE);
@@ -164,12 +133,9 @@ create_windowMain ()
164
133
g_signal_connect (G_OBJECT (buttonClose ), "clicked" ,
165
134
G_CALLBACK (on_buttonClose_clicked ),
166
135
NULL );
167
- g_object_set (G_OBJECT (treeUSB ), "has-tooltip" , TRUE, NULL );
168
- g_signal_connect (G_OBJECT (treeUSB ), "query-tooltip" , G_CALLBACK (query_tooltip_cb ), NULL );
169
136
170
137
/* create our timer */
171
138
//timer = gtk_timeout_add (2000, on_timer_timeout, 0);
172
-
139
+
173
140
return windowMain ;
174
141
}
175
-
0 commit comments