[arch-commits] Commit in xfce4-netload-plugin/repos/extra-x86_64 (5 files)

Evangelos Foutras foutrelis at archlinux.org
Tue Nov 18 21:04:39 UTC 2014


    Date: Tuesday, November 18, 2014 @ 22:04:39
  Author: foutrelis
Revision: 226370

archrelease: copy trunk to extra-x86_64

Added:
  xfce4-netload-plugin/repos/extra-x86_64/0001-Add-argument-as_bits-to-format_byte_humanreadable-fu.patch
    (from rev 226369, xfce4-netload-plugin/trunk/0001-Add-argument-as_bits-to-format_byte_humanreadable-fu.patch)
  xfce4-netload-plugin/repos/extra-x86_64/PKGBUILD
    (from rev 226369, xfce4-netload-plugin/trunk/PKGBUILD)
  xfce4-netload-plugin/repos/extra-x86_64/xfce4-netload-plugin.install
    (from rev 226369, xfce4-netload-plugin/trunk/xfce4-netload-plugin.install)
Deleted:
  xfce4-netload-plugin/repos/extra-x86_64/PKGBUILD
  xfce4-netload-plugin/repos/extra-x86_64/xfce4-netload-plugin.install

-----------------------------------------------------------------+
 0001-Add-argument-as_bits-to-format_byte_humanreadable-fu.patch |  147 ++++++++++
 PKGBUILD                                                        |   81 +++--
 xfce4-netload-plugin.install                                    |   26 -
 3 files changed, 205 insertions(+), 49 deletions(-)

