Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Gtk+/Gnome Application Development
Prev Home Next

Other Config File Operations

Figure 7 lists some additional operations available for manipulating config files. The most important of these have already been mentioned in passing. gnome_config_sync() writes the configuration file to disk, and gnome_config_push_prefix() allows you to shorten the path passed to the other gnome-config functions. There are also boolean tests, to ask gnome-config whether a given section exists.

Two new operations are introduced: to drop a file or section means to forget any information about it stored in memory, including cached values loaded from the file and values not yet saved to the file with gnome_config_sync(). To clean a file, section, or key means to unset its value(s), so the file, section, or key will not exist once gnome_config_sync() is called.

gnome_config_sync() automatically calls gnome_config_drop_all() to free all gnome-config resources, since the information is safely stored on disk.

Functions are also provided to get the "real" (filesystem) path of a configuration file from a gnome-config path. These are unlikely to be useful in application code.

#include <libgnome/gnome-config.h>

gboolean gnome_config_has_section(const gchar* path);

gboolean gnome_config_private_has_section(const gchar* path);

void gnome_config_drop_all(void);

void gnome_config_sync(void);

void gnome_config_sync_file(const gchar* path);

void gnome_config_private_sync_file(const gchar* path);

void gnome_config_drop_file(const gchar* path);

void gnome_config_private_drop_file(const gchar* path);

void gnome_config_clean_file(const gchar* path);

void gnome_config_private_clean_file(const gchar* path);

void gnome_config_clean_section(const gchar* path);

void gnome_config_private_clean_section(const gchar* path);

void gnome_config_clean_key(const gchar* path);

void gnome_config_private_clean_key(const gchar* path);

gchar* gnome_config_get_real_path(const gchar* path);

gchar* gnome_config_private_get_real_path(const gchar* path);

void gnome_config_push_prefix(const gchar* path);

void gnome_config_pop_prefix(void);

Figure 7. Miscellaneous configuration file functions

Gtk+/Gnome Application Development
Prev Home Next

  Published under free license. Design by Interspire