Skip to content
Commits on Source (7)
commit e0a516cbc85438a196db681b8003e06e8d294c47
Author: Andre Miranda <andre42m@gmail.com>
Date: Sun Jun 30 06:34:13 2019 +0200
I18n: Update translation pt_BR (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit 687219e7f7e35b70a80a7fb2b38bdc3a75d5af8b
Author: Michael Martins <michaelfm21@gmail.com>
Date: Fri Jun 28 00:31:32 2019 +0200
I18n: Update translation pt_BR (97%).
37 translated messages, 1 untranslated message.
Transifex (https://www.transifex.com/xfce/public/).
commit 3d0d50d11ffd40d9b3a20e2704357455ee684c55
Author: Robert Antoni Buj Gelonch <rbuj@fedoraproject.org>
Date: Thu Jun 27 18:32:39 2019 +0200
I18n: Update translation ca (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit 3cd5da158e0b832c41d5115d19d05ff430e0b9ed
Author: Zmicer Turok <nashtlumach@gmail.com>
Date: Thu Jun 27 18:32:39 2019 +0200
I18n: Update translation be (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit 8831558312d609c75f26d527a5c9f3d49b99dfd8
Author: Andreas Eitel <github-aneitel@online.de>
Date: Thu Jun 27 00:32:08 2019 +0200
I18n: Update translation de (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit 8da394a1c25722ed11820876456fc1adf8b81c56
Author: Daniel Muñiz Fontoira <dani@damufo.com>
Date: Wed Jun 26 12:33:01 2019 +0200
I18n: Update translation gl (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit b0cdb24891894de5f412a00659f52bd78a9e7fcf
Author: abuyop <abuyop@gmail.com>
Date: Wed Jun 26 06:31:34 2019 +0200
I18n: Update translation ms (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit c4ff42a083fb0d37205612fa88678238f37786ee
Author: Anonymous <noreply@xfce.org>
Date: Tue Jun 25 00:31:23 2019 +0200
I18n: Update translation lt (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit 1c5b5b69d766b8a73e402fb58f13a9bc97d06599
Author: Anonymous <noreply@xfce.org>
Date: Mon Jun 24 12:31:43 2019 +0200
I18n: Update translation hu (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit dce73fcb0d8f5b0131d622d041d7227aab17873d
Author: Anonymous <noreply@xfce.org>
Date: Mon Jun 24 12:31:43 2019 +0200
I18n: Update translation es (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit 9ba326e3feb8243170497d92c5bfa217c2d2e61a
Author: 玉堂白鹤 <yjwork@qq.com>
Date: Mon Jun 24 06:31:12 2019 +0200
I18n: Update translation zh_CN (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit e742096512af76414e19ff4edb654ec1e53aefee
Author: Anonymous <noreply@xfce.org>
Date: Mon Jun 24 00:31:22 2019 +0200
I18n: Update translation da (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit 69a5ca670a99c665880b5ef9da497fd79890beee
Author: Jeff Huang <s8321414@gmail.com>
Date: Sun Jun 23 18:31:13 2019 +0200
I18n: Update translation zh_TW (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit 2e18d5490177690860afcc7b297f0fd043d26d93
Author: Igor <f2404@yandex.ru>
Date: Sun Jun 23 18:31:13 2019 +0200
I18n: Update translation ru (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit 1c9320eb5838a6e4711657fa0513f83a62688520
Author: Hugo Carvalho <hugokarvalho@hotmail.com>
Date: Sun Jun 23 18:31:13 2019 +0200
I18n: Update translation pt (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit 45e1482e7a0b8ae9a68607f39f7d757bc80c8aae
Author: Anonymous <noreply@xfce.org>
Date: Sun Jun 23 18:31:13 2019 +0200
I18n: Update translation pl (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit 41172f0152a2995d309cdebbcde5d26a283bd98e
Author: Emanuele Petriglia <transifex@emanuelepetriglia.com>
Date: Sun Jun 23 18:31:13 2019 +0200
I18n: Update translation it (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit d3c2a0f63d9786d07c51f263b00a95a57c6ff7c5
Author: Besnik <besnik@programeshqip.org>
Date: Sun Jun 23 12:31:21 2019 +0200
I18n: Update translation sq (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit 1ada8b1e7fa9e74109905dc2e9c9c9da174ccc28
Author: Pjotr <pjotrvertaalt@gmail.com>
Date: Sun Jun 23 12:31:21 2019 +0200
I18n: Update translation nl (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit fd9af95ea4d6fa35735b679cb310087bf79e8a5c
Author: Edin Veskovic <edin.lockedin@gmail.com>
Date: Sun Jun 23 12:31:20 2019 +0200
I18n: Update translation hr (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit c573add83970807a0309e9fc9b16514ad2055a12
Author: Yannick Le Guen <leguen.yannick@gmail.com>
Date: Sun Jun 23 12:31:20 2019 +0200
I18n: Update translation fr (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit dcc42f395d3ef7e10c837850096f090f6f44167b
Author: Michal Várady <miko.vaji@gmail.com>
Date: Sun Jun 23 12:31:20 2019 +0200
I18n: Update translation cs (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit ca91a55af59af76659b1615fe62d8d5de7fe76b7
Author: Kiril Kirilov <cybercop_montana@abv.bg>
Date: Sun Jun 23 12:31:20 2019 +0200
I18n: Update translation bg (100%).
38 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit bfd3b5f2d65c6a70e0ab7e6f45d2585560c0c377
Author: Andre Miranda <andreldm@xfce.org>
Date: Sat Jun 22 22:09:44 2019 -0300
Updates for release
commit dc8e3dbd28893d309fd7bf86fc0184299bc870f6
Author: Andre Miranda <andreldm@xfce.org>
Date: Sat Jun 22 14:25:19 2019 -0300
Add option to disable the graph (Bug #15163)
commit 739df2586d5d413e0a0e94d7a22018d1175f02ca
Author: Andre Miranda <andreldm@xfce.org>
Date: Sat Jun 22 13:01:25 2019 -0300
Use css to change bar colors (Bug #15186)
commit 0963d604318294e70dcc57664dbdeee7c7994cba
Author: Anonymous <noreply@xfce.org>
Date: Wed Jun 5 00:32:50 2019 +0200
I18n: Add new translation ie (97%).
36 translated messages, 1 untranslated message.
Transifex (https://www.transifex.com/xfce/public/).
commit 7b4e9ebe4652ea6df9b0627e07fa4de86efbe415
Author: Andre Miranda <andreldm@xfce.org>
Date: Sat Jun 1 18:07:09 2019 -0300
Ignore deprecated functions
commit 5c535d2ad2e21e692e6305645d339418032ae336
Author: Andre Miranda <andreldm@xfce.org>
Date: Sat Jun 1 18:04:27 2019 -0300
Fix indentation
commit d68571177251e8a1633d9a8d37cee65251175007
Author: Andre Miranda <andreldm@xfce.org>
Date: Sat Jun 1 16:33:02 2019 -0300
Fix bars in horizontal mode
commit 67c37ffeae78f77b406556076e6c7fa238839f12
Author: Anonymous <noreply@xfce.org>
Date: Sat Jun 1 06:31:17 2019 +0200
I18n: Update translation da (100%).
37 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit 8519435e4c18771cb3d893f2f51ab91633cddeba
Author: Emanuele Petriglia <transifex@emanuelepetriglia.com>
Date: Thu May 30 00:32:19 2019 +0200
I18n: Update translation it (100%).
37 translated messages.
Transifex (https://www.transifex.com/xfce/public/).
commit 9eda4edda9d5a948878f1e015e039367d2827fc7
Author: Besnik <besnik@programeshqip.org>
Date: Wed May 29 18:33:50 2019 +0200
I18n: Update translation sq (97%).
36 translated messages, 1 untranslated message.
Transifex (https://www.transifex.com/xfce/public/).
commit fed99f660495306f65f5fda638dccf86c7bc8af3
Author: Andre Miranda <andreldm@xfce.org>
Date: Tue May 28 23:23:17 2019 -0300
Updates for release
commit b46a04e1cc7df89c6f89ca98118448e33919c2c8
Author: Andre Miranda <andreldm@xfce.org>
Date: Tue May 28 23:22:36 2019 -0300
Update .gitignore
commit c17ddec12a509282d1340bab9708a5e79dd37511
Author: Andre Miranda <andreldm@xfce.org>
Date: Tue May 28 23:21:26 2019 -0300
......
1.1.0 (2/7/2019)
=====
- Updated translations
1.0.91 (22/6/2019)
=====
- Add option to disable the graph (Bug #15163)
- Use css to change bar colors (Bug #15186)
- Fix bars in horizontal mode
- Updated translations
1.0.90 (28/5/2019)
=====
- GTK 3 Port
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for xfce4-cpugraph-plugin 1.0.90.
# Generated by GNU Autoconf 2.69 for xfce4-cpugraph-plugin 1.1.0.
#
# Report bugs to <https://bugzilla.xfce.org/>.
#
......@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='xfce4-cpugraph-plugin'
PACKAGE_TARNAME='xfce4-cpugraph-plugin'
PACKAGE_VERSION='1.0.90'
PACKAGE_STRING='xfce4-cpugraph-plugin 1.0.90'
PACKAGE_VERSION='1.1.0'
PACKAGE_STRING='xfce4-cpugraph-plugin 1.1.0'
PACKAGE_BUGREPORT='https://bugzilla.xfce.org/'
PACKAGE_URL=''
......@@ -1387,7 +1387,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures xfce4-cpugraph-plugin 1.0.90 to adapt to many kinds of systems.
\`configure' configures xfce4-cpugraph-plugin 1.1.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1458,7 +1458,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of xfce4-cpugraph-plugin 1.0.90:";;
short | recursive ) echo "Configuration of xfce4-cpugraph-plugin 1.1.0:";;
esac
cat <<\_ACEOF
......@@ -1583,7 +1583,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
xfce4-cpugraph-plugin configure 1.0.90
xfce4-cpugraph-plugin configure 1.1.0
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by xfce4-cpugraph-plugin $as_me 1.0.90, which was
It was created by xfce4-cpugraph-plugin $as_me 1.1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -3640,7 +3640,7 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
CPUGRAPH_VERSION=1.0.90
CPUGRAPH_VERSION=1.1.0
am__api_version='1.16'
# Find a good install program. We prefer a C program (faster),
......@@ -4187,7 +4187,7 @@ fi
# Define the identity of the package.
PACKAGE='xfce4-cpugraph-plugin'
VERSION='1.0.90'
VERSION='1.1.0'
cat >>confdefs.h <<_ACEOF
......@@ -14137,7 +14137,7 @@ _ACEOF
ALL_LINGUAS="ar ast be bg ca cs da de el en_AU en_GB es eu fi fr gl he hr hu id is it ja kk ko lt lv ms nb nl oc pa pl pt_BR pt ro ru sk sq sr sv th tr ug uk ur_PK ur vi zh_CN zh_TW "
ALL_LINGUAS="ar ast be bg ca cs da de el en_AU en_GB es eu fi fr gl he hr hu id ie is it ja kk ko lt lv ms nb nl oc pa pl pt_BR pt ro ru sk sq sr sv th tr ug uk ur_PK ur vi zh_CN zh_TW "
for ac_header in locale.h
do :
......@@ -15596,7 +15596,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by xfce4-cpugraph-plugin $as_me 1.0.90, which was
This file was extended by xfce4-cpugraph-plugin $as_me 1.1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -15662,7 +15662,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
xfce4-cpugraph-plugin config.status 1.0.90
xfce4-cpugraph-plugin config.status 1.1.0
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
......@@ -10,7 +10,7 @@ dnl
dnl 2004 Alexander Nordfelth <alex.nordfelth@telia.com>
dnl
m4_define([cpugraph_version],[1.0.90])
m4_define([cpugraph_version],[1.1.0])
AC_INIT([xfce4-cpugraph-plugin], [cpugraph_version], [https://bugzilla.xfce.org/])
AC_USE_SYSTEM_EXTENSIONS()
......@@ -41,7 +41,7 @@ XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.12.0])
XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.22.0])
dnl translations
XDT_I18N([ar ast be bg ca cs da de el en_AU en_GB es eu fi fr gl he hr hu id is it ja kk ko lt lv ms nb nl oc pa pl pt_BR pt ro ru sk sq sr sv th tr ug uk ur_PK ur vi zh_CN zh_TW ])
XDT_I18N([ar ast be bg ca cs da de el en_AU en_GB es eu fi fr gl he hr hu id ie is it ja kk ko lt lv ms nb nl oc pa pl pt_BR pt ro ru sk sq sr sv th tr ug uk ur_PK ur vi zh_CN zh_TW ])
dnl Check for debugging support
XDT_FEATURE_DEBUG()
......
xfce4-cpugraph-plugin (1.1.0-1) UNRELEASED; urgency=medium
* New upstream version 1.1.0
* d/compat, d/control:
- Drop d/compat in favor of debhelper-compat, bump to 11.
* d/control: Update build-depends for gtk3.
- libxfce4ui-1-dev → libxfce4ui-2-dev
- xfce4-panel-dev → libxfce4panel-2.0-dev
* d/copyright: Update Format and Upstream-Name fields.
* Update Standards-Version to 4.4.0.
* Trim whitespace from previous changelog entries.
-- Unit 193 <unit193@ubuntu.com> Wed, 10 Jul 2019 01:28:23 -0400
xfce4-cpugraph-plugin (1.0.5-2) unstable; urgency=medium
[ Yves-Alexis Perez ]
......
......@@ -3,12 +3,12 @@ Section: xfce
Priority: optional
Maintainer: Debian Xfce Maintainers <debian-xfce@lists.debian.org>
Uploaders: Yves-Alexis Perez <corsac@debian.org>
Build-Depends: debhelper (>= 10),
Build-Depends: debhelper-compat (= 11),
intltool,
libxfce4ui-1-dev,
xfce4-panel-dev (>= 4.8),
libxfce4panel-2.0-dev,
libxfce4ui-2-dev,
xfce4-dev-tools
Standards-Version: 4.2.1
Standards-Version: 4.4.0
Homepage: https://goodies.xfce.org/
Vcs-Git: https://salsa.debian.org/xfce-team/goodies/xfce4-cpugraph-plugin.git
Vcs-Browser: https://salsa.debian.org/xfce-team/goodies/xfce4-cpugraph-plugin
......
Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
Name: Graphical representation of the CPU load
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: xfce4-cpugraph-plugin
Source: http://archive.xfce.org/src/panel-plugins/xfce4-cpugraph-plugin/
Files: *
......
......@@ -29,6 +29,7 @@ libcpugraph_la_LDFLAGS = \
-export-symbols-regex '^xfce_panel_module_(preinit|init|construct)' \
$(PLATFORM_LDFLAGS)
#
# .desktop file
#
desktop_in_files = cpugraph.desktop.in
......
......@@ -402,6 +402,7 @@ libcpugraph_la_LDFLAGS = \
$(PLATFORM_LDFLAGS)
#
# .desktop file
#
desktop_in_files = cpugraph.desktop.in
......
......@@ -36,22 +36,42 @@ static void cpugraph_construct( XfcePanelPlugin *plugin );
static CPUGraph *create_gui (XfcePanelPlugin *plugin);
static void create_bars (CPUGraph *base);
static guint init_cpu_data (CpuData **data);
static void shutdown( XfcePanelPlugin *plugin, CPUGraph *base );
static void shutdown (XfcePanelPlugin *plugin,
CPUGraph *base);
static void delete_bars (CPUGraph *base);
static gboolean size_cb( XfcePanelPlugin *plugin, guint size, CPUGraph *base );
static void about_cb( XfcePanelPlugin *plugin, CPUGraph *base );
static void set_bars_size( CPUGraph *base, gint size, GtkOrientation orientation );
static void mode_cb( XfcePanelPlugin *plugin, XfcePanelPluginMode mode, CPUGraph *base );
static void set_bars_orientation( CPUGraph *base, GtkOrientation orientation);
static gboolean size_cb (XfcePanelPlugin *plugin,
guint size,
CPUGraph *base);
static void about_cb (XfcePanelPlugin *plugin,
CPUGraph *base);
static void set_bars_size (CPUGraph *base,
gint size,
GtkOrientation orientation);
static void mode_cb (XfcePanelPlugin *plugin,
XfcePanelPluginMode mode,
CPUGraph *base);
static void set_bars_color (CPUGraph *base);
static void set_bars_orientation (CPUGraph *base,
GtkOrientation orientation);
static gboolean update_cb (CPUGraph *base);
static void update_tooltip (CPUGraph *base);
static gboolean tooltip_cb( GtkWidget *widget, gint x, gint y, gboolean keyboard, GtkTooltip * tooltip, CPUGraph *base);
static void draw_area_cb( GtkWidget *w, cairo_t *cr, gpointer data );
static gboolean command_cb( GtkWidget *w, GdkEventButton *event, CPUGraph *base );
static gboolean tooltip_cb (GtkWidget *widget,
gint x,
gint y,
gboolean keyboard,
GtkTooltip *tooltip,
CPUGraph *base);
static void draw_area_cb (GtkWidget *w,
cairo_t *cr,
gpointer data);
static gboolean command_cb (GtkWidget *w,
GdkEventButton *event,
CPUGraph *base);
XFCE_PANEL_PLUGIN_REGISTER (cpugraph_construct);
static void cpugraph_construct( XfcePanelPlugin *plugin )
static void
cpugraph_construct (XfcePanelPlugin *plugin)
{
CPUGraph *base;
......@@ -71,7 +91,8 @@ static void cpugraph_construct( XfcePanelPlugin *plugin )
g_signal_connect (plugin, "mode-changed", G_CALLBACK (mode_cb), base);
}
static CPUGraph * create_gui( XfcePanelPlugin * plugin )
static CPUGraph *
create_gui (XfcePanelPlugin *plugin)
{
GtkWidget *frame, *ebox;
GtkOrientation orientation;
......@@ -112,6 +133,13 @@ static CPUGraph * create_gui( XfcePanelPlugin * plugin )
base->tooltip_text = gtk_label_new (NULL);
g_object_ref (base->tooltip_text);
base->css_provider = gtk_css_provider_new ();
gtk_style_context_add_provider_for_screen (
gtk_widget_get_screen (GTK_WIDGET (plugin)),
GTK_STYLE_PROVIDER (base->css_provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (base->css_provider);
return base;
}
......@@ -138,11 +166,14 @@ about_cb( XfcePanelPlugin *plugin, CPUGraph *base )
g_object_unref (G_OBJECT (icon));
}
static guint nb_bars( CPUGraph * base )
static guint
nb_bars (CPUGraph *base)
{
return base->tracked_core == 0 ? base->nr_cores : 1;
}
static void create_bars( CPUGraph *base )
static void
create_bars (CPUGraph *base)
{
guint i;
guint n;
......@@ -152,18 +183,17 @@ static void create_bars( CPUGraph *base )
for (i = 0; i < n; i++)
{
base->bars[i] = GTK_WIDGET (gtk_progress_bar_new ());
/* Set bar colors */
if (base->has_barcolor) {
gtk_widget_override_background_color(base->bars[i], GTK_STATE_PRELIGHT, &base->colors[4]);
gtk_widget_override_background_color(base->bars[i], GTK_STATE_SELECTED, &base->colors[4]);
gtk_widget_override_color(base->bars[i], GTK_STATE_SELECTED, &base->colors[4]);
}
gtk_box_pack_end (GTK_BOX (base->box), base->bars[i], FALSE, FALSE, 0);
gtk_widget_show (base->bars[i]);
}
if (base->has_barcolor) {
set_bars_color (base);
}
}
guint init_cpu_data( CpuData **data )
guint
init_cpu_data (CpuData **data)
{
guint cpuNr;
......@@ -176,7 +206,8 @@ guint init_cpu_data( CpuData **data )
return cpuNr;
}
static void shutdown( XfcePanelPlugin * plugin, CPUGraph * base )
static void
shutdown (XfcePanelPlugin *plugin, CPUGraph *base)
{
g_free (base->cpu_data);
delete_bars (base);
......@@ -189,7 +220,8 @@ static void shutdown( XfcePanelPlugin * plugin, CPUGraph * base )
g_free (base);
}
static void delete_bars( CPUGraph *base )
static void
delete_bars (CPUGraph *base)
{
guint i;
guint n;
......@@ -206,7 +238,8 @@ static void delete_bars( CPUGraph *base )
}
}
static gboolean size_cb( XfcePanelPlugin *plugin, guint size, CPUGraph *base )
static gboolean
size_cb (XfcePanelPlugin *plugin, guint size, CPUGraph *base)
{
gint frame_h, frame_v, history;
GtkOrientation orientation;
......@@ -240,11 +273,13 @@ static gboolean size_cb( XfcePanelPlugin *plugin, guint size, CPUGraph *base )
return TRUE;
}
static void set_bars_size( CPUGraph *base, gint size, GtkOrientation orientation )
static void
set_bars_size (CPUGraph *base, gint size, GtkOrientation orientation)
{
guint i;
guint n;
gint h, v;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
{
h = 8;
......@@ -255,17 +290,20 @@ static void set_bars_size( CPUGraph *base, gint size, GtkOrientation orientation
h = -1;
v = 8;
}
n = nb_bars (base);
for (i = 0; i < n ; i++)
gtk_widget_set_size_request (GTK_WIDGET (base->bars[i]), h, v);
}
static void mode_cb( XfcePanelPlugin * plugin, XfcePanelPluginMode mode, CPUGraph *base )
static void
mode_cb (XfcePanelPlugin *plugin, XfcePanelPluginMode mode, CPUGraph *base)
{
GtkOrientation orientation = (mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL) ?
GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
gtk_orientable_set_orientation( GTK_ORIENTABLE( base->box ), xfce_panel_plugin_get_orientation (plugin));
gtk_orientable_set_orientation (GTK_ORIENTABLE (base->box),
xfce_panel_plugin_get_orientation (plugin));
if (base->has_bars)
set_bars_orientation (base, orientation);
......@@ -273,7 +311,23 @@ static void mode_cb( XfcePanelPlugin * plugin, XfcePanelPluginMode mode, CPUGrap
size_cb (plugin, xfce_panel_plugin_get_size (base->plugin), base);
}
static void set_bars_orientation( CPUGraph *base, GtkOrientation orientation)
static void
set_bars_color (CPUGraph *base)
{
gchar *color = gdk_rgba_to_string (&base->colors[4]);
gchar *css = g_strdup_printf ("progressbar progress { \
background-color: %1$s; \
background-image: none; \
border-color: darker (%1$s)}", color);
gtk_css_provider_load_from_data (base->css_provider, css, strlen(css), NULL);
g_free (color);
g_free (css);
}
static void
set_bars_orientation (CPUGraph *base, GtkOrientation orientation)
{
guint i, n;
......@@ -283,10 +337,15 @@ static void set_bars_orientation( CPUGraph *base, GtkOrientation orientation)
n = nb_bars (base);
for (i = 0; i < n; i++)
{
gtk_orientable_set_orientation (GTK_ORIENTABLE (base->bars[i]), orientation);
gtk_progress_bar_set_inverted (GTK_PROGRESS_BAR (base->bars[i]),
orientation == GTK_ORIENTATION_VERTICAL);
}
}
static gboolean update_cb( CPUGraph * base )
static gboolean
update_cb (CPUGraph *base)
{
gint i, a, b, factor;
......@@ -303,16 +362,20 @@ static gboolean update_cb( CPUGraph * base )
if (base->tracked_core != 0 || base->nr_cores == 1)
{
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (base->bars[0]),
(gdouble)base->cpu_data[0].load / CPU_SCALE
);
(gdouble) base->cpu_data[0].load / CPU_SCALE);
}
else
{
for (i = 0; i < base->nr_cores; i++)
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (base->bars[i]),
(gdouble)base->cpu_data[i+1].load / CPU_SCALE
);
(gdouble) base->cpu_data[i+1].load / CPU_SCALE);
}
}
if (base->mode == -1)
{
/* Disabled mode, skip updating history and drawing the graph */
return TRUE;
}
if (base->non_linear)
......@@ -325,7 +388,8 @@ static gboolean update_cb( CPUGraph * base )
factor = (i * 2);
base->history[i--] = (a * (factor-1) + b) / factor;
}
} else {
}
else {
memmove (base->history + 1 , base->history , (base->history_size - 1) * sizeof (guint));
}
base->history[0] = base->cpu_data[0].load;
......@@ -336,20 +400,23 @@ static gboolean update_cb( CPUGraph * base )
return TRUE;
}
static void update_tooltip( CPUGraph * base )
static void
update_tooltip (CPUGraph *base)
{
gchar tooltip[32];
g_snprintf (tooltip, 32, _("Usage: %u%%"), (guint) base->cpu_data[0].load * 100 / CPU_SCALE);
gtk_label_set_text (GTK_LABEL (base->tooltip_text), tooltip);
}
static gboolean tooltip_cb( GtkWidget *widget, gint x, gint y, gboolean keyboard, GtkTooltip * tooltip, CPUGraph *base)
static gboolean
tooltip_cb (GtkWidget *widget, gint x, gint y, gboolean keyboard, GtkTooltip *tooltip, CPUGraph *base)
{
gtk_tooltip_set_custom (tooltip, base->tooltip_text);
return TRUE;
}
static void draw_area_cb( GtkWidget * widget, cairo_t * cr, gpointer data )
static void
draw_area_cb (GtkWidget *widget, cairo_t *cr, gpointer data)
{
CPUGraph *base = (CPUGraph *) data;
GtkAllocation alloc;
......@@ -380,34 +447,42 @@ static void draw_area_cb( GtkWidget * widget, cairo_t * cr, gpointer data )
}
}
static gboolean command_cb( GtkWidget *w,GdkEventButton *event, CPUGraph *base )
static gboolean
command_cb (GtkWidget *w, GdkEventButton *event, CPUGraph *base)
{
if (event->button == 1 && base->command)
{
xfce_spawn_command_line_on_screen( gdk_screen_get_default(), base->command, base->in_terminal, base->startup_notification, NULL );
xfce_spawn_command_line_on_screen (gdk_screen_get_default (),
base->command, base->in_terminal,
base->startup_notification, NULL);
}
return FALSE;
}
void set_startup_notification( CPUGraph *base, gboolean startup_notification )
void
set_startup_notification (CPUGraph *base, gboolean startup_notification)
{
base->startup_notification = startup_notification;
}
void set_in_terminal( CPUGraph *base, gboolean in_terminal )
void
set_in_terminal (CPUGraph *base, gboolean in_terminal)
{
base->in_terminal = in_terminal;
}
void set_command( CPUGraph *base, const gchar *command )
void
set_command (CPUGraph *base, const gchar *command)
{
g_free (base->command);
base->command = g_strdup (command);
}
void set_bars( CPUGraph * base, gboolean bars)
void
set_bars (CPUGraph *base, gboolean bars)
{
GtkOrientation orientation;
if (base->has_bars != bars)
{
base->has_bars = bars;
......@@ -423,7 +498,8 @@ void set_bars( CPUGraph * base, gboolean bars)
}
}
void set_border( CPUGraph *base, gboolean border )
void
set_border (CPUGraph *base, gboolean border)
{
int border_width = (xfce_panel_plugin_get_size (base->plugin) > 26 ? 2 : 1);
base->has_border = border;
......@@ -432,18 +508,21 @@ void set_border( CPUGraph *base, gboolean border )
gtk_container_set_border_width (GTK_CONTAINER (base->box), border_width);
}
void set_frame( CPUGraph *base, gboolean frame )
void
set_frame (CPUGraph *base, gboolean frame)
{
base->has_frame = frame;
gtk_frame_set_shadow_type (GTK_FRAME (base->frame_widget), base->has_frame ? GTK_SHADOW_IN : GTK_SHADOW_NONE);
}
void set_nonlinear_time( CPUGraph *base, gboolean nonlinear )
void
set_nonlinear_time (CPUGraph *base, gboolean nonlinear)
{
base->non_linear = nonlinear;
}
void set_update_rate( CPUGraph *base, guint rate )
void
set_update_rate (CPUGraph *base, guint rate)
{
guint update;
......@@ -451,6 +530,7 @@ void set_update_rate( CPUGraph *base, guint rate )
if (base->timeout_id)
g_source_remove (base->timeout_id);
switch (base->update_interval)
{
case 0:
......@@ -468,47 +548,60 @@ void set_update_rate( CPUGraph *base, guint rate )
base->timeout_id = g_timeout_add (update, (GSourceFunc) update_cb, base);
}
void set_size( CPUGraph *base, guint size )
void
set_size (CPUGraph *base, guint size)
{
base->size = size;
size_cb (base->plugin, xfce_panel_plugin_get_size (base->plugin), base);
}
void set_color_mode( CPUGraph *base, guint color_mode )
void
set_color_mode (CPUGraph *base, guint color_mode)
{
base->color_mode = color_mode;
}
void set_mode( CPUGraph *base, guint mode )
void
set_mode (CPUGraph *base, guint mode)
{
base->mode = mode;
if (mode == -1)
{
/* 'Disabled' mode, hide graph and clear history */
gtk_widget_hide (base->frame_widget);
for (gint i = 0; i < base->history_size; i++)
base->history[i] = 0;
}
else
{
gtk_widget_show (base->frame_widget);
}
}
void set_color( CPUGraph *base, guint number, GdkRGBA color )
void
set_color (CPUGraph *base, guint number, GdkRGBA color)
{
guint i, n;
base->colors[number] = color;
if (number == 0)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
gtk_widget_override_background_color (base->draw_area, GTK_STATE_INSENSITIVE, &base->colors[0]);
gtk_widget_override_background_color (base->draw_area, GTK_STATE_NORMAL, &base->colors[0]);
G_GNUC_END_IGNORE_DEPRECATIONS
}
if( number == 4 && base->has_bars && base->has_barcolor )
{
n = nb_bars( base );
for( i=0; i< n; i++ )
if (number == 4 && base->has_bars && base->has_barcolor)
{
/* Set bar colors */
gtk_widget_override_background_color(base->bars[i], GTK_STATE_PRELIGHT, &base->colors[4]);
gtk_widget_override_background_color(base->bars[i], GTK_STATE_SELECTED, &base->colors[4]);
gtk_widget_override_color(base->bars[i], GTK_STATE_SELECTED, &base->colors[4]);
}
set_bars_color (base);
}
}
void set_tracked_core( CPUGraph *base, guint core )
void
set_tracked_core (CPUGraph *base, guint core)
{
gboolean has_bars = base->has_bars;
if (has_bars)
......
......@@ -49,7 +49,7 @@ typedef struct
guint update_interval; /* Number of ms between updates. */
gboolean non_linear;
guint size;
guint mode;
gint mode;
guint color_mode;
gboolean has_frame;
gboolean has_border;
......@@ -67,6 +67,7 @@ typedef struct
guint *history;
gssize history_size;
CpuData *cpu_data;
GtkCssProvider *css_provider;
} CPUGraph;
void set_startup_notification (CPUGraph *base, gboolean startup_notification);
......@@ -82,4 +83,5 @@ void set_color_mode( CPUGraph *base, guint color_mode );
void set_mode (CPUGraph *base, guint mode);
void set_color (CPUGraph *base, guint number, GdkRGBA color);
void set_tracked_core (CPUGraph *base, guint core);
#endif /* !_XFCE_CPU_H_ */
......@@ -25,12 +25,20 @@
#include <cairo/cairo.h>
#include "mode.h"
static gdouble _lerp( gdouble t, gdouble a, gdouble b )
typedef struct
{
gint x;
gint y;
} point;
static gdouble
_lerp (gdouble t, gdouble a, gdouble b)
{
return (gdouble) (a + t * (b - a));
}
static void mix_colors( gdouble ratio, GdkRGBA *color1, GdkRGBA *color2, cairo_t *target )
static void
mix_colors (gdouble ratio, GdkRGBA *color1, GdkRGBA *color2, cairo_t *target)
{
GdkRGBA color;
color.red = _lerp (ratio, color1->red, color2->red);
......@@ -40,7 +48,8 @@ static void mix_colors( gdouble ratio, GdkRGBA *color1, GdkRGBA *color2, cairo_t
gdk_cairo_set_source_rgba (target, &color);
}
void draw_graph_normal( CPUGraph *base, cairo_t *cr, gint w, gint h )
void
draw_graph_normal (CPUGraph *base, cairo_t *cr, gint w, gint h)
{
gint x, y;
gint usage;
......@@ -54,7 +63,8 @@ void draw_graph_normal( CPUGraph *base, cairo_t *cr, gint w, gint h )
{
usage = h * base->history[w - 1- x] / CPU_SCALE;
if( usage == 0 ) continue;
if (usage == 0)
continue;
if (base->color_mode == 0)
{
......@@ -83,7 +93,8 @@ void draw_graph_normal( CPUGraph *base, cairo_t *cr, gint w, gint h )
}
}
void draw_graph_LED( CPUGraph *base, cairo_t *cr, gint w, gint h )
void
draw_graph_LED (CPUGraph *base, cairo_t *cr, gint w, gint h)
{
gint nrx = (w + 1) / 3;
gint nry = (h + 1) / 2;
......@@ -95,6 +106,7 @@ void draw_graph_LED( CPUGraph *base, cairo_t *cr, gint w, gint h )
{
idx = nrx - x;
limit = nry - nry * base->history[idx] / CPU_SCALE;
for (y = 0; y * 2 < h; y++)
{
if (base->color_mode != 0 && y < limit)
......@@ -108,6 +120,7 @@ void draw_graph_LED( CPUGraph *base, cairo_t *cr, gint w, gint h )
{
gdk_cairo_set_source_rgba (cr, y >= limit ? &base->colors[1] : &base->colors[2]);
}
/* draw rectangle */
cairo_rectangle (cr, x * 3, y * 2, 2, 1);
cairo_fill (cr);
......@@ -115,7 +128,8 @@ void draw_graph_LED( CPUGraph *base, cairo_t *cr, gint w, gint h )
}
}
void draw_graph_no_history( CPUGraph *base, cairo_t *cr, gint w, gint h )
void
draw_graph_no_history (CPUGraph *base, cairo_t *cr, gint w, gint h)
{
gint y;
gint usage = h * base->history[0] / CPU_SCALE;
......@@ -137,6 +151,7 @@ void draw_graph_no_history( CPUGraph *base, cairo_t *cr, gint w, gint h )
(tmp / (gdouble) (usage));
mix_colors (t, &base->colors[1], &base->colors[2], cr);
tmp++;
/* draw line */
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
cairo_move_to (cr, 0, y);
......@@ -146,13 +161,8 @@ void draw_graph_no_history( CPUGraph *base, cairo_t *cr, gint w, gint h )
}
}
typedef struct
{
gint x;
gint y;
} point;
void draw_graph_grid( CPUGraph *base, cairo_t *cr, gint w, gint h )
void
draw_graph_grid (CPUGraph *base, cairo_t *cr, gint w, gint h)
{
gint x, y;
gint usage;
......@@ -171,6 +181,7 @@ void draw_graph_grid( CPUGraph *base, cairo_t *cr, gint w, gint h )
cairo_line_to (cr, x * 6 + 0.5, h - 1 + 0.5);
cairo_stroke (cr);
}
for (y = 0; y * 4 < h; y++)
{
/* draw line */
......@@ -180,11 +191,13 @@ void draw_graph_grid( CPUGraph *base, cairo_t *cr, gint w, gint h )
}
gdk_cairo_set_source_rgba (cr, &base->colors[2]);
for (x = 0; x < w; x++)
{
usage = h * base->history[w - 1 - x] / CPU_SCALE;
current.x = x;
current.y = h - usage;
/* draw line */
cairo_move_to (cr, current.x + 0.5, current.y + 0.5);
cairo_line_to (cr, last.x + 0.5, last.y + 0.5);
......
......@@ -68,7 +68,8 @@ static kstat_ctl_t *kc;
#endif
#if defined (__linux__) || defined (__FreeBSD_kernel__)
guint detect_cpu_number()
guint
detect_cpu_number ()
{
guint nb_lines= 0;
FILE *fstat = NULL;
......@@ -90,7 +91,8 @@ guint detect_cpu_number()
return nb_lines > 1 ? nb_lines - 1 : 0;
}
gboolean read_cpu_data( CpuData *data, guint nb_cpu )
gboolean
read_cpu_data (CpuData *data, guint nb_cpu)
{
FILE *fStat;
gchar cpuStr[PROCMAXLNLEN];
......@@ -103,16 +105,18 @@ gboolean read_cpu_data( CpuData *data, guint nb_cpu )
for (line = 0; line < nb_cpu + 1; line++)
{
if (!fgets (cpuStr, PROCMAXLNLEN, fStat) ||
strncmp( cpuStr, "cpu", 3 ) != 0
)
strncmp (cpuStr, "cpu", 3) != 0)
{
fclose (fStat);
return FALSE;
}
if (sscanf (cpuStr, "%*s %lu %lu %lu %lu %lu %lu %lu", &user, &nice, &system, &idle, &iowait, &irq, &softirq) < 7)
iowait = irq = softirq = 0;
used = user + nice + system + irq + softirq;
total = used + idle + iowait;
if ((total - data[line].previous_total) != 0)
{
data[line].load = CPU_SCALE * (used - data[line].previous_used) /
......@@ -132,18 +136,21 @@ gboolean read_cpu_data( CpuData *data, guint nb_cpu )
}
#elif defined (__FreeBSD__)
guint detect_cpu_number()
guint
detect_cpu_number ()
{
static gint mib[] = {CTL_HW, HW_NCPU};
gint ncpu;
gsize len = sizeof (gint);
if (sysctl (mib, 2, &ncpu, &len, NULL, 0) < 0)
return 0;
else
return ncpu;
}
gboolean read_cpu_data( CpuData *data, guint nb_cpu)
gboolean
read_cpu_data (CpuData *data, guint nb_cpu)
{
glong used, total;
glong *cp_time;
......@@ -166,13 +173,16 @@ gboolean read_cpu_data( CpuData *data, guint nb_cpu)
g_free (cp_time);
return FALSE;
}
for (i = 1; i <= nb_cpu; i++)
{
cp_time1 = &cp_time[CPUSTATES * (i - 1)];
used = cp_time1[CP_USER] + cp_time1[CP_NICE] + cp_time1[CP_SYS] + cp_time1[CP_INTR];
total = used + cp_time1[CP_IDLE];
if ((total - data[i].previous_total) != 0)
data[i].load = (CPU_SCALE * (used - data[i].previous_used))/(total - data[i].previous_total);
data[i].load = (CPU_SCALE * (used - data[i].previous_used)) /
(total - data[i].previous_total);
else
data[i].load = 0;
......@@ -180,24 +190,28 @@ gboolean read_cpu_data( CpuData *data, guint nb_cpu)
data[i].previous_total = total;
data[0].load += data[i].load;
}
data[0].load /= nb_cpu;
g_free (cp_time);
return TRUE;
}
#elif defined (__NetBSD__)
guint detect_cpu_number()
guint
detect_cpu_number ()
{
static gint mib[] = {CTL_HW, HW_NCPU};
gint ncpu;
gsize len = sizeof (gint);
if (sysctl (mib, 2, &ncpu, &len, NULL, 0) < 0)
return 0;
else
return ncpu;
}
gboolean read_cpu_data( CpuData *data, guint nb_cpu)
gboolean
read_cpu_data (CpuData *data, guint nb_cpu)
{
guint64 used, total;
guint64 cp_time[CPUSTATES * nb_cpu];
......@@ -205,6 +219,7 @@ gboolean read_cpu_data( CpuData *data, guint nb_cpu)
gint i;
gsize len = nb_cpu * CPUSTATES * sizeof (guint64);
gint mib[] = {CTL_KERN, KERN_CP_TIME};
if (sysctl (mib, 2, &cp_time, &len, NULL, 0) < 0)
return FALSE;
......@@ -216,39 +231,47 @@ gboolean read_cpu_data( CpuData *data, guint nb_cpu)
total = used + cp_time1[CP_IDLE];
if (total - data[i].previous_total != 0)
data[i].load = (CPU_SCALE * (used - data[i].previous_used))/(total - data[i].previous_total);
data[i].load = (CPU_SCALE * (used - data[i].previous_used)) /
(total - data[i].previous_total);
else
data[i].load = 0;
data[i].previous_used = used;
data[i].previous_total = total;
data[0].load += data[i].load;
}
data[0].load /= nb_cpu;
return TRUE;
}
#elif defined (__OpenBSD__)
guint detect_cpu_number()
guint
detect_cpu_number ()
{
static gint mib[] = {CTL_HW, HW_NCPU};
gint ncpu;
gsize len = sizeof (gint);
if (sysctl (mib, 2, &ncpu, &len, NULL, 0) < 0)
return 0;
else
return ncpu;
}
gboolean read_cpu_data( CpuData *data, guint nb_cpu)
gboolean
read_cpu_data (CpuData *data, guint nb_cpu)
{
guint64 used, total;
guint64 cp_time[CPUSTATES];
gint i;
data[0].load = 0;
for (i = 1; i <= nb_cpu; i++)
{
gsize len = CPUSTATES * sizeof (guint64);
gint mib[] = {CTL_KERN, KERN_CPTIME2, i - 1};
if (sysctl (mib, 3, &cp_time, &len, NULL, 0) < 0)
return FALSE;
......@@ -256,24 +279,29 @@ gboolean read_cpu_data( CpuData *data, guint nb_cpu)
total = used + cp_time[CP_IDLE];
if (total - data[i].previous_total != 0)
data[i].load = (CPU_SCALE * (used - data[i].previous_used))/(total - data[i].previous_total);
data[i].load = (CPU_SCALE * (used - data[i].previous_used)) /
(total - data[i].previous_total);
else
data[i].load = 0;
data[i].previous_used = used;
data[i].previous_total = total;
data[0].load += data[i].load;
}
data[0].load /= nb_cpu;
return TRUE;
}
#elif defined (__sun__)
static void init_stats()
static void
init_stats ()
{
kc = kstat_open ();
}
guint detect_cpu_number()
guint
detect_cpu_number ()
{
kstat_t *ksp;
kstat_named_t *knp;
......@@ -283,13 +311,15 @@ guint detect_cpu_number()
if (!(ksp = kstat_lookup (kc, "unix", 0, "system_misc")))
return 0;
else
kstat_read (kc, ksp, NULL);
knp = kstat_data_lookup (ksp, "ncpus");
return knp->value.ui32;
}
gboolean read_cpu_data( CpuData *data, guint nb_cpu )
gboolean
read_cpu_data (CpuData *data, guint nb_cpu)
{
kstat_t *ksp;
kstat_named_t *knp;
......@@ -301,6 +331,7 @@ gboolean read_cpu_data( CpuData *data, guint nb_cpu )
init_stats ();
i = 1;
for (ksp = kc->kc_chain; ksp != NULL; ksp = ksp->ks_next)
{
if (!g_strcmp0 (ksp->ks_module, "cpu") && !g_strcmp0 (ksp->ks_name, "sys"))
......@@ -314,10 +345,13 @@ gboolean read_cpu_data( CpuData *data, guint nb_cpu )
used += knp->value.ul;
knp = kstat_data_lookup (ksp, "cpu_nsec_idle");
total = used + knp->value.ul;
if (total - data[i].previous_total != 0)
data[i].load = (CPU_SCALE * (used - data[i].previous_used))/(total - data[i].previous_total);
data[i].load = (CPU_SCALE * (used - data[i].previous_used)) /
(total - data[i].previous_total);
else
data[i].load = 0;
data[i].previous_used = used;
data[i].previous_total = total;
data[0].load += data[i].load;
......