Copied: xfce4-netload-plugin/repos/extra-x86_64/0001-Add-argument-as_bits-to-format_byte_humanreadable-fu.patch (from rev 226369, xfce4-netload-plugin/trunk/0001-Add-argument-as_bits-to-format_byte_humanreadable-fu.patch)
===================================================================
--- 0001-Add-argument-as_bits-to-format_byte_humanreadable-fu.patch	                        (rev 0)
+++ 0001-Add-argument-as_bits-to-format_byte_humanreadable-fu.patch	2014-11-18 21:04:39 UTC (rev 226370)
@@ -0,0 +1,147 @@
+From 2e2d905b28d31c6065183ee7a52d238f0be410f5 Mon Sep 17 00:00:00 2001
+From: Mike Massonnet <m8t at gandi.net>
+Date: Sat, 15 Nov 2014 23:27:36 +0100
+Subject: [PATCH] Add argument as_bits to format_byte_humanreadable function
+
+---
+ panel-plugin/commandline.c |  6 +++---
+ panel-plugin/netload.c     |  7 ++++---
+ panel-plugin/utils.c       | 25 +++++++++++++++++--------
+ panel-plugin/utils.h       |  4 +++-
+ 4 files changed, 27 insertions(+), 15 deletions(-)
+
+diff --git a/panel-plugin/commandline.c b/panel-plugin/commandline.c
+index 5624845..8dfb4fb 100644
+--- a/panel-plugin/commandline.c
++++ b/panel-plugin/commandline.c
+@@ -73,9 +73,9 @@ int main(int argc, char* argv[])
+     for (;;)
+     {
+         get_current_netload(&data, &in, &out, &tot);
+-        format_byte_humanreadable(bufIn, 20, (double)in, 0);
+-        format_byte_humanreadable(bufOut, 20, (double)out, 0);
+-        format_byte_humanreadable(bufTot, 20, (double)tot, 0);
++        format_byte_humanreadable(bufIn, 20, (double)in, 0, FALSE);
++        format_byte_humanreadable(bufOut, 20, (double)out, 0, FALSE);
++        format_byte_humanreadable(bufTot, 20, (double)tot, 0, FALSE);
+         printf("Current netload:\nIN : %s\nOUT: %s\nTOT: %s\nIP: %s\n", 
+             bufIn, bufOut, bufTot, get_ip_address(&data));
+         sleep(1);
+diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c
+index 79d6bdb..990a75d 100644
+--- a/panel-plugin/netload.c
++++ b/panel-plugin/netload.c
+@@ -27,6 +27,7 @@
+ #include "utils.h"
+ #include "global.h"
+ 
++#include <glib.h>
+ #include <gtk/gtk.h>
+ 
+ #include <libxfce4util/libxfce4util.h>
+@@ -240,11 +241,11 @@ static gboolean update_monitors(t_global_monitor *global)
+         if (global->monitor->options.show_bars)
+             gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(global->monitor->status[i]), temp);
+ 
+-        format_byte_humanreadable( buffer[i], BUFSIZ - 1, display[i], 2 );
+-        format_byte_humanreadable( buffer_panel[i], BUFSIZ - 1, display[i], 2 );
++        format_byte_humanreadable( buffer[i], BUFSIZ - 1, display[i], 2, FALSE );
++        format_byte_humanreadable( buffer_panel[i], BUFSIZ - 1, display[i], 2, FALSE );
+     }
+     
+-    format_byte_humanreadable( buffer[TOT], BUFSIZ - 1, (display[IN]+display[OUT]), 2 );
++    format_byte_humanreadable( buffer[TOT], BUFSIZ - 1, (display[IN]+display[OUT]), 2, FALSE );
+     
+     {
+         char* ip = get_ip_address(&(global->monitor->data));
+diff --git a/panel-plugin/utils.c b/panel-plugin/utils.c
+index c2824ba..c262f87 100644
+--- a/panel-plugin/utils.c
++++ b/panel-plugin/utils.c
+@@ -70,19 +70,28 @@ unsigned long max_array( unsigned long array[], int size )
+ 
+ 
+ /* ---------------------------------------------------------------------------------------------- */
+-char* format_byte_humanreadable(char* string, int stringsize, double number, int digits)
++char* format_byte_humanreadable(char* string, int stringsize, double number, int digits, gboolean as_bits)
+ {
+     char* str = string;
+     char buffer[BUFSIZ], formatstring[BUFSIZ];
+     char* bufptr = buffer;
+     char* unit_names[] = { N_("B"), N_("KiB"), N_("MiB"), N_("GiB") };
++    char* unit_names_bits[] = { N_("bps"), N_("Kbps"), N_("Mbps"), N_("Gbps") };
+     unsigned int uidx = 0;
+-    double number_displayed = number / 1024.0;
++    double number_displayed = 0;
++    double thousand_divider = as_bits ? 1000 : 1024;
+     unsigned int i;
+     int numberOfIntegerChars, count;
+     struct lconv* localeinfo = localeconv();
+     int grouping = (int)localeinfo->grouping[0] == 0 ? INT_MAX : (int)localeinfo->grouping[0];
+     
++    /* Start with kilo and adapt to bits values*/
++    uidx = 1;
++    number_displayed = number / thousand_divider;
++    if (as_bits)
++    {
++        number_displayed *= 8;
++    }
+     
+     /* sensible value for digits */
+     if (digits < 0 || digits >= 10)
+@@ -90,16 +99,16 @@ char* format_byte_humanreadable(char* string, int stringsize, double number, int
+         digits = 2;
+     }
+     
+-    /* no digits for values under MiB/s unit size */
+-    if (number < 1024.0 * 1024.0)
++    /* 1 digit for values above MiB/s unit size */
++    if (digits > 1 && number_displayed > thousand_divider * thousand_divider)
+     {
+-        digits = 0;
++        digits = 1;
+     }
+ 
+     /* calculate number and appropriate unit size for display */
+-    while(number_displayed >= 1024.0 && uidx < (sizeof(unit_names) / sizeof(char*) - 1))
++    while(number_displayed >= thousand_divider && uidx < (sizeof(unit_names) / sizeof(char*) - 1))
+     {
+-        number_displayed /= 1024.0;
++        number_displayed /= thousand_divider;
+         uidx++;
+     }
+ 
+@@ -148,7 +157,7 @@ char* format_byte_humanreadable(char* string, int stringsize, double number, int
+     *str = 0;
+     
+     /* Add the unit name */
+-    g_strlcat(string, _(unit_names[uidx]), stringsize);
++    g_strlcat(string, as_bits ? _(unit_names_bits[uidx]) : _(unit_names[uidx]), stringsize);
+ 
+     return string;
+ }
+diff --git a/panel-plugin/utils.h b/panel-plugin/utils.h
+index 1da6a9b..749de87 100644
+--- a/panel-plugin/utils.h
++++ b/panel-plugin/utils.h
+@@ -19,6 +19,8 @@
+ #ifndef UTILS_H
+ #define UTILS_H
+ 
++#include <glib.h>
++
+ /**
+  * Formats the number into a number of the appropriate byte unit with
+  * a thousands separator, respecting the current locale. It appends
+@@ -32,7 +34,7 @@
+  * @param   digits      the number of digits after the decimal point
+  * @return  the string to allow concatening buffers or <code>null</code>
+  */
+-char* format_byte_humanreadable( char* string, int stringsize, double number, int digits );
++char* format_byte_humanreadable( char* string, int stringsize, double number, int digits, gboolean as_bits );
+ 
+ /**
+  * Returns the minimum of the array. The array must contain at least one element.
+-- 
+2.1.3
+

Deleted: PKGBUILD
===================================================================
--- PKGBUILD	2014-11-18 21:04:26 UTC (rev 226369)
+++ PKGBUILD	2014-11-18 21:04:39 UTC (rev 226370)
@@ -1,36 +0,0 @@
-# $Id$
-# Maintainer: Evangelos Foutras <evangelos at foutrelis.com>
-# Contributor: Aurelien Foret <orelien at chez.com>
-
-pkgname=xfce4-netload-plugin
-pkgver=1.2.3
-pkgrel=1
-pkgdesc="A netload plugin for the Xfce panel"
-arch=('i686' 'x86_64')
-url="http://goodies.xfce.org/projects/panel-plugins/xfce4-netload-plugin"
-license=('GPL')
-groups=('xfce4-goodies')
-depends=('xfce4-panel')
-makedepends=('intltool')
-install=$pkgname.install
-source=(http://archive.xfce.org/src/panel-plugins/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.bz2)
-sha256sums=('43bd1f291c83143a8a6acbe81f63080da772918c1c9a694793a75b29a2d3ba2c')
-
-build() {
-  cd "$srcdir/$pkgname-$pkgver"
-
-  ./configure \
-    --prefix=/usr \
-    --sysconfdir=/etc \
-    --libexecdir=/usr/lib \
-    --localstatedir=/var \
-    --disable-debug
-  make
-}
-
-package() {
-  cd "$srcdir/$pkgname-$pkgver"
-  make DESTDIR="$pkgdir" install
-}
-
-# vim:set ts=2 sw=2 et:

Copied: xfce4-netload-plugin/repos/extra-x86_64/PKGBUILD (from rev 226369, xfce4-netload-plugin/trunk/PKGBUILD)
===================================================================
--- PKGBUILD	                        (rev 0)
+++ PKGBUILD	2014-11-18 21:04:39 UTC (rev 226370)
@@ -0,0 +1,45 @@
+# $Id$
+# Maintainer: Evangelos Foutras <evangelos at foutrelis.com>
+# Contributor: Aurelien Foret <orelien at chez.com>
+
+pkgname=xfce4-netload-plugin
+pkgver=1.2.3
+pkgrel=2
+pkgdesc="A netload plugin for the Xfce panel"
+arch=('i686' 'x86_64')
+url="http://goodies.xfce.org/projects/panel-plugins/xfce4-netload-plugin"
+license=('GPL')
+groups=('xfce4-goodies')
+depends=('xfce4-panel')
+makedepends=('intltool')
+install=$pkgname.install
+source=(http://archive.xfce.org/src/panel-plugins/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.bz2
+        0001-Add-argument-as_bits-to-format_byte_humanreadable-fu.patch)
+sha256sums=('43bd1f291c83143a8a6acbe81f63080da772918c1c9a694793a75b29a2d3ba2c'
+            '0ac37c6091544a2807090d07c6ca7775ef598ab20292891b80f769650ec2cd6e')
+
+prepare() {
+  cd "$srcdir/$pkgname-$pkgver"
+
+  # https://bugs.archlinux.org/task/42834
+  patch -Np1 -i ../0001-Add-argument-as_bits-to-format_byte_humanreadable-fu.patch
+}
+
+build() {
+  cd "$srcdir/$pkgname-$pkgver"
+
+  ./configure \
+    --prefix=/usr \
+    --sysconfdir=/etc \
+    --libexecdir=/usr/lib \
+    --localstatedir=/var \
+    --disable-debug
+  make
+}
+
+package() {
+  cd "$srcdir/$pkgname-$pkgver"
+  make DESTDIR="$pkgdir" install
+}
+
+# vim:set ts=2 sw=2 et:

Deleted: xfce4-netload-plugin.install
===================================================================
--- xfce4-netload-plugin.install	2014-11-18 21:04:26 UTC (rev 226369)
+++ xfce4-netload-plugin.install	2014-11-18 21:04:39 UTC (rev 226370)
@@ -1,13 +0,0 @@
-post_install() {
-  gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
-}
-
-post_upgrade() {
-  post_install
-}
-
-post_remove() {
-  post_install
-}
-
-# vim:set ts=2 sw=2 et:

Copied: xfce4-netload-plugin/repos/extra-x86_64/xfce4-netload-plugin.install (from rev 226369, xfce4-netload-plugin/trunk/xfce4-netload-plugin.install)
===================================================================
--- xfce4-netload-plugin.install	                        (rev 0)
+++ xfce4-netload-plugin.install	2014-11-18 21:04:39 UTC (rev 226370)
@@ -0,0 +1,13 @@
+post_install() {
+  gtk-update-icon-cache -q -t -f usr/share/icons/hicolor
+}
+
+post_upgrade() {
+  post_install
+}
+
+post_remove() {
+  post_install
+}
+
+# vim:set ts=2 sw=2 et:


More information about the arch-commits mailing list