From 1f00a987a689231df052de88280d6e042af1827b Mon Sep 17 00:00:00 2001 From: Alexander Vanhee <160625516+AlexanderVanhee@users.noreply.github.com> Date: Wed, 29 Jul 2026 21:51:43 +0200 Subject: [PATCH] Add main config option to hide auto update options in preferences --- docs/overview.md | 2 ++ src/bz-main-config.txt | 1 + src/bz-preferences-dialog.blp | 4 +++- src/bz-preferences-dialog.c | 12 ++++-------- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/overview.md b/docs/overview.md index de8206a2..2610570f 100644 --- a/docs/overview.md +++ b/docs/overview.md @@ -109,6 +109,8 @@ curated-config-paths: - /run/host/etc/bazaar/curated.yaml # Make the app start on the curated page instead of the explore page, try to only use if you have an interesting news section start-on-curated: true +# Hide the auto update options in the preferences dialog, useful when you want to avoid confusion if your distro handles auto-updates of Flatpaks already. +hide-auto-update-options: true ``` ### EOL Overrides diff --git a/src/bz-main-config.txt b/src/bz-main-config.txt index 7c516aba..bc00a690 100644 --- a/src/bz-main-config.txt +++ b/src/bz-main-config.txt @@ -27,3 +27,4 @@ property=hooks GListModel G_TYPE_LIST_MODEL object property=search_biases GListModel G_TYPE_LIST_MODEL object property=start_on_curated gboolean G_TYPE_BOOLEAN boolean +property=hide_auto_update_options gboolean G_TYPE_BOOLEAN boolean diff --git a/src/bz-preferences-dialog.blp b/src/bz-preferences-dialog.blp index 2a49d283..b761fd16 100644 --- a/src/bz-preferences-dialog.blp +++ b/src/bz-preferences-dialog.blp @@ -27,8 +27,9 @@ template $BzPreferencesDialog: Adw.PreferencesDialog { action-name: "app.sync-remotes"; }; - Adw.PreferencesGroup { + Adw.PreferencesGroup auto_updates_group { title: _("App Updates"); + visible: bind try {$logical_or($invert_boolean(template.state as <$BzStateInfo>.main-config as <$BzMainConfig>.hide-auto-update-options) as , automatic_updates_check.active), true}; [header-suffix] MenuButton { @@ -73,6 +74,7 @@ template $BzPreferencesDialog: Adw.PreferencesDialog { } Adw.PreferencesGroup { + visible: bind auto_updates_group.visible; Adw.SwitchRow auto_notif_switch { use-underline: true; title: _("Automatic Update _Notifications"); diff --git a/src/bz-preferences-dialog.c b/src/bz-preferences-dialog.c index 817b2504..37eb9668 100644 --- a/src/bz-preferences-dialog.c +++ b/src/bz-preferences-dialog.c @@ -19,6 +19,7 @@ */ #include "bz-preferences-dialog.h" +#include "template-callbacks.h" #include typedef struct @@ -241,13 +242,6 @@ bz_preferences_dialog_set_property (GObject *object, } } -static gboolean -invert_boolean (gpointer object, - gboolean value) -{ - return !value; -} - static void bz_preferences_dialog_class_init (BzPreferencesDialogClass *klass) { @@ -269,6 +263,8 @@ bz_preferences_dialog_class_init (BzPreferencesDialogClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/io/github/kolunmi/Bazaar/bz-preferences-dialog.ui"); + bz_widget_class_bind_all_util_callbacks (widget_class); + gtk_widget_class_bind_template_child (widget_class, BzPreferencesDialog, only_foss_switch); gtk_widget_class_bind_template_child (widget_class, BzPreferencesDialog, only_flathub_switch); gtk_widget_class_bind_template_child (widget_class, BzPreferencesDialog, only_verified_switch); @@ -276,7 +272,6 @@ bz_preferences_dialog_class_init (BzPreferencesDialogClass *klass) gtk_widget_class_bind_template_child (widget_class, BzPreferencesDialog, hide_eol_switch); gtk_widget_class_bind_template_child (widget_class, BzPreferencesDialog, automatic_updates_check); gtk_widget_class_bind_template_child (widget_class, BzPreferencesDialog, auto_notif_switch); - gtk_widget_class_bind_template_callback (widget_class, invert_boolean); } static void @@ -298,5 +293,6 @@ bz_preferences_dialog_new (BzStateInfo *state) g_object_get (state, "settings", &dialog->settings, NULL); bind_settings (dialog); + g_object_notify_by_pspec (G_OBJECT (dialog), props[PROP_STATE]); return ADW_DIALOG (dialog); }