Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Plugin/xfconf #4396

Merged
merged 82 commits into from
Jan 2, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
7896583
xfconf: Initialize skeleton
eiskasten Jun 14, 2022
482186f
xfconf: Add xfconf initialization and shutdown
eiskasten Jun 14, 2022
1d7d50a
xfconf: Remove lied infos/placements
eiskasten Jun 20, 2022
c248ca0
xfconf: Link with xfconf libraries
eiskasten Jun 20, 2022
1ff0012
xfconf: Add file workaround
eiskasten Jun 20, 2022
1df5489
xfconf: Add get for strings
eiskasten Jun 20, 2022
c3add37
xfconf: use gvalue instead of gchar
eiskasten Jun 20, 2022
7b606e3
xfconf: Implement set
eiskasten Jun 21, 2022
f53341a
xfconf: Remove unused plugin functions
eiskasten Jun 21, 2022
d5d13fc
xfconf: Add channel as mount parameter
eiskasten Jun 21, 2022
11ab4a5
xfconf: Remove libgen header include
eiskasten Jun 21, 2022
a2af438
xfconf: Begin with readme
eiskasten Jun 22, 2022
c3fa140
xfconf: Implement xfconf locks
eiskasten Jul 12, 2022
2fcbaeb
xfconf: Implement array get
eiskasten Jul 12, 2022
5c8ec2a
xfconf: Add array iteration in set
eiskasten Jul 12, 2022
2994614
xfconf-plugin: Remove array limitation from readme
eiskasten Aug 2, 2022
e9defcf
xfconf-plugin: Fix clang-format error
eiskasten Aug 2, 2022
031a867
xfconf-plugin: Add xfconf dependency to cirrus arch, fedora and freeb…
eiskasten Aug 2, 2022
f043490
xfconf-plugin: Use xfconf devel package instead of library only in fe…
eiskasten Aug 2, 2022
eaeb180
xfconf-plugin: Explicitly add pkgconf port to freebsd image
eiskasten Aug 2, 2022
a7a9803
xfconf-binding: Directly fetch keynames in debug macros instead of de…
eiskasten Aug 2, 2022
0542aef
xfconf-plugin: Add explicit kdb includes
eiskasten Aug 2, 2022
b6fd319
xfconf-plugin: Link elektra-ease
eiskasten Aug 2, 2022
e7f3d2c
xfconf-plugin: Fix readme shellrecorder cascading on key creation
eiskasten Aug 3, 2022
35b88ad
xfconf-plugin: Add xfconf build dependency to debian images
eiskasten Aug 3, 2022
39e5add
xfconf-plugin: Add xfconf build dependency to fedora images
eiskasten Aug 3, 2022
e42b17f
xfconf-plugin: Add xfconf build dependency to jenkinsnode image
eiskasten Aug 3, 2022
87be411
xfconf-plugin: Add xfconf build dependency to opensuse image
eiskasten Aug 3, 2022
2ba4bb3
xfconf-plugin: Remove unimplemented functions from test
eiskasten Aug 3, 2022
c5d4f43
xfconf-plugin: Remove xfconf from macOS test builds
eiskasten Aug 5, 2022
a96b6b0
xfconf-plugin: Remove plugin when library not found
eiskasten Aug 18, 2022
2a61c05
xfconf-plugin: Remove xfconf-plugin from macOS workflow
eiskasten Aug 18, 2022
b516e8a
xfconf-plugin: Add entry in plugin readme
eiskasten Aug 18, 2022
0eb9abb
xfconf-plugin: Exlcude plugin if pkgconfig is not available
eiskasten Aug 22, 2022
8a8beb8
xfconf-plugin: Add xfconf cmake module
eiskasten Aug 23, 2022
75c9abc
xfconf-plugin: Fix cmake space formatting
eiskasten Aug 23, 2022
0574de0
xfconf-plugin: Let docker reformat cmake files
eiskasten Aug 23, 2022
8467ad5
xfconf-plugin: Add gcc dependency in FreeBSD image
eiskasten Nov 1, 2022
c0ce8e9
xfconf-plugin: Replace gcc with CC env in examples
eiskasten Nov 3, 2022
7e92e98
xfconf-plugin: Add glib2 libraries in cmake file
eiskasten Nov 17, 2022
c197cda
xfonf-plugin: Add gobject to FindXfconf
eiskasten Nov 17, 2022
77911dc
xfconf-plugin: set interface error on faulty initalization
eiskasten Nov 18, 2022
f279bb8
xfconf-plugin: Add dbus to freebsd job
eiskasten Nov 18, 2022
4d7dd47
xfconf-plugin: Add release note
eiskasten Nov 18, 2022
fb53711
xfconf-plugin: redirect stderr messages to /dev/null
eiskasten Nov 18, 2022
1a1a6b5
xfconf-plugin: Update placements
eiskasten Nov 18, 2022
cc209dc
xfconf-plugin: Add readme info contract attributes
eiskasten Nov 21, 2022
002660d
xfconf-plugin: Exclude from rwstorage
eiskasten Nov 21, 2022
266ab67
xfconf-plugin: Update man page
eiskasten Nov 21, 2022
d69fa38
xfconf-plugin: Start dbus during fedora tests
eiskasten Nov 21, 2022
6e9f6a7
xfconf-plugin: Remove line number 1001 to only contain 1000 lines
eiskasten Nov 21, 2022
4b915d7
xfconf-plugin: Add dbus-x11 to fedora and debian images for dbus-launch
eiskasten Nov 21, 2022
c38088b
macos: Add coreutils for realpath
eiskasten Nov 22, 2022
cadd132
xfconf-plugin: Skip external tests if realpath is not installed
eiskasten Nov 22, 2022
7b480c4
xfconf-plugin: export dbus pids in bullseye jenkins image
eiskasten Nov 23, 2022
15deb99
xfconf-plugin: Add dbus env to ctest in jenkins
eiskasten Nov 28, 2022
07d2a23
xfconf-plugin: Escape dollar sign
eiskasten Nov 28, 2022
969be62
xfconf-plugin: Add library checks for the cmake module
eiskasten Nov 28, 2022
76145b7
xfconf-plugin: Run dbus during package build
eiskasten Nov 28, 2022
f1ca0f6
xfconf: Print warning if dbus is not running
eiskasten Dec 12, 2022
82a05d6
xfconf: Add dry-run option for plugin init
eiskasten Dec 13, 2022
d10ac3a
xfconf-plugin: check for 0 status dry-run
eiskasten Dec 14, 2022
dcbc968
xfconf-plugin: skip internal checks due to dbus
eiskasten Dec 14, 2022
beefc56
xfconf-plugin: Use 1 instead of 0 status code for dry run
eiskasten Dec 16, 2022
7b26e96
xfconf-plugin: Add limitation for memory leaks
eiskasten Dec 20, 2022
390413e
xfconf-plugin: Add memleak label during testing phase
eiskasten Dec 20, 2022
6d48838
xfconf-plugin: Move test target into separate function
eiskasten Dec 20, 2022
1d0d552
xfconf-plugin: Remove INSTALL_TEST_DATA label
eiskasten Dec 20, 2022
368b059
xfconf-plugin: Change man page date from november to august
eiskasten Dec 20, 2022
6add862
xfconf-plugin: Add xfconf valgrind supressions
eiskasten Dec 20, 2022
1458711
xfconf-plugin: Remove additional printf line from test
eiskasten Dec 22, 2022
49cd309
xfconf-plugin: Fix typo in internal check comment
eiskasten Dec 22, 2022
b135305
xfconf-plugin: Describe how xfconf locks work
eiskasten Dec 22, 2022
487ecce
xfoncf-plugin: Add description of channels and properties
eiskasten Dec 22, 2022
a599135
xfconf-plugin: Implement channel list
eiskasten Dec 22, 2022
e18c08c
xfconf-plugin: Document channel list/create/remove behavior
eiskasten Dec 22, 2022
210f415
xfconf-plugin: Add umount in example and remove stderr redirection
eiskasten Dec 22, 2022
0f5f854
xfconf-plugin: Add more content to the depencies section
eiskasten Dec 22, 2022
d1e4892
xfconf-plugin: Add description how arrays work
eiskasten Dec 23, 2022
1b1307a
xfconf-plugin: Mention the running dbus requirement
eiskasten Dec 23, 2022
e282a32
xfocnf-plugin: Explain channel plugin configuration
eiskasten Dec 23, 2022
56e94e4
xfconf-plugin: Add introduction in the readme
eiskasten Dec 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 38 additions & 6 deletions src/plugins/xfconf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,38 @@

