#[cfg(any(feature = "v0_7_8", feature = "dox"))]
use Agreement;
#[cfg(any(feature = "v0_7_8", feature = "dox"))]
use AgreementKind;
#[cfg(any(feature = "v0_5_10", feature = "dox"))]
use AppKind;
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
use AppMergeKind;
#[cfg(any(feature = "v0_5_10", feature = "dox"))]
use AppQuirk;
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
use AppScope;
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
use AppState;
#[cfg(any(feature = "v0_3_5", feature = "dox"))]
use Bundle;
#[cfg(any(feature = "v0_1_2", feature = "dox"))]
use Error;
#[cfg(any(feature = "v0_6_9", feature = "dox"))]
use Format;
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
use FormatKind;
#[cfg(any(feature = "v0_3_1", feature = "dox"))]
use Icon;
#[cfg(any(feature = "v0_3_1", feature = "dox"))]
use IconKind;
use IdKind;
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
use KudoKind;
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
use Launchable;
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
use LaunchableKind;
#[cfg(any(feature = "v0_1_6", feature = "dox"))]
use Provide;
#[cfg(any(feature = "v0_6_7", feature = "dox"))]
use Require;
#[cfg(any(feature = "v0_6_7", feature = "dox"))]
use RequireKind;
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
use Review;
use Screenshot;
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
use Suggest;
#[cfg(any(feature = "v0_5_8", feature = "dox"))]
use Translation;
use UrlKind;
use app_stream_glib_sys;
#[cfg(any(feature = "v0_2", feature = "dox"))]
use gio;
#[cfg(any(feature = "v0_1_2", feature = "dox"))]
use glib;
use glib::GString;
use glib::object::IsA;
use glib::translate::*;
use std::fmt;
#[cfg(any(feature = "v0_1_2", feature = "dox"))]
use std::ptr;
glib_wrapper! {
pub struct App(Object<app_stream_glib_sys::AsApp, app_stream_glib_sys::AsAppClass, AppClass>);
match fn {
get_type => || app_stream_glib_sys::as_app_get_type(),
}
}
impl App {
pub fn new() -> App {
unsafe {
from_glib_full(app_stream_glib_sys::as_app_new())
}
}
#[cfg(any(feature = "v0_1_2", feature = "dox"))]
pub fn error_quark() -> glib::Quark {
unsafe {
from_glib(app_stream_glib_sys::as_app_error_quark())
}
}
#[cfg(any(feature = "v0_1_8", feature = "dox"))]
pub fn guess_source_kind(filename: &str) -> FormatKind {
unsafe {
from_glib(app_stream_glib_sys::as_app_guess_source_kind(filename.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_5_10", feature = "dox"))]
pub fn kind_from_string(kind: &str) -> AppKind {
unsafe {
from_glib(app_stream_glib_sys::as_app_kind_from_string(kind.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_5_10", feature = "dox"))]
pub fn kind_to_string(kind: AppKind) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_kind_to_string(kind.to_glib()))
}
}
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
pub fn merge_kind_from_string(merge_kind: &str) -> AppMergeKind {
unsafe {
from_glib(app_stream_glib_sys::as_app_merge_kind_from_string(merge_kind.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
pub fn merge_kind_to_string(merge_kind: AppMergeKind) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_merge_kind_to_string(merge_kind.to_glib()))
}
}
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
pub fn scope_from_string(scope: &str) -> AppScope {
unsafe {
from_glib(app_stream_glib_sys::as_app_scope_from_string(scope.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
pub fn scope_to_string(scope: AppScope) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_scope_to_string(scope.to_glib()))
}
}
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
pub fn source_kind_from_string(source_kind: &str) -> FormatKind {
unsafe {
from_glib(app_stream_glib_sys::as_app_source_kind_from_string(source_kind.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
pub fn source_kind_to_string(source_kind: FormatKind) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_source_kind_to_string(source_kind.to_glib()))
}
}
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
pub fn state_to_string(state: AppState) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_state_to_string(state.to_glib()))
}
}
}
impl Default for App {
fn default() -> Self {
Self::new()
}
}
pub const NONE_APP: Option<&App> = None;
pub trait AppExt: 'static {
#[cfg(any(feature = "v0_1_7", feature = "dox"))]
fn add_addon<P: IsA<App>>(&self, addon: &P);
#[cfg(any(feature = "v0_7_8", feature = "dox"))]
fn add_agreement<P: IsA<Agreement>>(&self, agreement: &P);
#[cfg(any(feature = "v0_1_1", feature = "dox"))]
fn add_arch(&self, arch: &str);
#[cfg(any(feature = "v0_3_5", feature = "dox"))]
fn add_bundle<P: IsA<Bundle>>(&self, bundle: &P);
fn add_category(&self, category: &str);
fn add_compulsory_for_desktop(&self, compulsory_for_desktop: &str);
#[cfg(any(feature = "v0_1_7", feature = "dox"))]
fn add_extends(&self, extends: &str);
#[cfg(any(feature = "v0_6_9", feature = "dox"))]
fn add_format<P: IsA<Format>>(&self, format: &P);
#[cfg(any(feature = "v0_3_1", feature = "dox"))]
fn add_icon<P: IsA<Icon>>(&self, icon: &P);
#[cfg(any(feature = "v0_3", feature = "dox"))]
fn add_keyword(&self, locale: Option<&str>, keyword: &str);
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn add_kudo(&self, kudo: &str);
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn add_kudo_kind(&self, kudo_kind: KudoKind);
fn add_language(&self, percentage: i32, locale: Option<&str>);
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
fn add_launchable<P: IsA<Launchable>>(&self, launchable: &P);
fn add_metadata(&self, key: &str, value: Option<&str>);
fn add_mimetype(&self, mimetype: &str);
#[cfg(any(feature = "v0_3_5", feature = "dox"))]
fn add_permission(&self, permission: &str);
fn add_pkgname(&self, pkgname: &str);
#[cfg(any(feature = "v0_1_6", feature = "dox"))]
fn add_provide<P: IsA<Provide>>(&self, provide: &P);
#[cfg(any(feature = "v0_5_10", feature = "dox"))]
fn add_quirk(&self, quirk: AppQuirk);
#[cfg(any(feature = "v0_6_7", feature = "dox"))]
fn add_require<P: IsA<Require>>(&self, require: &P);
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn add_review<P: IsA<Review>>(&self, review: &P);
fn add_screenshot<P: IsA<Screenshot>>(&self, screenshot: &P);
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn add_suggest<P: IsA<Suggest>>(&self, suggest: &P);
#[cfg(any(feature = "v0_5_8", feature = "dox"))]
fn add_translation<P: IsA<Translation>>(&self, translation: &P);
fn add_url(&self, url_kind: UrlKind, url: &str);
#[cfg(any(feature = "v0_3_1", feature = "dox"))]
fn convert_icons(&self, kind: IconKind) -> Result<(), Error>;
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn equal<P: IsA<App>>(&self, app2: &P) -> bool;
#[cfg(any(feature = "v0_7_8", feature = "dox"))]
fn get_agreement_by_kind(&self, kind: AgreementKind) -> Option<Agreement>;
#[cfg(any(feature = "v0_7_8", feature = "dox"))]
fn get_agreement_default(&self) -> Option<Agreement>;
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn get_branch(&self) -> Option<GString>;
#[cfg(any(feature = "v0_3_5", feature = "dox"))]
fn get_bundle_default(&self) -> Option<Bundle>;
fn get_comment(&self, locale: Option<&str>) -> Option<GString>;
fn get_description(&self, locale: Option<&str>) -> Option<GString>;
#[cfg(any(feature = "v0_1_8", feature = "dox"))]
fn get_developer_name(&self, locale: Option<&str>) -> Option<GString>;
#[cfg(any(feature = "v0_6_9", feature = "dox"))]
fn get_format_by_filename(&self, filename: &str) -> Option<Format>;
#[cfg(any(feature = "v0_6_9", feature = "dox"))]
fn get_format_by_kind(&self, kind: FormatKind) -> Option<Format>;
#[cfg(any(feature = "v0_6_9", feature = "dox"))]
fn get_format_default(&self) -> Option<Format>;
#[cfg(any(feature = "v0_3_1", feature = "dox"))]
fn get_icon_default(&self) -> Option<Icon>;
#[cfg(any(feature = "v0_3_1", feature = "dox"))]
fn get_icon_for_size(&self, width: u32, height: u32) -> Option<Icon>;
fn get_icon_path(&self) -> Option<GString>;
fn get_id(&self) -> Option<GString>;
#[cfg(any(feature = "v0_3", feature = "dox"))]
fn get_id_filename(&self) -> Option<GString>;
fn get_id_kind(&self) -> IdKind;
#[cfg(any(feature = "v0_5_12", feature = "dox"))]
fn get_id_no_prefix(&self) -> Option<GString>;
#[cfg(any(feature = "v0_5_10", feature = "dox"))]
fn get_kind(&self) -> AppKind;
fn get_language(&self, locale: Option<&str>) -> i32;
fn get_languages(&self) -> Vec<GString>;
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
fn get_launchable_by_kind(&self, kind: LaunchableKind) -> Option<Launchable>;
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
fn get_launchable_default(&self) -> Option<Launchable>;
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn get_merge_kind(&self) -> AppMergeKind;
fn get_metadata_item(&self, key: &str) -> Option<GString>;
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
fn get_metadata_license(&self) -> Option<GString>;
fn get_name(&self, locale: Option<&str>) -> Option<GString>;
#[cfg(any(feature = "v0_3_2", feature = "dox"))]
fn get_origin(&self) -> Option<GString>;
#[cfg(any(feature = "v0_2", feature = "dox"))]
fn get_pkgname_default(&self) -> Option<GString>;
fn get_priority(&self) -> i32;
fn get_project_group(&self) -> Option<GString>;
fn get_project_license(&self) -> Option<GString>;
#[cfg(any(feature = "v0_6_7", feature = "dox"))]
fn get_require_by_value(&self, kind: RequireKind, value: &str) -> Option<Require>;
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn get_scope(&self) -> AppScope;
#[cfg(any(feature = "v0_7_3", feature = "dox"))]
fn get_screenshot_default(&self) -> Option<Screenshot>;
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
fn get_search_match(&self) -> u16;
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn get_source_file(&self) -> Option<GString>;
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
fn get_source_kind(&self) -> FormatKind;
#[cfg(any(feature = "v0_2_4", feature = "dox"))]
fn get_source_pkgname(&self) -> Option<GString>;
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn get_state(&self) -> AppState;
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn get_trust_flags(&self) -> u32;
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn get_unique_id(&self) -> Option<GString>;
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
fn get_update_contact(&self) -> Option<GString>;
fn get_url_item(&self, url_kind: UrlKind) -> Option<GString>;
#[cfg(any(feature = "v0_1_5", feature = "dox"))]
fn has_category(&self, category: &str) -> bool;
#[cfg(any(feature = "v0_5_12", feature = "dox"))]
fn has_compulsory_for_desktop(&self, desktop: &str) -> bool;
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn has_kudo(&self, kudo: &str) -> bool;
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn has_kudo_kind(&self, kudo: KudoKind) -> bool;
#[cfg(any(feature = "v0_3_5", feature = "dox"))]
fn has_permission(&self, permission: &str) -> bool;
#[cfg(any(feature = "v0_5_10", feature = "dox"))]
fn has_quirk(&self, quirk: AppQuirk) -> bool;
#[cfg(any(feature = "v0_7_5", feature = "dox"))]
fn parse_data(&self, data: &glib::Bytes, flags: u32) -> Result<(), Error>;
#[cfg(any(feature = "v0_1_2", feature = "dox"))]
fn parse_file(&self, filename: &str, flags: u32) -> Result<(), Error>;
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
fn remove_category(&self, category: &str);
#[cfg(any(feature = "v0_6_9", feature = "dox"))]
fn remove_format<P: IsA<Format>>(&self, format: &P);
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
fn remove_kudo(&self, kudo: &str);
fn remove_metadata(&self, key: &str);
#[cfg(any(feature = "v0_4_1", feature = "dox"))]
fn remove_veto(&self, description: &str);
fn search_matches(&self, search: &str) -> u32;
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn set_branch(&self, branch: &str);
fn set_comment(&self, locale: Option<&str>, comment: &str);
fn set_description(&self, locale: Option<&str>, description: &str);
fn set_developer_name(&self, locale: Option<&str>, developer_name: &str);
fn set_icon_path(&self, icon_path: &str);
fn set_id(&self, id: &str);
fn set_id_kind(&self, id_kind: IdKind);
#[cfg(any(feature = "v0_5_10", feature = "dox"))]
fn set_kind(&self, kind: AppKind);
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn set_merge_kind(&self, merge_kind: AppMergeKind);
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
fn set_metadata_license(&self, metadata_license: &str);
fn set_name(&self, locale: Option<&str>, name: &str);
#[cfg(any(feature = "v0_3_2", feature = "dox"))]
fn set_origin(&self, origin: &str);
fn set_priority(&self, priority: i32);
fn set_project_group(&self, project_group: &str);
fn set_project_license(&self, project_license: &str);
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn set_scope(&self, scope: AppScope);
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
fn set_search_match(&self, search_match: u16);
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn set_source_file(&self, source_file: &str);
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
fn set_source_kind(&self, source_kind: FormatKind);
#[cfg(any(feature = "v0_2_4", feature = "dox"))]
fn set_source_pkgname(&self, source_pkgname: &str);
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn set_state(&self, state: AppState);
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn set_trust_flags(&self, trust_flags: u32);
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
fn set_update_contact(&self, update_contact: &str);
fn subsume<P: IsA<App>>(&self, donor: &P);
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
fn subsume_full<P: IsA<App>>(&self, donor: &P, flags: u64);
#[cfg(any(feature = "v0_2", feature = "dox"))]
fn to_file<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(&self, file: &P, cancellable: Option<&Q>) -> Result<(), Error>;
#[cfg(any(feature = "v0_7_14", feature = "dox"))]
fn to_xml(&self) -> Result<glib::String, Error>;
}
impl<O: IsA<App>> AppExt for O {
#[cfg(any(feature = "v0_1_7", feature = "dox"))]
fn add_addon<P: IsA<App>>(&self, addon: &P) {
unsafe {
app_stream_glib_sys::as_app_add_addon(self.as_ref().to_glib_none().0, addon.as_ref().to_glib_none().0);
}
}
#[cfg(any(feature = "v0_7_8", feature = "dox"))]
fn add_agreement<P: IsA<Agreement>>(&self, agreement: &P) {
unsafe {
app_stream_glib_sys::as_app_add_agreement(self.as_ref().to_glib_none().0, agreement.as_ref().to_glib_none().0);
}
}
#[cfg(any(feature = "v0_1_1", feature = "dox"))]
fn add_arch(&self, arch: &str) {
unsafe {
app_stream_glib_sys::as_app_add_arch(self.as_ref().to_glib_none().0, arch.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_3_5", feature = "dox"))]
fn add_bundle<P: IsA<Bundle>>(&self, bundle: &P) {
unsafe {
app_stream_glib_sys::as_app_add_bundle(self.as_ref().to_glib_none().0, bundle.as_ref().to_glib_none().0);
}
}
fn add_category(&self, category: &str) {
unsafe {
app_stream_glib_sys::as_app_add_category(self.as_ref().to_glib_none().0, category.to_glib_none().0);
}
}
fn add_compulsory_for_desktop(&self, compulsory_for_desktop: &str) {
unsafe {
app_stream_glib_sys::as_app_add_compulsory_for_desktop(self.as_ref().to_glib_none().0, compulsory_for_desktop.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_1_7", feature = "dox"))]
fn add_extends(&self, extends: &str) {
unsafe {
app_stream_glib_sys::as_app_add_extends(self.as_ref().to_glib_none().0, extends.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_6_9", feature = "dox"))]
fn add_format<P: IsA<Format>>(&self, format: &P) {
unsafe {
app_stream_glib_sys::as_app_add_format(self.as_ref().to_glib_none().0, format.as_ref().to_glib_none().0);
}
}
#[cfg(any(feature = "v0_3_1", feature = "dox"))]
fn add_icon<P: IsA<Icon>>(&self, icon: &P) {
unsafe {
app_stream_glib_sys::as_app_add_icon(self.as_ref().to_glib_none().0, icon.as_ref().to_glib_none().0);
}
}
#[cfg(any(feature = "v0_3", feature = "dox"))]
fn add_keyword(&self, locale: Option<&str>, keyword: &str) {
unsafe {
app_stream_glib_sys::as_app_add_keyword(self.as_ref().to_glib_none().0, locale.to_glib_none().0, keyword.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn add_kudo(&self, kudo: &str) {
unsafe {
app_stream_glib_sys::as_app_add_kudo(self.as_ref().to_glib_none().0, kudo.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn add_kudo_kind(&self, kudo_kind: KudoKind) {
unsafe {
app_stream_glib_sys::as_app_add_kudo_kind(self.as_ref().to_glib_none().0, kudo_kind.to_glib());
}
}
fn add_language(&self, percentage: i32, locale: Option<&str>) {
unsafe {
app_stream_glib_sys::as_app_add_language(self.as_ref().to_glib_none().0, percentage, locale.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
fn add_launchable<P: IsA<Launchable>>(&self, launchable: &P) {
unsafe {
app_stream_glib_sys::as_app_add_launchable(self.as_ref().to_glib_none().0, launchable.as_ref().to_glib_none().0);
}
}
fn add_metadata(&self, key: &str, value: Option<&str>) {
unsafe {
app_stream_glib_sys::as_app_add_metadata(self.as_ref().to_glib_none().0, key.to_glib_none().0, value.to_glib_none().0);
}
}
fn add_mimetype(&self, mimetype: &str) {
unsafe {
app_stream_glib_sys::as_app_add_mimetype(self.as_ref().to_glib_none().0, mimetype.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_3_5", feature = "dox"))]
fn add_permission(&self, permission: &str) {
unsafe {
app_stream_glib_sys::as_app_add_permission(self.as_ref().to_glib_none().0, permission.to_glib_none().0);
}
}
fn add_pkgname(&self, pkgname: &str) {
unsafe {
app_stream_glib_sys::as_app_add_pkgname(self.as_ref().to_glib_none().0, pkgname.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_1_6", feature = "dox"))]
fn add_provide<P: IsA<Provide>>(&self, provide: &P) {
unsafe {
app_stream_glib_sys::as_app_add_provide(self.as_ref().to_glib_none().0, provide.as_ref().to_glib_none().0);
}
}
#[cfg(any(feature = "v0_5_10", feature = "dox"))]
fn add_quirk(&self, quirk: AppQuirk) {
unsafe {
app_stream_glib_sys::as_app_add_quirk(self.as_ref().to_glib_none().0, quirk.to_glib());
}
}
#[cfg(any(feature = "v0_6_7", feature = "dox"))]
fn add_require<P: IsA<Require>>(&self, require: &P) {
unsafe {
app_stream_glib_sys::as_app_add_require(self.as_ref().to_glib_none().0, require.as_ref().to_glib_none().0);
}
}
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn add_review<P: IsA<Review>>(&self, review: &P) {
unsafe {
app_stream_glib_sys::as_app_add_review(self.as_ref().to_glib_none().0, review.as_ref().to_glib_none().0);
}
}
fn add_screenshot<P: IsA<Screenshot>>(&self, screenshot: &P) {
unsafe {
app_stream_glib_sys::as_app_add_screenshot(self.as_ref().to_glib_none().0, screenshot.as_ref().to_glib_none().0);
}
}
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn add_suggest<P: IsA<Suggest>>(&self, suggest: &P) {
unsafe {
app_stream_glib_sys::as_app_add_suggest(self.as_ref().to_glib_none().0, suggest.as_ref().to_glib_none().0);
}
}
#[cfg(any(feature = "v0_5_8", feature = "dox"))]
fn add_translation<P: IsA<Translation>>(&self, translation: &P) {
unsafe {
app_stream_glib_sys::as_app_add_translation(self.as_ref().to_glib_none().0, translation.as_ref().to_glib_none().0);
}
}
fn add_url(&self, url_kind: UrlKind, url: &str) {
unsafe {
app_stream_glib_sys::as_app_add_url(self.as_ref().to_glib_none().0, url_kind.to_glib(), url.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_3_1", feature = "dox"))]
fn convert_icons(&self, kind: IconKind) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = app_stream_glib_sys::as_app_convert_icons(self.as_ref().to_glib_none().0, kind.to_glib(), &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn equal<P: IsA<App>>(&self, app2: &P) -> bool {
unsafe {
from_glib(app_stream_glib_sys::as_app_equal(self.as_ref().to_glib_none().0, app2.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_7_8", feature = "dox"))]
fn get_agreement_by_kind(&self, kind: AgreementKind) -> Option<Agreement> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_agreement_by_kind(self.as_ref().to_glib_none().0, kind.to_glib()))
}
}
#[cfg(any(feature = "v0_7_8", feature = "dox"))]
fn get_agreement_default(&self) -> Option<Agreement> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_agreement_default(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn get_branch(&self) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_branch(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_3_5", feature = "dox"))]
fn get_bundle_default(&self) -> Option<Bundle> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_bundle_default(self.as_ref().to_glib_none().0))
}
}
fn get_comment(&self, locale: Option<&str>) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_comment(self.as_ref().to_glib_none().0, locale.to_glib_none().0))
}
}
fn get_description(&self, locale: Option<&str>) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_description(self.as_ref().to_glib_none().0, locale.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_1_8", feature = "dox"))]
fn get_developer_name(&self, locale: Option<&str>) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_developer_name(self.as_ref().to_glib_none().0, locale.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_6_9", feature = "dox"))]
fn get_format_by_filename(&self, filename: &str) -> Option<Format> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_format_by_filename(self.as_ref().to_glib_none().0, filename.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_6_9", feature = "dox"))]
fn get_format_by_kind(&self, kind: FormatKind) -> Option<Format> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_format_by_kind(self.as_ref().to_glib_none().0, kind.to_glib()))
}
}
#[cfg(any(feature = "v0_6_9", feature = "dox"))]
fn get_format_default(&self) -> Option<Format> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_format_default(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_3_1", feature = "dox"))]
fn get_icon_default(&self) -> Option<Icon> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_icon_default(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_3_1", feature = "dox"))]
fn get_icon_for_size(&self, width: u32, height: u32) -> Option<Icon> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_icon_for_size(self.as_ref().to_glib_none().0, width, height))
}
}
fn get_icon_path(&self) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_icon_path(self.as_ref().to_glib_none().0))
}
}
fn get_id(&self) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_id(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_3", feature = "dox"))]
fn get_id_filename(&self) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_id_filename(self.as_ref().to_glib_none().0))
}
}
fn get_id_kind(&self) -> IdKind {
unsafe {
from_glib(app_stream_glib_sys::as_app_get_id_kind(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_5_12", feature = "dox"))]
fn get_id_no_prefix(&self) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_id_no_prefix(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_5_10", feature = "dox"))]
fn get_kind(&self) -> AppKind {
unsafe {
from_glib(app_stream_glib_sys::as_app_get_kind(self.as_ref().to_glib_none().0))
}
}
fn get_language(&self, locale: Option<&str>) -> i32 {
unsafe {
app_stream_glib_sys::as_app_get_language(self.as_ref().to_glib_none().0, locale.to_glib_none().0)
}
}
fn get_languages(&self) -> Vec<GString> {
unsafe {
FromGlibPtrContainer::from_glib_container(app_stream_glib_sys::as_app_get_languages(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
fn get_launchable_by_kind(&self, kind: LaunchableKind) -> Option<Launchable> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_launchable_by_kind(self.as_ref().to_glib_none().0, kind.to_glib()))
}
}
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
fn get_launchable_default(&self) -> Option<Launchable> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_launchable_default(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn get_merge_kind(&self) -> AppMergeKind {
unsafe {
from_glib(app_stream_glib_sys::as_app_get_merge_kind(self.as_ref().to_glib_none().0))
}
}
fn get_metadata_item(&self, key: &str) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_metadata_item(self.as_ref().to_glib_none().0, key.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
fn get_metadata_license(&self) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_metadata_license(self.as_ref().to_glib_none().0))
}
}
fn get_name(&self, locale: Option<&str>) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_name(self.as_ref().to_glib_none().0, locale.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_3_2", feature = "dox"))]
fn get_origin(&self) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_origin(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_2", feature = "dox"))]
fn get_pkgname_default(&self) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_pkgname_default(self.as_ref().to_glib_none().0))
}
}
fn get_priority(&self) -> i32 {
unsafe {
app_stream_glib_sys::as_app_get_priority(self.as_ref().to_glib_none().0)
}
}
fn get_project_group(&self) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_project_group(self.as_ref().to_glib_none().0))
}
}
fn get_project_license(&self) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_project_license(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_6_7", feature = "dox"))]
fn get_require_by_value(&self, kind: RequireKind, value: &str) -> Option<Require> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_require_by_value(self.as_ref().to_glib_none().0, kind.to_glib(), value.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn get_scope(&self) -> AppScope {
unsafe {
from_glib(app_stream_glib_sys::as_app_get_scope(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_7_3", feature = "dox"))]
fn get_screenshot_default(&self) -> Option<Screenshot> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_screenshot_default(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
fn get_search_match(&self) -> u16 {
unsafe {
app_stream_glib_sys::as_app_get_search_match(self.as_ref().to_glib_none().0)
}
}
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn get_source_file(&self) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_source_file(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
fn get_source_kind(&self) -> FormatKind {
unsafe {
from_glib(app_stream_glib_sys::as_app_get_source_kind(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_2_4", feature = "dox"))]
fn get_source_pkgname(&self) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_source_pkgname(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn get_state(&self) -> AppState {
unsafe {
from_glib(app_stream_glib_sys::as_app_get_state(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn get_trust_flags(&self) -> u32 {
unsafe {
app_stream_glib_sys::as_app_get_trust_flags(self.as_ref().to_glib_none().0)
}
}
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn get_unique_id(&self) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_unique_id(self.as_ref().to_glib_none().0))
}
}
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
fn get_update_contact(&self) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_update_contact(self.as_ref().to_glib_none().0))
}
}
fn get_url_item(&self, url_kind: UrlKind) -> Option<GString> {
unsafe {
from_glib_none(app_stream_glib_sys::as_app_get_url_item(self.as_ref().to_glib_none().0, url_kind.to_glib()))
}
}
#[cfg(any(feature = "v0_1_5", feature = "dox"))]
fn has_category(&self, category: &str) -> bool {
unsafe {
from_glib(app_stream_glib_sys::as_app_has_category(self.as_ref().to_glib_none().0, category.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_5_12", feature = "dox"))]
fn has_compulsory_for_desktop(&self, desktop: &str) -> bool {
unsafe {
from_glib(app_stream_glib_sys::as_app_has_compulsory_for_desktop(self.as_ref().to_glib_none().0, desktop.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn has_kudo(&self, kudo: &str) -> bool {
unsafe {
from_glib(app_stream_glib_sys::as_app_has_kudo(self.as_ref().to_glib_none().0, kudo.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn has_kudo_kind(&self, kudo: KudoKind) -> bool {
unsafe {
from_glib(app_stream_glib_sys::as_app_has_kudo_kind(self.as_ref().to_glib_none().0, kudo.to_glib()))
}
}
#[cfg(any(feature = "v0_3_5", feature = "dox"))]
fn has_permission(&self, permission: &str) -> bool {
unsafe {
from_glib(app_stream_glib_sys::as_app_has_permission(self.as_ref().to_glib_none().0, permission.to_glib_none().0))
}
}
#[cfg(any(feature = "v0_5_10", feature = "dox"))]
fn has_quirk(&self, quirk: AppQuirk) -> bool {
unsafe {
from_glib(app_stream_glib_sys::as_app_has_quirk(self.as_ref().to_glib_none().0, quirk.to_glib()))
}
}
#[cfg(any(feature = "v0_7_5", feature = "dox"))]
fn parse_data(&self, data: &glib::Bytes, flags: u32) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = app_stream_glib_sys::as_app_parse_data(self.as_ref().to_glib_none().0, data.to_glib_none().0, flags, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v0_1_2", feature = "dox"))]
fn parse_file(&self, filename: &str, flags: u32) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = app_stream_glib_sys::as_app_parse_file(self.as_ref().to_glib_none().0, filename.to_glib_none().0, flags, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
fn remove_category(&self, category: &str) {
unsafe {
app_stream_glib_sys::as_app_remove_category(self.as_ref().to_glib_none().0, category.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_6_9", feature = "dox"))]
fn remove_format<P: IsA<Format>>(&self, format: &P) {
unsafe {
app_stream_glib_sys::as_app_remove_format(self.as_ref().to_glib_none().0, format.as_ref().to_glib_none().0);
}
}
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
fn remove_kudo(&self, kudo: &str) {
unsafe {
app_stream_glib_sys::as_app_remove_kudo(self.as_ref().to_glib_none().0, kudo.to_glib_none().0);
}
}
fn remove_metadata(&self, key: &str) {
unsafe {
app_stream_glib_sys::as_app_remove_metadata(self.as_ref().to_glib_none().0, key.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_4_1", feature = "dox"))]
fn remove_veto(&self, description: &str) {
unsafe {
app_stream_glib_sys::as_app_remove_veto(self.as_ref().to_glib_none().0, description.to_glib_none().0);
}
}
fn search_matches(&self, search: &str) -> u32 {
unsafe {
app_stream_glib_sys::as_app_search_matches(self.as_ref().to_glib_none().0, search.to_glib_none().0)
}
}
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn set_branch(&self, branch: &str) {
unsafe {
app_stream_glib_sys::as_app_set_branch(self.as_ref().to_glib_none().0, branch.to_glib_none().0);
}
}
fn set_comment(&self, locale: Option<&str>, comment: &str) {
unsafe {
app_stream_glib_sys::as_app_set_comment(self.as_ref().to_glib_none().0, locale.to_glib_none().0, comment.to_glib_none().0);
}
}
fn set_description(&self, locale: Option<&str>, description: &str) {
unsafe {
app_stream_glib_sys::as_app_set_description(self.as_ref().to_glib_none().0, locale.to_glib_none().0, description.to_glib_none().0);
}
}
fn set_developer_name(&self, locale: Option<&str>, developer_name: &str) {
unsafe {
app_stream_glib_sys::as_app_set_developer_name(self.as_ref().to_glib_none().0, locale.to_glib_none().0, developer_name.to_glib_none().0);
}
}
fn set_icon_path(&self, icon_path: &str) {
unsafe {
app_stream_glib_sys::as_app_set_icon_path(self.as_ref().to_glib_none().0, icon_path.to_glib_none().0);
}
}
fn set_id(&self, id: &str) {
unsafe {
app_stream_glib_sys::as_app_set_id(self.as_ref().to_glib_none().0, id.to_glib_none().0);
}
}
fn set_id_kind(&self, id_kind: IdKind) {
unsafe {
app_stream_glib_sys::as_app_set_id_kind(self.as_ref().to_glib_none().0, id_kind.to_glib());
}
}
#[cfg(any(feature = "v0_5_10", feature = "dox"))]
fn set_kind(&self, kind: AppKind) {
unsafe {
app_stream_glib_sys::as_app_set_kind(self.as_ref().to_glib_none().0, kind.to_glib());
}
}
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn set_merge_kind(&self, merge_kind: AppMergeKind) {
unsafe {
app_stream_glib_sys::as_app_set_merge_kind(self.as_ref().to_glib_none().0, merge_kind.to_glib());
}
}
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
fn set_metadata_license(&self, metadata_license: &str) {
unsafe {
app_stream_glib_sys::as_app_set_metadata_license(self.as_ref().to_glib_none().0, metadata_license.to_glib_none().0);
}
}
fn set_name(&self, locale: Option<&str>, name: &str) {
unsafe {
app_stream_glib_sys::as_app_set_name(self.as_ref().to_glib_none().0, locale.to_glib_none().0, name.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_3_2", feature = "dox"))]
fn set_origin(&self, origin: &str) {
unsafe {
app_stream_glib_sys::as_app_set_origin(self.as_ref().to_glib_none().0, origin.to_glib_none().0);
}
}
fn set_priority(&self, priority: i32) {
unsafe {
app_stream_glib_sys::as_app_set_priority(self.as_ref().to_glib_none().0, priority);
}
}
fn set_project_group(&self, project_group: &str) {
unsafe {
app_stream_glib_sys::as_app_set_project_group(self.as_ref().to_glib_none().0, project_group.to_glib_none().0);
}
}
fn set_project_license(&self, project_license: &str) {
unsafe {
app_stream_glib_sys::as_app_set_project_license(self.as_ref().to_glib_none().0, project_license.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_6_1", feature = "dox"))]
fn set_scope(&self, scope: AppScope) {
unsafe {
app_stream_glib_sys::as_app_set_scope(self.as_ref().to_glib_none().0, scope.to_glib());
}
}
#[cfg(any(feature = "v0_6_13", feature = "dox"))]
fn set_search_match(&self, search_match: u16) {
unsafe {
app_stream_glib_sys::as_app_set_search_match(self.as_ref().to_glib_none().0, search_match);
}
}
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn set_source_file(&self, source_file: &str) {
unsafe {
app_stream_glib_sys::as_app_set_source_file(self.as_ref().to_glib_none().0, source_file.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
fn set_source_kind(&self, source_kind: FormatKind) {
unsafe {
app_stream_glib_sys::as_app_set_source_kind(self.as_ref().to_glib_none().0, source_kind.to_glib());
}
}
#[cfg(any(feature = "v0_2_4", feature = "dox"))]
fn set_source_pkgname(&self, source_pkgname: &str) {
unsafe {
app_stream_glib_sys::as_app_set_source_pkgname(self.as_ref().to_glib_none().0, source_pkgname.to_glib_none().0);
}
}
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn set_state(&self, state: AppState) {
unsafe {
app_stream_glib_sys::as_app_set_state(self.as_ref().to_glib_none().0, state.to_glib());
}
}
#[cfg(any(feature = "v0_2_2", feature = "dox"))]
fn set_trust_flags(&self, trust_flags: u32) {
unsafe {
app_stream_glib_sys::as_app_set_trust_flags(self.as_ref().to_glib_none().0, trust_flags);
}
}
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
fn set_update_contact(&self, update_contact: &str) {
unsafe {
app_stream_glib_sys::as_app_set_update_contact(self.as_ref().to_glib_none().0, update_contact.to_glib_none().0);
}
}
fn subsume<P: IsA<App>>(&self, donor: &P) {
unsafe {
app_stream_glib_sys::as_app_subsume(self.as_ref().to_glib_none().0, donor.as_ref().to_glib_none().0);
}
}
#[cfg(any(feature = "v0_1_4", feature = "dox"))]
fn subsume_full<P: IsA<App>>(&self, donor: &P, flags: u64) {
unsafe {
app_stream_glib_sys::as_app_subsume_full(self.as_ref().to_glib_none().0, donor.as_ref().to_glib_none().0, flags);
}
}
#[cfg(any(feature = "v0_2", feature = "dox"))]
fn to_file<P: IsA<gio::File>, Q: IsA<gio::Cancellable>>(&self, file: &P, cancellable: Option<&Q>) -> Result<(), Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = app_stream_glib_sys::as_app_to_file(self.as_ref().to_glib_none().0, file.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error);
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
}
}
#[cfg(any(feature = "v0_7_14", feature = "dox"))]
fn to_xml(&self) -> Result<glib::String, Error> {
unsafe {
let mut error = ptr::null_mut();
let ret = app_stream_glib_sys::as_app_to_xml(self.as_ref().to_glib_none().0, &mut error);
if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
}
}
}
impl fmt::Display for App {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "App")
}
}