├── .changes ├── config.json └── readme.md ├── .github ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ ├── build.yml │ ├── covector-status.yml │ └── covector-version-or-publish.yml ├── .gitignore ├── .gitmodules ├── .license_template ├── CHANGELOG.md ├── Cargo.toml ├── Gir.toml ├── LICENSE ├── README.md ├── check_init_asserts ├── examples └── main.rs ├── rustfmt.toml ├── src ├── auto │ ├── application_info.rs │ ├── authentication_request.rs │ ├── automation_session.rs │ ├── back_forward_list.rs │ ├── back_forward_list_item.rs │ ├── color_chooser_request.rs │ ├── context_menu.rs │ ├── context_menu_item.rs │ ├── cookie_manager.rs │ ├── credential.rs │ ├── device_info_permission_request.rs │ ├── download.rs │ ├── editor_state.rs │ ├── enums.rs │ ├── favicon_database.rs │ ├── file_chooser_request.rs │ ├── find_controller.rs │ ├── flags.rs │ ├── form_submission_request.rs │ ├── geolocation_manager.rs │ ├── geolocation_permission_request.rs │ ├── geolocation_position.rs │ ├── hit_test_result.rs │ ├── input_method_context.rs │ ├── input_method_underline.rs │ ├── install_missing_media_plugins_permission_request.rs │ ├── itp_first_party.rs │ ├── itp_third_party.rs │ ├── javascript_result.rs │ ├── media_key_system_permission_request.rs │ ├── memory_pressure_settings.rs │ ├── mime_info.rs │ ├── mod.rs │ ├── navigation_action.rs │ ├── navigation_policy_decision.rs │ ├── network_proxy_settings.rs │ ├── notification.rs │ ├── notification_permission_request.rs │ ├── option_menu.rs │ ├── option_menu_item.rs │ ├── permission_request.rs │ ├── plugin.rs │ ├── pointer_lock_permission_request.rs │ ├── policy_decision.rs │ ├── print_custom_widget.rs │ ├── print_operation.rs │ ├── response_policy_decision.rs │ ├── script_dialog.rs │ ├── security_manager.rs │ ├── security_origin.rs │ ├── settings.rs │ ├── uri_request.rs │ ├── uri_response.rs │ ├── uri_scheme_request.rs │ ├── uri_scheme_response.rs │ ├── user_content_manager.rs │ ├── user_media_permission_request.rs │ ├── user_message.rs │ ├── user_script.rs │ ├── user_style_sheet.rs │ ├── versions.txt │ ├── web_context.rs │ ├── web_inspector.rs │ ├── web_resource.rs │ ├── web_view.rs │ ├── web_view_base.rs │ ├── web_view_session_state.rs │ ├── website_data.rs │ ├── website_data_access_permission_request.rs │ ├── website_data_manager.rs │ ├── website_policies.rs │ └── window_properties.rs ├── credential.rs ├── javascript_result.rs ├── lib.rs ├── rt.rs ├── web_context.rs ├── web_view.rs └── website_data_manager.rs └── sys ├── CHANGELOG.md ├── Cargo.toml ├── Gir.toml ├── LICENSE ├── build.rs ├── src └── lib.rs ├── tests ├── abi.rs ├── constant.c ├── layout.c └── manual.h └── versions.txt /.changes/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "gitSiteUrl": "https://github.com/tauri-apps/javascriptcore-rs/", 3 | "timeout": 3600000, 4 | "additionalBumpTypes": ["housekeeping"], 5 | "pkgManagers": { 6 | "rust": { 7 | "version": true, 8 | "getPublishedVersion": "cargo search ${ pkg.pkg } --limit 1 | sed -nE 's/^[^\"]*\"//; s/\".*//1p'", 9 | "prepublish": [ 10 | "sudo apt-get update", 11 | "sudo apt-get install -y libgtk-3-dev webkit2gtk-4.1", 12 | "cargo install cargo-audit --features=fix", 13 | { 14 | "command": "cargo generate-lockfile", 15 | "dryRunCommand": true, 16 | "runFromRoot": true, 17 | "pipe": true 18 | }, 19 | { 20 | "command": "echo \"# Cargo Audit\"", 21 | "dryRunCommand": true, 22 | "pipe": true 23 | }, 24 | { 25 | "command": "echo \"\\`\\`\\`\"", 26 | "dryRunCommand": true, 27 | "pipe": true 28 | }, 29 | { 30 | "command": "cargo audit ${ process.env.CARGO_AUDIT_OPTIONS || '' }", 31 | "dryRunCommand": true, 32 | "runFromRoot": true, 33 | "pipe": true 34 | }, 35 | { 36 | "command": "echo \"\\`\\`\\`\"", 37 | "dryRunCommand": true, 38 | "pipe": true 39 | } 40 | ], 41 | "publish": [ 42 | { 43 | "command": "cargo package --allow-dirty", 44 | "dryRunCommand": true 45 | }, 46 | { 47 | "command": "echo \"# Cargo Publish\"", 48 | "dryRunCommand": true, 49 | "pipe": true 50 | }, 51 | { 52 | "command": "echo \"\\`\\`\\`\"", 53 | "dryRunCommand": true, 54 | "pipe": true 55 | }, 56 | { 57 | "command": "cargo publish --no-verify", 58 | "dryRunCommand": "cargo publish --no-verify --dry-run --allow-dirty", 59 | "pipe": true 60 | }, 61 | { 62 | "command": "echo \"\\`\\`\\`\"", 63 | "dryRunCommand": true, 64 | "pipe": true 65 | } 66 | ], 67 | "postpublish": [ 68 | "git tag ${ pkg.pkg }-v${ pkgFile.versionMajor } -f", 69 | "git tag ${ pkg.pkg }-v${ pkgFile.versionMajor }.${ pkgFile.versionMinor } -f", 70 | "git push --tags -f" 71 | ], 72 | "assets": [ 73 | { 74 | "path": "${ pkg.path }/${ pkg.pkg }-${ pkgFile.version }.crate", 75 | "name": "${ pkg.pkg }-${ pkgFile.version }.crate" 76 | } 77 | ] 78 | } 79 | }, 80 | "packages": { 81 | "webkit2gtk-sys": { 82 | "path": "./sys", 83 | "manager": "rust" 84 | }, 85 | "webkit2gtk-rs": { 86 | "path": "./", 87 | "manager": "rust" 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /.changes/readme.md: -------------------------------------------------------------------------------- 1 | # Changes 2 | 3 | ##### via https://github.com/jbolda/covector 4 | 5 | As you create PRs and make changes that require a version bump, please add a new markdown file in this folder. You do not note the version _number_, but rather the type of bump that you expect: major, minor, or patch. The filename is not important, as long as it is a `.md`, but we recommend that it represents the overall change for organizational purposes. 6 | 7 | When you select the version bump required, you do _not_ need to consider dependencies. Only note the package with the actual change, and any packages that depend on that package will be bumped automatically in the process. 8 | 9 | Use the following format: 10 | 11 | ```md 12 | --- 13 | "package-a": patch 14 | "package-b": minor 15 | --- 16 | 17 | Change summary goes here 18 | 19 | ``` 20 | 21 | Summaries do not have a specific character limit, but are text only. These summaries are used within the (future implementation of) changelogs. They will give context to the change and also point back to the original PR if more details and context are needed. 22 | 23 | Changes will be designated as a `major`, `minor` or `patch` as further described in [semver](https://semver.org/). 24 | 25 | Given a version number MAJOR.MINOR.PATCH, increment the: 26 | 27 | - MAJOR version when you make incompatible API changes, 28 | - MINOR version when you add functionality in a backwards compatible manner, and 29 | - PATCH version when you make backwards compatible bug fixes. 30 | 31 | Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format, but will be discussed prior to usage (as extra steps will be necessary in consideration of merging and publishing). 32 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Current WG Code Sub Teams: 2 | # @tauri-apps/admins 3 | # @tauri-apps/core 4 | # @tauri-apps/testing 5 | 6 | # admins default to review 7 | # Order is important; the last matching pattern takes the most precedence. 8 | * @tauri-apps/admins 9 | 10 | .github @tauri-apps/admins @tauri-apps/testing 11 | 12 | /examples/ @tauri-apps/testing 13 | 14 | /src/ @tauri-apps/core 15 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. 4 | 5 | We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion. 6 | 7 | Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. 8 | 9 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. 10 | 11 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. 12 | 13 | This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/) 14 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # 4 | patreon: # 5 | open_collective: tauri 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | custom: # Replace with a single custom sponsorship URL 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve Tauri 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **Steps To Reproduce** 14 | Steps to reproduce the behavior: 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **Screenshots** 20 | If applicable, add screenshots to help explain your problem. 21 | 22 | **Platform and Versions (please complete the following information):** 23 | OS: 24 | Rustc: 25 | 26 | **Additional context** 27 | Add any other context about the problem here. 28 | 29 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for Tauri 4 | title: '' 5 | labels: feature request 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | 22 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 22 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | test: 7 | strategy: 8 | fail-fast: false 9 | matrix: 10 | rust_version: [stable] 11 | platform: 12 | - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest } 13 | 14 | runs-on: ${{ matrix.platform.os }} 15 | 16 | steps: 17 | - uses: actions/checkout@v2 18 | - name: install stable 19 | uses: actions-rs/toolchain@v1 20 | with: 21 | toolchain: stable 22 | target: ${{ matrix.platform.target }} 23 | 24 | - name: install webkit2gtk (ubuntu only) 25 | if: matrix.platform.os == 'ubuntu-latest' 26 | run: | 27 | sudo apt-get update 28 | sudo apt-get install -y webkit2gtk-4.1-dev 29 | 30 | - name: Get current date 31 | run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV 32 | 33 | - name: Cache cargo registry 34 | uses: actions/cache@v2.1.4 35 | with: 36 | path: ~/.cargo/registry 37 | # Add date to the cache to keep it up to date 38 | key: ${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('Cargo.toml') }}-${{ env.CURRENT_DATE }} 39 | # Restore from outdated cache for speed 40 | restore-keys: | 41 | ${{ matrix.platform }}-stable-cargo-registry-${{ hashFiles('Cargo.toml') }} 42 | ${{ matrix.platform }}-stable-cargo-registry- 43 | 44 | - name: Cache cargo index 45 | uses: actions/cache@v2.1.4 46 | with: 47 | path: ~/.cargo/git 48 | # Add date to the cache to keep it up to date 49 | key: ${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('Cargo.toml') }}-${{ env.CURRENT_DATE }} 50 | # Restore from outdated cache for speed 51 | restore-keys: | 52 | ${{ matrix.platform }}-stable-cargo-index-${{ hashFiles('Cargo.toml') }} 53 | ${{ matrix.platform }}-stable-cargo-index- 54 | 55 | - name: Cache cargo target 56 | uses: actions/cache@v2 57 | with: 58 | path: target 59 | # Add date to the cache to keep it up to date 60 | key: ${{ matrix.platform }}-stable-cargo-core-${{ hashFiles('Cargo.toml') }}-${{ env.CURRENT_DATE }} 61 | # Restore from outdated cache for speed 62 | restore-keys: | 63 | ${{ matrix.platform }}-stable-cargo-core-${{ hashFiles('Cargo.toml') }} 64 | ${{ matrix.platform }}-stable-cargo-core- 65 | 66 | - name: Cargo fmt 67 | uses: actions-rs/cargo@v1 68 | with: 69 | command: fmt 70 | args: --all -- --check 71 | 72 | - name: build webkit2gtk 73 | run: cargo build --target ${{ matrix.platform.target }} 74 | 75 | - name: build and run tests 76 | run: cargo test --verbose --target ${{ matrix.platform.target }} 77 | 78 | -------------------------------------------------------------------------------- /.github/workflows/covector-status.yml: -------------------------------------------------------------------------------- 1 | name: covector status 2 | on: [pull_request] 3 | 4 | jobs: 5 | covector: 6 | runs-on: ubuntu-latest 7 | 8 | steps: 9 | - uses: actions/checkout@v2 10 | with: 11 | fetch-depth: 0 12 | - name: covector status 13 | uses: jbolda/covector/packages/action@covector-v0 14 | id: covector 15 | with: 16 | command: 'status' 17 | -------------------------------------------------------------------------------- /.github/workflows/covector-version-or-publish.yml: -------------------------------------------------------------------------------- 1 | name: version or publish 2 | 3 | on: 4 | push: 5 | branches: 6 | - crate 7 | 8 | jobs: 9 | version-or-publish: 10 | runs-on: ubuntu-latest 11 | timeout-minutes: 65 12 | outputs: 13 | change: ${{ steps.covector.outputs.change }} 14 | commandRan: ${{ steps.covector.outputs.commandRan }} 15 | successfulPublish: ${{ steps.covector.outputs.successfulPublish }} 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | with: 20 | fetch-depth: 0 21 | - name: cargo login 22 | run: cargo login ${{ secrets.ORG_CRATES_IO_TOKEN }} 23 | - name: git config 24 | run: | 25 | git config --global user.name "${{ github.event.pusher.name }}" 26 | git config --global user.email "${{ github.event.pusher.email }}" 27 | - name: covector version or publish (publish when no change files present) 28 | uses: jbolda/covector/packages/action@covector-v0 29 | id: covector 30 | env: 31 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 32 | CARGO_AUDIT_OPTIONS: ${{ secrets.CARGO_AUDIT_OPTIONS }} 33 | with: 34 | token: ${{ secrets.GITHUB_TOKEN }} 35 | command: 'version-or-publish' 36 | createRelease: true 37 | - name: Create Pull Request With Versions Bumped 38 | id: cpr 39 | uses: tauri-apps/create-pull-request@v3 40 | if: steps.covector.outputs.commandRan == 'version' 41 | with: 42 | token: ${{ secrets.GITHUB_TOKEN }} 43 | title: "Publish New Versions" 44 | commit-message: "publish new versions" 45 | labels: "version updates" 46 | branch: "release" 47 | body: ${{ steps.covector.outputs.change }} 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | *Cargo.lock -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "gir"] 2 | path = gir 3 | url = https://github.com/gtk-rs/gir.git 4 | [submodule "gir-files"] 5 | path = gir-files 6 | url = https://github.com/tauri-apps/gir-files 7 | -------------------------------------------------------------------------------- /.license_template: -------------------------------------------------------------------------------- 1 | // Copyright {20\d{2}(-20\d{2})?} The Gtk-rs Project Developers 2 | // Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy 3 | // SPDX-License-Identifier: MIT -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## \[2.0.1] 4 | 5 | - [`74ab5a4`](https://github.com/tauri-apps/javascriptcore-rs/commit/74ab5a403ddfac3ba977cadc499376e1935e6613) Properly replaced dox with docrs. 6 | 7 | ## \[2.0.0] 8 | 9 | - [`b31ff8c`](https://github.com/tauri-apps/javascriptcore-rs/commit/b31ff8cc1438ef1f708b9694caa026d72620cba3) Update gtk to 0.18. 10 | 11 | Bump MSRV to 1.70.0. 12 | 13 | ## \[1.1.1] 14 | 15 | - [`e95f84a`](https://github.com/tauri-apps/javascriptcore-rs/commit/e95f84a72bc7e6fc367929fd04f5aa795a5d00df) Lock webkit2gtk version to 1.0. 16 | 17 | ## \[1.1.0] 18 | 19 | - [`5f8f15f`](https://github.com/tauri-apps/javascriptcore-rs/commit/5f8f15f2303d25083c885c2309e90ad98a8b780e) Update to webkit2gtk v2.40. 20 | 21 | ## \[1.0.0] 22 | 23 | - Bump version to 1.0. 24 | - [31b3ddf](https://github.com/tauri-apps/javascriptcore-rs/commit/31b3ddf725a394499d2a3a03a776d34e73464a66) Bump version to v1.0 on 2023-04-04 25 | 26 | ## \[0.19.2] 27 | 28 | - Enable dox feature when building docs. 29 | - [a59c76d](https://github.com/tauri-apps/javascriptcore-rs/commit/a59c76dfe31b05e20ca809dc3ce4113a2e54a7d7) Enable dox feature when building docs on 2023-01-31 30 | 31 | ## \[0.19.1] 32 | 33 | - Update javascriptcore to crates.io dependency. 34 | - [38b4d26](https://github.com/tauri-apps/javascriptcore-rs/commit/38b4d2647db6fad4791ec21897d23722c79a1015) Update jsc to crate.io's dependency. on 2023-01-26 35 | 36 | ## \[0.19.0] 37 | 38 | - Bump gtk version: 0.15 -> 0.16, webkit2gtk version: 4.0 -> 4.1 39 | - [c475ff3](https://github.com/tauri-apps/javascriptcore-rs/commit/c475ff39b8412e38cda91c5705a6ad518dd4e5e0) chore: add changelog on 2023-01-25 40 | 41 | ## \[0.18.2] 42 | 43 | - Fix transfer rule of `URISchemeResponse::set_http_headers` to full. 44 | - [609aece](https://github.com/tauri-apps/javascriptcore-rs/commit/609aecedee096fec37618b8e3c1d7c7a43eabc32) Fix transfer rule of `URISchemeResponse::set_http_headers` on 2022-10-17 45 | 46 | ## \[0.18.1] 47 | 48 | - Fix transfer rule of `URISchemeRequest::http_headers` to none. 49 | - [eb1dd5d](https://github.com/tauri-apps/javascriptcore-rs/commit/eb1dd5db0ac1b5a4fb153ca8ac7835e609aa2783) Fix transfer rule of `URISchemeRequest::http_headers` to none on 2022-10-15 50 | 51 | ## \[0.18.0] 52 | 53 | - Update webkit2gtk to 2.36 54 | - [e43696b](https://github.com/tauri-apps/javascriptcore-rs/commit/e43696b55d2ea3cad03c8493dc381dbbf5c741a4) Add change file on 2022-05-06 55 | 56 | ## \[0.17.1] 57 | 58 | - Fix TimeSpan type mismatch. 59 | - [dbbbf7a](https://github.com/tauri-apps/javascriptcore-rs/commit/dbbbf7ae1f9c9c8d91429a694245e7f1e923a49c) Fix TimeSpan type mismatch on 2022-01-19 60 | 61 | ## \[0.17.0] 62 | 63 | - Update to gtk 0.15 64 | - [205e481](https://github.com/tauri-apps/javascriptcore-rs/commit/205e481831a8f008d0c89a31463751c3e7800dfd) Update to gtk 0.15 on 2022-01-18 65 | 66 | ## \[0.16.0] 67 | 68 | - Update to soup2-sys in sys crate. 69 | - [eb53cd6](https://github.com/tauri-apps/javascriptcore-rs/commit/eb53cd68667ea35917a75aac4ed9167ddf4bfa0e) Add change file on 2021-12-23 70 | 71 | ## \[0.15.3] 72 | 73 | - Update with lates gir files 74 | - [cf24027](https://github.com/tauri-apps/javascriptcore-rs/commit/cf240271a1154ff82ae9dcf444fa63d082a8a9f9) Add change file on 2021-11-04 75 | 76 | ## \[0.15.2] 77 | 78 | - Update url in Cargo.toml. 79 | - [f458817](https://github.com/tauri-apps/javascriptcore-rs/commit/f4588172e70e58ff76c63c49cd8a7e576452e33b) Update url in Cargo.toml on 2021-10-25 80 | 81 | ## \[0.15.1] 82 | 83 | - Re-export all traits to public. 84 | - [4951e34](https://github.com/tauri-apps/javascriptcore-rs/commit/4951e345dafd677efeb79e42a63b5ff46baa1111) Re-export all traits to public on 2021-10-06 85 | 86 | ## \[0.15.0] 87 | 88 | - Update webkit2gtk-rs with latest gir. 89 | - [bfd8a39](https://github.com/tauri-apps/javascriptcore-rs/commit/bfd8a397a4a1f2bfc150f2aaf90230c166fc6415) Bump version of webkit2gtk-rs on 2021-10-05 90 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "webkit2gtk" 3 | version = "2.0.1" 4 | edition = "2021" 5 | categories = [ "api-bindings", "gui" ] 6 | description = "Rust bindings for webkit-gtk library" 7 | repository = "https://github.com/tauri-apps/webkit2gtk-rs" 8 | license = "MIT" 9 | keywords = [ "webkit", "gtk-rs", "gnome", "GUI" ] 10 | 11 | [package.metadata.docs.rs] 12 | all-features = true 13 | rustc-args = [ "--cfg", "docsrs" ] 14 | rustdoc-args = [ "--cfg", "docsrs" ] 15 | 16 | [lib] 17 | name = "webkit2gtk" 18 | 19 | [features] 20 | v2_2 = [ ] 21 | v2_4 = [ "v2_2" ] 22 | v2_6 = [ "v2_4", "ffi/v2_6" ] 23 | v2_8 = [ "v2_6", "ffi/v2_8" ] 24 | v2_10 = [ "v2_8", "ffi/v2_10" ] 25 | v2_12 = [ "v2_10", "ffi/v2_12" ] 26 | v2_14 = [ "v2_12", "ffi/v2_14" ] 27 | v2_16 = [ "v2_14", "ffi/v2_16" ] 28 | v2_18 = [ "v2_16", "ffi/v2_18" ] 29 | v2_20 = [ "v2_18", "ffi/v2_20" ] 30 | v2_22 = [ "v2_20", "ffi/v2_22" ] 31 | v2_24 = [ "v2_22", "ffi/v2_24" ] 32 | v2_26 = [ "v2_24", "ffi/v2_26" ] 33 | v2_28 = [ "v2_26", "ffi/v2_28" ] 34 | v2_30 = [ "v2_28", "ffi/v2_30" ] 35 | v2_32 = [ "v2_30", "ffi/v2_32" ] 36 | v2_34 = [ "v2_32", "ffi/v2_34" ] 37 | v2_36 = [ "v2_34", "ffi/v2_36" ] 38 | v2_38 = [ "v2_36", "ffi/v2_38" ] 39 | v2_40 = [ "v2_38", "ffi/v2_40" ] 40 | 41 | [dependencies] 42 | bitflags = "^1.0" 43 | once_cell = "1.8" 44 | libc = "^0.2" 45 | cairo-rs = "^0.18.0" 46 | gdk = "^0.18.0" 47 | gdk-sys = "^0.18.0" 48 | gio = "^0.18.0" 49 | gio-sys = "^0.18.0" 50 | glib = "^0.18.0" 51 | glib-sys = "^0.18.0" 52 | gobject-sys = "^0.18.0" 53 | gtk = "^0.18.0" 54 | gtk-sys = "^0.18.0" 55 | 56 | [dependencies.java_script_core] 57 | package = "javascriptcore-rs" 58 | version = "=1.1" 59 | 60 | [dependencies.soup] 61 | package = "soup3" 62 | version = "0.5" 63 | 64 | [dependencies.ffi] 65 | package = "webkit2gtk-sys" 66 | path = "sys" 67 | version = "2.0.1" 68 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Boucher, Antoni 2 | Copyright (c) 2017-2021, The Gtk-rs Project Developers. 3 | Copyright (c) 2021, Tauri Programme within The Commons Conservancy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # webkit2gtk 2 | 3 | __Rust__ bindings and wrappers for __webkit2gtk__. 4 | 5 | ## Building 6 | 7 | __webkit2gtk-rs__ expects __GTK+__, __GLib__ and __webkit2gtk__ development files to be installed on your system. 8 | See the [requirements page](http://gtk-rs.org/docs/requirements.html). 9 | 10 | ## Using 11 | 12 | ```toml 13 | [dependencies] 14 | webkit2gtk = "0.18.0" 15 | ``` 16 | 17 | ## Simple Example Browser 18 | 19 | You can run the example in example/main.rs with 20 | ```shell 21 | cargo run --example main 22 | ``` 23 | 24 | ## License 25 | 26 | __webkit2gtk-rs__ is available under the MIT License, please refer to it. 27 | -------------------------------------------------------------------------------- /check_init_asserts: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | perl -0777 -ne ' 4 | BEGIN { $e = 0 } 5 | while (/^(\N*)\V*fn\s+(\w+)\s*(<[^(]+>)?\s*(\([^{;]+)\{\N*\n^(\N*)$/gms) { 6 | ($modifiers, $name, $signature, $first_line) = ($1, $2, $4, $5); 7 | unless ($modifiers =~ /^\s*(\/\/|(pub )?unsafe)/ || 8 | $signature =~ /^\((&(\x27\w+ )?)?(mut )?self\b/ || 9 | $signature =~ /^\(\)/ || 10 | $first_line =~ /^\s*( 11 | assert_initialized_main_thread | 12 | assert_not_initialized | 13 | skip_assert_initialized | 14 | callback_guard 15 | )!\(\)/x) { 16 | print "$ARGV: $name$signature\n"; 17 | $e = 1 18 | } 19 | } 20 | END { exit $e }' src/*.rs src/auto/*.rs 21 | -------------------------------------------------------------------------------- /examples/main.rs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016 Boucher, Antoni 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of 5 | * this software and associated documentation files (the "Software"), to deal in 6 | * the Software without restriction, including without limitation the rights to 7 | * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 8 | * the Software, and to permit persons to whom the Software is furnished to do so, 9 | * subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in all 12 | * copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 16 | * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 17 | * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 18 | * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 | */ 21 | 22 | extern crate gio; 23 | extern crate glib; 24 | extern crate gtk; 25 | extern crate webkit2gtk; 26 | 27 | #[cfg(feature = "v2_4")] 28 | use glib::ToVariant; 29 | use gtk::{prelude::*, Window, WindowType}; 30 | use webkit2gtk::{SettingsExt, WebContext, WebContextExt, WebView, WebViewExt}; 31 | #[cfg(feature = "v2_6")] 32 | use webkit2gtk::{UserContentManager, WebViewExtManual}; 33 | 34 | fn main() { 35 | gtk::init().unwrap(); 36 | 37 | let window = Window::new(WindowType::Toplevel); 38 | let context = WebContext::default().unwrap(); 39 | #[cfg(feature = "v2_4")] 40 | context.set_web_extensions_initialization_user_data(&"webkit".to_variant()); 41 | context.set_web_extensions_directory("../webkit2gtk-webextension-rs/example/target/debug/"); 42 | #[cfg(feature = "v2_6")] 43 | let webview = 44 | WebView::new_with_context_and_user_content_manager(&context, &UserContentManager::new()); 45 | #[cfg(not(feature = "v2_6"))] 46 | let webview = WebView::with_context(&context); 47 | webview.load_uri("https://crates.io/"); 48 | window.add(&webview); 49 | 50 | let settings = WebViewExt::settings(&webview).unwrap(); 51 | settings.set_enable_developer_extras(true); 52 | 53 | /*let inspector = webview.get_inspector().unwrap(); 54 | inspector.show();*/ 55 | 56 | window.show_all(); 57 | 58 | webview.run_javascript("alert('Hello');", None::<&gio::Cancellable>, |_result| {}); 59 | #[cfg(feature = "v2_22")] 60 | webview.run_javascript("42", None::<&gio::Cancellable>, |result| match result { 61 | Ok(result) => { 62 | use java_script_core::ValueExt; 63 | let value = result.js_value().unwrap(); 64 | println!("is_boolean: {}", value.is_boolean()); 65 | println!("is_number: {}", value.is_number()); 66 | println!("{:?}", value.to_int32()); 67 | println!("{:?}", value.to_boolean()); 68 | } 69 | Err(error) => println!("{}", error), 70 | }); 71 | 72 | window.connect_delete_event(|_, _| { 73 | gtk::main_quit(); 74 | glib::Propagation::Proceed 75 | }); 76 | 77 | gtk::main(); 78 | } 79 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | max_width = 100 2 | hard_tabs = false 3 | tab_spaces = 2 4 | newline_style = "Unix" 5 | use_small_heuristics = "Default" 6 | reorder_imports = true 7 | reorder_modules = true 8 | remove_nested_parens = true 9 | edition = "2018" 10 | merge_derives = true 11 | use_try_shorthand = false 12 | use_field_init_shorthand = false 13 | force_explicit_abi = true 14 | imports_granularity = "Crate" 15 | #license_template_path = ".license_template" -------------------------------------------------------------------------------- /src/auto/application_info.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::translate::*; 6 | 7 | glib::wrapper! { 8 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 9 | pub struct ApplicationInfo(Shared); 10 | 11 | match fn { 12 | ref => |ptr| ffi::webkit_application_info_ref(ptr), 13 | unref => |ptr| ffi::webkit_application_info_unref(ptr), 14 | type_ => || ffi::webkit_application_info_get_type(), 15 | } 16 | } 17 | 18 | impl ApplicationInfo { 19 | #[doc(alias = "webkit_application_info_new")] 20 | pub fn new() -> ApplicationInfo { 21 | assert_initialized_main_thread!(); 22 | unsafe { from_glib_full(ffi::webkit_application_info_new()) } 23 | } 24 | 25 | #[doc(alias = "webkit_application_info_get_name")] 26 | #[doc(alias = "get_name")] 27 | pub fn name(&self) -> Option { 28 | unsafe { from_glib_none(ffi::webkit_application_info_get_name(self.to_glib_none().0)) } 29 | } 30 | 31 | #[doc(alias = "webkit_application_info_get_version")] 32 | #[doc(alias = "get_version")] 33 | pub fn version(&self) -> (u64, u64, u64) { 34 | unsafe { 35 | let mut major = std::mem::MaybeUninit::uninit(); 36 | let mut minor = std::mem::MaybeUninit::uninit(); 37 | let mut micro = std::mem::MaybeUninit::uninit(); 38 | ffi::webkit_application_info_get_version( 39 | self.to_glib_none().0, 40 | major.as_mut_ptr(), 41 | minor.as_mut_ptr(), 42 | micro.as_mut_ptr(), 43 | ); 44 | ( 45 | major.assume_init(), 46 | minor.assume_init(), 47 | micro.assume_init(), 48 | ) 49 | } 50 | } 51 | 52 | #[doc(alias = "webkit_application_info_set_name")] 53 | pub fn set_name(&self, name: &str) { 54 | unsafe { 55 | ffi::webkit_application_info_set_name(self.to_glib_none().0, name.to_glib_none().0); 56 | } 57 | } 58 | 59 | #[doc(alias = "webkit_application_info_set_version")] 60 | pub fn set_version(&self, major: u64, minor: u64, micro: u64) { 61 | unsafe { 62 | ffi::webkit_application_info_set_version(self.to_glib_none().0, major, minor, micro); 63 | } 64 | } 65 | } 66 | 67 | #[cfg(feature = "v2_18")] 68 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_18")))] 69 | impl Default for ApplicationInfo { 70 | fn default() -> Self { 71 | Self::new() 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/auto/automation_session.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::{ApplicationInfo, WebView}; 6 | use glib::{ 7 | prelude::*, 8 | signal::{connect_raw, SignalHandlerId}, 9 | translate::*, 10 | }; 11 | use std::boxed::Box as Box_; 12 | 13 | glib::wrapper! { 14 | #[doc(alias = "WebKitAutomationSession")] 15 | pub struct AutomationSession(Object); 16 | 17 | match fn { 18 | type_ => || ffi::webkit_automation_session_get_type(), 19 | } 20 | } 21 | 22 | impl AutomationSession { 23 | pub const NONE: Option<&'static AutomationSession> = None; 24 | 25 | // rustdoc-stripper-ignore-next 26 | /// Creates a new builder-pattern struct instance to construct [`AutomationSession`] objects. 27 | /// 28 | /// This method returns an instance of [`AutomationSessionBuilder`](crate::builders::AutomationSessionBuilder) which can be used to create [`AutomationSession`] objects. 29 | pub fn builder() -> AutomationSessionBuilder { 30 | AutomationSessionBuilder::new() 31 | } 32 | } 33 | 34 | // rustdoc-stripper-ignore-next 35 | /// A [builder-pattern] type to construct [`AutomationSession`] objects. 36 | /// 37 | /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 38 | #[must_use = "The builder must be built to be used"] 39 | pub struct AutomationSessionBuilder { 40 | builder: glib::object::ObjectBuilder<'static, AutomationSession>, 41 | } 42 | 43 | impl AutomationSessionBuilder { 44 | fn new() -> Self { 45 | Self { 46 | builder: glib::object::Object::builder(), 47 | } 48 | } 49 | 50 | #[cfg(feature = "v2_18")] 51 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_18")))] 52 | pub fn id(self, id: impl Into) -> Self { 53 | Self { 54 | builder: self.builder.property("id", id.into()), 55 | } 56 | } 57 | 58 | // rustdoc-stripper-ignore-next 59 | /// Build the [`AutomationSession`]. 60 | #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] 61 | pub fn build(self) -> AutomationSession { 62 | self.builder.build() 63 | } 64 | } 65 | 66 | mod sealed { 67 | pub trait Sealed {} 68 | impl> Sealed for T {} 69 | } 70 | 71 | pub trait AutomationSessionExt: IsA + sealed::Sealed + 'static { 72 | #[doc(alias = "webkit_automation_session_get_application_info")] 73 | #[doc(alias = "get_application_info")] 74 | fn application_info(&self) -> Option { 75 | unsafe { 76 | from_glib_none(ffi::webkit_automation_session_get_application_info( 77 | self.as_ref().to_glib_none().0, 78 | )) 79 | } 80 | } 81 | 82 | #[doc(alias = "webkit_automation_session_get_id")] 83 | #[doc(alias = "get_id")] 84 | fn id(&self) -> Option { 85 | unsafe { 86 | from_glib_none(ffi::webkit_automation_session_get_id( 87 | self.as_ref().to_glib_none().0, 88 | )) 89 | } 90 | } 91 | 92 | #[doc(alias = "webkit_automation_session_set_application_info")] 93 | fn set_application_info(&self, info: &ApplicationInfo) { 94 | unsafe { 95 | ffi::webkit_automation_session_set_application_info( 96 | self.as_ref().to_glib_none().0, 97 | info.to_glib_none().0, 98 | ); 99 | } 100 | } 101 | 102 | #[cfg(feature = "v2_18")] 103 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_18")))] 104 | #[doc(alias = "create-web-view")] 105 | fn connect_create_web_view WebView + 'static>( 106 | &self, 107 | detail: Option<&str>, 108 | f: F, 109 | ) -> SignalHandlerId { 110 | unsafe extern "C" fn create_web_view_trampoline< 111 | P: IsA, 112 | F: Fn(&P) -> WebView + 'static, 113 | >( 114 | this: *mut ffi::WebKitAutomationSession, 115 | f: glib::ffi::gpointer, 116 | ) -> *mut ffi::WebKitWebView { 117 | let f: &F = &*(f as *const F); 118 | f(AutomationSession::from_glib_borrow(this).unsafe_cast_ref()) /*Not checked*/ 119 | .to_glib_none() 120 | .0 121 | } 122 | unsafe { 123 | let f: Box_ = Box_::new(f); 124 | let detailed_signal_name = detail.map(|name| format!("create-web-view::{name}\0")); 125 | let signal_name: &[u8] = detailed_signal_name 126 | .as_ref() 127 | .map_or(&b"create-web-view\0"[..], |n| n.as_bytes()); 128 | connect_raw( 129 | self.as_ptr() as *mut _, 130 | signal_name.as_ptr() as *const _, 131 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 132 | create_web_view_trampoline:: as *const (), 133 | )), 134 | Box_::into_raw(f), 135 | ) 136 | } 137 | } 138 | } 139 | 140 | impl> AutomationSessionExt for O {} 141 | -------------------------------------------------------------------------------- /src/auto/back_forward_list.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::BackForwardListItem; 6 | use glib::{prelude::*, translate::*}; 7 | 8 | glib::wrapper! { 9 | #[doc(alias = "WebKitBackForwardList")] 10 | pub struct BackForwardList(Object); 11 | 12 | match fn { 13 | type_ => || ffi::webkit_back_forward_list_get_type(), 14 | } 15 | } 16 | 17 | impl BackForwardList { 18 | pub const NONE: Option<&'static BackForwardList> = None; 19 | } 20 | 21 | mod sealed { 22 | pub trait Sealed {} 23 | impl> Sealed for T {} 24 | } 25 | 26 | pub trait BackForwardListExt: IsA + sealed::Sealed + 'static { 27 | #[doc(alias = "webkit_back_forward_list_get_back_item")] 28 | #[doc(alias = "get_back_item")] 29 | fn back_item(&self) -> Option { 30 | unsafe { 31 | from_glib_none(ffi::webkit_back_forward_list_get_back_item( 32 | self.as_ref().to_glib_none().0, 33 | )) 34 | } 35 | } 36 | 37 | #[doc(alias = "webkit_back_forward_list_get_back_list")] 38 | #[doc(alias = "get_back_list")] 39 | fn back_list(&self) -> Vec { 40 | unsafe { 41 | FromGlibPtrContainer::from_glib_container(ffi::webkit_back_forward_list_get_back_list( 42 | self.as_ref().to_glib_none().0, 43 | )) 44 | } 45 | } 46 | 47 | #[doc(alias = "webkit_back_forward_list_get_back_list_with_limit")] 48 | #[doc(alias = "get_back_list_with_limit")] 49 | fn back_list_with_limit(&self, limit: u32) -> Vec { 50 | unsafe { 51 | FromGlibPtrContainer::from_glib_container( 52 | ffi::webkit_back_forward_list_get_back_list_with_limit( 53 | self.as_ref().to_glib_none().0, 54 | limit, 55 | ), 56 | ) 57 | } 58 | } 59 | 60 | #[doc(alias = "webkit_back_forward_list_get_current_item")] 61 | #[doc(alias = "get_current_item")] 62 | fn current_item(&self) -> Option { 63 | unsafe { 64 | from_glib_none(ffi::webkit_back_forward_list_get_current_item( 65 | self.as_ref().to_glib_none().0, 66 | )) 67 | } 68 | } 69 | 70 | #[doc(alias = "webkit_back_forward_list_get_forward_item")] 71 | #[doc(alias = "get_forward_item")] 72 | fn forward_item(&self) -> Option { 73 | unsafe { 74 | from_glib_none(ffi::webkit_back_forward_list_get_forward_item( 75 | self.as_ref().to_glib_none().0, 76 | )) 77 | } 78 | } 79 | 80 | #[doc(alias = "webkit_back_forward_list_get_forward_list")] 81 | #[doc(alias = "get_forward_list")] 82 | fn forward_list(&self) -> Vec { 83 | unsafe { 84 | FromGlibPtrContainer::from_glib_container(ffi::webkit_back_forward_list_get_forward_list( 85 | self.as_ref().to_glib_none().0, 86 | )) 87 | } 88 | } 89 | 90 | #[doc(alias = "webkit_back_forward_list_get_forward_list_with_limit")] 91 | #[doc(alias = "get_forward_list_with_limit")] 92 | fn forward_list_with_limit(&self, limit: u32) -> Vec { 93 | unsafe { 94 | FromGlibPtrContainer::from_glib_container( 95 | ffi::webkit_back_forward_list_get_forward_list_with_limit( 96 | self.as_ref().to_glib_none().0, 97 | limit, 98 | ), 99 | ) 100 | } 101 | } 102 | 103 | #[doc(alias = "webkit_back_forward_list_get_length")] 104 | #[doc(alias = "get_length")] 105 | fn length(&self) -> u32 { 106 | unsafe { ffi::webkit_back_forward_list_get_length(self.as_ref().to_glib_none().0) } 107 | } 108 | 109 | #[doc(alias = "webkit_back_forward_list_get_nth_item")] 110 | #[doc(alias = "get_nth_item")] 111 | fn nth_item(&self, index: i32) -> Option { 112 | unsafe { 113 | from_glib_none(ffi::webkit_back_forward_list_get_nth_item( 114 | self.as_ref().to_glib_none().0, 115 | index, 116 | )) 117 | } 118 | } 119 | 120 | //#[doc(alias = "changed")] 121 | //fn connect_changed(&self, f: F) -> SignalHandlerId { 122 | // Unimplemented items_removed: *.Pointer 123 | //} 124 | } 125 | 126 | impl> BackForwardListExt for O {} 127 | -------------------------------------------------------------------------------- /src/auto/back_forward_list_item.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::{prelude::*, translate::*}; 6 | 7 | glib::wrapper! { 8 | #[doc(alias = "WebKitBackForwardListItem")] 9 | pub struct BackForwardListItem(Object); 10 | 11 | match fn { 12 | type_ => || ffi::webkit_back_forward_list_item_get_type(), 13 | } 14 | } 15 | 16 | impl BackForwardListItem { 17 | pub const NONE: Option<&'static BackForwardListItem> = None; 18 | } 19 | 20 | mod sealed { 21 | pub trait Sealed {} 22 | impl> Sealed for T {} 23 | } 24 | 25 | pub trait BackForwardListItemExt: IsA + sealed::Sealed + 'static { 26 | #[doc(alias = "webkit_back_forward_list_item_get_original_uri")] 27 | #[doc(alias = "get_original_uri")] 28 | fn original_uri(&self) -> Option { 29 | unsafe { 30 | from_glib_none(ffi::webkit_back_forward_list_item_get_original_uri( 31 | self.as_ref().to_glib_none().0, 32 | )) 33 | } 34 | } 35 | 36 | #[doc(alias = "webkit_back_forward_list_item_get_title")] 37 | #[doc(alias = "get_title")] 38 | fn title(&self) -> Option { 39 | unsafe { 40 | from_glib_none(ffi::webkit_back_forward_list_item_get_title( 41 | self.as_ref().to_glib_none().0, 42 | )) 43 | } 44 | } 45 | 46 | #[doc(alias = "webkit_back_forward_list_item_get_uri")] 47 | #[doc(alias = "get_uri")] 48 | fn uri(&self) -> Option { 49 | unsafe { 50 | from_glib_none(ffi::webkit_back_forward_list_item_get_uri( 51 | self.as_ref().to_glib_none().0, 52 | )) 53 | } 54 | } 55 | } 56 | 57 | impl> BackForwardListItemExt for O {} 58 | -------------------------------------------------------------------------------- /src/auto/color_chooser_request.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::prelude::*; 6 | #[cfg(feature = "v2_8")] 7 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 8 | use glib::{ 9 | signal::{connect_raw, SignalHandlerId}, 10 | translate::*, 11 | }; 12 | #[cfg(feature = "v2_8")] 13 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 14 | use std::boxed::Box as Box_; 15 | 16 | glib::wrapper! { 17 | #[doc(alias = "WebKitColorChooserRequest")] 18 | pub struct ColorChooserRequest(Object); 19 | 20 | match fn { 21 | type_ => || ffi::webkit_color_chooser_request_get_type(), 22 | } 23 | } 24 | 25 | impl ColorChooserRequest { 26 | pub const NONE: Option<&'static ColorChooserRequest> = None; 27 | 28 | // rustdoc-stripper-ignore-next 29 | /// Creates a new builder-pattern struct instance to construct [`ColorChooserRequest`] objects. 30 | /// 31 | /// This method returns an instance of [`ColorChooserRequestBuilder`](crate::builders::ColorChooserRequestBuilder) which can be used to create [`ColorChooserRequest`] objects. 32 | pub fn builder() -> ColorChooserRequestBuilder { 33 | ColorChooserRequestBuilder::new() 34 | } 35 | } 36 | 37 | // rustdoc-stripper-ignore-next 38 | /// A [builder-pattern] type to construct [`ColorChooserRequest`] objects. 39 | /// 40 | /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 41 | #[must_use = "The builder must be built to be used"] 42 | pub struct ColorChooserRequestBuilder { 43 | builder: glib::object::ObjectBuilder<'static, ColorChooserRequest>, 44 | } 45 | 46 | impl ColorChooserRequestBuilder { 47 | fn new() -> Self { 48 | Self { 49 | builder: glib::object::Object::builder(), 50 | } 51 | } 52 | 53 | #[cfg(feature = "v2_8")] 54 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 55 | pub fn rgba(self, rgba: &gdk::RGBA) -> Self { 56 | Self { 57 | builder: self.builder.property("rgba", rgba), 58 | } 59 | } 60 | 61 | // rustdoc-stripper-ignore-next 62 | /// Build the [`ColorChooserRequest`]. 63 | #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] 64 | pub fn build(self) -> ColorChooserRequest { 65 | self.builder.build() 66 | } 67 | } 68 | 69 | mod sealed { 70 | pub trait Sealed {} 71 | impl> Sealed for T {} 72 | } 73 | 74 | pub trait ColorChooserRequestExt: IsA + sealed::Sealed + 'static { 75 | #[cfg(feature = "v2_8")] 76 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 77 | #[doc(alias = "webkit_color_chooser_request_cancel")] 78 | fn cancel(&self) { 79 | unsafe { 80 | ffi::webkit_color_chooser_request_cancel(self.as_ref().to_glib_none().0); 81 | } 82 | } 83 | 84 | #[cfg(feature = "v2_8")] 85 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 86 | #[doc(alias = "webkit_color_chooser_request_finish")] 87 | fn finish(&self) { 88 | unsafe { 89 | ffi::webkit_color_chooser_request_finish(self.as_ref().to_glib_none().0); 90 | } 91 | } 92 | 93 | #[cfg(feature = "v2_8")] 94 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 95 | #[doc(alias = "webkit_color_chooser_request_get_element_rectangle")] 96 | #[doc(alias = "get_element_rectangle")] 97 | fn element_rectangle(&self) -> gdk::Rectangle { 98 | unsafe { 99 | let mut rect = gdk::Rectangle::uninitialized(); 100 | ffi::webkit_color_chooser_request_get_element_rectangle( 101 | self.as_ref().to_glib_none().0, 102 | rect.to_glib_none_mut().0, 103 | ); 104 | rect 105 | } 106 | } 107 | 108 | #[cfg(feature = "v2_8")] 109 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 110 | #[doc(alias = "webkit_color_chooser_request_get_rgba")] 111 | #[doc(alias = "get_rgba")] 112 | fn rgba(&self) -> gdk::RGBA { 113 | unsafe { 114 | let mut rgba = gdk::RGBA::uninitialized(); 115 | ffi::webkit_color_chooser_request_get_rgba( 116 | self.as_ref().to_glib_none().0, 117 | rgba.to_glib_none_mut().0, 118 | ); 119 | rgba 120 | } 121 | } 122 | 123 | #[cfg(feature = "v2_8")] 124 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 125 | #[doc(alias = "webkit_color_chooser_request_set_rgba")] 126 | fn set_rgba(&self, rgba: &gdk::RGBA) { 127 | unsafe { 128 | ffi::webkit_color_chooser_request_set_rgba( 129 | self.as_ref().to_glib_none().0, 130 | rgba.to_glib_none().0, 131 | ); 132 | } 133 | } 134 | 135 | #[cfg(feature = "v2_8")] 136 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 137 | #[doc(alias = "finished")] 138 | fn connect_finished(&self, f: F) -> SignalHandlerId { 139 | unsafe extern "C" fn finished_trampoline, F: Fn(&P) + 'static>( 140 | this: *mut ffi::WebKitColorChooserRequest, 141 | f: glib::ffi::gpointer, 142 | ) { 143 | let f: &F = &*(f as *const F); 144 | f(ColorChooserRequest::from_glib_borrow(this).unsafe_cast_ref()) 145 | } 146 | unsafe { 147 | let f: Box_ = Box_::new(f); 148 | connect_raw( 149 | self.as_ptr() as *mut _, 150 | b"finished\0".as_ptr() as *const _, 151 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 152 | finished_trampoline:: as *const (), 153 | )), 154 | Box_::into_raw(f), 155 | ) 156 | } 157 | } 158 | 159 | #[cfg(feature = "v2_8")] 160 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 161 | #[doc(alias = "rgba")] 162 | fn connect_rgba_notify(&self, f: F) -> SignalHandlerId { 163 | unsafe extern "C" fn notify_rgba_trampoline< 164 | P: IsA, 165 | F: Fn(&P) + 'static, 166 | >( 167 | this: *mut ffi::WebKitColorChooserRequest, 168 | _param_spec: glib::ffi::gpointer, 169 | f: glib::ffi::gpointer, 170 | ) { 171 | let f: &F = &*(f as *const F); 172 | f(ColorChooserRequest::from_glib_borrow(this).unsafe_cast_ref()) 173 | } 174 | unsafe { 175 | let f: Box_ = Box_::new(f); 176 | connect_raw( 177 | self.as_ptr() as *mut _, 178 | b"notify::rgba\0".as_ptr() as *const _, 179 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 180 | notify_rgba_trampoline:: as *const (), 181 | )), 182 | Box_::into_raw(f), 183 | ) 184 | } 185 | } 186 | } 187 | 188 | impl> ColorChooserRequestExt for O {} 189 | -------------------------------------------------------------------------------- /src/auto/context_menu.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::ContextMenuItem; 6 | use glib::{prelude::*, translate::*}; 7 | 8 | glib::wrapper! { 9 | #[doc(alias = "WebKitContextMenu")] 10 | pub struct ContextMenu(Object); 11 | 12 | match fn { 13 | type_ => || ffi::webkit_context_menu_get_type(), 14 | } 15 | } 16 | 17 | impl ContextMenu { 18 | pub const NONE: Option<&'static ContextMenu> = None; 19 | 20 | #[doc(alias = "webkit_context_menu_new")] 21 | pub fn new() -> ContextMenu { 22 | assert_initialized_main_thread!(); 23 | unsafe { from_glib_full(ffi::webkit_context_menu_new()) } 24 | } 25 | 26 | #[doc(alias = "webkit_context_menu_new_with_items")] 27 | #[doc(alias = "new_with_items")] 28 | pub fn with_items(items: &[ContextMenuItem]) -> ContextMenu { 29 | assert_initialized_main_thread!(); 30 | unsafe { 31 | from_glib_full(ffi::webkit_context_menu_new_with_items( 32 | items.to_glib_none().0, 33 | )) 34 | } 35 | } 36 | } 37 | 38 | impl Default for ContextMenu { 39 | fn default() -> Self { 40 | Self::new() 41 | } 42 | } 43 | 44 | mod sealed { 45 | pub trait Sealed {} 46 | impl> Sealed for T {} 47 | } 48 | 49 | pub trait ContextMenuExt: IsA + sealed::Sealed + 'static { 50 | #[doc(alias = "webkit_context_menu_append")] 51 | fn append(&self, item: &impl IsA) { 52 | unsafe { 53 | ffi::webkit_context_menu_append( 54 | self.as_ref().to_glib_none().0, 55 | item.as_ref().to_glib_none().0, 56 | ); 57 | } 58 | } 59 | 60 | #[doc(alias = "webkit_context_menu_first")] 61 | fn first(&self) -> Option { 62 | unsafe { 63 | from_glib_none(ffi::webkit_context_menu_first( 64 | self.as_ref().to_glib_none().0, 65 | )) 66 | } 67 | } 68 | 69 | #[cfg(feature = "v2_40")] 70 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_40")))] 71 | #[doc(alias = "webkit_context_menu_get_event")] 72 | #[doc(alias = "get_event")] 73 | fn event(&self) -> Option { 74 | unsafe { 75 | from_glib_none(ffi::webkit_context_menu_get_event( 76 | self.as_ref().to_glib_none().0, 77 | )) 78 | } 79 | } 80 | 81 | #[doc(alias = "webkit_context_menu_get_item_at_position")] 82 | #[doc(alias = "get_item_at_position")] 83 | fn item_at_position(&self, position: u32) -> Option { 84 | unsafe { 85 | from_glib_none(ffi::webkit_context_menu_get_item_at_position( 86 | self.as_ref().to_glib_none().0, 87 | position, 88 | )) 89 | } 90 | } 91 | 92 | #[doc(alias = "webkit_context_menu_get_items")] 93 | #[doc(alias = "get_items")] 94 | fn items(&self) -> Vec { 95 | unsafe { 96 | FromGlibPtrContainer::from_glib_none(ffi::webkit_context_menu_get_items( 97 | self.as_ref().to_glib_none().0, 98 | )) 99 | } 100 | } 101 | 102 | #[doc(alias = "webkit_context_menu_get_n_items")] 103 | #[doc(alias = "get_n_items")] 104 | fn n_items(&self) -> u32 { 105 | unsafe { ffi::webkit_context_menu_get_n_items(self.as_ref().to_glib_none().0) } 106 | } 107 | 108 | #[cfg(feature = "v2_8")] 109 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 110 | #[doc(alias = "webkit_context_menu_get_user_data")] 111 | #[doc(alias = "get_user_data")] 112 | fn user_data(&self) -> Option { 113 | unsafe { 114 | from_glib_none(ffi::webkit_context_menu_get_user_data( 115 | self.as_ref().to_glib_none().0, 116 | )) 117 | } 118 | } 119 | 120 | #[doc(alias = "webkit_context_menu_insert")] 121 | fn insert(&self, item: &impl IsA, position: i32) { 122 | unsafe { 123 | ffi::webkit_context_menu_insert( 124 | self.as_ref().to_glib_none().0, 125 | item.as_ref().to_glib_none().0, 126 | position, 127 | ); 128 | } 129 | } 130 | 131 | #[doc(alias = "webkit_context_menu_last")] 132 | fn last(&self) -> Option { 133 | unsafe { 134 | from_glib_none(ffi::webkit_context_menu_last( 135 | self.as_ref().to_glib_none().0, 136 | )) 137 | } 138 | } 139 | 140 | #[doc(alias = "webkit_context_menu_move_item")] 141 | fn move_item(&self, item: &impl IsA, position: i32) { 142 | unsafe { 143 | ffi::webkit_context_menu_move_item( 144 | self.as_ref().to_glib_none().0, 145 | item.as_ref().to_glib_none().0, 146 | position, 147 | ); 148 | } 149 | } 150 | 151 | #[doc(alias = "webkit_context_menu_prepend")] 152 | fn prepend(&self, item: &impl IsA) { 153 | unsafe { 154 | ffi::webkit_context_menu_prepend( 155 | self.as_ref().to_glib_none().0, 156 | item.as_ref().to_glib_none().0, 157 | ); 158 | } 159 | } 160 | 161 | #[doc(alias = "webkit_context_menu_remove")] 162 | fn remove(&self, item: &impl IsA) { 163 | unsafe { 164 | ffi::webkit_context_menu_remove( 165 | self.as_ref().to_glib_none().0, 166 | item.as_ref().to_glib_none().0, 167 | ); 168 | } 169 | } 170 | 171 | #[doc(alias = "webkit_context_menu_remove_all")] 172 | fn remove_all(&self) { 173 | unsafe { 174 | ffi::webkit_context_menu_remove_all(self.as_ref().to_glib_none().0); 175 | } 176 | } 177 | 178 | #[cfg(feature = "v2_8")] 179 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 180 | #[doc(alias = "webkit_context_menu_set_user_data")] 181 | fn set_user_data(&self, user_data: &glib::Variant) { 182 | unsafe { 183 | ffi::webkit_context_menu_set_user_data( 184 | self.as_ref().to_glib_none().0, 185 | user_data.to_glib_none().0, 186 | ); 187 | } 188 | } 189 | } 190 | 191 | impl> ContextMenuExt for O {} 192 | -------------------------------------------------------------------------------- /src/auto/context_menu_item.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | #![allow(deprecated)] 5 | 6 | use crate::{ContextMenu, ContextMenuAction}; 7 | use glib::{prelude::*, translate::*}; 8 | 9 | glib::wrapper! { 10 | #[doc(alias = "WebKitContextMenuItem")] 11 | pub struct ContextMenuItem(Object); 12 | 13 | match fn { 14 | type_ => || ffi::webkit_context_menu_item_get_type(), 15 | } 16 | } 17 | 18 | impl ContextMenuItem { 19 | pub const NONE: Option<&'static ContextMenuItem> = None; 20 | 21 | //#[cfg_attr(feature = "v2_18", deprecated = "Since 2.18")] 22 | //#[allow(deprecated)] 23 | //#[doc(alias = "webkit_context_menu_item_new")] 24 | //pub fn new(action: /*Ignored*/>k::Action) -> ContextMenuItem { 25 | // unsafe { TODO: call ffi:webkit_context_menu_item_new() } 26 | //} 27 | 28 | #[cfg(feature = "v2_18")] 29 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_18")))] 30 | #[doc(alias = "webkit_context_menu_item_new_from_gaction")] 31 | #[doc(alias = "new_from_gaction")] 32 | pub fn from_gaction( 33 | action: &impl IsA, 34 | label: &str, 35 | target: Option<&glib::Variant>, 36 | ) -> ContextMenuItem { 37 | assert_initialized_main_thread!(); 38 | unsafe { 39 | from_glib_none(ffi::webkit_context_menu_item_new_from_gaction( 40 | action.as_ref().to_glib_none().0, 41 | label.to_glib_none().0, 42 | target.to_glib_none().0, 43 | )) 44 | } 45 | } 46 | 47 | #[doc(alias = "webkit_context_menu_item_new_from_stock_action")] 48 | #[doc(alias = "new_from_stock_action")] 49 | pub fn from_stock_action(action: ContextMenuAction) -> ContextMenuItem { 50 | assert_initialized_main_thread!(); 51 | unsafe { 52 | from_glib_none(ffi::webkit_context_menu_item_new_from_stock_action( 53 | action.into_glib(), 54 | )) 55 | } 56 | } 57 | 58 | #[doc(alias = "webkit_context_menu_item_new_from_stock_action_with_label")] 59 | #[doc(alias = "new_from_stock_action_with_label")] 60 | pub fn from_stock_action_with_label(action: ContextMenuAction, label: &str) -> ContextMenuItem { 61 | assert_initialized_main_thread!(); 62 | unsafe { 63 | from_glib_none( 64 | ffi::webkit_context_menu_item_new_from_stock_action_with_label( 65 | action.into_glib(), 66 | label.to_glib_none().0, 67 | ), 68 | ) 69 | } 70 | } 71 | 72 | #[doc(alias = "webkit_context_menu_item_new_separator")] 73 | pub fn new_separator() -> ContextMenuItem { 74 | assert_initialized_main_thread!(); 75 | unsafe { from_glib_none(ffi::webkit_context_menu_item_new_separator()) } 76 | } 77 | 78 | #[doc(alias = "webkit_context_menu_item_new_with_submenu")] 79 | #[doc(alias = "new_with_submenu")] 80 | pub fn with_submenu(label: &str, submenu: &impl IsA) -> ContextMenuItem { 81 | skip_assert_initialized!(); 82 | unsafe { 83 | from_glib_none(ffi::webkit_context_menu_item_new_with_submenu( 84 | label.to_glib_none().0, 85 | submenu.as_ref().to_glib_none().0, 86 | )) 87 | } 88 | } 89 | } 90 | 91 | mod sealed { 92 | pub trait Sealed {} 93 | impl> Sealed for T {} 94 | } 95 | 96 | pub trait ContextMenuItemExt: IsA + sealed::Sealed + 'static { 97 | //#[cfg_attr(feature = "v2_18", deprecated = "Since 2.18")] 98 | //#[allow(deprecated)] 99 | //#[doc(alias = "webkit_context_menu_item_get_action")] 100 | //#[doc(alias = "get_action")] 101 | //fn action(&self) -> /*Ignored*/Option { 102 | // unsafe { TODO: call ffi:webkit_context_menu_item_get_action() } 103 | //} 104 | 105 | #[cfg(feature = "v2_18")] 106 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_18")))] 107 | #[doc(alias = "webkit_context_menu_item_get_gaction")] 108 | #[doc(alias = "get_gaction")] 109 | fn gaction(&self) -> Option { 110 | unsafe { 111 | from_glib_none(ffi::webkit_context_menu_item_get_gaction( 112 | self.as_ref().to_glib_none().0, 113 | )) 114 | } 115 | } 116 | 117 | #[doc(alias = "webkit_context_menu_item_get_stock_action")] 118 | #[doc(alias = "get_stock_action")] 119 | fn stock_action(&self) -> ContextMenuAction { 120 | unsafe { 121 | from_glib(ffi::webkit_context_menu_item_get_stock_action( 122 | self.as_ref().to_glib_none().0, 123 | )) 124 | } 125 | } 126 | 127 | #[doc(alias = "webkit_context_menu_item_get_submenu")] 128 | #[doc(alias = "get_submenu")] 129 | fn submenu(&self) -> Option { 130 | unsafe { 131 | from_glib_none(ffi::webkit_context_menu_item_get_submenu( 132 | self.as_ref().to_glib_none().0, 133 | )) 134 | } 135 | } 136 | 137 | #[doc(alias = "webkit_context_menu_item_is_separator")] 138 | fn is_separator(&self) -> bool { 139 | unsafe { 140 | from_glib(ffi::webkit_context_menu_item_is_separator( 141 | self.as_ref().to_glib_none().0, 142 | )) 143 | } 144 | } 145 | 146 | #[doc(alias = "webkit_context_menu_item_set_submenu")] 147 | fn set_submenu(&self, submenu: Option<&impl IsA>) { 148 | unsafe { 149 | ffi::webkit_context_menu_item_set_submenu( 150 | self.as_ref().to_glib_none().0, 151 | submenu.map(|p| p.as_ref()).to_glib_none().0, 152 | ); 153 | } 154 | } 155 | } 156 | 157 | impl> ContextMenuItemExt for O {} 158 | -------------------------------------------------------------------------------- /src/auto/credential.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::CredentialPersistence; 6 | #[cfg(feature = "v2_34")] 7 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_34")))] 8 | use glib::prelude::*; 9 | use glib::translate::*; 10 | 11 | glib::wrapper! { 12 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 13 | pub struct Credential(Boxed); 14 | 15 | match fn { 16 | copy => |ptr| ffi::webkit_credential_copy(mut_override(ptr)), 17 | free => |ptr| ffi::webkit_credential_free(ptr), 18 | type_ => || ffi::webkit_credential_get_type(), 19 | } 20 | } 21 | 22 | impl Credential { 23 | #[doc(alias = "webkit_credential_new")] 24 | pub fn new(username: &str, password: &str, persistence: CredentialPersistence) -> Credential { 25 | assert_initialized_main_thread!(); 26 | unsafe { 27 | from_glib_full(ffi::webkit_credential_new( 28 | username.to_glib_none().0, 29 | password.to_glib_none().0, 30 | persistence.into_glib(), 31 | )) 32 | } 33 | } 34 | 35 | #[cfg(feature = "v2_34")] 36 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_34")))] 37 | #[doc(alias = "webkit_credential_new_for_certificate")] 38 | #[doc(alias = "new_for_certificate")] 39 | pub fn for_certificate( 40 | certificate: Option<&impl IsA>, 41 | persistence: CredentialPersistence, 42 | ) -> Credential { 43 | assert_initialized_main_thread!(); 44 | unsafe { 45 | from_glib_full(ffi::webkit_credential_new_for_certificate( 46 | certificate.map(|p| p.as_ref()).to_glib_none().0, 47 | persistence.into_glib(), 48 | )) 49 | } 50 | } 51 | 52 | #[cfg(feature = "v2_34")] 53 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_34")))] 54 | #[doc(alias = "webkit_credential_new_for_certificate_pin")] 55 | #[doc(alias = "new_for_certificate_pin")] 56 | pub fn for_certificate_pin(pin: &str, persistence: CredentialPersistence) -> Credential { 57 | assert_initialized_main_thread!(); 58 | unsafe { 59 | from_glib_full(ffi::webkit_credential_new_for_certificate_pin( 60 | pin.to_glib_none().0, 61 | persistence.into_glib(), 62 | )) 63 | } 64 | } 65 | 66 | #[cfg(feature = "v2_34")] 67 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_34")))] 68 | #[doc(alias = "webkit_credential_get_certificate")] 69 | #[doc(alias = "get_certificate")] 70 | pub fn certificate(&mut self) -> Option { 71 | unsafe { 72 | from_glib_none(ffi::webkit_credential_get_certificate( 73 | self.to_glib_none_mut().0, 74 | )) 75 | } 76 | } 77 | 78 | #[doc(alias = "webkit_credential_get_password")] 79 | #[doc(alias = "get_password")] 80 | pub fn password(&mut self) -> Option { 81 | unsafe { 82 | from_glib_none(ffi::webkit_credential_get_password( 83 | self.to_glib_none_mut().0, 84 | )) 85 | } 86 | } 87 | 88 | #[doc(alias = "webkit_credential_get_persistence")] 89 | #[doc(alias = "get_persistence")] 90 | pub fn persistence(&mut self) -> CredentialPersistence { 91 | unsafe { 92 | from_glib(ffi::webkit_credential_get_persistence( 93 | self.to_glib_none_mut().0, 94 | )) 95 | } 96 | } 97 | 98 | #[doc(alias = "webkit_credential_get_username")] 99 | #[doc(alias = "get_username")] 100 | pub fn username(&mut self) -> Option { 101 | unsafe { 102 | from_glib_none(ffi::webkit_credential_get_username( 103 | self.to_glib_none_mut().0, 104 | )) 105 | } 106 | } 107 | 108 | #[doc(alias = "webkit_credential_has_password")] 109 | pub fn has_password(&mut self) -> bool { 110 | unsafe { 111 | from_glib(ffi::webkit_credential_has_password( 112 | self.to_glib_none_mut().0, 113 | )) 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /src/auto/device_info_permission_request.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::PermissionRequest; 6 | 7 | glib::wrapper! { 8 | #[doc(alias = "WebKitDeviceInfoPermissionRequest")] 9 | pub struct DeviceInfoPermissionRequest(Object) @implements PermissionRequest; 10 | 11 | match fn { 12 | type_ => || ffi::webkit_device_info_permission_request_get_type(), 13 | } 14 | } 15 | 16 | impl DeviceInfoPermissionRequest { 17 | pub const NONE: Option<&'static DeviceInfoPermissionRequest> = None; 18 | } 19 | -------------------------------------------------------------------------------- /src/auto/editor_state.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::{ 6 | prelude::*, 7 | signal::{connect_raw, SignalHandlerId}, 8 | translate::*, 9 | }; 10 | use std::boxed::Box as Box_; 11 | 12 | glib::wrapper! { 13 | #[doc(alias = "WebKitEditorState")] 14 | pub struct EditorState(Object); 15 | 16 | match fn { 17 | type_ => || ffi::webkit_editor_state_get_type(), 18 | } 19 | } 20 | 21 | impl EditorState { 22 | pub const NONE: Option<&'static EditorState> = None; 23 | } 24 | 25 | mod sealed { 26 | pub trait Sealed {} 27 | impl> Sealed for T {} 28 | } 29 | 30 | pub trait EditorStateExt: IsA + sealed::Sealed + 'static { 31 | #[doc(alias = "webkit_editor_state_get_typing_attributes")] 32 | #[doc(alias = "get_typing_attributes")] 33 | fn typing_attributes(&self) -> u32 { 34 | unsafe { ffi::webkit_editor_state_get_typing_attributes(self.as_ref().to_glib_none().0) } 35 | } 36 | 37 | #[cfg(feature = "v2_20")] 38 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_20")))] 39 | #[doc(alias = "webkit_editor_state_is_copy_available")] 40 | fn is_copy_available(&self) -> bool { 41 | unsafe { 42 | from_glib(ffi::webkit_editor_state_is_copy_available( 43 | self.as_ref().to_glib_none().0, 44 | )) 45 | } 46 | } 47 | 48 | #[cfg(feature = "v2_20")] 49 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_20")))] 50 | #[doc(alias = "webkit_editor_state_is_cut_available")] 51 | fn is_cut_available(&self) -> bool { 52 | unsafe { 53 | from_glib(ffi::webkit_editor_state_is_cut_available( 54 | self.as_ref().to_glib_none().0, 55 | )) 56 | } 57 | } 58 | 59 | #[cfg(feature = "v2_20")] 60 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_20")))] 61 | #[doc(alias = "webkit_editor_state_is_paste_available")] 62 | fn is_paste_available(&self) -> bool { 63 | unsafe { 64 | from_glib(ffi::webkit_editor_state_is_paste_available( 65 | self.as_ref().to_glib_none().0, 66 | )) 67 | } 68 | } 69 | 70 | #[cfg(feature = "v2_20")] 71 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_20")))] 72 | #[doc(alias = "webkit_editor_state_is_redo_available")] 73 | fn is_redo_available(&self) -> bool { 74 | unsafe { 75 | from_glib(ffi::webkit_editor_state_is_redo_available( 76 | self.as_ref().to_glib_none().0, 77 | )) 78 | } 79 | } 80 | 81 | #[cfg(feature = "v2_20")] 82 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_20")))] 83 | #[doc(alias = "webkit_editor_state_is_undo_available")] 84 | fn is_undo_available(&self) -> bool { 85 | unsafe { 86 | from_glib(ffi::webkit_editor_state_is_undo_available( 87 | self.as_ref().to_glib_none().0, 88 | )) 89 | } 90 | } 91 | 92 | #[cfg(feature = "v2_10")] 93 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_10")))] 94 | #[doc(alias = "typing-attributes")] 95 | fn connect_typing_attributes_notify(&self, f: F) -> SignalHandlerId { 96 | unsafe extern "C" fn notify_typing_attributes_trampoline< 97 | P: IsA, 98 | F: Fn(&P) + 'static, 99 | >( 100 | this: *mut ffi::WebKitEditorState, 101 | _param_spec: glib::ffi::gpointer, 102 | f: glib::ffi::gpointer, 103 | ) { 104 | let f: &F = &*(f as *const F); 105 | f(EditorState::from_glib_borrow(this).unsafe_cast_ref()) 106 | } 107 | unsafe { 108 | let f: Box_ = Box_::new(f); 109 | connect_raw( 110 | self.as_ptr() as *mut _, 111 | b"notify::typing-attributes\0".as_ptr() as *const _, 112 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 113 | notify_typing_attributes_trampoline:: as *const (), 114 | )), 115 | Box_::into_raw(f), 116 | ) 117 | } 118 | } 119 | } 120 | 121 | impl> EditorStateExt for O {} 122 | -------------------------------------------------------------------------------- /src/auto/favicon_database.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::{ 6 | prelude::*, 7 | signal::{connect_raw, SignalHandlerId}, 8 | translate::*, 9 | }; 10 | use std::{boxed::Box as Box_, pin::Pin}; 11 | 12 | glib::wrapper! { 13 | #[doc(alias = "WebKitFaviconDatabase")] 14 | pub struct FaviconDatabase(Object); 15 | 16 | match fn { 17 | type_ => || ffi::webkit_favicon_database_get_type(), 18 | } 19 | } 20 | 21 | impl FaviconDatabase { 22 | pub const NONE: Option<&'static FaviconDatabase> = None; 23 | } 24 | 25 | mod sealed { 26 | pub trait Sealed {} 27 | impl> Sealed for T {} 28 | } 29 | 30 | pub trait FaviconDatabaseExt: IsA + sealed::Sealed + 'static { 31 | #[doc(alias = "webkit_favicon_database_clear")] 32 | fn clear(&self) { 33 | unsafe { 34 | ffi::webkit_favicon_database_clear(self.as_ref().to_glib_none().0); 35 | } 36 | } 37 | 38 | #[doc(alias = "webkit_favicon_database_get_favicon")] 39 | #[doc(alias = "get_favicon")] 40 | fn favicon) + 'static>( 41 | &self, 42 | page_uri: &str, 43 | cancellable: Option<&impl IsA>, 44 | callback: P, 45 | ) { 46 | let main_context = glib::MainContext::ref_thread_default(); 47 | let is_main_context_owner = main_context.is_owner(); 48 | let has_acquired_main_context = (!is_main_context_owner) 49 | .then(|| main_context.acquire().ok()) 50 | .flatten(); 51 | assert!( 52 | is_main_context_owner || has_acquired_main_context.is_some(), 53 | "Async operations only allowed if the thread is owning the MainContext" 54 | ); 55 | 56 | let user_data: Box_> = 57 | Box_::new(glib::thread_guard::ThreadGuard::new(callback)); 58 | unsafe extern "C" fn favicon_trampoline< 59 | P: FnOnce(Result) + 'static, 60 | >( 61 | _source_object: *mut glib::gobject_ffi::GObject, 62 | res: *mut gio::ffi::GAsyncResult, 63 | user_data: glib::ffi::gpointer, 64 | ) { 65 | let mut error = std::ptr::null_mut(); 66 | let ret = 67 | ffi::webkit_favicon_database_get_favicon_finish(_source_object as *mut _, res, &mut error); 68 | let result = if error.is_null() { 69 | Ok(from_glib_full(ret)) 70 | } else { 71 | Err(from_glib_full(error)) 72 | }; 73 | let callback: Box_> = Box_::from_raw(user_data as *mut _); 74 | let callback: P = callback.into_inner(); 75 | callback(result); 76 | } 77 | let callback = favicon_trampoline::

; 78 | unsafe { 79 | ffi::webkit_favicon_database_get_favicon( 80 | self.as_ref().to_glib_none().0, 81 | page_uri.to_glib_none().0, 82 | cancellable.map(|p| p.as_ref()).to_glib_none().0, 83 | Some(callback), 84 | Box_::into_raw(user_data) as *mut _, 85 | ); 86 | } 87 | } 88 | 89 | fn favicon_future( 90 | &self, 91 | page_uri: &str, 92 | ) -> Pin> + 'static>> 93 | { 94 | let page_uri = String::from(page_uri); 95 | Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { 96 | obj.favicon(&page_uri, Some(cancellable), move |res| { 97 | send.resolve(res); 98 | }); 99 | })) 100 | } 101 | 102 | #[doc(alias = "webkit_favicon_database_get_favicon_uri")] 103 | #[doc(alias = "get_favicon_uri")] 104 | fn favicon_uri(&self, page_uri: &str) -> Option { 105 | unsafe { 106 | from_glib_full(ffi::webkit_favicon_database_get_favicon_uri( 107 | self.as_ref().to_glib_none().0, 108 | page_uri.to_glib_none().0, 109 | )) 110 | } 111 | } 112 | 113 | #[doc(alias = "favicon-changed")] 114 | fn connect_favicon_changed(&self, f: F) -> SignalHandlerId { 115 | unsafe extern "C" fn favicon_changed_trampoline< 116 | P: IsA, 117 | F: Fn(&P, &str, &str) + 'static, 118 | >( 119 | this: *mut ffi::WebKitFaviconDatabase, 120 | page_uri: *mut libc::c_char, 121 | favicon_uri: *mut libc::c_char, 122 | f: glib::ffi::gpointer, 123 | ) { 124 | let f: &F = &*(f as *const F); 125 | f( 126 | FaviconDatabase::from_glib_borrow(this).unsafe_cast_ref(), 127 | &glib::GString::from_glib_borrow(page_uri), 128 | &glib::GString::from_glib_borrow(favicon_uri), 129 | ) 130 | } 131 | unsafe { 132 | let f: Box_ = Box_::new(f); 133 | connect_raw( 134 | self.as_ptr() as *mut _, 135 | b"favicon-changed\0".as_ptr() as *const _, 136 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 137 | favicon_changed_trampoline:: as *const (), 138 | )), 139 | Box_::into_raw(f), 140 | ) 141 | } 142 | } 143 | } 144 | 145 | impl> FaviconDatabaseExt for O {} 146 | -------------------------------------------------------------------------------- /src/auto/file_chooser_request.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::{ 6 | prelude::*, 7 | signal::{connect_raw, SignalHandlerId}, 8 | translate::*, 9 | }; 10 | use std::boxed::Box as Box_; 11 | 12 | glib::wrapper! { 13 | #[doc(alias = "WebKitFileChooserRequest")] 14 | pub struct FileChooserRequest(Object); 15 | 16 | match fn { 17 | type_ => || ffi::webkit_file_chooser_request_get_type(), 18 | } 19 | } 20 | 21 | impl FileChooserRequest { 22 | pub const NONE: Option<&'static FileChooserRequest> = None; 23 | } 24 | 25 | mod sealed { 26 | pub trait Sealed {} 27 | impl> Sealed for T {} 28 | } 29 | 30 | pub trait FileChooserRequestExt: IsA + sealed::Sealed + 'static { 31 | #[doc(alias = "webkit_file_chooser_request_cancel")] 32 | fn cancel(&self) { 33 | unsafe { 34 | ffi::webkit_file_chooser_request_cancel(self.as_ref().to_glib_none().0); 35 | } 36 | } 37 | 38 | #[doc(alias = "webkit_file_chooser_request_get_mime_types")] 39 | #[doc(alias = "get_mime_types")] 40 | fn mime_types(&self) -> Vec { 41 | unsafe { 42 | FromGlibPtrContainer::from_glib_none(ffi::webkit_file_chooser_request_get_mime_types( 43 | self.as_ref().to_glib_none().0, 44 | )) 45 | } 46 | } 47 | 48 | #[doc(alias = "webkit_file_chooser_request_get_mime_types_filter")] 49 | #[doc(alias = "get_mime_types_filter")] 50 | fn mime_types_filter(&self) -> Option { 51 | unsafe { 52 | from_glib_none(ffi::webkit_file_chooser_request_get_mime_types_filter( 53 | self.as_ref().to_glib_none().0, 54 | )) 55 | } 56 | } 57 | 58 | #[doc(alias = "webkit_file_chooser_request_get_select_multiple")] 59 | #[doc(alias = "get_select_multiple")] 60 | fn selects_multiple(&self) -> bool { 61 | unsafe { 62 | from_glib(ffi::webkit_file_chooser_request_get_select_multiple( 63 | self.as_ref().to_glib_none().0, 64 | )) 65 | } 66 | } 67 | 68 | #[doc(alias = "webkit_file_chooser_request_get_selected_files")] 69 | #[doc(alias = "get_selected_files")] 70 | fn selected_files(&self) -> Vec { 71 | unsafe { 72 | FromGlibPtrContainer::from_glib_none(ffi::webkit_file_chooser_request_get_selected_files( 73 | self.as_ref().to_glib_none().0, 74 | )) 75 | } 76 | } 77 | 78 | #[doc(alias = "webkit_file_chooser_request_select_files")] 79 | fn select_files(&self, files: &[&str]) { 80 | unsafe { 81 | ffi::webkit_file_chooser_request_select_files( 82 | self.as_ref().to_glib_none().0, 83 | files.to_glib_none().0, 84 | ); 85 | } 86 | } 87 | 88 | fn filter(&self) -> Option { 89 | ObjectExt::property(self.as_ref(), "filter") 90 | } 91 | 92 | #[doc(alias = "filter")] 93 | fn connect_filter_notify(&self, f: F) -> SignalHandlerId { 94 | unsafe extern "C" fn notify_filter_trampoline< 95 | P: IsA, 96 | F: Fn(&P) + 'static, 97 | >( 98 | this: *mut ffi::WebKitFileChooserRequest, 99 | _param_spec: glib::ffi::gpointer, 100 | f: glib::ffi::gpointer, 101 | ) { 102 | let f: &F = &*(f as *const F); 103 | f(FileChooserRequest::from_glib_borrow(this).unsafe_cast_ref()) 104 | } 105 | unsafe { 106 | let f: Box_ = Box_::new(f); 107 | connect_raw( 108 | self.as_ptr() as *mut _, 109 | b"notify::filter\0".as_ptr() as *const _, 110 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 111 | notify_filter_trampoline:: as *const (), 112 | )), 113 | Box_::into_raw(f), 114 | ) 115 | } 116 | } 117 | 118 | #[doc(alias = "mime-types")] 119 | fn connect_mime_types_notify(&self, f: F) -> SignalHandlerId { 120 | unsafe extern "C" fn notify_mime_types_trampoline< 121 | P: IsA, 122 | F: Fn(&P) + 'static, 123 | >( 124 | this: *mut ffi::WebKitFileChooserRequest, 125 | _param_spec: glib::ffi::gpointer, 126 | f: glib::ffi::gpointer, 127 | ) { 128 | let f: &F = &*(f as *const F); 129 | f(FileChooserRequest::from_glib_borrow(this).unsafe_cast_ref()) 130 | } 131 | unsafe { 132 | let f: Box_ = Box_::new(f); 133 | connect_raw( 134 | self.as_ptr() as *mut _, 135 | b"notify::mime-types\0".as_ptr() as *const _, 136 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 137 | notify_mime_types_trampoline:: as *const (), 138 | )), 139 | Box_::into_raw(f), 140 | ) 141 | } 142 | } 143 | 144 | #[doc(alias = "select-multiple")] 145 | fn connect_select_multiple_notify(&self, f: F) -> SignalHandlerId { 146 | unsafe extern "C" fn notify_select_multiple_trampoline< 147 | P: IsA, 148 | F: Fn(&P) + 'static, 149 | >( 150 | this: *mut ffi::WebKitFileChooserRequest, 151 | _param_spec: glib::ffi::gpointer, 152 | f: glib::ffi::gpointer, 153 | ) { 154 | let f: &F = &*(f as *const F); 155 | f(FileChooserRequest::from_glib_borrow(this).unsafe_cast_ref()) 156 | } 157 | unsafe { 158 | let f: Box_ = Box_::new(f); 159 | connect_raw( 160 | self.as_ptr() as *mut _, 161 | b"notify::select-multiple\0".as_ptr() as *const _, 162 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 163 | notify_select_multiple_trampoline:: as *const (), 164 | )), 165 | Box_::into_raw(f), 166 | ) 167 | } 168 | } 169 | 170 | #[doc(alias = "selected-files")] 171 | fn connect_selected_files_notify(&self, f: F) -> SignalHandlerId { 172 | unsafe extern "C" fn notify_selected_files_trampoline< 173 | P: IsA, 174 | F: Fn(&P) + 'static, 175 | >( 176 | this: *mut ffi::WebKitFileChooserRequest, 177 | _param_spec: glib::ffi::gpointer, 178 | f: glib::ffi::gpointer, 179 | ) { 180 | let f: &F = &*(f as *const F); 181 | f(FileChooserRequest::from_glib_borrow(this).unsafe_cast_ref()) 182 | } 183 | unsafe { 184 | let f: Box_ = Box_::new(f); 185 | connect_raw( 186 | self.as_ptr() as *mut _, 187 | b"notify::selected-files\0".as_ptr() as *const _, 188 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 189 | notify_selected_files_trampoline:: as *const (), 190 | )), 191 | Box_::into_raw(f), 192 | ) 193 | } 194 | } 195 | } 196 | 197 | impl> FileChooserRequestExt for O {} 198 | -------------------------------------------------------------------------------- /src/auto/form_submission_request.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | #![allow(deprecated)] 5 | 6 | use glib::{prelude::*, translate::*}; 7 | 8 | glib::wrapper! { 9 | #[doc(alias = "WebKitFormSubmissionRequest")] 10 | pub struct FormSubmissionRequest(Object); 11 | 12 | match fn { 13 | type_ => || ffi::webkit_form_submission_request_get_type(), 14 | } 15 | } 16 | 17 | impl FormSubmissionRequest { 18 | pub const NONE: Option<&'static FormSubmissionRequest> = None; 19 | } 20 | 21 | mod sealed { 22 | pub trait Sealed {} 23 | impl> Sealed for T {} 24 | } 25 | 26 | pub trait FormSubmissionRequestExt: IsA + sealed::Sealed + 'static { 27 | //#[cfg_attr(feature = "v2_20", deprecated = "Since 2.20")] 28 | //#[allow(deprecated)] 29 | //#[doc(alias = "webkit_form_submission_request_get_text_fields")] 30 | //#[doc(alias = "get_text_fields")] 31 | //fn text_fields(&self) -> /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 } { 32 | // unsafe { TODO: call ffi:webkit_form_submission_request_get_text_fields() } 33 | //} 34 | 35 | #[doc(alias = "webkit_form_submission_request_submit")] 36 | fn submit(&self) { 37 | unsafe { 38 | ffi::webkit_form_submission_request_submit(self.as_ref().to_glib_none().0); 39 | } 40 | } 41 | } 42 | 43 | impl> FormSubmissionRequestExt for O {} 44 | -------------------------------------------------------------------------------- /src/auto/geolocation_manager.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::GeolocationPosition; 6 | use glib::{ 7 | prelude::*, 8 | signal::{connect_raw, SignalHandlerId}, 9 | translate::*, 10 | }; 11 | use std::boxed::Box as Box_; 12 | 13 | glib::wrapper! { 14 | #[doc(alias = "WebKitGeolocationManager")] 15 | pub struct GeolocationManager(Object); 16 | 17 | match fn { 18 | type_ => || ffi::webkit_geolocation_manager_get_type(), 19 | } 20 | } 21 | 22 | impl GeolocationManager { 23 | pub const NONE: Option<&'static GeolocationManager> = None; 24 | } 25 | 26 | mod sealed { 27 | pub trait Sealed {} 28 | impl> Sealed for T {} 29 | } 30 | 31 | pub trait GeolocationManagerExt: IsA + sealed::Sealed + 'static { 32 | #[doc(alias = "webkit_geolocation_manager_failed")] 33 | fn failed(&self, error_message: &str) { 34 | unsafe { 35 | ffi::webkit_geolocation_manager_failed( 36 | self.as_ref().to_glib_none().0, 37 | error_message.to_glib_none().0, 38 | ); 39 | } 40 | } 41 | 42 | #[doc(alias = "webkit_geolocation_manager_get_enable_high_accuracy")] 43 | #[doc(alias = "get_enable_high_accuracy")] 44 | fn enables_high_accuracy(&self) -> bool { 45 | unsafe { 46 | from_glib(ffi::webkit_geolocation_manager_get_enable_high_accuracy( 47 | self.as_ref().to_glib_none().0, 48 | )) 49 | } 50 | } 51 | 52 | #[doc(alias = "webkit_geolocation_manager_update_position")] 53 | fn update_position(&self, position: &mut GeolocationPosition) { 54 | unsafe { 55 | ffi::webkit_geolocation_manager_update_position( 56 | self.as_ref().to_glib_none().0, 57 | position.to_glib_none_mut().0, 58 | ); 59 | } 60 | } 61 | 62 | #[cfg(feature = "v2_26")] 63 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_26")))] 64 | #[doc(alias = "start")] 65 | fn connect_start bool + 'static>(&self, f: F) -> SignalHandlerId { 66 | unsafe extern "C" fn start_trampoline< 67 | P: IsA, 68 | F: Fn(&P) -> bool + 'static, 69 | >( 70 | this: *mut ffi::WebKitGeolocationManager, 71 | f: glib::ffi::gpointer, 72 | ) -> glib::ffi::gboolean { 73 | let f: &F = &*(f as *const F); 74 | f(GeolocationManager::from_glib_borrow(this).unsafe_cast_ref()).into_glib() 75 | } 76 | unsafe { 77 | let f: Box_ = Box_::new(f); 78 | connect_raw( 79 | self.as_ptr() as *mut _, 80 | b"start\0".as_ptr() as *const _, 81 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 82 | start_trampoline:: as *const (), 83 | )), 84 | Box_::into_raw(f), 85 | ) 86 | } 87 | } 88 | 89 | #[cfg(feature = "v2_26")] 90 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_26")))] 91 | #[doc(alias = "stop")] 92 | fn connect_stop(&self, f: F) -> SignalHandlerId { 93 | unsafe extern "C" fn stop_trampoline, F: Fn(&P) + 'static>( 94 | this: *mut ffi::WebKitGeolocationManager, 95 | f: glib::ffi::gpointer, 96 | ) { 97 | let f: &F = &*(f as *const F); 98 | f(GeolocationManager::from_glib_borrow(this).unsafe_cast_ref()) 99 | } 100 | unsafe { 101 | let f: Box_ = Box_::new(f); 102 | connect_raw( 103 | self.as_ptr() as *mut _, 104 | b"stop\0".as_ptr() as *const _, 105 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 106 | stop_trampoline:: as *const (), 107 | )), 108 | Box_::into_raw(f), 109 | ) 110 | } 111 | } 112 | 113 | #[cfg(feature = "v2_26")] 114 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_26")))] 115 | #[doc(alias = "enable-high-accuracy")] 116 | fn connect_enable_high_accuracy_notify(&self, f: F) -> SignalHandlerId { 117 | unsafe extern "C" fn notify_enable_high_accuracy_trampoline< 118 | P: IsA, 119 | F: Fn(&P) + 'static, 120 | >( 121 | this: *mut ffi::WebKitGeolocationManager, 122 | _param_spec: glib::ffi::gpointer, 123 | f: glib::ffi::gpointer, 124 | ) { 125 | let f: &F = &*(f as *const F); 126 | f(GeolocationManager::from_glib_borrow(this).unsafe_cast_ref()) 127 | } 128 | unsafe { 129 | let f: Box_ = Box_::new(f); 130 | connect_raw( 131 | self.as_ptr() as *mut _, 132 | b"notify::enable-high-accuracy\0".as_ptr() as *const _, 133 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 134 | notify_enable_high_accuracy_trampoline:: as *const (), 135 | )), 136 | Box_::into_raw(f), 137 | ) 138 | } 139 | } 140 | } 141 | 142 | impl> GeolocationManagerExt for O {} 143 | -------------------------------------------------------------------------------- /src/auto/geolocation_permission_request.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::PermissionRequest; 6 | 7 | glib::wrapper! { 8 | #[doc(alias = "WebKitGeolocationPermissionRequest")] 9 | pub struct GeolocationPermissionRequest(Object) @implements PermissionRequest; 10 | 11 | match fn { 12 | type_ => || ffi::webkit_geolocation_permission_request_get_type(), 13 | } 14 | } 15 | 16 | impl GeolocationPermissionRequest { 17 | pub const NONE: Option<&'static GeolocationPermissionRequest> = None; 18 | } 19 | -------------------------------------------------------------------------------- /src/auto/geolocation_position.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::translate::*; 6 | 7 | glib::wrapper! { 8 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 9 | pub struct GeolocationPosition(Boxed); 10 | 11 | match fn { 12 | copy => |ptr| ffi::webkit_geolocation_position_copy(mut_override(ptr)), 13 | free => |ptr| ffi::webkit_geolocation_position_free(ptr), 14 | type_ => || ffi::webkit_geolocation_position_get_type(), 15 | } 16 | } 17 | 18 | impl GeolocationPosition { 19 | #[doc(alias = "webkit_geolocation_position_new")] 20 | pub fn new(latitude: f64, longitude: f64, accuracy: f64) -> GeolocationPosition { 21 | assert_initialized_main_thread!(); 22 | unsafe { 23 | from_glib_full(ffi::webkit_geolocation_position_new( 24 | latitude, longitude, accuracy, 25 | )) 26 | } 27 | } 28 | 29 | #[doc(alias = "webkit_geolocation_position_set_altitude")] 30 | pub fn set_altitude(&mut self, altitude: f64) { 31 | unsafe { 32 | ffi::webkit_geolocation_position_set_altitude(self.to_glib_none_mut().0, altitude); 33 | } 34 | } 35 | 36 | #[doc(alias = "webkit_geolocation_position_set_altitude_accuracy")] 37 | pub fn set_altitude_accuracy(&mut self, altitude_accuracy: f64) { 38 | unsafe { 39 | ffi::webkit_geolocation_position_set_altitude_accuracy( 40 | self.to_glib_none_mut().0, 41 | altitude_accuracy, 42 | ); 43 | } 44 | } 45 | 46 | #[doc(alias = "webkit_geolocation_position_set_heading")] 47 | pub fn set_heading(&mut self, heading: f64) { 48 | unsafe { 49 | ffi::webkit_geolocation_position_set_heading(self.to_glib_none_mut().0, heading); 50 | } 51 | } 52 | 53 | #[doc(alias = "webkit_geolocation_position_set_speed")] 54 | pub fn set_speed(&mut self, speed: f64) { 55 | unsafe { 56 | ffi::webkit_geolocation_position_set_speed(self.to_glib_none_mut().0, speed); 57 | } 58 | } 59 | 60 | #[doc(alias = "webkit_geolocation_position_set_timestamp")] 61 | pub fn set_timestamp(&mut self, timestamp: u64) { 62 | unsafe { 63 | ffi::webkit_geolocation_position_set_timestamp(self.to_glib_none_mut().0, timestamp); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/auto/hit_test_result.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::{prelude::*, translate::*}; 6 | 7 | glib::wrapper! { 8 | #[doc(alias = "WebKitHitTestResult")] 9 | pub struct HitTestResult(Object); 10 | 11 | match fn { 12 | type_ => || ffi::webkit_hit_test_result_get_type(), 13 | } 14 | } 15 | 16 | impl HitTestResult { 17 | pub const NONE: Option<&'static HitTestResult> = None; 18 | 19 | // rustdoc-stripper-ignore-next 20 | /// Creates a new builder-pattern struct instance to construct [`HitTestResult`] objects. 21 | /// 22 | /// This method returns an instance of [`HitTestResultBuilder`](crate::builders::HitTestResultBuilder) which can be used to create [`HitTestResult`] objects. 23 | pub fn builder() -> HitTestResultBuilder { 24 | HitTestResultBuilder::new() 25 | } 26 | } 27 | 28 | // rustdoc-stripper-ignore-next 29 | /// A [builder-pattern] type to construct [`HitTestResult`] objects. 30 | /// 31 | /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 32 | #[must_use = "The builder must be built to be used"] 33 | pub struct HitTestResultBuilder { 34 | builder: glib::object::ObjectBuilder<'static, HitTestResult>, 35 | } 36 | 37 | impl HitTestResultBuilder { 38 | fn new() -> Self { 39 | Self { 40 | builder: glib::object::Object::builder(), 41 | } 42 | } 43 | 44 | pub fn context(self, context: u32) -> Self { 45 | Self { 46 | builder: self.builder.property("context", context), 47 | } 48 | } 49 | 50 | pub fn image_uri(self, image_uri: impl Into) -> Self { 51 | Self { 52 | builder: self.builder.property("image-uri", image_uri.into()), 53 | } 54 | } 55 | 56 | pub fn link_label(self, link_label: impl Into) -> Self { 57 | Self { 58 | builder: self.builder.property("link-label", link_label.into()), 59 | } 60 | } 61 | 62 | pub fn link_title(self, link_title: impl Into) -> Self { 63 | Self { 64 | builder: self.builder.property("link-title", link_title.into()), 65 | } 66 | } 67 | 68 | pub fn link_uri(self, link_uri: impl Into) -> Self { 69 | Self { 70 | builder: self.builder.property("link-uri", link_uri.into()), 71 | } 72 | } 73 | 74 | pub fn media_uri(self, media_uri: impl Into) -> Self { 75 | Self { 76 | builder: self.builder.property("media-uri", media_uri.into()), 77 | } 78 | } 79 | 80 | // rustdoc-stripper-ignore-next 81 | /// Build the [`HitTestResult`]. 82 | #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] 83 | pub fn build(self) -> HitTestResult { 84 | self.builder.build() 85 | } 86 | } 87 | 88 | mod sealed { 89 | pub trait Sealed {} 90 | impl> Sealed for T {} 91 | } 92 | 93 | pub trait HitTestResultExt: IsA + sealed::Sealed + 'static { 94 | #[doc(alias = "webkit_hit_test_result_context_is_editable")] 95 | fn context_is_editable(&self) -> bool { 96 | unsafe { 97 | from_glib(ffi::webkit_hit_test_result_context_is_editable( 98 | self.as_ref().to_glib_none().0, 99 | )) 100 | } 101 | } 102 | 103 | #[doc(alias = "webkit_hit_test_result_context_is_image")] 104 | fn context_is_image(&self) -> bool { 105 | unsafe { 106 | from_glib(ffi::webkit_hit_test_result_context_is_image( 107 | self.as_ref().to_glib_none().0, 108 | )) 109 | } 110 | } 111 | 112 | #[doc(alias = "webkit_hit_test_result_context_is_link")] 113 | fn context_is_link(&self) -> bool { 114 | unsafe { 115 | from_glib(ffi::webkit_hit_test_result_context_is_link( 116 | self.as_ref().to_glib_none().0, 117 | )) 118 | } 119 | } 120 | 121 | #[doc(alias = "webkit_hit_test_result_context_is_media")] 122 | fn context_is_media(&self) -> bool { 123 | unsafe { 124 | from_glib(ffi::webkit_hit_test_result_context_is_media( 125 | self.as_ref().to_glib_none().0, 126 | )) 127 | } 128 | } 129 | 130 | #[doc(alias = "webkit_hit_test_result_context_is_scrollbar")] 131 | fn context_is_scrollbar(&self) -> bool { 132 | unsafe { 133 | from_glib(ffi::webkit_hit_test_result_context_is_scrollbar( 134 | self.as_ref().to_glib_none().0, 135 | )) 136 | } 137 | } 138 | 139 | #[cfg(feature = "v2_8")] 140 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 141 | #[doc(alias = "webkit_hit_test_result_context_is_selection")] 142 | fn context_is_selection(&self) -> bool { 143 | unsafe { 144 | from_glib(ffi::webkit_hit_test_result_context_is_selection( 145 | self.as_ref().to_glib_none().0, 146 | )) 147 | } 148 | } 149 | 150 | #[doc(alias = "webkit_hit_test_result_get_context")] 151 | #[doc(alias = "get_context")] 152 | fn context(&self) -> u32 { 153 | unsafe { ffi::webkit_hit_test_result_get_context(self.as_ref().to_glib_none().0) } 154 | } 155 | 156 | #[doc(alias = "webkit_hit_test_result_get_image_uri")] 157 | #[doc(alias = "get_image_uri")] 158 | fn image_uri(&self) -> Option { 159 | unsafe { 160 | from_glib_none(ffi::webkit_hit_test_result_get_image_uri( 161 | self.as_ref().to_glib_none().0, 162 | )) 163 | } 164 | } 165 | 166 | #[doc(alias = "webkit_hit_test_result_get_link_label")] 167 | #[doc(alias = "get_link_label")] 168 | fn link_label(&self) -> Option { 169 | unsafe { 170 | from_glib_none(ffi::webkit_hit_test_result_get_link_label( 171 | self.as_ref().to_glib_none().0, 172 | )) 173 | } 174 | } 175 | 176 | #[doc(alias = "webkit_hit_test_result_get_link_title")] 177 | #[doc(alias = "get_link_title")] 178 | fn link_title(&self) -> Option { 179 | unsafe { 180 | from_glib_none(ffi::webkit_hit_test_result_get_link_title( 181 | self.as_ref().to_glib_none().0, 182 | )) 183 | } 184 | } 185 | 186 | #[doc(alias = "webkit_hit_test_result_get_link_uri")] 187 | #[doc(alias = "get_link_uri")] 188 | fn link_uri(&self) -> Option { 189 | unsafe { 190 | from_glib_none(ffi::webkit_hit_test_result_get_link_uri( 191 | self.as_ref().to_glib_none().0, 192 | )) 193 | } 194 | } 195 | 196 | #[doc(alias = "webkit_hit_test_result_get_media_uri")] 197 | #[doc(alias = "get_media_uri")] 198 | fn media_uri(&self) -> Option { 199 | unsafe { 200 | from_glib_none(ffi::webkit_hit_test_result_get_media_uri( 201 | self.as_ref().to_glib_none().0, 202 | )) 203 | } 204 | } 205 | } 206 | 207 | impl> HitTestResultExt for O {} 208 | -------------------------------------------------------------------------------- /src/auto/input_method_underline.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::translate::*; 6 | 7 | glib::wrapper! { 8 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 9 | pub struct InputMethodUnderline(Boxed); 10 | 11 | match fn { 12 | copy => |ptr| ffi::webkit_input_method_underline_copy(mut_override(ptr)), 13 | free => |ptr| ffi::webkit_input_method_underline_free(ptr), 14 | type_ => || ffi::webkit_input_method_underline_get_type(), 15 | } 16 | } 17 | 18 | impl InputMethodUnderline { 19 | #[doc(alias = "webkit_input_method_underline_new")] 20 | pub fn new(start_offset: u32, end_offset: u32) -> InputMethodUnderline { 21 | assert_initialized_main_thread!(); 22 | unsafe { 23 | from_glib_full(ffi::webkit_input_method_underline_new( 24 | start_offset, 25 | end_offset, 26 | )) 27 | } 28 | } 29 | 30 | #[doc(alias = "webkit_input_method_underline_set_color")] 31 | pub fn set_color(&mut self, rgba: Option<&gdk::RGBA>) { 32 | unsafe { 33 | ffi::webkit_input_method_underline_set_color( 34 | self.to_glib_none_mut().0, 35 | rgba.to_glib_none().0, 36 | ); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/auto/install_missing_media_plugins_permission_request.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | #![allow(deprecated)] 5 | 6 | use crate::PermissionRequest; 7 | use glib::{prelude::*, translate::*}; 8 | 9 | glib::wrapper! { 10 | #[doc(alias = "WebKitInstallMissingMediaPluginsPermissionRequest")] 11 | pub struct InstallMissingMediaPluginsPermissionRequest(Object) @implements PermissionRequest; 12 | 13 | match fn { 14 | type_ => || ffi::webkit_install_missing_media_plugins_permission_request_get_type(), 15 | } 16 | } 17 | 18 | impl InstallMissingMediaPluginsPermissionRequest { 19 | pub const NONE: Option<&'static InstallMissingMediaPluginsPermissionRequest> = None; 20 | } 21 | 22 | mod sealed { 23 | pub trait Sealed {} 24 | impl> Sealed for T {} 25 | } 26 | 27 | pub trait InstallMissingMediaPluginsPermissionRequestExt: 28 | IsA + sealed::Sealed + 'static 29 | { 30 | #[cfg_attr(feature = "v2_40", deprecated = "Since 2.40")] 31 | #[allow(deprecated)] 32 | #[doc(alias = "webkit_install_missing_media_plugins_permission_request_get_description")] 33 | #[doc(alias = "get_description")] 34 | fn description(&self) -> Option { 35 | unsafe { 36 | from_glib_none( 37 | ffi::webkit_install_missing_media_plugins_permission_request_get_description( 38 | self.as_ref().to_glib_none().0, 39 | ), 40 | ) 41 | } 42 | } 43 | } 44 | 45 | impl> 46 | InstallMissingMediaPluginsPermissionRequestExt for O 47 | { 48 | } 49 | -------------------------------------------------------------------------------- /src/auto/itp_first_party.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::translate::*; 6 | 7 | glib::wrapper! { 8 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 9 | pub struct ITPFirstParty(Shared); 10 | 11 | match fn { 12 | ref => |ptr| ffi::webkit_itp_first_party_ref(ptr), 13 | unref => |ptr| ffi::webkit_itp_first_party_unref(ptr), 14 | type_ => || ffi::webkit_itp_first_party_get_type(), 15 | } 16 | } 17 | 18 | impl ITPFirstParty { 19 | #[doc(alias = "webkit_itp_first_party_get_domain")] 20 | #[doc(alias = "get_domain")] 21 | pub fn domain(&self) -> Option { 22 | unsafe { 23 | from_glib_none(ffi::webkit_itp_first_party_get_domain( 24 | self.to_glib_none().0, 25 | )) 26 | } 27 | } 28 | 29 | #[doc(alias = "webkit_itp_first_party_get_last_update_time")] 30 | #[doc(alias = "get_last_update_time")] 31 | pub fn last_update_time(&self) -> Option { 32 | unsafe { 33 | from_glib_none(ffi::webkit_itp_first_party_get_last_update_time( 34 | self.to_glib_none().0, 35 | )) 36 | } 37 | } 38 | 39 | #[doc(alias = "webkit_itp_first_party_get_website_data_access_allowed")] 40 | #[doc(alias = "get_website_data_access_allowed")] 41 | pub fn is_website_data_access_allowed(&self) -> bool { 42 | unsafe { 43 | from_glib(ffi::webkit_itp_first_party_get_website_data_access_allowed( 44 | self.to_glib_none().0, 45 | )) 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/auto/itp_third_party.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::ITPFirstParty; 6 | use glib::translate::*; 7 | 8 | glib::wrapper! { 9 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 10 | pub struct ITPThirdParty(Shared); 11 | 12 | match fn { 13 | ref => |ptr| ffi::webkit_itp_third_party_ref(ptr), 14 | unref => |ptr| ffi::webkit_itp_third_party_unref(ptr), 15 | type_ => || ffi::webkit_itp_third_party_get_type(), 16 | } 17 | } 18 | 19 | impl ITPThirdParty { 20 | #[doc(alias = "webkit_itp_third_party_get_domain")] 21 | #[doc(alias = "get_domain")] 22 | pub fn domain(&self) -> Option { 23 | unsafe { 24 | from_glib_none(ffi::webkit_itp_third_party_get_domain( 25 | self.to_glib_none().0, 26 | )) 27 | } 28 | } 29 | 30 | #[doc(alias = "webkit_itp_third_party_get_first_parties")] 31 | #[doc(alias = "get_first_parties")] 32 | pub fn first_parties(&self) -> Vec { 33 | unsafe { 34 | FromGlibPtrContainer::from_glib_none(ffi::webkit_itp_third_party_get_first_parties( 35 | self.to_glib_none().0, 36 | )) 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/auto/javascript_result.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | #[cfg(feature = "v2_22")] 6 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_22")))] 7 | use glib::translate::*; 8 | 9 | glib::wrapper! { 10 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 11 | pub struct JavascriptResult(Shared); 12 | 13 | match fn { 14 | ref => |ptr| ffi::webkit_javascript_result_ref(ptr), 15 | unref => |ptr| ffi::webkit_javascript_result_unref(ptr), 16 | type_ => || ffi::webkit_javascript_result_get_type(), 17 | } 18 | } 19 | 20 | impl JavascriptResult { 21 | #[cfg(feature = "v2_22")] 22 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_22")))] 23 | #[doc(alias = "webkit_javascript_result_get_js_value")] 24 | #[doc(alias = "get_js_value")] 25 | pub fn js_value(&self) -> Option { 26 | unsafe { 27 | from_glib_none(ffi::webkit_javascript_result_get_js_value( 28 | self.to_glib_none().0, 29 | )) 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/auto/media_key_system_permission_request.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::PermissionRequest; 6 | 7 | glib::wrapper! { 8 | #[doc(alias = "WebKitMediaKeySystemPermissionRequest")] 9 | pub struct MediaKeySystemPermissionRequest(Object) @implements PermissionRequest; 10 | 11 | match fn { 12 | type_ => || ffi::webkit_media_key_system_permission_request_get_type(), 13 | } 14 | } 15 | 16 | impl MediaKeySystemPermissionRequest { 17 | pub const NONE: Option<&'static MediaKeySystemPermissionRequest> = None; 18 | } 19 | -------------------------------------------------------------------------------- /src/auto/memory_pressure_settings.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::translate::*; 6 | 7 | glib::wrapper! { 8 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 9 | pub struct MemoryPressureSettings(Boxed); 10 | 11 | match fn { 12 | copy => |ptr| ffi::webkit_memory_pressure_settings_copy(mut_override(ptr)), 13 | free => |ptr| ffi::webkit_memory_pressure_settings_free(ptr), 14 | type_ => || ffi::webkit_memory_pressure_settings_get_type(), 15 | } 16 | } 17 | 18 | impl MemoryPressureSettings { 19 | #[doc(alias = "webkit_memory_pressure_settings_new")] 20 | pub fn new() -> MemoryPressureSettings { 21 | assert_initialized_main_thread!(); 22 | unsafe { from_glib_full(ffi::webkit_memory_pressure_settings_new()) } 23 | } 24 | 25 | #[doc(alias = "webkit_memory_pressure_settings_get_conservative_threshold")] 26 | #[doc(alias = "get_conservative_threshold")] 27 | pub fn conservative_threshold(&mut self) -> f64 { 28 | unsafe { 29 | ffi::webkit_memory_pressure_settings_get_conservative_threshold(self.to_glib_none_mut().0) 30 | } 31 | } 32 | 33 | #[doc(alias = "webkit_memory_pressure_settings_get_kill_threshold")] 34 | #[doc(alias = "get_kill_threshold")] 35 | pub fn kill_threshold(&mut self) -> f64 { 36 | unsafe { ffi::webkit_memory_pressure_settings_get_kill_threshold(self.to_glib_none_mut().0) } 37 | } 38 | 39 | #[doc(alias = "webkit_memory_pressure_settings_get_memory_limit")] 40 | #[doc(alias = "get_memory_limit")] 41 | pub fn memory_limit(&mut self) -> u32 { 42 | unsafe { ffi::webkit_memory_pressure_settings_get_memory_limit(self.to_glib_none_mut().0) } 43 | } 44 | 45 | #[doc(alias = "webkit_memory_pressure_settings_get_poll_interval")] 46 | #[doc(alias = "get_poll_interval")] 47 | pub fn poll_interval(&mut self) -> f64 { 48 | unsafe { ffi::webkit_memory_pressure_settings_get_poll_interval(self.to_glib_none_mut().0) } 49 | } 50 | 51 | #[doc(alias = "webkit_memory_pressure_settings_get_strict_threshold")] 52 | #[doc(alias = "get_strict_threshold")] 53 | pub fn strict_threshold(&mut self) -> f64 { 54 | unsafe { ffi::webkit_memory_pressure_settings_get_strict_threshold(self.to_glib_none_mut().0) } 55 | } 56 | 57 | #[doc(alias = "webkit_memory_pressure_settings_set_conservative_threshold")] 58 | pub fn set_conservative_threshold(&mut self, value: f64) { 59 | unsafe { 60 | ffi::webkit_memory_pressure_settings_set_conservative_threshold( 61 | self.to_glib_none_mut().0, 62 | value, 63 | ); 64 | } 65 | } 66 | 67 | #[doc(alias = "webkit_memory_pressure_settings_set_kill_threshold")] 68 | pub fn set_kill_threshold(&mut self, value: f64) { 69 | unsafe { 70 | ffi::webkit_memory_pressure_settings_set_kill_threshold(self.to_glib_none_mut().0, value); 71 | } 72 | } 73 | 74 | #[doc(alias = "webkit_memory_pressure_settings_set_memory_limit")] 75 | pub fn set_memory_limit(&mut self, memory_limit: u32) { 76 | unsafe { 77 | ffi::webkit_memory_pressure_settings_set_memory_limit( 78 | self.to_glib_none_mut().0, 79 | memory_limit, 80 | ); 81 | } 82 | } 83 | 84 | #[doc(alias = "webkit_memory_pressure_settings_set_poll_interval")] 85 | pub fn set_poll_interval(&mut self, value: f64) { 86 | unsafe { 87 | ffi::webkit_memory_pressure_settings_set_poll_interval(self.to_glib_none_mut().0, value); 88 | } 89 | } 90 | 91 | #[doc(alias = "webkit_memory_pressure_settings_set_strict_threshold")] 92 | pub fn set_strict_threshold(&mut self, value: f64) { 93 | unsafe { 94 | ffi::webkit_memory_pressure_settings_set_strict_threshold(self.to_glib_none_mut().0, value); 95 | } 96 | } 97 | } 98 | 99 | #[cfg(feature = "v2_34")] 100 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_34")))] 101 | impl Default for MemoryPressureSettings { 102 | fn default() -> Self { 103 | Self::new() 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /src/auto/mime_info.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::translate::*; 6 | 7 | glib::wrapper! { 8 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 9 | pub struct MimeInfo(Shared); 10 | 11 | match fn { 12 | ref => |ptr| ffi::webkit_mime_info_ref(ptr), 13 | unref => |ptr| ffi::webkit_mime_info_unref(ptr), 14 | type_ => || ffi::webkit_mime_info_get_type(), 15 | } 16 | } 17 | 18 | impl MimeInfo { 19 | #[cfg_attr(feature = "v2_32", deprecated = "Since 2.32")] 20 | #[allow(deprecated)] 21 | #[doc(alias = "webkit_mime_info_get_description")] 22 | #[doc(alias = "get_description")] 23 | pub fn description(&self) -> Option { 24 | unsafe { from_glib_none(ffi::webkit_mime_info_get_description(self.to_glib_none().0)) } 25 | } 26 | 27 | #[cfg_attr(feature = "v2_32", deprecated = "Since 2.32")] 28 | #[allow(deprecated)] 29 | #[doc(alias = "webkit_mime_info_get_extensions")] 30 | #[doc(alias = "get_extensions")] 31 | pub fn extensions(&self) -> Vec { 32 | unsafe { 33 | FromGlibPtrContainer::from_glib_none(ffi::webkit_mime_info_get_extensions( 34 | self.to_glib_none().0, 35 | )) 36 | } 37 | } 38 | 39 | #[cfg_attr(feature = "v2_32", deprecated = "Since 2.32")] 40 | #[allow(deprecated)] 41 | #[doc(alias = "webkit_mime_info_get_mime_type")] 42 | #[doc(alias = "get_mime_type")] 43 | pub fn mime_type(&self) -> Option { 44 | unsafe { from_glib_none(ffi::webkit_mime_info_get_mime_type(self.to_glib_none().0)) } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/auto/navigation_action.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::{NavigationType, URIRequest}; 6 | use glib::translate::*; 7 | 8 | glib::wrapper! { 9 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 10 | pub struct NavigationAction(Boxed); 11 | 12 | match fn { 13 | copy => |ptr| ffi::webkit_navigation_action_copy(mut_override(ptr)), 14 | free => |ptr| ffi::webkit_navigation_action_free(ptr), 15 | type_ => || ffi::webkit_navigation_action_get_type(), 16 | } 17 | } 18 | 19 | impl NavigationAction { 20 | #[cfg(feature = "v2_40")] 21 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_40")))] 22 | #[doc(alias = "webkit_navigation_action_get_frame_name")] 23 | #[doc(alias = "get_frame_name")] 24 | pub fn frame_name(&mut self) -> Option { 25 | unsafe { 26 | from_glib_none(ffi::webkit_navigation_action_get_frame_name( 27 | self.to_glib_none_mut().0, 28 | )) 29 | } 30 | } 31 | 32 | #[doc(alias = "webkit_navigation_action_get_modifiers")] 33 | #[doc(alias = "get_modifiers")] 34 | pub fn modifiers(&self) -> u32 { 35 | unsafe { ffi::webkit_navigation_action_get_modifiers(mut_override(self.to_glib_none().0)) } 36 | } 37 | 38 | #[doc(alias = "webkit_navigation_action_get_mouse_button")] 39 | #[doc(alias = "get_mouse_button")] 40 | pub fn mouse_button(&self) -> u32 { 41 | unsafe { ffi::webkit_navigation_action_get_mouse_button(mut_override(self.to_glib_none().0)) } 42 | } 43 | 44 | #[doc(alias = "webkit_navigation_action_get_navigation_type")] 45 | #[doc(alias = "get_navigation_type")] 46 | pub fn navigation_type(&self) -> NavigationType { 47 | unsafe { 48 | from_glib(ffi::webkit_navigation_action_get_navigation_type( 49 | mut_override(self.to_glib_none().0), 50 | )) 51 | } 52 | } 53 | 54 | #[doc(alias = "webkit_navigation_action_get_request")] 55 | #[doc(alias = "get_request")] 56 | pub fn request(&self) -> Option { 57 | unsafe { 58 | from_glib_none(ffi::webkit_navigation_action_get_request(mut_override( 59 | self.to_glib_none().0, 60 | ))) 61 | } 62 | } 63 | 64 | #[cfg(feature = "v2_20")] 65 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_20")))] 66 | #[doc(alias = "webkit_navigation_action_is_redirect")] 67 | pub fn is_redirect(&mut self) -> bool { 68 | unsafe { 69 | from_glib(ffi::webkit_navigation_action_is_redirect( 70 | self.to_glib_none_mut().0, 71 | )) 72 | } 73 | } 74 | 75 | #[doc(alias = "webkit_navigation_action_is_user_gesture")] 76 | pub fn is_user_gesture(&self) -> bool { 77 | unsafe { 78 | from_glib(ffi::webkit_navigation_action_is_user_gesture(mut_override( 79 | self.to_glib_none().0, 80 | ))) 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/auto/network_proxy_settings.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::translate::*; 6 | 7 | glib::wrapper! { 8 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 9 | pub struct NetworkProxySettings(Boxed); 10 | 11 | match fn { 12 | copy => |ptr| ffi::webkit_network_proxy_settings_copy(mut_override(ptr)), 13 | free => |ptr| ffi::webkit_network_proxy_settings_free(ptr), 14 | type_ => || ffi::webkit_network_proxy_settings_get_type(), 15 | } 16 | } 17 | 18 | impl NetworkProxySettings { 19 | #[doc(alias = "webkit_network_proxy_settings_new")] 20 | pub fn new(default_proxy_uri: Option<&str>, ignore_hosts: &[&str]) -> NetworkProxySettings { 21 | assert_initialized_main_thread!(); 22 | unsafe { 23 | from_glib_full(ffi::webkit_network_proxy_settings_new( 24 | default_proxy_uri.to_glib_none().0, 25 | ignore_hosts.to_glib_none().0, 26 | )) 27 | } 28 | } 29 | 30 | #[doc(alias = "webkit_network_proxy_settings_add_proxy_for_scheme")] 31 | pub fn add_proxy_for_scheme(&mut self, scheme: &str, proxy_uri: &str) { 32 | unsafe { 33 | ffi::webkit_network_proxy_settings_add_proxy_for_scheme( 34 | self.to_glib_none_mut().0, 35 | scheme.to_glib_none().0, 36 | proxy_uri.to_glib_none().0, 37 | ); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/auto/notification.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::{ 6 | prelude::*, 7 | signal::{connect_raw, SignalHandlerId}, 8 | translate::*, 9 | }; 10 | use std::boxed::Box as Box_; 11 | 12 | glib::wrapper! { 13 | #[doc(alias = "WebKitNotification")] 14 | pub struct Notification(Object); 15 | 16 | match fn { 17 | type_ => || ffi::webkit_notification_get_type(), 18 | } 19 | } 20 | 21 | impl Notification { 22 | pub const NONE: Option<&'static Notification> = None; 23 | } 24 | 25 | mod sealed { 26 | pub trait Sealed {} 27 | impl> Sealed for T {} 28 | } 29 | 30 | pub trait NotificationExt: IsA + sealed::Sealed + 'static { 31 | #[cfg(feature = "v2_12")] 32 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_12")))] 33 | #[doc(alias = "webkit_notification_clicked")] 34 | fn clicked(&self) { 35 | unsafe { 36 | ffi::webkit_notification_clicked(self.as_ref().to_glib_none().0); 37 | } 38 | } 39 | 40 | #[doc(alias = "webkit_notification_close")] 41 | fn close(&self) { 42 | unsafe { 43 | ffi::webkit_notification_close(self.as_ref().to_glib_none().0); 44 | } 45 | } 46 | 47 | #[doc(alias = "webkit_notification_get_body")] 48 | #[doc(alias = "get_body")] 49 | fn body(&self) -> Option { 50 | unsafe { 51 | from_glib_none(ffi::webkit_notification_get_body( 52 | self.as_ref().to_glib_none().0, 53 | )) 54 | } 55 | } 56 | 57 | #[doc(alias = "webkit_notification_get_id")] 58 | #[doc(alias = "get_id")] 59 | fn id(&self) -> u64 { 60 | unsafe { ffi::webkit_notification_get_id(self.as_ref().to_glib_none().0) } 61 | } 62 | 63 | #[cfg(feature = "v2_16")] 64 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 65 | #[doc(alias = "webkit_notification_get_tag")] 66 | #[doc(alias = "get_tag")] 67 | fn tag(&self) -> Option { 68 | unsafe { 69 | from_glib_none(ffi::webkit_notification_get_tag( 70 | self.as_ref().to_glib_none().0, 71 | )) 72 | } 73 | } 74 | 75 | #[doc(alias = "webkit_notification_get_title")] 76 | #[doc(alias = "get_title")] 77 | fn title(&self) -> Option { 78 | unsafe { 79 | from_glib_none(ffi::webkit_notification_get_title( 80 | self.as_ref().to_glib_none().0, 81 | )) 82 | } 83 | } 84 | 85 | #[cfg(feature = "v2_12")] 86 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_12")))] 87 | #[doc(alias = "clicked")] 88 | fn connect_clicked(&self, f: F) -> SignalHandlerId { 89 | unsafe extern "C" fn clicked_trampoline, F: Fn(&P) + 'static>( 90 | this: *mut ffi::WebKitNotification, 91 | f: glib::ffi::gpointer, 92 | ) { 93 | let f: &F = &*(f as *const F); 94 | f(Notification::from_glib_borrow(this).unsafe_cast_ref()) 95 | } 96 | unsafe { 97 | let f: Box_ = Box_::new(f); 98 | connect_raw( 99 | self.as_ptr() as *mut _, 100 | b"clicked\0".as_ptr() as *const _, 101 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 102 | clicked_trampoline:: as *const (), 103 | )), 104 | Box_::into_raw(f), 105 | ) 106 | } 107 | } 108 | 109 | #[cfg(feature = "v2_8")] 110 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 111 | #[doc(alias = "closed")] 112 | fn connect_closed(&self, f: F) -> SignalHandlerId { 113 | unsafe extern "C" fn closed_trampoline, F: Fn(&P) + 'static>( 114 | this: *mut ffi::WebKitNotification, 115 | f: glib::ffi::gpointer, 116 | ) { 117 | let f: &F = &*(f as *const F); 118 | f(Notification::from_glib_borrow(this).unsafe_cast_ref()) 119 | } 120 | unsafe { 121 | let f: Box_ = Box_::new(f); 122 | connect_raw( 123 | self.as_ptr() as *mut _, 124 | b"closed\0".as_ptr() as *const _, 125 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 126 | closed_trampoline:: as *const (), 127 | )), 128 | Box_::into_raw(f), 129 | ) 130 | } 131 | } 132 | 133 | #[cfg(feature = "v2_8")] 134 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 135 | #[doc(alias = "body")] 136 | fn connect_body_notify(&self, f: F) -> SignalHandlerId { 137 | unsafe extern "C" fn notify_body_trampoline, F: Fn(&P) + 'static>( 138 | this: *mut ffi::WebKitNotification, 139 | _param_spec: glib::ffi::gpointer, 140 | f: glib::ffi::gpointer, 141 | ) { 142 | let f: &F = &*(f as *const F); 143 | f(Notification::from_glib_borrow(this).unsafe_cast_ref()) 144 | } 145 | unsafe { 146 | let f: Box_ = Box_::new(f); 147 | connect_raw( 148 | self.as_ptr() as *mut _, 149 | b"notify::body\0".as_ptr() as *const _, 150 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 151 | notify_body_trampoline:: as *const (), 152 | )), 153 | Box_::into_raw(f), 154 | ) 155 | } 156 | } 157 | 158 | #[cfg(feature = "v2_8")] 159 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 160 | #[doc(alias = "id")] 161 | fn connect_id_notify(&self, f: F) -> SignalHandlerId { 162 | unsafe extern "C" fn notify_id_trampoline, F: Fn(&P) + 'static>( 163 | this: *mut ffi::WebKitNotification, 164 | _param_spec: glib::ffi::gpointer, 165 | f: glib::ffi::gpointer, 166 | ) { 167 | let f: &F = &*(f as *const F); 168 | f(Notification::from_glib_borrow(this).unsafe_cast_ref()) 169 | } 170 | unsafe { 171 | let f: Box_ = Box_::new(f); 172 | connect_raw( 173 | self.as_ptr() as *mut _, 174 | b"notify::id\0".as_ptr() as *const _, 175 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 176 | notify_id_trampoline:: as *const (), 177 | )), 178 | Box_::into_raw(f), 179 | ) 180 | } 181 | } 182 | 183 | #[cfg(feature = "v2_16")] 184 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 185 | #[doc(alias = "tag")] 186 | fn connect_tag_notify(&self, f: F) -> SignalHandlerId { 187 | unsafe extern "C" fn notify_tag_trampoline, F: Fn(&P) + 'static>( 188 | this: *mut ffi::WebKitNotification, 189 | _param_spec: glib::ffi::gpointer, 190 | f: glib::ffi::gpointer, 191 | ) { 192 | let f: &F = &*(f as *const F); 193 | f(Notification::from_glib_borrow(this).unsafe_cast_ref()) 194 | } 195 | unsafe { 196 | let f: Box_ = Box_::new(f); 197 | connect_raw( 198 | self.as_ptr() as *mut _, 199 | b"notify::tag\0".as_ptr() as *const _, 200 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 201 | notify_tag_trampoline:: as *const (), 202 | )), 203 | Box_::into_raw(f), 204 | ) 205 | } 206 | } 207 | 208 | #[cfg(feature = "v2_8")] 209 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 210 | #[doc(alias = "title")] 211 | fn connect_title_notify(&self, f: F) -> SignalHandlerId { 212 | unsafe extern "C" fn notify_title_trampoline, F: Fn(&P) + 'static>( 213 | this: *mut ffi::WebKitNotification, 214 | _param_spec: glib::ffi::gpointer, 215 | f: glib::ffi::gpointer, 216 | ) { 217 | let f: &F = &*(f as *const F); 218 | f(Notification::from_glib_borrow(this).unsafe_cast_ref()) 219 | } 220 | unsafe { 221 | let f: Box_ = Box_::new(f); 222 | connect_raw( 223 | self.as_ptr() as *mut _, 224 | b"notify::title\0".as_ptr() as *const _, 225 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 226 | notify_title_trampoline:: as *const (), 227 | )), 228 | Box_::into_raw(f), 229 | ) 230 | } 231 | } 232 | } 233 | 234 | impl> NotificationExt for O {} 235 | -------------------------------------------------------------------------------- /src/auto/notification_permission_request.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::PermissionRequest; 6 | 7 | glib::wrapper! { 8 | #[doc(alias = "WebKitNotificationPermissionRequest")] 9 | pub struct NotificationPermissionRequest(Object) @implements PermissionRequest; 10 | 11 | match fn { 12 | type_ => || ffi::webkit_notification_permission_request_get_type(), 13 | } 14 | } 15 | 16 | impl NotificationPermissionRequest { 17 | pub const NONE: Option<&'static NotificationPermissionRequest> = None; 18 | } 19 | -------------------------------------------------------------------------------- /src/auto/option_menu.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::OptionMenuItem; 6 | use glib::{ 7 | prelude::*, 8 | signal::{connect_raw, SignalHandlerId}, 9 | translate::*, 10 | }; 11 | use std::boxed::Box as Box_; 12 | 13 | glib::wrapper! { 14 | #[doc(alias = "WebKitOptionMenu")] 15 | pub struct OptionMenu(Object); 16 | 17 | match fn { 18 | type_ => || ffi::webkit_option_menu_get_type(), 19 | } 20 | } 21 | 22 | impl OptionMenu { 23 | pub const NONE: Option<&'static OptionMenu> = None; 24 | } 25 | 26 | mod sealed { 27 | pub trait Sealed {} 28 | impl> Sealed for T {} 29 | } 30 | 31 | pub trait OptionMenuExt: IsA + sealed::Sealed + 'static { 32 | #[doc(alias = "webkit_option_menu_activate_item")] 33 | fn activate_item(&self, index: u32) { 34 | unsafe { 35 | ffi::webkit_option_menu_activate_item(self.as_ref().to_glib_none().0, index); 36 | } 37 | } 38 | 39 | #[doc(alias = "webkit_option_menu_close")] 40 | fn close(&self) { 41 | unsafe { 42 | ffi::webkit_option_menu_close(self.as_ref().to_glib_none().0); 43 | } 44 | } 45 | 46 | #[cfg(feature = "v2_40")] 47 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_40")))] 48 | #[doc(alias = "webkit_option_menu_get_event")] 49 | #[doc(alias = "get_event")] 50 | fn event(&self) -> Option { 51 | unsafe { 52 | from_glib_none(ffi::webkit_option_menu_get_event( 53 | self.as_ref().to_glib_none().0, 54 | )) 55 | } 56 | } 57 | 58 | #[doc(alias = "webkit_option_menu_get_item")] 59 | #[doc(alias = "get_item")] 60 | fn item(&self, index: u32) -> Option { 61 | unsafe { 62 | from_glib_none(ffi::webkit_option_menu_get_item( 63 | self.as_ref().to_glib_none().0, 64 | index, 65 | )) 66 | } 67 | } 68 | 69 | #[doc(alias = "webkit_option_menu_get_n_items")] 70 | #[doc(alias = "get_n_items")] 71 | fn n_items(&self) -> u32 { 72 | unsafe { ffi::webkit_option_menu_get_n_items(self.as_ref().to_glib_none().0) } 73 | } 74 | 75 | #[doc(alias = "webkit_option_menu_select_item")] 76 | fn select_item(&self, index: u32) { 77 | unsafe { 78 | ffi::webkit_option_menu_select_item(self.as_ref().to_glib_none().0, index); 79 | } 80 | } 81 | 82 | #[cfg(feature = "v2_18")] 83 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_18")))] 84 | #[doc(alias = "close")] 85 | fn connect_close(&self, f: F) -> SignalHandlerId { 86 | unsafe extern "C" fn close_trampoline, F: Fn(&P) + 'static>( 87 | this: *mut ffi::WebKitOptionMenu, 88 | f: glib::ffi::gpointer, 89 | ) { 90 | let f: &F = &*(f as *const F); 91 | f(OptionMenu::from_glib_borrow(this).unsafe_cast_ref()) 92 | } 93 | unsafe { 94 | let f: Box_ = Box_::new(f); 95 | connect_raw( 96 | self.as_ptr() as *mut _, 97 | b"close\0".as_ptr() as *const _, 98 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 99 | close_trampoline:: as *const (), 100 | )), 101 | Box_::into_raw(f), 102 | ) 103 | } 104 | } 105 | } 106 | 107 | impl> OptionMenuExt for O {} 108 | -------------------------------------------------------------------------------- /src/auto/option_menu_item.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::translate::*; 6 | 7 | glib::wrapper! { 8 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 9 | pub struct OptionMenuItem(Boxed); 10 | 11 | match fn { 12 | copy => |ptr| ffi::webkit_option_menu_item_copy(mut_override(ptr)), 13 | free => |ptr| ffi::webkit_option_menu_item_free(ptr), 14 | type_ => || ffi::webkit_option_menu_item_get_type(), 15 | } 16 | } 17 | 18 | impl OptionMenuItem { 19 | #[doc(alias = "webkit_option_menu_item_get_label")] 20 | #[doc(alias = "get_label")] 21 | pub fn label(&mut self) -> Option { 22 | unsafe { 23 | from_glib_none(ffi::webkit_option_menu_item_get_label( 24 | self.to_glib_none_mut().0, 25 | )) 26 | } 27 | } 28 | 29 | #[doc(alias = "webkit_option_menu_item_get_tooltip")] 30 | #[doc(alias = "get_tooltip")] 31 | pub fn tooltip(&mut self) -> Option { 32 | unsafe { 33 | from_glib_none(ffi::webkit_option_menu_item_get_tooltip( 34 | self.to_glib_none_mut().0, 35 | )) 36 | } 37 | } 38 | 39 | #[doc(alias = "webkit_option_menu_item_is_enabled")] 40 | pub fn is_enabled(&mut self) -> bool { 41 | unsafe { 42 | from_glib(ffi::webkit_option_menu_item_is_enabled( 43 | self.to_glib_none_mut().0, 44 | )) 45 | } 46 | } 47 | 48 | #[doc(alias = "webkit_option_menu_item_is_group_child")] 49 | pub fn is_group_child(&mut self) -> bool { 50 | unsafe { 51 | from_glib(ffi::webkit_option_menu_item_is_group_child( 52 | self.to_glib_none_mut().0, 53 | )) 54 | } 55 | } 56 | 57 | #[doc(alias = "webkit_option_menu_item_is_group_label")] 58 | pub fn is_group_label(&mut self) -> bool { 59 | unsafe { 60 | from_glib(ffi::webkit_option_menu_item_is_group_label( 61 | self.to_glib_none_mut().0, 62 | )) 63 | } 64 | } 65 | 66 | #[doc(alias = "webkit_option_menu_item_is_selected")] 67 | pub fn is_selected(&mut self) -> bool { 68 | unsafe { 69 | from_glib(ffi::webkit_option_menu_item_is_selected( 70 | self.to_glib_none_mut().0, 71 | )) 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/auto/permission_request.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::{prelude::*, translate::*}; 6 | 7 | glib::wrapper! { 8 | #[doc(alias = "WebKitPermissionRequest")] 9 | pub struct PermissionRequest(Interface); 10 | 11 | match fn { 12 | type_ => || ffi::webkit_permission_request_get_type(), 13 | } 14 | } 15 | 16 | impl PermissionRequest { 17 | pub const NONE: Option<&'static PermissionRequest> = None; 18 | } 19 | 20 | mod sealed { 21 | pub trait Sealed {} 22 | impl> Sealed for T {} 23 | } 24 | 25 | pub trait PermissionRequestExt: IsA + sealed::Sealed + 'static { 26 | #[doc(alias = "webkit_permission_request_allow")] 27 | fn allow(&self) { 28 | unsafe { 29 | ffi::webkit_permission_request_allow(self.as_ref().to_glib_none().0); 30 | } 31 | } 32 | 33 | #[doc(alias = "webkit_permission_request_deny")] 34 | fn deny(&self) { 35 | unsafe { 36 | ffi::webkit_permission_request_deny(self.as_ref().to_glib_none().0); 37 | } 38 | } 39 | } 40 | 41 | impl> PermissionRequestExt for O {} 42 | -------------------------------------------------------------------------------- /src/auto/plugin.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | #![allow(deprecated)] 5 | 6 | use crate::MimeInfo; 7 | use glib::{prelude::*, translate::*}; 8 | 9 | glib::wrapper! { 10 | #[doc(alias = "WebKitPlugin")] 11 | pub struct Plugin(Object); 12 | 13 | match fn { 14 | type_ => || ffi::webkit_plugin_get_type(), 15 | } 16 | } 17 | 18 | impl Plugin { 19 | pub const NONE: Option<&'static Plugin> = None; 20 | } 21 | 22 | mod sealed { 23 | pub trait Sealed {} 24 | impl> Sealed for T {} 25 | } 26 | 27 | pub trait PluginExt: IsA + sealed::Sealed + 'static { 28 | #[cfg_attr(feature = "v2_32", deprecated = "Since 2.32")] 29 | #[allow(deprecated)] 30 | #[doc(alias = "webkit_plugin_get_description")] 31 | #[doc(alias = "get_description")] 32 | fn description(&self) -> Option { 33 | unsafe { 34 | from_glib_none(ffi::webkit_plugin_get_description( 35 | self.as_ref().to_glib_none().0, 36 | )) 37 | } 38 | } 39 | 40 | #[cfg_attr(feature = "v2_32", deprecated = "Since 2.32")] 41 | #[allow(deprecated)] 42 | #[doc(alias = "webkit_plugin_get_mime_info_list")] 43 | #[doc(alias = "get_mime_info_list")] 44 | fn mime_info_list(&self) -> Vec { 45 | unsafe { 46 | FromGlibPtrContainer::from_glib_none(ffi::webkit_plugin_get_mime_info_list( 47 | self.as_ref().to_glib_none().0, 48 | )) 49 | } 50 | } 51 | 52 | #[cfg_attr(feature = "v2_32", deprecated = "Since 2.32")] 53 | #[allow(deprecated)] 54 | #[doc(alias = "webkit_plugin_get_name")] 55 | #[doc(alias = "get_name")] 56 | fn name(&self) -> Option { 57 | unsafe { from_glib_none(ffi::webkit_plugin_get_name(self.as_ref().to_glib_none().0)) } 58 | } 59 | 60 | #[cfg_attr(feature = "v2_32", deprecated = "Since 2.32")] 61 | #[allow(deprecated)] 62 | #[doc(alias = "webkit_plugin_get_path")] 63 | #[doc(alias = "get_path")] 64 | fn path(&self) -> Option { 65 | unsafe { from_glib_none(ffi::webkit_plugin_get_path(self.as_ref().to_glib_none().0)) } 66 | } 67 | } 68 | 69 | impl> PluginExt for O {} 70 | -------------------------------------------------------------------------------- /src/auto/pointer_lock_permission_request.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::PermissionRequest; 6 | 7 | glib::wrapper! { 8 | #[doc(alias = "WebKitPointerLockPermissionRequest")] 9 | pub struct PointerLockPermissionRequest(Object) @implements PermissionRequest; 10 | 11 | match fn { 12 | type_ => || ffi::webkit_pointer_lock_permission_request_get_type(), 13 | } 14 | } 15 | 16 | impl PointerLockPermissionRequest { 17 | pub const NONE: Option<&'static PointerLockPermissionRequest> = None; 18 | } 19 | -------------------------------------------------------------------------------- /src/auto/policy_decision.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | #[cfg(feature = "v2_30")] 6 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_30")))] 7 | use crate::WebsitePolicies; 8 | use glib::{prelude::*, translate::*}; 9 | 10 | glib::wrapper! { 11 | #[doc(alias = "WebKitPolicyDecision")] 12 | pub struct PolicyDecision(Object); 13 | 14 | match fn { 15 | type_ => || ffi::webkit_policy_decision_get_type(), 16 | } 17 | } 18 | 19 | impl PolicyDecision { 20 | pub const NONE: Option<&'static PolicyDecision> = None; 21 | } 22 | 23 | mod sealed { 24 | pub trait Sealed {} 25 | impl> Sealed for T {} 26 | } 27 | 28 | pub trait PolicyDecisionExt: IsA + sealed::Sealed + 'static { 29 | #[doc(alias = "webkit_policy_decision_download")] 30 | fn download(&self) { 31 | unsafe { 32 | ffi::webkit_policy_decision_download(self.as_ref().to_glib_none().0); 33 | } 34 | } 35 | 36 | #[doc(alias = "webkit_policy_decision_ignore")] 37 | fn ignore(&self) { 38 | unsafe { 39 | ffi::webkit_policy_decision_ignore(self.as_ref().to_glib_none().0); 40 | } 41 | } 42 | 43 | #[doc(alias = "webkit_policy_decision_use")] 44 | #[doc(alias = "use")] 45 | fn use_(&self) { 46 | unsafe { 47 | ffi::webkit_policy_decision_use(self.as_ref().to_glib_none().0); 48 | } 49 | } 50 | 51 | #[cfg(feature = "v2_30")] 52 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_30")))] 53 | #[doc(alias = "webkit_policy_decision_use_with_policies")] 54 | fn use_with_policies(&self, policies: &impl IsA) { 55 | unsafe { 56 | ffi::webkit_policy_decision_use_with_policies( 57 | self.as_ref().to_glib_none().0, 58 | policies.as_ref().to_glib_none().0, 59 | ); 60 | } 61 | } 62 | } 63 | 64 | impl> PolicyDecisionExt for O {} 65 | -------------------------------------------------------------------------------- /src/auto/print_custom_widget.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | #![allow(deprecated)] 5 | 6 | use glib::{ 7 | prelude::*, 8 | signal::{connect_raw, SignalHandlerId}, 9 | translate::*, 10 | }; 11 | use std::boxed::Box as Box_; 12 | 13 | glib::wrapper! { 14 | #[doc(alias = "WebKitPrintCustomWidget")] 15 | pub struct PrintCustomWidget(Object); 16 | 17 | match fn { 18 | type_ => || ffi::webkit_print_custom_widget_get_type(), 19 | } 20 | } 21 | 22 | impl PrintCustomWidget { 23 | pub const NONE: Option<&'static PrintCustomWidget> = None; 24 | 25 | #[cfg_attr(feature = "v2_40", deprecated = "Since 2.40")] 26 | #[allow(deprecated)] 27 | #[doc(alias = "webkit_print_custom_widget_new")] 28 | pub fn new(widget: &impl IsA, title: &str) -> PrintCustomWidget { 29 | assert_initialized_main_thread!(); 30 | unsafe { 31 | from_glib_full(ffi::webkit_print_custom_widget_new( 32 | widget.as_ref().to_glib_none().0, 33 | title.to_glib_none().0, 34 | )) 35 | } 36 | } 37 | 38 | // rustdoc-stripper-ignore-next 39 | /// Creates a new builder-pattern struct instance to construct [`PrintCustomWidget`] objects. 40 | /// 41 | /// This method returns an instance of [`PrintCustomWidgetBuilder`](crate::builders::PrintCustomWidgetBuilder) which can be used to create [`PrintCustomWidget`] objects. 42 | pub fn builder() -> PrintCustomWidgetBuilder { 43 | PrintCustomWidgetBuilder::new() 44 | } 45 | } 46 | 47 | #[cfg(feature = "v2_16")] 48 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 49 | impl Default for PrintCustomWidget { 50 | fn default() -> Self { 51 | glib::object::Object::new::() 52 | } 53 | } 54 | 55 | // rustdoc-stripper-ignore-next 56 | /// A [builder-pattern] type to construct [`PrintCustomWidget`] objects. 57 | /// 58 | /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 59 | #[must_use = "The builder must be built to be used"] 60 | pub struct PrintCustomWidgetBuilder { 61 | builder: glib::object::ObjectBuilder<'static, PrintCustomWidget>, 62 | } 63 | 64 | impl PrintCustomWidgetBuilder { 65 | fn new() -> Self { 66 | Self { 67 | builder: glib::object::Object::builder(), 68 | } 69 | } 70 | 71 | #[cfg(feature = "v2_16")] 72 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 73 | #[cfg_attr(feature = "v2_40", deprecated = "Since 2.40")] 74 | pub fn title(self, title: impl Into) -> Self { 75 | Self { 76 | builder: self.builder.property("title", title.into()), 77 | } 78 | } 79 | 80 | #[cfg(feature = "v2_16")] 81 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 82 | #[cfg_attr(feature = "v2_40", deprecated = "Since 2.40")] 83 | pub fn widget(self, widget: &impl IsA) -> Self { 84 | Self { 85 | builder: self.builder.property("widget", widget.clone().upcast()), 86 | } 87 | } 88 | 89 | // rustdoc-stripper-ignore-next 90 | /// Build the [`PrintCustomWidget`]. 91 | #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] 92 | pub fn build(self) -> PrintCustomWidget { 93 | self.builder.build() 94 | } 95 | } 96 | 97 | mod sealed { 98 | pub trait Sealed {} 99 | impl> Sealed for T {} 100 | } 101 | 102 | pub trait PrintCustomWidgetExt: IsA + sealed::Sealed + 'static { 103 | #[cfg_attr(feature = "v2_40", deprecated = "Since 2.40")] 104 | #[allow(deprecated)] 105 | #[doc(alias = "webkit_print_custom_widget_get_title")] 106 | #[doc(alias = "get_title")] 107 | fn title(&self) -> Option { 108 | unsafe { 109 | from_glib_none(ffi::webkit_print_custom_widget_get_title( 110 | self.as_ref().to_glib_none().0, 111 | )) 112 | } 113 | } 114 | 115 | #[cfg_attr(feature = "v2_40", deprecated = "Since 2.40")] 116 | #[allow(deprecated)] 117 | #[doc(alias = "webkit_print_custom_widget_get_widget")] 118 | #[doc(alias = "get_widget")] 119 | fn widget(&self) -> Option { 120 | unsafe { 121 | from_glib_none(ffi::webkit_print_custom_widget_get_widget( 122 | self.as_ref().to_glib_none().0, 123 | )) 124 | } 125 | } 126 | 127 | #[cfg_attr(feature = "v2_40", deprecated = "Since 2.40")] 128 | #[cfg(feature = "v2_16")] 129 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 130 | #[doc(alias = "apply")] 131 | fn connect_apply(&self, f: F) -> SignalHandlerId { 132 | unsafe extern "C" fn apply_trampoline, F: Fn(&P) + 'static>( 133 | this: *mut ffi::WebKitPrintCustomWidget, 134 | f: glib::ffi::gpointer, 135 | ) { 136 | let f: &F = &*(f as *const F); 137 | f(PrintCustomWidget::from_glib_borrow(this).unsafe_cast_ref()) 138 | } 139 | unsafe { 140 | let f: Box_ = Box_::new(f); 141 | connect_raw( 142 | self.as_ptr() as *mut _, 143 | b"apply\0".as_ptr() as *const _, 144 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 145 | apply_trampoline:: as *const (), 146 | )), 147 | Box_::into_raw(f), 148 | ) 149 | } 150 | } 151 | 152 | #[cfg_attr(feature = "v2_40", deprecated = "Since 2.40")] 153 | #[cfg(feature = "v2_16")] 154 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 155 | #[doc(alias = "update")] 156 | fn connect_update( 157 | &self, 158 | f: F, 159 | ) -> SignalHandlerId { 160 | unsafe extern "C" fn update_trampoline< 161 | P: IsA, 162 | F: Fn(&P, >k::PageSetup, >k::PrintSettings) + 'static, 163 | >( 164 | this: *mut ffi::WebKitPrintCustomWidget, 165 | page_setup: *mut gtk::ffi::GtkPageSetup, 166 | print_settings: *mut gtk::ffi::GtkPrintSettings, 167 | f: glib::ffi::gpointer, 168 | ) { 169 | let f: &F = &*(f as *const F); 170 | f( 171 | PrintCustomWidget::from_glib_borrow(this).unsafe_cast_ref(), 172 | &from_glib_borrow(page_setup), 173 | &from_glib_borrow(print_settings), 174 | ) 175 | } 176 | unsafe { 177 | let f: Box_ = Box_::new(f); 178 | connect_raw( 179 | self.as_ptr() as *mut _, 180 | b"update\0".as_ptr() as *const _, 181 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 182 | update_trampoline:: as *const (), 183 | )), 184 | Box_::into_raw(f), 185 | ) 186 | } 187 | } 188 | } 189 | 190 | impl> PrintCustomWidgetExt for O {} 191 | -------------------------------------------------------------------------------- /src/auto/response_policy_decision.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::{PolicyDecision, URIRequest, URIResponse}; 6 | use glib::{ 7 | prelude::*, 8 | signal::{connect_raw, SignalHandlerId}, 9 | translate::*, 10 | }; 11 | use std::boxed::Box as Box_; 12 | 13 | glib::wrapper! { 14 | #[doc(alias = "WebKitResponsePolicyDecision")] 15 | pub struct ResponsePolicyDecision(Object) @extends PolicyDecision; 16 | 17 | match fn { 18 | type_ => || ffi::webkit_response_policy_decision_get_type(), 19 | } 20 | } 21 | 22 | impl ResponsePolicyDecision { 23 | pub const NONE: Option<&'static ResponsePolicyDecision> = None; 24 | } 25 | 26 | mod sealed { 27 | pub trait Sealed {} 28 | impl> Sealed for T {} 29 | } 30 | 31 | pub trait ResponsePolicyDecisionExt: 32 | IsA + sealed::Sealed + 'static 33 | { 34 | #[doc(alias = "webkit_response_policy_decision_get_request")] 35 | #[doc(alias = "get_request")] 36 | fn request(&self) -> Option { 37 | unsafe { 38 | from_glib_none(ffi::webkit_response_policy_decision_get_request( 39 | self.as_ref().to_glib_none().0, 40 | )) 41 | } 42 | } 43 | 44 | #[doc(alias = "webkit_response_policy_decision_get_response")] 45 | #[doc(alias = "get_response")] 46 | fn response(&self) -> Option { 47 | unsafe { 48 | from_glib_none(ffi::webkit_response_policy_decision_get_response( 49 | self.as_ref().to_glib_none().0, 50 | )) 51 | } 52 | } 53 | 54 | #[cfg(feature = "v2_40")] 55 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_40")))] 56 | #[doc(alias = "webkit_response_policy_decision_is_main_frame_main_resource")] 57 | fn is_main_frame_main_resource(&self) -> bool { 58 | unsafe { 59 | from_glib( 60 | ffi::webkit_response_policy_decision_is_main_frame_main_resource( 61 | self.as_ref().to_glib_none().0, 62 | ), 63 | ) 64 | } 65 | } 66 | 67 | #[cfg(feature = "v2_4")] 68 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_4")))] 69 | #[doc(alias = "webkit_response_policy_decision_is_mime_type_supported")] 70 | fn is_mime_type_supported(&self) -> bool { 71 | unsafe { 72 | from_glib(ffi::webkit_response_policy_decision_is_mime_type_supported( 73 | self.as_ref().to_glib_none().0, 74 | )) 75 | } 76 | } 77 | 78 | #[doc(alias = "request")] 79 | fn connect_request_notify(&self, f: F) -> SignalHandlerId { 80 | unsafe extern "C" fn notify_request_trampoline< 81 | P: IsA, 82 | F: Fn(&P) + 'static, 83 | >( 84 | this: *mut ffi::WebKitResponsePolicyDecision, 85 | _param_spec: glib::ffi::gpointer, 86 | f: glib::ffi::gpointer, 87 | ) { 88 | let f: &F = &*(f as *const F); 89 | f(ResponsePolicyDecision::from_glib_borrow(this).unsafe_cast_ref()) 90 | } 91 | unsafe { 92 | let f: Box_ = Box_::new(f); 93 | connect_raw( 94 | self.as_ptr() as *mut _, 95 | b"notify::request\0".as_ptr() as *const _, 96 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 97 | notify_request_trampoline:: as *const (), 98 | )), 99 | Box_::into_raw(f), 100 | ) 101 | } 102 | } 103 | 104 | #[doc(alias = "response")] 105 | fn connect_response_notify(&self, f: F) -> SignalHandlerId { 106 | unsafe extern "C" fn notify_response_trampoline< 107 | P: IsA, 108 | F: Fn(&P) + 'static, 109 | >( 110 | this: *mut ffi::WebKitResponsePolicyDecision, 111 | _param_spec: glib::ffi::gpointer, 112 | f: glib::ffi::gpointer, 113 | ) { 114 | let f: &F = &*(f as *const F); 115 | f(ResponsePolicyDecision::from_glib_borrow(this).unsafe_cast_ref()) 116 | } 117 | unsafe { 118 | let f: Box_ = Box_::new(f); 119 | connect_raw( 120 | self.as_ptr() as *mut _, 121 | b"notify::response\0".as_ptr() as *const _, 122 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 123 | notify_response_trampoline:: as *const (), 124 | )), 125 | Box_::into_raw(f), 126 | ) 127 | } 128 | } 129 | } 130 | 131 | impl> ResponsePolicyDecisionExt for O {} 132 | -------------------------------------------------------------------------------- /src/auto/script_dialog.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::ScriptDialogType; 6 | use glib::translate::*; 7 | 8 | glib::wrapper! { 9 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 10 | pub struct ScriptDialog(Shared); 11 | 12 | match fn { 13 | ref => |ptr| ffi::webkit_script_dialog_ref(ptr), 14 | unref => |ptr| ffi::webkit_script_dialog_unref(ptr), 15 | type_ => || ffi::webkit_script_dialog_get_type(), 16 | } 17 | } 18 | 19 | impl ScriptDialog { 20 | #[doc(alias = "webkit_script_dialog_close")] 21 | pub fn close(&self) { 22 | unsafe { 23 | ffi::webkit_script_dialog_close(self.to_glib_none().0); 24 | } 25 | } 26 | 27 | #[doc(alias = "webkit_script_dialog_confirm_set_confirmed")] 28 | pub fn confirm_set_confirmed(&self, confirmed: bool) { 29 | unsafe { 30 | ffi::webkit_script_dialog_confirm_set_confirmed(self.to_glib_none().0, confirmed.into_glib()); 31 | } 32 | } 33 | 34 | #[doc(alias = "webkit_script_dialog_get_dialog_type")] 35 | #[doc(alias = "get_dialog_type")] 36 | pub fn dialog_type(&self) -> ScriptDialogType { 37 | unsafe { 38 | from_glib(ffi::webkit_script_dialog_get_dialog_type( 39 | self.to_glib_none().0, 40 | )) 41 | } 42 | } 43 | 44 | #[doc(alias = "webkit_script_dialog_get_message")] 45 | #[doc(alias = "get_message")] 46 | pub fn message(&self) -> Option { 47 | unsafe { from_glib_none(ffi::webkit_script_dialog_get_message(self.to_glib_none().0)) } 48 | } 49 | 50 | #[doc(alias = "webkit_script_dialog_prompt_get_default_text")] 51 | pub fn prompt_get_default_text(&self) -> Option { 52 | unsafe { 53 | from_glib_none(ffi::webkit_script_dialog_prompt_get_default_text( 54 | self.to_glib_none().0, 55 | )) 56 | } 57 | } 58 | 59 | #[doc(alias = "webkit_script_dialog_prompt_set_text")] 60 | pub fn prompt_set_text(&self, text: &str) { 61 | unsafe { 62 | ffi::webkit_script_dialog_prompt_set_text(self.to_glib_none().0, text.to_glib_none().0); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/auto/security_manager.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::{prelude::*, translate::*}; 6 | 7 | glib::wrapper! { 8 | #[doc(alias = "WebKitSecurityManager")] 9 | pub struct SecurityManager(Object); 10 | 11 | match fn { 12 | type_ => || ffi::webkit_security_manager_get_type(), 13 | } 14 | } 15 | 16 | impl SecurityManager { 17 | pub const NONE: Option<&'static SecurityManager> = None; 18 | } 19 | 20 | mod sealed { 21 | pub trait Sealed {} 22 | impl> Sealed for T {} 23 | } 24 | 25 | pub trait SecurityManagerExt: IsA + sealed::Sealed + 'static { 26 | #[doc(alias = "webkit_security_manager_register_uri_scheme_as_cors_enabled")] 27 | fn register_uri_scheme_as_cors_enabled(&self, scheme: &str) { 28 | unsafe { 29 | ffi::webkit_security_manager_register_uri_scheme_as_cors_enabled( 30 | self.as_ref().to_glib_none().0, 31 | scheme.to_glib_none().0, 32 | ); 33 | } 34 | } 35 | 36 | #[doc(alias = "webkit_security_manager_register_uri_scheme_as_display_isolated")] 37 | fn register_uri_scheme_as_display_isolated(&self, scheme: &str) { 38 | unsafe { 39 | ffi::webkit_security_manager_register_uri_scheme_as_display_isolated( 40 | self.as_ref().to_glib_none().0, 41 | scheme.to_glib_none().0, 42 | ); 43 | } 44 | } 45 | 46 | #[doc(alias = "webkit_security_manager_register_uri_scheme_as_empty_document")] 47 | fn register_uri_scheme_as_empty_document(&self, scheme: &str) { 48 | unsafe { 49 | ffi::webkit_security_manager_register_uri_scheme_as_empty_document( 50 | self.as_ref().to_glib_none().0, 51 | scheme.to_glib_none().0, 52 | ); 53 | } 54 | } 55 | 56 | #[doc(alias = "webkit_security_manager_register_uri_scheme_as_local")] 57 | fn register_uri_scheme_as_local(&self, scheme: &str) { 58 | unsafe { 59 | ffi::webkit_security_manager_register_uri_scheme_as_local( 60 | self.as_ref().to_glib_none().0, 61 | scheme.to_glib_none().0, 62 | ); 63 | } 64 | } 65 | 66 | #[doc(alias = "webkit_security_manager_register_uri_scheme_as_no_access")] 67 | fn register_uri_scheme_as_no_access(&self, scheme: &str) { 68 | unsafe { 69 | ffi::webkit_security_manager_register_uri_scheme_as_no_access( 70 | self.as_ref().to_glib_none().0, 71 | scheme.to_glib_none().0, 72 | ); 73 | } 74 | } 75 | 76 | #[doc(alias = "webkit_security_manager_register_uri_scheme_as_secure")] 77 | fn register_uri_scheme_as_secure(&self, scheme: &str) { 78 | unsafe { 79 | ffi::webkit_security_manager_register_uri_scheme_as_secure( 80 | self.as_ref().to_glib_none().0, 81 | scheme.to_glib_none().0, 82 | ); 83 | } 84 | } 85 | 86 | #[doc(alias = "webkit_security_manager_uri_scheme_is_cors_enabled")] 87 | fn uri_scheme_is_cors_enabled(&self, scheme: &str) -> bool { 88 | unsafe { 89 | from_glib(ffi::webkit_security_manager_uri_scheme_is_cors_enabled( 90 | self.as_ref().to_glib_none().0, 91 | scheme.to_glib_none().0, 92 | )) 93 | } 94 | } 95 | 96 | #[doc(alias = "webkit_security_manager_uri_scheme_is_display_isolated")] 97 | fn uri_scheme_is_display_isolated(&self, scheme: &str) -> bool { 98 | unsafe { 99 | from_glib(ffi::webkit_security_manager_uri_scheme_is_display_isolated( 100 | self.as_ref().to_glib_none().0, 101 | scheme.to_glib_none().0, 102 | )) 103 | } 104 | } 105 | 106 | #[doc(alias = "webkit_security_manager_uri_scheme_is_empty_document")] 107 | fn uri_scheme_is_empty_document(&self, scheme: &str) -> bool { 108 | unsafe { 109 | from_glib(ffi::webkit_security_manager_uri_scheme_is_empty_document( 110 | self.as_ref().to_glib_none().0, 111 | scheme.to_glib_none().0, 112 | )) 113 | } 114 | } 115 | 116 | #[doc(alias = "webkit_security_manager_uri_scheme_is_local")] 117 | fn uri_scheme_is_local(&self, scheme: &str) -> bool { 118 | unsafe { 119 | from_glib(ffi::webkit_security_manager_uri_scheme_is_local( 120 | self.as_ref().to_glib_none().0, 121 | scheme.to_glib_none().0, 122 | )) 123 | } 124 | } 125 | 126 | #[doc(alias = "webkit_security_manager_uri_scheme_is_no_access")] 127 | fn uri_scheme_is_no_access(&self, scheme: &str) -> bool { 128 | unsafe { 129 | from_glib(ffi::webkit_security_manager_uri_scheme_is_no_access( 130 | self.as_ref().to_glib_none().0, 131 | scheme.to_glib_none().0, 132 | )) 133 | } 134 | } 135 | 136 | #[doc(alias = "webkit_security_manager_uri_scheme_is_secure")] 137 | fn uri_scheme_is_secure(&self, scheme: &str) -> bool { 138 | unsafe { 139 | from_glib(ffi::webkit_security_manager_uri_scheme_is_secure( 140 | self.as_ref().to_glib_none().0, 141 | scheme.to_glib_none().0, 142 | )) 143 | } 144 | } 145 | } 146 | 147 | impl> SecurityManagerExt for O {} 148 | -------------------------------------------------------------------------------- /src/auto/security_origin.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::translate::*; 6 | 7 | glib::wrapper! { 8 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 9 | pub struct SecurityOrigin(Shared); 10 | 11 | match fn { 12 | ref => |ptr| ffi::webkit_security_origin_ref(ptr), 13 | unref => |ptr| ffi::webkit_security_origin_unref(ptr), 14 | type_ => || ffi::webkit_security_origin_get_type(), 15 | } 16 | } 17 | 18 | impl SecurityOrigin { 19 | #[doc(alias = "webkit_security_origin_new")] 20 | pub fn new(protocol: &str, host: &str, port: u16) -> SecurityOrigin { 21 | assert_initialized_main_thread!(); 22 | unsafe { 23 | from_glib_full(ffi::webkit_security_origin_new( 24 | protocol.to_glib_none().0, 25 | host.to_glib_none().0, 26 | port, 27 | )) 28 | } 29 | } 30 | 31 | #[doc(alias = "webkit_security_origin_new_for_uri")] 32 | #[doc(alias = "new_for_uri")] 33 | pub fn for_uri(uri: &str) -> SecurityOrigin { 34 | assert_initialized_main_thread!(); 35 | unsafe { 36 | from_glib_full(ffi::webkit_security_origin_new_for_uri( 37 | uri.to_glib_none().0, 38 | )) 39 | } 40 | } 41 | 42 | #[doc(alias = "webkit_security_origin_get_host")] 43 | #[doc(alias = "get_host")] 44 | pub fn host(&self) -> Option { 45 | unsafe { from_glib_none(ffi::webkit_security_origin_get_host(self.to_glib_none().0)) } 46 | } 47 | 48 | #[doc(alias = "webkit_security_origin_get_port")] 49 | #[doc(alias = "get_port")] 50 | pub fn port(&self) -> u16 { 51 | unsafe { ffi::webkit_security_origin_get_port(self.to_glib_none().0) } 52 | } 53 | 54 | #[doc(alias = "webkit_security_origin_get_protocol")] 55 | #[doc(alias = "get_protocol")] 56 | pub fn protocol(&self) -> Option { 57 | unsafe { 58 | from_glib_none(ffi::webkit_security_origin_get_protocol( 59 | self.to_glib_none().0, 60 | )) 61 | } 62 | } 63 | 64 | #[cfg_attr(feature = "v2_32", deprecated = "Since 2.32")] 65 | #[allow(deprecated)] 66 | #[doc(alias = "webkit_security_origin_is_opaque")] 67 | pub fn is_opaque(&self) -> bool { 68 | unsafe { from_glib(ffi::webkit_security_origin_is_opaque(self.to_glib_none().0)) } 69 | } 70 | 71 | #[doc(alias = "webkit_security_origin_to_string")] 72 | #[doc(alias = "to_string")] 73 | pub fn to_str(&self) -> glib::GString { 74 | unsafe { from_glib_full(ffi::webkit_security_origin_to_string(self.to_glib_none().0)) } 75 | } 76 | } 77 | 78 | impl std::fmt::Display for SecurityOrigin { 79 | #[inline] 80 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 81 | f.write_str(&self.to_str()) 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/auto/uri_request.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::{ 6 | prelude::*, 7 | signal::{connect_raw, SignalHandlerId}, 8 | translate::*, 9 | }; 10 | use std::boxed::Box as Box_; 11 | 12 | glib::wrapper! { 13 | #[doc(alias = "WebKitURIRequest")] 14 | pub struct URIRequest(Object); 15 | 16 | match fn { 17 | type_ => || ffi::webkit_uri_request_get_type(), 18 | } 19 | } 20 | 21 | impl URIRequest { 22 | pub const NONE: Option<&'static URIRequest> = None; 23 | 24 | #[doc(alias = "webkit_uri_request_new")] 25 | pub fn new(uri: &str) -> URIRequest { 26 | assert_initialized_main_thread!(); 27 | unsafe { from_glib_full(ffi::webkit_uri_request_new(uri.to_glib_none().0)) } 28 | } 29 | 30 | // rustdoc-stripper-ignore-next 31 | /// Creates a new builder-pattern struct instance to construct [`URIRequest`] objects. 32 | /// 33 | /// This method returns an instance of [`URIRequestBuilder`](crate::builders::URIRequestBuilder) which can be used to create [`URIRequest`] objects. 34 | pub fn builder() -> URIRequestBuilder { 35 | URIRequestBuilder::new() 36 | } 37 | } 38 | 39 | impl Default for URIRequest { 40 | fn default() -> Self { 41 | glib::object::Object::new::() 42 | } 43 | } 44 | 45 | // rustdoc-stripper-ignore-next 46 | /// A [builder-pattern] type to construct [`URIRequest`] objects. 47 | /// 48 | /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 49 | #[must_use = "The builder must be built to be used"] 50 | pub struct URIRequestBuilder { 51 | builder: glib::object::ObjectBuilder<'static, URIRequest>, 52 | } 53 | 54 | impl URIRequestBuilder { 55 | fn new() -> Self { 56 | Self { 57 | builder: glib::object::Object::builder(), 58 | } 59 | } 60 | 61 | pub fn uri(self, uri: impl Into) -> Self { 62 | Self { 63 | builder: self.builder.property("uri", uri.into()), 64 | } 65 | } 66 | 67 | // rustdoc-stripper-ignore-next 68 | /// Build the [`URIRequest`]. 69 | #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] 70 | pub fn build(self) -> URIRequest { 71 | self.builder.build() 72 | } 73 | } 74 | 75 | mod sealed { 76 | pub trait Sealed {} 77 | impl> Sealed for T {} 78 | } 79 | 80 | pub trait URIRequestExt: IsA + sealed::Sealed + 'static { 81 | #[doc(alias = "webkit_uri_request_get_http_headers")] 82 | #[doc(alias = "get_http_headers")] 83 | fn http_headers(&self) -> Option { 84 | unsafe { 85 | from_glib_none(ffi::webkit_uri_request_get_http_headers( 86 | self.as_ref().to_glib_none().0, 87 | )) 88 | } 89 | } 90 | 91 | #[cfg(feature = "v2_12")] 92 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_12")))] 93 | #[doc(alias = "webkit_uri_request_get_http_method")] 94 | #[doc(alias = "get_http_method")] 95 | fn http_method(&self) -> Option { 96 | unsafe { 97 | from_glib_none(ffi::webkit_uri_request_get_http_method( 98 | self.as_ref().to_glib_none().0, 99 | )) 100 | } 101 | } 102 | 103 | #[doc(alias = "webkit_uri_request_get_uri")] 104 | #[doc(alias = "get_uri")] 105 | fn uri(&self) -> Option { 106 | unsafe { 107 | from_glib_none(ffi::webkit_uri_request_get_uri( 108 | self.as_ref().to_glib_none().0, 109 | )) 110 | } 111 | } 112 | 113 | #[doc(alias = "webkit_uri_request_set_uri")] 114 | fn set_uri(&self, uri: &str) { 115 | unsafe { 116 | ffi::webkit_uri_request_set_uri(self.as_ref().to_glib_none().0, uri.to_glib_none().0); 117 | } 118 | } 119 | 120 | #[doc(alias = "uri")] 121 | fn connect_uri_notify(&self, f: F) -> SignalHandlerId { 122 | unsafe extern "C" fn notify_uri_trampoline, F: Fn(&P) + 'static>( 123 | this: *mut ffi::WebKitURIRequest, 124 | _param_spec: glib::ffi::gpointer, 125 | f: glib::ffi::gpointer, 126 | ) { 127 | let f: &F = &*(f as *const F); 128 | f(URIRequest::from_glib_borrow(this).unsafe_cast_ref()) 129 | } 130 | unsafe { 131 | let f: Box_ = Box_::new(f); 132 | connect_raw( 133 | self.as_ptr() as *mut _, 134 | b"notify::uri\0".as_ptr() as *const _, 135 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 136 | notify_uri_trampoline:: as *const (), 137 | )), 138 | Box_::into_raw(f), 139 | ) 140 | } 141 | } 142 | } 143 | 144 | impl> URIRequestExt for O {} 145 | -------------------------------------------------------------------------------- /src/auto/uri_scheme_request.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | #[cfg(feature = "v2_36")] 6 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_36")))] 7 | use crate::URISchemeResponse; 8 | use crate::WebView; 9 | use glib::{prelude::*, translate::*}; 10 | 11 | glib::wrapper! { 12 | #[doc(alias = "WebKitURISchemeRequest")] 13 | pub struct URISchemeRequest(Object); 14 | 15 | match fn { 16 | type_ => || ffi::webkit_uri_scheme_request_get_type(), 17 | } 18 | } 19 | 20 | impl URISchemeRequest { 21 | pub const NONE: Option<&'static URISchemeRequest> = None; 22 | } 23 | 24 | mod sealed { 25 | pub trait Sealed {} 26 | impl> Sealed for T {} 27 | } 28 | 29 | pub trait URISchemeRequestExt: IsA + sealed::Sealed + 'static { 30 | #[doc(alias = "webkit_uri_scheme_request_finish")] 31 | fn finish( 32 | &self, 33 | stream: &impl IsA, 34 | stream_length: i64, 35 | content_type: Option<&str>, 36 | ) { 37 | unsafe { 38 | ffi::webkit_uri_scheme_request_finish( 39 | self.as_ref().to_glib_none().0, 40 | stream.as_ref().to_glib_none().0, 41 | stream_length, 42 | content_type.to_glib_none().0, 43 | ); 44 | } 45 | } 46 | 47 | #[cfg(feature = "v2_2")] 48 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_2")))] 49 | #[doc(alias = "webkit_uri_scheme_request_finish_error")] 50 | fn finish_error(&self, error: &mut glib::Error) { 51 | unsafe { 52 | ffi::webkit_uri_scheme_request_finish_error( 53 | self.as_ref().to_glib_none().0, 54 | error.to_glib_none_mut().0, 55 | ); 56 | } 57 | } 58 | 59 | #[cfg(feature = "v2_36")] 60 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_36")))] 61 | #[doc(alias = "webkit_uri_scheme_request_finish_with_response")] 62 | fn finish_with_response(&self, response: &impl IsA) { 63 | unsafe { 64 | ffi::webkit_uri_scheme_request_finish_with_response( 65 | self.as_ref().to_glib_none().0, 66 | response.as_ref().to_glib_none().0, 67 | ); 68 | } 69 | } 70 | 71 | #[cfg(feature = "v2_40")] 72 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_40")))] 73 | #[doc(alias = "webkit_uri_scheme_request_get_http_body")] 74 | #[doc(alias = "get_http_body")] 75 | fn http_body(&self) -> Option { 76 | unsafe { 77 | from_glib_full(ffi::webkit_uri_scheme_request_get_http_body( 78 | self.as_ref().to_glib_none().0, 79 | )) 80 | } 81 | } 82 | 83 | #[cfg(feature = "v2_36")] 84 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_36")))] 85 | #[doc(alias = "webkit_uri_scheme_request_get_http_headers")] 86 | #[doc(alias = "get_http_headers")] 87 | fn http_headers(&self) -> Option { 88 | unsafe { 89 | from_glib_none(ffi::webkit_uri_scheme_request_get_http_headers( 90 | self.as_ref().to_glib_none().0, 91 | )) 92 | } 93 | } 94 | 95 | #[cfg(feature = "v2_36")] 96 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_36")))] 97 | #[doc(alias = "webkit_uri_scheme_request_get_http_method")] 98 | #[doc(alias = "get_http_method")] 99 | fn http_method(&self) -> Option { 100 | unsafe { 101 | from_glib_none(ffi::webkit_uri_scheme_request_get_http_method( 102 | self.as_ref().to_glib_none().0, 103 | )) 104 | } 105 | } 106 | 107 | #[doc(alias = "webkit_uri_scheme_request_get_path")] 108 | #[doc(alias = "get_path")] 109 | fn path(&self) -> Option { 110 | unsafe { 111 | from_glib_none(ffi::webkit_uri_scheme_request_get_path( 112 | self.as_ref().to_glib_none().0, 113 | )) 114 | } 115 | } 116 | 117 | #[doc(alias = "webkit_uri_scheme_request_get_scheme")] 118 | #[doc(alias = "get_scheme")] 119 | fn scheme(&self) -> Option { 120 | unsafe { 121 | from_glib_none(ffi::webkit_uri_scheme_request_get_scheme( 122 | self.as_ref().to_glib_none().0, 123 | )) 124 | } 125 | } 126 | 127 | #[doc(alias = "webkit_uri_scheme_request_get_uri")] 128 | #[doc(alias = "get_uri")] 129 | fn uri(&self) -> Option { 130 | unsafe { 131 | from_glib_none(ffi::webkit_uri_scheme_request_get_uri( 132 | self.as_ref().to_glib_none().0, 133 | )) 134 | } 135 | } 136 | 137 | #[doc(alias = "webkit_uri_scheme_request_get_web_view")] 138 | #[doc(alias = "get_web_view")] 139 | fn web_view(&self) -> Option { 140 | unsafe { 141 | from_glib_none(ffi::webkit_uri_scheme_request_get_web_view( 142 | self.as_ref().to_glib_none().0, 143 | )) 144 | } 145 | } 146 | } 147 | 148 | impl> URISchemeRequestExt for O {} 149 | -------------------------------------------------------------------------------- /src/auto/uri_scheme_response.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::prelude::*; 6 | #[cfg(feature = "v2_36")] 7 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_36")))] 8 | use glib::translate::*; 9 | 10 | glib::wrapper! { 11 | #[doc(alias = "WebKitURISchemeResponse")] 12 | pub struct URISchemeResponse(Object); 13 | 14 | match fn { 15 | type_ => || ffi::webkit_uri_scheme_response_get_type(), 16 | } 17 | } 18 | 19 | impl URISchemeResponse { 20 | pub const NONE: Option<&'static URISchemeResponse> = None; 21 | 22 | #[cfg(feature = "v2_36")] 23 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_36")))] 24 | #[doc(alias = "webkit_uri_scheme_response_new")] 25 | pub fn new(input_stream: &impl IsA, stream_length: i64) -> URISchemeResponse { 26 | assert_initialized_main_thread!(); 27 | unsafe { 28 | from_glib_full(ffi::webkit_uri_scheme_response_new( 29 | input_stream.as_ref().to_glib_none().0, 30 | stream_length, 31 | )) 32 | } 33 | } 34 | 35 | // rustdoc-stripper-ignore-next 36 | /// Creates a new builder-pattern struct instance to construct [`URISchemeResponse`] objects. 37 | /// 38 | /// This method returns an instance of [`URISchemeResponseBuilder`](crate::builders::URISchemeResponseBuilder) which can be used to create [`URISchemeResponse`] objects. 39 | pub fn builder() -> URISchemeResponseBuilder { 40 | URISchemeResponseBuilder::new() 41 | } 42 | } 43 | 44 | #[cfg(feature = "v2_36")] 45 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_36")))] 46 | impl Default for URISchemeResponse { 47 | fn default() -> Self { 48 | glib::object::Object::new::() 49 | } 50 | } 51 | 52 | // rustdoc-stripper-ignore-next 53 | /// A [builder-pattern] type to construct [`URISchemeResponse`] objects. 54 | /// 55 | /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 56 | #[must_use = "The builder must be built to be used"] 57 | pub struct URISchemeResponseBuilder { 58 | builder: glib::object::ObjectBuilder<'static, URISchemeResponse>, 59 | } 60 | 61 | impl URISchemeResponseBuilder { 62 | fn new() -> Self { 63 | Self { 64 | builder: glib::object::Object::builder(), 65 | } 66 | } 67 | 68 | #[cfg(feature = "v2_36")] 69 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_36")))] 70 | pub fn stream(self, stream: &impl IsA) -> Self { 71 | Self { 72 | builder: self.builder.property("stream", stream.clone().upcast()), 73 | } 74 | } 75 | 76 | #[cfg(feature = "v2_36")] 77 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_36")))] 78 | pub fn stream_length(self, stream_length: i64) -> Self { 79 | Self { 80 | builder: self.builder.property("stream-length", stream_length), 81 | } 82 | } 83 | 84 | // rustdoc-stripper-ignore-next 85 | /// Build the [`URISchemeResponse`]. 86 | #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] 87 | pub fn build(self) -> URISchemeResponse { 88 | self.builder.build() 89 | } 90 | } 91 | 92 | mod sealed { 93 | pub trait Sealed {} 94 | impl> Sealed for T {} 95 | } 96 | 97 | pub trait URISchemeResponseExt: IsA + sealed::Sealed + 'static { 98 | #[cfg(feature = "v2_36")] 99 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_36")))] 100 | #[doc(alias = "webkit_uri_scheme_response_set_content_type")] 101 | fn set_content_type(&self, content_type: &str) { 102 | unsafe { 103 | ffi::webkit_uri_scheme_response_set_content_type( 104 | self.as_ref().to_glib_none().0, 105 | content_type.to_glib_none().0, 106 | ); 107 | } 108 | } 109 | 110 | #[cfg(feature = "v2_36")] 111 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_36")))] 112 | #[doc(alias = "webkit_uri_scheme_response_set_http_headers")] 113 | fn set_http_headers(&self, headers: soup::MessageHeaders) { 114 | unsafe { 115 | ffi::webkit_uri_scheme_response_set_http_headers( 116 | self.as_ref().to_glib_none().0, 117 | headers.into_glib_ptr(), 118 | ); 119 | } 120 | } 121 | 122 | #[cfg(feature = "v2_36")] 123 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_36")))] 124 | #[doc(alias = "webkit_uri_scheme_response_set_status")] 125 | fn set_status(&self, status_code: u32, reason_phrase: Option<&str>) { 126 | unsafe { 127 | ffi::webkit_uri_scheme_response_set_status( 128 | self.as_ref().to_glib_none().0, 129 | status_code, 130 | reason_phrase.to_glib_none().0, 131 | ); 132 | } 133 | } 134 | } 135 | 136 | impl> URISchemeResponseExt for O {} 137 | -------------------------------------------------------------------------------- /src/auto/user_media_permission_request.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::PermissionRequest; 6 | use glib::{ 7 | prelude::*, 8 | signal::{connect_raw, SignalHandlerId}, 9 | translate::*, 10 | }; 11 | use std::boxed::Box as Box_; 12 | 13 | glib::wrapper! { 14 | #[doc(alias = "WebKitUserMediaPermissionRequest")] 15 | pub struct UserMediaPermissionRequest(Object) @implements PermissionRequest; 16 | 17 | match fn { 18 | type_ => || ffi::webkit_user_media_permission_request_get_type(), 19 | } 20 | } 21 | 22 | impl UserMediaPermissionRequest { 23 | pub const NONE: Option<&'static UserMediaPermissionRequest> = None; 24 | } 25 | 26 | mod sealed { 27 | pub trait Sealed {} 28 | impl> Sealed for T {} 29 | } 30 | 31 | pub trait UserMediaPermissionRequestExt: 32 | IsA + sealed::Sealed + 'static 33 | { 34 | #[cfg(feature = "v2_8")] 35 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 36 | #[doc(alias = "is-for-audio-device")] 37 | fn is_for_audio_device(&self) -> bool { 38 | ObjectExt::property(self.as_ref(), "is-for-audio-device") 39 | } 40 | 41 | #[cfg(feature = "v2_8")] 42 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 43 | #[doc(alias = "is-for-video-device")] 44 | fn is_for_video_device(&self) -> bool { 45 | ObjectExt::property(self.as_ref(), "is-for-video-device") 46 | } 47 | 48 | #[cfg(feature = "v2_8")] 49 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 50 | #[doc(alias = "is-for-audio-device")] 51 | fn connect_is_for_audio_device_notify(&self, f: F) -> SignalHandlerId { 52 | unsafe extern "C" fn notify_is_for_audio_device_trampoline< 53 | P: IsA, 54 | F: Fn(&P) + 'static, 55 | >( 56 | this: *mut ffi::WebKitUserMediaPermissionRequest, 57 | _param_spec: glib::ffi::gpointer, 58 | f: glib::ffi::gpointer, 59 | ) { 60 | let f: &F = &*(f as *const F); 61 | f(UserMediaPermissionRequest::from_glib_borrow(this).unsafe_cast_ref()) 62 | } 63 | unsafe { 64 | let f: Box_ = Box_::new(f); 65 | connect_raw( 66 | self.as_ptr() as *mut _, 67 | b"notify::is-for-audio-device\0".as_ptr() as *const _, 68 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 69 | notify_is_for_audio_device_trampoline:: as *const (), 70 | )), 71 | Box_::into_raw(f), 72 | ) 73 | } 74 | } 75 | 76 | #[cfg(feature = "v2_8")] 77 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_8")))] 78 | #[doc(alias = "is-for-video-device")] 79 | fn connect_is_for_video_device_notify(&self, f: F) -> SignalHandlerId { 80 | unsafe extern "C" fn notify_is_for_video_device_trampoline< 81 | P: IsA, 82 | F: Fn(&P) + 'static, 83 | >( 84 | this: *mut ffi::WebKitUserMediaPermissionRequest, 85 | _param_spec: glib::ffi::gpointer, 86 | f: glib::ffi::gpointer, 87 | ) { 88 | let f: &F = &*(f as *const F); 89 | f(UserMediaPermissionRequest::from_glib_borrow(this).unsafe_cast_ref()) 90 | } 91 | unsafe { 92 | let f: Box_ = Box_::new(f); 93 | connect_raw( 94 | self.as_ptr() as *mut _, 95 | b"notify::is-for-video-device\0".as_ptr() as *const _, 96 | Some(std::mem::transmute::<_, unsafe extern "C" fn()>( 97 | notify_is_for_video_device_trampoline:: as *const (), 98 | )), 99 | Box_::into_raw(f), 100 | ) 101 | } 102 | } 103 | } 104 | 105 | impl> UserMediaPermissionRequestExt for O {} 106 | -------------------------------------------------------------------------------- /src/auto/user_message.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::{prelude::*, translate::*}; 6 | 7 | glib::wrapper! { 8 | #[doc(alias = "WebKitUserMessage")] 9 | pub struct UserMessage(Object); 10 | 11 | match fn { 12 | type_ => || ffi::webkit_user_message_get_type(), 13 | } 14 | } 15 | 16 | impl UserMessage { 17 | pub const NONE: Option<&'static UserMessage> = None; 18 | 19 | #[doc(alias = "webkit_user_message_new")] 20 | pub fn new(name: &str, parameters: Option<&glib::Variant>) -> UserMessage { 21 | assert_initialized_main_thread!(); 22 | unsafe { 23 | from_glib_none(ffi::webkit_user_message_new( 24 | name.to_glib_none().0, 25 | parameters.to_glib_none().0, 26 | )) 27 | } 28 | } 29 | 30 | #[doc(alias = "webkit_user_message_new_with_fd_list")] 31 | #[doc(alias = "new_with_fd_list")] 32 | pub fn with_fd_list( 33 | name: &str, 34 | parameters: Option<&glib::Variant>, 35 | fd_list: Option<&impl IsA>, 36 | ) -> UserMessage { 37 | assert_initialized_main_thread!(); 38 | unsafe { 39 | from_glib_none(ffi::webkit_user_message_new_with_fd_list( 40 | name.to_glib_none().0, 41 | parameters.to_glib_none().0, 42 | fd_list.map(|p| p.as_ref()).to_glib_none().0, 43 | )) 44 | } 45 | } 46 | 47 | // rustdoc-stripper-ignore-next 48 | /// Creates a new builder-pattern struct instance to construct [`UserMessage`] objects. 49 | /// 50 | /// This method returns an instance of [`UserMessageBuilder`](crate::builders::UserMessageBuilder) which can be used to create [`UserMessage`] objects. 51 | pub fn builder() -> UserMessageBuilder { 52 | UserMessageBuilder::new() 53 | } 54 | } 55 | 56 | #[cfg(feature = "v2_28")] 57 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_28")))] 58 | impl Default for UserMessage { 59 | fn default() -> Self { 60 | glib::object::Object::new::() 61 | } 62 | } 63 | 64 | // rustdoc-stripper-ignore-next 65 | /// A [builder-pattern] type to construct [`UserMessage`] objects. 66 | /// 67 | /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 68 | #[must_use = "The builder must be built to be used"] 69 | pub struct UserMessageBuilder { 70 | builder: glib::object::ObjectBuilder<'static, UserMessage>, 71 | } 72 | 73 | impl UserMessageBuilder { 74 | fn new() -> Self { 75 | Self { 76 | builder: glib::object::Object::builder(), 77 | } 78 | } 79 | 80 | #[cfg(feature = "v2_28")] 81 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_28")))] 82 | pub fn fd_list(self, fd_list: &impl IsA) -> Self { 83 | Self { 84 | builder: self.builder.property("fd-list", fd_list.clone().upcast()), 85 | } 86 | } 87 | 88 | #[cfg(feature = "v2_28")] 89 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_28")))] 90 | pub fn name(self, name: impl Into) -> Self { 91 | Self { 92 | builder: self.builder.property("name", name.into()), 93 | } 94 | } 95 | 96 | #[cfg(feature = "v2_28")] 97 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_28")))] 98 | pub fn parameters(self, parameters: &glib::Variant) -> Self { 99 | Self { 100 | builder: self.builder.property("parameters", parameters.clone()), 101 | } 102 | } 103 | 104 | // rustdoc-stripper-ignore-next 105 | /// Build the [`UserMessage`]. 106 | #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] 107 | pub fn build(self) -> UserMessage { 108 | self.builder.build() 109 | } 110 | } 111 | 112 | mod sealed { 113 | pub trait Sealed {} 114 | impl> Sealed for T {} 115 | } 116 | 117 | pub trait UserMessageExt: IsA + sealed::Sealed + 'static { 118 | #[doc(alias = "webkit_user_message_get_fd_list")] 119 | #[doc(alias = "get_fd_list")] 120 | fn fd_list(&self) -> Option { 121 | unsafe { 122 | from_glib_none(ffi::webkit_user_message_get_fd_list( 123 | self.as_ref().to_glib_none().0, 124 | )) 125 | } 126 | } 127 | 128 | #[doc(alias = "webkit_user_message_get_name")] 129 | #[doc(alias = "get_name")] 130 | fn name(&self) -> Option { 131 | unsafe { 132 | from_glib_none(ffi::webkit_user_message_get_name( 133 | self.as_ref().to_glib_none().0, 134 | )) 135 | } 136 | } 137 | 138 | #[doc(alias = "webkit_user_message_get_parameters")] 139 | #[doc(alias = "get_parameters")] 140 | fn parameters(&self) -> Option { 141 | unsafe { 142 | from_glib_none(ffi::webkit_user_message_get_parameters( 143 | self.as_ref().to_glib_none().0, 144 | )) 145 | } 146 | } 147 | 148 | #[doc(alias = "webkit_user_message_send_reply")] 149 | fn send_reply(&self, reply: &impl IsA) { 150 | unsafe { 151 | ffi::webkit_user_message_send_reply( 152 | self.as_ref().to_glib_none().0, 153 | reply.as_ref().to_glib_none().0, 154 | ); 155 | } 156 | } 157 | } 158 | 159 | impl> UserMessageExt for O {} 160 | -------------------------------------------------------------------------------- /src/auto/user_script.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::{UserContentInjectedFrames, UserScriptInjectionTime}; 6 | use glib::translate::*; 7 | 8 | glib::wrapper! { 9 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 10 | pub struct UserScript(Shared); 11 | 12 | match fn { 13 | ref => |ptr| ffi::webkit_user_script_ref(ptr), 14 | unref => |ptr| ffi::webkit_user_script_unref(ptr), 15 | type_ => || ffi::webkit_user_script_get_type(), 16 | } 17 | } 18 | 19 | impl UserScript { 20 | #[doc(alias = "webkit_user_script_new")] 21 | pub fn new( 22 | source: &str, 23 | injected_frames: UserContentInjectedFrames, 24 | injection_time: UserScriptInjectionTime, 25 | allow_list: &[&str], 26 | block_list: &[&str], 27 | ) -> UserScript { 28 | assert_initialized_main_thread!(); 29 | unsafe { 30 | from_glib_full(ffi::webkit_user_script_new( 31 | source.to_glib_none().0, 32 | injected_frames.into_glib(), 33 | injection_time.into_glib(), 34 | allow_list.to_glib_none().0, 35 | block_list.to_glib_none().0, 36 | )) 37 | } 38 | } 39 | 40 | #[cfg(feature = "v2_22")] 41 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_22")))] 42 | #[doc(alias = "webkit_user_script_new_for_world")] 43 | #[doc(alias = "new_for_world")] 44 | pub fn for_world( 45 | source: &str, 46 | injected_frames: UserContentInjectedFrames, 47 | injection_time: UserScriptInjectionTime, 48 | world_name: &str, 49 | allow_list: &[&str], 50 | block_list: &[&str], 51 | ) -> UserScript { 52 | assert_initialized_main_thread!(); 53 | unsafe { 54 | from_glib_full(ffi::webkit_user_script_new_for_world( 55 | source.to_glib_none().0, 56 | injected_frames.into_glib(), 57 | injection_time.into_glib(), 58 | world_name.to_glib_none().0, 59 | allow_list.to_glib_none().0, 60 | block_list.to_glib_none().0, 61 | )) 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/auto/user_style_sheet.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::{UserContentInjectedFrames, UserStyleLevel}; 6 | use glib::translate::*; 7 | 8 | glib::wrapper! { 9 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 10 | pub struct UserStyleSheet(Shared); 11 | 12 | match fn { 13 | ref => |ptr| ffi::webkit_user_style_sheet_ref(ptr), 14 | unref => |ptr| ffi::webkit_user_style_sheet_unref(ptr), 15 | type_ => || ffi::webkit_user_style_sheet_get_type(), 16 | } 17 | } 18 | 19 | impl UserStyleSheet { 20 | #[doc(alias = "webkit_user_style_sheet_new")] 21 | pub fn new( 22 | source: &str, 23 | injected_frames: UserContentInjectedFrames, 24 | level: UserStyleLevel, 25 | allow_list: &[&str], 26 | block_list: &[&str], 27 | ) -> UserStyleSheet { 28 | assert_initialized_main_thread!(); 29 | unsafe { 30 | from_glib_full(ffi::webkit_user_style_sheet_new( 31 | source.to_glib_none().0, 32 | injected_frames.into_glib(), 33 | level.into_glib(), 34 | allow_list.to_glib_none().0, 35 | block_list.to_glib_none().0, 36 | )) 37 | } 38 | } 39 | 40 | #[cfg(feature = "v2_22")] 41 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_22")))] 42 | #[doc(alias = "webkit_user_style_sheet_new_for_world")] 43 | #[doc(alias = "new_for_world")] 44 | pub fn for_world( 45 | source: &str, 46 | injected_frames: UserContentInjectedFrames, 47 | level: UserStyleLevel, 48 | world_name: &str, 49 | allow_list: &[&str], 50 | block_list: &[&str], 51 | ) -> UserStyleSheet { 52 | assert_initialized_main_thread!(); 53 | unsafe { 54 | from_glib_full(ffi::webkit_user_style_sheet_new_for_world( 55 | source.to_glib_none().0, 56 | injected_frames.into_glib(), 57 | level.into_glib(), 58 | world_name.to_glib_none().0, 59 | allow_list.to_glib_none().0, 60 | block_list.to_glib_none().0, 61 | )) 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/auto/versions.txt: -------------------------------------------------------------------------------- 1 | Generated by gir (https://github.com/gtk-rs/gir @ 428c880ecf0b) 2 | from gir-files (https://github.com/tauri-apps/gir-files @ 81738e4951ed) 3 | -------------------------------------------------------------------------------- /src/auto/web_view_base.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | glib::wrapper! { 6 | #[doc(alias = "WebKitWebViewBase")] 7 | pub struct WebViewBase(Object) @extends gtk::Container, gtk::Widget, @implements gtk::Buildable; 8 | 9 | match fn { 10 | type_ => || ffi::webkit_web_view_base_get_type(), 11 | } 12 | } 13 | 14 | impl WebViewBase { 15 | pub const NONE: Option<&'static WebViewBase> = None; 16 | } 17 | -------------------------------------------------------------------------------- /src/auto/web_view_session_state.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::translate::*; 6 | 7 | glib::wrapper! { 8 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 9 | pub struct WebViewSessionState(Shared); 10 | 11 | match fn { 12 | ref => |ptr| ffi::webkit_web_view_session_state_ref(ptr), 13 | unref => |ptr| ffi::webkit_web_view_session_state_unref(ptr), 14 | type_ => || ffi::webkit_web_view_session_state_get_type(), 15 | } 16 | } 17 | 18 | impl WebViewSessionState { 19 | #[doc(alias = "webkit_web_view_session_state_new")] 20 | pub fn new(data: &glib::Bytes) -> WebViewSessionState { 21 | assert_initialized_main_thread!(); 22 | unsafe { 23 | from_glib_full(ffi::webkit_web_view_session_state_new( 24 | data.to_glib_none().0, 25 | )) 26 | } 27 | } 28 | 29 | #[doc(alias = "webkit_web_view_session_state_serialize")] 30 | pub fn serialize(&self) -> Option { 31 | unsafe { 32 | from_glib_full(ffi::webkit_web_view_session_state_serialize( 33 | self.to_glib_none().0, 34 | )) 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/auto/website_data.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::WebsiteDataTypes; 6 | use glib::translate::*; 7 | 8 | glib::wrapper! { 9 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 10 | pub struct WebsiteData(Shared); 11 | 12 | match fn { 13 | ref => |ptr| ffi::webkit_website_data_ref(ptr), 14 | unref => |ptr| ffi::webkit_website_data_unref(ptr), 15 | type_ => || ffi::webkit_website_data_get_type(), 16 | } 17 | } 18 | 19 | impl WebsiteData { 20 | #[doc(alias = "webkit_website_data_get_name")] 21 | #[doc(alias = "get_name")] 22 | pub fn name(&self) -> Option { 23 | unsafe { from_glib_none(ffi::webkit_website_data_get_name(self.to_glib_none().0)) } 24 | } 25 | 26 | #[doc(alias = "webkit_website_data_get_size")] 27 | #[doc(alias = "get_size")] 28 | pub fn size(&self, types: WebsiteDataTypes) -> u64 { 29 | unsafe { ffi::webkit_website_data_get_size(self.to_glib_none().0, types.into_glib()) } 30 | } 31 | 32 | #[doc(alias = "webkit_website_data_get_types")] 33 | #[doc(alias = "get_types")] 34 | pub fn types(&self) -> WebsiteDataTypes { 35 | unsafe { from_glib(ffi::webkit_website_data_get_types(self.to_glib_none().0)) } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/auto/website_data_access_permission_request.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::PermissionRequest; 6 | use glib::{prelude::*, translate::*}; 7 | 8 | glib::wrapper! { 9 | #[doc(alias = "WebKitWebsiteDataAccessPermissionRequest")] 10 | pub struct WebsiteDataAccessPermissionRequest(Object) @implements PermissionRequest; 11 | 12 | match fn { 13 | type_ => || ffi::webkit_website_data_access_permission_request_get_type(), 14 | } 15 | } 16 | 17 | impl WebsiteDataAccessPermissionRequest { 18 | pub const NONE: Option<&'static WebsiteDataAccessPermissionRequest> = None; 19 | } 20 | 21 | mod sealed { 22 | pub trait Sealed {} 23 | impl> Sealed for T {} 24 | } 25 | 26 | pub trait WebsiteDataAccessPermissionRequestExt: 27 | IsA + sealed::Sealed + 'static 28 | { 29 | #[doc(alias = "webkit_website_data_access_permission_request_get_current_domain")] 30 | #[doc(alias = "get_current_domain")] 31 | fn current_domain(&self) -> Option { 32 | unsafe { 33 | from_glib_none( 34 | ffi::webkit_website_data_access_permission_request_get_current_domain( 35 | self.as_ref().to_glib_none().0, 36 | ), 37 | ) 38 | } 39 | } 40 | 41 | #[doc(alias = "webkit_website_data_access_permission_request_get_requesting_domain")] 42 | #[doc(alias = "get_requesting_domain")] 43 | fn requesting_domain(&self) -> Option { 44 | unsafe { 45 | from_glib_none( 46 | ffi::webkit_website_data_access_permission_request_get_requesting_domain( 47 | self.as_ref().to_glib_none().0, 48 | ), 49 | ) 50 | } 51 | } 52 | } 53 | 54 | impl> WebsiteDataAccessPermissionRequestExt for O {} 55 | -------------------------------------------------------------------------------- /src/auto/website_policies.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use crate::AutoplayPolicy; 6 | use glib::{prelude::*, translate::*}; 7 | 8 | glib::wrapper! { 9 | #[doc(alias = "WebKitWebsitePolicies")] 10 | pub struct WebsitePolicies(Object); 11 | 12 | match fn { 13 | type_ => || ffi::webkit_website_policies_get_type(), 14 | } 15 | } 16 | 17 | impl WebsitePolicies { 18 | pub const NONE: Option<&'static WebsitePolicies> = None; 19 | 20 | #[doc(alias = "webkit_website_policies_new")] 21 | pub fn new() -> WebsitePolicies { 22 | assert_initialized_main_thread!(); 23 | unsafe { from_glib_full(ffi::webkit_website_policies_new()) } 24 | } 25 | 26 | //#[doc(alias = "webkit_website_policies_new_with_policies")] 27 | //#[doc(alias = "new_with_policies")] 28 | //pub fn with_policies(first_policy_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> WebsitePolicies { 29 | // unsafe { TODO: call ffi:webkit_website_policies_new_with_policies() } 30 | //} 31 | 32 | // rustdoc-stripper-ignore-next 33 | /// Creates a new builder-pattern struct instance to construct [`WebsitePolicies`] objects. 34 | /// 35 | /// This method returns an instance of [`WebsitePoliciesBuilder`](crate::builders::WebsitePoliciesBuilder) which can be used to create [`WebsitePolicies`] objects. 36 | pub fn builder() -> WebsitePoliciesBuilder { 37 | WebsitePoliciesBuilder::new() 38 | } 39 | } 40 | 41 | #[cfg(feature = "v2_30")] 42 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_30")))] 43 | impl Default for WebsitePolicies { 44 | fn default() -> Self { 45 | Self::new() 46 | } 47 | } 48 | 49 | // rustdoc-stripper-ignore-next 50 | /// A [builder-pattern] type to construct [`WebsitePolicies`] objects. 51 | /// 52 | /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 53 | #[must_use = "The builder must be built to be used"] 54 | pub struct WebsitePoliciesBuilder { 55 | builder: glib::object::ObjectBuilder<'static, WebsitePolicies>, 56 | } 57 | 58 | impl WebsitePoliciesBuilder { 59 | fn new() -> Self { 60 | Self { 61 | builder: glib::object::Object::builder(), 62 | } 63 | } 64 | 65 | #[cfg(feature = "v2_30")] 66 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_30")))] 67 | pub fn autoplay(self, autoplay: AutoplayPolicy) -> Self { 68 | Self { 69 | builder: self.builder.property("autoplay", autoplay), 70 | } 71 | } 72 | 73 | // rustdoc-stripper-ignore-next 74 | /// Build the [`WebsitePolicies`]. 75 | #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] 76 | pub fn build(self) -> WebsitePolicies { 77 | self.builder.build() 78 | } 79 | } 80 | 81 | mod sealed { 82 | pub trait Sealed {} 83 | impl> Sealed for T {} 84 | } 85 | 86 | pub trait WebsitePoliciesExt: IsA + sealed::Sealed + 'static { 87 | #[doc(alias = "webkit_website_policies_get_autoplay_policy")] 88 | #[doc(alias = "get_autoplay_policy")] 89 | fn autoplay_policy(&self) -> AutoplayPolicy { 90 | unsafe { 91 | from_glib(ffi::webkit_website_policies_get_autoplay_policy( 92 | self.as_ref().to_glib_none().0, 93 | )) 94 | } 95 | } 96 | 97 | #[cfg(feature = "v2_30")] 98 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_30")))] 99 | fn autoplay(&self) -> AutoplayPolicy { 100 | ObjectExt::property(self.as_ref(), "autoplay") 101 | } 102 | } 103 | 104 | impl> WebsitePoliciesExt for O {} 105 | -------------------------------------------------------------------------------- /src/auto/window_properties.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/tauri-apps/gir-files) 3 | // DO NOT EDIT 4 | 5 | use glib::{prelude::*, translate::*}; 6 | 7 | glib::wrapper! { 8 | #[doc(alias = "WebKitWindowProperties")] 9 | pub struct WindowProperties(Object); 10 | 11 | match fn { 12 | type_ => || ffi::webkit_window_properties_get_type(), 13 | } 14 | } 15 | 16 | impl WindowProperties { 17 | pub const NONE: Option<&'static WindowProperties> = None; 18 | 19 | // rustdoc-stripper-ignore-next 20 | /// Creates a new builder-pattern struct instance to construct [`WindowProperties`] objects. 21 | /// 22 | /// This method returns an instance of [`WindowPropertiesBuilder`](crate::builders::WindowPropertiesBuilder) which can be used to create [`WindowProperties`] objects. 23 | pub fn builder() -> WindowPropertiesBuilder { 24 | WindowPropertiesBuilder::new() 25 | } 26 | } 27 | 28 | // rustdoc-stripper-ignore-next 29 | /// A [builder-pattern] type to construct [`WindowProperties`] objects. 30 | /// 31 | /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 32 | #[must_use = "The builder must be built to be used"] 33 | pub struct WindowPropertiesBuilder { 34 | builder: glib::object::ObjectBuilder<'static, WindowProperties>, 35 | } 36 | 37 | impl WindowPropertiesBuilder { 38 | fn new() -> Self { 39 | Self { 40 | builder: glib::object::Object::builder(), 41 | } 42 | } 43 | 44 | pub fn fullscreen(self, fullscreen: bool) -> Self { 45 | Self { 46 | builder: self.builder.property("fullscreen", fullscreen), 47 | } 48 | } 49 | 50 | pub fn geometry(self, geometry: &gdk::Rectangle) -> Self { 51 | Self { 52 | builder: self.builder.property("geometry", geometry), 53 | } 54 | } 55 | 56 | pub fn locationbar_visible(self, locationbar_visible: bool) -> Self { 57 | Self { 58 | builder: self 59 | .builder 60 | .property("locationbar-visible", locationbar_visible), 61 | } 62 | } 63 | 64 | pub fn menubar_visible(self, menubar_visible: bool) -> Self { 65 | Self { 66 | builder: self.builder.property("menubar-visible", menubar_visible), 67 | } 68 | } 69 | 70 | pub fn resizable(self, resizable: bool) -> Self { 71 | Self { 72 | builder: self.builder.property("resizable", resizable), 73 | } 74 | } 75 | 76 | pub fn scrollbars_visible(self, scrollbars_visible: bool) -> Self { 77 | Self { 78 | builder: self 79 | .builder 80 | .property("scrollbars-visible", scrollbars_visible), 81 | } 82 | } 83 | 84 | pub fn statusbar_visible(self, statusbar_visible: bool) -> Self { 85 | Self { 86 | builder: self 87 | .builder 88 | .property("statusbar-visible", statusbar_visible), 89 | } 90 | } 91 | 92 | pub fn toolbar_visible(self, toolbar_visible: bool) -> Self { 93 | Self { 94 | builder: self.builder.property("toolbar-visible", toolbar_visible), 95 | } 96 | } 97 | 98 | // rustdoc-stripper-ignore-next 99 | /// Build the [`WindowProperties`]. 100 | #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"] 101 | pub fn build(self) -> WindowProperties { 102 | self.builder.build() 103 | } 104 | } 105 | 106 | mod sealed { 107 | pub trait Sealed {} 108 | impl> Sealed for T {} 109 | } 110 | 111 | pub trait WindowPropertiesExt: IsA + sealed::Sealed + 'static { 112 | #[doc(alias = "webkit_window_properties_get_fullscreen")] 113 | #[doc(alias = "get_fullscreen")] 114 | fn is_fullscreen(&self) -> bool { 115 | unsafe { 116 | from_glib(ffi::webkit_window_properties_get_fullscreen( 117 | self.as_ref().to_glib_none().0, 118 | )) 119 | } 120 | } 121 | 122 | #[doc(alias = "webkit_window_properties_get_geometry")] 123 | #[doc(alias = "get_geometry")] 124 | fn geometry(&self) -> gdk::Rectangle { 125 | unsafe { 126 | let mut geometry = gdk::Rectangle::uninitialized(); 127 | ffi::webkit_window_properties_get_geometry( 128 | self.as_ref().to_glib_none().0, 129 | geometry.to_glib_none_mut().0, 130 | ); 131 | geometry 132 | } 133 | } 134 | 135 | #[doc(alias = "webkit_window_properties_get_locationbar_visible")] 136 | #[doc(alias = "get_locationbar_visible")] 137 | fn is_locationbar_visible(&self) -> bool { 138 | unsafe { 139 | from_glib(ffi::webkit_window_properties_get_locationbar_visible( 140 | self.as_ref().to_glib_none().0, 141 | )) 142 | } 143 | } 144 | 145 | #[doc(alias = "webkit_window_properties_get_menubar_visible")] 146 | #[doc(alias = "get_menubar_visible")] 147 | fn is_menubar_visible(&self) -> bool { 148 | unsafe { 149 | from_glib(ffi::webkit_window_properties_get_menubar_visible( 150 | self.as_ref().to_glib_none().0, 151 | )) 152 | } 153 | } 154 | 155 | #[doc(alias = "webkit_window_properties_get_resizable")] 156 | #[doc(alias = "get_resizable")] 157 | fn is_resizable(&self) -> bool { 158 | unsafe { 159 | from_glib(ffi::webkit_window_properties_get_resizable( 160 | self.as_ref().to_glib_none().0, 161 | )) 162 | } 163 | } 164 | 165 | #[doc(alias = "webkit_window_properties_get_scrollbars_visible")] 166 | #[doc(alias = "get_scrollbars_visible")] 167 | fn is_scrollbars_visible(&self) -> bool { 168 | unsafe { 169 | from_glib(ffi::webkit_window_properties_get_scrollbars_visible( 170 | self.as_ref().to_glib_none().0, 171 | )) 172 | } 173 | } 174 | 175 | #[doc(alias = "webkit_window_properties_get_statusbar_visible")] 176 | #[doc(alias = "get_statusbar_visible")] 177 | fn is_statusbar_visible(&self) -> bool { 178 | unsafe { 179 | from_glib(ffi::webkit_window_properties_get_statusbar_visible( 180 | self.as_ref().to_glib_none().0, 181 | )) 182 | } 183 | } 184 | 185 | #[doc(alias = "webkit_window_properties_get_toolbar_visible")] 186 | #[doc(alias = "get_toolbar_visible")] 187 | fn is_toolbar_visible(&self) -> bool { 188 | unsafe { 189 | from_glib(ffi::webkit_window_properties_get_toolbar_visible( 190 | self.as_ref().to_glib_none().0, 191 | )) 192 | } 193 | } 194 | } 195 | 196 | impl> WindowPropertiesExt for O {} 197 | -------------------------------------------------------------------------------- /src/credential.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from gir-files (https://github.com/vhdirk/gir-files.git) 3 | // DO NOT EDIT 4 | 5 | #[cfg(any(feature = "v2_2", docsrs))] 6 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_2")))] 7 | use crate::CredentialPersistence; 8 | #[cfg(any(feature = "v2_34", docsrs))] 9 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_34")))] 10 | use glib::object::IsA; 11 | use glib::translate::mut_override; 12 | #[cfg(any(feature = "v2_2", docsrs))] 13 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_2")))] 14 | use glib::translate::*; 15 | 16 | glib::wrapper! { 17 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 18 | pub struct Credential(Boxed); 19 | 20 | match fn { 21 | copy => |ptr| ffi::webkit_credential_copy(mut_override(ptr)), 22 | free => |ptr| ffi::webkit_credential_free(ptr), 23 | type_ => || ffi::webkit_credential_get_type(), 24 | } 25 | } 26 | 27 | impl Credential { 28 | #[cfg(any(feature = "v2_2", docsrs))] 29 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_2")))] 30 | #[doc(alias = "webkit_credential_new")] 31 | pub fn new(username: &str, password: &str, persistence: CredentialPersistence) -> Credential { 32 | assert_initialized_main_thread!(); 33 | unsafe { 34 | from_glib_full(ffi::webkit_credential_new( 35 | username.to_glib_none().0, 36 | password.to_glib_none().0, 37 | persistence.into_glib(), 38 | )) 39 | } 40 | } 41 | 42 | #[cfg(any(feature = "v2_34", docsrs))] 43 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_34")))] 44 | #[doc(alias = "webkit_credential_new_for_certificate")] 45 | #[doc(alias = "new_for_certificate")] 46 | pub fn for_certificate( 47 | certificate: Option<&impl IsA>, 48 | persistence: CredentialPersistence, 49 | ) -> Credential { 50 | assert_initialized_main_thread!(); 51 | unsafe { 52 | from_glib_full(ffi::webkit_credential_new_for_certificate( 53 | certificate.map(|p| p.as_ref()).to_glib_none().0, 54 | persistence.into_glib(), 55 | )) 56 | } 57 | } 58 | 59 | #[cfg(any(feature = "v2_34", docsrs))] 60 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_34")))] 61 | #[doc(alias = "webkit_credential_new_for_certificate_pin")] 62 | #[doc(alias = "new_for_certificate_pin")] 63 | pub fn for_certificate_pin(pin: &str, persistence: CredentialPersistence) -> Credential { 64 | assert_initialized_main_thread!(); 65 | unsafe { 66 | from_glib_full(ffi::webkit_credential_new_for_certificate_pin( 67 | pin.to_glib_none().0, 68 | persistence.into_glib(), 69 | )) 70 | } 71 | } 72 | 73 | #[cfg(any(feature = "v2_34", docsrs))] 74 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_34")))] 75 | #[doc(alias = "webkit_credential_get_certificate")] 76 | #[doc(alias = "get_certificate")] 77 | pub fn certificate(&mut self) -> Option { 78 | unsafe { 79 | from_glib_none(ffi::webkit_credential_get_certificate( 80 | self.to_glib_none_mut().0, 81 | )) 82 | } 83 | } 84 | 85 | #[cfg(any(feature = "v2_2", docsrs))] 86 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_2")))] 87 | #[doc(alias = "webkit_credential_get_password")] 88 | #[doc(alias = "get_password")] 89 | pub fn password(&mut self) -> Option { 90 | unsafe { 91 | from_glib_none(ffi::webkit_credential_get_password( 92 | self.to_glib_none_mut().0, 93 | )) 94 | } 95 | } 96 | 97 | #[cfg(any(feature = "v2_2", docsrs))] 98 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_2")))] 99 | #[doc(alias = "webkit_credential_get_persistence")] 100 | #[doc(alias = "get_persistence")] 101 | pub fn persistence(&mut self) -> CredentialPersistence { 102 | unsafe { 103 | from_glib(ffi::webkit_credential_get_persistence( 104 | self.to_glib_none_mut().0, 105 | )) 106 | } 107 | } 108 | 109 | #[cfg(any(feature = "v2_2", docsrs))] 110 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_2")))] 111 | #[doc(alias = "webkit_credential_get_username")] 112 | #[doc(alias = "get_username")] 113 | pub fn username(&mut self) -> Option { 114 | unsafe { 115 | from_glib_none(ffi::webkit_credential_get_username( 116 | self.to_glib_none_mut().0, 117 | )) 118 | } 119 | } 120 | 121 | #[cfg(any(feature = "v2_2", docsrs))] 122 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_2")))] 123 | #[doc(alias = "webkit_credential_has_password")] 124 | pub fn has_password(&mut self) -> bool { 125 | unsafe { 126 | from_glib(ffi::webkit_credential_has_password( 127 | self.to_glib_none_mut().0, 128 | )) 129 | } 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /src/javascript_result.rs: -------------------------------------------------------------------------------- 1 | use glib::translate::*; 2 | 3 | glib::wrapper! { 4 | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] 5 | pub struct JavascriptResult(Shared); 6 | 7 | match fn { 8 | ref => |ptr| ffi::webkit_javascript_result_ref(ptr), 9 | unref => |ptr| ffi::webkit_javascript_result_unref(ptr), 10 | type_ => || ffi::webkit_javascript_result_get_type(), 11 | } 12 | } 13 | 14 | impl JavascriptResult { 15 | #[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")] 16 | #[doc(alias = "webkit_javascript_result_get_global_context")] 17 | #[doc(alias = "get_global_context")] 18 | pub fn global_context(&self) -> Option { 19 | unsafe { 20 | from_glib_none(ffi::webkit_javascript_result_get_global_context( 21 | self.to_glib_none().0, 22 | )) 23 | } 24 | } 25 | 26 | #[cfg(any(feature = "v2_22", docsrs))] 27 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_22")))] 28 | #[doc(alias = "webkit_javascript_result_get_js_value")] 29 | #[doc(alias = "get_js_value")] 30 | pub fn js_value(&self) -> Option { 31 | unsafe { 32 | from_glib_none(ffi::webkit_javascript_result_get_js_value( 33 | self.to_glib_none().0, 34 | )) 35 | } 36 | } 37 | 38 | #[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")] 39 | #[doc(alias = "webkit_javascript_result_get_value")] 40 | #[doc(alias = "get_value")] 41 | pub fn value(&self) -> Option { 42 | unsafe { 43 | from_glib_none(ffi::webkit_javascript_result_get_value( 44 | self.to_glib_none().0, 45 | )) 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | #![allow(deprecated)] 2 | #![doc = include_str!("../README.md")] 3 | #![cfg_attr(docsrs, feature(doc_cfg))] 4 | 5 | pub use ffi; 6 | 7 | // Re-export gtk dependencies 8 | pub use gio; 9 | pub use glib; 10 | 11 | pub use glib::Error; 12 | 13 | #[cfg_attr(feature = "cargo-clippy", allow(too_many_arguments))] 14 | #[cfg_attr(feature = "cargo-clippy", allow(useless_transmute))] 15 | #[macro_use] 16 | mod rt; 17 | 18 | #[allow(unused_imports)] 19 | mod auto; 20 | // mod credential; 21 | // mod javascript_result; 22 | // mod web_context; 23 | mod web_view; 24 | 25 | #[cfg(any(feature = "v2_16", docsrs))] 26 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 27 | mod website_data_manager; 28 | 29 | // pub use credential::*; 30 | // pub use javascript_result::*; 31 | // pub use web_context::*; 32 | pub use web_view::*; 33 | 34 | #[cfg(any(feature = "v2_16", docsrs))] 35 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 36 | pub use website_data_manager::*; 37 | 38 | pub use crate::auto::builders::*; 39 | pub use crate::auto::traits::*; 40 | pub use crate::auto::*; 41 | -------------------------------------------------------------------------------- /src/rt.rs: -------------------------------------------------------------------------------- 1 | // Take a look at the license at the top of the repository in the LICENSE file. 2 | 3 | macro_rules! assert_initialized_main_thread { 4 | () => { 5 | if !::gtk::is_initialized_main_thread() { 6 | if ::gtk::is_initialized() { 7 | panic!("GTK may only be used from the main thread."); 8 | } else { 9 | panic!("GTK has not been initialized. Call `gtk::init` first."); 10 | } 11 | } 12 | }; 13 | } 14 | 15 | macro_rules! skip_assert_initialized { 16 | () => {}; 17 | } 18 | -------------------------------------------------------------------------------- /src/web_context.rs: -------------------------------------------------------------------------------- 1 | // Take a look at the license at the top of the repository in the LICENSE file. 2 | 3 | #[cfg(feature = "v2_16")] 4 | use super::{NetworkProxyMode, NetworkProxySettings}; 5 | #[cfg(feature = "v2_6")] 6 | use glib::translate::{FromGlibPtrNone, IntoGlib, ToGlibPtr, ToGlibPtrMut}; 7 | use glib::IsA; 8 | 9 | use super::WebContext; 10 | 11 | pub trait WebContextExtManual { 12 | #[cfg(any(feature = "v2_16", docsrs))] 13 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 14 | #[doc(alias = "webkit_web_context_set_network_proxy_settings")] 15 | fn set_network_proxy_settings( 16 | &self, 17 | proxy_mode: NetworkProxyMode, 18 | proxy_settings: Option<&mut NetworkProxySettings>, 19 | ); 20 | } 21 | 22 | impl WebContextExtManual for O 23 | where 24 | O: IsA, 25 | { 26 | #[cfg(any(feature = "v2_16", docsrs))] 27 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 28 | fn set_network_proxy_settings( 29 | &self, 30 | proxy_mode: NetworkProxyMode, 31 | mut proxy_settings: Option<&mut NetworkProxySettings>, 32 | ) { 33 | unsafe { 34 | ffi::webkit_web_context_set_network_proxy_settings( 35 | self.as_ref().to_glib_none().0, 36 | proxy_mode.into_glib(), 37 | proxy_settings.to_glib_none_mut().0, 38 | ); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/web_view.rs: -------------------------------------------------------------------------------- 1 | // Take a look at the license at the top of the repository in the LICENSE file. 2 | 3 | #[cfg(feature = "v2_6")] 4 | use crate::UserContentManager; 5 | #[cfg(feature = "v2_6")] 6 | use crate::WebContext; 7 | use crate::WebView; 8 | use glib::IsA; 9 | 10 | pub trait WebViewExtManual { 11 | #[cfg(feature = "v2_6")] 12 | fn new_with_context_and_user_content_manager( 13 | context: &WebContext, 14 | user_content_manager: &UserContentManager, 15 | ) -> Self; 16 | } 17 | 18 | impl WebViewExtManual for O 19 | where 20 | O: IsA + IsA, 21 | { 22 | #[cfg(feature = "v2_6")] 23 | fn new_with_context_and_user_content_manager( 24 | context: &WebContext, 25 | user_content_manager: &UserContentManager, 26 | ) -> Self { 27 | use glib::{ 28 | object::Cast, 29 | translate::{FromGlibPtrNone, IntoGlib, ToGlibPtr}, 30 | StaticType, 31 | }; 32 | use std::{ffi::CString, ptr}; 33 | assert_initialized_main_thread!(); 34 | let user_content_manager_property = CString::new("user-content-manager").unwrap(); 35 | let web_context_property = CString::new("web-context").unwrap(); 36 | let glib_user_content_manager: *mut ffi::WebKitUserContentManager = 37 | user_content_manager.to_glib_none().0; 38 | let glib_user_content_manager = glib_user_content_manager as *mut gobject_sys::GObject; 39 | let glib_context: *mut ffi::WebKitWebContext = context.to_glib_none().0; 40 | let glib_context = glib_context as *mut gobject_sys::GObject; 41 | let null: *mut gobject_sys::GObject = ptr::null_mut(); 42 | unsafe { 43 | gtk::Widget::from_glib_none(gobject_sys::g_object_new( 44 | WebView::static_type().into_glib(), 45 | user_content_manager_property.as_ptr(), 46 | glib_user_content_manager, 47 | web_context_property.as_ptr(), 48 | glib_context, 49 | null, 50 | ) as *mut _) 51 | .downcast() 52 | .expect("downcast") 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/website_data_manager.rs: -------------------------------------------------------------------------------- 1 | #[cfg(any(feature = "v2_16", docsrs))] 2 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 3 | use crate::WebsiteData; 4 | use crate::WebsiteDataManager; 5 | #[cfg(any(feature = "v2_16", docsrs))] 6 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 7 | use crate::WebsiteDataTypes; 8 | use glib::{object::IsA, translate::*}; 9 | #[cfg(any(feature = "v2_16", docsrs))] 10 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 11 | use std::boxed::Box as Box_; 12 | use std::ptr; 13 | 14 | pub trait WebsiteDataManagerExtManual: 'static { 15 | #[cfg(any(feature = "v2_16", docsrs))] 16 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 17 | #[doc(alias = "webkit_website_data_manager_clear")] 18 | fn clear) + Send + 'static>( 19 | &self, 20 | types: WebsiteDataTypes, 21 | timespan: glib::TimeSpan, 22 | cancellable: Option<&impl IsA>, 23 | callback: P, 24 | ); 25 | 26 | #[cfg(any(feature = "v2_16", docsrs))] 27 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 28 | #[doc(alias = "webkit_website_data_manager_remove")] 29 | fn remove) + Send + 'static>( 30 | &self, 31 | types: WebsiteDataTypes, 32 | website_data: &[&WebsiteData], 33 | cancellable: Option<&impl IsA>, 34 | callback: P, 35 | ); 36 | } 37 | 38 | impl> WebsiteDataManagerExtManual for O { 39 | #[cfg(any(feature = "v2_16", docsrs))] 40 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 41 | fn clear) + Send + 'static>( 42 | &self, 43 | types: WebsiteDataTypes, 44 | timespan: glib::TimeSpan, 45 | cancellable: Option<&impl IsA>, 46 | callback: P, 47 | ) { 48 | let user_data: Box_

= Box_::new(callback); 49 | unsafe extern "C" fn clear_trampoline) + Send + 'static>( 50 | _source_object: *mut glib::gobject_ffi::GObject, 51 | res: *mut gio::ffi::GAsyncResult, 52 | user_data: glib::ffi::gpointer, 53 | ) { 54 | let mut error = ptr::null_mut(); 55 | let _ = 56 | ffi::webkit_website_data_manager_clear_finish(_source_object as *mut _, res, &mut error); 57 | let result = if error.is_null() { 58 | Ok(()) 59 | } else { 60 | Err(from_glib_full(error)) 61 | }; 62 | let callback: Box_