This is a storage plugin to mount the xfconf configuration settings.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain what this plugin can do, how to use it, what works, ... E.g. see src/plugins/augeas/README.md for a similar plugin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a much better introduction with 56e94e4.


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template has ## Installation here, please add this information.

## Xfconf Terminology

### Property

A property in xfconf is the same as a key in libelektra i.e. it has a name and can hold one or more values.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A key only has one value (or none). Can you please give an example of how a property in xfconf would be represented in Elektra.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely, this was may fault. I corrected this with d1e4892.


### Channel

A channel is a type of namespace used in the xfconf library.
Usually, it is used to separate the properties of different applications which is helpful if different applications rely on a property with the same name but require them to hold different values.
For example Thunar uses a channel named `thunar`, Xfwm uses a channel named `xfwm4` and so on.
Keep in mind that channels are only used to separate the properties such as namespaces.
They are not a security feature i.e. every application has read/write access to every channel.

The list of all channels is stored in the `system:/elektra/modules/xfconf/channels` which is an array of all channel names.
Channel cannot be explicitly created or removed.
They only exist in an implicit manner when you pass the `channel=...` argument.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this sentence. Do you mean "plugin configuration" when you say argument? Please describe how channels are used within xfce4, and how they map to Elektra.

Copy link
Contributor Author

