Commit graph

50 commits

Author SHA1 Message Date
velsinki
ce584b3b67 search-locations-dialog: Add placeholder for custom locations
If there are no Other Locations added, the list shows empty which looks
odd.

Fix this by adding a simple placeholder to the GtkListBox.

Fixes #2869
2024-02-09 15:43:43 +00:00
Corey Berla
42920853c0 search-locations-dialog: Stop removing non-existent folders from tracker
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.
2024-02-09 15:43:43 +00:00
Corey Berla
aae5cd27bd search-locations-dialog: Expose single directory setting
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.
2024-02-09 15:43:43 +00:00
Corey Berla
0268ad08cd search-locations-dialog: Reuse new function 2024-02-09 15:43:43 +00:00
Corey Berla
56d6fd7c2f search-locations-dialog: Correctly handle single directory setting
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
2024-02-09 15:43:43 +00:00
Corey Berla
127bd170c2 search-locations-dialog: Set title for non-existent bookmarks
Show the bookmark name, but keep the switch invisible.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1916
2024-02-09 15:43:43 +00:00
Corey Berla
8baa4b159b search-locations-dialog: Stop leaking GError 2024-02-09 15:43:43 +00:00
Matthijs Velsink
8f541d0cff search-locations-dialog: Always show switch for default/bookmarks
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.
2024-02-09 15:43:43 +00:00
Corey Berla
8568e45d9e search-locations-dialog: Sort entries
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.
2024-02-09 15:43:43 +00:00
Peter Eisenmann
2275ef3be0 search-locations-dialog: ignore on dismissed folder selection 2024-02-09 15:43:43 +00:00
Peter Eisenmann
fda78fa577 search-locations-dialog: handle unset XDG dirs
The user can disable XDG dirs by setting them to the home directory. In
this case `path_from_tracker_dir`returns NULL. Handle this case by
continuing.
2024-02-09 15:43:43 +00:00
Peter Eisenmann
03c1c72c52 search-locations-dialog: remove new()'s parent parameter
The dialog doesn't need to know where it will be shown.
2024-02-09 15:43:43 +00:00
Automeris naranja
a3681a50fd search-locations-dialog: Add tooltip to the remove button 2024-01-30 13:44:07 +00:00
Automeris naranja
50c413e6bb general: Use proper icon in remove buttons of some list rows
window-close-symbolic shouldn't be used in this case.
Use edit-delete-symbolic instead.

Closes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2842
2024-01-18 12:08:42 +00:00
Felipe Borges
d0d5606e46 search: Fix crash when selecting fodler with a File dialog
Fixes #2645
2023-09-15 08:55:58 +00:00
Alice Mikhaylenko
ee4c5f8115 search: Stop using AdwPreferencesWindow for search locations window
That's not what it's for.
2023-08-02 12:51:48 +00:00
Christopher Davis
d7307b4c7e search: Use GtkFileDialog
The GtkFileChooser interface is deprecaed in favor of GtkFileDialog.
2023-06-06 13:33:29 +00:00
Felipe Borges
294156c0f9 Drop most uses of deprecated gtk_style_context_add/remove_class
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.
2023-01-05 18:55:51 +00:00
Christopher Davis
b4e74d58be search: Use AdwActionRow for locations dialog rows
Gives us consistent styling without needing to set
margins, as well as simple row activation.
2022-02-09 13:53:17 +00:00
Christopher Davis
ddb979abfd search: Use AdwPreferences{Window,Page,Group} for location dialog
Gives us more modern styling for the search locations
window.
2022-02-09 13:53:17 +00:00
Georges Basile Stavracas Neto
26630338ba search: Port to GTK4
This one was the first panel ported that used Drag n' Drop, and
we can see how much of an improvement GTK4 is compared to GTK3
when handling DnD.
2021-12-14 22:34:21 -03:00
Carlos Garnacho
27e1140c9d search: Check for either tracker 2.x or 3.x schemas
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
2020-11-02 21:47:22 +00:00
Adrien Plazas
9e2a2836d9 Use GtkDialog instead of HdyDialog
HdyDialog has been dropped in libhandy 1.
2020-07-20 08:04:28 +02:00
Felipe Borges
5c679301ec search: Invalidate "Search Locations" list when folders can't be found
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
2019-12-17 22:16:08 +00:00
Iain Lane
b5ff6d1b21
cc-search-locations: Use g_new0 instead of the slice allocator 2019-10-30 16:07:18 +00:00
Iain Lane
2c8cce0dcc
search: Factor out creation of Place objects.
If we always construct these objects via a constructor, then we can help
to avoid bugs like that fixed by
2fb0ff250b.
2019-10-30 16:07:14 +00:00
Mohammed Sadiq
2fb0ff250b search: Fix crash on clicking 'Search Locations'
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
2019-09-19 22:45:23 +05:30
Robert Ancell
8855254486 search: Make .ui filename match the .c filename 2019-09-09 21:58:00 +00:00
Robert Ancell
14b9f65ba4 search: Remove global variable that could get leaked
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.
2019-08-26 11:57:53 +00:00
Mohammed Sadiq
53ba6dcd2e search: Make search locations dialog adaptive 2019-07-26 01:21:27 +00:00
Robert Ancell
6e3adb6568 search: Don't use gtk_widget_show_all
It is removed in GTK+ 4
2018-10-11 22:21:34 +00:00
Robert Ancell
a64ef75ad7 Simplify use of GCancellable
g_cancellable_cancell can be called without checking for a NULL value.
Use g_clear_object instead of g_object_unref
2018-06-01 21:03:19 +00:00
Robert Ancell
59e420b774 search: Fix crash introduced in 58a6432 2018-05-31 12:16:04 +12:00
Robert Ancell
58a64323c4 search: Use g_auto for variables 2018-05-30 23:24:21 +00:00
Benjamin Berg
c2f601a9d4 Move common panel code from shell/ to panel/common
This creates a new static library called libwidget which the shell links
against.
2018-04-17 15:26:59 +02:00
Rui Matos
f32b305a1a search: Fix a GFile leak
https://bugzilla.gnome.org/show_bug.cgi?id=783885
2017-06-19 11:31:06 +02:00
Mohammed Sadiq
38ac1d1d76 search: Fix memory leak
The container returned by g_variant_get_strv() should be
freed with g_free().