= Box_::from_raw(user_data as *mut _); 63 | callback(result); 64 | } 65 | let callback = clear_trampoline::

; 66 | unsafe { 67 | ffi::webkit_website_data_manager_clear( 68 | self.as_ref().to_glib_none().0, 69 | types.into_glib(), 70 | timespan.0, 71 | cancellable.map(|p| p.as_ref()).to_glib_none().0, 72 | Some(callback), 73 | Box_::into_raw(user_data) as *mut _, 74 | ); 75 | } 76 | } 77 | 78 | #[cfg(any(feature = "v2_16", docsrs))] 79 | #[cfg_attr(docsrs, doc(cfg(feature = "v2_16")))] 80 | fn remove) + Send + 'static>( 81 | &self, 82 | types: WebsiteDataTypes, 83 | website_data: &[&WebsiteData], 84 | cancellable: Option<&impl IsA>, 85 | callback: P, 86 | ) { 87 | let user_data: Box_

= Box_::new(callback); 88 | unsafe extern "C" fn remove_trampoline) + Send + 'static>( 89 | _source_object: *mut glib::gobject_ffi::GObject, 90 | res: *mut gio::ffi::GAsyncResult, 91 | user_data: glib::ffi::gpointer, 92 | ) { 93 | let mut error = ptr::null_mut(); 94 | let _ = 95 | ffi::webkit_website_data_manager_remove_finish(_source_object as *mut _, res, &mut error); 96 | let result = if error.is_null() { 97 | Ok(()) 98 | } else { 99 | Err(from_glib_full(error)) 100 | }; 101 | let callback: Box_

