# HG changeset patch # User Colin Clark # Date 1533237336 -3600 # Node ID 1d43d9582f36c3d05df2222c11a507c01f8ddf26 # Parent 7fa597d9c65b397c15b89369be11929ed9e3598d Tooltip for path entry The current path entry can be partially obscured if the vertical divider is pushed too far to the left. This commit shows the current path as the tooltip. diff -r 7fa597d9c65b -r 1d43d9582f36 src/layout.c --- a/src/layout.c Thu Aug 02 14:28:17 2018 +0100 +++ b/src/layout.c Thu Aug 02 20:15:36 2018 +0100 @@ -287,6 +287,24 @@ gtk_widget_set_sensitive(lw->back_button, (n > 1)); } +static gboolean path_entry_tooltip_cb(GtkWidget *widget, gpointer data) +{ + LayoutWindow *lw = data; + GList *box_child_list; + GtkComboBox *path_entry; + gchar *current_path; + + box_child_list = gtk_container_get_children(GTK_CONTAINER(widget)); + path_entry = box_child_list->data; + current_path = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(path_entry)); + gtk_widget_set_tooltip_text(GTK_WIDGET(widget), current_path); + + g_free(current_path); + g_list_free(box_child_list); + + return FALSE; +} + static GtkWidget *layout_tool_setup(LayoutWindow *lw) { GtkWidget *box; @@ -311,6 +329,8 @@ tab_completion_add_append_func(lw->path_entry, layout_path_entry_tab_append_cb, lw); gtk_box_pack_start(GTK_BOX(box), tabcomp, FALSE, FALSE, 0); gtk_widget_show(tabcomp); + gtk_widget_set_has_tooltip(GTK_WIDGET(tabcomp), TRUE); + g_signal_connect(G_OBJECT(tabcomp), "query_tooltip", G_CALLBACK(path_entry_tooltip_cb), lw); #if GTK_CHECK_VERSION(3,20,0) g_signal_connect(G_OBJECT(gtk_widget_get_parent(gtk_widget_get_parent(lw->path_entry))), "changed",