[Xfce4-commits] <tumbler:master> Fix location matching and titles starting with a year.
Nick Schermer
noreply at xfce.org
Thu Dec 27 11:30:04 CET 2012
Updating branch refs/heads/master
to 1846f6c958bb50707ded2ef9e12072efa0116b5b (commit)
from 72a8b6ad2af67a2455ac0da78a9304138a35c429 (commit)
commit 1846f6c958bb50707ded2ef9e12072efa0116b5b
Author: Nick Schermer <nick at xfce.org>
Date: Tue Dec 11 22:30:11 2012 +0100
Fix location matching and titles starting with a year.
plugins/cover-thumbnailer/cover-thumbnailer.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/plugins/cover-thumbnailer/cover-thumbnailer.c b/plugins/cover-thumbnailer/cover-thumbnailer.c
index 6120dc4..ab822e8 100644
--- a/plugins/cover-thumbnailer/cover-thumbnailer.c
+++ b/plugins/cover-thumbnailer/cover-thumbnailer.c
@@ -442,6 +442,7 @@ cover_thumbnailer_get_title (CoverThumbnailer *cover,
gboolean append_space;
gunichar uchar;
gboolean succeed;
+ gchar *temp;
g_return_val_if_fail (G_IS_FILE (gfile), FALSE);
g_return_val_if_fail (ret_title != NULL, FALSE);
@@ -470,11 +471,21 @@ cover_thumbnailer_get_title (CoverThumbnailer *cover,
{
/* store year and remove the suffix from the title */
if (g_match_info_fetch_pos (match_info, 0, &start_pos, &end_pos)
- && start_pos > 0
+ && start_pos >= 0
&& end_pos > start_pos)
{
year = g_strndup (basename + start_pos, end_pos - start_pos);
- basename[start_pos] = '\0';
+
+ if (start_pos == 0)
+ {
+ temp = g_strdup (basename + end_pos);
+ g_free (basename);
+ basename = temp;
+ }
+ else
+ {
+ basename[start_pos] = '\0';
+ }
}
g_match_info_free (match_info);
}
@@ -633,7 +644,7 @@ cover_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
/* check if file is in allowed destinations */
for (lp = cover->locations; lp != NULL; lp = lp->next)
- if (g_file_has_parent (gfile, lp->data))
+ if (g_file_has_prefix (gfile, lp->data))
break;
if (lp == NULL)
More information about the Xfce4-commits
mailing list