https://bugzilla.gnome.org/show_bug.cgi?id=783885
2017-06-19 11:23:42 +02:00
Felipe Borges
e67cd42a45 search: use-header-bar for Search Locations dialog
https://bugzilla.gnome.org/show_bug.cgi?id=766513
2016-05-30 15:32:38 +02:00
Felipe Borges
f473ec45c7 search: introduce the new Search Locations dialog
https://wiki.gnome.org/Design/SystemSettings/Search

https://bugzilla.gnome.org/show_bug.cgi?id=766513
2016-05-30 15:22:44 +02:00
Rui Matos
d3b6add75e search: Drop deprecated API usage
https://bugzilla.gnome.org/show_bug.cgi?id=740986
2014-12-05 16:13:29 +01:00
Daniel Mustieles
2c5951819d Updated FSF's address 2014-01-29 11:27:38 +01:00
Yosef Or Boczko
38119b3f29 search: Use margin-start/end instead of margin-left/right
This is part of previous patch which fell accidentally.

https://bugzilla.gnome.org/show_bug.cgi?id=712661
2013-11-19 22:38:47 +02:00
Yosef Or Boczko
6926cf08b9 search: drop GtkStock
https://bugzilla.gnome.org/show_bug.cgi?id=704178
2013-07-19 15:58:09 +03:00
Alexander Larsson
a46a652093 search: Convert to GtkListBox
https://bugzilla.gnome.org/show_bug.cgi?id=702164
2013-07-02 16:19:09 +01:00
Matthias Clasen
16c2a04e5e Add context to some translated strings
We are using "Other" in various contexts that may require
different translations.
https://bugzilla.gnome.org/show_bug.cgi?id=697211
2013-05-18 18:05:18 -04:00
Kalev Lember
c8b3bc5948 search: Unescape the names in Search Locations
Instead of using g_path_get_basename() on raw URIs, use GFile functions
for getting the properly unescaped basenames of the files.

https://bugzilla.gnome.org/show_bug.cgi?id=694447
2013-02-28 19:44:14 +01:00
Cosimo Cecchi
28b6974b83 search: use a GResource for GtkBuilder UI definition
https://bugzilla.gnome.org/show_bug.cgi?id=691132
2013-01-07 10:57:16 +01:00
Bastien Nocera
63521fe34e search: Use correct ref increasing function 2012-12-03 11:08:59 +01:00
Cosimo Cecchi
2ad13d89f3 search: make options insensitive if tracker is not available
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
2012-11-27 12:33:00 +01:00
Cosimo Cecchi
defe92ec34 search: add a dialog to configure Tracker search locations
Ideally applications could configure Tracker independent from each
other, but we don't have such a feature currently.
In the meanwhile, bring up a settings dialog that can allow
configuration of the locations indexed by the Tracker files miner, as
suggested by the current design.

https://live.gnome.org/Design/SystemSettings/Search

https://bugzilla.gnome.org/show_bug.cgi?id=687490
2012-11-27 12:33:00 +01:00