搜索

6.3. GSettings 值

download PDF

每个 GSettings 键都将特定设置的值存储为 GVariant 数据类型。要修改键的值,您必须使用 GVariant 文本格式指定值。

GVariant 支持以下数据类型:

数据类型GVariant 文本格式示例

Boolean

  • true
  • false

String

  • 'option1'
  • "option2"

Number

  • 5
  • 37.5
  • 3.75e1

tuple

  • ("hello", 42)

Array

  • [1, 2, 3]

Dictionary

  • {1: "one", 2: "two", 3: "three"}

Variant

  • [<"hello">, <42>]

Maybe

  • just 'hello'
  • nothing

Byte string

  • b'abc'
  • b"abc"
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.