Gconf与Gsettings的简介、及gsettings的具体使用案例

/*********************************************************************
 * Author  : Samson
 * Date    : 12/11/2014
 * Test platform:
 *              3.13.0-24-generic
 *              GNU bash, 4.3.11(1)-release 
 * *******************************************************************/

GConf was a system used by the GNOME desktop environment for storing configuration settings for the desktop and applications. It is similar to the Windows Registry.
Gconf是一个存储GNOME桌面环境配置的一个系统,以方便桌面和应用程序的配置,是后台运行的。可以理解为是一个类似于windows下的注册表的一个东西;
而gsettings是对GConf后台的读取和设置;

现就举一个例子(以LinuxMint cinnamon桌面为例,):
在面板中使用了panel-launchers的key,那么如何得到这个的值呢?

第一步:
ufo@ufo:~$ gsettings  list-schemas | grep cinnamon
可查找到cinnamon对应的方案为org.cinnamon

第二步,在此方案中查找key的值:
ufo@ufo:~$ gsettings  list-recursively org.cinnamon | grep -w "panel-launchers"
org.cinnamon enabled-applets ['panel1:left:0:menu@cinnamon.org:0', 'panel1:left:1:show-desktop@cinnamon.org:1', 'panel1:left:2:panel-launchers@cinnamon.org:2', 'panel1:left:3:windowPreviewWindowList@dalcde:3', 'panel1:right:0:notifications@cinnamon.org:4', 'panel1:right:1:settings@cinnamon.org:5', 'panel1:right:2:removable-drives@cinnamon.org:6', 'panel1:right:3:bluetooth@cinnamon.org:7', 'panel1:right:4:network@cinnamon.org:8', 'panel1:right:5:sound@cinnamon.org:9', 'panel1:right:6:power@cinnamon.org:10', 'panel1:right:7:systray@cinnamon.org:11', 'panel1:right:8:cpu-monitor@iscas.as.cn:12', 'panel1:right:9:calendar@cinnamon.org:13', 'panel1:right:10:windows-quick-list@cinnamon.org:14']
org.cinnamon panel-launchers ['firefox.desktop', 'gnome-screenshot.desktop', 'gnome-terminal.desktop', 'thunderbird.desktop', 'fcitx-configtool.desktop', 'cinnamon-custom-launcher-3.desktop']
org.cinnamon panel-launchers-draggable true

可看出panel-launchers的值。

gconf对应的文件是以文本文件存在的,在Linux Mint系统中主要存放在以下两个位置:
/usr/share/glib-2.0/schemas/
/usr/share/gconf/schemas/

Ref:



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值