@eiskasten eiskasten Dec 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope the commit e282a32 makes it more clear.


### Locks

Xfconf uses so-called locks to prevent users or applications to set properties to a new value.
They can be referred as a type of constant.
As of now, locks cannot be set or unset in xfconf which makes locked properties read-only forever.

## Dependencies

xfconf from the XFCE project
The xfconf library from the XFCE project is the main dependency of this plugin.
Usually, this library is called something such as `xfconf` (Arch, Fedora, `xfconf-devel` for compiling), `libxfconf-0` (Debian, `libxfconf-0-dev` for compmiling) or `xfce4-conf` (FreeBSD) in the package manager.
As xfconf itself depends on dbus and glib, these are dependecies too but should be installed with the package manager automatically.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also write that dbus must be running.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done with 1b1307a.

This plugin is tested with the xfconf versions `4.16` and above.

Note that this plugin does not support macOS since Xfce is not commonly used there, Mac Ports only provides a very old version (`4.12`) and Brew does not provide Xfce at all.

## Usage

Expand All @@ -27,20 +56,23 @@ The usage is identical to most storage plugins except that the channel option du
# Backup-and-Restore: user:/tests/xfconf

# mount the xfwm channel
kdb mount /dev/null /test/xfwm xfconf "channel=xfwm4" 2&>/dev/null
kdb mount /dev/null /test/xfwm xfconf "channel=xfwm4"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This plugin also needs new-backend and new-style mounting. Let us discuss this later in the meeting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I realized it is the same issue as for @flo91 has with the relational database backend

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be tests, see doc/TESTING.md line 196:

Suggested change
kdb mount /dev/null /test/xfwm xfconf "channel=xfwm4"
kdb mount /dev/null /tests/xfconf/xfwm xfconf "channel=xfwm4"


