-
Notifications
You must be signed in to change notification settings - Fork 364
Checksummed icons #586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checksummed icons #586
Conversation
g_strcmp0 handles NULL values correctly. This allows to omit NULL pointer checks, which would be otherwise crucial.
|
|
||
| gsize len_expected; | ||
| gsize len_actual; | ||
| gsize pixelstride; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is rowstride an int but pixelstride gsize? Just seemed inconsistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually both should be a gsize or size_t. But the gdk pixbuf requires an int and the GVariant stores an int for the rowstride.
0886f92 to
5748c41
Compare
src/notification.c
Outdated
| if (STR_EMPTY(n->iconname)) | ||
| g_clear_pointer(&n->iconname, g_free); | ||
| if (!n->icon && n->iconname) | ||
| n->icon = icon_get_for_name(n->iconname, &n->icon_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed one here, this call doesn't scale the icon.
EDIT: I think this is a hint to maybe put all the icon parsing in one place to be able to manage them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OMG. Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: I think this is a hint to maybe put all the icon parsing in one place to be able to manage them.
Valid point. This already exists. I just had to use the right function.
5748c41 to
2321084
Compare
Currently, we just skipped the notification comparison, if the notification had a raw icon attached. This is a bit counterintuitive. Calculating a checksum of the raw icon's data is the solution. For that we cache the pixel buffer and introduce a field, which saves the current icon's id. The icon_id may be a path or a hash. So you can compare two notifications by their icon_id field regardless of their icon type by their icon_id field.
2321084 to
6f8b53c
Compare
tsipinakis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Fixes #571