• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ g_key_file_has_key函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
    }
}
开发者ID:kseistrup,项目名称:profanity,代码行数:11,代码来源:preferences.c


示例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();
}
开发者ID:Cw1X,项目名称:pnmixer,代码行数:11,代码来源:prefs.c


示例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;
    }
}
开发者ID:asdil12,项目名称:profanity,代码行数:11,代码来源:settings.c


示例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;
    }
}
开发者ID:kseistrup,项目名称:profanity,代码行数:11,代码来源:preferences.c


示例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;
}
开发者ID:sushi-irc,项目名称:maki,代码行数:11,代码来源:instance.c


示例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);
}
开发者ID:jubalh,项目名称:pnmixer,代码行数:24,代码来源:main.c


示例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;
}
开发者ID:sizeofvoid,项目名称:profanity,代码行数:12,代码来源:settings.c


示例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;
}
开发者ID:SuspiciouSx,项目名称:gcr,代码行数:65,代码来源:gcr-secret-exchange.c


示例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;
}
开发者ID:NetworkManager,项目名称:NetworkManager,代码行数:22,代码来源:nm-keyfile-utils.c


示例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);
}
开发者ID:Carlos-C-M,项目名称:moloch,代码行数:22,代码来源:config.c


示例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);
}
开发者ID:ashleyblackmore,项目名称:profanity,代码行数:13,代码来源:preferences.c


示例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;
}
开发者ID:Carlos-C-M,项目名称:moloch,代码行数:22,代码来源:config.c


示例13: loadStringList

bool ConfigFile::loadStringList(std::list <std::string> &variable, const std::string &section, 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;
}
开发者ID:hanzz,项目名称:spectrum-load-balancer,代码行数:13,代码来源:configfile.cpp


示例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;
}
开发者ID:Carlos-C-M,项目名称:moloch,代码行数:22,代码来源:config.c


示例15: loadBoolean

bool ConfigFile::loadBoolean(bool &variable, const std::string &section, 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;
}
开发者ID:hanzz,项目名称:spectrum-load-balancer,代码行数:13,代码来源:configfile.cpp


示例16: cd_mail_retrieve_pop3_params

void cd_mail_retrieve_pop3_params (CDMailAccount *mailaccount, GKeyFile *pKeyFile, gchar *mailbox_name)
{
  if( !mailaccount || !pKeyFile || !mailbox_name ) return;

  gboolean bFlushConfFileNeeded = FALSE;

  mailaccount->driver = POP3_STORAGE;
  mailaccount->storage = mailstorage_new(NULL);
  mailaccount->folder = NULL;
  mailaccount->server = NULL;
  mailaccount->port = 0;
  mailaccount->connection_type = CONNECTION_TYPE_PLAIN;
  mailaccount->user = NULL;
  mailaccount->password = NULL;
  mailaccount->auth_type = POP3_AUTH_TYPE_TRY_APOP;
  mailaccount->path = NULL;
  mailaccount->timeout = 0;
  
  if (g_key_file_has_key (pKeyFile, mailbox_name, "host", NULL))
  {
    mailaccount->server = CD_CONFIG_GET_STRING (mailbox_name, "host");
  }
  if (g_key_file_has_key (pKeyFile, mailbox_name, "username", NULL))
  {
    mailaccount->user = CD_CONFIG_GET_STRING (mailbox_name, "username");
  }
  if (g_key_file_has_key (pKeyFile, mailbox_name, "password", NULL))
  {
    gchar *encryptedPassword = CD_CONFIG_GET_STRING (mailbox_name, "password");
    cairo_dock_decrypt_string( encryptedPassword,  &(mailaccount->password) );

    if( encryptedPassword ) g_free(encryptedPassword);
  }
  mailaccount->connection_type = CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT (mailbox_name, "use secure connection", FALSE)?CONNECTION_TYPE_TLS:CONNECTION_TYPE_PLAIN;
  mailaccount->port = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "port", 0);

  mailaccount->timeout = CD_CONFIG_GET_INTEGER_WITH_DEFAULT (mailbox_name, "timeout mn", 10);
}
开发者ID:BackupTheBerlios,项目名称:cairo-dock-svn,代码行数:38,代码来源:cd-mail-applet-accounts.c


示例17: prefs_get_roster_presence_indent

