[nautilus/use-tracked-dirs-for-star: 5/5] files-view: Use tracked directories for star
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/use-tracked-dirs-for-star: 5/5] files-view: Use tracked directories for star
- Date: Mon, 4 Feb 2019 18:17:26 +0000 (UTC)
commit 7f19a036491cb27579daa674aaf7f5353d910709
Author: Carlos Soriano <csoriano redhat com>
Date: Tue Jan 29 16:24:43 2019 +0100
files-view: Use tracked directories for star
We were using the xdg directories to check whether we can star a file
or not, since the star feature only works on directories that are
tracked by tracker.
Tracker is usually shipped in distributions tracking the
xdg-directories, so we check that as a stop gap solution for 3.30
since we didn't have time to actually query what directories tracker
is tracking and match that.
This work makes it so that we show the star action on tracked
directories.
build-aux/flatpak/org.gnome.Nautilus.json | 31 ++++-
build-aux/flatpak/org.gnome.Nautilus.yml | 31 ++++-
build-aux/flatpak/org.gnome.NautilusGtk4.yml | 186 ++++++++++++++-----------
build-aux/flatpak/org.gnome.NautilusMaster.yml | 172 +++++++++++++----------
src/meson.build | 4 +-
src/nautilus-files-view.c | 9 +-
src/nautilus-global-preferences.c | 2 +
src/nautilus-global-preferences.h | 1 +
src/nautilus-list-view.c | 13 +-
src/nautilus-tracker-utilities.c | 112 +++++++++++++++
src/nautilus-tracker-utilities.h | 26 ++++
11 files changed, 415 insertions(+), 172 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.Nautilus.json b/build-aux/flatpak/org.gnome.Nautilus.json
index ef359d4f4..e7a18a6d1 100644
--- a/build-aux/flatpak/org.gnome.Nautilus.json
+++ b/build-aux/flatpak/org.gnome.Nautilus.json
@@ -16,6 +16,7 @@
"--socket=wayland",
"--talk-name=org.gnome.OnlineAccounts",
"--talk-name=org.freedesktop.Tracker1",
+ "--talk-name=org.freedesktop.Tracker1.Miner.Extract",
"--filesystem=host",
"--talk-name=org.gtk.vfs",
"--talk-name=org.gtk.vfs.*",
@@ -84,6 +85,34 @@
}
]
},
+ {
+ "name": "tracker-miners",
+ "buildsystem": "meson",
+ "cleanup": [ "/etc",
+ "/lib",
+ "/libexec",
+ "/share/dbus-1/services/org.freedesktop.Tracker1.Miner.Extract.service",
+ "/share/dbus-1/services/org.freedesktop.Tracker1.Writeback.service",
+ "/share/tracker/miners/org.freedesktop.Tracker1.Miner.Applications.service",
+ "/share/tracker/miners/org.freedesktop.Tracker1.Miner.Extract.service",
+ "/share/tracker/miners/org.freedesktop.Tracker1.Miner.RSS.service",
+ "/share/tracker-miners",
+ "/share/glib-2.0/schemas/org.freedesktop.Tracker.Extract.gschema.xml",
+ "/share/glib-2.0/schemas/org.freedesktop.Tracker.Writeback.gschema.xml" ],
+ "config-opts": [ "-Dextract=false",
+ "-Dgeneric_media_extractor=none",
+ "-Dminer_apps=false",
+ "-Dminer_fs=true",
+ "-Dminer_rss=false",
+ "-Dsystemd_user_services=no",
+ "-Dwriteback=false" ],
+ "sources": [
+ {
+ "type": "git",
+ "url": "https://gitlab.gnome.org/GNOME/tracker-miners.git"
+ }
+ ]
+ },
{
"name" : "gnome-autoar",
"sources" : [
@@ -110,4 +139,4 @@
]
}
]
-}
\ No newline at end of file
+}
diff --git a/build-aux/flatpak/org.gnome.Nautilus.yml b/build-aux/flatpak/org.gnome.Nautilus.yml
index 50b5820d9..d5cb9fb02 100644
--- a/build-aux/flatpak/org.gnome.Nautilus.yml
+++ b/build-aux/flatpak/org.gnome.Nautilus.yml
@@ -1,7 +1,7 @@
---
app-id: org.gnome.NautilusDevel
runtime: org.gnome.Platform
-runtime-version: 'master'
+runtime-version: master
sdk: org.gnome.Sdk
command: nautilus
tags:
@@ -15,6 +15,7 @@ finish-args:
- "--socket=wayland"
- "--talk-name=org.gnome.OnlineAccounts"
- "--talk-name=org.freedesktop.Tracker1"
+- "--talk-name=org.freedesktop.Tracker1.Miner.Extract"
- "--filesystem=host"
- "--talk-name=org.gtk.vfs"
- "--talk-name=org.gtk.vfs.*"
@@ -63,6 +64,31 @@ modules:
sources:
- type: git
url: https://gitlab.gnome.org/GNOME/tracker.git
+- name: tracker-miners
+ buildsystem: meson
+ cleanup:
+ - "/etc"
+ - "/lib"
+ - "/libexec"
+ - "/share/dbus-1/services/org.freedesktop.Tracker1.Miner.Extract.service"
+ - "/share/dbus-1/services/org.freedesktop.Tracker1.Writeback.service"
+ - "/share/tracker/miners/org.freedesktop.Tracker1.Miner.Applications.service"
+ - "/share/tracker/miners/org.freedesktop.Tracker1.Miner.Extract.service"
+ - "/share/tracker/miners/org.freedesktop.Tracker1.Miner.RSS.service"
+ - "/share/tracker-miners"
+ - "/share/glib-2.0/schemas/org.freedesktop.Tracker.Extract.gschema.xml"
+ - "/share/glib-2.0/schemas/org.freedesktop.Tracker.Writeback.gschema.xml"
+ config-opts:
+ - "-Dextract=false"
+ - "-Dgeneric_media_extractor=none"
+ - "-Dminer_apps=false"
+ - "-Dminer_fs=true"
+ - "-Dminer_rss=false"
+ - "-Dsystemd_user_services=no"
+ - "-Dwriteback=false"
+ sources:
+ - type: git
+ url: https://gitlab.gnome.org/GNOME/tracker-miners.git
- name: gnome-autoar
sources:
- type: git
@@ -76,4 +102,5 @@ modules:
- "-Dprofile=Devel"
sources:
- type: git
- url: https://gitlab.gnome.org/GNOME/nautilus.git
\ No newline at end of file
+ url: https://gitlab.gnome.org/GNOME/nautilus.git
+
diff --git a/build-aux/flatpak/org.gnome.NautilusGtk4.yml b/build-aux/flatpak/org.gnome.NautilusGtk4.yml
index 2a8eee1ef..c6067eb1f 100644
--- a/build-aux/flatpak/org.gnome.NautilusGtk4.yml
+++ b/build-aux/flatpak/org.gnome.NautilusGtk4.yml
@@ -1,87 +1,107 @@
-app-id: "org.gnome.NautilusGtk4"
-runtime: "org.gnome.Platform"
-runtime-version: "master"
-sdk: "org.gnome.Sdk"
-command: "nautilus"
+---
+app-id: org.gnome.NautilusDevel
+runtime: org.gnome.Platform
+runtime-version: master
+sdk: org.gnome.Sdk
+command: nautilus
tags:
- - "devel"
- - "nightly"
- - "gtk4"
-desktop-file-name-prefix: "(Development Gtk4) "
+- devel
+- development
+- nightly
+desktop-file-name-prefix: "(Development) "
finish-args:
- - "--filesystem=host"
- - "--share=ipc"
- - "--socket=x11"
- - "--socket=wayland"
- - "--talk-name=org.gnome.OnlineAccounts"
- - "--talk-name=org.freedesktop.Tracker1"
- - "--talk-name=org.gtk.vfs"
- - "--talk-name=org.gtk.vfs.*"
- - "--filesystem=xdg-run/dconf"
- - "--filesystem=~/.config/dconf:ro"
- # Remove to something better for dconf when ready.
- # See https://github.com/flatpak/flatpak/issues/78
- - "--talk-name=ca.desrt.dconf"
- - "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
- - "--device=dri"
- # It's a fallback path for tracker, Flatpak seems needs it.
- - --env=TRACKER_SPARQL_BACKEND=bus
-
+- "--share=ipc"
+- "--socket=x11"
+- "--socket=wayland"
+- "--talk-name=org.gnome.OnlineAccounts"
+- "--talk-name=org.freedesktop.Tracker1"
+- "--talk-name=org.freedesktop.Tracker1.Miner.Extract"
+- "--filesystem=host"
+- "--talk-name=org.gtk.vfs"
+- "--talk-name=org.gtk.vfs.*"
+- "--filesystem=xdg-run/dconf"
+- "--filesystem=~/.config/dconf:ro"
+- "--talk-name=ca.desrt.dconf"
+- "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
+- "--env=TRACKER_SPARQL_BACKEND=bus"
modules:
- - name: "exiv2"
- buildsystem: "cmake-ninja"
- sources:
- - type: "archive"
- url: "https://github.com/Exiv2/exiv2/archive/v0.26.tar.gz"
- sha256: "51cffa8d19d67e1da6c1d0f570a75b8f6c814113367318c2c0407691888c5f01"
-
- - name: "gexiv2"
- buildsystem: "meson"
- cleanup:
- - '/lib/girepository-1.0'
- - '/share/gir-1.0'
- build-options:
- config-opts:
- - '-Ddisable-introspection=True'
- - '-Ddisable-vala=true'
- - '-Dpython2-girdir=no'
- - '-Dpython3-girdir=no'
- sources:
- - type: "git"
- url: "https://gitlab.gnome.org/GNOME/gexiv2.git"
-
- - name: "tracker"
- cleanup:
- - "/bin"
- - "/etc"
- - "/libexec"
- buildsystem: "meson"
- build-options:
- config-opts:
- - "-Dbash_completion=no"
- - "-Ddocs=false"
- - "-Dfunctional_tests=false"
- - "-Djournal=false"
- - "-Dnetwork_manager=no"
- - "-Dstemmer=no"
- - "-Dsystemd_user_services=no"
- sources:
- - type: "git"
- url: "https://gitlab.gnome.org/GNOME/tracker.git"
-
- - name: "gnome-autoar"
- sources:
- - type: "git"
- url: "https://gitlab.gnome.org/GNOME/gnome-autoar.git"
- tag: "0.2.3"
+- gcovr.json
+- name: exiv2
+ config-opts:
+ - "-DCMAKE_INSTALL_PREFIX=/app"
+ - "-DCMAKE_INSTALL_LIBDIR=/app/lib"
+ buildsystem: cmake-ninja
+ sources:
+ - type: archive
+ url: https://github.com/Exiv2/exiv2/archive/v0.26.tar.gz
+ sha256: 51cffa8d19d67e1da6c1d0f570a75b8f6c814113367318c2c0407691888c5f01
+- name: gexiv2
+ buildsystem: meson
+ builddir: true
+ config-opts:
+ - "--libdir=/app/lib"
+ - "-Ddisable-introspection=True"
+ sources:
+ - type: git
+ url: https://gitlab.gnome.org/GNOME/gexiv2.git
+ tag: gexiv2-0.10.8
+- name: tracker
+ cleanup:
+ - "/bin"
+ - "/etc"
+ - "/libexec"
+ buildsystem: meson
+ builddir: true
+ config-opts:
+ - "--libdir=lib"
+ - "-Ddocs=false"
+ - "-Dfunctional_tests=false"
+ - "-Djournal=false"
+ - "-Dnetwork_manager=no"
+ - "-Dstemmer=no"
+ - "-Dbash_completion=no"
+ - "-Dsystemd_user_services=no"
+ sources:
+ - type: git
+ url: https://gitlab.gnome.org/GNOME/tracker.git
+- name: tracker-miners
+ buildsystem: meson
+ cleanup:
+ - "/etc"
+ - "/lib"
+ - "/libexec"
+ - "/share/dbus-1/services/org.freedesktop.Tracker1.Miner.Extract.service"
+ - "/share/dbus-1/services/org.freedesktop.Tracker1.Writeback.service"
+ - "/share/tracker/miners/org.freedesktop.Tracker1.Miner.Applications.service"
+ - "/share/tracker/miners/org.freedesktop.Tracker1.Miner.Extract.service"
+ - "/share/tracker/miners/org.freedesktop.Tracker1.Miner.RSS.service"
+ - "/share/tracker-miners"
+ - "/share/glib-2.0/schemas/org.freedesktop.Tracker.Extract.gschema.xml"
+ - "/share/glib-2.0/schemas/org.freedesktop.Tracker.Writeback.gschema.xml"
+ config-opts:
+ - "-Dextract=false"
+ - "-Dgeneric_media_extractor=none"
+ - "-Dminer_apps=false"
+ - "-Dminer_fs=true"
+ - "-Dminer_rss=false"
+ - "-Dsystemd_user_services=no"
+ - "-Dwriteback=false"
+ sources:
+ - type: git
+ url: https://gitlab.gnome.org/GNOME/tracker-miners.git
+- name: gnome-autoar
+ sources:
+ - type: git
+ url: https://gitlab.gnome.org/GNOME/gnome-autoar.git
+ tag: 0.2.3
+- buildsystem: meson
+ builddir: true
+ name: nautilus
+ config-opts:
+ - "--libdir=/app/lib"
+ - "-Dprofile=Devel"
+ sources:
+ - type: git
+ url: https://gitlab.gnome.org/GNOME/nautilus.git
+ branch: wip/ernestask/gtk4-continued
- - name: "nautilus"
- buildsystem: "meson"
- build-options:
- config-opts:
- - "-Dprofile=Gtk4"
- - "-Dintrospection=false"
- sources:
- - type: "git"
- url: "https://gitlab.gnome.org/GNOME/nautilus.git"
- branch: "wip/ernestask/gtk4-continued"
diff --git a/build-aux/flatpak/org.gnome.NautilusMaster.yml b/build-aux/flatpak/org.gnome.NautilusMaster.yml
index 74fd74387..d5cb9fb02 100644
--- a/build-aux/flatpak/org.gnome.NautilusMaster.yml
+++ b/build-aux/flatpak/org.gnome.NautilusMaster.yml
@@ -1,82 +1,106 @@
-app-id: org.gnome.NautilusMaster
+---
+app-id: org.gnome.NautilusDevel
runtime: org.gnome.Platform
runtime-version: master
sdk: org.gnome.Sdk
command: nautilus
tags:
- - devel
- - nightly
- - master
-desktop-file-name-prefix: "(Development Master) "
+- devel
+- development
+- nightly
+desktop-file-name-prefix: "(Development) "
finish-args:
- - --filesystem=host
- - --share=ipc
- - --socket=x11
- - --socket=wayland
- - --talk-name=org.gnome.OnlineAccounts
- - --talk-name=org.freedesktop.Tracker1
- - --filesystem=host
- - --talk-name=org.gtk.vfs
- - --talk-name=org.gtk.vfs.*
- - --filesystem=xdg-run/dconf
- - --filesystem=~/.config/dconf:ro
- # Remove to something better for dconf when ready.
- # See https://github.com/flatpak/flatpak/issues/78
- - --talk-name=ca.desrt.dconf
- - --env=DCONF_USER_CONFIG_DIR=.config/dconf
- # It's a fallback path for tracker, Flatpak seems needs it.
- - --env=TRACKER_SPARQL_BACKEND=bus
-
+- "--share=ipc"
+- "--socket=x11"
+- "--socket=wayland"
+- "--talk-name=org.gnome.OnlineAccounts"
+- "--talk-name=org.freedesktop.Tracker1"
+- "--talk-name=org.freedesktop.Tracker1.Miner.Extract"
+- "--filesystem=host"
+- "--talk-name=org.gtk.vfs"
+- "--talk-name=org.gtk.vfs.*"
+- "--filesystem=xdg-run/dconf"
+- "--filesystem=~/.config/dconf:ro"
+- "--talk-name=ca.desrt.dconf"
+- "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
+- "--env=TRACKER_SPARQL_BACKEND=bus"
modules:
- - name: "exiv2"
- buildsystem: "cmake-ninja"
- sources:
- - type: "git"
- url: "https://github.com/Exiv2/exiv2.git"
- tag: "v0.26"
-
- - name: gexiv2
- buildsystem: meson
- cleanup:
- - '/lib/girepository-1.0'
- - '/share/gir-1.0'
- build-options:
- config-opts:
- - '-Dpython2_girdir=no'
- - '-Dpython3_girdir=no'
- sources:
- - type: git
- url: https://gitlab.gnome.org/GNOME/gexiv2.git
-
- - name: tracker
- cleanup:
- - /bin
- - /etc
- - /libexec
- buildsystem: meson
- build-options:
- config-opts:
- - -Ddocs=false
- - -Dfunctional_tests=false
- - -Djournal=false
- - -Dnetwork_manager=no
- - -Dstemmer=no
- - -Dbash_completion=no
- - -Dsystemd_user_services=no
- sources:
- - type: git
- url: https://gitlab.gnome.org/GNOME/tracker.git
-
- - name: gnome-autoar
- sources:
- - type: git
- url: https://gitlab.gnome.org/GNOME/gnome-autoar.git
+- gcovr.json
+- name: exiv2
+ config-opts:
+ - "-DCMAKE_INSTALL_PREFIX=/app"
+ - "-DCMAKE_INSTALL_LIBDIR=/app/lib"
+ buildsystem: cmake-ninja
+ sources:
+ - type: archive
+ url: https://github.com/Exiv2/exiv2/archive/v0.26.tar.gz
+ sha256: 51cffa8d19d67e1da6c1d0f570a75b8f6c814113367318c2c0407691888c5f01
+- name: gexiv2
+ buildsystem: meson
+ builddir: true
+ config-opts:
+ - "--libdir=/app/lib"
+ - "-Ddisable-introspection=True"
+ sources:
+ - type: git
+ url: https://gitlab.gnome.org/GNOME/gexiv2.git
+ tag: gexiv2-0.10.8
+- name: tracker
+ cleanup:
+ - "/bin"
+ - "/etc"
+ - "/libexec"
+ buildsystem: meson
+ builddir: true
+ config-opts:
+ - "--libdir=lib"
+ - "-Ddocs=false"
+ - "-Dfunctional_tests=false"
+ - "-Djournal=false"
+ - "-Dnetwork_manager=no"
+ - "-Dstemmer=no"
+ - "-Dbash_completion=no"
+ - "-Dsystemd_user_services=no"
+ sources:
+ - type: git
+ url: https://gitlab.gnome.org/GNOME/tracker.git
+- name: tracker-miners
+ buildsystem: meson
+ cleanup:
+ - "/etc"
+ - "/lib"
+ - "/libexec"
+ - "/share/dbus-1/services/org.freedesktop.Tracker1.Miner.Extract.service"
+ - "/share/dbus-1/services/org.freedesktop.Tracker1.Writeback.service"
+ - "/share/tracker/miners/org.freedesktop.Tracker1.Miner.Applications.service"
+ - "/share/tracker/miners/org.freedesktop.Tracker1.Miner.Extract.service"
+ - "/share/tracker/miners/org.freedesktop.Tracker1.Miner.RSS.service"
+ - "/share/tracker-miners"
+ - "/share/glib-2.0/schemas/org.freedesktop.Tracker.Extract.gschema.xml"
+ - "/share/glib-2.0/schemas/org.freedesktop.Tracker.Writeback.gschema.xml"
+ config-opts:
+ - "-Dextract=false"
+ - "-Dgeneric_media_extractor=none"
+ - "-Dminer_apps=false"
+ - "-Dminer_fs=true"
+ - "-Dminer_rss=false"
+ - "-Dsystemd_user_services=no"
+ - "-Dwriteback=false"
+ sources:
+ - type: git
+ url: https://gitlab.gnome.org/GNOME/tracker-miners.git
+- name: gnome-autoar
+ sources:
+ - type: git
+ url: https://gitlab.gnome.org/GNOME/gnome-autoar.git
+ tag: 0.2.3
+- buildsystem: meson
+ builddir: true
+ name: nautilus
+ config-opts:
+ - "--libdir=/app/lib"
+ - "-Dprofile=Devel"
+ sources:
+ - type: git
+ url: https://gitlab.gnome.org/GNOME/nautilus.git
- - name: nautilus
- buildsystem: meson
- build-options:
- config-opts:
- - -Dprofile=Master
- sources:
- - type: git
- url: https://gitlab.gnome.org/GNOME/nautilus.git
diff --git a/src/meson.build b/src/meson.build
index a87c51414..5aea6d251 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -267,7 +267,9 @@ libnautilus_sources = [
'nautilus-starred-directory.c',
'nautilus-starred-directory.h',
'nautilus-enums.h',
- 'nautilus-types.h'
+ 'nautilus-types.h',
+ 'nautilus-tracker-utilities.c',
+ 'nautilus-tracker-utilities.h'
]
nautilus_deps = [
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 20a5c03d2..591d87b52 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -88,6 +88,7 @@
#include "nautilus-view.h"
#include "nautilus-view-icon-controller.h"
#include "nautilus-window.h"
+#include "nautilus-tracker-utilities.h"
/* Minimum starting update inverval */
#define UPDATE_INTERVAL_MIN 100
@@ -7302,7 +7303,7 @@ real_update_actions_state (NautilusFilesView *view)
GDriveStartStopType start_stop_type;
g_autoptr (GFile) current_location = NULL;
g_autofree gchar *current_uri = NULL;
- gboolean current_directory_in_xdg_folders;
+ gboolean current_directory_tracked;
gboolean show_star;
gboolean show_unstar;
gchar *uri;
@@ -7638,12 +7639,12 @@ real_update_actions_state (NautilusFilesView *view)
*/
current_location = nautilus_file_get_location (nautilus_files_view_get_directory_as_file (view));
current_uri = g_file_get_uri (current_location);
- current_directory_in_xdg_folders = eel_uri_is_in_xdg_dirs (current_uri);
+ current_directory_tracked = nautilus_tracker_directory_is_tracked (current_location);
show_star = (selection != NULL) &&
- (current_directory_in_xdg_folders || selection_contains_starred);
+ (current_directory_tracked || selection_contains_starred);
show_unstar = (selection != NULL) &&
- (current_directory_in_xdg_folders || selection_contains_starred);
+ (current_directory_tracked || selection_contains_starred);
for (l = selection; l != NULL; l = l->next)
{
NautilusFile *file;
diff --git a/src/nautilus-global-preferences.c b/src/nautilus-global-preferences.c
index 8fc9baadf..0e7e011b6 100644
--- a/src/nautilus-global-preferences.c
+++ b/src/nautilus-global-preferences.c
@@ -41,6 +41,7 @@ GSettings *gtk_filechooser_preferences;
GSettings *gnome_lockdown_preferences;
GSettings *gnome_background_preferences;
GSettings *gnome_interface_preferences;
+GSettings *tracker_preferences;
void
nautilus_global_preferences_init (void)
@@ -65,4 +66,5 @@ nautilus_global_preferences_init (void)
gnome_lockdown_preferences = g_settings_new ("org.gnome.desktop.lockdown");
gnome_background_preferences = g_settings_new ("org.gnome.desktop.background");
gnome_interface_preferences = g_settings_new ("org.gnome.desktop.interface");
+ tracker_preferences = g_settings_new ("org.freedesktop.Tracker.Miner.Files");
}
diff --git a/src/nautilus-global-preferences.h b/src/nautilus-global-preferences.h
index 87a79e706..e7e497e3e 100644
--- a/src/nautilus-global-preferences.h
+++ b/src/nautilus-global-preferences.h
@@ -164,5 +164,6 @@ extern GSettings *gtk_filechooser_preferences;
extern GSettings *gnome_lockdown_preferences;
extern GSettings *gnome_background_preferences;
extern GSettings *gnome_interface_preferences;
+extern GSettings *tracker_preferences;
G_END_DECLS
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c
index 100c7c474..e8a00f27c 100644
--- a/src/nautilus-list-view.c
+++ b/src/nautilus-list-view.c
@@ -54,6 +54,7 @@
#include "nautilus-tree-view-drag-dest.h"
#include "nautilus-ui-utilities.h"
#include "nautilus-view.h"
+#include "nautilus-tracker-utilities.h"
struct SelectionForeachData
{
@@ -2465,20 +2466,18 @@ get_visible_columns (NautilusListView *list_view)
{
NautilusFile *file;
g_autoptr (GList) visible_columns = NULL;
+ g_autoptr (GFile) location = NULL;
GPtrArray *res;
GList *l;
g_autofree gchar *uri = NULL;
- gboolean in_xdg_dirs;
+ gboolean in_tracked_dir;
gboolean is_starred;
file = nautilus_files_view_get_directory_as_file (NAUTILUS_FILES_VIEW (list_view));
uri = nautilus_file_get_uri (file);
- /* FIXME: We are assuming tracker indexes XDG folders and ignore the search
- * setting. This should be fixed in a better way for Nautilus 3.30.
- * See https://gitlab.gnome.org/GNOME/nautilus/issues/243
- */
- in_xdg_dirs = eel_uri_is_in_xdg_dirs (uri);
+ location = g_file_new_for_uri (uri);
+ in_tracked_dir = nautilus_tracker_directory_is_tracked (location);
is_starred = eel_uri_is_starred (uri);
visible_columns = nautilus_file_get_metadata_list (file,
@@ -2492,7 +2491,7 @@ get_visible_columns (NautilusListView *list_view)
for (l = visible_columns; l != NULL; l = l->next)
{
if (g_strcmp0 (l->data, "starred") != 0 ||
- (g_strcmp0 (l->data, "starred") == 0 && (in_xdg_dirs || is_starred)))
+ (g_strcmp0 (l->data, "starred") == 0 && (in_tracked_dir || is_starred)))
{
g_ptr_array_add (res, l->data);
}
diff --git a/src/nautilus-tracker-utilities.c b/src/nautilus-tracker-utilities.c
new file mode 100644
index 000000000..2e9af932d
--- /dev/null
+++ b/src/nautilus-tracker-utilities.c
@@ -0,0 +1,112 @@
+/* nautilus-tracker-utilities.c
+ *
+ * Copyright 2019 Carlos Soriano <csoriano redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#include "nautilus-tracker-utilities.h"
+#include "nautilus-global-preferences.h"
+
+#define TRACKER_KEY_RECURSIVE_DIRECTORIES "index-recursive-directories"
+
+static const gchar *
+path_from_tracker_dir (const gchar *value)
+{
+ const gchar *path;
+
+ if (g_strcmp0 (value, "&DESKTOP") == 0)
+ {
+ path = g_get_user_special_dir (G_USER_DIRECTORY_DESKTOP);
+ }
+ else if (g_strcmp0 (value, "&DOCUMENTS") == 0)
+ {
+ path = g_get_user_special_dir (G_USER_DIRECTORY_DOCUMENTS);
+ }
+ else if (g_strcmp0 (value, "&DOWNLOAD") == 0)
+ {
+ path = g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD);
+ }
+ else if (g_strcmp0 (value, "&MUSIC") == 0)
+ {
+ path = g_get_user_special_dir (G_USER_DIRECTORY_MUSIC);
+ }
+ else if (g_strcmp0 (value, "&PICTURES") == 0)
+ {
+ path = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
+ }
+ else if (g_strcmp0 (value, "&PUBLIC_SHARE") == 0)
+ {
+ path = g_get_user_special_dir (G_USER_DIRECTORY_PUBLIC_SHARE);
+ }
+ else if (g_strcmp0 (value, "&TEMPLATES") == 0)
+ {
+ path = g_get_user_special_dir (G_USER_DIRECTORY_TEMPLATES);
+ }
+ else if (g_strcmp0 (value, "&VIDEOS") == 0)
+ {
+ path = g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS);
+ }
+ else if (g_strcmp0 (value, "$HOME") == 0)
+ {
+ path = g_get_home_dir ();
+ }
+ else
+ {
+ path = value;
+ }
+
+ return path;
+}
+
+static GList *
+get_tracker_locations (void)
+{
+ g_auto (GStrv) locations = NULL;
+ GList *list = NULL;
+ gint idx;
+ GFile *location;
+ const gchar *path;
+
+ locations = g_settings_get_strv (tracker_preferences, TRACKER_KEY_RECURSIVE_DIRECTORIES);
+
+ for (idx = 0; locations[idx] != NULL; idx++)
+ {
+ path = path_from_tracker_dir (locations[idx]);
+ location = g_file_new_for_commandline_arg (path);
+ list = g_list_prepend (list, location);
+ }
+
+ return list;
+}
+
+gboolean
+nautilus_tracker_directory_is_tracked (GFile *directory)
+{
+ g_autolist (GFile) locations = NULL;
+ GList *l;
+
+ locations = get_tracker_locations ();
+ for (l = locations; l != NULL; l = l->next)
+ {
+ if (g_file_equal (directory, G_FILE (l->data)))
+ {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
diff --git a/src/nautilus-tracker-utilities.h b/src/nautilus-tracker-utilities.h
new file mode 100644
index 000000000..f509c3005
--- /dev/null
+++ b/src/nautilus-tracker-utilities.h
@@ -0,0 +1,26 @@
+/* nautilus-tracker-utilities.h
+ *
+ * Copyright 2019 Carlos Soriano <csoriano redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+
+#pragma once
+
+#include <gio/gio.h>
+
+gboolean nautilus_tracker_directory_is_tracked (GFile *directory);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]