This change effectively reverts commit 5c679301ec ("search: Invalidate
"Search Locations" list when folders can't be found"). The crash
that commits intends to fix does not occur on main anymore, and there's
no real difference between an existing and non existing file from this
interface's perspective.
Removing a folder automatically is dangerous because it may be on
an unmounted external hard drive or another location that is not
currently available. This also removes some blocking i/o on the main
thread.
Instead replace with a subtitle message to notify the user that the
folder is inaccessible.
We handle index-single-directories and index-recursive-directories
different, but the user has no idea. Add a subtitle to clarify
the difference in behavior.
We wrongly assume that the only directory set to index-single-directories
is the home directory. Now adays [1] tracker miners defaults home
and downloads to index-single-directories. This leads to a behavior
where downloads appears to be unindexed (the switch is set to inactive),
but if you set the switch to active you will end up with downloads
in index-single-directories and index-recursive-directories.
Check the index-single-directories (as well as its default value)
to consistently handle this setting correctly.
[1] d97cf22273
However, for Default or Bookmarked locations, the switch is not shown if
the location is not found, but there is no reason to now allow the user
to switch that location of, even if not found.
We therefore now show the switch unconditionally for the Default and
Bookmarked locations. This allows a great deal of code simplification
too, as the file info query is now only used to place a subtitle if it
is not found.
A regression from commit f473ec45c7 ("search: introduce the new Search
Locations dialog") causes the entries to be in a random order (as
determined by g_hash_table_get_values()). Previous to this commit,
there was a single listbox sorted by a custom sort func which grouped
XDG folders, bookmarks, and others. Now there's a listbox for each of
those groupings, but only others_list gets the sort func. Sort each
of the lists, and remove unnecessary code.
GtkStyleContext will be deprecated in gtk 4.10.
https://docs.gtk.org/gtk4/class.StyleContext.html
This preserves code blocks where additional GtkStyleContext operations
were used, such as gtk_style_context_save/restore.
The Tracker3 schema points to the same dconf path and is backwards
compatible with Tracker 2.x settings. Check for either here, with a
preference to Tracker 3.x.
Eventually, Tracker 2.x will be fully phased out, and this will not
be necessary.
Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1173
We store the list of "Search Locations" in a gsetting. When a location
gets added and then removed, the gsetting still stores its path.
These changes verify the existance of a file before loading it in the UI,
and also removes the path from the gsetting when the location can't
be found.
Fixes#812
When creating a Page, the dialog variable wasn't set and thus
dereferencing a NULL in a later code resulting a crash.
This was introduced in 14b9f65ba4
Tracker GSettings were previously stored in a global variable. This
seems to have been done to avoid difficulty passing the settings via
callbacks. Global variables are easy to leak and make mistakes with.
Update the code to have better callback handling so the variable can
be stored inside the object.
Instead of either hard-depending on Tracker being installed, or crashing
when the Tracker GSettings schema is not found, make the configuration
insensitive if the schema is not available.
https://bugzilla.gnome.org/show_bug.cgi?id=687490