# store old button layout
set "OLD_LAYOUT=$(kdb get /test/xfwm/general/button_layout 2&>/dev/null)"
set "OLD_LAYOUT=$(kdb get /test/xfwm/general/button_layout)"

# set only a close button
kdb set system:/test/xfwm/general/button_layout "C|" 2&>/dev/null
kdb set system:/test/xfwm/general/button_layout "C|"

# read the new layout
kdb get /test/xfwm/general/button_layout 2&>/dev/null
kdb get /test/xfwm/general/button_layout
#> C|

# restore old layout
kdb set /test/xfwm/general/button_layout "$OLD_LAYOUT" 2&>/dev/null
kdb set /test/xfwm/general/button_layout "$OLD_LAYOUT"

# umount the channel
kdb umount /test/xfwm
```
markus2330 marked this conversation as resolved.
Show resolved Hide resolved

## Limitations
Expand Down
1 change: 0 additions & 1 deletion src/plugins/xfconf/testmod_xfconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ static void test_basics (void)
}

printf ("test basics\n");
printf ("open plugin...\n");
PLUGIN_OPEN ("xfconf");

KeySet * ks = ksNew (0, KS_END);
Copy link
Contributor

@markus2330 markus2330 Dec 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are only very basic tests.

Expand Down
33 changes: 33 additions & 0 deletions src/plugins/xfconf/xfconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,38 @@ int elektraXfconfClose (Plugin * handle ELEKTRA_UNUSED, Key * errorKey ELEKTRA_U
return ELEKTRA_PLUGIN_STATUS_SUCCESS;
}

static void appendChannelList (KeySet * keySet)
{
const char * absoluteKeyName = "system:/elektra/modules/xfconf/channels";
Key * channelArrayKey = keyNew (absoluteKeyName, KEY_END);
gchar ** channels = xfconf_list_channels ();
if (channels == NULL)
{
return;
}
keySetMeta (channelArrayKey, "array", "");
long channelIndex;
for (channelIndex = 0; channels[channelIndex] != NULL; channelIndex++)
{
char * channelKeyName = elektraMalloc ((elektraStrLen (absoluteKeyName) + ELEKTRA_MAX_ARRAY_SIZE + 2) * sizeof (char));
channelKeyName[0] = '\0';
strcat (channelKeyName, absoluteKeyName);
channelKeyName[elektraStrLen (absoluteKeyName) - 1] = '/';
elektraWriteArrayNumber (&channelKeyName[elektraStrLen (absoluteKeyName)], channelIndex);
Key * currentChannelKey = keyNew (channelKeyName, KEY_VALUE, channels[channelIndex], KEY_END);
ksAppendKey (keySet, currentChannelKey);
}
if (channelIndex > 0)
{
char * arrayValue = elektraMalloc (ELEKTRA_MAX_ARRAY_SIZE * sizeof (char));
elektraWriteArrayNumber (arrayValue, channelIndex - 1);
keySetMeta (channelArrayKey, "array", arrayValue);
}
ksAppendKey (keySet, channelArrayKey);

g_strfreev (channels);
}

int elektraXfconfGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * parentKey)
{
ELEKTRA_LOG ("issued get\n");
Expand All @@ -74,6 +106,7 @@ int elektraXfconfGet (Plugin * handle ELEKTRA_UNUSED, KeySet * returned, Key * p
#include ELEKTRA_README
keyNew ("system:/elektra/modules/xfconf/infos/version", KEY_VALUE, PLUGINVERSION, KEY_END), KS_END);
ksAppend (returned, contract);
appendChannelList (returned);
ksDel (contract);

return ELEKTRA_PLUGIN_STATUS_SUCCESS;
Expand Down
2 changes: 1 addition & 1 deletion tests/shell/check_kdb_internal_check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ for PLUGIN in $ACTUAL_PLUGINS; do
continue
;;
"xfconf")
# dbus is not enable on internal checks
# dbus is not enabled on internal checks
continue
;;
"spec")
Expand Down