[Pkg-xfce-commits] [Git][xfce-team/goodies/xfce4-cpugraph-plugin][upstream/latest] New upstream version 1.2.6.
Unit 193 (@unit193)
gitlab at salsa.debian.org
Tue Feb 15 19:04:33 GMT 2022
Unit 193 pushed to branch upstream/latest at xfce / goodies / xfce4-cpugraph-plugin
Commits:
1d7e488e by Unit 193 at 2022-02-15T13:57:55-05:00
New upstream version 1.2.6.
- - - - -
29 changed files:
- ChangeLog
- NEWS
- configure
- configure.ac
- panel-plugin/cpu.cc
- panel-plugin/properties.cc
- panel-plugin/settings.cc
- po/da.po
- po/eu.po
- po/he.po
- po/hr.po
- po/id.po
- po/oc.po
- po/pt_BR.po
- po/sl.po
- po/sv.po
- po/zh_CN.po
- xfce4++/util.h
- xfce4++/util/Makefile.am
- xfce4++/util/Makefile.in
- + xfce4++/util/collection-utils.h
- xfce4++/util/fixes.h
- xfce4++/util/gtk.cc
- xfce4++/util/gtk.h
- xfce4++/util/memory.h
- xfce4++/util/rc.cc
- xfce4++/util/rc.h
- xfce4++/util/string-utils.cc
- xfce4++/util/string-utils.h
Changes:
=====================================
ChangeLog
=====================================
@@ -1,3 +1,196 @@
+commit 78fc0d83736724c872c22ccbf4a08d2283eba84f
+Author: Jan Ziak <0xe2.0x9a.0x9b at xfce.org>
+Date: Mon Jan 31 05:59:47 2022 +0100
+
+ Sync xfce4++ with panel-plugins/xfce4-cpufreq-plugin
+
+ This patchset includes fix for issue https://gitlab.xfce.org/panel-plugins/xfce4-cpufreq-plugin/-/issues/16 which also affects the cpugraph plugin.
+
+commit 15701cde523f67de457a10e8bca68d9e3ecbc177
+Author: Jan Ziak <0xe2.0x9a.0x9b at xfce.org>
+Date: Mon Jan 17 05:43:46 2022 +0100
+
+ Sync xfce4++ with panel-plugins/xfce4-sensors-plugin
+
+commit 6b42eca3f355dcc2406be9a9bc7290fc4c61d5d2
+Author: Lucas Wilm <lucaswilm at gmail.com>
+Date: Tue Jan 4 00:51:30 2022 +0100
+
+ I18n: Update translation pt_BR (100%).
+
+ 59 translated messages.
+
+ Transifex (https://www.transifex.com/xfce/public/).
+
+commit 691e310daeecb316c55e987461804aacba6080b9
+Author: Anonymous <noreply at xfce.org>
+Date: Wed Dec 29 12:53:38 2021 +0100
+
+ I18n: Update translation oc (64%).
+
+ 38 translated messages, 21 untranslated messages.
+
+ Transifex (https://www.transifex.com/xfce/public/).
+
+commit f1d7d1ba27c9341aa949f9800fbbceafe20f25c7
+Author: Ivica Kolić <ikoli at yahoo.com>
+Date: Fri Dec 10 12:53:18 2021 +0100
+
+ I18n: Update translation hr (66%).
+
+ 39 translated messages, 20 untranslated messages.
+
+ Transifex (https://www.transifex.com/xfce/public/).
+
+commit db1547a8935f1c2deb8f8849dda1a5dd6c8cd025
+Author: Arve Eriksson <031299870 at telia.com>
+Date: Sun Nov 21 12:52:03 2021 +0100
+
+ I18n: Update translation sv (100%).
+
+ 59 translated messages.
+
+ Transifex (https://www.transifex.com/xfce/public/).
+
+commit ed158bea1bfaabbf93658c0ab84fd93fd28f29d7
+Author: Luna Jernberg <bittin at cafe8bitar.se>
+Date: Thu Nov 18 12:53:24 2021 +0100
+
+ I18n: Update translation sv (98%).
+
+ 58 translated messages, 1 untranslated message.
+
+ Transifex (https://www.transifex.com/xfce/public/).
+
+commit 7ea3fef23e05b9c8c37baeb0b63cb669b91b3492
+Author: Elishai Eliyahu <elishai at mailfence.com>
+Date: Sun Nov 14 00:51:18 2021 +0100
+
+ I18n: Update translation he (100%).
+
+ 59 translated messages.
+
+ Transifex (https://www.transifex.com/xfce/public/).
+
+commit 859ceed28933199151c9f3defa33c146461892f8
+Author: Jan Ziak <0xe2.0x9a.0x9b at xfce.org>
+Date: Wed Nov 10 03:10:50 2021 +0100
+
+ Don't save some defaults to configuration files
+
+commit aa1b20d38ab8d5bad4795dc383a27ea7cd915427
+Author: Jan Ziak <0xe2.0x9a.0x9b at xfce.org>
+Date: Wed Nov 10 03:07:52 2021 +0100
+
+ Fix visibility of the associated-command configuration
+
+commit 17fea442d0b8ac779f08ad150fd1e294a75d74cb
+Author: Jan Ziak <0xe2.0x9a.0x9b at xfce.org>
+Date: Wed Nov 10 02:53:32 2021 +0100
+
+ Sync xfce4++ with panel-plugins/xfce4-sensors-plugin
+
+commit 1bbaba2f0712be9d8cbd84d67acc136d981afdb3
+Author: Jan Ziak <0xe2.0x9a.0x9b at xfce.org>
+Date: Mon Nov 8 21:14:08 2021 +0100
+
+ Sync xfce4++ with panel-plugins/xfce4-sensors-plugin
+
+commit 70954148f0f1bea6a4f9a354363fa8cdec32501f
+Author: Jan Ziak <0xe2.0x9a.0x9b at xfce.org>
+Date: Sat Nov 6 03:05:48 2021 +0100
+
+ Sync xfce4++ with panel-plugins/xfce4-sensors-plugin
+
+commit 5a33de908bbed4c71648e2d60e1614c0959e9923
+Author: Jan Ziak <0xe2.0x9a.0x9b at xfce.org>
+Date: Sun Oct 31 17:36:34 2021 +0100
+
+ Add missing backslash to Makefile.am
+
+commit c2fea752f1d3367a5181fc36df022bde2e5427af
+Author: Anonymous <noreply at xfce.org>
+Date: Sun Oct 31 00:51:27 2021 +0200
+
+ I18n: Update translation eu (100%).
+
+ 59 translated messages.
+
+ Transifex (https://www.transifex.com/xfce/public/).
+
+commit d6784a83ddc508f335ccaa268293471693050f41
+Author: Jan Ziak <0xe2.0x9a.0x9b at xfce.org>
+Date: Fri Oct 29 14:08:44 2021 +0200
+
+ Sync xfce4++ with panel-plugins/xfce4-sensors-plugin
+
+commit 9b594c5b7c1e11612e0aab2a5a78125b308f6ed4
+Author: Jan Ziak <0xe2.0x9a.0x9b at xfce.org>
+Date: Wed Oct 20 13:45:51 2021 +0200
+
+ Update xfce4::Rc member functions
+
+ Add new wrappers, and enable xfce4::Rc functions to be called without
+ creating a temporary instance of std::string when passing char*.
+
+commit a60ab40622cc21d74da17d38f4ed298bbb774d8f
+Author: 玉堂白鹤 <yjwork at qq.com>
+Date: Tue Oct 19 12:52:03 2021 +0200
+
+ I18n: Update translation zh_CN (100%).
+
+ 59 translated messages.
+
+ Transifex (https://www.transifex.com/xfce/public/).
+
+commit eee819dc3ac7133895a635e8d461a47a7acbb08f
+Author: Anonymous <noreply at xfce.org>
+Date: Sat Oct 16 00:50:22 2021 +0200
+
+ I18n: Update translation da (100%).
+
+ 59 translated messages.
+
+ Transifex (https://www.transifex.com/xfce/public/).
+
+commit a5508c51f3db4a765c89ede22f111306e7c94820
+Author: Arnold Marko <arnold.marko at gmail.com>
+Date: Mon Oct 11 12:53:39 2021 +0200
+
+ I18n: Update translation sl (100%).
+
+ 59 translated messages.
+
+ Transifex (https://www.transifex.com/xfce/public/).
+
+commit add9665773769aeff81fe78d41bc8d1740f4d872
+Author: Jan Ziak <0xe2.0x9a.0x9b at xfce.org>
+Date: Mon Oct 11 00:50:34 2021 +0200
+
+ Update configure.ac.in syntax
+
+commit a144212ab9a926ae919e0672a02758198d820960
+Author: Triyan W. Nugroho <triyan.wn at gmail.com>
+Date: Sun Oct 10 12:53:01 2021 +0200
+
+ I18n: Update translation id (100%).
+
+ 59 translated messages.
+
+ Transifex (https://www.transifex.com/xfce/public/).
+
+commit 20b39d9c89dbd9c12e0f77708d44497f8fb6da82
+Author: Jan Ziak <0xe2.0x9a.0x9b at xfce.org>
+Date: Sat Oct 9 20:51:08 2021 +0200
+
+ Back to development
+
+commit 75f68b47a7da4749d7cd33da64aea9ce40155f98
+Author: Jan Ziak <0xe2.0x9a.0x9b at xfce.org>
+Date: Sat Oct 9 20:46:51 2021 +0200
+
+ Updates for release
+
commit 18402c3283082b47fd9b6c1355e4b178e9c3cac6
Author: Demiray Muhterem <mdemiray at msn.com>
Date: Fri Oct 8 12:52:41 2021 +0200
=====================================
NEWS
=====================================
@@ -1,3 +1,13 @@
+1.2.6 (2022-02-02)
+=====
+- Fix translations not showing in the GUI
+- Don't save some defaults to configuration files
+- Fix visibility of the associated-command configuration
+- Update configure.ac.in syntax
+- Translation Updates:
+ Basque, Chinese (China), Croatian, Danish, Hebrew, Indonesian,
+ Occitan (post 1500), Portuguese (Brazil), Slovenian, Swedish
+
1.2.5 (2021-10-09)
=====
- Lower peak memory consumption in case of a long CPU load history
=====================================
configure
=====================================
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for xfce4-cpugraph-plugin 1.2.5.
+# Generated by GNU Autoconf 2.69 for xfce4-cpugraph-plugin 1.2.6.
#
# Report bugs to <https://gitlab.xfce.org/panel-plugins/xfce4-cpugraph-plugin/>.
#
@@ -591,8 +591,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='xfce4-cpugraph-plugin'
PACKAGE_TARNAME='xfce4-cpugraph-plugin'
-PACKAGE_VERSION='1.2.5'
-PACKAGE_STRING='xfce4-cpugraph-plugin 1.2.5'
+PACKAGE_VERSION='1.2.6'
+PACKAGE_STRING='xfce4-cpugraph-plugin 1.2.6'
PACKAGE_BUGREPORT='https://gitlab.xfce.org/panel-plugins/xfce4-cpugraph-plugin/'
PACKAGE_URL=''
@@ -1401,7 +1401,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.2.5 to adapt to many kinds of systems.
+\`configure' configures xfce4-cpugraph-plugin 1.2.6 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1473,7 +1473,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of xfce4-cpugraph-plugin 1.2.5:";;
+ short | recursive ) echo "Configuration of xfce4-cpugraph-plugin 1.2.6:";;
esac
cat <<\_ACEOF
@@ -1601,7 +1601,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-xfce4-cpugraph-plugin configure 1.2.5
+xfce4-cpugraph-plugin configure 1.2.6
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2000,7 +2000,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.2.5, which was
+It was created by xfce4-cpugraph-plugin $as_me 1.2.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2866,7 +2866,7 @@ fi
# Define the identity of the package.
PACKAGE='xfce4-cpugraph-plugin'
- VERSION='1.2.5'
+ VERSION='1.2.6'
cat >>confdefs.h <<_ACEOF
@@ -3140,69 +3140,6 @@ fi
AM_BACKSLASH='\'
-DEPDIR="${am__leading_dot}deps"
-
-ac_config_commands="$ac_config_commands depfiles"
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
-$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; }
-cat > confinc.mk << 'END'
-am__doit:
- @echo this is the am__doit target >confinc.out
-.PHONY: am__doit
-END
-am__include="#"
-am__quote=
-# BSD make does it like this.
-echo '.include "confinc.mk" # ignored' > confmf.BSD
-# Other make implementations (GNU, Solaris 10, AIX) do it like this.
-echo 'include confinc.mk # ignored' > confmf.GNU
-_am_result=no
-for s in GNU BSD; do
- { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
- (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
- case $?:`cat confinc.out 2>/dev/null` in #(
- '0:this is the am__doit target') :
- case $s in #(
- BSD) :
- am__include='.include' am__quote='"' ;; #(
- *) :
- am__include='include' am__quote='' ;;
-esac ;; #(
- *) :
- ;;
-esac
- if test "$am__include" != "#"; then
- _am_result="yes ($s style)"
- break
- fi
-done
-rm -f confinc.* confmf.*
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
-$as_echo "${_am_result}" >&6; }
-
-# Check whether --enable-dependency-tracking was given.
-if test "${enable_dependency_tracking+set}" = set; then :
- enableval=$enable_dependency_tracking;
-fi
-
-if test "x$enable_dependency_tracking" != xno; then
- am_depcomp="$ac_aux_dir/depcomp"
- AMDEPBACKSLASH='\'
- am__nodep='_no'
-fi
- if test "x$enable_dependency_tracking" != xno; then
- AMDEP_TRUE=
- AMDEP_FALSE='#'
-else
- AMDEP_TRUE='#'
- AMDEP_FALSE=
-fi
-
-
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -4050,6 +3987,69 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5
+$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; }
+cat > confinc.mk << 'END'
+am__doit:
+ @echo this is the am__doit target >confinc.out
+.PHONY: am__doit
+END
+am__include="#"
+am__quote=
+# BSD make does it like this.
+echo '.include "confinc.mk" # ignored' > confmf.BSD
+# Other make implementations (GNU, Solaris 10, AIX) do it like this.
+echo 'include confinc.mk # ignored' > confmf.GNU
+_am_result=no
+for s in GNU BSD; do
+ { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5
+ (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ case $?:`cat confinc.out 2>/dev/null` in #(
+ '0:this is the am__doit target') :
+ case $s in #(
+ BSD) :
+ am__include='.include' am__quote='"' ;; #(
+ *) :
+ am__include='include' am__quote='' ;;
+esac ;; #(
+ *) :
+ ;;
+esac
+ if test "$am__include" != "#"; then
+ _am_result="yes ($s style)"
+ break
+ fi
+done
+rm -f confinc.* confmf.*
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5
+$as_echo "${_am_result}" >&6; }
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
depcc="$CC" am_compiler_list=
@@ -4179,183 +4179,6 @@ else
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
-$as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
-if ${ac_cv_prog_cc_c99+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_cv_prog_cc_c99=no
-ac_save_CC=$CC
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <stdio.h>
-
-// Check varargs macros. These examples are taken from C99 6.10.3.5.
-#define debug(...) fprintf (stderr, __VA_ARGS__)
-#define showlist(...) puts (#__VA_ARGS__)
-#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
-static void
-test_varargs_macros (void)
-{
- int x = 1234;
- int y = 5678;
- debug ("Flag");
- debug ("X = %d\n", x);
- showlist (The first, second, and third items.);
- report (x>y, "x is %d but y is %d", x, y);
-}
-
-// Check long long types.
-#define BIG64 18446744073709551615ull
-#define BIG32 4294967295ul
-#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
-#if !BIG_OK
- your preprocessor is broken;
-#endif
-#if BIG_OK
-#else
- your preprocessor is broken;
-#endif
-static long long int bignum = -9223372036854775807LL;
-static unsigned long long int ubignum = BIG64;
-
-struct incomplete_array
-{
- int datasize;
- double data[];
-};
-
-struct named_init {
- int number;
- const wchar_t *name;
- double average;
-};
-
-typedef const char *ccp;
-
-static inline int
-test_restrict (ccp restrict text)
-{
- // See if C++-style comments work.
- // Iterate through items via the restricted pointer.
- // Also check for declarations in for loops.
- for (unsigned int i = 0; *(text+i) != '\0'; ++i)
- continue;
- return 0;
-}
-
-// Check varargs and va_copy.
-static void
-test_varargs (const char *format, ...)
-{
- va_list args;
- va_start (args, format);
- va_list args_copy;
- va_copy (args_copy, args);
-
- const char *str;
- int number;
- float fnumber;
-
- while (*format)
- {
- switch (*format++)
- {
- case 's': // string
- str = va_arg (args_copy, const char *);
- break;
- case 'd': // int
- number = va_arg (args_copy, int);
- break;
- case 'f': // float
- fnumber = va_arg (args_copy, double);
- break;
- default:
- break;
- }
- }
- va_end (args_copy);
- va_end (args);
-}
-
-int
-main ()
-{
-
- // Check bool.
- _Bool success = false;
-
- // Check restrict.
- if (test_restrict ("String literal") == 0)
- success = true;
- char *restrict newvar = "Another string";
-
- // Check varargs.
- test_varargs ("s, d' f .", "string", 65, 34.234);
- test_varargs_macros ();
-
- // Check flexible array members.
- struct incomplete_array *ia =
- malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
- ia->datasize = 10;
- for (int i = 0; i < ia->datasize; ++i)
- ia->data[i] = i * 1.234;
-
- // Check named initializers.
- struct named_init ni = {
- .number = 34,
- .name = L"Test wide string",
- .average = 543.34343,
- };
-
- ni.number = 58;
-
- int dynamic_array[ni.number];
- dynamic_array[ni.number - 1] = 543;
-
- // work around unused variable warnings
- return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
- || dynamic_array[ni.number - 1] != 543);
-
- ;
- return 0;
-}
-_ACEOF
-for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99
-do
- CC="$ac_save_CC $ac_arg"
- if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_prog_cc_c99=$ac_arg
-fi
-rm -f core conftest.err conftest.$ac_objext
- test "x$ac_cv_prog_cc_c99" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c99" in
- x)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
- xno)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
- *)
- CC="$CC $ac_cv_prog_cc_c99"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
-$as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
-esac
-if test "x$ac_cv_prog_cc_c99" != xno; then :
-
-fi
-
-
ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -18177,7 +18000,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.2.5, which was
+This file was extended by xfce4-cpugraph-plugin $as_me 1.2.6, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -18243,7 +18066,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.2.5
+xfce4-cpugraph-plugin config.status 1.2.6
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
=====================================
configure.ac
=====================================
@@ -3,9 +3,8 @@ dnl This file was autogenerated from "configure.ac.in".
dnl Edit that file instead!
dnl
-dnl configure.ac
dnl
-dnl xfce4-cpugraph-plugin - A new system load Xfce4 panel-plugin
+dnl Copyright (c) 2004 - 2021 The Xfce development team
dnl
dnl 2004 Alexander Nordfelth <alex.nordfelth at telia.com>
dnl
@@ -14,13 +13,13 @@ dnl Version information
AC_CONFIG_MACRO_DIRS([m4])
m4_define([cpugraph_version_major], [1])
m4_define([cpugraph_version_minor], [2])
-m4_define([cpugraph_version_micro], [5])
-m4_define([cpugraph_version_build], [18402c3])
+m4_define([cpugraph_version_micro], [6])
+m4_define([cpugraph_version_build], [78fc0d8])
m4_define([cpugraph_version_tag], [])
m4_define([cpugraph_version], [cpugraph_version_major().cpugraph_version_minor().cpugraph_version_micro()ifelse(cpugraph_version_tag(), [git], [cpugraph_version_tag()-cpugraph_version_build()], [cpugraph_version_tag()])])
dnl Initialize autoconf
-AC_INIT([xfce4-cpugraph-plugin], [cpugraph_version], [https://gitlab.xfce.org/panel-plugins/xfce4-cpugraph-plugin/], [xfce4-cpugraph-plugin])
+AC_INIT([xfce4-cpugraph-plugin],[cpugraph_version],[https://gitlab.xfce.org/panel-plugins/xfce4-cpugraph-plugin/],[xfce4-cpugraph-plugin])
AC_PREREQ([2.60])
dnl Initialize automake
@@ -30,9 +29,9 @@ AM_MAINTAINER_MODE()
AM_SILENT_RULES([yes])
dnl Check for basic programs
-AC_PROG_CC_C99
+AC_PROG_CC()
AC_PROG_CXX()
-AC_PROG_LD()
+LT_PATH_LD([])
AC_PROG_INSTALL
AX_CXX_COMPILE_STDCXX_11()
IT_PROG_INTLTOOL([0.35.0])
@@ -52,7 +51,7 @@ XDT_I18N([])
dnl Check for debugging support
XDT_FEATURE_DEBUG()
-AC_OUTPUT([
+AC_CONFIG_FILES([
Makefile
panel-plugin/Makefile
xfce4++/Makefile
@@ -64,3 +63,4 @@ icons/128x128/Makefile
icons/scalable/Makefile
po/Makefile.in
])
+AC_OUTPUT
=====================================
panel-plugin/cpu.cc
=====================================
@@ -608,11 +608,11 @@ detect_smt_issues (const Ptr<CPUGraph> &base)
base->cpu_data[i+1].smt_highlight = suboptimal[i];
}
-static bool
+static xfce4::TimeoutResponse
update_cb (const Ptr<CPUGraph> &base)
{
if (!read_cpu_data (base->cpu_data))
- return TRUE;
+ return xfce4::TIMEOUT_AGAIN;
detect_smt_issues (base);
@@ -634,7 +634,7 @@ update_cb (const Ptr<CPUGraph> &base)
queue_draw (base);
update_tooltip (base);
- return TRUE;
+ return xfce4::TIMEOUT_AGAIN;
}
static void
@@ -1000,7 +1000,7 @@ CPUGraph::set_update_rate (const Ptr<CPUGraph> &base, CPUGraphUpdateRate rate)
base->update_interval = rate;
if (base->timeout_id)
g_source_remove (base->timeout_id);
- base->timeout_id = xfce4::timeout_add (interval, [base]() -> bool { return update_cb(base); });
+ base->timeout_id = xfce4::timeout_add (interval, [base]() { return update_cb(base); });
if (change && !init)
queue_draw (base);
=====================================
panel-plugin/properties.cc
=====================================
@@ -93,7 +93,8 @@ static void setup_load_threshold_option (GtkBox *vbox, GtkSizeGroup *sg, c
static GtkBox* setup_per_core_spacing_option (GtkBox *vbox, GtkSizeGroup *sg, const Ptr<CPUGraph> &base);
static void change_color (GtkColorButton *button, const Ptr<CPUGraph> &base, CPUGraphColorNumber number);
static void update_sensitivity (const Ptr<CPUGraphOptions> &data, bool initial = false);
-static bool update_cb (const Ptr<CPUGraphOptions> &data);
+
+static xfce4::TimeoutResponse update_cb (const Ptr<CPUGraphOptions> &data);
void
create_options (XfcePanelPlugin *plugin, const Ptr<CPUGraph> &base)
@@ -223,7 +224,7 @@ create_options (XfcePanelPlugin *plugin, const Ptr<CPUGraph> &base)
gtk_container_add (GTK_CONTAINER (content), notebook);
update_cb (dlg_data);
- dlg_data->timeout_id = xfce4::timeout_add (100, [dlg_data]() -> bool { return update_cb(dlg_data); });
+ dlg_data->timeout_id = xfce4::timeout_add (100, [dlg_data]() { return update_cb(dlg_data); });
gtk_widget_show_all (notebook);
update_sensitivity (dlg_data, true);
@@ -519,7 +520,7 @@ update_sensitivity (const Ptr<CPUGraphOptions> &data, bool initial)
gtk_widget_set_visible (GTK_WIDGET (data->hbox_in_terminal), !default_command);
gtk_widget_set_visible (GTK_WIDGET (data->hbox_startup_notification), !default_command);
}
- else
+ else if (!default_command)
{
gtk_widget_set_visible (GTK_WIDGET (data->hbox_in_terminal), true);
gtk_widget_set_visible (GTK_WIDGET (data->hbox_startup_notification), true);
@@ -541,7 +542,7 @@ update_sensitivity (const Ptr<CPUGraphOptions> &data, bool initial)
gtk_widget_set_sensitive (GTK_WIDGET (data->show_bars_checkbox), base->mode != MODE_DISABLED);
}
-static bool
+static xfce4::TimeoutResponse
update_cb (const Ptr<CPUGraphOptions> &data)
{
const Ptr<CPUGraph> base = data->base;
@@ -603,5 +604,5 @@ update_cb (const Ptr<CPUGraphOptions> &data)
gtk_widget_set_tooltip_text (GTK_WIDGET (data->smt_stats), show_tooltip ? data->smt_stats_tooltip().c_str() : "");
}
- return true;
+ return xfce4::TIMEOUT_AGAIN;
}
=====================================
panel-plugin/settings.cc
=====================================
@@ -188,26 +188,20 @@ write_settings (XfcePanelPlugin *plugin, const Ptr<const CPUGraph> &base)
if (!rc)
return;
- rc->write_int_entry ("UpdateInterval", base->update_interval);
+ rc->write_default_int_entry ("UpdateInterval", base->update_interval, RATE_NORMAL);
rc->write_int_entry ("TimeScale", base->non_linear ? 1 : 0);
rc->write_int_entry ("Size", base->size);
- rc->write_int_entry ("Mode", base->mode);
+ rc->write_default_int_entry ("Mode", base->mode, MODE_NORMAL);
rc->write_int_entry ("Frame", base->has_frame ? 1 : 0);
rc->write_int_entry ("Border", base->has_border ? 1 : 0);
rc->write_int_entry ("Bars", base->has_bars ? 1 : 0);
rc->write_int_entry ("PerCore", base->per_core ? 1 : 0);
rc->write_int_entry ("TrackedCore", base->tracked_core);
- if (!base->command.empty())
- rc->write_entry ("Command", base->command);
- else
- rc->delete_entry ("Command", false);
+ rc->write_default_entry ("Command", base->command, "");
rc->write_int_entry ("InTerminal", base->command_in_terminal ? 1 : 0);
rc->write_int_entry ("StartupNotification", base->command_startup_notification ? 1 : 0);
rc->write_int_entry ("ColorMode", base->color_mode);
- if (base->load_threshold != 0)
- rc->write_int_entry ("LoadThreshold", gint (roundf (100 * base->load_threshold)));
- else
- rc->delete_entry ("LoadThreshold", false);
+ rc->write_default_int_entry ("LoadThreshold", gint (roundf (100 * base->load_threshold)), 0);
for (guint i = 0; i < NUM_COLORS; i++)
{
@@ -220,23 +214,12 @@ write_settings (XfcePanelPlugin *plugin, const Ptr<const CPUGraph> &base)
{
auto rgba = (std::string) base->colors[i];
auto rgba_default = (std::string) default_colors[i];
-
- if (rgba != rgba_default)
- rc->write_entry (key, rgba);
- else
- rc->delete_entry (key, false);
+ rc->write_default_entry (key, rgba, rgba_default);
}
}
- if (base->highlight_smt != HIGHLIGHT_SMT_BY_DEFAULT)
- rc->write_int_entry ("SmtIssues", base->highlight_smt ? 1 : 0);
- else
- rc->delete_entry ("SmtIssues", false);
-
- if (base->per_core_spacing != PER_CORE_SPACING_DEFAULT)
- rc->write_int_entry ("PerCoreSpacing", base->per_core_spacing);
- else
- rc->delete_entry ("PerCoreSpacing", false);
+ rc->write_default_int_entry ("SmtIssues", base->highlight_smt ? 1 : 0, HIGHLIGHT_SMT_BY_DEFAULT);
+ rc->write_default_int_entry ("PerCoreSpacing", base->per_core_spacing, PER_CORE_SPACING_DEFAULT);
rc->close ();
}
=====================================
po/da.po
=====================================
@@ -11,8 +11,8 @@ msgstr ""
"Project-Id-Version: Xfce Panel Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-03 00:50+0200\n"
-"PO-Revision-Date: 2021-10-02 22:50+0000\n"
-"Last-Translator: Xfce Bot <transifex at xfce.org>\n"
+"PO-Revision-Date: 2021-10-15 15:06+0000\n"
+"Last-Translator: scootergrisen\n"
"Language-Team: Danish (http://www.transifex.com/xfce/xfce-panel-plugins/language/da/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -186,11 +186,11 @@ msgstr "Tilknyttet kommando:"
#: ../panel-plugin/properties.cc:409
msgid "The command to run when the plugin is left-clicked."
-msgstr ""
+msgstr "Kommandoen som skal køres når der højreklikkes på pluginet."
#: ../panel-plugin/properties.cc:410
msgid "If not specified, it defaults to xfce4-taskmanager, htop or top."
-msgstr ""
+msgstr "Hvis det ikke er angivet, så indstilles det som standard til xfce4-taskmanager, htop eller top."
#: ../panel-plugin/properties.cc:438
msgid "Disabled"
=====================================
po/eu.po
=====================================
@@ -11,8 +11,8 @@ msgstr ""
"Project-Id-Version: Xfce Panel Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-03 00:50+0200\n"
-"PO-Revision-Date: 2021-10-02 22:50+0000\n"
-"Last-Translator: Xfce Bot <transifex at xfce.org>\n"
+"PO-Revision-Date: 2021-10-30 15:27+0000\n"
+"Last-Translator: beriain\n"
"Language-Team: Basque (http://www.transifex.com/xfce/xfce-panel-plugins/language/eu/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -186,11 +186,11 @@ msgstr "Loturiko komandoa:"
#: ../panel-plugin/properties.cc:409
msgid "The command to run when the plugin is left-clicked."
-msgstr ""
+msgstr "Plugina ezkerreko botoiarekin klikatua denean exekutatuko den komandoa."
#: ../panel-plugin/properties.cc:410
msgid "If not specified, it defaults to xfce4-taskmanager, htop or top."
-msgstr ""
+msgstr "Zehazten ez bada, xfce4-taskmanager, htop edo top erabiliko dira lehenetsi bezala."
#: ../panel-plugin/properties.cc:438
msgid "Disabled"
=====================================
po/he.po
=====================================
@@ -10,8 +10,8 @@ msgstr ""
"Project-Id-Version: Xfce Panel Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-03 00:50+0200\n"
-"PO-Revision-Date: 2021-10-02 22:50+0000\n"
-"Last-Translator: Xfce Bot <transifex at xfce.org>\n"
+"PO-Revision-Date: 2021-11-13 19:41+0000\n"
+"Last-Translator: Elishai Eliyahu <elishai at mailfence.com>\n"
"Language-Team: Hebrew (http://www.transifex.com/xfce/xfce-panel-plugins/language/he/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -187,11 +187,11 @@ msgstr "פקודה משויכת:"
#: ../panel-plugin/properties.cc:409
msgid "The command to run when the plugin is left-clicked."
-msgstr ""
+msgstr "הפקודה להרצה בקליק שמאלי של התוסף."
#: ../panel-plugin/properties.cc:410
msgid "If not specified, it defaults to xfce4-taskmanager, htop or top."
-msgstr ""
+msgstr "אם לא מוגדר, ברירת מחדל ל-xfce4-taskmanager, htop, או top."
#: ../panel-plugin/properties.cc:438
msgid "Disabled"
=====================================
po/hr.po
=====================================
@@ -11,8 +11,8 @@ msgstr ""
"Project-Id-Version: Xfce Panel Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-03 00:50+0200\n"
-"PO-Revision-Date: 2021-10-02 22:50+0000\n"
-"Last-Translator: Xfce Bot <transifex at xfce.org>\n"
+"PO-Revision-Date: 2021-12-10 09:53+0000\n"
+"Last-Translator: Ivica Kolić <ikoli at yahoo.com>\n"
"Language-Team: Croatian (http://www.transifex.com/xfce/xfce-panel-plugins/language/hr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
=====================================
po/id.po
=====================================
@@ -3,14 +3,14 @@
# This file is distributed under the same license as the PACKAGE package..
#
# Translators:
-# Triyan W. Nugroho <triyan.wn at gmail.com>, 2020
+# Triyan W. Nugroho <triyan.wn at gmail.com>, 2020-2021
msgid ""
msgstr ""
"Project-Id-Version: Xfce Panel Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-03 00:50+0200\n"
-"PO-Revision-Date: 2021-10-02 22:50+0000\n"
-"Last-Translator: Xfce Bot <transifex at xfce.org>\n"
+"PO-Revision-Date: 2021-10-10 02:25+0000\n"
+"Last-Translator: Triyan W. Nugroho <triyan.wn at gmail.com>\n"
"Language-Team: Indonesian (http://www.transifex.com/xfce/xfce-panel-plugins/language/id/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -183,11 +183,11 @@ msgstr "Perintah diasosiasikan:"
#: ../panel-plugin/properties.cc:409
msgid "The command to run when the plugin is left-clicked."
-msgstr ""
+msgstr "Perintah untuk dijalankan ketika klik-kiri pada plugin."
#: ../panel-plugin/properties.cc:410
msgid "If not specified, it defaults to xfce4-taskmanager, htop or top."
-msgstr ""
+msgstr "Jika tidak ditentukan, gunakan xfce4-taskmanager, htop atau top."
#: ../panel-plugin/properties.cc:438
msgid "Disabled"
=====================================
po/oc.po
=====================================
@@ -9,8 +9,8 @@ msgstr ""
"Project-Id-Version: Xfce Panel Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-03 00:50+0200\n"
-"PO-Revision-Date: 2021-10-02 22:50+0000\n"
-"Last-Translator: Xfce Bot <transifex at xfce.org>\n"
+"PO-Revision-Date: 2021-12-29 06:49+0000\n"
+"Last-Translator: Quentin PAGÈS\n"
"Language-Team: Occitan (post 1500) (http://www.transifex.com/xfce/xfce-panel-plugins/language/oc/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -24,7 +24,7 @@ msgstr "Representacion grafica de la carga processor"
#: ../panel-plugin/cpu.cc:169
msgid "Copyright (c) 2003-2021\n"
-msgstr ""
+msgstr "Copyright (c) 2003-2021\n"
#: ../panel-plugin/cpu.cc:642
#, c-format
=====================================
po/pt_BR.po
=====================================
@@ -6,7 +6,7 @@
# Andre Miranda <andre42m at gmail.com>, 2019
# C. E., 2020
# Fábio Nogueira <deb-user-ba at ubuntu.com>, 2007
-# Lucas Wilm <lucaswilm at gmail.com>, 2021
+# Lucas Wilm <lucaswilm at gmail.com>, 2021-2022
# Michael Martins <michaelfm21 at gmail.com>, 2020
# The Cat, 2020-2021
msgid ""
@@ -14,8 +14,8 @@ msgstr ""
"Project-Id-Version: Xfce Panel Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-03 00:50+0200\n"
-"PO-Revision-Date: 2021-10-02 22:50+0000\n"
-"Last-Translator: Xfce Bot <transifex at xfce.org>\n"
+"PO-Revision-Date: 2022-01-03 12:20+0000\n"
+"Last-Translator: Lucas Wilm <lucaswilm at gmail.com>\n"
"Language-Team: Portuguese (Brazil) (http://www.transifex.com/xfce/xfce-panel-plugins/language/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -189,11 +189,11 @@ msgstr "Comando associado:"
#: ../panel-plugin/properties.cc:409
msgid "The command to run when the plugin is left-clicked."
-msgstr ""
+msgstr "O comando a ser executado quando o plug-in é clicado com o botão esquerdo."
#: ../panel-plugin/properties.cc:410
msgid "If not specified, it defaults to xfce4-taskmanager, htop or top."
-msgstr ""
+msgstr "Se não especificado, o padrão será xfce4-taskmanager, htop ou top."
#: ../panel-plugin/properties.cc:438
msgid "Disabled"
=====================================
po/sl.po
=====================================
@@ -9,8 +9,8 @@ msgstr ""
"Project-Id-Version: Xfce Panel Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-03 00:50+0200\n"
-"PO-Revision-Date: 2021-10-02 22:50+0000\n"
-"Last-Translator: Xfce Bot <transifex at xfce.org>\n"
+"PO-Revision-Date: 2021-10-11 07:35+0000\n"
+"Last-Translator: Arnold Marko <arnold.marko at gmail.com>\n"
"Language-Team: Slovenian (http://www.transifex.com/xfce/xfce-panel-plugins/language/sl/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -186,11 +186,11 @@ msgstr "Pripisan ukaz:"
#: ../panel-plugin/properties.cc:409
msgid "The command to run when the plugin is left-clicked."
-msgstr ""
+msgstr "Ukaz, ki naj se izvede, ko na vtičnik kliknemo z levim gumbom."
#: ../panel-plugin/properties.cc:410
msgid "If not specified, it defaults to xfce4-taskmanager, htop or top."
-msgstr ""
+msgstr "Če ni določeno, je privzeto xfce4-taskmanager, htop ali top."
#: ../panel-plugin/properties.cc:438
msgid "Disabled"
=====================================
po/sv.po
=====================================
@@ -12,8 +12,8 @@ msgstr ""
"Project-Id-Version: Xfce Panel Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-03 00:50+0200\n"
-"PO-Revision-Date: 2021-10-02 22:50+0000\n"
-"Last-Translator: Xfce Bot <transifex at xfce.org>\n"
+"PO-Revision-Date: 2021-11-21 08:02+0000\n"
+"Last-Translator: Arve Eriksson <031299870 at telia.com>\n"
"Language-Team: Swedish (http://www.transifex.com/xfce/xfce-panel-plugins/language/sv/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -187,11 +187,11 @@ msgstr "Associerat kommando:"
#: ../panel-plugin/properties.cc:409
msgid "The command to run when the plugin is left-clicked."
-msgstr ""
+msgstr "Kommando att köra vid vänsterklick på instick."
#: ../panel-plugin/properties.cc:410
msgid "If not specified, it defaults to xfce4-taskmanager, htop or top."
-msgstr ""
+msgstr "Om det inte anges är det som standard xfce4-taskmanager, htop eller top."
#: ../panel-plugin/properties.cc:438
msgid "Disabled"
=====================================
po/zh_CN.po
=====================================
@@ -12,8 +12,8 @@ msgstr ""
"Project-Id-Version: Xfce Panel Plugins\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-03 00:50+0200\n"
-"PO-Revision-Date: 2021-10-02 22:50+0000\n"
-"Last-Translator: Xfce Bot <transifex at xfce.org>\n"
+"PO-Revision-Date: 2021-10-19 03:51+0000\n"
+"Last-Translator: 玉堂白鹤 <yjwork at qq.com>\n"
"Language-Team: Chinese (China) (http://www.transifex.com/xfce/xfce-panel-plugins/language/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@@ -186,11 +186,11 @@ msgstr "绑定的命令:"
#: ../panel-plugin/properties.cc:409
msgid "The command to run when the plugin is left-clicked."
-msgstr ""
+msgstr "左键单击插件时运行的命令。"
#: ../panel-plugin/properties.cc:410
msgid "If not specified, it defaults to xfce4-taskmanager, htop or top."
-msgstr ""
+msgstr "如果未指定,则默认为 xfce4-taskmanager、htop 或 top。"
#: ../panel-plugin/properties.cc:438
msgid "Disabled"
=====================================
xfce4++/util.h
=====================================
@@ -26,6 +26,7 @@
#endif
#include <libxfce4util/libxfce4util.h>
+#include "xfce4++/util/collection-utils.h"
#include "xfce4++/util/gtk.h"
#include "xfce4++/util/io.h"
#include "xfce4++/util/rc.h"
=====================================
xfce4++/util/Makefile.am
=====================================
@@ -22,15 +22,16 @@ noinst_LTLIBRARIES = libxfce4util_pp.la
libxfce4util_pp_la_CXXFLAGS = \
@GTK_CFLAGS@ \
- @LIBXFCE4PANEL_CFLAGS@
+ @LIBXFCE4PANEL_CFLAGS@ \
@LIBXFCE4UTIL_CFLAGS@
libxfce4util_pp_la_LIBADD = \
@GTK_LIBS@ \
- @LIBXFCE4PANEL_LIBS@
+ @LIBXFCE4PANEL_LIBS@ \
@LIBXFCE4UTIL_LIBS@
libxfce4util_pp_la_SOURCES = \
+ collection-utils.h \
fixes.h \
gtk.h \
gtk.cc \
=====================================
xfce4++/util/Makefile.in
=====================================
@@ -380,13 +380,16 @@ AM_CPPFLAGS = -I${top_srcdir}
noinst_LTLIBRARIES = libxfce4util_pp.la
libxfce4util_pp_la_CXXFLAGS = \
@GTK_CFLAGS@ \
- @LIBXFCE4PANEL_CFLAGS@
+ @LIBXFCE4PANEL_CFLAGS@ \
+ @LIBXFCE4UTIL_CFLAGS@
libxfce4util_pp_la_LIBADD = \
@GTK_LIBS@ \
- @LIBXFCE4PANEL_LIBS@
+ @LIBXFCE4PANEL_LIBS@ \
+ @LIBXFCE4UTIL_LIBS@
libxfce4util_pp_la_SOURCES = \
+ collection-utils.h \
fixes.h \
gtk.h \
gtk.cc \
@@ -744,8 +747,6 @@ uninstall-am:
.PRECIOUS: Makefile
- @LIBXFCE4UTIL_CFLAGS@
- @LIBXFCE4UTIL_LIBS@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
=====================================
xfce4++/util/collection-utils.h
=====================================
@@ -0,0 +1,45 @@
+/*
+ * This file is part of Xfce (https://gitlab.xfce.org).
+ *
+ * Copyright (c) 2021 Jan Ziak <0xe2.0x9a.0x9b at xfce.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef _XFCE4PP_UTIL_COLLECTIONUTILS_H_
+#define _XFCE4PP_UTIL_COLLECTIONUTILS_H_
+
+#include <map>
+#include <utility>
+
+namespace xfce4 {
+
+template<typename K, typename V>
+void put(std::map<K, V> &map, const K &key, const V &value) {
+ auto result = map.emplace(key, value);
+ if(!result.second)
+ result.first->second = value;
+}
+
+template<typename K, typename V>
+void put(std::map<K, V> &map, K &&key, const V &value) {
+ auto result = map.emplace(std::move(key), value);
+ if(!result.second)
+ result.first->second = value;
+}
+
+} /* namespace xfce4 */
+
+#endif /* _XFCE4PP_UTIL_COLLECTIONUTILS_H_*/
=====================================
xfce4++/util/fixes.h
=====================================
@@ -37,7 +37,23 @@ extern "C" {
#if LIBXFCE4UTIL_CHECK_VERSION(4, 17, 0)
#include <libxfce4util/xfce-gio-extensions.h>
#endif
- #include <libxfce4util/xfce-i18n.h>
+
+ /*
+ * Define the macro GETTEXT_PACKAGE in order to avoid getting
+ * an invalid ngettext() definition from <libxfce4util/xfce-i18n.h>.
+ *
+ * See also: https://gitlab.xfce.org/xfce/libxfce4util/-/issues/7
+ */
+ #ifdef GETTEXT_PACKAGE
+ #include <libxfce4util/xfce-i18n.h>
+ #else
+ /* Note: The symbol __UNDEFINED__GETTEXT_PACKAGE__... is meant not to be defined anywhere.
+ * The numeric suffix is a random 64-bit number. The random number makes it improbable
+ * for any 3rd-party source code to define such a symbol. */
+ #define GETTEXT_PACKAGE __UNDEFINED__GETTEXT_PACKAGE__RND_11148334482592236430__
+ #include <libxfce4util/xfce-i18n.h>
+ #undef GETTEXT_PACKAGE
+ #endif
}
#undef LIBXFCE4UTIL_INSIDE_LIBXFCE4UTIL_H
=====================================
xfce4++/util/gtk.cc
=====================================
@@ -22,14 +22,16 @@
namespace xfce4 {
-const PluginSize RECTANGLE{true}, SQUARE{false};
-const Propagation PROPAGATE{false}, STOP{true};
-const TooltipTime LATER{false}, NOW{true};
+const PluginSize RECTANGLE{true}, SQUARE{false};
+const Propagation PROPAGATE{false}, STOP{true};
+const TimeoutResponse TIMEOUT_AGAIN{true}, TIMEOUT_REMOVE{false};
+const TooltipTime LATER{false}, NOW{true};
-template<typename To, typename From> static To convert(const From &from) { return from; }
-template<> gboolean convert(const PluginSize &from) { return from.rectangle; }
-template<> gboolean convert(const Propagation &from) { return from.stop; }
-template<> gboolean convert(const TooltipTime &from) { return from.now; }
+template<typename To, typename From> static To convert(const From &from) { return from; }
+template<> gboolean convert(const PluginSize &from) { return from.rectangle; }
+template<> gboolean convert(const Propagation &from) { return from.stop; }
+template<> gboolean convert(const TimeoutResponse &from) { return from.again; }
+template<> gboolean convert(const TooltipTime &from) { return from.now; }
template<typename GReturnType, typename ObjectType, typename ReturnType, typename... Args>
struct HandlerData {
@@ -92,22 +94,127 @@ void connect(GtkEntry *widget, const char *signal, const std::function<vo
void connect(GtkSpinButton *widget, const char *signal, const std::function<void(GtkSpinButton*)> &handler) { _connect<void>(widget, signal, handler); }
void connect(GtkToggleButton *widget, const char *signal, const std::function<void(GtkToggleButton*)> &handler) { _connect<void>(widget, signal, handler); }
+
+
/*
- * Links to documentation:
+ * Connection functions, with links to associated GTK documentation.
+ */
+
+void connect_after_draw(GtkWidget *widget, const std::function<DrawHandler1> &handler) {
+ connect_after_draw(widget, [handler](GtkWidget*, cairo_t *cr) {
+ return handler(cr);
+ });
+}
+
+/* http://docs.gtk.org/gtk3/signal.Widget.draw.html */
+void connect_after_draw(GtkWidget *widget, const std::function<DrawHandler2> &handler) {
+ _connect<gboolean>(widget, "draw", handler, true);
+}
+
+/* http://docs.gtk.org/gtk3/signal.Widget.button-press-event.html */
+void connect_button_press(GtkWidget *widget, const std::function<ButtonHandler> &handler) {
+ _connect<gboolean>(widget, "button-press-event", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.ComboBox.changed.html */
+void connect_changed(GtkComboBox *widget, const std::function<ChangedHandler_ComboBox> &handler) {
+ _connect<void>(widget, "changed", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.Range.change-value.html */
+void connect_change_value(GtkRange *widget, const std::function<ChangeValueHandler_Range> &handler) {
+ _connect<gboolean>(widget, "change-value", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.Container.check-resize.html */
+void connect_check_resize(GtkContainer *widget, const std::function<CheckResizeHandler> &handler) {
+ _connect<void>(widget, "check-resize", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.Button.clicked.html */
+void connect_clicked(GtkButton *widget, const std::function<ClickHandler> &handler) {
+ _connect<void>(widget, "clicked", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.ColorButton.color-set.html */
+void connect_color_set(GtkColorButton *widget, const std::function<ColorSetHandler> &handler) {
+ _connect<void>(widget, "color-set", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.Widget.destroy.html */
+void connect_destroy(GtkWidget *widget, const std::function<DestroyHandler> &handler) {
+ _connect<void>(widget, "destroy", handler);
+}
+
+void connect_draw(GtkWidget *widget, const std::function<DrawHandler1> &handler) {
+ connect_draw(widget, [handler](GtkWidget*, cairo_t *cr) {
+ return handler(cr);
+ });
+}
+
+void connect_draw(GtkWidget *widget, const std::function<DrawHandler2> &handler) {
+ _connect<gboolean>(widget, "draw", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.CellRendererText.edited.html */
+void connect_edited(GtkCellRendererText *object, const std::function<EditedHandler> &handler) {
+ _connect<void>(object, "edited", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.Widget.enter-notify-event.html
*
- * http://docs.gtk.org/gtk3/signal.Dialog.response.html
- * http://docs.gtk.org/gtk3/signal.Widget.button-press-event.html
- * http://docs.gtk.org/gtk3/signal.Widget.destroy.html
- * http://docs.gtk.org/gtk3/signal.Widget.draw.html
- * http://docs.gtk.org/gtk3/signal.Widget.query-tooltip.html
+ * Note: GTK+ documentation contains an error.
+ * The event actually passed to the handler is a pointer to GdkEventCrossing.
*/
+void connect_enter_notify(GtkWidget *widget, const std::function<EnterNotifyHandler> &handler) {
+ _connect<gboolean>(widget, "enter-notify-event", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.FontButton.font-set.html */
+ void connect_font_set(GtkFontButton *widget, const std::function<FontSetHandler> &handler) {
+ _connect<void>(widget, "font-set", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.Widget.leave-notify-event.html
+ *
+ * Note: GTK+ documentation contains an error.
+ * The event actually passed to the handler is a pointer to GdkEventCrossing.
+ */
+void connect_leave_notify(GtkWidget *widget, const std::function<LeaveNotifyHandler> &handler) {
+ _connect<gboolean>(widget, "leave-notify-event", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.Widget.query-tooltip.html */
+void connect_query_tooltip(GtkWidget *widget, const std::function<TooltipHandler> &handler) {
+ _connect<gboolean>(widget, "query-tooltip", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.Dialog.response.html */
+void connect_response(GtkDialog *widget, const std::function<ResponseHandler> &handler) {
+ _connect<void>(widget, "response", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.CellRendererToggle.toggled.html */
+void connect_toggled(GtkCellRendererToggle *object, const std::function<ToggledHandler_CellRendererToggle> &handler) {
+ _connect<void>(object, "toggled", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.ToggleButton.toggled.html */
+void connect_toggled(GtkToggleButton *widget, const std::function<ToggledHandler_ToggleButton> &handler) {
+ _connect<void>(widget, "toggled", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.Adjustment.value-changed.html */
+void connect_value_changed(GtkAdjustment *object, const std::function<ValueChangedHandler_Adjustment> &handler) {
+ _connect<void>(object, "value_changed", handler);
+}
+
+/* http://docs.gtk.org/gtk3/signal.SpinButton.value-changed.html */
+void connect_value_changed(GtkSpinButton *widget, const std::function<ValueChangedHandler_SpinButton> &handler) {
+ _connect<void>(widget, "value_changed", handler);
+}
+
-void connect_after_draw (GtkWidget *widget, const std::function<DrawHandler1> &handler) { connect_after_draw(widget, [handler](GtkWidget*, cairo_t *cr) { return handler(cr); }); }
-void connect_after_draw (GtkWidget *widget, const std::function<DrawHandler2> &handler) { _connect<gboolean>(widget, "draw", handler, true); }
-void connect_button_press (GtkWidget *widget, const std::function<ButtonHandler> &handler) { _connect<gboolean>(widget, "button-press-event", handler); }
-void connect_destroy (GtkWidget *widget, const std::function<DestroyHandler> &handler) { _connect<void> (widget, "destroy", handler); }
-void connect_query_tooltip(GtkWidget *widget, const std::function<TooltipHandler> &handler) { _connect<gboolean>(widget, "query-tooltip", handler); }
-void connect_response (GtkDialog *widget, const std::function<ResponseHandler> &handler) { _connect<void> (widget, "response", handler); }
/*
* Links to documentation:
@@ -120,24 +227,55 @@ void connect_response (GtkDialog *widget, const std::function<ResponseHandle
* http://developer.xfce.org/xfce4-panel/XfcePanelPlugin.html#XfcePanelPlugin-size-changed
*/
-void connect_about (XfcePanelPlugin *plugin, const std::function<PluginHandler> &handler) { _connect<void> (plugin, "about", handler); }
-void connect_configure_plugin(XfcePanelPlugin *plugin, const std::function<PluginHandler> &handler) { _connect<void> (plugin, "configure-plugin", handler); }
-void connect_free_data (XfcePanelPlugin *plugin, const std::function<PluginHandler> &handler) { _connect<void> (plugin, "free-data", handler); }
-void connect_mode_changed (XfcePanelPlugin *plugin, const std::function<ModeChangeHandler> &handler) { _connect<void> (plugin, "mode-changed", handler); }
-void connect_save (XfcePanelPlugin *plugin, const std::function<PluginHandler> &handler) { _connect<void> (plugin, "save", handler); }
-void connect_size_changed (XfcePanelPlugin *plugin, const std::function<SizeChangeHandler> &handler) { _connect<gboolean>(plugin, "size-changed", handler); }
+void connect_about(XfcePanelPlugin *plugin, const std::function<PluginHandler> &handler) {
+ _connect<void>(plugin, "about", handler);
+}
+
+void connect_configure_plugin(XfcePanelPlugin *plugin, const std::function<PluginHandler> &handler) {
+ _connect<void>(plugin, "configure-plugin", handler);
+}
+
+void connect_free_data(XfcePanelPlugin *plugin, const std::function<PluginHandler> &handler) {
+ _connect<void>(plugin, "free-data", handler);
+}
+
+void connect_mode_changed(XfcePanelPlugin *plugin, const std::function<ModeChangeHandler> &handler) {
+ _connect<void>(plugin, "mode-changed", handler);
+}
+
+void connect_save(XfcePanelPlugin *plugin, const std::function<PluginHandler> &handler) {
+ _connect<void>(plugin, "save", handler);
+}
+
+void connect_size_changed(XfcePanelPlugin *plugin, const std::function<SizeChangeHandler> &handler) {
+ _connect<gboolean>(plugin, "size-changed", handler);
+}
+
+
+
+void invoke_later(const std::function<void()> &task) {
+ timeout_add(0, [task]() {
+ task();
+ return TIMEOUT_REMOVE;
+ });
+}
struct TimeoutHandlerData {
- typedef bool FunctionType();
+ static const uint32_t MAGIC = 0x99F67650;
+ const uint32_t magic = MAGIC;
+
+ typedef TimeoutResponse FunctionType();
std::function<FunctionType> handler;
TimeoutHandlerData(const std::function<FunctionType> &_handler) : handler(_handler) {}
static gboolean call(void *data) {
- return ((TimeoutHandlerData*)data)->handler();
+ auto h = (TimeoutHandlerData*)data;
+ g_assert(h->magic == MAGIC); /* Try to detect invalid number of parameters in the function signature of h->handler */
+ return convert<gboolean, TimeoutResponse>(h->handler());
}
static void destroy(void *data) {
=====================================
xfce4++/util/gtk.h
=====================================
@@ -71,28 +71,62 @@ struct Propagation {
Propagation() = delete;
};
+struct TimeoutResponse {
+ bool again; /* Invoke the timeout handler again, otherwise stop the timer */
+ TimeoutResponse() = delete;
+};
+
struct TooltipTime {
bool now; /* Whether to show the tooltip now or later */
TooltipTime() = delete;
};
-extern const PluginSize RECTANGLE, SQUARE;
-extern const Propagation PROPAGATE, STOP;
-extern const TooltipTime LATER, NOW; /* If in doubt, use NOW */
-
-typedef Propagation ButtonHandler (GtkWidget *widget, GdkEventButton *event);
-typedef void DestroyHandler (GtkWidget *widget);
-typedef Propagation DrawHandler1 (cairo_t *cr);
-typedef Propagation DrawHandler2 (GtkWidget *widget, cairo_t *cr);
-typedef void ResponseHandler(GtkDialog *widget, gint response);
-typedef TooltipTime TooltipHandler (GtkWidget *widget, gint x, gint y, bool keyboard, GtkTooltip *tooltip);
-
-void connect_after_draw (GtkWidget *widget, const std::function<DrawHandler1> &handler);
-void connect_after_draw (GtkWidget *widget, const std::function<DrawHandler2> &handler);
-void connect_button_press (GtkWidget *widget, const std::function<ButtonHandler> &handler);
-void connect_destroy (GtkWidget *widget, const std::function<DestroyHandler> &handler);
-void connect_query_tooltip(GtkWidget *widget, const std::function<TooltipHandler> &handler);
-void connect_response (GtkDialog *widget, const std::function<ResponseHandler> &handler);
+extern const PluginSize RECTANGLE, SQUARE;
+extern const Propagation PROPAGATE, STOP;
+extern const TimeoutResponse TIMEOUT_AGAIN, TIMEOUT_REMOVE;
+extern const TooltipTime LATER, NOW; /* If in doubt, use NOW */
+
+typedef Propagation ButtonHandler (GtkWidget *widget, GdkEventButton *event);
+typedef void ChangedHandler_ComboBox (GtkComboBox *widget);
+typedef Propagation ChangeValueHandler_Range (GtkRange *widget, GtkScrollType *scroll, gdouble value);
+typedef void CheckResizeHandler (GtkContainer *widget);
+typedef void ClickHandler (GtkButton *widget);
+typedef void ColorSetHandler (GtkColorButton *widget);
+typedef void DestroyHandler (GtkWidget *widget);
+typedef Propagation DrawHandler1 (cairo_t *cr);
+typedef Propagation DrawHandler2 (GtkWidget *widget, cairo_t *cr);
+typedef void EditedHandler (GtkCellRendererText *object, gchar *path, gchar *new_text);
+typedef Propagation EnterNotifyHandler (GtkWidget *widget, GdkEventCrossing *event);
+typedef void FontSetHandler (GtkFontButton *widget);
+typedef Propagation LeaveNotifyHandler (GtkWidget *widget, GdkEventCrossing *event);
+typedef void ResponseHandler (GtkDialog *widget, gint response);
+typedef void ToggledHandler_CellRendererToggle(GtkCellRendererToggle *object, gchar *path);
+typedef void ToggledHandler_ToggleButton (GtkToggleButton *widget);
+typedef TooltipTime TooltipHandler (GtkWidget *widget, gint x, gint y, bool keyboard, GtkTooltip *tooltip);
+typedef void ValueChangedHandler_Adjustment (GtkAdjustment *object);
+typedef void ValueChangedHandler_SpinButton (GtkSpinButton *widget);
+
+void connect_after_draw (GtkWidget *widget, const std::function<DrawHandler1> &handler);
+void connect_after_draw (GtkWidget *widget, const std::function<DrawHandler2> &handler);
+void connect_button_press (GtkWidget *widget, const std::function<ButtonHandler> &handler);
+void connect_changed (GtkComboBox *widget, const std::function<ChangedHandler_ComboBox> &handler);
+void connect_change_value (GtkRange *widget, const std::function<ChangeValueHandler_Range> &handler);
+void connect_check_resize (GtkContainer *widget, const std::function<CheckResizeHandler> &handler);
+void connect_clicked (GtkButton *widget, const std::function<ClickHandler> &handler);
+void connect_color_set (GtkColorButton *widget, const std::function<ColorSetHandler> &handler);
+void connect_destroy (GtkWidget *widget, const std::function<DestroyHandler> &handler);
+void connect_draw (GtkWidget *widget, const std::function<DrawHandler1> &handler);
+void connect_draw (GtkWidget *widget, const std::function<DrawHandler2> &handler);
+void connect_edited (GtkCellRendererText *object, const std::function<EditedHandler> &handler);
+void connect_enter_notify (GtkWidget *widget, const std::function<EnterNotifyHandler> &handler);
+void connect_font_set (GtkFontButton *widget, const std::function<FontSetHandler> &handler);
+void connect_leave_notify (GtkWidget *widget, const std::function<LeaveNotifyHandler> &handler);
+void connect_query_tooltip(GtkWidget *widget, const std::function<TooltipHandler> &handler);
+void connect_response (GtkDialog *widget, const std::function<ResponseHandler> &handler);
+void connect_toggled (GtkCellRendererToggle *object, const std::function<ToggledHandler_CellRendererToggle> &handler);
+void connect_toggled (GtkToggleButton *widget, const std::function<ToggledHandler_ToggleButton> &handler);
+void connect_value_changed(GtkAdjustment *object, const std::function<ValueChangedHandler_Adjustment> &handler);
+void connect_value_changed(GtkSpinButton *widget, const std::function<ValueChangedHandler_SpinButton> &handler);
typedef void PluginHandler (XfcePanelPlugin *plugin);
typedef void ModeChangeHandler(XfcePanelPlugin *plugin, XfcePanelPluginMode mode);
@@ -105,7 +139,9 @@ void connect_mode_changed (XfcePanelPlugin *plugin, const std::function<ModeC
void connect_save (XfcePanelPlugin *plugin, const std::function<PluginHandler> &handler);
void connect_size_changed (XfcePanelPlugin *plugin, const std::function<SizeChangeHandler> &handler);
-typedef bool TimeoutHandler();
+void invoke_later(const std::function<void()> &task);
+
+typedef TimeoutResponse TimeoutHandler();
guint timeout_add(guint interval_ms, const std::function<TimeoutHandler> &handler);
=====================================
xfce4++/util/memory.h
=====================================
@@ -21,11 +21,15 @@
#ifndef _XFCE4PP_UTIL_MEMORY_H_
#define _XFCE4PP_UTIL_MEMORY_H_
+#include <cstdlib>
+#include <glib.h>
#include <memory>
#include <utility>
namespace xfce4 {
+template<typename T> struct Ptr0;
+
/* A pointer that cannot be null */
template<typename T>
struct Ptr final {
@@ -33,17 +37,20 @@ struct Ptr final {
template<typename... Args>
static Ptr<T> make(Args&&... args) {
- Ptr p;
- p.ptr = std::make_shared<T>(std::forward<Args>(args)...);
- return p;
+ return Ptr<T>(std::make_shared<T>(std::forward<Args>(args)...));
}
template<typename U> Ptr(const Ptr<U> &p) : ptr(p.ptr) {}
T* operator->() const { return ptr.get(); }
+ T& operator*() const { return *ptr; }
+
+ template<typename U> bool operator<(const Ptr<U> &p) const { return ptr < p.ptr; }
private:
- Ptr() {}
+ friend Ptr0<T>;
+ Ptr(const std::shared_ptr<T> &p) : ptr(p) {}
+ Ptr(std::shared_ptr<T> &&p) : ptr(std::move(p)) {}
};
/* A pointer that can be null */
@@ -54,6 +61,16 @@ struct Ptr0 final : std::shared_ptr<T> {
template<typename U> Ptr0(const std::shared_ptr<U> &p) : std::shared_ptr<T>(p) {}
template<typename U> Ptr0(std::shared_ptr<U> &&p) : std::shared_ptr<T>(std::move(p)) {}
template<typename U> Ptr0(const Ptr<U> &p) : std::shared_ptr<T>(p.ptr) {}
+
+ Ptr<T> toPtr() const {
+ if(*this) {
+ return Ptr<T>(*this);
+ }
+ else {
+ g_error("null pointer");
+ std::abort();
+ }
+ }
};
/* Allocates a new instance of T on the heap, passing args to T's constructor */
=====================================
xfce4++/util/rc.cc
=====================================
@@ -21,7 +21,9 @@
/* The fixes file has to be included before any other #include directives */
#include "xfce4++/util/fixes.h"
+#include <errno.h>
#include "rc.h"
+#include "string-utils.h"
namespace xfce4 {
@@ -38,23 +40,79 @@ void Rc::close() {
}
}
-void Rc::delete_entry(const std::string &key, bool global) {
- xfce_rc_delete_entry(rc, key.c_str(), global);
+void Rc::delete_entry(const char *key, bool global) {
+ xfce_rc_delete_entry(rc, key, global);
}
-Ptr0<std::string> Rc::read_entry(const std::string &key, const char *fallback_orNull) const {
- const gchar *e = xfce_rc_read_entry(rc, key.c_str(), fallback_orNull);
+void Rc::delete_entry(const string &key, bool global) { delete_entry(key.c_str(), global); }
+
+bool Rc::has_group(const char *group) const {
+ return xfce_rc_has_group(rc, group);
+}
+
+bool Rc::has_group(const string &group) const { return has_group(group.c_str()); }
+
+bool Rc::read_bool_entry(const char *key, bool fallback) const {
+ return xfce_rc_read_bool_entry(rc, key, fallback);
+}
+
+bool Rc::read_bool_entry(const string &key, bool fallback) const { return read_bool_entry(key.c_str(), fallback); }
+
+Ptr0<std::string> Rc::read_entry(const char *key, const char *fallback_orNull) const {
+ const gchar *e = xfce_rc_read_entry(rc, key, fallback_orNull);
if(e)
- return make<std::string>(e);
+ return make<string>(e);
+ else if(fallback_orNull)
+ return make<string>(fallback_orNull);
else
return nullptr;
}
-gint Rc::read_int_entry(const std::string &key, gint fallback) const {
- return xfce_rc_read_int_entry(rc, key.c_str(), fallback);
+Ptr0<std::string> Rc::read_entry(const string &key, const char *fallback_orNull) const {
+ return read_entry(key.c_str(), fallback_orNull);
+}
+
+std::string Rc::read_entry(const char *key, const string &fallback) const {
+ const gchar *e = xfce_rc_read_entry(rc, key, fallback.c_str());
+ if(e)
+ return e;
+ else
+ return fallback;
+}
+
+std::string Rc::read_entry(const string &key, const string &fallback) const {
+ return read_entry(key.c_str(), fallback);
+}
+
+float Rc::read_float_entry(const char *key, float fallback) const {
+ Ptr0<string> e = read_entry(key, nullptr);
+ if(e) {
+ const std::string s = trim(*e.toPtr());
+ gchar *endptr = NULL;
+ errno = 0;
+ gdouble value = g_ascii_strtod(s.c_str(), &endptr);
+ if(errno == 0 && endptr == s.c_str() + s.size()) {
+ return value;
+ }
+ }
+ return fallback;
+}
+
+float Rc::read_float_entry(const string &key, float fallback) const { return read_float_entry(key.c_str(), fallback); }
+
+gint Rc::read_int_entry(const char *key, gint fallback) const {
+ return xfce_rc_read_int_entry(rc, key, fallback);
+}
+
+gint Rc::read_int_entry(const string &key, gint fallback) const { return read_int_entry(key.c_str(), fallback); }
+
+void Rc::set_group(const char *group) {
+ xfce_rc_set_group(rc, group);
}
-Ptr0<Rc> Rc::simple_open(const std::string &filename, bool readonly) {
+void Rc::set_group(const string &group) { set_group(group.c_str()); }
+
+Ptr0<Rc> Rc::simple_open(const string &filename, bool readonly) {
XfceRc *rc = xfce_rc_simple_open(filename.c_str(), readonly);
if(rc)
return make<Rc>(rc);
@@ -62,12 +120,94 @@ Ptr0<Rc> Rc::simple_open(const std::string &filename, bool readonly) {
return nullptr;
}
-void Rc::write_entry(const std::string &key, const std::string &value) {
- xfce_rc_write_entry(rc, key.c_str(), value.c_str());
+void Rc::write_bool_entry(const char *key, bool value) { xfce_rc_write_bool_entry(rc, key , value); }
+void Rc::write_bool_entry(const string &key, bool value) { xfce_rc_write_bool_entry(rc, key.c_str(), value); }
+
+void Rc::write_entry(const char *key, const char *value) { xfce_rc_write_entry(rc, key , value ); }
+void Rc::write_entry(const char *key, const string &value) { xfce_rc_write_entry(rc, key , value.c_str()); }
+void Rc::write_entry(const string &key, const char *value) { xfce_rc_write_entry(rc, key.c_str(), value ); }
+void Rc::write_entry(const string &key, const string &value) { xfce_rc_write_entry(rc, key.c_str(), value.c_str()); }
+
+void Rc::write_float_entry(const char *key, float value) {
+ gchar buf[G_ASCII_DTOSTR_BUF_SIZE+1];
+ g_ascii_dtostr(buf, G_ASCII_DTOSTR_BUF_SIZE, value);
+ buf[G_ASCII_DTOSTR_BUF_SIZE] = '\0';
+ write_entry(key, buf);
}
-void Rc::write_int_entry(const std::string &key, gint value) {
- xfce_rc_write_int_entry(rc, key.c_str(), value);
+void Rc::write_float_entry(const string &key, float value) { write_float_entry(key.c_str(), value); }
+
+void Rc::write_int_entry(const char *key, gint value) { xfce_rc_write_int_entry(rc, key , value); }
+void Rc::write_int_entry(const string &key, gint value) { xfce_rc_write_int_entry(rc, key.c_str(), value); }
+
+void Rc::write_default_bool_entry(const char *key, bool value, bool default_value) {
+ if(value == default_value)
+ delete_entry(key, false);
+ else
+ write_bool_entry(key, value);
+}
+
+void Rc::write_default_bool_entry(const string &key, bool value, bool default_value) {
+ if(value == default_value)
+ delete_entry(key, false);
+ else
+ write_bool_entry(key, value);
+}
+
+void Rc::write_default_entry(const char *key, const char *value, const char *default_value) {
+ if(value && default_value && strcmp(value, default_value) == 0)
+ delete_entry(key, false);
+ else
+ write_entry(key, value);
+}
+
+void Rc::write_default_entry(const char *key, const string &value, const string &default_value) {
+ if(value == default_value)
+ delete_entry(key, false);
+ else
+ write_entry(key, value);
+}
+
+void Rc::write_default_entry(const string &key, const char *value, const char *default_value) {
+ if(value && default_value && strcmp(value, default_value) == 0)
+ delete_entry(key, false);
+ else
+ write_entry(key, value);
+}
+
+void Rc::write_default_entry(const string &key, const string &value, const string &default_value) {
+ if(value == default_value)
+ delete_entry(key, false);
+ else
+ write_entry(key, value);
+}
+
+void Rc::write_default_float_entry(const char *key, float value, float default_value, float epsilon) {
+ if(value >= default_value - epsilon && value <= default_value + epsilon)
+ delete_entry(key, false);
+ else
+ write_float_entry(key, value);
+}
+
+void Rc::write_default_float_entry(const string &key, float value, float default_value, float epsilon) {
+ if(value == default_value)
+ delete_entry(key, false);
+ else
+ write_float_entry(key, value);
+}
+
+void Rc::write_default_int_entry(const char *key, gint value, gint default_value) {
+ if(value == default_value)
+ delete_entry(key, false);
+ else
+ write_int_entry(key, value);
+}
+
+void Rc::write_default_int_entry(const string &key, gint value, gint default_value) {
+ if(value == default_value)
+ delete_entry(key, false);
+ else
+ write_int_entry(key, value);
}
} /* namespace xfce4 */
=====================================
xfce4++/util/rc.h
=====================================
@@ -33,19 +33,59 @@
namespace xfce4 {
struct Rc final {
+ typedef std::string string;
+
XfceRc *rc;
- static Ptr0<Rc> simple_open(const std::string &filename, bool readonly);
+ static Ptr0<Rc> simple_open(const string &filename, bool readonly);
Rc(XfceRc *rc);
~Rc();
void close();
- void delete_entry(const std::string &key, bool global);
- Ptr0<std::string> read_entry(const std::string &key, const char *fallback_orNull) const G_GNUC_WARN_UNUSED_RESULT;
- gint read_int_entry(const std::string &key, gint fallback) const G_GNUC_WARN_UNUSED_RESULT;
- void write_entry(const std::string &key, const std::string &value);
- void write_int_entry(const std::string &key, gint value);
+
+ void delete_entry(const char *key, bool global);
+ void delete_entry(const string &key, bool global);
+
+ bool read_bool_entry (const char *key, bool fallback ) const G_GNUC_WARN_UNUSED_RESULT;
+ bool read_bool_entry (const string &key, bool fallback ) const G_GNUC_WARN_UNUSED_RESULT;
+ Ptr0<string> read_entry (const char *key, const char *fallback_orNull) const G_GNUC_WARN_UNUSED_RESULT;
+ Ptr0<string> read_entry (const string &key, const char *fallback_orNull) const G_GNUC_WARN_UNUSED_RESULT;
+ string read_entry (const char *key, const string &fallback ) const G_GNUC_WARN_UNUSED_RESULT;
+ string read_entry (const string &key, const string &fallback ) const G_GNUC_WARN_UNUSED_RESULT;
+ float read_float_entry(const char *key, float fallback ) const G_GNUC_WARN_UNUSED_RESULT;
+ float read_float_entry(const string &key, float fallback ) const G_GNUC_WARN_UNUSED_RESULT;
+ gint read_int_entry (const char *key, gint fallback ) const G_GNUC_WARN_UNUSED_RESULT;
+ gint read_int_entry (const string &key, gint fallback ) const G_GNUC_WARN_UNUSED_RESULT;
+
+ bool has_group(const char *group) const;
+ bool has_group(const string &group) const;
+ void set_group(const char *group);
+ void set_group(const string &group);
+
+ void write_bool_entry (const char *key, bool value);
+ void write_bool_entry (const string &key, bool value);
+ void write_entry (const char *key, const char *value);
+ void write_entry (const char *key, const string &value);
+ void write_entry (const string &key, const char *value);
+ void write_entry (const string &key, const string &value);
+ void write_float_entry(const char *key, float value);
+ void write_float_entry(const string &key, float value);
+ void write_int_entry (const char *key, gint value);
+ void write_int_entry (const string &key, gint value);
+
+ /* Write an entry if it differs from the default value.
+ * Delete an entry if it equals to the default value. */
+ void write_default_bool_entry (const char *key, bool value, bool default_value);
+ void write_default_bool_entry (const string &key, bool value, bool default_value);
+ void write_default_entry (const char *key, const char *value, const char *default_value);
+ void write_default_entry (const char *key, const string &value, const string &default_value);
+ void write_default_entry (const string &key, const char *value, const char *default_value);
+ void write_default_entry (const string &key, const string &value, const string &default_value);
+ void write_default_float_entry(const char *key, float value, float default_value, float epsilon);
+ void write_default_float_entry(const string &key, float value, float default_value, float epsilon);
+ void write_default_int_entry (const char *key, gint value, gint default_value);
+ void write_default_int_entry (const string &key, gint value, gint default_value);
};
} /* namespace xfce4 */
=====================================
xfce4++/util/string-utils.cc
=====================================
@@ -20,12 +20,57 @@
#include "string-utils.h"
+#include <algorithm>
#include <cerrno>
#include <cstdarg>
#include <cstdio>
namespace xfce4 {
+bool ends_with(const std::string &s, const char *suffix) {
+ size_t suffix_size = strlen(suffix);
+ if(s.size() >= suffix_size) {
+ size_t d = s.size() - suffix_size;
+ return std::equal(s.begin() + d, s.end(), suffix);
+ }
+ else {
+ return false;
+ }
+}
+
+bool ends_with(const std::string &s, const std::string &suffix) {
+ if(s.size() >= suffix.size()) {
+ size_t d = s.size() - suffix.size();
+ return std::equal(s.begin() + d, s.end(), suffix.begin());
+ }
+ else {
+ return false;
+ }
+}
+
+std::string join(const std::vector<std::string> &strings, const char *separator) {
+ return join(strings, std::string(separator));
+}
+
+std::string join(const std::vector<std::string> &strings, const std::string &separator) {
+ size_t size = 0;
+ for (size_t i = 0; i < strings.size(); i++) {
+ if(i) {
+ size += separator.size();
+ }
+ size += strings[i].size();
+ }
+ std::string s;
+ s.reserve(size);
+ for (size_t i = 0; i < strings.size(); i++) {
+ if(i) {
+ s.append(separator);
+ }
+ s.append(strings[i]);
+ }
+ return s;
+}
+
template<typename T, typename fT>
static T parse_number(gchar **s, unsigned base, bool *error, fT (*f)(const gchar*, gchar**, guint)) {
gchar *end;
@@ -55,25 +100,47 @@ gulong parse_ulong(gchar **s, unsigned base, bool *error) {
}
template<typename T, typename fT>
-static Optional<T> parse_number_optional(const std::string &s, unsigned base, fT (*f)(const gchar*, gchar**, guint)) {
+static Optional<T> parse_float_optional(const std::string &s, fT (*f)(const gchar*, gchar**)) {
const auto s1 = trim(s);
- const char *s2 = s1.c_str();
+ if(!s1.empty()) {
+ const char *s2 = s1.c_str();
+ gchar *end;
+ errno = 0;
+ auto value = f(s2, &end);
+ if(errno == 0 && end == s2+s1.size())
+ return Optional<T>(value);
+ }
+ return Optional<T>();
+}
- gchar *end;
- errno = 0;
- auto value = f(s2, &end, base);
- if(errno || end != s2+s1.size() || value != T(value))
- return Optional<T>();
- else
- return Optional<T>(value);
+template<typename T, typename fT>
+static Optional<T> parse_int_optional(const std::string &s, unsigned base, fT (*f)(const gchar*, gchar**, guint)) {
+ const auto s1 = trim(s);
+ if(!s1.empty()) {
+ const char *s2 = s1.c_str();
+ gchar *end;
+ errno = 0;
+ auto value = f(s2, &end, base);
+ if(errno == 0 && end == s2+s1.size() && value == T(value))
+ return Optional<T>(value);
+ }
+ return Optional<T>();
+}
+
+Optional<gdouble> parse_double(const std::string &s) {
+ return parse_float_optional<gdouble>(s, g_ascii_strtod);
+}
+
+Optional<gfloat> parse_float(const std::string &s) {
+ return parse_float_optional<gfloat>(s, g_ascii_strtod);
}
Optional<glong> parse_long(const std::string &s, unsigned base) {
- return parse_number_optional<glong>(s, base, g_ascii_strtoll);
+ return parse_int_optional<glong>(s, base, g_ascii_strtoll);
}
Optional<gulong> parse_ulong(const std::string &s, unsigned base) {
- return parse_number_optional<gulong>(s, base, g_ascii_strtoull);
+ return parse_int_optional<gulong>(s, base, g_ascii_strtoull);
}
std::string sprintf(const char *fmt, ...) {
@@ -107,6 +174,15 @@ std::string sprintf(const char *fmt, ...) {
return "<xfce4::sprintf() failure>";
}
+bool starts_with(const std::string &s, const char *prefix) {
+ size_t prefix_size = strlen(prefix);
+ return s.size() >= prefix_size && std::equal(prefix, prefix + prefix_size, s.begin());
+}
+
+bool starts_with(const std::string &s, const std::string &prefix) {
+ return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin());
+}
+
std::string trim(const std::string &s) {
return trim_left(trim_right(s));
}
=====================================
xfce4++/util/string-utils.h
=====================================
@@ -23,6 +23,7 @@
#include <glib.h>
#include <string>
+#include <vector>
#include "optional.h"
namespace xfce4 {
@@ -32,8 +33,10 @@ namespace xfce4 {
*
* The string can contain just the number, with an optional prefix and suffix consisting from whitespace characters.
*/
-Optional<glong> parse_long (const std::string &s, unsigned base = 0);
-Optional<gulong> parse_ulong(const std::string &s, unsigned base = 0);
+Optional<gdouble> parse_double(const std::string &s);
+Optional<gfloat> parse_float (const std::string &s);
+Optional<glong> parse_long (const std::string &s, unsigned base = 0);
+Optional<gulong> parse_ulong (const std::string &s, unsigned base = 0);
/*
* Number parsing functions which move an indirect string pointer
@@ -45,10 +48,16 @@ Optional<gulong> parse_ulong(const std::string &s, unsigned base = 0);
glong parse_long (gchar **s, unsigned base = 0, bool *error = nullptr);
gulong parse_ulong(gchar **s, unsigned base = 0, bool *error = nullptr);
-std::string sprintf (const char *fmt, ...) G_GNUC_PRINTF(1, 2);
-std::string trim (const std::string &s);
-std::string trim_left (const std::string &s);
-std::string trim_right(const std::string &s);
+bool ends_with (const std::string &s, const char *suffix);
+bool ends_with (const std::string &s, const std::string &suffix);
+std::string join (const std::vector<std::string> &strings, const char *separator);
+std::string join (const std::vector<std::string> &strings, const std::string &separator);
+std::string sprintf (const char *fmt, ...) G_GNUC_PRINTF(1, 2);
+bool starts_with(const std::string &s, const char *prefix);
+bool starts_with(const std::string &s, const std::string &prefix);
+std::string trim (const std::string &s);
+std::string trim_left (const std::string &s);
+std::string trim_right (const std::string &s);
} /* namespace xfce4 */
View it on GitLab: https://salsa.debian.org/xfce-team/goodies/xfce4-cpugraph-plugin/-/commit/1d7e488ed1c30181fb923619f80220df5532d7d8
--
View it on GitLab: https://salsa.debian.org/xfce-team/goodies/xfce4-cpugraph-plugin/-/commit/1d7e488ed1c30181fb923619f80220df5532d7d8
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-xfce-commits/attachments/20220215/6c3f858a/attachment-0001.htm>
More information about the Pkg-xfce-commits
mailing list