! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
[PATCH] xfce4-netload-plugin: Format byte numbers to human-readable sizes
Status:
CLOSED: FIXED
Severity:
enhancement
Product:
Xfce4-netload-plugin
Component:
General

Comments

Description Harald Judt 2011-12-27 17:50:05 CET
Created attachment 4049 
Change function format_with_thousandssep into format_byte_humanreadable.

These are follow-up patches to bug 7804.

They format numbers not only into formats with thousand separators, but also with byte size units. This way, they take less space in the panel and it will become more predictable how much space will be needed for display.

We can set the label char width from 13 to 10 now.
Comment 1 Harald Judt 2011-12-27 17:50:36 CET
Created attachment 4050 
This updates the german translation.
Comment 2 Ivan Romanov 2011-12-27 18:18:32 CET
#: ../panel-plugin/netload.c:820
msgid "Show bars"
msgstr "Balken anzeigen"

Anyway I think it is part of show-values.patch
Comment 3 Harald Judt 2011-12-28 14:45:39 CET
Created attachment 4052 
Change unit in options dialog accordingly.
Comment 4 Mike Massonnet editbugs 2012-01-07 15:34:28 CET
Attachment 4049  doesn't apply against git properly anymore.

 || mike@devian:~/xfce/goodies-qa/xfce4-netload-plugin$ git apply < 005-format-units.patch 
 || error: patch failed: panel-plugin/netload.c:231
 || error: panel-plugin/netload.c: patch does not apply
Comment 5 Harald Judt 2012-01-07 17:18:12 CET
Created attachment 4088 
Change function format_with_thousandssep into format_byte_humanreadable.

No problem, this one should work.

BTW: For the translation of unit strings I used gettext(), no change here. However, I wonder why I can use N_() or _() in other parts of the code but not in utils.c. I seem to have missed something, maybe you can enlighten me?
Comment 6 Mike Massonnet editbugs 2012-01-08 14:10:13 CET
(In reply to comment #5)
> Created attachment 4088 
> Change function format_with_thousandssep into format_byte_humanreadable.
> 
> No problem, this one should work.

I units over GiB since they don't make sense (even GiB doesn't make sense, but this one is used for tolerance).

I also changed the strcat call to strlcat in order to not exceed the maximum size of the variable 'string'.

> BTW: For the translation of unit strings I used gettext(), no change here.
> However, I wonder why I can use N_() or _() in other parts of the code but not
> in utils.c. I seem to have missed something, maybe you can enlighten me?

http://developer.gnome.org/glib/stable/glib-I18N.html#N-:CAPS

This function doesn't use gettext and actually returns a simple string, but is needed to mark the string in the translation files.

The file units.c needed to include the header file <glib/gi18n.h>.
Comment 7 Mike Massonnet editbugs 2012-01-08 14:11:06 CET
Pushed in git master.
6256c6c..e7f6355
Comment 8 Harald Judt 2012-01-08 15:27:29 CET
Ok, thanks for the corrections and information. Could you apply the other patch (attachment 4052 ) too, please?
Comment 9 Mike Massonnet editbugs 2012-01-08 15:35:18 CET
(In reply to comment #8)
> Ok, thanks for the corrections and information. Could you apply the other patch
> (attachment 4052 ) too, please?

Done.

Bug #8280

Reported by:
Harald Judt
Reported on: 2011-12-27
Last modified on: 2012-01-13

People

Assignee:
Florian Rivoal
CC List:
2 users

Version

Attachments

Additional information