Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions data/io.github.kolunmi.Bazaar.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
<summary>Show Only Verified Content</summary>
<description>Hide applications which are not verified on Flathub</description>
</key>
<key name="show-only-mobile" type="b">
<default>false</default>
<summary>Show Only Mobile apps</summary>
<description>Hide applications which do not work well on mobile</description>
</key>
<key name="search-debounce" type="b">
<default>true</default>
<summary>Debounce Search Inputs</summary>
Expand Down
13 changes: 13 additions & 0 deletions src/bz-application.c
Original file line number Diff line number Diff line change
Expand Up @@ -2139,6 +2139,7 @@ show_hide_app_setting_changed (BzApplication *self,
bz_state_info_set_show_only_foss (self->state, g_settings_get_boolean (self->settings, "show-only-foss"));
bz_state_info_set_show_only_flathub (self->state, g_settings_get_boolean (self->settings, "show-only-flathub"));
bz_state_info_set_show_only_verified (self->state, g_settings_get_boolean (self->settings, "show-only-verified"));
bz_state_info_set_show_only_mobile (self->state, g_settings_get_boolean (self->settings, "show-only-mobile"));

gtk_filter_changed (GTK_FILTER (self->group_filter), GTK_FILTER_CHANGE_DIFFERENT);
gtk_filter_changed (GTK_FILTER (self->appid_filter), GTK_FILTER_CHANGE_DIFFERENT);
Expand Down Expand Up @@ -2765,6 +2766,15 @@ init_service_struct (BzApplication *self,
G_CALLBACK (show_hide_app_setting_changed),
self);

bz_state_info_set_show_only_mobile (
self->state,
g_settings_get_boolean (self->settings, "show-only-mobile"));
g_signal_connect_swapped (
self->settings,
"changed::show-only-mobile",
G_CALLBACK (show_hide_app_setting_changed),
self);

self->blocklist_regexes = g_ptr_array_new_with_free_func (
(GDestroyNotify) g_ptr_array_unref);
self->blocklists_provider = bz_content_provider_new ();
Expand Down Expand Up @@ -3119,6 +3129,9 @@ validate_group_for_ui (BzApplication *self,
if (bz_state_info_get_show_only_verified (self->state) &&
!bz_entry_group_get_is_verified (group))
return FALSE;
if (bz_state_info_get_show_only_mobile (self->state) &&
!bz_entry_group_get_is_mobile_friendly (group))
return FALSE;

if (self->malcontent != NULL)
{
Expand Down
1 change: 1 addition & 0 deletions src/bz-apps-page.blp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ template $BzAppsPage: Adw.NavigationPage {

Box content_box {
orientation: vertical;
valign: start;
spacing: 10;
margin-start: 30;
margin-end: 30;
Expand Down
33 changes: 31 additions & 2 deletions src/bz-entry-group.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct _BzEntryGroup
char *dark_accent_color;
gboolean is_flathub;
gboolean is_verified;
gboolean is_mobile_friendly;
char *search_tokens;
char *remote_repos_string;
char *eol;
Expand Down Expand Up @@ -93,6 +94,7 @@ enum
PROP_DARK_ACCENT_COLOR,
PROP_IS_FLATHUB,
PROP_IS_VERIFIED,
PROP_IS_MOBILE_FRIENDLY,
PROP_SEARCH_TOKENS,
PROP_UI_ENTRY,
PROP_REMOTE_REPOS_STRING,
Expand Down Expand Up @@ -209,6 +211,9 @@ bz_entry_group_get_property (GObject *object,
case PROP_IS_VERIFIED:
g_value_set_boolean (value, bz_entry_group_get_is_verified (self));
break;
case PROP_IS_MOBILE_FRIENDLY:
g_value_set_boolean (value, bz_entry_group_get_is_mobile_friendly (self));
break;
case PROP_SEARCH_TOKENS:
g_value_set_boxed (value, bz_entry_group_get_search_tokens (self));
break;
Expand Down Expand Up @@ -280,6 +285,7 @@ bz_entry_group_set_property (GObject *object,
case PROP_DARK_ACCENT_COLOR:
case PROP_IS_FLATHUB:
case PROP_IS_VERIFIED:
case PROP_IS_MOBILE_FRIENDLY:
case PROP_SEARCH_TOKENS:
case PROP_EOL:
case PROP_UI_ENTRY:
Expand Down Expand Up @@ -381,6 +387,12 @@ bz_entry_group_class_init (BzEntryGroupClass *klass)
NULL, NULL, FALSE,
G_PARAM_READABLE);

props[PROP_IS_MOBILE_FRIENDLY] =
g_param_spec_boolean (
"is-mobile-friendly",
NULL, NULL, FALSE,
G_PARAM_READABLE);

props[PROP_SEARCH_TOKENS] =
g_param_spec_string (
"search-tokens",
Expand Down Expand Up @@ -525,6 +537,7 @@ bz_entry_group_new_for_single_entry (BzEntry *entry)
const char *dark_accent_color = NULL;
gboolean is_flathub = FALSE;
gboolean is_verified = FALSE;
gboolean is_mobile_friendly = FALSE;
const char *eol = NULL;
guint64 installed_size = 0;
const char *donation_url = NULL;
Expand All @@ -547,6 +560,7 @@ bz_entry_group_new_for_single_entry (BzEntry *entry)
dark_accent_color = bz_entry_get_dark_accent_color (entry);
is_flathub = bz_entry_get_is_flathub (entry);
is_verified = bz_entry_is_verified (entry);
is_mobile_friendly = bz_entry_get_is_mobile_friendly (entry);
eol = bz_entry_get_eol (entry);
installed_size = bz_entry_get_installed_size (entry);
donation_url = bz_entry_get_donation_url (entry);
Expand All @@ -569,8 +583,9 @@ bz_entry_group_new_for_single_entry (BzEntry *entry)
group->light_accent_color = g_strdup (light_accent_color);
if (dark_accent_color != NULL)
group->dark_accent_color = g_strdup (dark_accent_color);
group->is_flathub = is_flathub;
group->is_verified = is_verified;
group->is_flathub = is_flathub;
group->is_verified = is_verified;
group->is_mobile_friendly = is_mobile_friendly;
if (eol != NULL)
group->eol = g_strdup (eol);
group->installed_size = installed_size;
Expand Down Expand Up @@ -680,6 +695,13 @@ bz_entry_group_get_is_verified (BzEntryGroup *self)
return self->is_verified;
}

gboolean
bz_entry_group_get_is_mobile_friendly (BzEntryGroup *self)
{
g_return_val_if_fail (BZ_IS_ENTRY_GROUP (self), FALSE);
return self->is_mobile_friendly;
}

const char *
bz_entry_group_get_search_tokens (BzEntryGroup *self)
{
Expand Down Expand Up @@ -858,6 +880,7 @@ bz_entry_group_add (BzEntryGroup *self,
const char *dark_accent_color = NULL;
gboolean is_flathub = FALSE;
gboolean is_verified = FALSE;
gboolean is_mobile_friendly = FALSE;
guint64 installed_size = 0;
GListModel *addons = NULL;
int n_addons = 0;
Expand Down Expand Up @@ -907,6 +930,7 @@ bz_entry_group_add (BzEntryGroup *self,
dark_accent_color = bz_entry_get_dark_accent_color (entry);
is_flathub = bz_entry_get_is_flathub (entry);
is_verified = bz_entry_is_verified (entry);
is_mobile_friendly = bz_entry_get_is_mobile_friendly (entry);
installed_size = bz_entry_get_installed_size (entry);
donation_url = bz_entry_get_donation_url (entry);
entry_categories = bz_entry_get_categories (entry);
Expand Down Expand Up @@ -987,6 +1011,11 @@ bz_entry_group_add (BzEntryGroup *self,
self->is_verified = is_verified;
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_IS_VERIFIED]);
}
if (!!is_mobile_friendly != !!self->is_mobile_friendly)
{
self->is_mobile_friendly = is_mobile_friendly;
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_IS_MOBILE_FRIENDLY]);
}
if (installed_size != self->installed_size)
{
self->installed_size = installed_size;
Expand Down
3 changes: 3 additions & 0 deletions src/bz-entry-group.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ bz_entry_group_get_is_flathub (BzEntryGroup *self);
gboolean
bz_entry_group_get_is_verified (BzEntryGroup *self);

gboolean
bz_entry_group_get_is_mobile_friendly (BzEntryGroup *self);

const char *
bz_entry_group_get_search_tokens (BzEntryGroup *self);

Expand Down
7 changes: 6 additions & 1 deletion src/bz-preferences-dialog.blp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ template $BzPreferencesDialog: Adw.PreferencesDialog {
subtitle: _("Hide results that are not verified on Flathub");
}

Adw.SwitchRow only_mobile_switch {
title: _("Mobile Friendly Only");
subtitle: _("Hide applications that are not optimized for mobile devices");
}

Adw.SwitchRow hide_eol_switch {
title: _("Hide EOL Apps");
subtitle: _("Hide apps which are no longer supported by their developers");
Expand Down Expand Up @@ -92,4 +97,4 @@ template $BzPreferencesDialog: Adw.PreferencesDialog {
}
}
}
}
}
59 changes: 34 additions & 25 deletions src/bz-preferences-dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*/

#include "bz-preferences-dialog.h"
#include "bz-template-callbacks.h"
#include <glib/gi18n.h>

typedef struct
Expand All @@ -29,28 +30,28 @@ typedef struct
} BarTheme;

static const BarTheme bar_themes[] = {
{ "accent-color", "accent-color-theme", N_ ("Accent Color") },
{ "pride-rainbow-flag", "pride-rainbow-flag-theme", N_ ("Pride Colors") },
{ "lesbian-pride-flag", "lesbian-pride-flag-theme", N_ ("Lesbian Pride Colors") },
{ "gay-pride-flag", "gay-pride-flag-theme", N_ ("Male Homosexual Pride Colors") },
{ "transgender-flag", "transgender-flag-theme", N_ ("Transgender Pride Colors") },
{ "nonbinary-flag", "nonbinary-flag-theme", N_ ("Nonbinary Pride Colors") },
{ "bisexual-flag", "bisexual-flag-theme", N_ ("Bisexual Pride Colors") },
{ "asexual-flag", "asexual-flag-theme", N_ ("Asexual Pride Colors") },
{ "pansexual-flag", "pansexual-flag-theme", N_ ("Pansexual Pride Colors") },
{ "aromantic-flag", "aromantic-flag-theme", N_ ("Aromantic Pride Colors") },
{ "genderfluid-flag", "genderfluid-flag-theme", N_ ("Genderfluid Pride Colors") },
{ "polysexual-flag", "polysexual-flag-theme", N_ ("Polysexual Pride Colors") },
{ "omnisexual-flag", "omnisexual-flag-theme", N_ ("Omnisexual Pride Colors") },
{ "aroace-flag", "aroace-flag-theme", N_ ("Aroace Pride Colors") },
{ "agender-flag", "agender-flag-theme", N_ ("Agender Pride Colors") },
{ "genderqueer-flag", "genderqueer-flag-theme", N_ ("Genderqueer Pride Colors") },
{ "intersex-flag", "intersex-flag-theme", N_ ("Intersex Pride Colors") },
{ "demigender-flag", "demigender-flag-theme", N_ ("Demigender Pride Colors") },
{ "biromantic-flag", "biromantic-flag-theme", N_ ("Biromantic Pride Colors") },
{ "disability-flag", "disability-flag-theme", N_ ("Disability Pride Colors") },
{ "femboy-flag", "femboy-flag-theme", N_ ("Femboy Pride Colors") },
{ "neutrois-flag", "neutrois-flag-theme", N_ ("Neutrois Pride Colors") },
{ "accent-color", "accent-color-theme", N_ ("Accent Color") },
{ "pride-rainbow-flag", "pride-rainbow-flag-theme", N_ ("Pride Colors") },
{ "lesbian-pride-flag", "lesbian-pride-flag-theme", N_ ("Lesbian Pride Colors") },
{ "gay-pride-flag", "gay-pride-flag-theme", N_ ("Male Homosexual Pride Colors") },
{ "transgender-flag", "transgender-flag-theme", N_ ("Transgender Pride Colors") },
{ "nonbinary-flag", "nonbinary-flag-theme", N_ ("Nonbinary Pride Colors") },
{ "bisexual-flag", "bisexual-flag-theme", N_ ("Bisexual Pride Colors") },
{ "asexual-flag", "asexual-flag-theme", N_ ("Asexual Pride Colors") },
{ "pansexual-flag", "pansexual-flag-theme", N_ ("Pansexual Pride Colors") },
{ "aromantic-flag", "aromantic-flag-theme", N_ ("Aromantic Pride Colors") },
{ "genderfluid-flag", "genderfluid-flag-theme", N_ ("Genderfluid Pride Colors") },
{ "polysexual-flag", "polysexual-flag-theme", N_ ("Polysexual Pride Colors") },
{ "omnisexual-flag", "omnisexual-flag-theme", N_ ("Omnisexual Pride Colors") },
{ "aroace-flag", "aroace-flag-theme", N_ ("Aroace Pride Colors") },
{ "agender-flag", "agender-flag-theme", N_ ("Agender Pride Colors") },
{ "genderqueer-flag", "genderqueer-flag-theme", N_ ("Genderqueer Pride Colors") },
{ "intersex-flag", "intersex-flag-theme", N_ ("Intersex Pride Colors") },
{ "demigender-flag", "demigender-flag-theme", N_ ("Demigender Pride Colors") },
{ "biromantic-flag", "biromantic-flag-theme", N_ ("Biromantic Pride Colors") },
{ "disability-flag", "disability-flag-theme", N_ ("Disability Pride Colors") },
{ "femboy-flag", "femboy-flag-theme", N_ ("Femboy Pride Colors") },
{ "neutrois-flag", "neutrois-flag-theme", N_ ("Neutrois Pride Colors") },
};

struct _BzPreferencesDialog
Expand All @@ -64,6 +65,7 @@ struct _BzPreferencesDialog
AdwSwitchRow *only_foss_switch;
AdwSwitchRow *only_flathub_switch;
AdwSwitchRow *only_verified_switch;
AdwSwitchRow *only_mobile_switch;
AdwSwitchRow *search_debounce_switch;
GtkFlowBox *flag_buttons_box;
AdwSwitchRow *hide_eol_switch;
Expand Down Expand Up @@ -139,7 +141,7 @@ on_rotate_switch_changed (AdwSwitchRow *row,
BzPreferencesDialog *self)
{
gboolean active = FALSE;
active = adw_switch_row_get_active (row);
active = adw_switch_row_get_active (row);
for (guint i = 0; i < G_N_ELEMENTS (bar_themes); i++)
{
if (active)
Expand Down Expand Up @@ -205,6 +207,10 @@ bind_settings (BzPreferencesDialog *self)
self->only_verified_switch, "active",
G_SETTINGS_BIND_DEFAULT);

g_settings_bind (self->settings, "show-only-mobile",
self->only_mobile_switch, "active",
G_SETTINGS_BIND_DEFAULT);

g_settings_bind (self->settings, "search-debounce",
self->search_debounce_switch, "active",
G_SETTINGS_BIND_DEFAULT);
Expand All @@ -214,8 +220,8 @@ bind_settings (BzPreferencesDialog *self)
G_SETTINGS_BIND_DEFAULT);

g_settings_bind (self->settings, "rotate-flag",
self->rotate_switch, "active",
G_SETTINGS_BIND_DEFAULT);
self->rotate_switch, "active",
G_SETTINGS_BIND_DEFAULT);

if (adw_switch_row_get_active (self->rotate_switch))
{
Expand Down Expand Up @@ -293,9 +299,12 @@ 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);
gtk_widget_class_bind_template_child (widget_class, BzPreferencesDialog, only_mobile_switch);
gtk_widget_class_bind_template_child (widget_class, BzPreferencesDialog, search_debounce_switch);
gtk_widget_class_bind_template_child (widget_class, BzPreferencesDialog, flag_buttons_box);
gtk_widget_class_bind_template_child (widget_class, BzPreferencesDialog, hide_eol_switch);
Expand Down
1 change: 1 addition & 0 deletions src/bz-state-info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ property=settings GSettings G_TYPE_SETTINGS object
property=show_only_flathub gboolean G_TYPE_BOOLEAN boolean
property=show_only_foss gboolean G_TYPE_BOOLEAN boolean
property=show_only_verified gboolean G_TYPE_BOOLEAN boolean
property=show_only_mobile gboolean G_TYPE_BOOLEAN boolean
property=syncing gboolean G_TYPE_BOOLEAN boolean
property=system_icon_theme GtkIconTheme GTK_TYPE_ICON_THEME object
property=transaction_manager BzTransactionManager BZ_TYPE_TRANSACTION_MANAGER object
Expand Down