├── .clang-format ├── .github └── workflows │ ├── check_q_decl_export.yaml │ ├── documentation.yaml │ ├── format.yaml │ ├── pr.yaml │ └── test.yaml ├── CONTRIBUTING.md ├── COPYING.LGPL2 ├── COPYING.LGPL3 ├── NEWS ├── README.md ├── doc ├── meson.build └── settings.toml.in ├── examples ├── meson.build ├── snap-glib.c └── snapctl-glib.c ├── format-source.sh ├── meson.build ├── meson_options.txt ├── po ├── LINGUAS ├── POTFILES.in └── meson.build ├── snapd-glib.doap ├── snapd-glib ├── meson.build ├── requests │ ├── snapd-get-aliases.c │ ├── snapd-get-aliases.h │ ├── snapd-get-apps.c │ ├── snapd-get-apps.h │ ├── snapd-get-assertions.c │ ├── snapd-get-assertions.h │ ├── snapd-get-buy-ready.c │ ├── snapd-get-buy-ready.h │ ├── snapd-get-categories.c │ ├── snapd-get-categories.h │ ├── snapd-get-change.c │ ├── snapd-get-change.h │ ├── snapd-get-changes.c │ ├── snapd-get-changes.h │ ├── snapd-get-connections.c │ ├── snapd-get-connections.h │ ├── snapd-get-find.c │ ├── snapd-get-find.h │ ├── snapd-get-icon.c │ ├── snapd-get-icon.h │ ├── snapd-get-interfaces-legacy.c │ ├── snapd-get-interfaces-legacy.h │ ├── snapd-get-interfaces.c │ ├── snapd-get-interfaces.h │ ├── snapd-get-logs.c │ ├── snapd-get-logs.h │ ├── snapd-get-model-serial.c │ ├── snapd-get-model-serial.h │ ├── snapd-get-model.c │ ├── snapd-get-model.h │ ├── snapd-get-notices.c │ ├── snapd-get-notices.h │ ├── snapd-get-sections.c │ ├── snapd-get-sections.h │ ├── snapd-get-snap-conf.c │ ├── snapd-get-snap-conf.h │ ├── snapd-get-snap.c │ ├── snapd-get-snap.h │ ├── snapd-get-snaps.c │ ├── snapd-get-snaps.h │ ├── snapd-get-system-info.c │ ├── snapd-get-system-info.h │ ├── snapd-get-themes.c │ ├── snapd-get-themes.h │ ├── snapd-get-users.c │ ├── snapd-get-users.h │ ├── snapd-json.c │ ├── snapd-json.h │ ├── snapd-post-aliases.c │ ├── snapd-post-aliases.h │ ├── snapd-post-assertions.c │ ├── snapd-post-assertions.h │ ├── snapd-post-buy.c │ ├── snapd-post-buy.h │ ├── snapd-post-change.c │ ├── snapd-post-change.h │ ├── snapd-post-create-user.c │ ├── snapd-post-create-user.h │ ├── snapd-post-create-users.c │ ├── snapd-post-create-users.h │ ├── snapd-post-download.c │ ├── snapd-post-download.h │ ├── snapd-post-interfaces.c │ ├── snapd-post-interfaces.h │ ├── snapd-post-login.c │ ├── snapd-post-login.h │ ├── snapd-post-logout.c │ ├── snapd-post-logout.h │ ├── snapd-post-snap-stream.c │ ├── snapd-post-snap-stream.h │ ├── snapd-post-snap-try.c │ ├── snapd-post-snap-try.h │ ├── snapd-post-snap.c │ ├── snapd-post-snap.h │ ├── snapd-post-snapctl.c │ ├── snapd-post-snapctl.h │ ├── snapd-post-snaps.c │ ├── snapd-post-snaps.h │ ├── snapd-post-themes.c │ ├── snapd-post-themes.h │ ├── snapd-put-snap-conf.c │ ├── snapd-put-snap-conf.h │ ├── snapd-request-async.c │ ├── snapd-request-async.h │ ├── snapd-request.c │ └── snapd-request.h ├── snapd-alias.c ├── snapd-alias.h ├── snapd-app.c ├── snapd-app.h ├── snapd-assertion.c ├── snapd-assertion.h ├── snapd-auth-data.c ├── snapd-auth-data.h ├── snapd-autorefresh-change-data.c ├── snapd-autorefresh-change-data.h ├── snapd-category-details.c ├── snapd-category-details.h ├── snapd-category.c ├── snapd-category.h ├── snapd-change-data.c ├── snapd-change-data.h ├── snapd-change.c ├── snapd-change.h ├── snapd-channel.c ├── snapd-channel.h ├── snapd-client-sync.c ├── snapd-client.c ├── snapd-client.h ├── snapd-connection.c ├── snapd-connection.h ├── snapd-enum-types.c.in ├── snapd-enum-types.h.in ├── snapd-error.c ├── snapd-error.h ├── snapd-glib.h ├── snapd-glib.map ├── snapd-glib.pc.in ├── snapd-icon.c ├── snapd-icon.h ├── snapd-interface.c ├── snapd-interface.h ├── snapd-link.c ├── snapd-link.h ├── snapd-log.c ├── snapd-log.h ├── snapd-login.c ├── snapd-login.h ├── snapd-maintenance.c ├── snapd-maintenance.h ├── snapd-markdown-node.c ├── snapd-markdown-node.h ├── snapd-markdown-parser.c ├── snapd-markdown-parser.h ├── snapd-media.c ├── snapd-media.h ├── snapd-notice.c ├── snapd-notice.h ├── snapd-notices-monitor.c ├── snapd-notices-monitor.h ├── snapd-plug-ref.c ├── snapd-plug-ref.h ├── snapd-plug.c ├── snapd-plug.h ├── snapd-price.c ├── snapd-price.h ├── snapd-screenshot.c ├── snapd-screenshot.h ├── snapd-slot-ref.c ├── snapd-slot-ref.h ├── snapd-slot.c ├── snapd-slot.h ├── snapd-snap.c ├── snapd-snap.h ├── snapd-system-information.c ├── snapd-system-information.h ├── snapd-task-data.c ├── snapd-task-data.h ├── snapd-task.c ├── snapd-task.h ├── snapd-user-information.c ├── snapd-user-information.h └── snapd-version.h ├── snapd-qt ├── Snapd │ ├── Alias │ ├── App │ ├── Assertion │ ├── AuthData │ ├── Category │ ├── CategoryDetails │ ├── Change │ ├── Channel │ ├── Client │ ├── Connection │ ├── Enums │ ├── Icon │ ├── Interface │ ├── Link │ ├── Maintenance │ ├── MarkdownNode │ ├── MarkdownParser │ ├── Media │ ├── Notice │ ├── Plug │ ├── PlugRef │ ├── Price │ ├── Request │ ├── Screenshot │ ├── Slot │ ├── SlotRef │ ├── Snap │ ├── SystemInformation │ ├── Task │ ├── TaskData │ ├── UserInformation │ ├── WrappedObject │ ├── alias.h │ ├── app.h │ ├── assertion.h │ ├── auth-data.h │ ├── category-details.h │ ├── category.h │ ├── change-autorefresh-data.h │ ├── change-data.h │ ├── change.h │ ├── channel.h │ ├── client.h │ ├── connection.h │ ├── enums.h │ ├── icon.h │ ├── interface.h │ ├── link.h │ ├── maintenance.h │ ├── markdown-node.h │ ├── markdown-parser.h │ ├── media.h │ ├── notice.h │ ├── plug-ref.h │ ├── plug.h │ ├── price.h │ ├── request.h │ ├── screenshot.h │ ├── slot-ref.h │ ├── slot.h │ ├── snap.h │ ├── snapdqt_global.h │ ├── system-information.h │ ├── task-data.h │ ├── task.h │ ├── user-information.h │ └── wrapped-object.h ├── SnapdQt5Config.cmake.in ├── SnapdQt5ConfigVersion.cmake.in ├── SnapdQt6Config.cmake.in ├── SnapdQt6ConfigVersion.cmake.in ├── alias.cpp ├── app.cpp ├── assertion.cpp ├── auth-data.cpp ├── category-details.cpp ├── category.cpp ├── change-autorefresh-data.cpp ├── change-data.cpp ├── change.cpp ├── channel.cpp ├── client-private.h ├── client.cpp ├── connection.cpp ├── icon.cpp ├── interface.cpp ├── link.cpp ├── maintenance.cpp ├── markdown-node.cpp ├── markdown-parser.cpp ├── media.cpp ├── meson.build ├── notice.cpp ├── plug-ref.cpp ├── plug.cpp ├── price.cpp ├── qml-plugin.cpp ├── qml-plugin.h ├── qmldir ├── request.cpp ├── screenshot.cpp ├── slot-ref.cpp ├── slot.cpp ├── snap.cpp ├── snapd-qt.pc.in ├── stream-wrapper.cpp ├── stream-wrapper.h ├── system-information.cpp ├── task-data.cpp ├── task.cpp ├── user-information.cpp └── variant.h └── tests ├── meson.build ├── mock-snapd.c ├── mock-snapd.h ├── test-glib.c ├── test-glib.test.in ├── test-markdown-glib.c ├── test-markdown-glib.test.in ├── test-markdown-qt.cpp ├── test-markdown-qt5.test.in ├── test-markdown-qt6.test.in ├── test-qt.cpp ├── test-qt.h ├── test-qt5.test.in └── test-qt6.test.in /.clang-format: -------------------------------------------------------------------------------- 1 | ReflowComments: false 2 | -------------------------------------------------------------------------------- /.github/workflows/check_q_decl_export.yaml: -------------------------------------------------------------------------------- 1 | name: Verify no Q_DECL_EXPORT is used 2 | 3 | on: 4 | pull_request: 5 | push: 6 | branches: 7 | - master 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | - name: Verify no Q_DECL_EXPORT is used 16 | run: | 17 | if grep Q_DECL_EXPORT snapd-qt/Snapd/*.h ; then 18 | echo There are Q_DECL_EXPORT definitions in the Qt headers!!! 19 | echo Replace them with LIBSNAPDQT_EXPORT 20 | echo See https://github.com/canonical/snapd-glib/issues/175 21 | exit 1 22 | fi 23 | -------------------------------------------------------------------------------- /.github/workflows/documentation.yaml: -------------------------------------------------------------------------------- 1 | name: documentation 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | permissions: 9 | contents: read 10 | pages: write 11 | id-token: write 12 | 13 | concurrency: 14 | group: "pages" 15 | cancel-in-progress: false 16 | 17 | jobs: 18 | # Build job 19 | build: 20 | runs-on: ubuntu-latest 21 | container: 22 | image: ubuntu:rolling 23 | steps: 24 | - name: Checkout 25 | uses: actions/checkout@v4 26 | - name: Setup Pages 27 | uses: actions/configure-pages@v5 28 | - name: Install dependencies (Ubuntu) 29 | run: | 30 | apt-get update 31 | DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends meson ninja-build gi-docgen libgirepository1.0-dev libglib2.0-dev libjson-glib-dev ninja-build python3-pip python3-setuptools python3-wheel valac libsoup-3.0-dev qt6-base-dev qt6-declarative-dev 32 | - name: Build documentation 33 | run: | 34 | meson setup _build -Ddocs=true -Dqt5=false -Dqt6=false 35 | ninja -C _build 36 | mkdir -p ./_site 37 | cp -v -a ./_build/doc/snapd-glib/* ./_site/ 38 | - name: Upload artifact 39 | uses: actions/upload-pages-artifact@v3 40 | 41 | # Deployment job 42 | deploy: 43 | environment: 44 | name: github-pages 45 | url: ${{ steps.deployment.outputs.page_url }} 46 | runs-on: ubuntu-latest 47 | needs: build 48 | steps: 49 | - name: Deploy to GitHub Pages 50 | id: deployment 51 | uses: actions/deploy-pages@v4 52 | 53 | -------------------------------------------------------------------------------- /.github/workflows/format.yaml: -------------------------------------------------------------------------------- 1 | name: Formatting 2 | 3 | on: 4 | pull_request: 5 | push: 6 | branches: 7 | - master 8 | 9 | jobs: 10 | build: 11 | runs-on: ubuntu-24.04 12 | 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - name: Verify formatting 17 | run: | 18 | ./format-source.sh check 19 | -------------------------------------------------------------------------------- /.github/workflows/pr.yaml: -------------------------------------------------------------------------------- 1 | name: Check if CLA is signed 2 | on: 3 | pull_request: 4 | 5 | jobs: 6 | cla-check: 7 | name: Check if CLA is signed 8 | runs-on: ubuntu-latest 9 | steps: 10 | - name: Check if CLA signed 11 | uses: canonical/has-signed-canonical-cla@v2 12 | with: 13 | accept-existing-contributors: true 14 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## snapd-glib 2 | 3 | snapd-glib is a library to allow GLib based applications access to snapd, the daemon that controls Snaps. 4 | A snapd-qt library is provided that wraps snapd-glib for Qt based applications. 5 | The following languages / platforms are supported: 6 | * C 7 | * C++ 8 | * Vala 9 | * Python (using GObject introspection) 10 | * Javacript (using GObject introspection) 11 | * Qt 12 | * QML 13 | 14 | Documentation is available [online](https://canonical.github.io/snapd-glib/). See [snapcraft.io](https://snapcraft.io) for more information on snapd. 15 | 16 | ## Contributing 17 | 18 | If you want to contribute with the project, please, read first the CONTRIBUTING.md file. 19 | 20 | When sending a patch, always ensure that the tests do work and that the coding style test 21 | passes. For the latter, the best way is to edit the `.git/hooks/pre-commit` script and set 22 | it to 23 | 24 | #!/bin/sh 25 | ./format-source.sh check 26 | 27 | Also, just manually running `./format-source.sh` script, without parameters, will do an 28 | automatic formatting. 29 | 30 | ## Reporting bugs 31 | 32 | If you have found an issue with the application, please [file an issue](https://github.com/canonical/snapd-glib/issues/new) on the [issues list on GitHub](https://github.com/snapcore/snapd-glib/issues). 33 | -------------------------------------------------------------------------------- /doc/meson.build: -------------------------------------------------------------------------------- 1 | if get_option ('docs') 2 | docgen = find_program('gi-docgen') 3 | 4 | doc_conf = configuration_data () 5 | doc_conf.set ('PROJECT_VERSION', meson.project_version ()) 6 | settings_file = configure_file (input: 'settings.toml.in', 7 | output: 'settings.toml', 8 | configuration: doc_conf) 9 | custom_target('documentation', 10 | depends: snapd_glib_gir, 11 | command : [docgen, 'generate', '--config', settings_file, '--no-namespace-dir', '--output-dir', join_paths('@OUTDIR@', 'snapd-glib'), join_paths (meson.project_build_root (), 'snapd-glib', 'Snapd-2.gir')], 12 | output: 'snapd-glib', 13 | build_by_default: true, 14 | install: true, 15 | install_dir: get_option('prefix') / get_option('datadir') / 'doc',) # installs to PREFIX/share/doc/snapd-glib 16 | endif 17 | -------------------------------------------------------------------------------- /doc/settings.toml.in: -------------------------------------------------------------------------------- 1 | [library] 2 | description = "The Snapd-GLib library" 3 | license = "LGPL-2, LGPL-3" 4 | version = "@PROJECT_VERSION@" 5 | repository_url = "https://github.com/canonical/snapd-glib" 6 | devhelp = true 7 | search_index = true 8 | 9 | [theme] 10 | name = "basic" 11 | show_index_summary = true 12 | show_class_hierarchy = true 13 | 14 | [source-location] 15 | base_url = "https://github.com/canonical/snapd-glib/tree/main" 16 | -------------------------------------------------------------------------------- /examples/meson.build: -------------------------------------------------------------------------------- 1 | executable ('snap-glib', 2 | 'snap-glib.c', 3 | dependencies: [snapd_glib_dep, gio_dep]) 4 | 5 | executable ('snapctl-glib', 6 | 'snapctl-glib.c', 7 | dependencies: [snapd_glib_dep, gio_dep]) 8 | -------------------------------------------------------------------------------- /examples/snapctl-glib.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include 13 | #include 14 | 15 | int main (int argc, char **argv) 16 | { 17 | g_autoptr(SnapdClient) client = snapd_client_new (); 18 | g_autoptr(GError) error = NULL; 19 | const char *context; 20 | g_autofree GStrv args = NULL; 21 | g_autofree gchar *stdout_output = NULL; 22 | g_autofree gchar *stderr_output = NULL; 23 | int exit_code, i; 24 | 25 | /* snapctl commands are sent over a different socket that is made 26 | * available within the snap sandbox */ 27 | snapd_client_set_socket_path (client, "/run/snapd-snap.socket"); 28 | 29 | /* Take context from the environment if available */ 30 | context = g_getenv ("SNAP_COOKIE"); 31 | if (!context) 32 | context = ""; 33 | 34 | /* run_snapctl expects a NULL terminated argument array */ 35 | args = g_new0 (char *, argc); 36 | for (i = 0; i < argc-1; i++) 37 | args[i] = argv[i+1]; 38 | 39 | if (!snapd_client_run_snapctl2_sync (client, context, args, &stdout_output, &stderr_output, &exit_code, NULL, &error)) { 40 | fprintf (stderr, "error: %s\n", error->message); 41 | return 1; 42 | } 43 | if (stdout_output) { 44 | fputs (stdout_output, stdout); 45 | } 46 | if (stderr_output) { 47 | fputs (stderr_output, stderr); 48 | } 49 | return exit_code; 50 | } 51 | -------------------------------------------------------------------------------- /format-source.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SOURCE_FILES="snapd-glib/*.[ch] snapd-glib/requests/*.[ch] snapd-qt/*.cpp snapd-qt/*.h snapd-qt/Snapd/*.h tests/*.[ch] tests/*.cpp" 4 | 5 | if [[ "$1" == "pre-commit" ]]; then 6 | echo Checking source style 7 | PRE_COMMIT=1 8 | else 9 | PRE_COMMIT=0 10 | fi 11 | 12 | passed=true 13 | for file in $SOURCE_FILES; do 14 | if [ $# -eq 0 ]; then 15 | # no parameters? Just apply the changes 16 | echo Formating $file 17 | clang-format -i $file 18 | else 19 | # any parameter? check that the formatting is fine 20 | clang-format $file > $file.formatted 21 | echo Checking $file 22 | if [ $PRE_COMMIT -eq 0 ]; then 23 | diff $file $file.formatted 24 | else 25 | diff $file $file.formatted > /dev/null 26 | fi 27 | if [ $? != 0 ]; then 28 | passed=false 29 | fi 30 | rm $file.formatted 31 | fi 32 | done 33 | if [ $passed = false ]; then 34 | echo Failed to pass clang-format check 35 | exit 1 36 | fi 37 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project ('snapd-glib', [ 'c', 'cpp' ], 2 | version: '1.70', 3 | meson_version: '>= 0.58.0', 4 | default_options : [ 'c_std=c11' ]) 5 | 6 | 7 | glib_dep = dependency ('glib-2.0', version: '>= 2.46') 8 | gio_dep = dependency ('gio-2.0', version: '>= 2.46') 9 | gio_unix_dep = dependency ('gio-unix-2.0', version: '>= 2.46') 10 | 11 | build_introspection = get_option ('introspection') 12 | if get_option('docs') 13 | build_introspection = true 14 | endif 15 | 16 | if get_option('soup2') 17 | libsoup_dep = dependency ('libsoup-2.4', version: '>= 2.32') 18 | else 19 | libsoup_dep = dependency ('libsoup-3.0', version: '>= 2.99.2') 20 | endif 21 | json_glib_dep = dependency ('json-glib-1.0', version: '>= 1.1.2') 22 | 23 | datadir = join_paths (get_option ('prefix'), get_option ('datadir')) 24 | includedir = join_paths (get_option ('prefix'), get_option ('includedir')) 25 | libdir = join_paths (get_option ('prefix'), get_option ('libdir')) 26 | 27 | subdir ('snapd-glib') 28 | if get_option('qt5') or get_option('qt6') 29 | subdir ('snapd-qt') 30 | endif 31 | if get_option ('tests') 32 | subdir ('tests') 33 | endif 34 | if get_option ('examples') 35 | subdir ('examples') 36 | endif 37 | subdir ('po') 38 | 39 | if get_option('docs') 40 | subdir ('doc') 41 | endif 42 | -------------------------------------------------------------------------------- /meson_options.txt: -------------------------------------------------------------------------------- 1 | option('introspection', 2 | type: 'boolean', value: true, 3 | description: 'Build the introspection data (requires gobject-introspection)') 4 | option('docs', 5 | type: 'boolean', value: true, 6 | description: 'Build the API reference (requires gi-docgen, and gobject-introspection)') 7 | option('vala-bindings', 8 | type: 'boolean', value: true, 9 | description: 'Build the Vala bindings (requires introspection)') 10 | option('qt5', 11 | type : 'boolean', 12 | value : false, 13 | description: 'Build the Qt5 bindings') 14 | option('qt6', 15 | type : 'boolean', 16 | value : true, 17 | description: 'Build the Qt6 bindings') 18 | option('qml-bindings', 19 | type: 'boolean', value: true, 20 | description: 'Build the QML bindings (requires the Qt bindings)') 21 | option('soup2', 22 | type: 'boolean', value: false, 23 | description: 'Whether to build with libsoup2') 24 | option('examples', 25 | type: 'boolean', value: true, 26 | description: 'Whether to build the examples') 27 | option('tests', 28 | type: 'boolean', value: true, 29 | description: 'Whether to build the tests') 30 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/canonical/snapd-glib/c7dd8f2cc12c8823e658c5e42e34a97f7a3ddd97/po/LINGUAS -------------------------------------------------------------------------------- /po/POTFILES.in: -------------------------------------------------------------------------------- 1 | # keep sorted alphabetically! 2 | snapd-glib/snapd-interface.c 3 | -------------------------------------------------------------------------------- /po/meson.build: -------------------------------------------------------------------------------- 1 | i18n = import('i18n') 2 | 3 | i18n.gettext('snapd-glib', preset: 'glib') 4 | -------------------------------------------------------------------------------- /snapd-glib.doap: -------------------------------------------------------------------------------- 1 | 6 | 7 | snapd-glib 8 | Library to allow GLib based applications access to snapd, the daemon that controls Snaps 9 | 10 | 11 | 12 | C 13 | 14 | 15 | 16 | Robert Ancell 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-aliases.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetAliases, snapd_get_aliases, SNAPD, GET_ALIASES, 17 | SnapdRequest) 18 | 19 | SnapdGetAliases *_snapd_get_aliases_new(GCancellable *cancellable, 20 | GAsyncReadyCallback callback, 21 | gpointer user_data); 22 | 23 | GPtrArray *_snapd_get_aliases_get_aliases(SnapdGetAliases *request); 24 | 25 | G_END_DECLS 26 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-apps.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetApps, snapd_get_apps, SNAPD, GET_APPS, 17 | SnapdRequest) 18 | 19 | SnapdGetApps *_snapd_get_apps_new(GStrv snaps, GCancellable *cancellable, 20 | GAsyncReadyCallback callback, 21 | gpointer user_data); 22 | 23 | void _snapd_get_apps_set_select(SnapdGetApps *request, const gchar *select); 24 | 25 | GPtrArray *_snapd_get_apps_get_apps(SnapdGetApps *request); 26 | 27 | G_END_DECLS 28 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-assertions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetAssertions, snapd_get_assertions, SNAPD, 17 | GET_ASSERTIONS, SnapdRequest) 18 | 19 | SnapdGetAssertions *_snapd_get_assertions_new(const gchar *type, 20 | GCancellable *cancellable, 21 | GAsyncReadyCallback callback, 22 | gpointer user_data); 23 | 24 | GStrv _snapd_get_assertions_get_assertions(SnapdGetAssertions *request); 25 | 26 | G_END_DECLS 27 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-buy-ready.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include "snapd-get-buy-ready.h" 11 | 12 | #include "snapd-json.h" 13 | 14 | struct _SnapdGetBuyReady { 15 | SnapdRequest parent_instance; 16 | }; 17 | 18 | G_DEFINE_TYPE(SnapdGetBuyReady, snapd_get_buy_ready, snapd_request_get_type()) 19 | 20 | SnapdGetBuyReady *_snapd_get_buy_ready_new(GCancellable *cancellable, 21 | GAsyncReadyCallback callback, 22 | gpointer user_data) { 23 | return SNAPD_GET_BUY_READY(g_object_new( 24 | snapd_get_buy_ready_get_type(), "cancellable", cancellable, 25 | "ready-callback", callback, "ready-callback-data", user_data, NULL)); 26 | } 27 | 28 | static SoupMessage *generate_get_buy_ready_request(SnapdRequest *request, 29 | GBytes **body) { 30 | return soup_message_new("GET", "http://snapd/v2/buy/ready"); 31 | } 32 | 33 | static gboolean 34 | parse_get_buy_ready_response(SnapdRequest *request, guint status_code, 35 | const gchar *content_type, GBytes *body, 36 | SnapdMaintenance **maintenance, GError **error) { 37 | g_autoptr(JsonObject) response = 38 | _snapd_json_parse_response(content_type, body, maintenance, NULL, error); 39 | if (response == NULL) 40 | return FALSE; 41 | 42 | return TRUE; 43 | } 44 | 45 | static void snapd_get_buy_ready_class_init(SnapdGetBuyReadyClass *klass) { 46 | SnapdRequestClass *request_class = SNAPD_REQUEST_CLASS(klass); 47 | 48 | request_class->generate_request = generate_get_buy_ready_request; 49 | request_class->parse_response = parse_get_buy_ready_response; 50 | } 51 | 52 | static void snapd_get_buy_ready_init(SnapdGetBuyReady *self) {} 53 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-buy-ready.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetBuyReady, snapd_get_buy_ready, SNAPD, 17 | GET_BUY_READY, SnapdRequest) 18 | 19 | SnapdGetBuyReady *_snapd_get_buy_ready_new(GCancellable *cancellable, 20 | GAsyncReadyCallback callback, 21 | gpointer user_data); 22 | 23 | G_END_DECLS 24 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-categories.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetCategories, snapd_get_categories, SNAPD, 17 | GET_CATEGORIES, SnapdRequest) 18 | 19 | SnapdGetCategories *_snapd_get_categories_new(GCancellable *cancellable, 20 | GAsyncReadyCallback callback, 21 | gpointer user_data); 22 | 23 | GPtrArray *_snapd_get_categories_get_categories(SnapdGetCategories *request); 24 | 25 | G_END_DECLS 26 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-change.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include 13 | 14 | #include "snapd-change.h" 15 | #include "snapd-request.h" 16 | 17 | G_BEGIN_DECLS 18 | 19 | G_DECLARE_FINAL_TYPE(SnapdGetChange, snapd_get_change, SNAPD, GET_CHANGE, 20 | SnapdRequest) 21 | 22 | SnapdGetChange *_snapd_get_change_new(const gchar *change_id, 23 | GCancellable *cancellable, 24 | GAsyncReadyCallback callback, 25 | gpointer user_data); 26 | 27 | const gchar *_snapd_get_change_get_change_id(SnapdGetChange *request); 28 | 29 | SnapdChange *_snapd_get_change_get_change(SnapdGetChange *request); 30 | 31 | JsonNode *_snapd_get_change_get_data(SnapdGetChange *request); 32 | 33 | void _snapd_get_change_set_api_path(SnapdGetChange *request, 34 | const gchar *api_path); 35 | G_END_DECLS 36 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-changes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include 13 | 14 | #include "snapd-request.h" 15 | 16 | G_BEGIN_DECLS 17 | 18 | G_DECLARE_FINAL_TYPE(SnapdGetChanges, snapd_get_changes, SNAPD, GET_CHANGES, 19 | SnapdRequest) 20 | 21 | SnapdGetChanges *_snapd_get_changes_new(const gchar *select, 22 | const gchar *snap_name, 23 | GCancellable *cancellable, 24 | GAsyncReadyCallback callback, 25 | gpointer user_data); 26 | 27 | GPtrArray *_snapd_get_changes_get_changes(SnapdGetChanges *request); 28 | 29 | G_END_DECLS 30 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-connections.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetConnections, snapd_get_connections, SNAPD, 17 | GET_CONNECTIONS, SnapdRequest) 18 | 19 | SnapdGetConnections * 20 | _snapd_get_connections_new(const gchar *snap, const gchar *interface, 21 | const gchar *select, GCancellable *cancellable, 22 | GAsyncReadyCallback callback, gpointer user_data); 23 | 24 | GPtrArray *_snapd_get_connections_get_established(SnapdGetConnections *request); 25 | 26 | GPtrArray *_snapd_get_connections_get_plugs(SnapdGetConnections *request); 27 | 28 | GPtrArray *_snapd_get_connections_get_slots(SnapdGetConnections *request); 29 | 30 | GPtrArray *_snapd_get_connections_get_undesired(SnapdGetConnections *request); 31 | 32 | G_END_DECLS 33 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-find.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetFind, snapd_get_find, SNAPD, GET_FIND, 17 | SnapdRequest) 18 | 19 | SnapdGetFind *_snapd_get_find_new(GCancellable *cancellable, 20 | GAsyncReadyCallback callback, 21 | gpointer user_data); 22 | 23 | void _snapd_get_find_set_common_id(SnapdGetFind *request, 24 | const gchar *common_id); 25 | 26 | void _snapd_get_find_set_query(SnapdGetFind *request, const gchar *query); 27 | 28 | void _snapd_get_find_set_name(SnapdGetFind *request, const gchar *name); 29 | 30 | void _snapd_get_find_set_select(SnapdGetFind *request, const gchar *select); 31 | 32 | void _snapd_get_find_set_section(SnapdGetFind *request, const gchar *section); 33 | 34 | void _snapd_get_find_set_category(SnapdGetFind *request, const gchar *category); 35 | 36 | void _snapd_get_find_set_scope(SnapdGetFind *request, const gchar *scope); 37 | 38 | GPtrArray *_snapd_get_find_get_snaps(SnapdGetFind *request); 39 | 40 | const gchar *_snapd_get_find_get_suggested_currency(SnapdGetFind *request); 41 | 42 | G_END_DECLS 43 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-icon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | #include "snapd-icon.h" 15 | 16 | G_BEGIN_DECLS 17 | 18 | G_DECLARE_FINAL_TYPE(SnapdGetIcon, snapd_get_icon, SNAPD, GET_ICON, 19 | SnapdRequest) 20 | 21 | SnapdGetIcon *_snapd_get_icon_new(const gchar *name, GCancellable *cancellable, 22 | GAsyncReadyCallback callback, 23 | gpointer user_data); 24 | 25 | SnapdIcon *_snapd_get_icon_get_icon(SnapdGetIcon *request); 26 | 27 | G_END_DECLS 28 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-interfaces-legacy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetInterfacesLegacy, snapd_get_interfaces_legacy, 17 | SNAPD, GET_INTERFACES_LEGACY, SnapdRequest) 18 | 19 | SnapdGetInterfacesLegacy * 20 | _snapd_get_interfaces_legacy_new(GCancellable *cancellable, 21 | GAsyncReadyCallback callback, 22 | gpointer user_data); 23 | 24 | GPtrArray * 25 | _snapd_get_interfaces_legacy_get_plugs(SnapdGetInterfacesLegacy *request); 26 | 27 | GPtrArray * 28 | _snapd_get_interfaces_legacy_get_slots(SnapdGetInterfacesLegacy *request); 29 | 30 | G_END_DECLS 31 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-interfaces.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetInterfaces, snapd_get_interfaces, SNAPD, 17 | GET_INTERFACES, SnapdRequest) 18 | 19 | SnapdGetInterfaces *_snapd_get_interfaces_new(gchar **names, 20 | GCancellable *cancellable, 21 | GAsyncReadyCallback callback, 22 | gpointer user_data); 23 | 24 | void _snapd_get_interfaces_set_include_docs(SnapdGetInterfaces *request, 25 | gboolean include_docs); 26 | 27 | void _snapd_get_interfaces_set_include_plugs(SnapdGetInterfaces *request, 28 | gboolean include_plugs); 29 | 30 | void _snapd_get_interfaces_set_include_slots(SnapdGetInterfaces *request, 31 | gboolean include_slots); 32 | 33 | void _snapd_get_interfaces_set_only_connected(SnapdGetInterfaces *request, 34 | gboolean only_connected); 35 | 36 | GPtrArray *_snapd_get_interfaces_get_interfaces(SnapdGetInterfaces *request); 37 | 38 | G_END_DECLS 39 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-logs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-log.h" 13 | #include "snapd-request.h" 14 | 15 | G_BEGIN_DECLS 16 | 17 | G_DECLARE_FINAL_TYPE(SnapdGetLogs, snapd_get_logs, SNAPD, GET_LOGS, 18 | SnapdRequest) 19 | 20 | typedef void (*SnapdGetLogsLogCallback)(SnapdGetLogs *request, SnapdLog *log, 21 | gpointer user_data); 22 | 23 | SnapdGetLogs *_snapd_get_logs_new(gchar **names, size_t n, gboolean follow, 24 | SnapdGetLogsLogCallback log_callback, 25 | gpointer log_callback_data, 26 | GDestroyNotify log_callback_destroy_notify, 27 | GCancellable *cancellable, 28 | GAsyncReadyCallback callback, 29 | gpointer user_data); 30 | 31 | GPtrArray *_snapd_get_logs_get_logs(SnapdGetLogs *request); 32 | 33 | G_END_DECLS 34 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-model-serial.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetModelSerial, snapd_get_model_serial, SNAPD, 17 | GET_MODEL_SERIAL, SnapdRequest) 18 | 19 | SnapdGetModelSerial *_snapd_get_model_serial_new(GCancellable *cancellable, 20 | GAsyncReadyCallback callback, 21 | gpointer user_data); 22 | 23 | const gchar * 24 | _snapd_get_model_serial_get_serial_assertion(SnapdGetModelSerial *request); 25 | 26 | G_END_DECLS 27 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-model.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetModel, snapd_get_model, SNAPD, GET_MODEL, 17 | SnapdRequest) 18 | 19 | SnapdGetModel *_snapd_get_model_new(GCancellable *cancellable, 20 | GAsyncReadyCallback callback, 21 | gpointer user_data); 22 | 23 | const gchar *_snapd_get_model_get_model_assertion(SnapdGetModel *request); 24 | 25 | G_END_DECLS 26 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-notices.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | #include "snapd-notice.h" 15 | 16 | G_BEGIN_DECLS 17 | 18 | G_DECLARE_FINAL_TYPE(SnapdGetNotices, snapd_get_notices, SNAPD, GET_NOTICES, 19 | SnapdRequest) 20 | 21 | SnapdGetNotices * 22 | _snapd_get_notices_new(gchar *user_id, gchar *users, gchar *types, gchar *keys, 23 | GDateTime *from_date_time, 24 | int from_date_time_nanoseconds, GTimeSpan timeout, 25 | GCancellable *cancellable, GAsyncReadyCallback callback, 26 | gpointer user_data); 27 | 28 | GPtrArray *_snapd_get_notices_get_notices(SnapdGetNotices *request); 29 | 30 | G_END_DECLS 31 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-sections.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetSections, snapd_get_sections, SNAPD, GET_SECTIONS, 17 | SnapdRequest) 18 | 19 | SnapdGetSections *_snapd_get_sections_new(GCancellable *cancellable, 20 | GAsyncReadyCallback callback, 21 | gpointer user_data); 22 | 23 | GStrv _snapd_get_sections_get_sections(SnapdGetSections *request); 24 | 25 | G_END_DECLS 26 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-snap-conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetSnapConf, snapd_get_snap_conf, SNAPD, 17 | GET_SNAP_CONF, SnapdRequest) 18 | 19 | SnapdGetSnapConf *_snapd_get_snap_conf_new(const gchar *name, GStrv keys, 20 | GCancellable *cancellable, 21 | GAsyncReadyCallback callback, 22 | gpointer user_data); 23 | 24 | GHashTable *_snapd_get_snap_conf_get_conf(SnapdGetSnapConf *request); 25 | 26 | G_END_DECLS 27 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-snap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | #include "snapd-snap.h" 15 | 16 | G_BEGIN_DECLS 17 | 18 | G_DECLARE_FINAL_TYPE(SnapdGetSnap, snapd_get_snap, SNAPD, GET_SNAP, 19 | SnapdRequest) 20 | 21 | SnapdGetSnap *_snapd_get_snap_new(const gchar *name, GCancellable *cancellable, 22 | GAsyncReadyCallback callback, 23 | gpointer user_data); 24 | 25 | SnapdSnap *_snapd_get_snap_get_snap(SnapdGetSnap *request); 26 | 27 | G_END_DECLS 28 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-snaps.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetSnaps, snapd_get_snaps, SNAPD, GET_SNAPS, 17 | SnapdRequest) 18 | 19 | SnapdGetSnaps *_snapd_get_snaps_new(GCancellable *cancellable, GStrv names, 20 | GAsyncReadyCallback callback, 21 | gpointer user_data); 22 | 23 | void _snapd_get_snaps_set_select(SnapdGetSnaps *request, const gchar *select); 24 | 25 | GPtrArray *_snapd_get_snaps_get_snaps(SnapdGetSnaps *request); 26 | 27 | G_END_DECLS 28 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-system-info.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | #include "snapd-system-information.h" 15 | 16 | G_BEGIN_DECLS 17 | 18 | G_DECLARE_FINAL_TYPE(SnapdGetSystemInfo, snapd_get_system_info, SNAPD, 19 | GET_SYSTEM_INFO, SnapdRequest) 20 | 21 | SnapdGetSystemInfo *_snapd_get_system_info_new(GCancellable *cancellable, 22 | GAsyncReadyCallback callback, 23 | gpointer user_data); 24 | 25 | SnapdSystemInformation * 26 | _snapd_get_system_info_get_system_information(SnapdGetSystemInfo *request); 27 | 28 | G_END_DECLS 29 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-themes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetThemes, snapd_get_themes, SNAPD, GET_THEMES, 17 | SnapdRequest) 18 | 19 | SnapdGetThemes * 20 | _snapd_get_themes_new(GStrv gtk_theme_names, GStrv icon_theme_names, 21 | GStrv sound_theme_names, GCancellable *cancellable, 22 | GAsyncReadyCallback callback, gpointer user_data); 23 | 24 | GHashTable *_snapd_get_themes_get_gtk_theme_status(SnapdGetThemes *request); 25 | GHashTable *_snapd_get_themes_get_icon_theme_status(SnapdGetThemes *request); 26 | GHashTable *_snapd_get_themes_get_sound_theme_status(SnapdGetThemes *request); 27 | 28 | G_END_DECLS 29 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-get-users.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdGetUsers, snapd_get_users, SNAPD, GET_USERS, 17 | SnapdRequest) 18 | 19 | SnapdGetUsers *_snapd_get_users_new(GCancellable *cancellable, 20 | GAsyncReadyCallback callback, 21 | gpointer user_data); 22 | 23 | GPtrArray *_snapd_get_users_get_users_information(SnapdGetUsers *request); 24 | 25 | G_END_DECLS 26 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-aliases.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request-async.h" 13 | 14 | #include "snapd-client.h" 15 | 16 | G_BEGIN_DECLS 17 | 18 | G_DECLARE_FINAL_TYPE(SnapdPostAliases, snapd_post_aliases, SNAPD, POST_ALIASES, 19 | SnapdRequestAsync) 20 | 21 | SnapdPostAliases *_snapd_post_aliases_new( 22 | const gchar *action, const gchar *snap, const gchar *app, 23 | const gchar *alias, SnapdProgressCallback progress_callback, 24 | gpointer progress_callback_data, GCancellable *cancellable, 25 | GAsyncReadyCallback callback, gpointer user_data); 26 | 27 | G_END_DECLS 28 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-assertions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdPostAssertions, snapd_post_assertions, SNAPD, 17 | POST_ASSERTIONS, SnapdRequest) 18 | 19 | SnapdPostAssertions *_snapd_post_assertions_new(GStrv assertions, 20 | GCancellable *cancellable, 21 | GAsyncReadyCallback callback, 22 | gpointer user_data); 23 | 24 | G_END_DECLS 25 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-buy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdPostBuy, snapd_post_buy, SNAPD, POST_BUY, 17 | SnapdRequest) 18 | 19 | SnapdPostBuy *_snapd_post_buy_new(const gchar *id, gdouble amount, 20 | const gchar *currency, 21 | GCancellable *cancellable, 22 | GAsyncReadyCallback callback, 23 | gpointer user_data); 24 | 25 | G_END_DECLS 26 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-change.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include 13 | 14 | #include "snapd-change.h" 15 | #include "snapd-request.h" 16 | 17 | G_BEGIN_DECLS 18 | 19 | G_DECLARE_FINAL_TYPE(SnapdPostChange, snapd_post_change, SNAPD, POST_CHANGE, 20 | SnapdRequest) 21 | 22 | SnapdPostChange *_snapd_post_change_new(const gchar *change_id, 23 | const gchar *action, 24 | GCancellable *cancellable, 25 | GAsyncReadyCallback callback, 26 | gpointer user_data); 27 | 28 | const gchar *_snapd_post_change_get_change_id(SnapdPostChange *request); 29 | 30 | SnapdChange *_snapd_post_change_get_change(SnapdPostChange *request); 31 | 32 | JsonNode *_snapd_post_change_get_data(SnapdPostChange *request); 33 | 34 | void _snapd_post_change_set_api_path(SnapdPostChange *request, 35 | const gchar *api_path); 36 | 37 | G_END_DECLS 38 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-create-user.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | #include "snapd-user-information.h" 14 | 15 | G_BEGIN_DECLS 16 | 17 | G_DECLARE_FINAL_TYPE(SnapdPostCreateUser, snapd_post_create_user, SNAPD, 18 | POST_CREATE_USER, SnapdRequest) 19 | 20 | SnapdPostCreateUser *_snapd_post_create_user_new(const gchar *email, 21 | GCancellable *cancellable, 22 | GAsyncReadyCallback callback, 23 | gpointer user_data); 24 | 25 | void _snapd_post_create_user_set_sudoer(SnapdPostCreateUser *request, 26 | gboolean sudoer); 27 | 28 | void _snapd_post_create_user_set_known(SnapdPostCreateUser *request, 29 | gboolean known); 30 | 31 | SnapdUserInformation * 32 | _snapd_post_create_user_get_user_information(SnapdPostCreateUser *request); 33 | 34 | G_END_DECLS 35 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-create-users.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdPostCreateUsers, snapd_post_create_users, SNAPD, 17 | POST_CREATE_USERS, SnapdRequest) 18 | 19 | SnapdPostCreateUsers *_snapd_post_create_users_new(GCancellable *cancellable, 20 | GAsyncReadyCallback callback, 21 | gpointer user_data); 22 | 23 | GPtrArray * 24 | _snapd_post_create_users_get_users_information(SnapdPostCreateUsers *request); 25 | 26 | G_END_DECLS 27 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-download.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdPostDownload, snapd_post_download, SNAPD, 17 | POST_DOWNLOAD, SnapdRequest) 18 | 19 | SnapdPostDownload * 20 | _snapd_post_download_new(const gchar *name, const gchar *channel, 21 | const gchar *revision, GCancellable *cancellable, 22 | GAsyncReadyCallback callback, gpointer user_data); 23 | 24 | GBytes *_snapd_post_download_get_data(SnapdPostDownload *request); 25 | 26 | G_END_DECLS 27 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-interfaces.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request-async.h" 13 | 14 | #include "snapd-client.h" 15 | 16 | G_BEGIN_DECLS 17 | 18 | G_DECLARE_FINAL_TYPE(SnapdPostInterfaces, snapd_post_interfaces, SNAPD, 19 | POST_INTERFACES, SnapdRequestAsync) 20 | 21 | SnapdPostInterfaces *_snapd_post_interfaces_new( 22 | const gchar *action, const gchar *plug_snap, const gchar *plug_name, 23 | const gchar *slot_snap, const gchar *slot_name, 24 | SnapdProgressCallback progress_callback, gpointer progress_callback_data, 25 | GCancellable *cancellable, GAsyncReadyCallback callback, 26 | gpointer user_data); 27 | 28 | G_END_DECLS 29 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-login.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | #include "snapd-user-information.h" 15 | 16 | G_BEGIN_DECLS 17 | 18 | G_DECLARE_FINAL_TYPE(SnapdPostLogin, snapd_post_login, SNAPD, POST_LOGIN, 19 | SnapdRequest) 20 | 21 | SnapdPostLogin *_snapd_post_login_new(const gchar *email, const gchar *password, 22 | const gchar *otp, 23 | GCancellable *cancellable, 24 | GAsyncReadyCallback callback, 25 | gpointer user_data); 26 | 27 | SnapdUserInformation * 28 | _snapd_post_login_get_user_information(SnapdPostLogin *request); 29 | 30 | G_END_DECLS 31 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-logout.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include "snapd-post-logout.h" 11 | 12 | #include "snapd-error.h" 13 | #include "snapd-json.h" 14 | 15 | struct _SnapdPostLogout { 16 | SnapdRequest parent_instance; 17 | gint64 id; 18 | }; 19 | 20 | G_DEFINE_TYPE(SnapdPostLogout, snapd_post_logout, snapd_request_get_type()) 21 | 22 | SnapdPostLogout *_snapd_post_logout_new(gint64 id, GCancellable *cancellable, 23 | GAsyncReadyCallback callback, 24 | gpointer user_data) { 25 | SnapdPostLogout *self = SNAPD_POST_LOGOUT(g_object_new( 26 | snapd_post_logout_get_type(), "cancellable", cancellable, 27 | "ready-callback", callback, "ready-callback-data", user_data, NULL)); 28 | self->id = id; 29 | 30 | return self; 31 | } 32 | 33 | static SoupMessage *generate_post_logout_request(SnapdRequest *request, 34 | GBytes **body) { 35 | SnapdPostLogout *self = SNAPD_POST_LOGOUT(request); 36 | 37 | SoupMessage *message = soup_message_new("POST", "http://snapd/v2/logout"); 38 | 39 | g_autoptr(JsonBuilder) builder = json_builder_new(); 40 | json_builder_begin_object(builder); 41 | json_builder_set_member_name(builder, "id"); 42 | json_builder_add_int_value(builder, self->id); 43 | json_builder_end_object(builder); 44 | _snapd_json_set_body(message, builder, body); 45 | 46 | return message; 47 | } 48 | 49 | static gboolean 50 | parse_post_logout_response(SnapdRequest *request, guint status_code, 51 | const gchar *content_type, GBytes *body, 52 | SnapdMaintenance **maintenance, GError **error) { 53 | g_autoptr(JsonObject) response = 54 | _snapd_json_parse_response(content_type, body, maintenance, NULL, error); 55 | if (response == NULL) 56 | return FALSE; 57 | /* FIXME: Needs json-glib to be fixed to use json_node_unref */ 58 | /*g_autoptr(JsonNode) result = NULL;*/ 59 | JsonNode *result = _snapd_json_get_sync_result(response, error); 60 | if (result == NULL) 61 | return FALSE; 62 | json_node_unref(result); 63 | 64 | return TRUE; 65 | } 66 | 67 | static void snapd_post_logout_class_init(SnapdPostLogoutClass *klass) { 68 | SnapdRequestClass *request_class = SNAPD_REQUEST_CLASS(klass); 69 | 70 | request_class->generate_request = generate_post_logout_request; 71 | request_class->parse_response = parse_post_logout_response; 72 | } 73 | 74 | static void snapd_post_logout_init(SnapdPostLogout *self) {} 75 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-logout.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdPostLogout, snapd_post_logout, SNAPD, POST_LOGOUT, 17 | SnapdRequest) 18 | 19 | SnapdPostLogout *_snapd_post_logout_new(gint64 id, GCancellable *cancellable, 20 | GAsyncReadyCallback callback, 21 | gpointer user_data); 22 | 23 | gboolean _snapd_post_logout_get_user_information(SnapdPostLogout *request); 24 | 25 | G_END_DECLS 26 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-snap-stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request-async.h" 13 | 14 | #include "snapd-client.h" 15 | 16 | G_BEGIN_DECLS 17 | 18 | G_DECLARE_FINAL_TYPE(SnapdPostSnapStream, snapd_post_snap_stream, SNAPD, 19 | POST_SNAP_STREAM, SnapdRequestAsync) 20 | 21 | SnapdPostSnapStream * 22 | _snapd_post_snap_stream_new(SnapdProgressCallback progress_callback, 23 | gpointer progress_callback_data, 24 | GCancellable *cancellable, 25 | GAsyncReadyCallback callback, gpointer user_data); 26 | 27 | void _snapd_post_snap_stream_set_classic(SnapdPostSnapStream *request, 28 | gboolean classic); 29 | 30 | void _snapd_post_snap_stream_set_dangerous(SnapdPostSnapStream *request, 31 | gboolean dangerous); 32 | 33 | void _snapd_post_snap_stream_set_devmode(SnapdPostSnapStream *request, 34 | gboolean devmode); 35 | 36 | void _snapd_post_snap_stream_set_jailmode(SnapdPostSnapStream *request, 37 | gboolean jailmode); 38 | 39 | void _snapd_post_snap_stream_append_data(SnapdPostSnapStream *request, 40 | const guint8 *data, guint len); 41 | 42 | G_END_DECLS 43 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-snap-try.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request-async.h" 13 | 14 | #include "snapd-client.h" 15 | 16 | G_BEGIN_DECLS 17 | 18 | G_DECLARE_FINAL_TYPE(SnapdPostSnapTry, snapd_post_snap_try, SNAPD, 19 | POST_SNAP_TRY, SnapdRequestAsync) 20 | 21 | SnapdPostSnapTry *_snapd_post_snap_try_new( 22 | const gchar *path, SnapdProgressCallback progress_callback, 23 | gpointer progress_callback_data, GCancellable *cancellable, 24 | GAsyncReadyCallback callback, gpointer user_data); 25 | 26 | G_END_DECLS 27 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-snap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request-async.h" 13 | 14 | #include "snapd-client.h" 15 | 16 | G_BEGIN_DECLS 17 | 18 | G_DECLARE_FINAL_TYPE(SnapdPostSnap, snapd_post_snap, SNAPD, POST_SNAP, 19 | SnapdRequestAsync) 20 | 21 | SnapdPostSnap *_snapd_post_snap_new(const gchar *name, const gchar *action, 22 | SnapdProgressCallback progress_callback, 23 | gpointer progress_callback_data, 24 | GCancellable *cancellable, 25 | GAsyncReadyCallback callback, 26 | gpointer user_data); 27 | 28 | void _snapd_post_snap_set_channel(SnapdPostSnap *request, const gchar *channel); 29 | 30 | void _snapd_post_snap_set_revision(SnapdPostSnap *request, 31 | const gchar *revision); 32 | 33 | void _snapd_post_snap_set_classic(SnapdPostSnap *request, gboolean classic); 34 | 35 | void _snapd_post_snap_set_dangerous(SnapdPostSnap *request, gboolean dangerous); 36 | 37 | void _snapd_post_snap_set_devmode(SnapdPostSnap *request, gboolean devmode); 38 | 39 | void _snapd_post_snap_set_jailmode(SnapdPostSnap *request, gboolean jailmode); 40 | 41 | void _snapd_post_snap_set_purge(SnapdPostSnap *request, gboolean purge); 42 | 43 | G_END_DECLS 44 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-snapctl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdPostSnapctl, snapd_post_snapctl, SNAPD, POST_SNAPCTL, 17 | SnapdRequest) 18 | 19 | SnapdPostSnapctl *_snapd_post_snapctl_new(const gchar *context_id, GStrv args, 20 | GCancellable *cancellable, 21 | GAsyncReadyCallback callback, 22 | gpointer user_data); 23 | 24 | const gchar *_snapd_post_snapctl_get_stdout_output(SnapdPostSnapctl *request); 25 | 26 | const gchar *_snapd_post_snapctl_get_stderr_output(SnapdPostSnapctl *request); 27 | 28 | int _snapd_post_snapctl_get_exit_code(SnapdPostSnapctl *request); 29 | 30 | G_END_DECLS 31 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-snaps.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request-async.h" 13 | 14 | #include "snapd-client.h" 15 | 16 | G_BEGIN_DECLS 17 | 18 | G_DECLARE_FINAL_TYPE(SnapdPostSnaps, snapd_post_snaps, SNAPD, POST_SNAPS, 19 | SnapdRequestAsync) 20 | 21 | SnapdPostSnaps *_snapd_post_snaps_new(const gchar *action, 22 | SnapdProgressCallback progress_callback, 23 | gpointer progress_callback_data, 24 | GCancellable *cancellable, 25 | GAsyncReadyCallback callback, 26 | gpointer user_data); 27 | 28 | GStrv _snapd_post_snaps_get_snap_names(SnapdPostSnaps *request); 29 | 30 | G_END_DECLS 31 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-post-themes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request-async.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdPostThemes, snapd_post_themes, SNAPD, POST_THEMES, 17 | SnapdRequestAsync) 18 | 19 | SnapdPostThemes *_snapd_post_themes_new( 20 | GStrv gtk_theme_names, GStrv icon_theme_names, GStrv sound_theme_names, 21 | SnapdProgressCallback progress_callback, gpointer progress_callback_data, 22 | GCancellable *cancellable, GAsyncReadyCallback callback, 23 | gpointer user_data); 24 | 25 | G_END_DECLS 26 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-put-snap-conf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include "snapd-request-async.h" 13 | 14 | G_BEGIN_DECLS 15 | 16 | G_DECLARE_FINAL_TYPE(SnapdPutSnapConf, snapd_put_snap_conf, SNAPD, 17 | PUT_SNAP_CONF, SnapdRequestAsync) 18 | 19 | SnapdPutSnapConf *_snapd_put_snap_conf_new(const gchar *name, 20 | GHashTable *key_values, 21 | GCancellable *cancellable, 22 | GAsyncReadyCallback callback, 23 | gpointer user_data); 24 | 25 | G_END_DECLS 26 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-request-async.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include 13 | #include 14 | 15 | #include "snapd-change.h" 16 | #include "snapd-client.h" 17 | #include "snapd-get-change.h" 18 | #include "snapd-post-change.h" 19 | #include "snapd-request.h" 20 | 21 | G_BEGIN_DECLS 22 | 23 | G_DECLARE_DERIVABLE_TYPE(SnapdRequestAsync, snapd_request_async, SNAPD, 24 | REQUEST_ASYNC, SnapdRequest) 25 | 26 | struct _SnapdRequestAsyncClass { 27 | SnapdRequestClass parent_class; 28 | 29 | gboolean (*parse_result)(SnapdRequestAsync *request, JsonNode *result, 30 | GError **error); 31 | }; 32 | 33 | const gchar *_snapd_request_async_get_change_id(SnapdRequestAsync *request); 34 | 35 | gboolean _snapd_request_async_parse_result(SnapdRequestAsync *request, 36 | JsonNode *result, GError **error); 37 | 38 | void _snapd_request_async_report_progress(SnapdRequestAsync *request, 39 | SnapdClient *client, 40 | SnapdChange *change); 41 | 42 | SnapdGetChange * 43 | _snapd_request_async_make_get_change_request(SnapdRequestAsync *request); 44 | 45 | SnapdPostChange * 46 | _snapd_request_async_make_post_change_request(SnapdRequestAsync *request); 47 | 48 | G_END_DECLS 49 | -------------------------------------------------------------------------------- /snapd-glib/requests/snapd-request.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #pragma once 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include "snapd-maintenance.h" 17 | 18 | G_BEGIN_DECLS 19 | 20 | G_DECLARE_DERIVABLE_TYPE(SnapdRequest, snapd_request, SNAPD, REQUEST, GObject) 21 | 22 | struct _SnapdRequestClass { 23 | GObjectClass parent_class; 24 | 25 | SoupMessage *(*generate_request)(SnapdRequest *request, GBytes **body); 26 | gboolean (*parse_response)(SnapdRequest *request, guint status_code, 27 | const gchar *content_type, GBytes *body, 28 | SnapdMaintenance **maintenance, GError **error); 29 | gboolean (*parse_json_seq)(SnapdRequest *request, JsonNode *seq, 30 | GError **error); 31 | }; 32 | 33 | void _snapd_request_set_source_object(SnapdRequest *request, GObject *object); 34 | 35 | GMainContext *_snapd_request_get_context(SnapdRequest *request); 36 | 37 | GCancellable *_snapd_request_get_cancellable(SnapdRequest *request); 38 | 39 | void _snapd_request_generate(SnapdRequest *request); 40 | 41 | SoupMessage *_snapd_request_get_message(SnapdRequest *request, GBytes **body); 42 | 43 | void _snapd_request_return(SnapdRequest *request, GError *error); 44 | 45 | gboolean _snapd_request_propagate_error(SnapdRequest *request, GError **error); 46 | 47 | G_END_DECLS 48 | -------------------------------------------------------------------------------- /snapd-glib/snapd-alias.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_ALIAS_H__ 11 | #define __SNAPD_ALIAS_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_ALIAS (snapd_alias_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdAlias, snapd_alias, SNAPD, ALIAS, GObject) 24 | 25 | /** 26 | * SnapdAliasStatus: 27 | * @SNAPD_ALIAS_STATUS_UNKNOWN: the alias status is unknown. 28 | * @SNAPD_ALIAS_STATUS_DEFAULT: deprecated, do not use. 29 | * @SNAPD_ALIAS_STATUS_ENABLED: deprecated, do not use. 30 | * @SNAPD_ALIAS_STATUS_DISABLED: the alias is disabled. 31 | * @SNAPD_ALIAS_STATUS_AUTO: the alias is automatically enabled. 32 | * @SNAPD_ALIAS_STATUS_MANUAL: the alias is manually enabled. 33 | * 34 | * Status of an alias. 35 | * 36 | * Since: 1.8 37 | */ 38 | typedef enum { 39 | SNAPD_ALIAS_STATUS_UNKNOWN, 40 | SNAPD_ALIAS_STATUS_DEFAULT, 41 | SNAPD_ALIAS_STATUS_ENABLED, 42 | SNAPD_ALIAS_STATUS_DISABLED, 43 | SNAPD_ALIAS_STATUS_AUTO, 44 | SNAPD_ALIAS_STATUS_MANUAL 45 | } SnapdAliasStatus; 46 | 47 | const gchar *snapd_alias_get_app(SnapdAlias *alias) G_DEPRECATED; 48 | 49 | const gchar *snapd_alias_get_app_auto(SnapdAlias *alias); 50 | 51 | const gchar *snapd_alias_get_command(SnapdAlias *alias); 52 | 53 | const gchar *snapd_alias_get_app_manual(SnapdAlias *alias); 54 | 55 | const gchar *snapd_alias_get_name(SnapdAlias *alias); 56 | 57 | const gchar *snapd_alias_get_snap(SnapdAlias *alias); 58 | 59 | SnapdAliasStatus snapd_alias_get_status(SnapdAlias *alias); 60 | 61 | G_END_DECLS 62 | 63 | #endif /* __SNAPD_ALIAS_H__ */ 64 | -------------------------------------------------------------------------------- /snapd-glib/snapd-app.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_APP_H__ 11 | #define __SNAPD_APP_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_APP (snapd_app_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdApp, snapd_app, SNAPD, APP, GObject) 24 | 25 | /** 26 | * SnapdDaemonType: 27 | * @SNAPD_DAEMON_TYPE_NONE: Not a daemon 28 | * @SNAPD_DAEMON_TYPE_UNKNOWN: Unknown daemon type 29 | * @SNAPD_DAEMON_TYPE_SIMPLE: Simple daemon 30 | * @SNAPD_DAEMON_TYPE_FORKING: Forking daemon 31 | * @SNAPD_DAEMON_TYPE_ONESHOT: One-shot daemon 32 | * @SNAPD_DAEMON_TYPE_DBUS: D-Bus daemon 33 | * @SNAPD_DAEMON_TYPE_NOTIFY: Notify daemon 34 | * 35 | * Type of daemon. 36 | * 37 | * Since: 1.9 38 | */ 39 | typedef enum { 40 | SNAPD_DAEMON_TYPE_NONE, 41 | SNAPD_DAEMON_TYPE_UNKNOWN, 42 | SNAPD_DAEMON_TYPE_SIMPLE, 43 | SNAPD_DAEMON_TYPE_FORKING, 44 | SNAPD_DAEMON_TYPE_ONESHOT, 45 | SNAPD_DAEMON_TYPE_DBUS, 46 | SNAPD_DAEMON_TYPE_NOTIFY 47 | } SnapdDaemonType; 48 | 49 | const gchar *snapd_app_get_name(SnapdApp *app); 50 | 51 | gboolean snapd_app_get_active(SnapdApp *app); 52 | 53 | GStrv snapd_app_get_aliases(SnapdApp *app) G_DEPRECATED; 54 | 55 | const gchar *snapd_app_get_common_id(SnapdApp *app); 56 | 57 | SnapdDaemonType snapd_app_get_daemon_type(SnapdApp *app); 58 | 59 | const gchar *snapd_app_get_desktop_file(SnapdApp *app); 60 | 61 | gboolean snapd_app_get_enabled(SnapdApp *app); 62 | 63 | const gchar *snapd_app_get_snap(SnapdApp *app); 64 | 65 | G_END_DECLS 66 | 67 | #endif /* __SNAPD_APP_H__ */ 68 | -------------------------------------------------------------------------------- /snapd-glib/snapd-assertion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_ASSERTION_H__ 11 | #define __SNAPD_ASSERTION_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_ASSERTION (snapd_assertion_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdAssertion, snapd_assertion, SNAPD, ASSERTION, GObject) 24 | 25 | SnapdAssertion *snapd_assertion_new(const gchar *content); 26 | 27 | GStrv snapd_assertion_get_headers(SnapdAssertion *assertion); 28 | 29 | gchar *snapd_assertion_get_header(SnapdAssertion *assertion, const gchar *name); 30 | 31 | gchar *snapd_assertion_get_body(SnapdAssertion *assertion); 32 | 33 | gchar *snapd_assertion_get_signature(SnapdAssertion *assertion); 34 | 35 | G_END_DECLS 36 | 37 | #endif /* __SNAPD_ASSERTION_H__ */ 38 | -------------------------------------------------------------------------------- /snapd-glib/snapd-auth-data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_AUTH_DATA_H__ 11 | #define __SNAPD_AUTH_DATA_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_AUTH_DATA (snapd_auth_data_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdAuthData, snapd_auth_data, SNAPD, AUTH_DATA, GObject) 24 | 25 | SnapdAuthData *snapd_auth_data_new(const gchar *macaroon, GStrv discharges); 26 | 27 | const gchar *snapd_auth_data_get_macaroon(SnapdAuthData *auth_data); 28 | 29 | GStrv snapd_auth_data_get_discharges(SnapdAuthData *auth_data); 30 | 31 | G_END_DECLS 32 | 33 | #endif /* __SNAPD_AUTH_DATA_H__ */ 34 | -------------------------------------------------------------------------------- /snapd-glib/snapd-autorefresh-change-data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_AUTOREFRESH_CHANGE_DATA_H__ 11 | #define __SNAPD_AUTOREFRESH_CHANGE_DATA_H__ 12 | 13 | #include "snapd-change-data.h" 14 | #include 15 | 16 | G_BEGIN_DECLS 17 | 18 | #define SNAPD_TYPE_AUTOREFRESH_CHANGE_DATA \ 19 | (snapd_autorefresh_change_data_get_type()) 20 | G_DECLARE_FINAL_TYPE(SnapdAutorefreshChangeData, snapd_autorefresh_change_data, 21 | SNAPD, AUTOREFRESH_CHANGE_DATA, SnapdChangeData) 22 | 23 | GStrv snapd_autorefresh_change_data_get_snap_names( 24 | SnapdAutorefreshChangeData *change_data); 25 | 26 | GStrv snapd_autorefresh_change_data_get_refresh_forced( 27 | SnapdAutorefreshChangeData *change_data); 28 | 29 | G_END_DECLS 30 | 31 | #endif /* __SNAPD_AUTOREFRESH_CHANGE_DATA_H__ */ 32 | -------------------------------------------------------------------------------- /snapd-glib/snapd-category-details.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_CATEGORY_DETAILS_H__ 11 | #define __SNAPD_CATEGORY_DETAILS_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_CATEGORY_DETAILS (snapd_category_details_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdCategoryDetails, snapd_category_details, SNAPD, 24 | CATEGORY_DETAILS, GObject) 25 | 26 | const gchar * 27 | snapd_category_details_get_name(SnapdCategoryDetails *category_details); 28 | 29 | G_END_DECLS 30 | 31 | #endif /* __SNAPD_CATEGORY_DETAILS_H__ */ 32 | -------------------------------------------------------------------------------- /snapd-glib/snapd-category.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_CATEGORY_H__ 11 | #define __SNAPD_CATEGORY_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_CATEGORY (snapd_category_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdCategory, snapd_category, SNAPD, CATEGORY, GObject) 24 | 25 | gboolean snapd_category_get_featured(SnapdCategory *category); 26 | 27 | const gchar *snapd_category_get_name(SnapdCategory *category); 28 | 29 | G_END_DECLS 30 | 31 | #endif /* __SNAPD_CATEGORY_H__ */ 32 | -------------------------------------------------------------------------------- /snapd-glib/snapd-change-data.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include "snapd-change-data.h" 11 | 12 | /** 13 | * SECTION: snapd-change-data 14 | * @short_description: Base class for custom data from a change 15 | * @include: snapd-glib/snapd-glib.h 16 | * 17 | * A #SnapdChangeData is the base class for the `data` field from 18 | * a #SnapdChange. Each kind of #SnapdChange will return a different 19 | * subclass of this one with the specific data of that kind of change. 20 | */ 21 | 22 | /** 23 | * SnapdChangeData: 24 | * 25 | * A #SnapdChangeData is the base class for the `data` field from 26 | * a #SnapdChange. 27 | * 28 | * Since: 1.65 29 | */ 30 | 31 | G_DEFINE_TYPE(SnapdChangeData, snapd_change_data, G_TYPE_OBJECT) 32 | 33 | static void snapd_change_data_class_init(SnapdChangeDataClass *klass) {} 34 | 35 | static void snapd_change_data_init(SnapdChangeData *self) {} 36 | -------------------------------------------------------------------------------- /snapd-glib/snapd-change-data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_CHANGE_DATA_H__ 11 | #define __SNAPD_CHANGE_DATA_H__ 12 | 13 | #include 14 | 15 | G_BEGIN_DECLS 16 | 17 | #define SNAPD_TYPE_CHANGE_DATA snapd_change_data_get_type() 18 | G_DECLARE_DERIVABLE_TYPE(SnapdChangeData, snapd_change_data, SNAPD, CHANGE_DATA, 19 | GObject) 20 | 21 | struct _SnapdChangeDataClass { 22 | GObjectClass parent_class; 23 | }; 24 | 25 | G_END_DECLS 26 | 27 | #endif /* __SNAPD_CHANGE_DATA_H__ */ 28 | -------------------------------------------------------------------------------- /snapd-glib/snapd-change.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_CHANGE_H__ 11 | #define __SNAPD_CHANGE_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include "snapd-autorefresh-change-data.h" 18 | #include "snapd-change-data.h" 19 | #include 20 | 21 | G_BEGIN_DECLS 22 | 23 | #define SNAPD_TYPE_CHANGE (snapd_change_get_type()) 24 | 25 | G_DECLARE_FINAL_TYPE(SnapdChange, snapd_change, SNAPD, CHANGE, GObject) 26 | 27 | const gchar *snapd_change_get_id(SnapdChange *change); 28 | 29 | const gchar *snapd_change_get_kind(SnapdChange *change); 30 | 31 | const gchar *snapd_change_get_summary(SnapdChange *change); 32 | 33 | const gchar *snapd_change_get_status(SnapdChange *change); 34 | 35 | gboolean snapd_change_get_ready(SnapdChange *change); 36 | 37 | GPtrArray *snapd_change_get_tasks(SnapdChange *change); 38 | 39 | GDateTime *snapd_change_get_spawn_time(SnapdChange *change); 40 | 41 | GDateTime *snapd_change_get_ready_time(SnapdChange *change); 42 | 43 | const gchar *snapd_change_get_error(SnapdChange *change); 44 | 45 | SnapdChangeData *snapd_change_get_data(SnapdChange *change); 46 | 47 | G_END_DECLS 48 | 49 | #endif /* __SNAPD_CHANGE_H__ */ 50 | -------------------------------------------------------------------------------- /snapd-glib/snapd-channel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_CHANNEL_H__ 11 | #define __SNAPD_CHANNEL_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_CHANNEL (snapd_channel_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdChannel, snapd_channel, SNAPD, CHANNEL, GObject) 24 | 25 | /** 26 | * SnapdConfinement: 27 | * @SNAPD_CONFINEMENT_UNKNOWN: the confinement of the snap is unknown. 28 | * @SNAPD_CONFINEMENT_STRICT: the snap is using confinement. 29 | * @SNAPD_CONFINEMENT_DEVMODE: the snap is in dev mode (i.e. unconfined). 30 | * @SNAPD_CONFINEMENT_CLASSIC: the snap is using classic confinement. 31 | * 32 | * Confinement used by a snap. 33 | * 34 | * Since: 1.0 35 | */ 36 | typedef enum { 37 | SNAPD_CONFINEMENT_UNKNOWN, 38 | SNAPD_CONFINEMENT_STRICT, 39 | SNAPD_CONFINEMENT_DEVMODE, 40 | SNAPD_CONFINEMENT_CLASSIC 41 | } SnapdConfinement; 42 | 43 | const gchar *snapd_channel_get_branch(SnapdChannel *channel); 44 | 45 | SnapdConfinement snapd_channel_get_confinement(SnapdChannel *channel); 46 | 47 | const gchar *snapd_channel_get_epoch(SnapdChannel *channel); 48 | 49 | const gchar *snapd_channel_get_name(SnapdChannel *channel); 50 | 51 | const gchar *snapd_channel_get_revision(SnapdChannel *channel); 52 | 53 | GDateTime *snapd_channel_get_released_at(SnapdChannel *channel); 54 | 55 | const gchar *snapd_channel_get_risk(SnapdChannel *channel); 56 | 57 | gint64 snapd_channel_get_size(SnapdChannel *channel); 58 | 59 | const gchar *snapd_channel_get_track(SnapdChannel *channel); 60 | 61 | const gchar *snapd_channel_get_version(SnapdChannel *channel); 62 | 63 | G_END_DECLS 64 | 65 | #endif /* __SNAPD_CHANNEL_H__ */ 66 | -------------------------------------------------------------------------------- /snapd-glib/snapd-connection.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_CONNECTION_H__ 11 | #define __SNAPD_CONNECTION_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | G_BEGIN_DECLS 22 | 23 | #define SNAPD_TYPE_CONNECTION (snapd_connection_get_type()) 24 | 25 | G_DECLARE_FINAL_TYPE(SnapdConnection, snapd_connection, SNAPD, CONNECTION, 26 | GObject) 27 | 28 | SnapdSlotRef *snapd_connection_get_slot(SnapdConnection *connection); 29 | 30 | SnapdPlugRef *snapd_connection_get_plug(SnapdConnection *connection); 31 | 32 | const gchar *snapd_connection_get_interface(SnapdConnection *connection); 33 | 34 | gboolean snapd_connection_get_manual(SnapdConnection *connection); 35 | 36 | gboolean snapd_connection_get_gadget(SnapdConnection *connection); 37 | 38 | GStrv snapd_connection_get_slot_attribute_names(SnapdConnection *connection, 39 | guint *length); 40 | 41 | gboolean snapd_connection_has_slot_attribute(SnapdConnection *connection, 42 | const gchar *name); 43 | 44 | GVariant *snapd_connection_get_slot_attribute(SnapdConnection *connection, 45 | const gchar *name); 46 | 47 | GStrv snapd_connection_get_plug_attribute_names(SnapdConnection *connection, 48 | guint *length); 49 | 50 | gboolean snapd_connection_has_plug_attribute(SnapdConnection *connection, 51 | const gchar *name); 52 | 53 | GVariant *snapd_connection_get_plug_attribute(SnapdConnection *connection, 54 | const gchar *name); 55 | 56 | const gchar * 57 | snapd_connection_get_name(SnapdConnection *connection) G_DEPRECATED; 58 | 59 | const gchar * 60 | snapd_connection_get_snap(SnapdConnection *connection) G_DEPRECATED; 61 | 62 | G_END_DECLS 63 | 64 | #endif /* __SNAPD_CONNECTION_H__ */ 65 | -------------------------------------------------------------------------------- /snapd-glib/snapd-enum-types.c.in: -------------------------------------------------------------------------------- 1 | /*** BEGIN file-header ***/ 2 | /* 3 | * Copyright (C) 2016 Canonical Ltd. 4 | * 5 | * This library is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU Lesser General Public License as published by the Free 7 | * Software Foundation; either version 2 or version 3 of the License. 8 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 9 | */ 10 | 11 | #include "snapd-enum-types.h" 12 | /*** END file-header ***/ 13 | 14 | /*** BEGIN file-production ***/ 15 | 16 | /* enumerations from "@basename@" */ 17 | #include "@filename@" 18 | 19 | /*** END file-production ***/ 20 | 21 | /*** BEGIN value-header ***/ 22 | GType 23 | @enum_name@_get_type (void) 24 | { 25 | static volatile gsize g_enum_type_id__volatile = 0; 26 | 27 | if (g_once_init_enter (&g_enum_type_id__volatile)) 28 | { 29 | static const G@Type@Value values[] = { 30 | /*** END value-header ***/ 31 | 32 | /*** BEGIN value-production ***/ 33 | { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, 34 | /*** END value-production ***/ 35 | 36 | /*** BEGIN value-tail ***/ 37 | { 0, NULL, NULL } 38 | }; 39 | 40 | GType g_enum_type_id = 41 | g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); 42 | 43 | g_once_init_leave (&g_enum_type_id__volatile, g_enum_type_id); 44 | } 45 | 46 | return g_enum_type_id__volatile; 47 | } 48 | /*** END value-tail ***/ 49 | -------------------------------------------------------------------------------- /snapd-glib/snapd-enum-types.h.in: -------------------------------------------------------------------------------- 1 | /*** BEGIN file-header ***/ 2 | /* 3 | * Copyright (C) 2016 Canonical Ltd. 4 | * 5 | * This library is free software; you can redistribute it and/or modify it under 6 | * the terms of the GNU Lesser General Public License as published by the Free 7 | * Software Foundation; either version 2 or version 3 of the License. 8 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 9 | */ 10 | 11 | #ifndef __SNAPD_ENUM_TYPES_H__ 12 | #define __SNAPD_ENUM_TYPES_H__ 13 | 14 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 15 | #error "Only can be included directly." 16 | #endif 17 | 18 | #include 19 | 20 | G_BEGIN_DECLS 21 | 22 | /*** END file-header ***/ 23 | 24 | /*** BEGIN file-production ***/ 25 | /* enumerations from "@basename@" */ 26 | /*** END file-production ***/ 27 | 28 | /*** BEGIN file-tail ***/ 29 | G_END_DECLS 30 | 31 | #endif /* !__SNAPD_ENUM_TYPES_H__ */ 32 | /*** END file-tail ***/ 33 | 34 | /*** BEGIN value-header ***/ 35 | GType @enum_name@_get_type (void) G_GNUC_CONST; 36 | #define SNAPD_TYPE_@ENUMSHORT@ (@enum_name@_get_type()) 37 | 38 | /*** END value-header ***/ 39 | 40 | -------------------------------------------------------------------------------- /snapd-glib/snapd-error.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include "snapd-error.h" 11 | 12 | /** 13 | * SECTION:snapd-error 14 | * @short_description: Snap error codes 15 | * @include: snapd-glib/snapd-glib.h 16 | * 17 | * Error code definitions for various snapd operations. 18 | */ 19 | 20 | /** 21 | * snapd_error_quark: 22 | * 23 | * Gets the Snapd Error Quark. 24 | * 25 | * Returns: a #GQuark. 26 | * 27 | * Since: 1.0 28 | **/ 29 | G_DEFINE_QUARK(snapd - error - quark, snapd_error) 30 | -------------------------------------------------------------------------------- /snapd-glib/snapd-glib.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_GLIB_H__ 11 | #define __SNAPD_GLIB_H__ 12 | 13 | #define __SNAPD_GLIB_INSIDE__ 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #undef __SNAPD_GLIB_INSIDE__ 49 | 50 | #endif /* __SNAPD_GLIB_H__ */ 51 | -------------------------------------------------------------------------------- /snapd-glib/snapd-glib.map: -------------------------------------------------------------------------------- 1 | { 2 | global: 3 | snapd_*; 4 | local: 5 | *; 6 | }; 7 | -------------------------------------------------------------------------------- /snapd-glib/snapd-glib.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: Snapd GLib 7 | Description: Libary for accessing snapd 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lsnapd-glib 10 | Cflags: -I${includedir}/snapd-glib 11 | Requires: gobject-2.0 gio-2.0 libsoup-2.4 json-glib-1.0 12 | -------------------------------------------------------------------------------- /snapd-glib/snapd-icon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_ICON_H__ 11 | #define __SNAPD_ICON_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_ICON (snapd_icon_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdIcon, snapd_icon, SNAPD, ICON, GObject) 24 | 25 | const gchar *snapd_icon_get_mime_type(SnapdIcon *icon); 26 | 27 | GBytes *snapd_icon_get_data(SnapdIcon *icon); 28 | 29 | G_END_DECLS 30 | 31 | #endif /* __SNAPD_ICON_H__ */ 32 | -------------------------------------------------------------------------------- /snapd-glib/snapd-interface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_INTERFACE_H__ 11 | #define __SNAPD_INTERFACE_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_INTERFACE (snapd_interface_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdInterface, snapd_interface, SNAPD, INTERFACE, GObject) 24 | 25 | const gchar *snapd_interface_get_name(SnapdInterface *interface); 26 | 27 | const gchar *snapd_interface_get_summary(SnapdInterface *interface); 28 | 29 | const gchar *snapd_interface_get_doc_url(SnapdInterface *interface); 30 | 31 | GPtrArray *snapd_interface_get_plugs(SnapdInterface *interface); 32 | 33 | GPtrArray *snapd_interface_get_slots(SnapdInterface *interface); 34 | 35 | gchar *snapd_interface_make_label(SnapdInterface *interface); 36 | 37 | G_END_DECLS 38 | 39 | #endif /* __SNAPD_INTERFACE_H__ */ 40 | -------------------------------------------------------------------------------- /snapd-glib/snapd-link.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_LINK_H__ 11 | #define __SNAPD_LINK_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_LINK (snapd_link_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdLink, snapd_link, SNAPD, LINK, GObject) 24 | 25 | GStrv snapd_link_get_urls(SnapdLink *link); 26 | 27 | const gchar *snapd_link_get_url_type(SnapdLink *link); 28 | 29 | G_END_DECLS 30 | 31 | #endif /* __SNAPD_LINK_H__ */ 32 | -------------------------------------------------------------------------------- /snapd-glib/snapd-log.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_LOG_H__ 11 | #define __SNAPD_LOG_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_LOG (snapd_log_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdLog, snapd_log, SNAPD, LOG, GObject) 24 | 25 | GDateTime *snapd_log_get_timestamp(SnapdLog *log); 26 | 27 | const gchar *snapd_log_get_message(SnapdLog *log); 28 | 29 | const gchar *snapd_log_get_sid(SnapdLog *log); 30 | 31 | const gchar *snapd_log_get_pid(SnapdLog *log); 32 | 33 | G_END_DECLS 34 | 35 | #endif /* __SNAPD_LOG_H__ */ 36 | -------------------------------------------------------------------------------- /snapd-glib/snapd-login.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_LOGIN_H__ 11 | #define __SNAPD_LOGIN_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | G_BEGIN_DECLS 23 | 24 | G_DEPRECATED_FOR(snapd_client_login2_sync) 25 | SnapdAuthData *snapd_login_sync(const gchar *username, const gchar *password, 26 | const gchar *otp, GCancellable *cancellable, 27 | GError **error); 28 | G_DEPRECATED_FOR(snapd_client_login2_async) 29 | void snapd_login_async(const gchar *username, const gchar *password, 30 | const gchar *otp, GCancellable *cancellable, 31 | GAsyncReadyCallback callback, gpointer user_data); 32 | G_DEPRECATED_FOR(snapd_client_login2_finish) 33 | SnapdAuthData *snapd_login_finish(GAsyncResult *result, GError **error); 34 | 35 | G_END_DECLS 36 | 37 | #endif /* __SNAPD_LOGIN_H__ */ 38 | -------------------------------------------------------------------------------- /snapd-glib/snapd-maintenance.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_MAINTENANCE_H__ 11 | #define __SNAPD_MAINTENANCE_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_MAINTENANCE (snapd_maintenance_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdMaintenance, snapd_maintenance, SNAPD, MAINTENANCE, 24 | GObject) 25 | 26 | /** 27 | * SnapdMaintenanceKind: 28 | * @SNAPD_MAINTENANCE_KIND_UNKNOWN: an unknown maintenance kind is occurring. 29 | * @SNAPD_MAINTENANCE_KIND_DAEMON_RESTART: the daemon is restarting. 30 | * @SNAPD_MAINTENANCE_KIND_SYSTEM_RESTART: the system is restarting. 31 | * 32 | * Type of snap. 33 | * 34 | * Since: 1.45 35 | */ 36 | typedef enum { 37 | SNAPD_MAINTENANCE_KIND_UNKNOWN, 38 | SNAPD_MAINTENANCE_KIND_DAEMON_RESTART, 39 | SNAPD_MAINTENANCE_KIND_SYSTEM_RESTART 40 | } SnapdMaintenanceKind; 41 | 42 | SnapdMaintenanceKind snapd_maintenance_get_kind(SnapdMaintenance *maintenance); 43 | 44 | const gchar *snapd_maintenance_get_message(SnapdMaintenance *maintenance); 45 | 46 | G_END_DECLS 47 | 48 | #endif /* __SNAPD_MAINTENANCE_H__ */ 49 | -------------------------------------------------------------------------------- /snapd-glib/snapd-markdown-node.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_MARKDOWN_NODE_H__ 11 | #define __SNAPD_MARKDOWN_NODE_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_MARKDOWN_NODE (snapd_markdown_node_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdMarkdownNode, snapd_markdown_node, SNAPD, 24 | MARKDOWN_NODE, GObject) 25 | 26 | /** 27 | * SnapdMarkdownNodeType: 28 | * @SNAPD_MARKDOWN_NODE_TYPE_TEXT: a piece of text. 29 | * @SNAPD_MARKDOWN_NODE_TYPE_PARAGRAPH: a paragraph. 30 | * @SNAPD_MARKDOWN_NODE_TYPE_UNORDERED_LIST: an unordered list. 31 | * @SNAPD_MARKDOWN_NODE_TYPE_LIST_ITEM: a list item. 32 | * @SNAPD_MARKDOWN_NODE_TYPE_CODE_BLOCK: a code block. 33 | * @SNAPD_MARKDOWN_NODE_TYPE_CODE_SPAN: a code span. 34 | * @SNAPD_MARKDOWN_NODE_TYPE_EMPHASIS: emphasised text. 35 | * @SNAPD_MARKDOWN_NODE_TYPE_STRONG_EMPHASIS: strongly emphasised text. 36 | * @SNAPD_MARKDOWN_NODE_TYPE_URL: a URL. 37 | * 38 | * Type of markdown node. 39 | * 40 | * Since: 1.48 41 | */ 42 | typedef enum { 43 | SNAPD_MARKDOWN_NODE_TYPE_TEXT, 44 | SNAPD_MARKDOWN_NODE_TYPE_PARAGRAPH, 45 | SNAPD_MARKDOWN_NODE_TYPE_UNORDERED_LIST, 46 | SNAPD_MARKDOWN_NODE_TYPE_LIST_ITEM, 47 | SNAPD_MARKDOWN_NODE_TYPE_CODE_BLOCK, 48 | SNAPD_MARKDOWN_NODE_TYPE_CODE_SPAN, 49 | SNAPD_MARKDOWN_NODE_TYPE_EMPHASIS, 50 | SNAPD_MARKDOWN_NODE_TYPE_STRONG_EMPHASIS, 51 | SNAPD_MARKDOWN_NODE_TYPE_URL 52 | } SnapdMarkdownNodeType; 53 | 54 | SnapdMarkdownNodeType 55 | snapd_markdown_node_get_node_type(SnapdMarkdownNode *node); 56 | 57 | const gchar *snapd_markdown_node_get_text(SnapdMarkdownNode *node); 58 | 59 | GPtrArray *snapd_markdown_node_get_children(SnapdMarkdownNode *node); 60 | 61 | G_END_DECLS 62 | 63 | #endif /* __SNAPD_MARKDOWN_NODE_H__ */ 64 | -------------------------------------------------------------------------------- /snapd-glib/snapd-markdown-parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_MARKDOWN_PARSER_H__ 11 | #define __SNAPD_MARKDOWN_PARSER_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_MARKDOWN_PARSER (snapd_markdown_parser_get_type()) 22 | 23 | /** 24 | * SnapdMarkdownVersion: 25 | * @SNAPD_MARKDOWN_VERSION_0: the initial version of Snap markdown. 26 | * 27 | * Version of markdown to parse. Picking a version will ensure only nodes of the 28 | * expected type are decoded. 29 | * 30 | * Since: 1.48 31 | */ 32 | typedef enum { SNAPD_MARKDOWN_VERSION_0 } SnapdMarkdownVersion; 33 | 34 | G_DECLARE_FINAL_TYPE(SnapdMarkdownParser, snapd_markdown_parser, SNAPD, 35 | MARKDOWN_PARSER, GObject) 36 | 37 | SnapdMarkdownParser *snapd_markdown_parser_new(SnapdMarkdownVersion version); 38 | 39 | void snapd_markdown_parser_set_preserve_whitespace( 40 | SnapdMarkdownParser *parser, gboolean preserve_whitespace); 41 | 42 | gboolean 43 | snapd_markdown_parser_get_preserve_whitespace(SnapdMarkdownParser *parser); 44 | 45 | GPtrArray *snapd_markdown_parser_parse(SnapdMarkdownParser *parser, 46 | const gchar *text); 47 | 48 | G_END_DECLS 49 | 50 | #endif /* __SNAPD_MARKDOWN_PARSER_H__ */ 51 | -------------------------------------------------------------------------------- /snapd-glib/snapd-media.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_MEDIA_H__ 11 | #define __SNAPD_MEDIA_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_MEDIA (snapd_media_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdMedia, snapd_media, SNAPD, MEDIA, GObject) 24 | 25 | const gchar *snapd_media_get_media_type(SnapdMedia *media); 26 | 27 | const gchar *snapd_media_get_url(SnapdMedia *media); 28 | 29 | guint snapd_media_get_width(SnapdMedia *media); 30 | 31 | guint snapd_media_get_height(SnapdMedia *media); 32 | 33 | G_END_DECLS 34 | 35 | #endif /* __SNAPD_MEDIA_H__ */ 36 | -------------------------------------------------------------------------------- /snapd-glib/snapd-notice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_NOTICE_H__ 11 | #define __SNAPD_NOTICE_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | typedef enum { 20 | SNAPD_NOTICE_TYPE_UNKNOWN = 0, 21 | SNAPD_NOTICE_TYPE_CHANGE_UPDATE, 22 | SNAPD_NOTICE_TYPE_REFRESH_INHIBIT, 23 | SNAPD_NOTICE_TYPE_SNAP_RUN_INHIBIT 24 | } SnapdNoticeType; 25 | 26 | G_BEGIN_DECLS 27 | 28 | #define SNAPD_TYPE_NOTICE (snapd_notice_get_type()) 29 | 30 | G_DECLARE_FINAL_TYPE(SnapdNotice, snapd_notice, SNAPD, NOTICE, GObject) 31 | 32 | const gchar *snapd_notice_get_id(SnapdNotice *notice); 33 | 34 | const gchar *snapd_notice_get_user_id(SnapdNotice *notice); 35 | 36 | SnapdNoticeType snapd_notice_get_notice_type(SnapdNotice *notice); 37 | 38 | const gchar *snapd_notice_get_key(SnapdNotice *notice); 39 | 40 | GDateTime *snapd_notice_get_first_occurred(SnapdNotice *notice) G_DEPRECATED; 41 | 42 | GDateTime *snapd_notice_get_first_occurred2(SnapdNotice *notice); 43 | 44 | GDateTime *snapd_notice_get_last_occurred(SnapdNotice *notice) G_DEPRECATED; 45 | 46 | GDateTime *snapd_notice_get_last_occurred2(SnapdNotice *notice); 47 | 48 | int snapd_notice_get_last_occurred_nanoseconds(SnapdNotice *notice); 49 | 50 | GDateTime *snapd_notice_get_last_repeated(SnapdNotice *notice) G_DEPRECATED; 51 | 52 | GDateTime *snapd_notice_get_last_repeated2(SnapdNotice *notice); 53 | 54 | gint64 snapd_notice_get_occurrences(SnapdNotice *notice); 55 | 56 | GHashTable *snapd_notice_get_last_data(SnapdNotice *notice) G_DEPRECATED; 57 | 58 | GHashTable *snapd_notice_get_last_data2(SnapdNotice *notice); 59 | 60 | GTimeSpan snapd_notice_get_repeat_after(SnapdNotice *notice); 61 | 62 | GTimeSpan snapd_notice_get_expire_after(SnapdNotice *notice); 63 | 64 | gint snapd_notice_compare_last_occurred(SnapdNotice *notice, 65 | SnapdNotice *notice_to_compare); 66 | 67 | G_END_DECLS 68 | 69 | #endif /* __SNAPD_NOTICE_H__ */ 70 | -------------------------------------------------------------------------------- /snapd-glib/snapd-notices-monitor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd 3 | * 4 | * This program is free software: you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License version 3 as 6 | * published by the Free Software Foundation. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | G_BEGIN_DECLS 23 | 24 | G_DECLARE_FINAL_TYPE(SnapdNoticesMonitor, snapd_notices_monitor, SNAPD, 25 | NOTICES_MONITOR, GObject) 26 | 27 | SnapdNoticesMonitor *snapd_notices_monitor_new(void); 28 | 29 | SnapdNoticesMonitor *snapd_notices_monitor_new_with_client(SnapdClient *client); 30 | 31 | gboolean snapd_notices_monitor_start(SnapdNoticesMonitor *monitor, 32 | GError **error); 33 | 34 | gboolean snapd_notices_monitor_stop(SnapdNoticesMonitor *monitor, 35 | GError **error); 36 | 37 | G_END_DECLS 38 | -------------------------------------------------------------------------------- /snapd-glib/snapd-plug-ref.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_PLUG_REF_H__ 11 | #define __SNAPD_PLUG_REF_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_PLUG_REF (snapd_plug_ref_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdPlugRef, snapd_plug_ref, SNAPD, PLUG_REF, GObject) 24 | 25 | const gchar *snapd_plug_ref_get_plug(SnapdPlugRef *plug_ref); 26 | 27 | const gchar *snapd_plug_ref_get_snap(SnapdPlugRef *plug_ref); 28 | 29 | G_END_DECLS 30 | 31 | #endif /* __SNAPD_PLUG_REF_H__ */ 32 | -------------------------------------------------------------------------------- /snapd-glib/snapd-plug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_PLUG_H__ 11 | #define __SNAPD_PLUG_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_PLUG (snapd_plug_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdPlug, snapd_plug, SNAPD, PLUG, GObject) 24 | 25 | const gchar *snapd_plug_get_name(SnapdPlug *plug); 26 | 27 | const gchar *snapd_plug_get_snap(SnapdPlug *plug); 28 | 29 | const gchar *snapd_plug_get_interface(SnapdPlug *plug); 30 | 31 | GStrv snapd_plug_get_attribute_names(SnapdPlug *plug, guint *length); 32 | 33 | gboolean snapd_plug_has_attribute(SnapdPlug *plug, const gchar *name); 34 | 35 | GVariant *snapd_plug_get_attribute(SnapdPlug *plug, const gchar *name); 36 | 37 | const gchar *snapd_plug_get_label(SnapdPlug *plug); 38 | 39 | GPtrArray *snapd_plug_get_connections(SnapdPlug *plug) 40 | G_DEPRECATED_FOR(snapd_plug_get_connected_slots); 41 | 42 | GPtrArray *snapd_plug_get_connected_slots(SnapdPlug *plug); 43 | 44 | G_END_DECLS 45 | 46 | #endif /* __SNAPD_PLUG_H__ */ 47 | -------------------------------------------------------------------------------- /snapd-glib/snapd-price.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_PRICE_H__ 11 | #define __SNAPD_PRICE_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_PRICE (snapd_price_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdPrice, snapd_price, SNAPD, PRICE, GObject) 24 | 25 | gdouble snapd_price_get_amount(SnapdPrice *price); 26 | 27 | const gchar *snapd_price_get_currency(SnapdPrice *price); 28 | 29 | G_END_DECLS 30 | 31 | #endif /* __SNAPD_PRICE_H__ */ 32 | -------------------------------------------------------------------------------- /snapd-glib/snapd-screenshot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_SCREENSHOT_H__ 11 | #define __SNAPD_SCREENSHOT_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_SCREENSHOT (snapd_screenshot_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdScreenshot, snapd_screenshot, SNAPD, SCREENSHOT, 24 | GObject) 25 | 26 | const gchar *snapd_screenshot_get_url(SnapdScreenshot *screenshot); 27 | 28 | guint snapd_screenshot_get_width(SnapdScreenshot *screenshot); 29 | 30 | guint snapd_screenshot_get_height(SnapdScreenshot *screenshot); 31 | 32 | G_END_DECLS 33 | 34 | #endif /* __SNAPD_SCREENSHOT_H__ */ 35 | -------------------------------------------------------------------------------- /snapd-glib/snapd-slot-ref.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_SLOT_REF_H__ 11 | #define __SNAPD_SLOT_REF_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_SLOT_REF (snapd_slot_ref_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdSlotRef, snapd_slot_ref, SNAPD, SLOT_REF, GObject) 24 | 25 | const gchar *snapd_slot_ref_get_slot(SnapdSlotRef *slot_ref); 26 | 27 | const gchar *snapd_slot_ref_get_snap(SnapdSlotRef *slot_ref); 28 | 29 | G_END_DECLS 30 | 31 | #endif /* __SNAPD_SLOT_REF_H__ */ 32 | -------------------------------------------------------------------------------- /snapd-glib/snapd-slot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_SLOT_H__ 11 | #define __SNAPD_SLOT_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_SLOT (snapd_slot_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdSlot, snapd_slot, SNAPD, SLOT, GObject) 24 | 25 | const gchar *snapd_slot_get_name(SnapdSlot *slot); 26 | 27 | const gchar *snapd_slot_get_snap(SnapdSlot *slot); 28 | 29 | const gchar *snapd_slot_get_interface(SnapdSlot *slot); 30 | 31 | GStrv snapd_slot_get_attribute_names(SnapdSlot *slot, guint *length); 32 | 33 | gboolean snapd_slot_has_attribute(SnapdSlot *slot, const gchar *name); 34 | 35 | GVariant *snapd_slot_get_attribute(SnapdSlot *slot, const gchar *name); 36 | 37 | const gchar *snapd_slot_get_label(SnapdSlot *slot); 38 | 39 | GPtrArray *snapd_slot_get_connections(SnapdSlot *slot) 40 | G_DEPRECATED_FOR(snapd_slot_get_connected_plugs); 41 | 42 | GPtrArray *snapd_slot_get_connected_plugs(SnapdSlot *slot); 43 | 44 | G_END_DECLS 45 | 46 | #endif /* __SNAPD_SLOT_H__ */ 47 | -------------------------------------------------------------------------------- /snapd-glib/snapd-task-data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_TASK_DATA_H__ 11 | #define __SNAPD_TASK_DATA_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | #define SNAPD_TYPE_TASK_DATA (snapd_task_data_get_type()) 22 | 23 | G_DECLARE_FINAL_TYPE(SnapdTaskData, snapd_task_data, SNAPD, TASK_DATA, GObject) 24 | 25 | GStrv snapd_task_data_get_affected_snaps(SnapdTaskData *task_data); 26 | 27 | G_END_DECLS 28 | 29 | #endif /* __SNAPD_TASK_DATA_H__ */ 30 | -------------------------------------------------------------------------------- /snapd-glib/snapd-task.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_TASK_H__ 11 | #define __SNAPD_TASK_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include "snapd-task-data.h" 18 | #include 19 | 20 | G_BEGIN_DECLS 21 | 22 | #define SNAPD_TYPE_TASK (snapd_task_get_type()) 23 | 24 | G_DECLARE_FINAL_TYPE(SnapdTask, snapd_task, SNAPD, TASK, GObject) 25 | 26 | const gchar *snapd_task_get_id(SnapdTask *task); 27 | 28 | const gchar *snapd_task_get_kind(SnapdTask *task); 29 | 30 | const gchar *snapd_task_get_summary(SnapdTask *task); 31 | 32 | const gchar *snapd_task_get_status(SnapdTask *task); 33 | 34 | G_DEPRECATED_FOR(snapd_change_get_ready) 35 | gboolean snapd_task_get_ready(SnapdTask *task); 36 | 37 | const gchar *snapd_task_get_progress_label(SnapdTask *task); 38 | 39 | gint64 snapd_task_get_progress_done(SnapdTask *task); 40 | 41 | gint64 snapd_task_get_progress_total(SnapdTask *task); 42 | 43 | GDateTime *snapd_task_get_spawn_time(SnapdTask *task); 44 | 45 | GDateTime *snapd_task_get_ready_time(SnapdTask *task); 46 | 47 | SnapdTaskData *snapd_task_get_data(SnapdTask *task); 48 | 49 | G_END_DECLS 50 | 51 | #endif /* __SNAPD_TASK_H__ */ 52 | -------------------------------------------------------------------------------- /snapd-glib/snapd-user-information.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef __SNAPD_USER_INFORMATION_H__ 11 | #define __SNAPD_USER_INFORMATION_H__ 12 | 13 | #if !defined(__SNAPD_GLIB_INSIDE__) && !defined(SNAPD_COMPILATION) 14 | #error "Only can be included directly." 15 | #endif 16 | 17 | #include 18 | 19 | #include "snapd-auth-data.h" 20 | 21 | G_BEGIN_DECLS 22 | 23 | #define SNAPD_TYPE_USER_INFORMATION (snapd_user_information_get_type()) 24 | 25 | G_DECLARE_FINAL_TYPE(SnapdUserInformation, snapd_user_information, SNAPD, 26 | USER_INFORMATION, GObject) 27 | 28 | gint64 snapd_user_information_get_id(SnapdUserInformation *user_information); 29 | 30 | const gchar * 31 | snapd_user_information_get_username(SnapdUserInformation *user_information); 32 | 33 | const gchar * 34 | snapd_user_information_get_email(SnapdUserInformation *user_information); 35 | 36 | GStrv snapd_user_information_get_ssh_keys( 37 | SnapdUserInformation *user_information); 38 | 39 | SnapdAuthData * 40 | snapd_user_information_get_auth_data(SnapdUserInformation *user_information); 41 | 42 | G_END_DECLS 43 | 44 | #endif /* __SNAPD_USER_INFORMATION_H__ */ 45 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Alias: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/App: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Assertion: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/AuthData: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Category: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_CATEGORY_H 11 | #define SNAPD_CATEGORY_H 12 | 13 | #include 14 | #include 15 | 16 | #include "snapdqt_global.h" 17 | 18 | class LIBSNAPDQT_EXPORT QSnapdCategory : public QSnapdWrappedObject 19 | { 20 | Q_OBJECT 21 | 22 | Q_PROPERTY(QString name READ name) 23 | Q_PROPERTY(bool featured READ featured) 24 | 25 | public: 26 | explicit QSnapdCategory (void* snapd_object, QObject* parent = 0); 27 | 28 | QString name () const; 29 | bool featured () const; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/CategoryDetails: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Change: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Channel: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Client: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Connection: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Enums: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Icon: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Interface: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Link: -------------------------------------------------------------------------------- 1 | #include -------------------------------------------------------------------------------- /snapd-qt/Snapd/Maintenance: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/MarkdownNode: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/MarkdownParser: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Media: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Notice: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Plug: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/PlugRef: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Price: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Request: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Screenshot: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Slot: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/SlotRef: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Snap: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/SystemInformation: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/Task: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/TaskData: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/UserInformation: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/WrappedObject: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/alias.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_ALIAS_H 11 | #define SNAPD_ALIAS_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "snapdqt_global.h" 18 | 19 | class LIBSNAPDQT_EXPORT QSnapdAlias : public QSnapdWrappedObject { 20 | Q_OBJECT 21 | 22 | Q_PROPERTY(QString app READ app) 23 | Q_PROPERTY(QString appAuto READ appAuto) 24 | Q_PROPERTY(QString command READ command) 25 | Q_PROPERTY(QString appManual READ appManual) 26 | Q_PROPERTY(QString name READ name) 27 | Q_PROPERTY(QString snap READ snap) 28 | Q_PROPERTY(QSnapdEnums::AliasStatus status READ status) 29 | 30 | public: 31 | explicit QSnapdAlias(void *snapd_object, QObject *parent = 0); 32 | 33 | Q_DECL_DEPRECATED QString app() const; 34 | QString appAuto() const; 35 | QString command() const; 36 | QString appManual() const; 37 | QString name() const; 38 | QString snap() const; 39 | QSnapdEnums::AliasStatus status() const; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/app.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_APP_H 11 | #define SNAPD_APP_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "snapdqt_global.h" 18 | 19 | class LIBSNAPDQT_EXPORT QSnapdApp : public QSnapdWrappedObject { 20 | Q_OBJECT 21 | 22 | Q_PROPERTY(QString name READ name) 23 | Q_PROPERTY(bool active READ active) 24 | Q_PROPERTY(QStringList aliases READ aliases) 25 | Q_PROPERTY(QString commonId READ commonId) 26 | Q_PROPERTY(QSnapdEnums::DaemonType daemonType READ daemonType) 27 | Q_PROPERTY(QString desktopFile READ desktopFile) 28 | Q_PROPERTY(bool enabled READ enabled) 29 | Q_PROPERTY(QString snap READ snap) 30 | 31 | public: 32 | explicit QSnapdApp(void *snapd_object, QObject *parent = 0); 33 | 34 | QString name() const; 35 | bool active() const; 36 | Q_DECL_DEPRECATED QStringList aliases() const; 37 | QString commonId() const; 38 | QSnapdEnums::DaemonType daemonType() const; 39 | QString desktopFile() const; 40 | bool enabled() const; 41 | QString snap() const; 42 | }; 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/assertion.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_ASSERTION_H 11 | #define SNAPD_ASSERTION_H 12 | 13 | #include 14 | #include 15 | 16 | #include "snapdqt_global.h" 17 | 18 | class LIBSNAPDQT_EXPORT QSnapdAssertion : public QSnapdWrappedObject { 19 | Q_OBJECT 20 | 21 | Q_PROPERTY(QStringList headers READ headers) 22 | Q_PROPERTY(QString body READ body) 23 | Q_PROPERTY(QString signature READ signature) 24 | 25 | public: 26 | explicit QSnapdAssertion(const QString &content, QObject *parent = 0); 27 | 28 | Q_INVOKABLE QString header(const QString &name) const; 29 | QStringList headers() const; 30 | QString body() const; 31 | QString signature() const; 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/auth-data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_AUTH_DATA_H 11 | #define SNAPD_AUTH_DATA_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "snapdqt_global.h" 18 | 19 | class LIBSNAPDQT_EXPORT QSnapdAuthData : public QSnapdWrappedObject { 20 | Q_OBJECT 21 | Q_PROPERTY(QString macaroon READ macaroon) 22 | Q_PROPERTY(QStringList discharges READ discharges) 23 | 24 | public: 25 | explicit QSnapdAuthData(void *snapd_object, QObject *parent = 0); 26 | explicit QSnapdAuthData(const QString &macaroon, 27 | const QStringList &discharges, QObject *parent = 0); 28 | explicit QSnapdAuthData(QObject *parent = 0); 29 | 30 | QString macaroon() const; 31 | QStringList discharges() const; 32 | }; 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/category-details.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_CATEGORY_DETAILS_H 11 | #define SNAPD_CATEGORY_DETAILS_H 12 | 13 | #include 14 | #include 15 | 16 | #include "snapdqt_global.h" 17 | 18 | class LIBSNAPDQT_EXPORT QSnapdCategoryDetails : public QSnapdWrappedObject { 19 | Q_OBJECT 20 | 21 | Q_PROPERTY(QString name READ name) 22 | 23 | public: 24 | explicit QSnapdCategoryDetails(void *snapd_object, QObject *parent = 0); 25 | 26 | QString name() const; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/category.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_CATEGORY_H 11 | #define SNAPD_CATEGORY_H 12 | 13 | #include 14 | #include 15 | 16 | #include "snapdqt_global.h" 17 | 18 | class LIBSNAPDQT_EXPORT QSnapdCategory : public QSnapdWrappedObject { 19 | Q_OBJECT 20 | 21 | Q_PROPERTY(QString name READ name) 22 | Q_PROPERTY(bool featured READ featured) 23 | 24 | public: 25 | explicit QSnapdCategory(void *snapd_object, QObject *parent = 0); 26 | 27 | QString name() const; 28 | bool featured() const; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/change-autorefresh-data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_AUTOREFRESH_CHANGE_DATA_H 11 | #define SNAPD_AUTOREFRESH_CHANGE_DATA_H 12 | 13 | #include "change-data.h" 14 | #include 15 | #include 16 | #include 17 | 18 | #include "snapdqt_global.h" 19 | 20 | class LIBSNAPDQT_EXPORT QSnapdAutorefreshChangeData : public QSnapdChangeData { 21 | Q_OBJECT 22 | 23 | Q_PROPERTY(QStringList snapNames READ snapNames) 24 | Q_PROPERTY(QStringList refreshForced READ refreshForced) 25 | 26 | public: 27 | explicit QSnapdAutorefreshChangeData(void *snapd_object, QObject *parent = 0); 28 | 29 | QStringList snapNames() const; 30 | QStringList refreshForced() const; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/change-data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_CHANGE_DATA_H 11 | #define SNAPD_CHANGE_DATA_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "snapdqt_global.h" 18 | 19 | class LIBSNAPDQT_EXPORT QSnapdChangeData : public QSnapdWrappedObject { 20 | Q_OBJECT 21 | 22 | public: 23 | explicit QSnapdChangeData(void *snapd_object, QObject *parent = 0); 24 | }; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/change.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_CHANGE_H 11 | #define SNAPD_CHANGE_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | #include "snapdqt_global.h" 21 | 22 | class LIBSNAPDQT_EXPORT QSnapdChange : public QSnapdWrappedObject { 23 | Q_OBJECT 24 | 25 | Q_PROPERTY(QString id READ id) 26 | Q_PROPERTY(QString kind READ kind) 27 | Q_PROPERTY(QString summary READ summary) 28 | Q_PROPERTY(QString status READ status) 29 | Q_PROPERTY(bool ready READ ready) 30 | Q_PROPERTY(int taskCount READ taskCount) 31 | Q_PROPERTY(QDateTime spawnTime READ spawnTime) 32 | Q_PROPERTY(QDateTime readyTime READ readyTime) 33 | Q_PROPERTY(QString error READ error) 34 | Q_PROPERTY(QSnapdChangeData *data READ data) 35 | 36 | public: 37 | explicit QSnapdChange(void *snapd_object, QObject *parent = 0); 38 | 39 | QString id() const; 40 | QString kind() const; 41 | QString summary() const; 42 | QString status() const; 43 | bool ready() const; 44 | int taskCount() const; 45 | Q_INVOKABLE QSnapdTask *task(int) const; 46 | QDateTime spawnTime() const; 47 | QDateTime readyTime() const; 48 | QString error() const; 49 | QSnapdChangeData *data() const; 50 | }; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/channel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_CHANNEL_H 11 | #define SNAPD_CHANNEL_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "snapdqt_global.h" 19 | 20 | class LIBSNAPDQT_EXPORT QSnapdChannel : public QSnapdWrappedObject { 21 | Q_OBJECT 22 | 23 | Q_PROPERTY(QString branch READ branch CONSTANT) 24 | Q_PROPERTY(QSnapdEnums::SnapConfinement confinement READ confinement CONSTANT) 25 | Q_PROPERTY(QString epoch READ epoch CONSTANT) 26 | Q_PROPERTY(QString name READ name CONSTANT) 27 | Q_PROPERTY(QDateTime releasedAt READ releasedAt CONSTANT) 28 | Q_PROPERTY(QString revision READ revision CONSTANT) 29 | Q_PROPERTY(QString risk READ risk CONSTANT) 30 | Q_PROPERTY(qint64 size READ size CONSTANT) 31 | Q_PROPERTY(QString track READ track CONSTANT) 32 | Q_PROPERTY(QString version READ version CONSTANT) 33 | 34 | public: 35 | explicit QSnapdChannel(void *snapd_object, QObject *parent = 0); 36 | 37 | QString branch() const; 38 | QSnapdEnums::SnapConfinement confinement() const; 39 | QString epoch() const; 40 | QString name() const; 41 | QDateTime releasedAt() const; 42 | QString revision() const; 43 | QString risk() const; 44 | qint64 size() const; 45 | QString track() const; 46 | QString version() const; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/connection.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_CONNECTION_H 11 | #define SNAPD_CONNECTION_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include "snapdqt_global.h" 20 | 21 | class LIBSNAPDQT_EXPORT QSnapdConnection : public QSnapdWrappedObject { 22 | Q_OBJECT 23 | 24 | Q_PROPERTY(QSnapdSlotRef slot READ slot) 25 | Q_PROPERTY(QSnapdPlugRef plug READ plug) 26 | Q_PROPERTY(QString interface READ interface) 27 | Q_PROPERTY(bool manual READ manual) 28 | Q_PROPERTY(bool gadget READ gadget) 29 | Q_PROPERTY(QString name READ name) 30 | Q_PROPERTY(QString snap READ snap) 31 | 32 | public: 33 | explicit QSnapdConnection(void *snapd_object, QObject *parent = 0); 34 | 35 | QSnapdSlotRef *slot() const; 36 | QSnapdPlugRef *plug() const; 37 | QString interface() const; 38 | bool manual() const; 39 | bool gadget() const; 40 | Q_INVOKABLE QStringList slotAttributeNames() const; 41 | Q_INVOKABLE bool hasSlotAttribute(const QString &name) const; 42 | Q_INVOKABLE QVariant slotAttribute(const QString &name) const; 43 | Q_INVOKABLE QStringList plugAttributeNames() const; 44 | Q_INVOKABLE bool hasPlugAttribute(const QString &name) const; 45 | Q_INVOKABLE QVariant plugAttribute(const QString &name) const; 46 | QString name() const; 47 | QString snap() const; 48 | }; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/enums.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_ENUMS_H 11 | #define SNAPD_ENUMS_H 12 | 13 | #include 14 | 15 | #include "snapdqt_global.h" 16 | 17 | class LIBSNAPDQT_EXPORT QSnapdEnums : public QObject { 18 | Q_OBJECT 19 | 20 | public: 21 | enum AliasStatus { 22 | AliasStatusUnknown, 23 | AliasStatusDefault, 24 | AliasStatusEnabled, 25 | AliasStatusDisabled, 26 | AliasStatusAuto, 27 | AliasStatusManual 28 | }; 29 | Q_ENUM(AliasStatus) 30 | 31 | enum DaemonType { 32 | DaemonTypeNone, 33 | DaemonTypeUnknown, 34 | DaemonTypeSimple, 35 | DaemonTypeForking, 36 | DaemonTypeOneshot, 37 | DaemonTypeDbus, 38 | DaemonTypeNotify 39 | }; 40 | Q_ENUM(DaemonType) 41 | 42 | enum SnapConfinement { 43 | SnapConfinementUnknown, 44 | SnapConfinementStrict, 45 | SnapConfinementDevmode, 46 | SnapConfinementClassic 47 | }; 48 | Q_ENUM(SnapConfinement) 49 | 50 | enum SnapType { 51 | SnapTypeUnknown, 52 | SnapTypeApp, 53 | SnapTypeKernel, 54 | SnapTypeGadget, 55 | SnapTypeOperatingSystem, 56 | SnapTypeCore, 57 | SnapTypeBase, 58 | SnapTypeSnapd 59 | }; 60 | Q_ENUM(SnapType) 61 | 62 | enum SnapStatus { 63 | SnapStatusUnknown, 64 | SnapStatusAvailable, 65 | SnapStatusPriced, 66 | SnapStatusInstalled, 67 | SnapStatusActive 68 | }; 69 | Q_ENUM(SnapStatus) 70 | 71 | enum SystemConfinement { 72 | SystemConfinementUnknown, 73 | SystemConfinementStrict, 74 | SystemConfinementPartial 75 | }; 76 | Q_ENUM(SystemConfinement) 77 | 78 | enum PublisherValidation { 79 | PublisherValidationUnknown, 80 | PublisherValidationUnproven, 81 | PublisherValidationVerified, 82 | PublisherValidationStarred 83 | }; 84 | Q_ENUM(PublisherValidation) 85 | 86 | enum MaintenanceKind { 87 | MaintenanceKindUnknown, 88 | MaintenanceKindDaemonRestart, 89 | MaintenanceKindSystemRestart 90 | }; 91 | Q_ENUM(MaintenanceKind) 92 | 93 | enum SnapNoticeType { 94 | SnapNoticeTypeUnknown, 95 | SnapNoticeTypeChangeUpdate, 96 | SnapNoticeTypeRefreshInhibit, 97 | SnapNoticeTypeSnapRunInhibit 98 | }; 99 | Q_ENUM(SnapNoticeType) 100 | }; 101 | 102 | #endif 103 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/icon.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_ICON_H 11 | #define SNAPD_ICON_H 12 | 13 | #include 14 | #include 15 | 16 | #include "snapdqt_global.h" 17 | 18 | class LIBSNAPDQT_EXPORT QSnapdIcon : public QSnapdWrappedObject { 19 | Q_OBJECT 20 | 21 | Q_PROPERTY(QString mimeType READ mimeType) 22 | Q_PROPERTY(QByteArray data READ data) 23 | 24 | public: 25 | explicit QSnapdIcon(void *snapd_object, QObject *parent = 0); 26 | 27 | QString mimeType() const; 28 | QByteArray data() const; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/interface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_INTERFACE_H 11 | #define SNAPD_INTERFACE_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "snapdqt_global.h" 19 | 20 | class LIBSNAPDQT_EXPORT QSnapdInterface : public QSnapdWrappedObject { 21 | Q_OBJECT 22 | 23 | Q_PROPERTY(QString name READ name) 24 | Q_PROPERTY(QString summary READ summary) 25 | Q_PROPERTY(QString docUrl READ docUrl) 26 | Q_PROPERTY(int plugCount READ plugCount) 27 | Q_PROPERTY(int slotCount READ slotCount) 28 | 29 | public: 30 | explicit QSnapdInterface(void *snapd_object, QObject *parent = 0); 31 | 32 | QString name() const; 33 | QString summary() const; 34 | QString docUrl() const; 35 | int plugCount() const; 36 | Q_INVOKABLE QSnapdPlug *plug(int) const; 37 | int slotCount() const; 38 | Q_INVOKABLE QSnapdSlot *slot(int) const; 39 | Q_INVOKABLE QString makeLabel() const; 40 | }; 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/link.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_LINK_H 11 | #define SNAPD_LINK_H 12 | 13 | #include 14 | #include 15 | 16 | class LIBSNAPDQT_EXPORT QSnapdLink : public QSnapdWrappedObject { 17 | Q_OBJECT 18 | 19 | Q_PROPERTY(QString type READ type) 20 | Q_PROPERTY(QStringList urls READ urls) 21 | 22 | public: 23 | explicit QSnapdLink(void *snapd_object, QObject *parent = 0); 24 | 25 | QString type() const; 26 | QStringList urls() const; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/maintenance.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_MAINTENANCE_H 11 | #define SNAPD_MAINTENANCE_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "snapdqt_global.h" 18 | 19 | class LIBSNAPDQT_EXPORT QSnapdMaintenance : public QSnapdWrappedObject { 20 | Q_OBJECT 21 | 22 | Q_PROPERTY(QSnapdEnums::MaintenanceKind kind READ kind) 23 | Q_PROPERTY(QString message READ message) 24 | 25 | public: 26 | explicit QSnapdMaintenance(void *snapd_object, QObject *parent = 0); 27 | 28 | QSnapdEnums::MaintenanceKind kind() const; 29 | QString message() const; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/markdown-node.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_MARKDOWN_NODE_H 11 | #define SNAPD_MARKDOWN_NODE_H 12 | 13 | #include 14 | #include 15 | 16 | #include "snapdqt_global.h" 17 | 18 | class LIBSNAPDQT_EXPORT QSnapdMarkdownNode : public QSnapdWrappedObject { 19 | Q_OBJECT 20 | 21 | Q_PROPERTY(NodeType type READ type) 22 | Q_PROPERTY(QString text READ text) 23 | 24 | public: 25 | enum NodeType { 26 | NodeTypeText, 27 | NodeTypeParagraph, 28 | NodeTypeUnorderedList, 29 | NodeTypeListItem, 30 | NodeTypeCodeBlock, 31 | NodeTypeCodeSpan, 32 | NodeTypeEmphasis, 33 | NodeTypeStrongEmphasis, 34 | NodeTypeUrl, 35 | }; 36 | Q_ENUM(NodeType) 37 | explicit QSnapdMarkdownNode(void *snapd_object, QObject *parent = 0); 38 | explicit QSnapdMarkdownNode(const QSnapdMarkdownNode &node); 39 | QSnapdMarkdownNode &operator=(const QSnapdMarkdownNode &node); 40 | 41 | NodeType type() const; 42 | QString text() const; 43 | Q_INVOKABLE int childCount() const; 44 | Q_INVOKABLE QSnapdMarkdownNode *child(int) const; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/markdown-parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_MARKDOWN_PARSER_H 11 | #define SNAPD_MARKDOWN_PARSER_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | class QSnapdMarkdownParserPrivate; 18 | #include "snapdqt_global.h" 19 | 20 | class LIBSNAPDQT_EXPORT QSnapdMarkdownParser : public QObject { 21 | Q_OBJECT 22 | 23 | Q_PROPERTY(bool preserveWhitespace READ preserveWhitespace WRITE 24 | setPreserveWhitespace) 25 | 26 | public: 27 | enum MarkdownVersion { 28 | MarkdownVersion0, 29 | }; 30 | Q_ENUM(MarkdownVersion) 31 | explicit QSnapdMarkdownParser(MarkdownVersion version, QObject *parent = 0); 32 | ~QSnapdMarkdownParser(); 33 | 34 | void setPreserveWhitespace(bool preserveWhitespace) const; 35 | bool preserveWhitespace() const; 36 | QList parse(const QString &text) const; 37 | 38 | private: 39 | QScopedPointer d_ptr; 40 | Q_DECLARE_PRIVATE(QSnapdMarkdownParser) 41 | }; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/media.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_MEDIA_H 11 | #define SNAPD_MEDIA_H 12 | 13 | #include 14 | #include 15 | 16 | #include "snapdqt_global.h" 17 | 18 | class LIBSNAPDQT_EXPORT QSnapdMedia : public QSnapdWrappedObject { 19 | Q_OBJECT 20 | 21 | Q_PROPERTY(QString type READ type) 22 | Q_PROPERTY(QString url READ url) 23 | Q_PROPERTY(quint64 width READ width); 24 | Q_PROPERTY(quint64 height READ height); 25 | 26 | public: 27 | explicit QSnapdMedia(void *snapd_object, QObject *parent = 0); 28 | 29 | QString type() const; 30 | QString url() const; 31 | quint64 width() const; 32 | quint64 height() const; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/notice.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_NOTICE_H 11 | #define SNAPD_NOTICE_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "snapdqt_global.h" 19 | 20 | class LIBSNAPDQT_EXPORT QSnapdNotice : public QSnapdWrappedObject { 21 | Q_OBJECT 22 | 23 | Q_PROPERTY(QString id READ id CONSTANT) 24 | Q_PROPERTY(QString userId READ userId CONSTANT) 25 | Q_PROPERTY(QSnapdEnums::SnapNoticeType noticeType READ noticeType CONSTANT) 26 | Q_PROPERTY(QString key READ key CONSTANT) 27 | Q_PROPERTY(QDateTime firstOccurred READ firstOccurred CONSTANT) 28 | Q_PROPERTY(QDateTime lastOccurred READ lastOccurred CONSTANT) 29 | Q_PROPERTY(QDateTime lastRepeated READ lastRepeated CONSTANT) 30 | Q_PROPERTY(qint32 occurrences READ occurrences CONSTANT) 31 | Q_PROPERTY(qint64 repeatAfter READ repeatAfter CONSTANT) 32 | Q_PROPERTY(qint64 expireAfter READ expireAfter CONSTANT) 33 | Q_PROPERTY(QHash lastData READ lastData CONSTANT) 34 | Q_PROPERTY( 35 | qint32 lastOccurredNanoseconds READ lastOccurredNanoseconds CONSTANT) 36 | 37 | public: 38 | explicit QSnapdNotice(void *snapd_object, QObject *parent = 0); 39 | 40 | QString id() const; 41 | QString userId() const; 42 | QSnapdEnums::SnapNoticeType noticeType() const; 43 | QString key() const; 44 | QDateTime firstOccurred() const; 45 | QDateTime lastOccurred() const; 46 | QDateTime lastRepeated() const; 47 | qint32 occurrences() const; 48 | qint64 repeatAfter() const; 49 | qint64 expireAfter() const; 50 | QHash lastData() const; 51 | qint32 lastOccurredNanoseconds() const; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/plug-ref.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_PLUG_REF_H 11 | #define SNAPD_PLUG_REF_H 12 | 13 | #include 14 | #include 15 | 16 | #include "snapdqt_global.h" 17 | 18 | class LIBSNAPDQT_EXPORT QSnapdPlugRef : public QSnapdWrappedObject { 19 | Q_OBJECT 20 | 21 | Q_PROPERTY(QString plug READ plug) 22 | Q_PROPERTY(QString snap READ snap) 23 | 24 | public: 25 | explicit QSnapdPlugRef(void *snapd_object, QObject *parent = 0); 26 | 27 | QString plug() const; 28 | QString snap() const; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/plug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_PLUG_H 11 | #define SNAPD_PLUG_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "snapdqt_global.h" 19 | 20 | class LIBSNAPDQT_EXPORT QSnapdPlug : public QSnapdWrappedObject { 21 | Q_OBJECT 22 | 23 | Q_PROPERTY(QString name READ name) 24 | Q_PROPERTY(QString snap READ snap) 25 | Q_PROPERTY(QString interface READ interface) 26 | Q_PROPERTY(QString label READ label) 27 | Q_PROPERTY(int connectionCount READ connectionCount) 28 | Q_PROPERTY(int connectedSlotCount READ connectedSlotCount) 29 | 30 | public: 31 | explicit QSnapdPlug(void *snapd_object, QObject *parent = 0); 32 | 33 | QString name() const; 34 | QString snap() const; 35 | QString interface() const; 36 | Q_INVOKABLE QStringList attributeNames() const; 37 | Q_INVOKABLE bool hasAttribute(const QString &name) const; 38 | Q_INVOKABLE QVariant attribute(const QString &name) const; 39 | QString label() const; 40 | Q_DECL_DEPRECATED_X("Use connectedSlotCount()") int connectionCount() const; 41 | Q_INVOKABLE Q_DECL_DEPRECATED_X("Use connectedSlot()") 42 | QSnapdConnection *connection(int) const; 43 | int connectedSlotCount() const; 44 | Q_INVOKABLE QSnapdSlotRef *connectedSlot(int) const; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/price.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_PRICE_H 11 | #define SNAPD_PRICE_H 12 | 13 | #include 14 | #include 15 | 16 | #include "snapdqt_global.h" 17 | 18 | class LIBSNAPDQT_EXPORT QSnapdPrice : public QSnapdWrappedObject { 19 | Q_OBJECT 20 | 21 | Q_PROPERTY(double amount READ amount) 22 | Q_PROPERTY(QString currency READ currency) 23 | 24 | public: 25 | explicit QSnapdPrice(void *snapd_object, QObject *parent = 0); 26 | 27 | double amount() const; 28 | QString currency() const; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/request.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_REQUEST_H 11 | #define SNAPD_REQUEST_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | class QSnapdRequestPrivate; 18 | 19 | #include "snapdqt_global.h" 20 | 21 | class LIBSNAPDQT_EXPORT QSnapdRequest : public QObject { 22 | Q_OBJECT 23 | 24 | Q_PROPERTY(bool isFinished READ isFinished) 25 | Q_PROPERTY(QSnapdError error READ error) 26 | Q_PROPERTY(QString errorString READ errorString) 27 | Q_PROPERTY(QSnapdChange change READ change) 28 | 29 | public: 30 | enum QSnapdError { 31 | NoError, 32 | UnknownError, 33 | ConnectionFailed, 34 | WriteFailed, 35 | ReadFailed, 36 | BadRequest, 37 | BadResponse, 38 | AuthDataRequired, 39 | AuthDataInvalid, 40 | TwoFactorRequired, 41 | TwoFactorInvalid, 42 | PermissionDenied, 43 | Failed, 44 | TermsNotAccepted, 45 | PaymentNotSetup, 46 | PaymentDeclined, 47 | AlreadyInstalled, 48 | NotInstalled, 49 | NoUpdateAvailable, 50 | PasswordPolicyError, 51 | NeedsDevmode, 52 | NeedsClassic, 53 | NeedsClassicSystem, 54 | Cancelled, 55 | BadQuery, 56 | NetworkTimeout, 57 | NotFound, 58 | NotInStore, 59 | AuthCancelled, 60 | NotClassic, 61 | RevisionNotAvailable, 62 | ChannelNotAvailable, 63 | NotASnap, 64 | DNSFailure, 65 | OptionNotFound, 66 | AppNotFound, 67 | ArchitectureNotAvailable, 68 | ChangeConflict, 69 | InterfacesUnchanged 70 | }; 71 | Q_ENUM(QSnapdError) 72 | 73 | explicit QSnapdRequest(void *snapd_client, QObject *parent = 0); 74 | ~QSnapdRequest(); 75 | bool isFinished() const; 76 | QSnapdError error() const; 77 | QString errorString() const; 78 | Q_INVOKABLE virtual void runSync() = 0; 79 | Q_INVOKABLE virtual void runAsync() = 0; 80 | Q_INVOKABLE void cancel(); 81 | Q_INVOKABLE QSnapdChange *change() const; 82 | void handleProgress(void *); 83 | 84 | protected: 85 | void *getClient() const; 86 | void *getCancellable() const; 87 | void finish(void *error); 88 | 89 | Q_SIGNALS: 90 | void progress(); 91 | void complete(); 92 | 93 | private: 94 | QScopedPointer d_ptr; 95 | Q_DECLARE_PRIVATE(QSnapdRequest); 96 | }; 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/screenshot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_SCREENSHOT_H 11 | #define SNAPD_SCREENSHOT_H 12 | 13 | #include 14 | #include 15 | 16 | #include "snapdqt_global.h" 17 | 18 | class LIBSNAPDQT_EXPORT QSnapdScreenshot : public QSnapdWrappedObject { 19 | Q_OBJECT 20 | 21 | Q_PROPERTY(QString url READ url) 22 | Q_PROPERTY(quint64 width READ width); 23 | Q_PROPERTY(quint64 height READ height); 24 | 25 | public: 26 | explicit QSnapdScreenshot(void *snapd_object, QObject *parent = 0); 27 | 28 | QString url() const; 29 | quint64 width() const; 30 | quint64 height() const; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/slot-ref.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_SLOT_REF_H 11 | #define SNAPD_SLOT_REF_H 12 | 13 | #include 14 | #include 15 | 16 | #include "snapdqt_global.h" 17 | 18 | class LIBSNAPDQT_EXPORT QSnapdSlotRef : public QSnapdWrappedObject { 19 | Q_OBJECT 20 | 21 | Q_PROPERTY(QString slot READ slot) 22 | Q_PROPERTY(QString snap READ snap) 23 | 24 | public: 25 | explicit QSnapdSlotRef(void *snapd_object, QObject *parent = 0); 26 | 27 | QString slot() const; 28 | QString snap() const; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/slot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_SLOT_H 11 | #define SNAPD_SLOT_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "snapdqt_global.h" 19 | 20 | class LIBSNAPDQT_EXPORT QSnapdSlot : public QSnapdWrappedObject { 21 | Q_OBJECT 22 | 23 | Q_PROPERTY(QString name READ name) 24 | Q_PROPERTY(QString snap READ snap) 25 | Q_PROPERTY(QString interface READ interface) 26 | Q_PROPERTY(QString label READ label) 27 | Q_PROPERTY(int connectionCount READ connectionCount) 28 | Q_PROPERTY(int connectedPlugCount READ connectedPlugCount) 29 | 30 | public: 31 | explicit QSnapdSlot(void *snapd_object, QObject *parent = 0); 32 | 33 | QString name() const; 34 | QString snap() const; 35 | QString interface() const; 36 | Q_INVOKABLE QStringList attributeNames() const; 37 | Q_INVOKABLE bool hasAttribute(const QString &name) const; 38 | Q_INVOKABLE QVariant attribute(const QString &name) const; 39 | QString label() const; 40 | Q_DECL_DEPRECATED_X("Use connectedPlugCount()") int connectionCount() const; 41 | Q_INVOKABLE Q_DECL_DEPRECATED_X("Use connectedPlug()") 42 | QSnapdConnection *connection(int) const; 43 | int connectedPlugCount() const; 44 | Q_INVOKABLE QSnapdPlugRef *connectedPlug(int) const; 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/snapdqt_global.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #if defined(LIBSNAPDQT) 13 | #define LIBSNAPDQT_EXPORT __attribute__((visibility("default"))) 14 | #else 15 | #define LIBSNAPDQT_EXPORT Q_DECL_IMPORT 16 | #endif 17 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/system-information.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_SYSTEM_INFORMATION_H 11 | #define SNAPD_SYSTEM_INFORMATION_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | #include "snapdqt_global.h" 20 | 21 | class LIBSNAPDQT_EXPORT QSnapdSystemInformation : public QSnapdWrappedObject { 22 | Q_OBJECT 23 | 24 | Q_PROPERTY(QString binariesDirectory READ binariesDirectory) 25 | Q_PROPERTY(QString buildId READ buildId) 26 | Q_PROPERTY(QSnapdEnums::SystemConfinement confinement READ confinement) 27 | Q_PROPERTY(QString kernelVersion READ kernelVersion) 28 | Q_PROPERTY(bool managed READ managed) 29 | Q_PROPERTY(QString mountDirectory READ mountDirectory) 30 | Q_PROPERTY(bool onClassic READ onClassic) 31 | Q_PROPERTY(QString osId READ osId) 32 | Q_PROPERTY(QString osVersion READ osVersion) 33 | Q_PROPERTY(QDateTime refreshHold READ refreshHold) 34 | Q_PROPERTY(QDateTime refreshLast READ refreshLast) 35 | Q_PROPERTY(QDateTime refreshNext READ refreshNext) 36 | Q_PROPERTY(QString refreshSchedule READ refreshSchedule) 37 | Q_PROPERTY(QString refreshTimer READ refreshTimer) 38 | Q_PROPERTY(QHash sandboxFeatures READ sandboxFeatures) 39 | Q_PROPERTY(QString series READ series) 40 | Q_PROPERTY(QString store READ store) 41 | Q_PROPERTY(QString version READ version) 42 | 43 | public: 44 | explicit QSnapdSystemInformation(void *snapd_object, QObject *parent = 0); 45 | 46 | QString binariesDirectory() const; 47 | QString buildId() const; 48 | QSnapdEnums::SystemConfinement confinement() const; 49 | QString kernelVersion() const; 50 | bool managed() const; 51 | QString mountDirectory() const; 52 | bool onClassic() const; 53 | QString osId() const; 54 | QString osVersion() const; 55 | QDateTime refreshHold() const; 56 | QDateTime refreshLast() const; 57 | QDateTime refreshNext() const; 58 | QString refreshSchedule() const; 59 | QString refreshTimer() const; 60 | QHash sandboxFeatures() const; 61 | QString series() const; 62 | QString store() const; 63 | QString version() const; 64 | }; 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/task-data.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_TASK_DATA_H 11 | #define SNAPD_TASK_DATA_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "snapdqt_global.h" 18 | 19 | class LIBSNAPDQT_EXPORT QSnapdTaskData : public QSnapdWrappedObject { 20 | Q_OBJECT 21 | 22 | Q_PROPERTY(QStringList affectedSnaps READ affectedSnaps) 23 | 24 | public: 25 | explicit QSnapdTaskData(void *snapd_object, QObject *parent = 0); 26 | 27 | Q_INVOKABLE QStringList affectedSnaps() const; 28 | }; 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/task.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_TASK_H 11 | #define SNAPD_TASK_H 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | #include "snapdqt_global.h" 19 | 20 | class LIBSNAPDQT_EXPORT QSnapdTask : public QSnapdWrappedObject { 21 | Q_OBJECT 22 | 23 | Q_PROPERTY(QString id READ id) 24 | Q_PROPERTY(QString kind READ kind) 25 | Q_PROPERTY(QString summary READ summary) 26 | Q_PROPERTY(QString status READ status) 27 | Q_PROPERTY(QString progressLabel READ progressLabel) 28 | Q_PROPERTY(qint64 progressDone READ progressDone) 29 | Q_PROPERTY(qint64 progressTotal READ progressTotal) 30 | Q_PROPERTY(QDateTime spawnTime READ spawnTime) 31 | Q_PROPERTY(QDateTime readyTime READ readyTime) 32 | Q_PROPERTY(QSnapdTaskData taskData READ taskData) 33 | 34 | public: 35 | explicit QSnapdTask(void *snapd_object, QObject *parent = 0); 36 | 37 | Q_INVOKABLE QString id() const; 38 | Q_INVOKABLE QString kind() const; 39 | Q_INVOKABLE QString summary() const; 40 | Q_INVOKABLE QString status() const; 41 | Q_INVOKABLE QString progressLabel() const; 42 | Q_INVOKABLE qint64 progressDone() const; 43 | Q_INVOKABLE qint64 progressTotal() const; 44 | Q_INVOKABLE QDateTime spawnTime() const; 45 | Q_INVOKABLE QDateTime readyTime() const; 46 | Q_INVOKABLE QSnapdTaskData *taskData() const; 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/user-information.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_USER_INFORMATION_H 11 | #define SNAPD_USER_INFORMATION_H 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | #include "snapdqt_global.h" 18 | 19 | class LIBSNAPDQT_EXPORT QSnapdUserInformation : public QSnapdWrappedObject { 20 | Q_OBJECT 21 | 22 | Q_PROPERTY(int id READ id) 23 | Q_PROPERTY(QString username READ username) 24 | Q_PROPERTY(QString email READ email) 25 | Q_PROPERTY(QStringList sshKeys READ sshKeys) 26 | Q_PROPERTY(QSnapdAuthData *authData READ authData) 27 | 28 | public: 29 | explicit QSnapdUserInformation(void *snapd_object, QObject *parent = 0); 30 | 31 | int id() const; 32 | QString username() const; 33 | QString email() const; 34 | QStringList sshKeys() const; 35 | QSnapdAuthData *authData() const; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /snapd-qt/Snapd/wrapped-object.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef SNAPD_WRAPPED_OBJECT_H 11 | #define SNAPD_WRAPPED_OBJECT_H 12 | 13 | #include 14 | 15 | #include "snapdqt_global.h" 16 | 17 | class LIBSNAPDQT_EXPORT QSnapdWrappedObject : public QObject { 18 | Q_OBJECT 19 | 20 | public: 21 | explicit QSnapdWrappedObject(void *object, void (*unref_func)(void *), 22 | QObject *parent = 0) 23 | : QObject(parent), wrapped_object(object), unref_func(unref_func) {} 24 | ~QSnapdWrappedObject() { unref_func(wrapped_object); } 25 | 26 | void *wrappedObject() { return wrapped_object; } 27 | 28 | protected: 29 | void *wrapped_object; 30 | 31 | private: 32 | void (*unref_func)(void *); 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /snapd-qt/SnapdQt5Config.cmake.in: -------------------------------------------------------------------------------- 1 | # SNAPD_INCLUDE_DIRS - The snapd-qt include directories 2 | # SNAPD_LIBRARIES - The libraries needed to use snapd-qt 3 | 4 | set(SNAPD_LIBRARIES @libdir@/lib@library_name@.so) 5 | set(SNAPD_INCLUDE_DIRS @includedir@/@library_name@/) 6 | 7 | add_library(Snapd::Core SHARED IMPORTED) 8 | set_target_properties(Snapd::Core PROPERTIES 9 | IMPORTED_LINK_DEPENDENT_LIBRARIES "Qt5::Core" 10 | IMPORTED_LOCATION "${SNAPD_LIBRARIES}" 11 | IMPORTED_SONAME "lib@library_name@.so" 12 | ) 13 | 14 | set_property(TARGET Snapd::Core PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${SNAPD_INCLUDE_DIRS}) 15 | -------------------------------------------------------------------------------- /snapd-qt/SnapdQt5ConfigVersion.cmake.in: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION @version@) 2 | 3 | if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) 4 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 5 | else("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) 6 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 7 | if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") 8 | set(PACKAGE_VERSION_EXACT TRUE) 9 | endif( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") 10 | endif("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) 11 | -------------------------------------------------------------------------------- /snapd-qt/SnapdQt6Config.cmake.in: -------------------------------------------------------------------------------- 1 | # SNAPD_INCLUDE_DIRS - The snapd-qt include directories 2 | # SNAPD_LIBRARIES - The libraries needed to use snapd-qt 3 | 4 | set(SNAPD_LIBRARIES @libdir@/lib@library_name@.so) 5 | set(SNAPD_INCLUDE_DIRS @includedir@/@library_name@/) 6 | 7 | add_library(Snapd::Core SHARED IMPORTED) 8 | set_target_properties(Snapd::Core PROPERTIES 9 | IMPORTED_LINK_DEPENDENT_LIBRARIES "Qt6::Core" 10 | IMPORTED_LOCATION "${SNAPD_LIBRARIES}" 11 | IMPORTED_SONAME "lib@library_name@.so" 12 | ) 13 | 14 | set_property(TARGET Snapd::Core PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${SNAPD_INCLUDE_DIRS}) 15 | -------------------------------------------------------------------------------- /snapd-qt/SnapdQt6ConfigVersion.cmake.in: -------------------------------------------------------------------------------- 1 | set(PACKAGE_VERSION @version@) 2 | 3 | if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) 4 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 5 | else("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) 6 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 7 | if( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") 8 | set(PACKAGE_VERSION_EXACT TRUE) 9 | endif( "${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}") 10 | endif("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) 11 | -------------------------------------------------------------------------------- /snapd-qt/alias.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/alias.h" 13 | 14 | QSnapdAlias::QSnapdAlias(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QString QSnapdAlias::app() const { 18 | G_GNUC_BEGIN_IGNORE_DEPRECATIONS 19 | return snapd_alias_get_app(SNAPD_ALIAS(wrapped_object)); 20 | G_GNUC_BEGIN_IGNORE_DEPRECATIONS 21 | } 22 | 23 | QString QSnapdAlias::appAuto() const { 24 | return snapd_alias_get_app_auto(SNAPD_ALIAS(wrapped_object)); 25 | } 26 | 27 | QString QSnapdAlias::command() const { 28 | return snapd_alias_get_command(SNAPD_ALIAS(wrapped_object)); 29 | } 30 | 31 | QString QSnapdAlias::appManual() const { 32 | return snapd_alias_get_app_manual(SNAPD_ALIAS(wrapped_object)); 33 | } 34 | 35 | QString QSnapdAlias::name() const { 36 | return snapd_alias_get_name(SNAPD_ALIAS(wrapped_object)); 37 | } 38 | 39 | QString QSnapdAlias::snap() const { 40 | return snapd_alias_get_snap(SNAPD_ALIAS(wrapped_object)); 41 | } 42 | 43 | QSnapdEnums::AliasStatus QSnapdAlias::status() const { 44 | switch (snapd_alias_get_status(SNAPD_ALIAS(wrapped_object))) { 45 | default: 46 | case SNAPD_ALIAS_STATUS_UNKNOWN: 47 | return QSnapdEnums::AliasStatusUnknown; 48 | case SNAPD_ALIAS_STATUS_DEFAULT: 49 | return QSnapdEnums::AliasStatusDefault; 50 | case SNAPD_ALIAS_STATUS_ENABLED: 51 | return QSnapdEnums::AliasStatusEnabled; 52 | case SNAPD_ALIAS_STATUS_DISABLED: 53 | return QSnapdEnums::AliasStatusDisabled; 54 | case SNAPD_ALIAS_STATUS_AUTO: 55 | return QSnapdEnums::AliasStatusAuto; 56 | case SNAPD_ALIAS_STATUS_MANUAL: 57 | return QSnapdEnums::AliasStatusManual; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /snapd-qt/app.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/app.h" 13 | 14 | QSnapdApp::QSnapdApp(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QString QSnapdApp::name() const { 18 | return snapd_app_get_name(SNAPD_APP(wrapped_object)); 19 | } 20 | 21 | bool QSnapdApp::active() const { 22 | return snapd_app_get_active(SNAPD_APP(wrapped_object)); 23 | } 24 | 25 | QStringList QSnapdApp::aliases() const { return QStringList(); } 26 | 27 | QString QSnapdApp::commonId() const { 28 | return snapd_app_get_common_id(SNAPD_APP(wrapped_object)); 29 | } 30 | 31 | QSnapdEnums::DaemonType QSnapdApp::daemonType() const { 32 | switch (snapd_app_get_daemon_type(SNAPD_APP(wrapped_object))) { 33 | case SNAPD_DAEMON_TYPE_NONE: 34 | return QSnapdEnums::DaemonTypeNone; 35 | default: 36 | case SNAPD_DAEMON_TYPE_UNKNOWN: 37 | return QSnapdEnums::DaemonTypeUnknown; 38 | case SNAPD_DAEMON_TYPE_SIMPLE: 39 | return QSnapdEnums::DaemonTypeSimple; 40 | case SNAPD_DAEMON_TYPE_FORKING: 41 | return QSnapdEnums::DaemonTypeForking; 42 | case SNAPD_DAEMON_TYPE_ONESHOT: 43 | return QSnapdEnums::DaemonTypeOneshot; 44 | case SNAPD_DAEMON_TYPE_DBUS: 45 | return QSnapdEnums::DaemonTypeDbus; 46 | case SNAPD_DAEMON_TYPE_NOTIFY: 47 | return QSnapdEnums::DaemonTypeNotify; 48 | } 49 | } 50 | 51 | QString QSnapdApp::desktopFile() const { 52 | return snapd_app_get_desktop_file(SNAPD_APP(wrapped_object)); 53 | } 54 | 55 | bool QSnapdApp::enabled() const { 56 | return snapd_app_get_enabled(SNAPD_APP(wrapped_object)); 57 | } 58 | 59 | QString QSnapdApp::snap() const { 60 | return snapd_app_get_snap(SNAPD_APP(wrapped_object)); 61 | } 62 | -------------------------------------------------------------------------------- /snapd-qt/assertion.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/assertion.h" 13 | 14 | QSnapdAssertion::QSnapdAssertion(const QString &contents, QObject *parent) 15 | : QSnapdWrappedObject(NULL, g_object_unref, parent) { 16 | wrapped_object = snapd_assertion_new(contents.toStdString().c_str()); 17 | } 18 | 19 | QStringList QSnapdAssertion::headers() const { 20 | g_auto(GStrv) headers = NULL; 21 | QStringList result; 22 | 23 | headers = snapd_assertion_get_headers(SNAPD_ASSERTION(wrapped_object)); 24 | for (int i = 0; headers[i] != NULL; i++) 25 | result.append(headers[i]); 26 | return result; 27 | } 28 | 29 | QString QSnapdAssertion::header(const QString &name) const { 30 | g_autofree gchar *header = snapd_assertion_get_header( 31 | SNAPD_ASSERTION(wrapped_object), name.toStdString().c_str()); 32 | return header; 33 | } 34 | 35 | QString QSnapdAssertion::body() const { 36 | g_autofree gchar *body = 37 | snapd_assertion_get_body(SNAPD_ASSERTION(wrapped_object)); 38 | return body; 39 | } 40 | 41 | QString QSnapdAssertion::signature() const { 42 | g_autofree gchar *signature = 43 | snapd_assertion_get_signature(SNAPD_ASSERTION(wrapped_object)); 44 | return signature; 45 | } 46 | -------------------------------------------------------------------------------- /snapd-qt/auth-data.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/auth-data.h" 13 | 14 | QSnapdAuthData::QSnapdAuthData(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QSnapdAuthData::QSnapdAuthData(QObject *parent) 18 | : QSnapdWrappedObject(snapd_auth_data_new("", NULL), g_object_unref, 19 | parent) {} 20 | 21 | QSnapdAuthData::QSnapdAuthData(const QString &macaroon, 22 | const QStringList &discharges, QObject *parent) 23 | : QSnapdWrappedObject(NULL, g_object_unref, parent) { 24 | g_auto(GStrv) strv = g_new(gchar *, discharges.size() + 1); 25 | int i; 26 | for (i = 0; i < discharges.size(); i++) 27 | strv[i] = g_strdup((char *)discharges.at(i).toStdString().c_str()); 28 | strv[i] = NULL; 29 | wrapped_object = snapd_auth_data_new(macaroon.toStdString().c_str(), strv); 30 | } 31 | 32 | QString QSnapdAuthData::macaroon() const { 33 | return snapd_auth_data_get_macaroon(SNAPD_AUTH_DATA(wrapped_object)); 34 | } 35 | 36 | QStringList QSnapdAuthData::discharges() const { 37 | GStrv discharges = 38 | snapd_auth_data_get_discharges(SNAPD_AUTH_DATA(wrapped_object)); 39 | QStringList result; 40 | for (int i = 0; discharges[i] != NULL; i++) 41 | result.append(discharges[i]); 42 | return result; 43 | } 44 | -------------------------------------------------------------------------------- /snapd-qt/category-details.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/category-details.h" 13 | 14 | QSnapdCategoryDetails::QSnapdCategoryDetails(void *snapd_object, 15 | QObject *parent) 16 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 17 | 18 | QString QSnapdCategoryDetails::name() const { 19 | return snapd_category_details_get_name( 20 | SNAPD_CATEGORY_DETAILS(wrapped_object)); 21 | } 22 | -------------------------------------------------------------------------------- /snapd-qt/category.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/category.h" 13 | 14 | QSnapdCategory::QSnapdCategory(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QString QSnapdCategory::name() const { 18 | return snapd_category_get_name(SNAPD_CATEGORY(wrapped_object)); 19 | } 20 | 21 | bool QSnapdCategory::featured() const { 22 | return snapd_category_get_featured(SNAPD_CATEGORY(wrapped_object)); 23 | } 24 | -------------------------------------------------------------------------------- /snapd-qt/change-autorefresh-data.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/change-autorefresh-data.h" 13 | 14 | QSnapdAutorefreshChangeData::QSnapdAutorefreshChangeData(void *snapd_object, 15 | QObject *parent) 16 | : QSnapdChangeData(snapd_object, parent) {} 17 | 18 | static QStringList gstrv_to_qstringlist(GStrv data) { 19 | QStringList retval; 20 | 21 | if (data != NULL) 22 | for (gchar **element = data; *element != NULL; element++) 23 | retval << *element; 24 | return retval; 25 | } 26 | 27 | QStringList QSnapdAutorefreshChangeData::snapNames() const { 28 | QStringList list; 29 | 30 | GStrv data = snapd_autorefresh_change_data_get_snap_names( 31 | SNAPD_AUTOREFRESH_CHANGE_DATA(wrapped_object)); 32 | return gstrv_to_qstringlist(data); 33 | } 34 | 35 | QStringList QSnapdAutorefreshChangeData::refreshForced() const { 36 | QStringList list; 37 | 38 | GStrv data = snapd_autorefresh_change_data_get_refresh_forced( 39 | SNAPD_AUTOREFRESH_CHANGE_DATA(wrapped_object)); 40 | return gstrv_to_qstringlist(data); 41 | } 42 | -------------------------------------------------------------------------------- /snapd-qt/change-data.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/change-data.h" 13 | 14 | QSnapdChangeData::QSnapdChangeData(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | -------------------------------------------------------------------------------- /snapd-qt/channel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/channel.h" 13 | 14 | QSnapdChannel::QSnapdChannel(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QString QSnapdChannel::branch() const { 18 | return snapd_channel_get_branch(SNAPD_CHANNEL(wrapped_object)); 19 | } 20 | 21 | QSnapdEnums::SnapConfinement QSnapdChannel::confinement() const { 22 | switch (snapd_channel_get_confinement(SNAPD_CHANNEL(wrapped_object))) { 23 | case SNAPD_CONFINEMENT_STRICT: 24 | return QSnapdEnums::SnapConfinementStrict; 25 | case SNAPD_CONFINEMENT_CLASSIC: 26 | return QSnapdEnums::SnapConfinementClassic; 27 | case SNAPD_CONFINEMENT_DEVMODE: 28 | return QSnapdEnums::SnapConfinementDevmode; 29 | case SNAPD_CONFINEMENT_UNKNOWN: 30 | default: 31 | return QSnapdEnums::SnapConfinementUnknown; 32 | } 33 | } 34 | 35 | QString QSnapdChannel::epoch() const { 36 | return snapd_channel_get_epoch(SNAPD_CHANNEL(wrapped_object)); 37 | } 38 | 39 | QString QSnapdChannel::name() const { 40 | return snapd_channel_get_name(SNAPD_CHANNEL(wrapped_object)); 41 | } 42 | 43 | static QDateTime convertDateTime(GDateTime *datetime) { 44 | if (datetime == NULL) 45 | return QDateTime(); 46 | 47 | QDate date(g_date_time_get_year(datetime), g_date_time_get_month(datetime), 48 | g_date_time_get_day_of_month(datetime)); 49 | QTime time(g_date_time_get_hour(datetime), g_date_time_get_minute(datetime), 50 | g_date_time_get_second(datetime), 51 | g_date_time_get_microsecond(datetime) / 1000); 52 | return QDateTime(date, time, Qt::OffsetFromUTC, 53 | g_date_time_get_utc_offset(datetime) / 1000000); 54 | } 55 | 56 | QDateTime QSnapdChannel::releasedAt() const { 57 | return convertDateTime( 58 | snapd_channel_get_released_at(SNAPD_CHANNEL(wrapped_object))); 59 | } 60 | 61 | QString QSnapdChannel::revision() const { 62 | return snapd_channel_get_revision(SNAPD_CHANNEL(wrapped_object)); 63 | } 64 | 65 | QString QSnapdChannel::risk() const { 66 | return snapd_channel_get_risk(SNAPD_CHANNEL(wrapped_object)); 67 | } 68 | 69 | qint64 QSnapdChannel::size() const { 70 | return snapd_channel_get_size(SNAPD_CHANNEL(wrapped_object)); 71 | } 72 | 73 | QString QSnapdChannel::track() const { 74 | return snapd_channel_get_track(SNAPD_CHANNEL(wrapped_object)); 75 | } 76 | 77 | QString QSnapdChannel::version() const { 78 | return snapd_channel_get_version(SNAPD_CHANNEL(wrapped_object)); 79 | } 80 | -------------------------------------------------------------------------------- /snapd-qt/icon.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/icon.h" 13 | 14 | QSnapdIcon::QSnapdIcon(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QString QSnapdIcon::mimeType() const { 18 | return snapd_icon_get_mime_type(SNAPD_ICON(wrapped_object)); 19 | } 20 | 21 | QByteArray QSnapdIcon::data() const { 22 | GBytes *data = snapd_icon_get_data(SNAPD_ICON(wrapped_object)); 23 | gsize length; 24 | gchar *raw_data = (gchar *)g_bytes_get_data(data, &length); 25 | return QByteArray::fromRawData(raw_data, length); 26 | } 27 | -------------------------------------------------------------------------------- /snapd-qt/interface.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/interface.h" 13 | 14 | QSnapdInterface::QSnapdInterface(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QString QSnapdInterface::name() const { 18 | return snapd_interface_get_name(SNAPD_INTERFACE(wrapped_object)); 19 | } 20 | 21 | QString QSnapdInterface::summary() const { 22 | return snapd_interface_get_summary(SNAPD_INTERFACE(wrapped_object)); 23 | } 24 | 25 | QString QSnapdInterface::docUrl() const { 26 | return snapd_interface_get_doc_url(SNAPD_INTERFACE(wrapped_object)); 27 | } 28 | 29 | int QSnapdInterface::slotCount() const { 30 | GPtrArray *slots; 31 | 32 | slots = snapd_interface_get_slots(SNAPD_INTERFACE(wrapped_object)); 33 | return slots != NULL ? slots->len : 0; 34 | } 35 | 36 | QSnapdSlot *QSnapdInterface::slot(int n) const { 37 | GPtrArray *slots; 38 | 39 | slots = snapd_interface_get_slots(SNAPD_INTERFACE(wrapped_object)); 40 | if (slots == NULL || n < 0 || (guint)n >= slots->len) 41 | return NULL; 42 | return new QSnapdSlot(slots->pdata[n]); 43 | } 44 | 45 | int QSnapdInterface::plugCount() const { 46 | GPtrArray *plugs; 47 | 48 | plugs = snapd_interface_get_plugs(SNAPD_INTERFACE(wrapped_object)); 49 | return plugs != NULL ? plugs->len : 0; 50 | } 51 | 52 | QSnapdPlug *QSnapdInterface::plug(int n) const { 53 | GPtrArray *plugs; 54 | 55 | plugs = snapd_interface_get_plugs(SNAPD_INTERFACE(wrapped_object)); 56 | if (plugs == NULL || n < 0 || (guint)n >= plugs->len) 57 | return NULL; 58 | return new QSnapdPlug(plugs->pdata[n]); 59 | } 60 | 61 | QString QSnapdInterface::makeLabel() const { 62 | g_autofree gchar *label = 63 | snapd_interface_make_label(SNAPD_INTERFACE(wrapped_object)); 64 | return label; 65 | } 66 | -------------------------------------------------------------------------------- /snapd-qt/link.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/link.h" 13 | 14 | QSnapdLink::QSnapdLink(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QString QSnapdLink::type() const { 18 | return snapd_link_get_url_type(SNAPD_LINK(wrapped_object)); 19 | } 20 | 21 | QStringList QSnapdLink::urls() const { 22 | GStrv array = snapd_link_get_urls(SNAPD_LINK(wrapped_object)); 23 | QStringList urls; 24 | for (; *array != NULL; array++) 25 | urls.append(*array); 26 | return urls; 27 | } -------------------------------------------------------------------------------- /snapd-qt/maintenance.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/maintenance.h" 13 | 14 | QSnapdMaintenance::QSnapdMaintenance(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QSnapdEnums::MaintenanceKind QSnapdMaintenance::kind() const { 18 | switch (snapd_maintenance_get_kind(SNAPD_MAINTENANCE(wrapped_object))) { 19 | default: 20 | case SNAPD_MAINTENANCE_KIND_UNKNOWN: 21 | return QSnapdEnums::MaintenanceKindUnknown; 22 | case SNAPD_MAINTENANCE_KIND_DAEMON_RESTART: 23 | return QSnapdEnums::MaintenanceKindDaemonRestart; 24 | case SNAPD_MAINTENANCE_KIND_SYSTEM_RESTART: 25 | return QSnapdEnums::MaintenanceKindSystemRestart; 26 | } 27 | } 28 | 29 | QString QSnapdMaintenance::message() const { 30 | return snapd_maintenance_get_message(SNAPD_MAINTENANCE(wrapped_object)); 31 | } 32 | -------------------------------------------------------------------------------- /snapd-qt/markdown-parser.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/markdown-parser.h" 13 | 14 | class QSnapdMarkdownParserPrivate { 15 | public: 16 | QSnapdMarkdownParserPrivate(QSnapdMarkdownParser::MarkdownVersion version) { 17 | SnapdMarkdownVersion v; 18 | switch (version) { 19 | default: 20 | case QSnapdMarkdownParser::MarkdownVersion0: 21 | v = SNAPD_MARKDOWN_VERSION_0; 22 | break; 23 | } 24 | parser = snapd_markdown_parser_new(v); 25 | } 26 | 27 | ~QSnapdMarkdownParserPrivate() { g_object_unref(parser); } 28 | 29 | SnapdMarkdownParser *parser; 30 | }; 31 | 32 | QSnapdMarkdownParser::QSnapdMarkdownParser( 33 | QSnapdMarkdownParser::MarkdownVersion version, QObject *parent) 34 | : QObject(parent), d_ptr(new QSnapdMarkdownParserPrivate(version)) {} 35 | 36 | QSnapdMarkdownParser::~QSnapdMarkdownParser() {} 37 | 38 | void QSnapdMarkdownParser::setPreserveWhitespace( 39 | bool preserveWhitespace) const { 40 | Q_D(const QSnapdMarkdownParser); 41 | snapd_markdown_parser_set_preserve_whitespace(d->parser, preserveWhitespace); 42 | } 43 | 44 | bool QSnapdMarkdownParser::preserveWhitespace() const { 45 | Q_D(const QSnapdMarkdownParser); 46 | return snapd_markdown_parser_get_preserve_whitespace(d->parser); 47 | } 48 | 49 | QList 50 | QSnapdMarkdownParser::parse(const QString &text) const { 51 | Q_D(const QSnapdMarkdownParser); 52 | g_autoptr(GPtrArray) nodes = 53 | snapd_markdown_parser_parse(d->parser, text.toUtf8().constData()); 54 | QList nodes_list; 55 | for (uint i = 0; i < nodes->len; i++) { 56 | SnapdMarkdownNode *node = (SnapdMarkdownNode *)g_ptr_array_index(nodes, i); 57 | nodes_list.append(QSnapdMarkdownNode(node)); 58 | } 59 | return nodes_list; 60 | } 61 | -------------------------------------------------------------------------------- /snapd-qt/media.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/media.h" 13 | 14 | QSnapdMedia::QSnapdMedia(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QString QSnapdMedia::type() const { 18 | return snapd_media_get_media_type(SNAPD_MEDIA(wrapped_object)); 19 | } 20 | 21 | QString QSnapdMedia::url() const { 22 | return snapd_media_get_url(SNAPD_MEDIA(wrapped_object)); 23 | } 24 | 25 | quint64 QSnapdMedia::width() const { 26 | return snapd_media_get_width(SNAPD_MEDIA(wrapped_object)); 27 | } 28 | 29 | quint64 QSnapdMedia::height() const { 30 | return snapd_media_get_height(SNAPD_MEDIA(wrapped_object)); 31 | } 32 | -------------------------------------------------------------------------------- /snapd-qt/plug-ref.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/plug-ref.h" 13 | 14 | QSnapdPlugRef::QSnapdPlugRef(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QString QSnapdPlugRef::plug() const { 18 | return snapd_plug_ref_get_plug(SNAPD_PLUG_REF(wrapped_object)); 19 | } 20 | 21 | QString QSnapdPlugRef::snap() const { 22 | return snapd_plug_ref_get_snap(SNAPD_PLUG_REF(wrapped_object)); 23 | } 24 | -------------------------------------------------------------------------------- /snapd-qt/price.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/price.h" 13 | 14 | QSnapdPrice::QSnapdPrice(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | double QSnapdPrice::amount() const { 18 | return snapd_price_get_amount(SNAPD_PRICE(wrapped_object)); 19 | } 20 | 21 | QString QSnapdPrice::currency() const { 22 | return snapd_price_get_currency(SNAPD_PRICE(wrapped_object)); 23 | } 24 | -------------------------------------------------------------------------------- /snapd-qt/qml-plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical, Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef QML_PLUGIN_H 11 | #define QML_PLUGIN_H 12 | 13 | #include 14 | 15 | class SnapdQmlPlugin : public QQmlExtensionPlugin { 16 | Q_OBJECT 17 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") 18 | 19 | public: 20 | void registerTypes(const char *uri); 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /snapd-qt/qmldir: -------------------------------------------------------------------------------- 1 | module Snapd 2 | plugin Snapd 3 | -------------------------------------------------------------------------------- /snapd-qt/screenshot.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/screenshot.h" 13 | 14 | QSnapdScreenshot::QSnapdScreenshot(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QString QSnapdScreenshot::url() const { 18 | return snapd_screenshot_get_url(SNAPD_SCREENSHOT(wrapped_object)); 19 | } 20 | 21 | quint64 QSnapdScreenshot::width() const { 22 | return snapd_screenshot_get_width(SNAPD_SCREENSHOT(wrapped_object)); 23 | } 24 | 25 | quint64 QSnapdScreenshot::height() const { 26 | return snapd_screenshot_get_height(SNAPD_SCREENSHOT(wrapped_object)); 27 | } 28 | -------------------------------------------------------------------------------- /snapd-qt/slot-ref.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/slot-ref.h" 13 | 14 | QSnapdSlotRef::QSnapdSlotRef(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QString QSnapdSlotRef::slot() const { 18 | return snapd_slot_ref_get_slot(SNAPD_SLOT_REF(wrapped_object)); 19 | } 20 | 21 | QString QSnapdSlotRef::snap() const { 22 | return snapd_slot_ref_get_snap(SNAPD_SLOT_REF(wrapped_object)); 23 | } 24 | -------------------------------------------------------------------------------- /snapd-qt/snapd-qt.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: Snapd Qt 7 | Description: Library for accessing snapd 8 | Version: @VERSION@ 9 | Libs: -L${libdir} -lsnapd-qt 10 | Cflags: -I${includedir}/snapd-qt 11 | Requires: @pc_required_qt@ 12 | -------------------------------------------------------------------------------- /snapd-qt/stream-wrapper.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include "stream-wrapper.h" 11 | 12 | #include 13 | 14 | G_DEFINE_TYPE(StreamWrapper, stream_wrapper, G_TYPE_INPUT_STREAM) 15 | 16 | static gssize stream_wrapper_read_fn(GInputStream *stream, void *buffer, 17 | gsize count, GCancellable *cancellable, 18 | GError **error) { 19 | StreamWrapper *wrapper = SNAPD_STREAM_WRAPPER(stream); 20 | qint64 nRead; 21 | 22 | if (wrapper->ioDevice == NULL) 23 | return 0; 24 | 25 | nRead = wrapper->ioDevice->read((char *)buffer, count); 26 | if (nRead >= 0) 27 | return nRead; 28 | 29 | g_set_error_literal(error, G_FILE_ERROR, G_FILE_ERROR_FAILED, 30 | wrapper->ioDevice->errorString().toStdString().c_str()); 31 | return -1; 32 | } 33 | 34 | static gboolean stream_wrapper_close_fn(GInputStream *stream, 35 | GCancellable *cancellable, 36 | GError **error) { 37 | StreamWrapper *wrapper = SNAPD_STREAM_WRAPPER(stream); 38 | 39 | if (wrapper->ioDevice == NULL) 40 | return TRUE; 41 | 42 | wrapper->ioDevice->close(); 43 | return TRUE; 44 | } 45 | 46 | static void stream_wrapper_init(StreamWrapper *wrapper) {} 47 | 48 | static void stream_wrapper_class_init(StreamWrapperClass *klass) { 49 | GInputStreamClass *input_stream_class = G_INPUT_STREAM_CLASS(klass); 50 | 51 | input_stream_class->read_fn = stream_wrapper_read_fn; 52 | input_stream_class->close_fn = stream_wrapper_close_fn; 53 | } 54 | -------------------------------------------------------------------------------- /snapd-qt/stream-wrapper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef STREAM_WRAPPER_H 11 | #define STREAM_WRAPPER_H 12 | 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | G_BEGIN_DECLS 20 | 21 | G_DECLARE_FINAL_TYPE(StreamWrapper, stream_wrapper, SNAPD, STREAM_WRAPPER, 22 | GInputStream) 23 | 24 | struct _StreamWrapper { 25 | GInputStream parent_instance; 26 | QPointer ioDevice; 27 | }; 28 | 29 | struct _StreamWrapperClass { 30 | GInputStreamClass parent_class; 31 | }; 32 | 33 | G_END_DECLS 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /snapd-qt/task-data.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/task-data.h" 13 | 14 | QSnapdTaskData::QSnapdTaskData(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QStringList QSnapdTaskData::affectedSnaps() const { 18 | QStringList retval; 19 | GStrv data = 20 | snapd_task_data_get_affected_snaps(SNAPD_TASK_DATA(wrapped_object)); 21 | 22 | if (data != NULL) 23 | for (; *data != NULL; data++) 24 | retval.append((gchar *)*data); 25 | return retval; 26 | } 27 | -------------------------------------------------------------------------------- /snapd-qt/task.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/task.h" 13 | 14 | QSnapdTask::QSnapdTask(void *snapd_object, QObject *parent) 15 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 16 | 17 | QString QSnapdTask::id() const { 18 | return snapd_task_get_id(SNAPD_TASK(wrapped_object)); 19 | } 20 | 21 | QString QSnapdTask::kind() const { 22 | return snapd_task_get_kind(SNAPD_TASK(wrapped_object)); 23 | } 24 | 25 | QString QSnapdTask::summary() const { 26 | return snapd_task_get_summary(SNAPD_TASK(wrapped_object)); 27 | } 28 | 29 | QString QSnapdTask::status() const { 30 | return snapd_task_get_status(SNAPD_TASK(wrapped_object)); 31 | } 32 | 33 | QString QSnapdTask::progressLabel() const { 34 | return snapd_task_get_progress_label(SNAPD_TASK(wrapped_object)); 35 | } 36 | 37 | qint64 QSnapdTask::progressDone() const { 38 | return snapd_task_get_progress_done(SNAPD_TASK(wrapped_object)); 39 | } 40 | 41 | qint64 QSnapdTask::progressTotal() const { 42 | return snapd_task_get_progress_total(SNAPD_TASK(wrapped_object)); 43 | } 44 | 45 | static QDateTime convertDateTime(GDateTime *datetime) { 46 | if (datetime == NULL) 47 | return QDateTime(); 48 | 49 | QDate date(g_date_time_get_year(datetime), g_date_time_get_month(datetime), 50 | g_date_time_get_day_of_month(datetime)); 51 | QTime time(g_date_time_get_hour(datetime), g_date_time_get_minute(datetime), 52 | g_date_time_get_second(datetime), 53 | g_date_time_get_microsecond(datetime) / 1000); 54 | return QDateTime(date, time, Qt::OffsetFromUTC, 55 | g_date_time_get_utc_offset(datetime) / 1000000); 56 | } 57 | 58 | QDateTime QSnapdTask::spawnTime() const { 59 | return convertDateTime(snapd_task_get_spawn_time(SNAPD_TASK(wrapped_object))); 60 | } 61 | 62 | QDateTime QSnapdTask::readyTime() const { 63 | return convertDateTime(snapd_task_get_ready_time(SNAPD_TASK(wrapped_object))); 64 | } 65 | 66 | QSnapdTaskData *QSnapdTask::taskData() const { 67 | SnapdTaskData *data = 68 | SNAPD_TASK_DATA(snapd_task_get_data(SNAPD_TASK(wrapped_object))); 69 | if (data == NULL) 70 | return NULL; 71 | return new QSnapdTaskData(SNAPD_TASK_DATA(data), NULL); 72 | } 73 | -------------------------------------------------------------------------------- /snapd-qt/user-information.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #include 11 | 12 | #include "Snapd/user-information.h" 13 | 14 | QSnapdUserInformation::QSnapdUserInformation(void *snapd_object, 15 | QObject *parent) 16 | : QSnapdWrappedObject(g_object_ref(snapd_object), g_object_unref, parent) {} 17 | 18 | int QSnapdUserInformation::id() const { 19 | return snapd_user_information_get_id(SNAPD_USER_INFORMATION(wrapped_object)); 20 | } 21 | 22 | QString QSnapdUserInformation::username() const { 23 | return snapd_user_information_get_username( 24 | SNAPD_USER_INFORMATION(wrapped_object)); 25 | } 26 | 27 | QString QSnapdUserInformation::email() const { 28 | return snapd_user_information_get_email( 29 | SNAPD_USER_INFORMATION(wrapped_object)); 30 | } 31 | 32 | QStringList QSnapdUserInformation::sshKeys() const { 33 | GStrv ssh_keys = snapd_user_information_get_ssh_keys( 34 | SNAPD_USER_INFORMATION(wrapped_object)); 35 | QStringList result; 36 | for (int i = 0; ssh_keys[i] != NULL; i++) 37 | result.append(ssh_keys[i]); 38 | return result; 39 | } 40 | 41 | QSnapdAuthData *QSnapdUserInformation::authData() const { 42 | return new QSnapdAuthData(snapd_user_information_get_auth_data( 43 | SNAPD_USER_INFORMATION(wrapped_object))); 44 | } 45 | -------------------------------------------------------------------------------- /snapd-qt/variant.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Canonical Ltd. 3 | * 4 | * This library is free software; you can redistribute it and/or modify it under 5 | * the terms of the GNU Lesser General Public License as published by the Free 6 | * Software Foundation; either version 2 or version 3 of the License. 7 | * See http://www.gnu.org/copyleft/lgpl.html the full text of the license. 8 | */ 9 | 10 | #ifndef VARIANT_H 11 | #define VARIANT_H 12 | 13 | static QVariant gvariant_to_qvariant(GVariant *variant) { 14 | if (variant == NULL) 15 | return QVariant(); 16 | 17 | if (g_variant_is_of_type(variant, G_VARIANT_TYPE_BOOLEAN)) 18 | return QVariant((bool)g_variant_get_boolean(variant)); 19 | if (g_variant_is_of_type(variant, G_VARIANT_TYPE_INT64)) 20 | return QVariant((qlonglong)g_variant_get_int64(variant)); 21 | if (g_variant_is_of_type(variant, G_VARIANT_TYPE_STRING)) 22 | return QVariant(g_variant_get_string(variant, NULL)); 23 | if (g_variant_is_of_type(variant, G_VARIANT_TYPE_DOUBLE)) 24 | return QVariant(g_variant_get_double(variant)); 25 | if (g_variant_is_of_type(variant, G_VARIANT_TYPE("av"))) { 26 | QList list; 27 | GVariantIter iter; 28 | g_variant_iter_init(&iter, variant); 29 | GVariant *value; 30 | while (g_variant_iter_loop(&iter, "v", &value)) 31 | list.append(gvariant_to_qvariant(value)); 32 | return QVariant(list); 33 | } 34 | if (g_variant_is_of_type(variant, G_VARIANT_TYPE("a{sv}"))) { 35 | QHash object; 36 | GVariantIter iter; 37 | g_variant_iter_init(&iter, variant); 38 | const gchar *key; 39 | GVariant *value; 40 | while (g_variant_iter_loop(&iter, "{sv}", &key, &value)) 41 | object.insert(key, gvariant_to_qvariant(value)); 42 | return QVariant(object); 43 | } 44 | if (g_variant_is_of_type(variant, G_VARIANT_TYPE("mv"))) 45 | return QVariant(); 46 | 47 | return QVariant(); 48 | } 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /tests/test-glib.test.in: -------------------------------------------------------------------------------- 1 | [Test] 2 | Type=session 3 | Exec=@installed_tests_exec_dir@/test-glib 4 | -------------------------------------------------------------------------------- /tests/test-markdown-glib.test.in: -------------------------------------------------------------------------------- 1 | [Test] 2 | Type=session 3 | Exec=@installed_tests_exec_dir@/test-markdown-glib 4 | -------------------------------------------------------------------------------- /tests/test-markdown-qt5.test.in: -------------------------------------------------------------------------------- 1 | [Test] 2 | Type=session 3 | Exec=@installed_tests_exec_dir@/test-markdown-qt5 4 | -------------------------------------------------------------------------------- /tests/test-markdown-qt6.test.in: -------------------------------------------------------------------------------- 1 | [Test] 2 | Type=session 3 | Exec=@installed_tests_exec_dir@/test-markdown-qt6 4 | -------------------------------------------------------------------------------- /tests/test-qt5.test.in: -------------------------------------------------------------------------------- 1 | [Test] 2 | Type=session 3 | Exec=@installed_tests_exec_dir@/test-qt5 4 | -------------------------------------------------------------------------------- /tests/test-qt6.test.in: -------------------------------------------------------------------------------- 1 | [Test] 2 | Type=session 3 | Exec=@installed_tests_exec_dir@/test-qt6 4 | --------------------------------------------------------------------------------