After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 735216 - nautilus-window-slot: Indicate no results when searching
nautilus-window-slot: Indicate no results when searching
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 680984 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-08-22 11:14 UTC by Carlos Soriano
Modified: 2015-08-07 12:42 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
nautilus-window-slot: Indicate no results when searching (6.23 KB, patch)
2014-08-22 11:15 UTC, Carlos Soriano
needs-work Details | Review
nautilus-window-slot: Indicate no results when searching (5.85 KB, patch)
2015-01-28 17:01 UTC, Carlos Soriano
none Details | Review

Description Carlos Soriano 2014-08-22 11:14:58 UTC
See patch
Comment 1 Carlos Soriano 2014-08-22 11:15:04 UTC
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.
Comment 2 Cosimo Cecchi 2014-10-16 13:17:26 UTC
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
Comment 3 Carlos Soriano 2015-01-28 17:01:37 UTC
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.
Comment 4 Carlos Soriano 2015-01-28 17:03:27 UTC
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.
Comment 5 António Fernandes 2015-03-14 19:58:10 UTC
*** Bug 680984 has been marked as a duplicate of this bug. ***