GNOME Bugzilla – Bug 563002
Doesn't call 'update-preview' on set_filename
Last modified: 2010-11-25 15:56:06 UTC
I did a little preview functionality in bug #357948 to show preview of the selected image, and I found that the preview is not refreshed first time the dialog is shown, even the gtk_file_chooser_set_filename call has been done before. I would expect to see preview of the actually selected filename, not only the one I click a second later.
This should happen in gtkfilechooserdefault.c:check_preview_change(). Do you have some time to trace it there?
What kind of tracing are you thinking of? I attached gdb to running evolution, opened an event (double click on it), clicked on the "Categories" button and then chose one category with an icon. The above function is called 3 times: 1) --------------------------------------------------------------------------
+ Trace 211566
------------------------------------------------------------------------------ But when I click on the chooser button, then right file is preselected, only the preview in the dialog is not shown. When I click on other file now, then the preview is shown again. My actual gtk+ version is gtk2-2.14.4-3.fc10.x86_64
You are on the right track. I mean, when you hit the breakpoint in check_preview_change(), can you see what happens inside that function? Something is causing it to *not* reach the place where it does g_signal_emit_by_name (impl, "update-preview");
I put breakpoint to that function, and then hit the FileChooserButton. It was called 4 times, once as this: Breakpoint 1, check_preview_change (impl=0x97bf268) at gtkfilechooserdefault.c:10041 10041 gtk_tree_view_get_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view), &cursor_path, NULL); (gdb) n 10044 if (cursor_path) (gdb) 10042 new_file = NULL; (gdb) 10043 new_display_name = NULL; (gdb) 10044 if (cursor_path) (gdb) 10096 if (new_file != impl->preview_file && (gdb) 10100 if (impl->preview_file) (gdb) 10102 g_object_unref (impl->preview_file); (gdb) 10103 g_free (impl->preview_display_name); (gdb) 10106 if (new_file) (gdb) 10113 impl->preview_file = NULL; (gdb) 10114 impl->preview_display_name = NULL; (gdb) 10117 if (impl->use_preview_label && impl->preview_label) (gdb) 10118 gtk_label_set_text (GTK_LABEL (impl->preview_label), impl->preview_display_name); (gdb) 10120 g_signal_emit_by_name (impl, "update-preview"); (gdb) 10122 } (gdb) list_selection_changed (selection=0x981eee0, impl=0x97bf268) at gtkfilechooserdefault.c:10508 10508 bookmarks_check_add_sensitivity (impl); (gdb) c Continuing. --------------------------------------------------------------------------- 3 times as this: Breakpoint 1, check_preview_change (impl=0x97bf268) at gtkfilechooserdefault.c:10041 10041 gtk_tree_view_get_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view), &cursor_path, NULL); (gdb) n 10044 if (cursor_path) (gdb) 10042 new_file = NULL; (gdb) 10043 new_display_name = NULL; (gdb) 10044 if (cursor_path) (gdb) 10096 if (new_file != impl->preview_file && (gdb) 10122 } (gdb) c Continuing. --------------------------------------------------------------------------- I guess it should be easier for you to try yourself, or does it work for you?
*** Bug 319525 has been marked as a duplicate of this bug. ***
Fixed in master and 2-22: commit 6bdc9b7f8a0196ee63af7f0ed0423af793ba0d32 Author: Michael Natterer <mitch@gimp.org> Date: Tue Oct 12 21:20:16 2010 +0200 Bug 563002 - Doesn't call 'update-preview' on set_filename Call gtk_tree_view_set_cursor() in addition to gtk_tree_selection_select_iter() when selecting the file in show_and_select_files() so the preview update machinery gets triggered. (cherry picked from commit 795c8070db6c97ace040bfd220794bae3e2721c2) gtk/gtkfilechooserdefault.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
*** Bug 626370 has been marked as a duplicate of this bug. ***