GNOME Bugzilla – Bug 735216
nautilus-window-slot: Indicate no results when searching
Last modified: 2015-08-07 12:42:36 UTC
See patch
Created attachment 284181 [details] [review] nautilus-window-slot: Indicate no results when searching Currently when no results are found for a search, the view becomes empty with no feedback to the user. Instead of that add a "No results" label when that happens.
Review of attachment 284181 [details] [review]: ::: libnautilus-private/nautilus-search-directory.c @@ +533,1 @@ + nautilus_directory_emit_done_loading (NAUTILUS_DIRECTORY (search)); You should probably be using the "end-loading" signal from the view, instead of adding a new signal specifically for the search directory. ::: src/nautilus-window-slot.c @@ +72,3 @@ + /* no results label */ + GtkLabel *no_results_label; By convention we usually store these pointers as GtkWidget * instead of the specialized type @@ +239,3 @@ + NautilusWindowSlot *slot) +{ + GList *files = nautilus_directory_get_file_list (directory); This should be freed with nautius_file_list_unref() @@ +242,3 @@ + + if (!g_list_length (files)) { + gtk_widget_show (GTK_WIDGET (slot->details->no_results_label)); You will need no GTK_WIDGET() cast once you have changed slot->details->no_results_label to be a GtkWidget * as suggested above (multiple occurrences) @@ +628,3 @@ gtk_widget_show (slot->details->view_overlay); + slot->details->no_results_label = gtk_label_new(NULL); Missing space after parenthesis (multiple occurrences) @@ +629,3 @@ + slot->details->no_results_label = gtk_label_new(NULL); + const char *markup = g_markup_printf_escaped("<span size=\"large\" font_weight=\"bold\">\%s</span>", _("No results")); This string is not const. Also you need to call g_free() on it
Created attachment 295681 [details] [review] nautilus-window-slot: Indicate no results when searching Currently when no results are found for a search, the view becomes empty with no feedback to the user. Instead of that add a "No results" label when that happens.
Couldn't figure out why the end-loading is called even when the files are "not" loaded in the view. That also happens with the view end-loading signal. That's why it's need the files-added signal, so if some file is present after loading the directory it removes the No results label.
*** Bug 680984 has been marked as a duplicate of this bug. ***
https://git.gnome.org/browse/nautilus/commit/?id=fe57397c9e66e178fb031b8a6e60827bd25ea5e3