self->priv->config = g_key_file_new();
/* g_get_user_config_dir() ==== ~/.config/ */
self->priv->config_file = g_build_filename(g_get_user_config_dir(), //创建config文件
"virt-viewer", "settings", NULL);
/* config_file==== ~/virt-viewer/settings */
g_key_file_load_from_file(self->priv->config, self->priv->config_file,
G_KEY_FILE_KEEP_COMMENTS|G_KEY_FILE_KEEP_TRANSLATIONS, &error); //加载config文件
/*这是写配置到config,若是string,g_key_file_set_string()/
g_key_file_set_boolean(self->priv->config,
"virt-viewer", "ask-quit", !dont_ask);
/*获取ui类别下的toolbar字段的bool, 若是string,g_key_file_get_string()/
gboolean ask = g_key_file_get_boolean(self->priv->config,
"virt-viewer", "ask-quit", &error);
参考链接:
http://web.mit.edu/ghudson/dev/nokrb/third/gtk2/docs/reference/gtk/html/GtkCheckButton.html
https://developer.gimp.org/api/2.0/gtk/GtkWindow.html#gtk-window-set-default-icon-name
https://developer.gnome.org/glib/stable/glib-Miscellaneous-Utility-Functions.html#g-build-filename