Fixes in "printers@cinnamon.org"#13524
Fixes in "printers@cinnamon.org"#13524hans-fritz-pommes wants to merge 6 commits intolinuxmint:masterfrom
Conversation
|
Oh and I changed icons. If you think they're ugly, just revert it |
|
I have an idea how to fix this mini-problem (identical bytes & job-number). But later |
Fix mini-problem (See linuxmint#13524)
|
Ok, now the identical bytes/document-name & job-number-problem is fixed. |
|
Sorry that I'm so chaotic |
Support filenames with whitespaces
| function formatBytes(bytesStr) { | ||
| const bytes = parseInt(bytesStr, 10); | ||
| if (isNaN(bytes) || bytes === 0) return "0 Bytes"; | ||
|
|
||
| const k = 1024; | ||
| const sizes = ["Bytes", "KB", "MB", "GB", "TB"]; | ||
| const i = Math.floor(Math.log(bytes) / Math.log(k)); | ||
| const value = bytes / Math.pow(k, i); | ||
|
|
||
| return value.toLocaleString(undefined, { | ||
| minimumFractionDigits: 1, | ||
| maximumFractionDigits: 1 | ||
| }) + " " + sizes[i]; | ||
| } |
There was a problem hiding this comment.
Consider using GLib.format_size() or GLib.format_size_full() instead here
| let size = formatBytes(jobInfo[job][3]); | ||
|
|
||
| if(doc.length > 30) { | ||
| doc = doc + '...'; |
There was a problem hiding this comment.
This isn't part of your changes, but maybe fix this - it detects a long string but doesn't actually shorten it before adding ellipses.
| } | ||
|
|
||
| let text = '(' + job + ') ' + _("'%s' on %s").format(doc, printer); | ||
| text = text + ' (' + size + ')' + _(" - by %s").format(user); |
There was a problem hiding this comment.
Can't this be a single translatable string?
# Translators: strings are job #, document name, printer name, size, username
# example: (23) 'test-doc.md' on HP_Smart_Tank_5100_series (44.0 KB) - by mtwebster
text = "(%s) '%s' on %s (%s) - by %s".format(job, doc, printer, size, user);
When 'Translators' is detected, these comments are included in the potfile to aid in translations
Best-practices scannerThis is a regex-based check for API usage that can pose security, performance or This check is not perfect will not replace a normal review.Found 1 potential issue(s):
|
Improved with mtwebsters ideas (linuxmint#13524)
Best-practices scannerThis is a regex-based check for API usage that can pose security, performance or This check is not perfect will not replace a normal review.Found 1 potential issue(s):
|
What should be done with that? |
|
Please squash the commits into one. |
What it suggests - use an arrow function instead of using Lang.bind(). Look at other applets, it's a pretty straightforward change. |
removed deprecated lang.bind
|
By the way: |
I encountered several small issues with the printers applet.
I modified the
applet.jsin/usr/share/cinnamon/applets/printers@cinnamon.organd tested printing documents.The things I did correct:
cancel -afor a specific printer, even if all of the jobs on this printer belonged to him.-> Now the "Cancel all jobs" command tries to cancel every single job, not
cancel -afor every printer(job number) lpstat -o(lpstat several times, if there was more than one job - see point before)-> The description is now:
(job number) 'document_name' on <printer_name> (<size in Bytes/MB/KB>) by <user>(using lpq -a).The following problem could occur:If a job has the same number as byte-size like the job-id of the following one, the username and the filesize of the first one will be strange (job-id and functions stay working).I would say this will happen that seldom - we should ignore it.Which user will open the menu exactly in that minute and have a problem with a strange username or filesize?EDIT: fixed in new commit