Mercurial > hg > forks > geeqie
comparison src/layout.c @ 2808:1d43d9582f36
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.
author | Colin Clark <colin.clark@cclark.uk> |
---|---|
date | Thu, 02 Aug 2018 20:15:36 +0100 |
parents | bcd52f7517c7 |
children | e9e8e8b2afce |
comparison
equal
deleted
inserted
replaced
2807:7fa597d9c65b | 2808:1d43d9582f36 |
---|---|
285 | 285 |
286 /* Enable back button if it makes sense */ | 286 /* Enable back button if it makes sense */ |
287 gtk_widget_set_sensitive(lw->back_button, (n > 1)); | 287 gtk_widget_set_sensitive(lw->back_button, (n > 1)); |
288 } | 288 } |
289 | 289 |
290 static gboolean path_entry_tooltip_cb(GtkWidget *widget, gpointer data) | |
291 { | |
292 LayoutWindow *lw = data; | |
293 GList *box_child_list; | |
294 GtkComboBox *path_entry; | |
295 gchar *current_path; | |
296 | |
297 box_child_list = gtk_container_get_children(GTK_CONTAINER(widget)); | |
298 path_entry = box_child_list->data; | |
299 current_path = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(path_entry)); | |
300 gtk_widget_set_tooltip_text(GTK_WIDGET(widget), current_path); | |
301 | |
302 g_free(current_path); | |
303 g_list_free(box_child_list); | |
304 | |
305 return FALSE; | |
306 } | |
307 | |
290 static GtkWidget *layout_tool_setup(LayoutWindow *lw) | 308 static GtkWidget *layout_tool_setup(LayoutWindow *lw) |
291 { | 309 { |
292 GtkWidget *box; | 310 GtkWidget *box; |
293 GtkWidget *box_folders; | 311 GtkWidget *box_folders; |
294 GtkWidget *scd; | 312 GtkWidget *scd; |
309 layout_path_entry_cb, lw); | 327 layout_path_entry_cb, lw); |
310 tab_completion_add_tab_func(lw->path_entry, layout_path_entry_tab_cb, lw); | 328 tab_completion_add_tab_func(lw->path_entry, layout_path_entry_tab_cb, lw); |
311 tab_completion_add_append_func(lw->path_entry, layout_path_entry_tab_append_cb, lw); | 329 tab_completion_add_append_func(lw->path_entry, layout_path_entry_tab_append_cb, lw); |
312 gtk_box_pack_start(GTK_BOX(box), tabcomp, FALSE, FALSE, 0); | 330 gtk_box_pack_start(GTK_BOX(box), tabcomp, FALSE, FALSE, 0); |
313 gtk_widget_show(tabcomp); | 331 gtk_widget_show(tabcomp); |
332 gtk_widget_set_has_tooltip(GTK_WIDGET(tabcomp), TRUE); | |
333 g_signal_connect(G_OBJECT(tabcomp), "query_tooltip", G_CALLBACK(path_entry_tooltip_cb), lw); | |
314 | 334 |
315 #if GTK_CHECK_VERSION(3,20,0) | 335 #if GTK_CHECK_VERSION(3,20,0) |
316 g_signal_connect(G_OBJECT(gtk_widget_get_parent(gtk_widget_get_parent(lw->path_entry))), "changed", | 336 g_signal_connect(G_OBJECT(gtk_widget_get_parent(gtk_widget_get_parent(lw->path_entry))), "changed", |
317 G_CALLBACK(layout_path_entry_changed_cb), lw); | 337 G_CALLBACK(layout_path_entry_changed_cb), lw); |
318 #else | 338 #else |