コード例 #1
0
JNIEXPORT jint JNICALL WebKitGTK_NATIVE(_1webkit_1major_1version)
	(JNIEnv *env, jclass that)
{
	jint rc = 0;
	WebKitGTK_NATIVE_ENTER(env, that, _1webkit_1major_1version_FUNC);
	rc = (jint)webkit_major_version();
	WebKitGTK_NATIVE_EXIT(env, that, _1webkit_1major_1version_FUNC);
	return rc;
}
コード例 #2
0
ファイル: luah.c プロジェクト: pawelz/luakit
/* luakit global table.
 * \param L The Lua VM state.
 * \return The number of elements pushed on stack.
 * \luastack
 * \lfield font The default font.
 * \lfield font_height The default font height.
 * \lfield conffile The configuration file which has been loaded.
 */
static gint
luaH_luakit_index(lua_State *L)
{
    if(luaH_usemetatable(L, 1, 2))
        return 1;

    widget_t *w;
    const gchar *prop = luaL_checkstring(L, 2);
    luakit_token_t token = l_tokenize(prop);

    switch(token) {

      /* push class methods */
      PF_CASE(GET_SPECIAL_DIR,  luaH_luakit_get_special_dir)
      PF_CASE(SPAWN,            luaH_luakit_spawn)
      PF_CASE(SPAWN_SYNC,       luaH_luakit_spawn_sync)
      PF_CASE(GET_SELECTION,    luaH_luakit_get_selection)
      PF_CASE(SET_SELECTION,    luaH_luakit_set_selection)
      PF_CASE(EXEC,             luaH_exec)
      /* push string properties */
      PS_CASE(CACHE_DIR,        globalconf.cache_dir)
      PS_CASE(CONFIG_DIR,       globalconf.config_dir)
      PS_CASE(DATA_DIR,         globalconf.data_dir)
      PS_CASE(EXECPATH,         globalconf.execpath)
      PS_CASE(CONFPATH,         globalconf.confpath)
      /* push boolean properties */
      PB_CASE(VERBOSE,          globalconf.verbose)
      /* push integer properties */
      PI_CASE(WEBKIT_MAJOR_VERSION, webkit_major_version())
      PI_CASE(WEBKIT_MINOR_VERSION, webkit_minor_version())
      PI_CASE(WEBKIT_MICRO_VERSION, webkit_micro_version())
      PI_CASE(WEBKIT_USER_AGENT_MAJOR_VERSION, WEBKIT_USER_AGENT_MAJOR_VERSION)
      PI_CASE(WEBKIT_USER_AGENT_MINOR_VERSION, WEBKIT_USER_AGENT_MINOR_VERSION)

      case L_TK_WINDOWS:
        lua_newtable(L);
        for (guint i = 0; i < globalconf.windows->len; i++) {
            w = globalconf.windows->pdata[i];
            luaH_object_push(L, w->ref);
            lua_rawseti(L, -2, i+1);
        }
        return 1;

      case L_TK_INSTALL_PATH:
        lua_pushliteral(L, LUAKIT_INSTALL_PATH);
        return 1;

      case L_TK_VERSION:
        lua_pushliteral(L, VERSION);
        return 1;

      default:
        break;
    }
    return 0;
}