gint
prefs_get_roster_presence_indent(void)
{
    if (!g_key_file_has_key(prefs, PREF_GROUP_UI, "roster.presence.indent", NULL)) {
        return 2;
    }

    gint result = g_key_file_get_integer(prefs, PREF_GROUP_UI, "roster.presence.indent", NULL);
    if (result < -1) {
        result = 0;
    }

    return result;
}
开发者ID:0xPoly,项目名称:profanity,代码行数:14,代码来源:preferences.c


示例18: load_session_file

static void
load_session_file (const char              *id,
                   const char              *path)
{
        GKeyFile          *key_file;
        GError            *error;
        gboolean           res;
        GdmSessionFile    *session;

        key_file = g_key_file_new ();

        error = NULL;
        res = g_key_file_load_from_file (key_file, path, 0, &error);

        if (!res) {
                g_debug ("Failed to load \"%s\": %s\n", path, error->message);
                g_error_free (error);
                goto out;
        }

        if (! g_key_file_has_group (key_file, G_KEY_FILE_DESKTOP_GROUP)) {
                goto out;
        }

        res = g_key_file_has_key (key_file, G_KEY_FILE_DESKTOP_GROUP, "Name", NULL);
        if (! res) {
                g_debug ("\"%s\" contains no \"Name\" key\n", path);
                goto out;
        }

        if (!key_file_is_relevant (key_file)) {
                g_debug ("\"%s\" is hidden or contains non-executable TryExec program\n", path);
                goto out;
        }

        session = g_new0 (GdmSessionFile, 1);

        session->id = g_strdup (id);
        session->path = g_strdup (path);

        session->translated_name = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, "Name", NULL, NULL);
        session->translated_comment = g_key_file_get_locale_string (key_file, G_KEY_FILE_DESKTOP_GROUP, "Comment", NULL, NULL);

        g_hash_table_insert (gdm_available_sessions_map,
                             g_strdup (id),
                             session);
 out:
        g_key_file_free (key_file);
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-stage-1,代码行数:49,代码来源:gdm-sessions.c


示例19: which_erlang

// which version of erlang is configured for this particular
// branch of the dir tree
gchar* which_erlang() {
  gchar* cfgfile = configcheckfromcwd();
  if(cfgfile == NULL) {
    // check for a system root. 
    // if one doesn't exist, return the system_default
    gchar *sysroot = systemrootcheck_from_cwd();
    if(sysroot != NULL) {
      return sysroot;
    } else {
      return get_system_default();
    }
  } else {
    if(g_file_test(cfgfile, G_FILE_TEST_EXISTS |
          G_FILE_TEST_IS_REGULAR)) {
      GKeyFile* kf = g_key_file_new();
      GError* err = NULL;
      if(!g_key_file_load_from_file(kf, cfgfile, G_KEY_FILE_NONE, &err)) {
        if(err != NULL) {
          g_error("Cannot load %s: %s\n", cfgfile, err->message);
        } else {
          g_error("Cannot load %s\n", cfgfile);
        }
      } else {
        if(!g_key_file_has_group(kf, "Config")) {
          g_error("Config group not defined in %s\n", cfgfile);
          return NULL;
        } else {
          err = NULL;
          if(g_key_file_has_key(kf, "Config", "Erlang", &err)) {
            gchar* erlversion = g_key_file_get_string(kf, "Config", "Erlang", &err);
            g_free(cfgfile);
            // THIS VALUE MUST BE FREED
            return erlversion;
          } else {
            if(err != NULL) {
              g_error("Missing Erlang | version: %s\n", err->message);
            } else {
              g_error("Missing Erlang | version\n");
            }
            return NULL;
          }
        }
      }
    } else {
      return NULL;
    }
  }
  return NULL;
}
开发者ID:mkb,项目名称:erln8,代码行数:51,代码来源:erln8.c


示例20: get_vol_command

gchar* get_vol_command() {
  if (g_key_file_has_key(keyFile,"PNMixer","VolumeControlCommand",NULL)) 
    return g_key_file_get_string(keyFile,"PNMixer","VolumeControlCommand",NULL);
  else {
    gchar buf[256];
    const char** cmd = vol_cmds;
    while (*cmd) {
      snprintf(buf, 256, "which %s | grep /%s > /dev/null",*cmd,*cmd);
      if (!system(buf))
	return g_strdup(*cmd);
      cmd++;
    }
    return NULL;
  }
}
开发者ID:Cw1X,项目名称:pnmixer,代码行数:15,代码来源:prefs.c



注:本文中的g_key_file_has_key函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ g_key_file_new函数代码示例发布时间:2022-05-30
下一篇:
C++ g_dbus_proxy_call_sync函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap