Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
GNOME
gThumb
Commits
e80cbf60
Commit
e80cbf60
authored
Jan 08, 2019
by
Paolo Bacchilega
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show the rating as a sequence of stars
parent
13f17708
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
gthumb/gth-file-data.c
gthumb/gth-file-data.c
+12
-1
gthumb/gth-grid-view.c
gthumb/gth-grid-view.c
+6
-1
No files found.
gthumb/gth-file-data.c
View file @
e80cbf60
...
...
@@ -534,7 +534,18 @@ gth_file_data_get_attribute_as_string (GthFileData *file_data,
if
(
GTH_IS_METADATA
(
obj
))
{
switch
(
gth_metadata_get_data_type
(
GTH_METADATA
(
obj
)))
{
case
GTH_METADATA_TYPE_STRING
:
value
=
g_strdup
(
gth_metadata_get_formatted
(
GTH_METADATA
(
obj
)));
if
(
strcmp
(
id
,
"general::rating"
)
==
0
)
{
int
n
=
atoi
(
gth_metadata_get_formatted
(
GTH_METADATA
(
obj
)));
if
((
n
>=
0
)
&&
(
n
<=
5
))
{
GString
*
str
=
g_string_new
(
""
);
int
i
;
for
(
i
=
1
;
i
<=
n
;
i
++
)
g_string_append
(
str
,
"⭐"
);
value
=
g_string_free
(
str
,
FALSE
);
}
}
if
(
value
==
NULL
)
value
=
g_strdup
(
gth_metadata_get_formatted
(
GTH_METADATA
(
obj
)));
break
;
case
GTH_METADATA_TYPE_STRING_LIST
:
value
=
gth_string_list_join
(
GTH_STRING_LIST
(
gth_metadata_get_string_list
(
GTH_METADATA
(
obj
))),
" "
);
...
...
gthumb/gth-grid-view.c
View file @
e80cbf60
...
...
@@ -298,6 +298,7 @@ gth_grid_view_item_update_caption (GthGridViewItem *item,
value
=
gth_file_data_get_attribute_as_string
(
item
->
file_data
,
attributes_v
[
i
]);
if
((
value
!=
NULL
)
&&
!
g_str_equal
(
value
,
""
))
{
char
*
escaped
;
char
*
style
;
if
(
metadata
->
len
>
0
)
g_string_append
(
metadata
,
"
\n
"
);
...
...
@@ -313,7 +314,11 @@ gth_grid_view_item_update_caption (GthGridViewItem *item,
}
escaped
=
g_markup_escape_text
(
value
,
-
1
);
g_string_append_printf
(
metadata
,
"<span%s>%s</span>"
,
(
odd
?
ODD_ROW_ATTR_STYLE
:
EVEN_ROW_ATTR_STYLE
),
escaped
);
if
(
strcmp
(
attributes_v
[
i
],
"general::rating"
)
==
0
)
style
=
""
;
else
style
=
(
odd
?
ODD_ROW_ATTR_STYLE
:
EVEN_ROW_ATTR_STYLE
);
g_string_append_printf
(
metadata
,
"<span%s>%s</span>"
,
style
,
escaped
);
g_free
(
escaped
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment