[shotwell] Include matching folder names for keyword search: Closes bgo#722756
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell] Include matching folder names for keyword search: Closes bgo#722756
- Date: Wed, 5 Feb 2014 01:39:01 +0000 (UTC)
commit 51f04e9c1f9c8605a9945a63d93681823fc39c50
Author: ritchiew <rawilson52 gmail com>
Date: Tue Feb 4 17:38:00 2014 -0800
Include matching folder names for keyword search: Closes bgo#722756
Photos in the library match on their folder names up to the library
root. Photos outside the library match only on their folder name.
THANKS | 1 +
src/MediaDataRepresentation.vala | 18 +++++++++++++++++-
2 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/THANKS b/THANKS
index c609bc5..64b3ef2 100644
--- a/THANKS
+++ b/THANKS
@@ -57,6 +57,7 @@ Norbert Preining <preining logic at>
Nikola Radovanovic <nrad eunet rs>
Tobias Rapp <yahuxo gmx de>
Louis-Francis Ratté-Boulianne <louis-francis ratte-boulianne com>
+ritchiew <rawilson52 gmail com>
Martin Robinson <martin james robinson gmail com>
Laurent Rocher <rocher laurent gmail com>
Alexandre Rosenfeld <alexandre rosenfeld gmail com>
diff --git a/src/MediaDataRepresentation.vala b/src/MediaDataRepresentation.vala
index 6a54718..21b4a63 100644
--- a/src/MediaDataRepresentation.vala
+++ b/src/MediaDataRepresentation.vala
@@ -80,10 +80,11 @@ public abstract class MediaSource : ThumbnailSource, Indexable {
}
private void update_indexable_keywords() {
- string[] indexables = new string[3];
+ string[] indexables = new string[4];
indexables[0] = get_title();
indexables[1] = get_basename();
indexables[2] = get_comment();
+ indexables[3] = get_keywords_from_path();
indexable_keywords = prepare_indexable_strings(indexables);
}
@@ -148,6 +149,21 @@ public abstract class MediaSource : ThumbnailSource, Indexable {
return get_file().get_basename();
}
+ // If in library, match anywhere along the library's children directories, otherwise
+ // only match against the photo's parent directory
+ public string get_keywords_from_path(){
+ File parent = get_master_file().get_parent();
+ string path_keywords = parent.get_basename();
+ if (AppDirs.is_in_import_dir(get_file())){
+ parent = parent.get_parent();
+ while(!parent.equal(AppDirs.get_import_dir())){
+ path_keywords += " " + parent.get_basename();
+ parent = parent.get_parent();
+ }
+ }
+ return path_keywords;
+ }
+
public abstract File get_file();
public abstract File get_master_file();
public abstract uint64 get_master_filesize();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]