= Box_::from_raw(user_data as *mut _); 102 | callback(result); 103 | } 104 | let callback = remove_trampoline::

; 105 | unsafe { 106 | ffi::webkit_website_data_manager_remove( 107 | self.as_ref().to_glib_none().0, 108 | types.into_glib(), 109 | website_data.to_glib_none().0, 110 | cancellable.map(|p| p.as_ref()).to_glib_none().0, 111 | Some(callback), 112 | Box_::into_raw(user_data) as *mut _, 113 | ); 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /sys/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## \[2.0.1] 4 | 5 | - [`74ab5a4`](https://github.com/tauri-apps/javascriptcore-rs/commit/74ab5a403ddfac3ba977cadc499376e1935e6613) Properly replaced dox with docrs. 6 | 7 | ## \[2.0.0] 8 | 9 | - [`b31ff8c`](https://github.com/tauri-apps/javascriptcore-rs/commit/b31ff8cc1438ef1f708b9694caa026d72620cba3) Update gtk to 0.18. 10 | 11 | Bump MSRV to 1.70.0. 12 | 13 | ## \[1.1.1] 14 | 15 | - [`e95f84a`](https://github.com/tauri-apps/javascriptcore-rs/commit/e95f84a72bc7e6fc367929fd04f5aa795a5d00df) Lock webkit2gtk version to 1.0. 16 | 17 | ## \[1.1.0] 18 | 19 | - [`5f8f15f`](https://github.com/tauri-apps/javascriptcore-rs/commit/5f8f15f2303d25083c885c2309e90ad98a8b780e) Update to webkit2gtk v2.40. 20 | 21 | ## \[1.0.0] 22 | 23 | - Bump version to 1.0. 24 | - [31b3ddf](https://github.com/tauri-apps/javascriptcore-rs/commit/31b3ddf725a394499d2a3a03a776d34e73464a66) Bump version to v1.0 on 2023-04-04 25 | 26 | ## \[0.19.1] 27 | 28 | - Update javascriptcore to crates.io dependency. 29 | - [38b4d26](https://github.com/tauri-apps/javascriptcore-rs/commit/38b4d2647db6fad4791ec21897d23722c79a1015) Update jsc to crate.io's dependency. on 2023-01-26 30 | 31 | ## \[0.19.0] 32 | 33 | - Bump gtk version: 0.15 -> 0.16, webkit2gtk version: 4.0 -> 4.1 34 | - [c475ff3](https://github.com/tauri-apps/javascriptcore-rs/commit/c475ff39b8412e38cda91c5705a6ad518dd4e5e0) chore: add changelog on 2023-01-25 35 | 36 | ## \[0.18.0] 37 | 38 | - Update webkit2gtk to 2.36 39 | - [e43696b](https://github.com/tauri-apps/javascriptcore-rs/commit/e43696b55d2ea3cad03c8493dc381dbbf5c741a4) Add change file on 2022-05-06 40 | 41 | ## \[0.17.0] 42 | 43 | - Update to gtk 0.15 44 | - [205e481](https://github.com/tauri-apps/javascriptcore-rs/commit/205e481831a8f008d0c89a31463751c3e7800dfd) Update to gtk 0.15 on 2022-01-18 45 | 46 | ## \[0.16.0] 47 | 48 | - Update to soup2-sys in sys crate. 49 | - [eb53cd6](https://github.com/tauri-apps/javascriptcore-rs/commit/eb53cd68667ea35917a75aac4ed9167ddf4bfa0e) Add change file on 2021-12-23 50 | 51 | ## \[0.15.2] 52 | 53 | - Update with lates gir files 54 | - [cf24027](https://github.com/tauri-apps/javascriptcore-rs/commit/cf240271a1154ff82ae9dcf444fa63d082a8a9f9) Add change file on 2021-11-04 55 | 56 | ## \[0.15.0] 57 | 58 | - Update sys crate to latest gir. 59 | - [e74374e](https://github.com/tauri-apps/javascriptcore-rs/commit/e74374e9ad6da48a63c457ef8bf21e147e176479) Bump sys crate version on 2021-10-05 60 | -------------------------------------------------------------------------------- /sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "webkit2gtk-sys" 3 | build = "build.rs" 4 | categories = [ "api-bindings", "gui" ] 5 | description = "Rust binding for webkit-gtk library" 6 | keywords = [ "webkit", "gtk-rs", "gnome", "GUI" ] 7 | license = "MIT" 8 | links = "web_kit2" 9 | repository = "https://github.com/tauri-apps/webkit2gtk-rs" 10 | version = "2.0.1" 11 | edition = "2018" 12 | 13 | [package.metadata.docs.rs] 14 | rustc-args = [ "--cfg", "docsrs" ] 15 | rustdoc-args = [ "--cfg", "docsrs", "--generate-link-to-definition" ] 16 | all-features = true 17 | 18 | [package.metadata.system-deps.webkit2gtk_4_1] 19 | name = "webkit2gtk-4.1" 20 | version = "2.4" 21 | 22 | [package.metadata.system-deps.webkit2gtk_4_1.v2_6] 23 | version = "2.6" 24 | 25 | [package.metadata.system-deps.webkit2gtk_4_1.v2_8] 26 | version = "2.8" 27 | 28 | [package.metadata.system-deps.webkit2gtk_4_1.v2_10] 29 | version = "2.10" 30 | 31 | [package.metadata.system-deps.webkit2gtk_4_1.v2_12] 32 | version = "2.12" 33 | 34 | [package.metadata.system-deps.webkit2gtk_4_1.v2_14] 35 | version = "2.14" 36 | 37 | [package.metadata.system-deps.webkit2gtk_4_1.v2_16] 38 | version = "2.16" 39 | 40 | [package.metadata.system-deps.webkit2gtk_4_1.v2_18] 41 | version = "2.18" 42 | 43 | [package.metadata.system-deps.webkit2gtk_4_1.v2_20] 44 | version = "2.20" 45 | 46 | [package.metadata.system-deps.webkit2gtk_4_1.v2_22] 47 | version = "2.22" 48 | 49 | [package.metadata.system-deps.webkit2gtk_4_1.v2_24] 50 | version = "2.24" 51 | 52 | [package.metadata.system-deps.webkit2gtk_4_1.v2_26] 53 | version = "2.26" 54 | 55 | [package.metadata.system-deps.webkit2gtk_4_1.v2_28] 56 | version = "2.28" 57 | 58 | [package.metadata.system-deps.webkit2gtk_4_1.v2_30] 59 | version = "2.30" 60 | 61 | [package.metadata.system-deps.webkit2gtk_4_1.v2_32] 62 | version = "2.32" 63 | 64 | [package.metadata.system-deps.webkit2gtk_4_1.v2_34] 65 | version = "2.34" 66 | 67 | [package.metadata.system-deps.webkit2gtk_4_1.v2_36] 68 | version = "2.36" 69 | 70 | [package.metadata.system-deps.webkit2gtk_4_1.v2_38] 71 | version = "2.38" 72 | 73 | [package.metadata.system-deps.webkit2gtk_4_1.v2_40] 74 | version = "2.40" 75 | 76 | [lib] 77 | name = "webkit2gtk_sys" 78 | 79 | [build-dependencies] 80 | pkg-config = "0.3.7" 81 | system-deps = "6" 82 | 83 | [dependencies] 84 | bitflags = "^1.0" 85 | libc = "0.2" 86 | 87 | [dependencies.gtk] 88 | package = "gtk-sys" 89 | version = "0.18" 90 | 91 | [dependencies.gdk] 92 | package = "gdk-sys" 93 | version = "0.18" 94 | 95 | [dependencies.gio] 96 | package = "gio-sys" 97 | version = "0.18" 98 | 99 | [dependencies.glib] 100 | package = "glib-sys" 101 | version = "0.18" 102 | 103 | [dependencies.gobject] 104 | package = "gobject-sys" 105 | version = "0.18" 106 | 107 | [dependencies.cairo] 108 | package = "cairo-sys-rs" 109 | version = "0.18" 110 | 111 | [dependencies.java_script_core] 112 | package = "javascriptcore-rs-sys" 113 | version = "=1.1" 114 | 115 | [dependencies.soup] 116 | package = "soup3-sys" 117 | version = "0.5" 118 | 119 | [dev-dependencies] 120 | shell-words = "1.0.0" 121 | tempfile = "3" 122 | 123 | [features] 124 | v2_6 = [ ] 125 | v2_8 = [ "v2_6" ] 126 | v2_10 = [ "v2_8" ] 127 | v2_12 = [ "v2_10" ] 128 | v2_14 = [ "v2_12" ] 129 | v2_16 = [ "v2_14" ] 130 | v2_18 = [ "v2_16" ] 131 | v2_20 = [ "v2_18" ] 132 | v2_22 = [ "v2_20" ] 133 | v2_24 = [ "v2_22" ] 134 | v2_26 = [ "v2_24" ] 135 | v2_28 = [ "v2_26" ] 136 | v2_30 = [ "v2_28" ] 137 | v2_32 = [ "v2_30" ] 138 | v2_34 = [ "v2_32" ] 139 | v2_36 = [ "v2_34" ] 140 | v2_38 = [ "v2_36" ] 141 | v2_40 = [ "v2_38" ] 142 | -------------------------------------------------------------------------------- /sys/Gir.toml: -------------------------------------------------------------------------------- 1 | [options] 2 | girs_directories = ["../gir-files"] 3 | work_mode = "sys" 4 | min_cfg_version="2.4" 5 | library = "WebKit2" 6 | version = "4.1" 7 | single_version_file = "." 8 | target_path = "." 9 | 10 | external_libraries = [ 11 | "Gtk", 12 | "GLib", 13 | "GObject", 14 | "Gio", 15 | "Gdk", 16 | "Cairo", 17 | "Soup", 18 | ] 19 | 20 | [external_libraries] 21 | javascriptcore_rs = "JavaScriptCore" 22 | -------------------------------------------------------------------------------- /sys/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Boucher, Antoni 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /sys/build.rs: -------------------------------------------------------------------------------- 1 | // This file was generated by gir (https://github.com/gtk-rs/gir) 2 | // from ../gir-files 3 | // DO NOT EDIT 4 | 5 | #[cfg(not(docsrs))] 6 | use std::process; 7 | 8 | #[cfg(docsrs)] 9 | fn main() {} // prevent linking libraries to avoid documentation failure 10 | 11 | #[cfg(not(docsrs))] 12 | fn main() { 13 | if let Err(s) = system_deps::Config::new().probe() { 14 | println!("cargo:warning={s}"); 15 | process::exit(1); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /sys/tests/manual.h: -------------------------------------------------------------------------------- 1 | // Feel free to edit this file, it won't be regenerated by gir generator unless removed. 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /sys/versions.txt: -------------------------------------------------------------------------------- 1 | Generated by gir (https://github.com/gtk-rs/gir @ 428c880ecf0b) 2 | from ../gir-files (@ 81738e4951ed) 3 | --------------------------------------------------------------------------------