├── .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 ├── .license_template ├── CHANGELOG.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── README.md ├── examples ├── hello.rs └── rust-logo.png ├── rustfmt.toml ├── src └── lib.rs └── sys ├── CHANGELOG.md ├── Cargo.toml └── src └── lib.rs /.changes/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "gitSiteUrl": "https://github.com/tauri-apps/libappindicator-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 libappindicator3-dev", 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 | "libappindicator-sys": { 82 | "path": "./sys", 83 | "manager": "rust" 84 | }, 85 | "libappindicator": { 86 | "path": "./", 87 | "manager": "rust" 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /.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 gtk 25 | if: matrix.platform.os == 'ubuntu-latest' 26 | run: | 27 | sudo apt-get update 28 | sudo apt-get install -y libgtk-3-dev libappindicator3-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 | - main 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 3 | -------------------------------------------------------------------------------- /.license_template: -------------------------------------------------------------------------------- 1 | // Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy 2 | // SPDX-License-Identifier: Apache-2.0 3 | // SPDX-License-Identifier: MIT -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.5.2 (2020-07-14) 2 | 3 | ## \[0.9.0] 4 | 5 | - [`d07334b`](https://github.com/tauri-apps/libappindicator-rs/commit/d07334b2378b137505bbdd706c23803073483e2c) Update gtk to 0.18. 6 | 7 | Increase MSRV to 1.70.0. 8 | 9 | ## \[0.8.0] 10 | 11 | - Bump gtk vesion: 0.15 -> 0.16 12 | - [f834d40](https://github.com/tauri-apps/libappindicator-rs/commit/f834d403fb44125d20f9c6f8f9a8d54aedef4451) chore: add changelog on 2023-01-25 13 | 14 | ## \[0.7.1] 15 | 16 | - Load exclusively using dynamic linking 17 | 18 | This change lets `dlopen` (through `ld.so`) handle what paths to search in for the respective libraries. 19 | Additionally this fixes a mistake with the library filenames. Now using the `SONAME` instead of a symlinked name that happened to work when dev packages are installed. 20 | 21 | **Breaking:** Support for `$APPDIR` based appImage detection is removed. 22 | Though it *should* still work, because appimages provide an `LD_LIBRARY_PATH` that would be equivalent to what our previous detection method was doing in rust. 23 | 24 | - [bb8d280](https://github.com/tauri-apps/libappindicator-rs/commit/bb8d2806b028c5b19c89f126624c85746fca9d7d) Add changes on 2022-06-27 25 | - [aae5895](https://github.com/tauri-apps/libappindicator-rs/commit/aae5895ae389fc2c8a9542a1b630f36e22bcc582) Add a backcompat feature flag on 2022-06-28 26 | - [7f96c33](https://github.com/tauri-apps/libappindicator-rs/commit/7f96c33637886e16082758c9e37a1ee6513ccbd2) fix(covector): change bump to patch on 2022-06-28 27 | 28 | ## \[0.7.0] 29 | 30 | - Update to gtk 0.15 31 | - [ae54bef](https://github.com/tauri-apps/libappindicator-rs/commit/ae54bef8d37f508174c0995f6a9f4b6288107cbd) Update to gtk 0.15 on 2022-01-17 32 | 33 | ## \[0.6.1] 34 | 35 | - Update license to Apache-2.0 OR MIT. 36 | - [09697b3](https://github.com/tauri-apps/libappindicator-rs/commit/09697b31188818260275b5ac99ea701c8351d3cd) Update license to Apache2/MIT on 2021-10-13 37 | 38 | ## \[0.6.0] 39 | 40 | - Bump version of libappindicator. 41 | - [58e495d](https://github.com/tauri-apps/libappindicator-rs/commit/58e495dd72d445567b7b2bbc15669e8d42f93377) Bump version of libappindicator on 2021-10-11 42 | 43 | ## Features 44 | 45 | - Update dependencies 46 | 47 | ## Bugfixes 48 | 49 | - Fix example for gtk-0.10 50 | 51 | # 0.5.1 (2020-02-09) 52 | 53 | ## Features 54 | 55 | - Remembered to make a CHANGELOG finally. 56 | - Added theme paths 57 | - Added non-full set icon methods 58 | - Updated examples and dependencies 59 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "libappindicator" 3 | version = "0.9.0" 4 | description = "Rust safe bindings for libappindicator" 5 | edition = "2021" 6 | license = "Apache-2.0 OR MIT" 7 | keywords = [ "linux", "gui", "gtk" ] 8 | 9 | [dependencies] 10 | log = "0.4" 11 | gtk = "0.18" 12 | libappindicator-sys = { version = "0.9", path = "sys/" } 13 | 14 | [features] 15 | default = [ "backcompat" ] 16 | backcompat = [ "libappindicator-sys/backcompat" ] 17 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-2021 qDot 4 | Copyright (c) 2021 Tauri Apps Contributors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # libappindicator-rs 2 | 3 | [![Crates.io](https://img.shields.io/crates/v/libappindicator.svg)](https://crates.io/crates/libappindicator) 4 | 5 | Rust safe bindings for the libappindicator library. libappindicator 6 | provides cross-distribution/window system functions for creating 7 | systray icons and menus. 8 | 9 | libappindicator-rs uses types from 10 | the [gtk-rs project](http://github.com/gtk-rs) for convenience. See 11 | the examples directory for ideas on building rust applications that 12 | use libappindicator. 13 | -------------------------------------------------------------------------------- /examples/hello.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | use std::path::Path; 3 | 4 | use gtk::prelude::*; 5 | use libappindicator::{AppIndicator, AppIndicatorStatus}; 6 | 7 | fn main() { 8 | gtk::init().unwrap(); 9 | let mut indicator = AppIndicator::new("libappindicator test application", ""); 10 | indicator.set_status(AppIndicatorStatus::Active); 11 | let icon_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("examples"); 12 | indicator.set_icon_theme_path(icon_path.to_str().unwrap()); 13 | indicator.set_icon_full("rust-logo", "icon"); 14 | let mut m = gtk::Menu::new(); 15 | let mi = gtk::CheckMenuItem::with_label("Hello Rust!"); 16 | mi.connect_activate(|_| { 17 | gtk::main_quit(); 18 | }); 19 | m.append(&mi); 20 | indicator.set_menu(&mut m); 21 | m.show_all(); 22 | gtk::main(); 23 | } 24 | -------------------------------------------------------------------------------- /examples/rust-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tauri-apps/libappindicator-rs/ef19dc0cd52357fd0b714555a9174bd65bb6e019/examples/rust-logo.png -------------------------------------------------------------------------------- /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" 16 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2017-2021 qDot 2 | // Copyright 2021 Tauri Programme within The Commons Conservancy 3 | // SPDX-License-Identifier: Apache-2.0 4 | // SPDX-License-Identifier: MIT 5 | 6 | use gtk::glib::translate::ToGlibPtr; 7 | use libappindicator_sys::AppIndicator as AppIndicatorRaw; 8 | pub use libappindicator_sys::*; 9 | 10 | pub struct AppIndicator { 11 | air: *mut AppIndicatorRaw, 12 | } 13 | pub enum AppIndicatorCategory { 14 | ApplicationStatus = 0, 15 | Communications = 1, 16 | SystemServices = 2, 17 | Hardware = 3, 18 | Other = 4, 19 | } 20 | pub enum AppIndicatorStatus { 21 | Passive = 0, 22 | Active = 1, 23 | Attention = 2, 24 | } 25 | impl AppIndicator { 26 | pub fn new(title: &str, icon: &str) -> AppIndicator { 27 | AppIndicator { 28 | air: unsafe { 29 | app_indicator_new( 30 | title.to_glib_none().0, 31 | icon.to_glib_none().0, 32 | AppIndicatorCategory::ApplicationStatus as u32, 33 | ) 34 | }, 35 | } 36 | } 37 | 38 | pub fn with_path(title: &str, icon: &str, theme_path: &str) -> AppIndicator { 39 | AppIndicator { 40 | air: unsafe { 41 | app_indicator_new_with_path( 42 | title.to_glib_none().0, 43 | icon.to_glib_none().0, 44 | AppIndicatorCategory::ApplicationStatus as u32, 45 | theme_path.to_glib_none().0, 46 | ) 47 | }, 48 | } 49 | } 50 | 51 | pub fn set_status(&mut self, status: AppIndicatorStatus) { 52 | unsafe { 53 | app_indicator_set_status(self.air, status as u32); 54 | } 55 | } 56 | 57 | pub fn set_menu(&mut self, menu: &mut gtk::Menu) { 58 | unsafe { 59 | app_indicator_set_menu(self.air, menu.to_glib_none().0); 60 | } 61 | } 62 | 63 | pub fn set_label(&mut self, label: &str, guide: &str) { 64 | unsafe { 65 | app_indicator_set_label(self.air, label.to_glib_none().0, guide.to_glib_none().0); 66 | } 67 | } 68 | 69 | pub fn set_title(&mut self, title: &str) { 70 | unsafe { 71 | app_indicator_set_title(self.air, title.to_glib_none().0); 72 | } 73 | } 74 | 75 | pub fn set_icon(&mut self, name: &str) { 76 | unsafe { 77 | app_indicator_set_icon(self.air, name.to_glib_none().0); 78 | } 79 | } 80 | pub fn set_icon_theme_path(&mut self, path: &str) { 81 | unsafe { 82 | app_indicator_set_icon_theme_path(self.air, path.to_glib_none().0); 83 | } 84 | } 85 | 86 | pub fn set_icon_full(&mut self, name: &str, desc: &str) { 87 | unsafe { 88 | app_indicator_set_icon_full(self.air, name.to_glib_none().0, desc.to_glib_none().0); 89 | } 90 | } 91 | 92 | pub fn set_attention_icon(&mut self, name: &str) { 93 | unsafe { 94 | app_indicator_set_attention_icon(self.air, name.to_glib_none().0); 95 | } 96 | } 97 | 98 | pub fn set_attention_icon_full(&mut self, name: &str, desc: &str) { 99 | unsafe { 100 | app_indicator_set_attention_icon_full(self.air, name.to_glib_none().0, desc.to_glib_none().0); 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /sys/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## \[0.9.0] 4 | 5 | - [`d07334b`](https://github.com/tauri-apps/libappindicator-rs/commit/d07334b2378b137505bbdd706c23803073483e2c) Update gtk to 0.18. 6 | 7 | Increase MSRV to 1.70.0. 8 | 9 | ## \[0.8.0] 10 | 11 | - Bump gtk vesion: 0.15 -> 0.16 12 | - [f834d40](https://github.com/tauri-apps/libappindicator-rs/commit/f834d403fb44125d20f9c6f8f9a8d54aedef4451) chore: add changelog on 2023-01-25 13 | 14 | ## \[0.7.3] 15 | 16 | - Load exclusively using dynamic linking 17 | 18 | This change lets `dlopen` (through `ld.so`) handle what paths to search in for the respective libraries. 19 | Additionally this fixes a mistake with the library filenames. Now using the `SONAME` instead of a symlinked name that happened to work when dev packages are installed. 20 | 21 | **Breaking:** Support for `$APPDIR` based appImage detection is removed. 22 | Though it *should* still work, because appimages provide an `LD_LIBRARY_PATH` that would be equivalent to what our previous detection method was doing in rust. 23 | 24 | - [bb8d280](https://github.com/tauri-apps/libappindicator-rs/commit/bb8d2806b028c5b19c89f126624c85746fca9d7d) Add changes on 2022-06-27 25 | - [aae5895](https://github.com/tauri-apps/libappindicator-rs/commit/aae5895ae389fc2c8a9542a1b630f36e22bcc582) Add a backcompat feature flag on 2022-06-28 26 | - [7f96c33](https://github.com/tauri-apps/libappindicator-rs/commit/7f96c33637886e16082758c9e37a1ee6513ccbd2) fix(covector): change bump to patch on 2022-06-28 27 | 28 | ## \[0.7.2] 29 | 30 | - Change the library loader to use the `APPDIR` environment variable if the running application is an AppImage file. 31 | - [3ee8dc0](https://github.com/tauri-apps/libappindicator-rs/commit/3ee8dc053e4a6027a215ad56dbf9fd4de758e297) fix(sys): use `APPDIR` environment variable when running as an appimage on 2022-06-03 32 | 33 | ## \[0.7.1] 34 | 35 | - Load the library dynamically. 36 | - [3b44230](https://github.com/tauri-apps/libappindicator-rs/commit/3b442309396ab56f1ca4a2fb54477e8351e06f3f) Add change file and fmt on 2022-05-27 37 | 38 | ## \[0.7.0] 39 | 40 | - Update to gtk 0.15 41 | - [ae54bef](https://github.com/tauri-apps/libappindicator-rs/commit/ae54bef8d37f508174c0995f6a9f4b6288107cbd) Update to gtk 0.15 on 2022-01-17 42 | 43 | ## \[0.6.1] 44 | 45 | - Update license to Apache-2.0 OR MIT. 46 | - [09697b3](https://github.com/tauri-apps/libappindicator-rs/commit/09697b31188818260275b5ac99ea701c8351d3cd) Update license to Apache2/MIT on 2021-10-13 47 | 48 | ## \[0.6.0] 49 | 50 | - Bump version of sys crate. 51 | - [c31ffa9](https://github.com/tauri-apps/libappindicator-rs/commit/c31ffa987503762f8a39664fe333af20d7862a9d) Bump version of sys crate on 2021-10-11 52 | -------------------------------------------------------------------------------- /sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "libappindicator-sys" 3 | version = "0.9.0" 4 | description = "Rust sys bindings for libappindicator" 5 | license = "Apache-2.0 OR MIT" 6 | keywords = [ "linux", "gui" ] 7 | edition = "2018" 8 | categories = [ "external-ffi-bindings" ] 9 | 10 | [dependencies] 11 | gtk-sys = "0.18" 12 | libloading = "0.7" 13 | once_cell = "1.12" 14 | 15 | [features] 16 | default = [ "backcompat" ] 17 | backcompat = [ ] 18 | -------------------------------------------------------------------------------- /sys/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![allow(non_upper_case_globals)] 2 | #![allow(non_camel_case_types)] 3 | #![allow(non_snake_case)] 4 | 5 | use gtk_sys::{ 6 | GtkContainer, GtkContainerPrivate, GtkMenu, GtkMenuPrivate, GtkMenuShell, GtkMenuShellPrivate, 7 | GtkStatusIconPrivate, GtkWidget, GtkWidgetPrivate, 8 | }; 9 | use libloading::*; 10 | use once_cell::sync::Lazy; 11 | use std::os::raw::*; 12 | 13 | pub static LIB: Lazy = Lazy::new(|| { 14 | let libayatana = unsafe { Library::new("libayatana-appindicator3.so.1") }; 15 | if let Ok(lib) = libayatana { 16 | return lib; 17 | } 18 | 19 | let libappindicator = unsafe { Library::new("libappindicator3.so.1") }; 20 | if let Ok(lib) = libappindicator { 21 | return lib; 22 | } 23 | 24 | // Versions v0.7.1 and v0.7.2 relied exclusively on the .so files without .1 suffix. 25 | // This is 'bad' because by convention that signals we don't care about ABI compatibility. 26 | // However in weird cases (*ahum* Tauri bundled appimages) this .so file is the only one 27 | // available. Using this feature flag allows them some time to fix this problem and bundle 28 | // with the correct filename. 29 | #[cfg(feature = "backcompat")] 30 | { 31 | let libayatana_compat = unsafe { Library::new("libayatana-appindicator3.so") }; 32 | if let Ok(lib) = libayatana_compat { 33 | return lib; 34 | } 35 | 36 | let libappindicator_compat = unsafe { Library::new("libappindicator3.so") }; 37 | if let Ok(lib) = libappindicator_compat { 38 | return lib; 39 | } 40 | 41 | panic!( 42 | "Failed to load ayatana-appindicator3 or appindicator3 dynamic library\n{}\n{}\n{}\n{}", 43 | libayatana.unwrap_err(), 44 | libappindicator.unwrap_err(), 45 | libayatana_compat.unwrap_err(), 46 | libappindicator_compat.unwrap_err(), 47 | ); 48 | } 49 | 50 | panic!( 51 | "Failed to load ayatana-appindicator3 or appindicator3 dynamic library\n{}\n{}", 52 | libayatana.unwrap_err(), 53 | libappindicator.unwrap_err() 54 | ); 55 | }); 56 | 57 | pub type guint32 = c_uint; 58 | pub type gint64 = c_long; 59 | pub type guint64 = c_ulong; 60 | pub type gsize = c_ulong; 61 | pub type gchar = c_char; 62 | pub type glong = c_long; 63 | pub type gint = c_int; 64 | pub type gboolean = gint; 65 | pub type gulong = c_ulong; 66 | pub type guint = c_uint; 67 | pub type gfloat = f32; 68 | pub type gdouble = f64; 69 | pub type gpointer = *mut c_void; 70 | #[repr(C)] 71 | #[derive(Debug, Copy, Clone)] 72 | pub struct _GData { 73 | _unused: [u8; 0], 74 | } 75 | pub type GData = _GData; 76 | pub type GSList = _GSList; 77 | #[repr(C)] 78 | #[derive(Debug, Copy, Clone)] 79 | pub struct _GSList { 80 | pub data: gpointer, 81 | pub next: *mut GSList, 82 | } 83 | #[test] 84 | fn bindgen_test_layout__GSList() { 85 | assert_eq!( 86 | ::std::mem::size_of::<_GSList>(), 87 | 16usize, 88 | concat!("Size of: ", stringify!(_GSList)) 89 | ); 90 | assert_eq!( 91 | ::std::mem::align_of::<_GSList>(), 92 | 8usize, 93 | concat!("Alignment of ", stringify!(_GSList)) 94 | ); 95 | assert_eq!( 96 | unsafe { &(*(::std::ptr::null::<_GSList>())).data as *const _ as usize }, 97 | 0usize, 98 | concat!( 99 | "Offset of field: ", 100 | stringify!(_GSList), 101 | "::", 102 | stringify!(data) 103 | ) 104 | ); 105 | assert_eq!( 106 | unsafe { &(*(::std::ptr::null::<_GSList>())).next as *const _ as usize }, 107 | 8usize, 108 | concat!( 109 | "Offset of field: ", 110 | stringify!(_GSList), 111 | "::", 112 | stringify!(next) 113 | ) 114 | ); 115 | } 116 | pub type GType = gsize; 117 | pub type GValue = _GValue; 118 | pub type GTypeClass = _GTypeClass; 119 | pub type GTypeInstance = _GTypeInstance; 120 | #[doc = " GTypeClass:"] 121 | #[doc = ""] 122 | #[doc = " An opaque structure used as the base of all classes."] 123 | #[repr(C)] 124 | #[derive(Debug, Copy, Clone)] 125 | pub struct _GTypeClass { 126 | pub g_type: GType, 127 | } 128 | #[test] 129 | fn bindgen_test_layout__GTypeClass() { 130 | assert_eq!( 131 | ::std::mem::size_of::<_GTypeClass>(), 132 | 8usize, 133 | concat!("Size of: ", stringify!(_GTypeClass)) 134 | ); 135 | assert_eq!( 136 | ::std::mem::align_of::<_GTypeClass>(), 137 | 8usize, 138 | concat!("Alignment of ", stringify!(_GTypeClass)) 139 | ); 140 | assert_eq!( 141 | unsafe { &(*(::std::ptr::null::<_GTypeClass>())).g_type as *const _ as usize }, 142 | 0usize, 143 | concat!( 144 | "Offset of field: ", 145 | stringify!(_GTypeClass), 146 | "::", 147 | stringify!(g_type) 148 | ) 149 | ); 150 | } 151 | #[doc = " GTypeInstance:"] 152 | #[doc = ""] 153 | #[doc = " An opaque structure used as the base of all type instances."] 154 | #[repr(C)] 155 | #[derive(Debug, Copy, Clone)] 156 | pub struct _GTypeInstance { 157 | pub g_class: *mut GTypeClass, 158 | } 159 | #[test] 160 | fn bindgen_test_layout__GTypeInstance() { 161 | assert_eq!( 162 | ::std::mem::size_of::<_GTypeInstance>(), 163 | 8usize, 164 | concat!("Size of: ", stringify!(_GTypeInstance)) 165 | ); 166 | assert_eq!( 167 | ::std::mem::align_of::<_GTypeInstance>(), 168 | 8usize, 169 | concat!("Alignment of ", stringify!(_GTypeInstance)) 170 | ); 171 | assert_eq!( 172 | unsafe { &(*(::std::ptr::null::<_GTypeInstance>())).g_class as *const _ as usize }, 173 | 0usize, 174 | concat!( 175 | "Offset of field: ", 176 | stringify!(_GTypeInstance), 177 | "::", 178 | stringify!(g_class) 179 | ) 180 | ); 181 | } 182 | #[doc = " GValue:"] 183 | #[doc = ""] 184 | #[doc = " An opaque structure used to hold different types of values."] 185 | #[doc = " The data within the structure has protected scope: it is accessible only"] 186 | #[doc = " to functions within a #GTypeValueTable structure, or implementations of"] 187 | #[doc = " the g_value_*() API. That is, code portions which implement new fundamental"] 188 | #[doc = " types."] 189 | #[doc = " #GValue users cannot make any assumptions about how data is stored"] 190 | #[doc = " within the 2 element @data union, and the @g_type member should"] 191 | #[doc = " only be accessed through the G_VALUE_TYPE() macro."] 192 | #[repr(C)] 193 | #[derive(Copy, Clone)] 194 | pub struct _GValue { 195 | pub g_type: GType, 196 | pub data: [_GValue__bindgen_ty_1; 2usize], 197 | } 198 | #[repr(C)] 199 | #[derive(Copy, Clone)] 200 | pub union _GValue__bindgen_ty_1 { 201 | pub v_int: gint, 202 | pub v_uint: guint, 203 | pub v_long: glong, 204 | pub v_ulong: gulong, 205 | pub v_int64: gint64, 206 | pub v_uint64: guint64, 207 | pub v_float: gfloat, 208 | pub v_double: gdouble, 209 | pub v_pointer: gpointer, 210 | _bindgen_union_align: u64, 211 | } 212 | #[test] 213 | fn bindgen_test_layout__GValue__bindgen_ty_1() { 214 | assert_eq!( 215 | ::std::mem::size_of::<_GValue__bindgen_ty_1>(), 216 | 8usize, 217 | concat!("Size of: ", stringify!(_GValue__bindgen_ty_1)) 218 | ); 219 | assert_eq!( 220 | ::std::mem::align_of::<_GValue__bindgen_ty_1>(), 221 | 8usize, 222 | concat!("Alignment of ", stringify!(_GValue__bindgen_ty_1)) 223 | ); 224 | assert_eq!( 225 | unsafe { &(*(::std::ptr::null::<_GValue__bindgen_ty_1>())).v_int as *const _ as usize }, 226 | 0usize, 227 | concat!( 228 | "Offset of field: ", 229 | stringify!(_GValue__bindgen_ty_1), 230 | "::", 231 | stringify!(v_int) 232 | ) 233 | ); 234 | assert_eq!( 235 | unsafe { &(*(::std::ptr::null::<_GValue__bindgen_ty_1>())).v_uint as *const _ as usize }, 236 | 0usize, 237 | concat!( 238 | "Offset of field: ", 239 | stringify!(_GValue__bindgen_ty_1), 240 | "::", 241 | stringify!(v_uint) 242 | ) 243 | ); 244 | assert_eq!( 245 | unsafe { &(*(::std::ptr::null::<_GValue__bindgen_ty_1>())).v_long as *const _ as usize }, 246 | 0usize, 247 | concat!( 248 | "Offset of field: ", 249 | stringify!(_GValue__bindgen_ty_1), 250 | "::", 251 | stringify!(v_long) 252 | ) 253 | ); 254 | assert_eq!( 255 | unsafe { &(*(::std::ptr::null::<_GValue__bindgen_ty_1>())).v_ulong as *const _ as usize }, 256 | 0usize, 257 | concat!( 258 | "Offset of field: ", 259 | stringify!(_GValue__bindgen_ty_1), 260 | "::", 261 | stringify!(v_ulong) 262 | ) 263 | ); 264 | assert_eq!( 265 | unsafe { &(*(::std::ptr::null::<_GValue__bindgen_ty_1>())).v_int64 as *const _ as usize }, 266 | 0usize, 267 | concat!( 268 | "Offset of field: ", 269 | stringify!(_GValue__bindgen_ty_1), 270 | "::", 271 | stringify!(v_int64) 272 | ) 273 | ); 274 | assert_eq!( 275 | unsafe { &(*(::std::ptr::null::<_GValue__bindgen_ty_1>())).v_uint64 as *const _ as usize }, 276 | 0usize, 277 | concat!( 278 | "Offset of field: ", 279 | stringify!(_GValue__bindgen_ty_1), 280 | "::", 281 | stringify!(v_uint64) 282 | ) 283 | ); 284 | assert_eq!( 285 | unsafe { &(*(::std::ptr::null::<_GValue__bindgen_ty_1>())).v_float as *const _ as usize }, 286 | 0usize, 287 | concat!( 288 | "Offset of field: ", 289 | stringify!(_GValue__bindgen_ty_1), 290 | "::", 291 | stringify!(v_float) 292 | ) 293 | ); 294 | assert_eq!( 295 | unsafe { &(*(::std::ptr::null::<_GValue__bindgen_ty_1>())).v_double as *const _ as usize }, 296 | 0usize, 297 | concat!( 298 | "Offset of field: ", 299 | stringify!(_GValue__bindgen_ty_1), 300 | "::", 301 | stringify!(v_double) 302 | ) 303 | ); 304 | assert_eq!( 305 | unsafe { &(*(::std::ptr::null::<_GValue__bindgen_ty_1>())).v_pointer as *const _ as usize }, 306 | 0usize, 307 | concat!( 308 | "Offset of field: ", 309 | stringify!(_GValue__bindgen_ty_1), 310 | "::", 311 | stringify!(v_pointer) 312 | ) 313 | ); 314 | } 315 | #[test] 316 | fn bindgen_test_layout__GValue() { 317 | assert_eq!( 318 | ::std::mem::size_of::<_GValue>(), 319 | 24usize, 320 | concat!("Size of: ", stringify!(_GValue)) 321 | ); 322 | assert_eq!( 323 | ::std::mem::align_of::<_GValue>(), 324 | 8usize, 325 | concat!("Alignment of ", stringify!(_GValue)) 326 | ); 327 | assert_eq!( 328 | unsafe { &(*(::std::ptr::null::<_GValue>())).g_type as *const _ as usize }, 329 | 0usize, 330 | concat!( 331 | "Offset of field: ", 332 | stringify!(_GValue), 333 | "::", 334 | stringify!(g_type) 335 | ) 336 | ); 337 | assert_eq!( 338 | unsafe { &(*(::std::ptr::null::<_GValue>())).data as *const _ as usize }, 339 | 8usize, 340 | concat!( 341 | "Offset of field: ", 342 | stringify!(_GValue), 343 | "::", 344 | stringify!(data) 345 | ) 346 | ); 347 | } 348 | pub const GParamFlags_G_PARAM_READABLE: GParamFlags = 1; 349 | pub const GParamFlags_G_PARAM_WRITABLE: GParamFlags = 2; 350 | pub const GParamFlags_G_PARAM_READWRITE: GParamFlags = 3; 351 | pub const GParamFlags_G_PARAM_CONSTRUCT: GParamFlags = 4; 352 | pub const GParamFlags_G_PARAM_CONSTRUCT_ONLY: GParamFlags = 8; 353 | pub const GParamFlags_G_PARAM_LAX_VALIDATION: GParamFlags = 16; 354 | pub const GParamFlags_G_PARAM_STATIC_NAME: GParamFlags = 32; 355 | pub const GParamFlags_G_PARAM_PRIVATE: GParamFlags = 32; 356 | pub const GParamFlags_G_PARAM_STATIC_NICK: GParamFlags = 64; 357 | pub const GParamFlags_G_PARAM_STATIC_BLURB: GParamFlags = 128; 358 | pub const GParamFlags_G_PARAM_EXPLICIT_NOTIFY: GParamFlags = 1073741824; 359 | pub const GParamFlags_G_PARAM_DEPRECATED: GParamFlags = -2147483648; 360 | #[doc = " GParamFlags:"] 361 | #[doc = " @G_PARAM_READABLE: the parameter is readable"] 362 | #[doc = " @G_PARAM_WRITABLE: the parameter is writable"] 363 | #[doc = " @G_PARAM_READWRITE: alias for %G_PARAM_READABLE | %G_PARAM_WRITABLE"] 364 | #[doc = " @G_PARAM_CONSTRUCT: the parameter will be set upon object construction"] 365 | #[doc = " @G_PARAM_CONSTRUCT_ONLY: the parameter can only be set upon object construction"] 366 | #[doc = " @G_PARAM_LAX_VALIDATION: upon parameter conversion (see g_param_value_convert())"] 367 | #[doc = " strict validation is not required"] 368 | #[doc = " @G_PARAM_STATIC_NAME: the string used as name when constructing the"] 369 | #[doc = " parameter is guaranteed to remain valid and"] 370 | #[doc = " unmodified for the lifetime of the parameter."] 371 | #[doc = " Since 2.8"] 372 | #[doc = " @G_PARAM_STATIC_NICK: the string used as nick when constructing the"] 373 | #[doc = " parameter is guaranteed to remain valid and"] 374 | #[doc = " unmmodified for the lifetime of the parameter."] 375 | #[doc = " Since 2.8"] 376 | #[doc = " @G_PARAM_STATIC_BLURB: the string used as blurb when constructing the"] 377 | #[doc = " parameter is guaranteed to remain valid and"] 378 | #[doc = " unmodified for the lifetime of the parameter."] 379 | #[doc = " Since 2.8"] 380 | #[doc = " @G_PARAM_EXPLICIT_NOTIFY: calls to g_object_set_property() for this"] 381 | #[doc = " property will not automatically result in a \"notify\" signal being"] 382 | #[doc = " emitted: the implementation must call g_object_notify() themselves"] 383 | #[doc = " in case the property actually changes. Since: 2.42."] 384 | #[doc = " @G_PARAM_PRIVATE: internal"] 385 | #[doc = " @G_PARAM_DEPRECATED: the parameter is deprecated and will be removed"] 386 | #[doc = " in a future version. A warning will be generated if it is used"] 387 | #[doc = " while running with G_ENABLE_DIAGNOSTIC=1."] 388 | #[doc = " Since 2.26"] 389 | #[doc = ""] 390 | #[doc = " Through the #GParamFlags flag values, certain aspects of parameters"] 391 | #[doc = " can be configured. See also #G_PARAM_STATIC_STRINGS."] 392 | pub type GParamFlags = i32; 393 | pub type GParamSpec = _GParamSpec; 394 | #[doc = " GParamSpec: (ref-func g_param_spec_ref_sink) (unref-func g_param_spec_uref) (set-value-func g_value_set_param) (get-value-func g_value_get_param)"] 395 | #[doc = " @g_type_instance: private #GTypeInstance portion"] 396 | #[doc = " @name: name of this parameter: always an interned string"] 397 | #[doc = " @flags: #GParamFlags flags for this parameter"] 398 | #[doc = " @value_type: the #GValue type for this parameter"] 399 | #[doc = " @owner_type: #GType type that uses (introduces) this parameter"] 400 | #[doc = ""] 401 | #[doc = " All other fields of the GParamSpec struct are private and"] 402 | #[doc = " should not be used directly."] 403 | #[repr(C)] 404 | #[derive(Debug, Copy, Clone)] 405 | pub struct _GParamSpec { 406 | pub g_type_instance: GTypeInstance, 407 | pub name: *const gchar, 408 | pub flags: GParamFlags, 409 | pub value_type: GType, 410 | pub owner_type: GType, 411 | pub _nick: *mut gchar, 412 | pub _blurb: *mut gchar, 413 | pub qdata: *mut GData, 414 | pub ref_count: guint, 415 | pub param_id: guint, 416 | } 417 | #[test] 418 | fn bindgen_test_layout__GParamSpec() { 419 | assert_eq!( 420 | ::std::mem::size_of::<_GParamSpec>(), 421 | 72usize, 422 | concat!("Size of: ", stringify!(_GParamSpec)) 423 | ); 424 | assert_eq!( 425 | ::std::mem::align_of::<_GParamSpec>(), 426 | 8usize, 427 | concat!("Alignment of ", stringify!(_GParamSpec)) 428 | ); 429 | assert_eq!( 430 | unsafe { &(*(::std::ptr::null::<_GParamSpec>())).g_type_instance as *const _ as usize }, 431 | 0usize, 432 | concat!( 433 | "Offset of field: ", 434 | stringify!(_GParamSpec), 435 | "::", 436 | stringify!(g_type_instance) 437 | ) 438 | ); 439 | assert_eq!( 440 | unsafe { &(*(::std::ptr::null::<_GParamSpec>())).name as *const _ as usize }, 441 | 8usize, 442 | concat!( 443 | "Offset of field: ", 444 | stringify!(_GParamSpec), 445 | "::", 446 | stringify!(name) 447 | ) 448 | ); 449 | assert_eq!( 450 | unsafe { &(*(::std::ptr::null::<_GParamSpec>())).flags as *const _ as usize }, 451 | 16usize, 452 | concat!( 453 | "Offset of field: ", 454 | stringify!(_GParamSpec), 455 | "::", 456 | stringify!(flags) 457 | ) 458 | ); 459 | assert_eq!( 460 | unsafe { &(*(::std::ptr::null::<_GParamSpec>())).value_type as *const _ as usize }, 461 | 24usize, 462 | concat!( 463 | "Offset of field: ", 464 | stringify!(_GParamSpec), 465 | "::", 466 | stringify!(value_type) 467 | ) 468 | ); 469 | assert_eq!( 470 | unsafe { &(*(::std::ptr::null::<_GParamSpec>())).owner_type as *const _ as usize }, 471 | 32usize, 472 | concat!( 473 | "Offset of field: ", 474 | stringify!(_GParamSpec), 475 | "::", 476 | stringify!(owner_type) 477 | ) 478 | ); 479 | assert_eq!( 480 | unsafe { &(*(::std::ptr::null::<_GParamSpec>()))._nick as *const _ as usize }, 481 | 40usize, 482 | concat!( 483 | "Offset of field: ", 484 | stringify!(_GParamSpec), 485 | "::", 486 | stringify!(_nick) 487 | ) 488 | ); 489 | assert_eq!( 490 | unsafe { &(*(::std::ptr::null::<_GParamSpec>()))._blurb as *const _ as usize }, 491 | 48usize, 492 | concat!( 493 | "Offset of field: ", 494 | stringify!(_GParamSpec), 495 | "::", 496 | stringify!(_blurb) 497 | ) 498 | ); 499 | assert_eq!( 500 | unsafe { &(*(::std::ptr::null::<_GParamSpec>())).qdata as *const _ as usize }, 501 | 56usize, 502 | concat!( 503 | "Offset of field: ", 504 | stringify!(_GParamSpec), 505 | "::", 506 | stringify!(qdata) 507 | ) 508 | ); 509 | assert_eq!( 510 | unsafe { &(*(::std::ptr::null::<_GParamSpec>())).ref_count as *const _ as usize }, 511 | 64usize, 512 | concat!( 513 | "Offset of field: ", 514 | stringify!(_GParamSpec), 515 | "::", 516 | stringify!(ref_count) 517 | ) 518 | ); 519 | assert_eq!( 520 | unsafe { &(*(::std::ptr::null::<_GParamSpec>())).param_id as *const _ as usize }, 521 | 68usize, 522 | concat!( 523 | "Offset of field: ", 524 | stringify!(_GParamSpec), 525 | "::", 526 | stringify!(param_id) 527 | ) 528 | ); 529 | } 530 | pub type GObject = _GObject; 531 | pub type GInitiallyUnowned = _GObject; 532 | #[doc = " GObject:"] 533 | #[doc = ""] 534 | #[doc = " All the fields in the GObject structure are private"] 535 | #[doc = " to the #GObject implementation and should never be accessed directly."] 536 | #[repr(C)] 537 | #[derive(Debug, Copy, Clone)] 538 | pub struct _GObject { 539 | pub g_type_instance: GTypeInstance, 540 | pub ref_count: guint, 541 | pub qdata: *mut GData, 542 | } 543 | #[test] 544 | fn bindgen_test_layout__GObject() { 545 | assert_eq!( 546 | ::std::mem::size_of::<_GObject>(), 547 | 24usize, 548 | concat!("Size of: ", stringify!(_GObject)) 549 | ); 550 | assert_eq!( 551 | ::std::mem::align_of::<_GObject>(), 552 | 8usize, 553 | concat!("Alignment of ", stringify!(_GObject)) 554 | ); 555 | assert_eq!( 556 | unsafe { &(*(::std::ptr::null::<_GObject>())).g_type_instance as *const _ as usize }, 557 | 0usize, 558 | concat!( 559 | "Offset of field: ", 560 | stringify!(_GObject), 561 | "::", 562 | stringify!(g_type_instance) 563 | ) 564 | ); 565 | assert_eq!( 566 | unsafe { &(*(::std::ptr::null::<_GObject>())).ref_count as *const _ as usize }, 567 | 8usize, 568 | concat!( 569 | "Offset of field: ", 570 | stringify!(_GObject), 571 | "::", 572 | stringify!(ref_count) 573 | ) 574 | ); 575 | assert_eq!( 576 | unsafe { &(*(::std::ptr::null::<_GObject>())).qdata as *const _ as usize }, 577 | 16usize, 578 | concat!( 579 | "Offset of field: ", 580 | stringify!(_GObject), 581 | "::", 582 | stringify!(qdata) 583 | ) 584 | ); 585 | } 586 | pub const GdkScrollDirection_GDK_SCROLL_UP: GdkScrollDirection = 0; 587 | pub const GdkScrollDirection_GDK_SCROLL_DOWN: GdkScrollDirection = 1; 588 | pub const GdkScrollDirection_GDK_SCROLL_LEFT: GdkScrollDirection = 2; 589 | pub const GdkScrollDirection_GDK_SCROLL_RIGHT: GdkScrollDirection = 3; 590 | pub const GdkScrollDirection_GDK_SCROLL_SMOOTH: GdkScrollDirection = 4; 591 | #[doc = " GdkScrollDirection:"] 592 | #[doc = " @GDK_SCROLL_UP: the window is scrolled up."] 593 | #[doc = " @GDK_SCROLL_DOWN: the window is scrolled down."] 594 | #[doc = " @GDK_SCROLL_LEFT: the window is scrolled to the left."] 595 | #[doc = " @GDK_SCROLL_RIGHT: the window is scrolled to the right."] 596 | #[doc = " @GDK_SCROLL_SMOOTH: the scrolling is determined by the delta values"] 597 | #[doc = " in #GdkEventScroll. See gdk_event_get_scroll_deltas(). Since: 3.4"] 598 | #[doc = ""] 599 | #[doc = " Specifies the direction for #GdkEventScroll."] 600 | pub type GdkScrollDirection = u32; 601 | #[repr(C)] 602 | #[derive(Debug, Copy, Clone)] 603 | pub struct _GtkWidgetPrivate { 604 | _unused: [u8; 0], 605 | } 606 | #[repr(C)] 607 | #[derive(Debug, Copy, Clone)] 608 | pub struct _GtkWidget { 609 | pub parent_instance: GInitiallyUnowned, 610 | pub priv_: *mut GtkWidgetPrivate, 611 | } 612 | #[test] 613 | fn bindgen_test_layout__GtkWidget() { 614 | assert_eq!( 615 | ::std::mem::size_of::<_GtkWidget>(), 616 | 32usize, 617 | concat!("Size of: ", stringify!(_GtkWidget)) 618 | ); 619 | assert_eq!( 620 | ::std::mem::align_of::<_GtkWidget>(), 621 | 8usize, 622 | concat!("Alignment of ", stringify!(_GtkWidget)) 623 | ); 624 | assert_eq!( 625 | unsafe { &(*(::std::ptr::null::<_GtkWidget>())).parent_instance as *const _ as usize }, 626 | 0usize, 627 | concat!( 628 | "Offset of field: ", 629 | stringify!(_GtkWidget), 630 | "::", 631 | stringify!(parent_instance) 632 | ) 633 | ); 634 | assert_eq!( 635 | unsafe { &(*(::std::ptr::null::<_GtkWidget>())).priv_ as *const _ as usize }, 636 | 24usize, 637 | concat!( 638 | "Offset of field: ", 639 | stringify!(_GtkWidget), 640 | "::", 641 | stringify!(priv_) 642 | ) 643 | ); 644 | } 645 | #[repr(C)] 646 | #[derive(Debug, Copy, Clone)] 647 | pub struct _GtkContainerPrivate { 648 | _unused: [u8; 0], 649 | } 650 | #[repr(C)] 651 | pub struct _GtkContainer { 652 | pub widget: GtkWidget, 653 | pub priv_: *mut GtkContainerPrivate, 654 | } 655 | #[test] 656 | fn bindgen_test_layout__GtkContainer() { 657 | assert_eq!( 658 | ::std::mem::size_of::<_GtkContainer>(), 659 | 40usize, 660 | concat!("Size of: ", stringify!(_GtkContainer)) 661 | ); 662 | assert_eq!( 663 | ::std::mem::align_of::<_GtkContainer>(), 664 | 8usize, 665 | concat!("Alignment of ", stringify!(_GtkContainer)) 666 | ); 667 | assert_eq!( 668 | unsafe { &(*(::std::ptr::null::<_GtkContainer>())).widget as *const _ as usize }, 669 | 0usize, 670 | concat!( 671 | "Offset of field: ", 672 | stringify!(_GtkContainer), 673 | "::", 674 | stringify!(widget) 675 | ) 676 | ); 677 | assert_eq!( 678 | unsafe { &(*(::std::ptr::null::<_GtkContainer>())).priv_ as *const _ as usize }, 679 | 32usize, 680 | concat!( 681 | "Offset of field: ", 682 | stringify!(_GtkContainer), 683 | "::", 684 | stringify!(priv_) 685 | ) 686 | ); 687 | } 688 | #[repr(C)] 689 | #[derive(Debug, Copy, Clone)] 690 | pub struct _GtkMenuShellPrivate { 691 | _unused: [u8; 0], 692 | } 693 | #[repr(C)] 694 | pub struct _GtkMenuShell { 695 | pub container: GtkContainer, 696 | pub priv_: *mut GtkMenuShellPrivate, 697 | } 698 | #[test] 699 | fn bindgen_test_layout__GtkMenuShell() { 700 | assert_eq!( 701 | ::std::mem::size_of::<_GtkMenuShell>(), 702 | 48usize, 703 | concat!("Size of: ", stringify!(_GtkMenuShell)) 704 | ); 705 | assert_eq!( 706 | ::std::mem::align_of::<_GtkMenuShell>(), 707 | 8usize, 708 | concat!("Alignment of ", stringify!(_GtkMenuShell)) 709 | ); 710 | assert_eq!( 711 | unsafe { &(*(::std::ptr::null::<_GtkMenuShell>())).container as *const _ as usize }, 712 | 0usize, 713 | concat!( 714 | "Offset of field: ", 715 | stringify!(_GtkMenuShell), 716 | "::", 717 | stringify!(container) 718 | ) 719 | ); 720 | assert_eq!( 721 | unsafe { &(*(::std::ptr::null::<_GtkMenuShell>())).priv_ as *const _ as usize }, 722 | 40usize, 723 | concat!( 724 | "Offset of field: ", 725 | stringify!(_GtkMenuShell), 726 | "::", 727 | stringify!(priv_) 728 | ) 729 | ); 730 | } 731 | #[repr(C)] 732 | #[derive(Debug, Copy, Clone)] 733 | pub struct _GtkMenuPrivate { 734 | _unused: [u8; 0], 735 | } 736 | #[repr(C)] 737 | pub struct _GtkMenu { 738 | pub menu_shell: GtkMenuShell, 739 | pub priv_: *mut GtkMenuPrivate, 740 | } 741 | #[test] 742 | fn bindgen_test_layout__GtkMenu() { 743 | assert_eq!( 744 | ::std::mem::size_of::<_GtkMenu>(), 745 | 56usize, 746 | concat!("Size of: ", stringify!(_GtkMenu)) 747 | ); 748 | assert_eq!( 749 | ::std::mem::align_of::<_GtkMenu>(), 750 | 8usize, 751 | concat!("Alignment of ", stringify!(_GtkMenu)) 752 | ); 753 | assert_eq!( 754 | unsafe { &(*(::std::ptr::null::<_GtkMenu>())).menu_shell as *const _ as usize }, 755 | 0usize, 756 | concat!( 757 | "Offset of field: ", 758 | stringify!(_GtkMenu), 759 | "::", 760 | stringify!(menu_shell) 761 | ) 762 | ); 763 | assert_eq!( 764 | unsafe { &(*(::std::ptr::null::<_GtkMenu>())).priv_ as *const _ as usize }, 765 | 48usize, 766 | concat!( 767 | "Offset of field: ", 768 | stringify!(_GtkMenu), 769 | "::", 770 | stringify!(priv_) 771 | ) 772 | ); 773 | } 774 | #[repr(C)] 775 | #[derive(Debug, Copy, Clone)] 776 | pub struct _GtkStatusIconPrivate { 777 | _unused: [u8; 0], 778 | } 779 | #[repr(C)] 780 | #[derive(Debug, Copy, Clone)] 781 | pub struct _GtkStatusIcon { 782 | pub parent_instance: GObject, 783 | pub priv_: *mut GtkStatusIconPrivate, 784 | } 785 | #[test] 786 | fn bindgen_test_layout__GtkStatusIcon() { 787 | assert_eq!( 788 | ::std::mem::size_of::<_GtkStatusIcon>(), 789 | 32usize, 790 | concat!("Size of: ", stringify!(_GtkStatusIcon)) 791 | ); 792 | assert_eq!( 793 | ::std::mem::align_of::<_GtkStatusIcon>(), 794 | 8usize, 795 | concat!("Alignment of ", stringify!(_GtkStatusIcon)) 796 | ); 797 | assert_eq!( 798 | unsafe { &(*(::std::ptr::null::<_GtkStatusIcon>())).parent_instance as *const _ as usize }, 799 | 0usize, 800 | concat!( 801 | "Offset of field: ", 802 | stringify!(_GtkStatusIcon), 803 | "::", 804 | stringify!(parent_instance) 805 | ) 806 | ); 807 | assert_eq!( 808 | unsafe { &(*(::std::ptr::null::<_GtkStatusIcon>())).priv_ as *const _ as usize }, 809 | 24usize, 810 | concat!( 811 | "Offset of field: ", 812 | stringify!(_GtkStatusIcon), 813 | "::", 814 | stringify!(priv_) 815 | ) 816 | ); 817 | } 818 | pub const AppIndicatorCategory_APP_INDICATOR_CATEGORY_APPLICATION_STATUS: AppIndicatorCategory = 0; 819 | pub const AppIndicatorCategory_APP_INDICATOR_CATEGORY_COMMUNICATIONS: AppIndicatorCategory = 1; 820 | pub const AppIndicatorCategory_APP_INDICATOR_CATEGORY_SYSTEM_SERVICES: AppIndicatorCategory = 2; 821 | pub const AppIndicatorCategory_APP_INDICATOR_CATEGORY_HARDWARE: AppIndicatorCategory = 3; 822 | pub const AppIndicatorCategory_APP_INDICATOR_CATEGORY_OTHER: AppIndicatorCategory = 4; 823 | #[doc = " AppIndicatorCategory:"] 824 | #[doc = " @APP_INDICATOR_CATEGORY_APPLICATION_STATUS: The indicator is used to display the status of the application."] 825 | #[doc = " @APP_INDICATOR_CATEGORY_COMMUNICATIONS: The application is used for communication with other people."] 826 | #[doc = " @APP_INDICATOR_CATEGORY_SYSTEM_SERVICES: A system indicator relating to something in the user's system."] 827 | #[doc = " @APP_INDICATOR_CATEGORY_HARDWARE: An indicator relating to the user's hardware."] 828 | #[doc = " @APP_INDICATOR_CATEGORY_OTHER: Something not defined in this enum, please don't use unless you really need it."] 829 | #[doc = ""] 830 | #[doc = " The category provides grouping for the indicators so that"] 831 | #[doc = " users can find indicators that are similar together."] 832 | pub type AppIndicatorCategory = u32; 833 | pub const AppIndicatorStatus_APP_INDICATOR_STATUS_PASSIVE: AppIndicatorStatus = 0; 834 | pub const AppIndicatorStatus_APP_INDICATOR_STATUS_ACTIVE: AppIndicatorStatus = 1; 835 | pub const AppIndicatorStatus_APP_INDICATOR_STATUS_ATTENTION: AppIndicatorStatus = 2; 836 | #[doc = " AppIndicatorStatus:"] 837 | #[doc = " @APP_INDICATOR_STATUS_PASSIVE: The indicator should not be shown to the user."] 838 | #[doc = " @APP_INDICATOR_STATUS_ACTIVE: The indicator should be shown in it's default state."] 839 | #[doc = " @APP_INDICATOR_STATUS_ATTENTION: The indicator should show it's attention icon."] 840 | #[doc = ""] 841 | #[doc = " These are the states that the indicator can be on in"] 842 | #[doc = " the user's panel. The indicator by default starts"] 843 | #[doc = " in the state @APP_INDICATOR_STATUS_PASSIVE and can be"] 844 | #[doc = " shown by setting it to @APP_INDICATOR_STATUS_ACTIVE."] 845 | pub type AppIndicatorStatus = u32; 846 | pub type AppIndicator = _AppIndicator; 847 | #[repr(C)] 848 | #[derive(Debug, Copy, Clone)] 849 | pub struct _AppIndicatorPrivate { 850 | _unused: [u8; 0], 851 | } 852 | pub type AppIndicatorPrivate = _AppIndicatorPrivate; 853 | #[doc = " AppIndicator:"] 854 | #[doc = ""] 855 | #[doc = " A application indicator represents the values that are needed to show a"] 856 | #[doc = " unique status in the panel for an application. In general, applications"] 857 | #[doc = " should try to fit in the other indicators that are available on the"] 858 | #[doc = " panel before using this. But, sometimes it is necissary."] 859 | #[doc = ""] 860 | #[doc = " Private fields"] 861 | #[doc = " @parent: Parent object."] 862 | #[doc = " @priv: Internal data."] 863 | #[repr(C)] 864 | #[derive(Debug, Copy, Clone)] 865 | pub struct _AppIndicator { 866 | pub parent: GObject, 867 | pub priv_: *mut AppIndicatorPrivate, 868 | } 869 | #[test] 870 | fn bindgen_test_layout__AppIndicator() { 871 | assert_eq!( 872 | ::std::mem::size_of::<_AppIndicator>(), 873 | 32usize, 874 | concat!("Size of: ", stringify!(_AppIndicator)) 875 | ); 876 | assert_eq!( 877 | ::std::mem::align_of::<_AppIndicator>(), 878 | 8usize, 879 | concat!("Alignment of ", stringify!(_AppIndicator)) 880 | ); 881 | assert_eq!( 882 | unsafe { &(*(::std::ptr::null::<_AppIndicator>())).parent as *const _ as usize }, 883 | 0usize, 884 | concat!( 885 | "Offset of field: ", 886 | stringify!(_AppIndicator), 887 | "::", 888 | stringify!(parent) 889 | ) 890 | ); 891 | assert_eq!( 892 | unsafe { &(*(::std::ptr::null::<_AppIndicator>())).priv_ as *const _ as usize }, 893 | 24usize, 894 | concat!( 895 | "Offset of field: ", 896 | stringify!(_AppIndicator), 897 | "::", 898 | stringify!(priv_) 899 | ) 900 | ); 901 | } 902 | 903 | pub unsafe fn app_indicator_get_type() -> GType { 904 | let f = LIB 905 | .get:: GType>(b"app_indicator_get_type\0") 906 | .expect( 907 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 908 | ); 909 | f() 910 | } 911 | 912 | // TODO use OnceCell to store symbols. 913 | pub unsafe fn app_indicator_new( 914 | id: *const gchar, 915 | icon_name: *const gchar, 916 | category: AppIndicatorCategory, 917 | ) -> *mut AppIndicator { 918 | let f = LIB.get:: *mut AppIndicator>(b"app_indicator_new\0") 919 | .expect("Can't get the extern function. This shouldn't happen unless the linked library is wrong."); 920 | f(id, icon_name, category) 921 | } 922 | 923 | pub unsafe fn app_indicator_new_with_path( 924 | id: *const gchar, 925 | icon_name: *const gchar, 926 | category: AppIndicatorCategory, 927 | icon_theme_path: *const gchar, 928 | ) -> *mut AppIndicator { 929 | let f = LIB 930 | .get:: *mut AppIndicator>(b"app_indicator_new_with_path\0") 936 | .expect( 937 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 938 | ); 939 | f(id, icon_name, category, icon_theme_path) 940 | } 941 | 942 | pub unsafe fn app_indicator_set_status(self_: *mut AppIndicator, status: AppIndicatorStatus) { 943 | let f = LIB 944 | .get::( 945 | b"app_indicator_set_status\0", 946 | ) 947 | .expect( 948 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 949 | ); 950 | f(self_, status) 951 | } 952 | 953 | pub unsafe fn app_indicator_set_attention_icon(self_: *mut AppIndicator, icon_name: *const gchar) { 954 | let f = LIB 955 | .get::( 956 | b"app_indicator_set_attention_icon\0", 957 | ) 958 | .expect( 959 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 960 | ); 961 | f(self_, icon_name) 962 | } 963 | 964 | pub unsafe fn app_indicator_set_attention_icon_full( 965 | self_: *mut AppIndicator, 966 | icon_name: *const gchar, 967 | icon_desc: *const gchar, 968 | ) { 969 | let f = LIB 970 | .get::( 971 | b"app_indicator_set_attention_icon_full\0", 972 | ) 973 | .expect( 974 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 975 | ); 976 | f(self_, icon_name, icon_desc) 977 | } 978 | 979 | pub unsafe fn app_indicator_set_menu(self_: *mut AppIndicator, menu: *mut GtkMenu) { 980 | let f = LIB 981 | .get::(b"app_indicator_set_menu\0") 982 | .expect( 983 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 984 | ); 985 | f(self_, menu) 986 | } 987 | 988 | pub unsafe fn app_indicator_set_icon(self_: *mut AppIndicator, icon_name: *const gchar) { 989 | let f = LIB 990 | .get::(b"app_indicator_set_icon\0") 991 | .expect( 992 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 993 | ); 994 | f(self_, icon_name) 995 | } 996 | pub unsafe fn app_indicator_set_icon_full( 997 | self_: *mut AppIndicator, 998 | icon_name: *const gchar, 999 | icon_desc: *const gchar, 1000 | ) { 1001 | let f = LIB 1002 | .get::( 1003 | b"app_indicator_set_icon_full\0", 1004 | ) 1005 | .expect( 1006 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1007 | ); 1008 | f(self_, icon_name, icon_desc) 1009 | } 1010 | 1011 | pub unsafe fn app_indicator_set_label( 1012 | self_: *mut AppIndicator, 1013 | label: *const gchar, 1014 | guide: *const gchar, 1015 | ) { 1016 | let f = LIB 1017 | .get::( 1018 | b"app_indicator_set_label\0", 1019 | ) 1020 | .expect( 1021 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1022 | ); 1023 | f(self_, label, guide) 1024 | } 1025 | 1026 | pub unsafe fn app_indicator_set_icon_theme_path( 1027 | self_: *mut AppIndicator, 1028 | icon_theme_path: *const gchar, 1029 | ) { 1030 | let f = LIB 1031 | .get::( 1032 | b"app_indicator_set_icon_theme_path\0", 1033 | ) 1034 | .expect( 1035 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1036 | ); 1037 | f(self_, icon_theme_path) 1038 | } 1039 | 1040 | pub unsafe fn app_indicator_set_ordering_index(self_: *mut AppIndicator, ordering_index: guint32) { 1041 | let f = LIB 1042 | .get::(b"app_indicator_set_ordering_index\0") 1043 | .expect( 1044 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1045 | ); 1046 | f(self_, ordering_index) 1047 | } 1048 | 1049 | pub unsafe fn app_indicator_set_secondary_activate_target( 1050 | self_: *mut AppIndicator, 1051 | menuitem: *mut GtkWidget, 1052 | ) { 1053 | let f = LIB 1054 | .get::( 1055 | b"app_indicator_set_secondary_activate_target\0", 1056 | ) 1057 | .expect( 1058 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1059 | ); 1060 | f(self_, menuitem) 1061 | } 1062 | 1063 | pub unsafe fn app_indicator_set_title(self_: *mut AppIndicator, title: *const gchar) { 1064 | let f = LIB 1065 | .get::(b"app_indicator_set_title\0") 1066 | .expect( 1067 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1068 | ); 1069 | f(self_, title) 1070 | } 1071 | 1072 | pub unsafe fn app_indicator_get_id(self_: *mut AppIndicator) -> *const gchar { 1073 | let f = LIB 1074 | .get:: *const gchar>(b"app_indicator_get_id\0") 1075 | .expect( 1076 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1077 | ); 1078 | f(self_) 1079 | } 1080 | 1081 | pub unsafe fn app_indicator_get_category(self_: *mut AppIndicator) -> AppIndicatorCategory { 1082 | let f = LIB 1083 | .get:: AppIndicatorCategory>( 1084 | b"app_indicator_get_category\0", 1085 | ) 1086 | .expect( 1087 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1088 | ); 1089 | f(self_) 1090 | } 1091 | 1092 | pub unsafe fn app_indicator_get_status(self_: *mut AppIndicator) -> AppIndicatorStatus { 1093 | let f = LIB 1094 | .get:: AppIndicatorStatus>( 1095 | b"app_indicator_get_status\0", 1096 | ) 1097 | .expect( 1098 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1099 | ); 1100 | f(self_) 1101 | } 1102 | 1103 | pub unsafe fn app_indicator_get_icon(self_: *mut AppIndicator) -> *const gchar { 1104 | let f = LIB 1105 | .get:: *const gchar>(b"app_indicator_get_icon\0") 1106 | .expect( 1107 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1108 | ); 1109 | f(self_) 1110 | } 1111 | 1112 | pub unsafe fn app_indicator_get_icon_desc(self_: *mut AppIndicator) -> *const gchar { 1113 | let f = LIB 1114 | .get:: *const gchar>( 1115 | b"app_indicator_get_icon_desc\0", 1116 | ) 1117 | .expect( 1118 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1119 | ); 1120 | f(self_) 1121 | } 1122 | 1123 | pub unsafe fn app_indicator_get_icon_theme_path(self_: *mut AppIndicator) -> *const gchar { 1124 | let f = LIB 1125 | .get:: *const gchar>( 1126 | b"app_indicator_get_icon_theme_path\0", 1127 | ) 1128 | .expect( 1129 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1130 | ); 1131 | f(self_) 1132 | } 1133 | 1134 | pub unsafe fn app_indicator_get_attention_icon(self_: *mut AppIndicator) -> *const gchar { 1135 | let f = LIB 1136 | .get:: *const gchar>( 1137 | b"app_indicator_get_attention_icon\0", 1138 | ) 1139 | .expect( 1140 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1141 | ); 1142 | f(self_) 1143 | } 1144 | 1145 | pub unsafe fn app_indicator_get_attention_icon_desc(self_: *mut AppIndicator) -> *const gchar { 1146 | let f = LIB 1147 | .get:: *const gchar>( 1148 | b"app_indicator_get_attention_icon_desc\0", 1149 | ) 1150 | .expect( 1151 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1152 | ); 1153 | f(self_) 1154 | } 1155 | 1156 | pub unsafe fn app_indicator_get_title(self_: *mut AppIndicator) -> *const gchar { 1157 | let f = LIB 1158 | .get:: *const gchar>(b"app_indicator_get_title\0") 1159 | .expect( 1160 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1161 | ); 1162 | f(self_) 1163 | } 1164 | 1165 | pub unsafe fn app_indicator_get_menu(self_: *mut AppIndicator) -> *mut GtkMenu { 1166 | let f = LIB 1167 | .get:: *mut GtkMenu>(b"app_indicator_get_menu\0") 1168 | .expect( 1169 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1170 | ); 1171 | f(self_) 1172 | } 1173 | 1174 | pub unsafe fn app_indicator_get_label(self_: *mut AppIndicator) -> *const gchar { 1175 | let f = LIB 1176 | .get:: *const gchar>(b"app_indicator_get_label\0") 1177 | .expect( 1178 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1179 | ); 1180 | f(self_) 1181 | } 1182 | 1183 | pub unsafe fn app_indicator_get_label_guide(self_: *mut AppIndicator) -> *const gchar { 1184 | let f = LIB 1185 | .get:: *const gchar>( 1186 | b"app_indicator_get_label_guide\0", 1187 | ) 1188 | .expect( 1189 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1190 | ); 1191 | f(self_) 1192 | } 1193 | 1194 | pub unsafe fn app_indicator_get_ordering_index(self_: *mut AppIndicator) -> guint32 { 1195 | let f = LIB 1196 | .get:: guint32>( 1197 | b"app_indicator_get_ordering_index\0", 1198 | ) 1199 | .expect( 1200 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1201 | ); 1202 | f(self_) 1203 | } 1204 | 1205 | pub unsafe fn app_indicator_get_secondary_activate_target( 1206 | self_: *mut AppIndicator, 1207 | ) -> *mut GtkWidget { 1208 | let f = LIB 1209 | .get:: *mut GtkWidget>( 1210 | b"app_indicator_get_secondary_activate_target\0", 1211 | ) 1212 | .expect( 1213 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1214 | ); 1215 | f(self_) 1216 | } 1217 | 1218 | pub unsafe fn app_indicator_build_menu_from_desktop( 1219 | self_: *mut AppIndicator, 1220 | desktop_file: *const gchar, 1221 | desktop_profile: *const gchar, 1222 | ) { 1223 | let f = LIB 1224 | .get::( 1225 | b"app_indicator_build_menu_from_desktop\0", 1226 | ) 1227 | .expect( 1228 | "Can't get the extern function. This shouldn't happen unless the linked library is wrong.", 1229 | ); 1230 | f(self_, desktop_file, desktop_profile) 1231 | } 1232 | --------------------------------------------------------------------------------