本文整理汇总了C++中g_key_file_has_key函数的典型用法代码示例。如果您正苦于以下问题:C++ g_key_file_has_key函数的具体用法?C++ g_key_file_has_key怎么用?C++ g_key_file_has_key使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了g_key_file_has_key函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prefs_add_alias
gboolean
prefs_add_alias(const char * const name, const char * const value)
{
if (g_key_file_has_key(prefs, PREF_GROUP_ALIAS, name, NULL)) {
return FALSE;
} else {
g_key_file_set_string(prefs, PREF_GROUP_ALIAS, name, value);
_save_prefs();
return TRUE;
}
}
示例2: get_icon_theme
void get_icon_theme() {
if (g_key_file_has_key(keyFile,"PNMixer","IconTheme",NULL)) {
gchar* theme_name = g_key_file_get_string(keyFile,"PNMixer","IconTheme",NULL);
if (icon_theme == NULL || (icon_theme == gtk_icon_theme_get_default()))
icon_theme = gtk_icon_theme_new();
gtk_icon_theme_set_custom_theme(icon_theme,theme_name);
g_free(theme_name);
}
else
icon_theme = gtk_icon_theme_get_default();
}
示例3: plugin_settings_get_string
char*
plugin_settings_get_string(const char *const group, const char *const key, const char *const def)
{
if (group && key && g_key_file_has_key(settings, group, key, NULL)) {
return g_key_file_get_string(settings, group, key, NULL);
} else if (def) {
return strdup(def);
} else {
return NULL;
}
}
示例4: prefs_remove_alias
gboolean
prefs_remove_alias(const char * const name)
{
if (!g_key_file_has_key(prefs, PREF_GROUP_ALIAS, name, NULL)) {
return FALSE;
} else {
g_key_file_remove_key(prefs, PREF_GROUP_ALIAS, name, NULL);
_save_prefs();
return TRUE;
}
}
示例5: maki_instance_config_exists
gboolean
maki_instance_config_exists (makiInstance* inst, gchar const* group, gchar const* key)
{
gboolean ret;
g_mutex_lock(inst->mutex.config);
ret = g_key_file_has_key(inst->key_file, group, key, NULL);
g_mutex_unlock(inst->mutex.config);
return ret;
}
示例6: update_vol_text
/**
* Updates the alignment of the volume text which is shown on the
* volume popup_window (left click) around the scroll bar.
*/
void update_vol_text() {
gboolean show = TRUE;
if (g_key_file_has_key(keyFile,"PNMixer","DisplayTextVolume",NULL))
show = g_key_file_get_boolean(keyFile,"PNMixer","DisplayTextVolume",NULL);
if (show) {
GtkPositionType pos = GTK_POS_RIGHT;
if (g_key_file_has_key(keyFile,"PNMixer","TextVolumePosition",NULL)) {
gint pi = g_key_file_get_integer(keyFile,"PNMixer","TextVolumePosition",NULL);
pos =
pi==0?GTK_POS_TOP:
pi==1?GTK_POS_BOTTOM:
pi==2?GTK_POS_LEFT:
GTK_POS_RIGHT;
}
gtk_scale_set_draw_value (GTK_SCALE (vol_scale), TRUE);
gtk_scale_set_value_pos (GTK_SCALE (vol_scale), pos);
}
else
gtk_scale_set_draw_value (GTK_SCALE (vol_scale), FALSE);
}
示例7: plugin_settings_string_list_clear
int
plugin_settings_string_list_clear(const char *const group, const char *const key)
{
if (!g_key_file_has_key(settings, group, key, NULL)) {
return 0;
}
g_key_file_remove_key(settings, group, key, NULL);
_save_settings();
return 1;
}
示例8: gcr_secret_exchange_receive
/**
* gcr_secret_exchange_receive:
* @self: a #GcrSecretExchange object
* @exchange: the string received
*
* Receive a string from the other side of secret exchange. This string will
* have been created by gcr_secret_exchange_begin() or gcr_secret_exchange_send().
*
* After this call completes successfully the value returned from
* gcr_secret_exchange_get_secret() will have changed.
*
* Returns: whether the string was successfully parsed and received
*/
gboolean
gcr_secret_exchange_receive (GcrSecretExchange *self,
const gchar *exchange)
{
GcrSecretExchangeClass *klass;
gchar *secret = NULL;
gsize n_secret = 0;
GKeyFile *input;
gboolean ret;
g_return_val_if_fail (GCR_IS_SECRET_EXCHANGE (self), FALSE);
g_return_val_if_fail (exchange != NULL, FALSE);
klass = GCR_SECRET_EXCHANGE_GET_CLASS (self);
g_return_val_if_fail (klass->generate_exchange_key, FALSE);
g_return_val_if_fail (klass->derive_transport_key, FALSE);
/* Parse the input */
input = g_key_file_new ();
if (!g_key_file_load_from_data (input, exchange, strlen (exchange),
G_KEY_FILE_NONE, NULL)) {
g_key_file_free (input);
g_message ("couldn't parse secret exchange data");
return FALSE;
}
if (!self->pv->generated) {
if (!(klass->generate_exchange_key) (self, GCR_SECRET_EXCHANGE_PROTOCOL_1,
&self->pv->publi, &self->pv->n_publi))
g_return_val_if_reached (FALSE);
self->pv->generated = TRUE;
}
ret = TRUE;
if (!self->pv->derived) {
if (!derive_key (self, input))
ret = FALSE;
}
if (ret && g_key_file_has_key (input, GCR_SECRET_EXCHANGE_PROTOCOL_1, "secret", NULL))
ret = perform_decrypt (self, input, (guchar **)&secret, &n_secret);
if (ret) {
egg_secure_free (self->pv->secret);
self->pv->secret = secret;
self->pv->n_secret = n_secret;
}
g_key_file_free (input);
return ret;
}
示例9: nm_keyfile_plugin_kf_has_key
gboolean
nm_keyfile_plugin_kf_has_key (GKeyFile *kf,
const char *group,
const char *key,
GError **error)
{
gboolean has;
const char *alias;
GError *local = NULL;
has = g_key_file_has_key (kf, group, key, &local);
if (g_error_matches (local, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_GROUP_NOT_FOUND)) {
alias = nm_keyfile_plugin_get_alias_for_setting_name (group);
if (alias) {
g_clear_error (&local);
has = g_key_file_has_key (kf, alias, key, &local);
}
}
if (local)
g_propagate_error (error, local);
return has;
}
示例10: g_key_file_get_string
gchar *moloch_config_str(GKeyFile *keyfile, char *key, char *d)
{
if (!keyfile)
keyfile = molochKeyFile;
if (g_key_file_has_key(keyfile, config.nodeName, key, NULL)) {
return g_key_file_get_string(keyfile, config.nodeName, key, NULL);
}
if (config.nodeClass && g_key_file_has_key(keyfile, config.nodeClass, key, NULL)) {
return g_key_file_get_string(keyfile, config.nodeClass, key, NULL);
}
if (g_key_file_has_key(keyfile, "default", key, NULL)) {
return g_key_file_get_string(keyfile, "default", key, NULL);
}
if (!d)
return NULL;
return g_strdup(d);
}
示例11: prefs_get_boolean
gboolean
prefs_get_boolean(preference_t pref)
{
const char *group = _get_group(pref);
const char *key = _get_key(pref);
gboolean def = _get_default_boolean(pref);
if (!g_key_file_has_key(prefs, group, key, NULL)) {
return def;
}
return g_key_file_get_boolean(prefs, group, key, NULL);
}
示例12: moloch_config_int
uint32_t moloch_config_int(GKeyFile *keyfile, char *key, uint32_t d, uint32_t min, uint32_t max)
{
uint32_t value = d;
if (!keyfile)
keyfile = molochKeyFile;
if (g_key_file_has_key(keyfile, config.nodeName, key, NULL)) {
value = g_key_file_get_integer(keyfile, config.nodeName, key, NULL);
} else if (config.nodeClass && g_key_file_has_key(keyfile, config.nodeClass, key, NULL)) {
value = g_key_file_get_integer(keyfile, config.nodeClass, key, NULL);
} else if (g_key_file_has_key(keyfile, "default", key, NULL)) {
value = g_key_file_get_integer(keyfile, "default", key, NULL);
}
if (value < min)
value = min;
if (value > max)
value = max;
return value;
}
示例13: loadStringList
bool ConfigFile::loadStringList(std::list <std::string> &variable, const std::string §ion, const std::string &key) {
char **bind;
variable.clear();
if (g_key_file_has_key(keyfile, section.c_str(), key.c_str(), NULL)) {
bind = g_key_file_get_string_list(keyfile, section.c_str(), key.c_str(), NULL, NULL);
for (int i = 0; bind[i]; i++) {
variable.push_back(bind[i]);
}
g_strfreev (bind);
return true;
}
return false;
}
示例14: moloch_config_double
double moloch_config_double(GKeyFile *keyfile, char *key, double d, double min, double max)
{
double value = d;
if (!keyfile)
keyfile = molochKeyFile;
if (g_key_file_has_key(keyfile, config.nodeName, key, NULL)) {
value = g_key_file_get_double(keyfile, config.nodeName, key, NULL);
} else if (config.nodeClass && g_key_file_has_key(keyfile, config.nodeClass, key, NULL)) {
value = g_key_file_get_double(keyfile, config.nodeClass, key, NULL);
} else if (g_key_file_has_key(keyfile, "default", key, NULL)) {
value = g_key_file_get_double(keyfile, "default", key, NULL);
}
if (value < min)
value = min;
if (value > max)
value = max;
return value;
}
示例15: loadBoolean
bool ConfigFile::loadBoolean(bool &variable, const std::string §ion, const std::string &key, bool def, bool required) {
if (g_key_file_has_key(keyfile, section.c_str(), key.c_str(), NULL))
variable = g_key_file_get_boolean(keyfile, section.c_str(), key.c_str(), NULL);
else {
if (required) {
Log("loadConfigFile", "You have to specify `" << key << "` in [" << section << "] section of config file.");
return false;
}
else
variable = def;
}
return true;
}