From 3929bc917f5cfae28fce1b4e4b2007c16478ccbb Mon Sep 17 00:00:00 2001 From: Adrien Plazas Date: Tue, 18 Jan 2022 14:12:30 +0100 Subject: [PATCH 1/4] app-grid-button: Have a single title line This matches the design of Shell and iOS. --- src/ui/app-grid-button.ui | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ui/app-grid-button.ui b/src/ui/app-grid-button.ui index 2fa1ef88e..f6e7b33a7 100644 --- a/src/ui/app-grid-button.ui +++ b/src/ui/app-grid-button.ui @@ -51,7 +51,6 @@ word-char end 10 - 2 False -- GitLab From 3de88f1d8189d05a9ba96d545906a1abe9a6a04e Mon Sep 17 00:00:00 2001 From: Adrien Plazas Date: Tue, 18 Jan 2022 11:24:10 +0100 Subject: [PATCH 2/4] app-grid-button: Show the lack of phone support with an icon This adds a "desktop" icon next to the title of non-adaptive apps. --- data/desktop-thin-small-symbolic.svg | 4 + src/app-grid-button.c | 139 ++++++++++++++++++++++++++- src/app-grid-button.h | 21 ++-- src/phosh.gresources.xml | 1 + src/ui/app-grid-button.ui | 32 ++++-- 5 files changed, 177 insertions(+), 20 deletions(-) create mode 100644 data/desktop-thin-small-symbolic.svg diff --git a/data/desktop-thin-small-symbolic.svg b/data/desktop-thin-small-symbolic.svg new file mode 100644 index 000000000..46111bd10 --- /dev/null +++ b/data/desktop-thin-small-symbolic.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/app-grid-button.c b/src/app-grid-button.c index 5056840c2..ccc15c730 100644 --- a/src/app-grid-button.c +++ b/src/app-grid-button.c @@ -6,8 +6,12 @@ #define G_LOG_DOMAIN "phosh-app-grid-button" +#define _GNU_SOURCE +#include + #include "config.h" #include "app-tracker.h" +#include "app-grid.h" #include "app-grid-button.h" #include "phosh-enums.h" #include "favorite-list-model.h" @@ -20,18 +24,22 @@ struct _PhoshAppGridButtonPrivate { GAppInfo *info; gboolean is_favorite; PhoshAppGridButtonMode mode; + gboolean desktop_mode; gulong favorite_changed_watcher; + GtkWidget *form_factor_desktop; GtkWidget *icon; GtkWidget *label; GtkWidget *popover; + GtkWidget *title_box; GtkGesture *gesture; GMenu *menu; GMenu *actions; GActionMap *action_map; + GSettings *settings; }; G_DEFINE_TYPE_WITH_PRIVATE (PhoshAppGridButton, phosh_app_grid_button, GTK_TYPE_FLOW_BOX_CHILD) @@ -41,6 +49,7 @@ enum { PROP_APP_INFO, PROP_IS_FAVORITE, PROP_MODE, + PROP_DESKTOP_MODE, LAST_PROP }; static GParamSpec *props[LAST_PROP]; @@ -51,6 +60,64 @@ enum { }; static guint signals[N_SIGNALS]; + +static gboolean +supports_mobile (PhoshAppGridButton *self) +{ + PhoshAppGridButtonPrivate *priv; + PhoshAppFilterModeFlags filter_mode; + + priv = phosh_app_grid_button_get_instance_private (self); + + filter_mode = g_settings_get_flags (priv->settings, "app-filter-mode"); + if (!(filter_mode & PHOSH_APP_FILTER_MODE_FLAGS_ADAPTIVE)) + return TRUE; + + if (G_IS_DESKTOP_APP_INFO (priv->info)) { + g_autofree char *mobile_purism = NULL; + g_autofree char *mobile_kde = NULL; + + mobile_purism = g_desktop_app_info_get_string (G_DESKTOP_APP_INFO (priv->info), + "X-Purism-FormFactor"); + if (mobile_purism && strcasestr (mobile_purism, "mobile;")) + return TRUE; + + mobile_kde = g_desktop_app_info_get_string (G_DESKTOP_APP_INFO (priv->info), + "X-KDE-FormFactor"); + if (mobile_kde && strcasestr (mobile_kde, "handset;")) + return TRUE; + } + + if (G_IS_APP_INFO (priv->info)) { + g_auto(GStrv) force_mobile = NULL; + const char *id; + + force_mobile = g_settings_get_strv (priv->settings, "force-adaptive"); + id = g_app_info_get_id (priv->info); + if (id && g_strv_contains ((const char * const *) force_mobile, id)) + return TRUE; + } + + return FALSE; +} + + +static void +update_form_factor (PhoshAppGridButton *self) +{ + PhoshAppGridButtonPrivate *priv; + gboolean desktop_only; + + priv = phosh_app_grid_button_get_instance_private (self); + + desktop_only = !priv->desktop_mode && !supports_mobile (self); + + gtk_widget_set_visible (priv->form_factor_desktop, desktop_only); + /* We need to make space for the icon. */ + gtk_label_set_max_width_chars (GTK_LABEL (priv->label), desktop_only ? 9 : 10); +} + + static void phosh_app_grid_button_set_property (GObject *object, guint property_id, @@ -66,6 +133,9 @@ phosh_app_grid_button_set_property (GObject *object, case PROP_MODE: phosh_app_grid_button_set_mode (self, g_value_get_enum (value)); break; + case PROP_DESKTOP_MODE: + phosh_app_grid_button_set_desktop_mode (self, g_value_get_boolean (value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -91,6 +161,9 @@ phosh_app_grid_button_get_property (GObject *object, case PROP_MODE: g_value_set_enum (value, phosh_app_grid_button_get_mode (self)); break; + case PROP_DESKTOP_MODE: + g_value_set_boolean (value, phosh_app_grid_button_get_desktop_mode (self)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -105,6 +178,7 @@ phosh_app_grid_button_dispose (GObject *object) PhoshAppGridButtonPrivate *priv = phosh_app_grid_button_get_instance_private (self); g_clear_object (&priv->gesture); + g_clear_object (&priv->settings); G_OBJECT_CLASS (phosh_app_grid_button_parent_class)->dispose (object); } @@ -227,14 +301,30 @@ phosh_app_grid_button_class_init (PhoshAppGridButtonClass *klass) G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY); + /** + * PhoshAppGridButton:desktop-mode: + * + * Whether to set the button for desktop shells. + * + * Stability: Private + */ + props[PROP_DESKTOP_MODE] = + g_param_spec_boolean ("desktop-mode", "Desktop mode", "Whether to set the button for desktop shells", + FALSE, + G_PARAM_STATIC_STRINGS | + G_PARAM_READWRITE | + G_PARAM_EXPLICIT_NOTIFY); + g_object_class_install_properties (object_class, LAST_PROP, props); gtk_widget_class_set_template_from_resource (widget_class, "/sm/puri/phosh/ui/app-grid-button.ui"); + gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGridButton, form_factor_desktop); gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGridButton, icon); gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGridButton, label); gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGridButton, popover); + gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGridButton, title_box); gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGridButton, menu); gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGridButton, actions); @@ -356,6 +446,15 @@ phosh_app_grid_button_init (PhoshAppGridButton *self) gtk_popover_bind_model (GTK_POPOVER (priv->popover), G_MENU_MODEL (priv->menu), "app-btn"); + + priv->settings = g_settings_new ("sm.puri.phosh"); + g_object_connect (priv->settings, + "swapped-signal::changed::force-adaptive", + G_CALLBACK (update_form_factor), self, + "swapped-signal::changed::app-filter-mode", + G_CALLBACK (update_form_factor), self, + NULL); + update_form_factor (self); } @@ -508,6 +607,8 @@ phosh_app_grid_button_set_app_info (PhoshAppGridButton *self, gtk_widget_set_sensitive (GTK_WIDGET (self), FALSE); } + update_form_factor (self); + g_object_notify_by_pspec (G_OBJECT (self), props[PROP_APP_INFO]); } @@ -551,10 +652,10 @@ phosh_app_grid_button_set_mode (PhoshAppGridButton *self, switch (mode) { case PHOSH_APP_GRID_BUTTON_LAUNCHER: - gtk_widget_set_visible (priv->label, TRUE); + gtk_widget_set_visible (priv->title_box, TRUE); break; case PHOSH_APP_GRID_BUTTON_FAVORITES: - gtk_widget_set_visible (priv->label, FALSE); + gtk_widget_set_visible (priv->title_box, FALSE); break; default: g_critical ("Invalid mode %i", mode); @@ -577,3 +678,37 @@ phosh_app_grid_button_get_mode (PhoshAppGridButton *self) return priv->mode; } + + +void +phosh_app_grid_button_set_desktop_mode (PhoshAppGridButton *self, + gboolean desktop_mode) +{ + PhoshAppGridButtonPrivate *priv; + + g_return_if_fail (PHOSH_IS_APP_GRID_BUTTON (self)); + priv = phosh_app_grid_button_get_instance_private (self); + + desktop_mode = !!desktop_mode; + + if (priv->desktop_mode == desktop_mode) + return; + + priv->desktop_mode = desktop_mode; + + update_form_factor (self); + + g_object_notify_by_pspec (G_OBJECT (self), props[PROP_DESKTOP_MODE]); +} + + +gboolean +phosh_app_grid_button_get_desktop_mode (PhoshAppGridButton *self) +{ + PhoshAppGridButtonPrivate *priv; + + g_return_val_if_fail (PHOSH_IS_APP_GRID_BUTTON (self), FALSE); + priv = phosh_app_grid_button_get_instance_private (self); + + return priv->desktop_mode; +} diff --git a/src/app-grid-button.h b/src/app-grid-button.h index 3e409f75c..1f7d834a3 100644 --- a/src/app-grid-button.h +++ b/src/app-grid-button.h @@ -42,14 +42,17 @@ struct _PhoshAppGridButtonClass GtkFlowBoxChildClass parent_class; }; -GtkWidget *phosh_app_grid_button_new (GAppInfo *info); -GtkWidget *phosh_app_grid_button_new_favorite (GAppInfo *info); -void phosh_app_grid_button_set_app_info (PhoshAppGridButton *self, - GAppInfo *info); -GAppInfo *phosh_app_grid_button_get_app_info (PhoshAppGridButton *self); -gboolean phosh_app_grid_button_is_favorite (PhoshAppGridButton *self); -void phosh_app_grid_button_set_mode (PhoshAppGridButton *self, - PhoshAppGridButtonMode mode); -PhoshAppGridButtonMode phosh_app_grid_button_get_mode (PhoshAppGridButton *self); +GtkWidget *phosh_app_grid_button_new (GAppInfo *info); +GtkWidget *phosh_app_grid_button_new_favorite (GAppInfo *info); +void phosh_app_grid_button_set_app_info (PhoshAppGridButton *self, + GAppInfo *info); +GAppInfo *phosh_app_grid_button_get_app_info (PhoshAppGridButton *self); +gboolean phosh_app_grid_button_is_favorite (PhoshAppGridButton *self); +void phosh_app_grid_button_set_mode (PhoshAppGridButton *self, + PhoshAppGridButtonMode mode); +PhoshAppGridButtonMode phosh_app_grid_button_get_mode (PhoshAppGridButton *self); +void phosh_app_grid_button_set_desktop_mode (PhoshAppGridButton *self, + gboolean desktop_mode); +gboolean phosh_app_grid_button_get_desktop_mode (PhoshAppGridButton *self); G_END_DECLS diff --git a/src/phosh.gresources.xml b/src/phosh.gresources.xml index c95528683..fb507972e 100644 --- a/src/phosh.gresources.xml +++ b/src/phosh.gresources.xml @@ -37,6 +37,7 @@ ../data/auth-sim-locked-symbolic.svg ../data/auth-sim-missing-symbolic.svg ../data/camera-hardware-disabled-symbolic.svg + ../data/desktop-thin-small-symbolic.svg ../data/eye-not-looking-symbolic.svg ../data/eye-open-negative-filled-symbolic.svg ../data/feedback-quiet-symbolic.svg diff --git a/src/ui/app-grid-button.ui b/src/ui/app-grid-button.ui index f6e7b33a7..315fd391d 100644 --- a/src/ui/app-grid-button.ui +++ b/src/ui/app-grid-button.ui @@ -41,16 +41,30 @@ - + + center + True + 4 True - False - True - App - center - True - word-char - end - 10 + + + desktop-thin-small-symbolic + 8 + True + + + + + end + left + App + 9 + True + word-char + True + 0 + + False -- GitLab From 9bb3b019f5098037cc47f5afcb5077407bcf0c03 Mon Sep 17 00:00:00 2001 From: Adrien Plazas Date: Tue, 18 Jan 2022 15:07:10 +0100 Subject: [PATCH 3/4] app-grid: Don't filter applications out We want to show them all and warn of incompatibilities instead. --- src/app-grid.c | 111 +++----------------------------------- src/stylesheet/common.css | 14 ----- src/ui/app-grid.ui | 47 +--------------- 3 files changed, 9 insertions(+), 163 deletions(-) diff --git a/src/app-grid.c b/src/app-grid.c index 276f08485..5b63d0f8c 100644 --- a/src/app-grid.c +++ b/src/app-grid.c @@ -46,14 +46,9 @@ struct _PhoshAppGridPrivate { GtkWidget *favs; GtkWidget *favs_revealer; GtkWidget *scrolled_window; - GtkWidget *btn_adaptive; - GtkWidget *btn_adaptive_img; - GtkWidget *btn_adaptive_lbl; char *search_string; gboolean filter_adaptive; - GSettings *settings; - GStrv force_adaptive; GSimpleActionGroup *actions; PhoshAppFilterModeFlags filter_mode; guint debounce; @@ -126,83 +121,6 @@ sort_apps (gconstpointer a, } -static void -update_filter_adaptive_button (PhoshAppGrid *self) -{ - PhoshAppGridPrivate *priv; - const char *label, *icon_name; - - priv = phosh_app_grid_get_instance_private (self); - if (priv->filter_adaptive) { - label = _("Show All Apps"); - icon_name = "eye-open-negative-filled-symbolic"; - } else { - label = _("Show Only Mobile Friendly Apps"); - icon_name = "eye-not-looking-symbolic"; - } - - gtk_label_set_label (GTK_LABEL (priv->btn_adaptive_lbl), label); - gtk_image_set_from_icon_name (GTK_IMAGE (priv->btn_adaptive_img), icon_name, GTK_ICON_SIZE_BUTTON); -} - - -static void -on_filter_setting_changed (PhoshAppGrid *self, - GParamSpec *pspec, - gpointer *unused) -{ - PhoshAppGridPrivate *priv; - gboolean show; - - g_return_if_fail (PHOSH_IS_APP_GRID (self)); - - priv = phosh_app_grid_get_instance_private (self); - - g_strfreev (priv->force_adaptive); - priv->force_adaptive = g_settings_get_strv (priv->settings, - "force-adaptive"); - priv->filter_mode = g_settings_get_flags (priv->settings, - "app-filter-mode"); - - show = !!(priv->filter_mode & PHOSH_APP_FILTER_MODE_FLAGS_ADAPTIVE); - gtk_widget_set_visible (priv->btn_adaptive, show); - - gtk_filter_list_model_refilter (priv->model); -} - - -static gboolean -filter_adaptive (PhoshAppGrid *self, GDesktopAppInfo *info) -{ - PhoshAppGridPrivate *priv = phosh_app_grid_get_instance_private (self); - g_autofree char *mobile = NULL; - const char *id; - - if (!(priv->filter_mode & PHOSH_APP_FILTER_MODE_FLAGS_ADAPTIVE)) - return TRUE; - - if (!priv->filter_adaptive) - return TRUE; - - mobile = g_desktop_app_info_get_string (G_DESKTOP_APP_INFO (info), - "X-Purism-FormFactor"); - if (mobile && strcasestr (mobile, "mobile;")) - return TRUE; - - g_free (mobile); - mobile = g_desktop_app_info_get_string (G_DESKTOP_APP_INFO (info), - "X-KDE-FormFactor"); - if (mobile && strcasestr (mobile, "handset;")) - return TRUE; - - id = g_app_info_get_id (G_APP_INFO (info)); - if (id && g_strv_contains ((const char * const*)priv->force_adaptive, id)) - return TRUE; - - return FALSE; -} - - static const char *(*app_attr[]) (GAppInfo *info) = { g_app_info_get_display_name, g_app_info_get_name, @@ -231,11 +149,6 @@ search_apps (gpointer item, gpointer data) search = priv->search_string; - if (G_IS_DESKTOP_APP_INFO (info)) { - if (!filter_adaptive (self, G_DESKTOP_APP_INFO (info))) - return FALSE; - } - /* filter out favorites when not searching */ if (search == NULL || strlen (search) == 0) { if (phosh_favorite_list_model_app_is_favorite (NULL, info)) @@ -299,6 +212,10 @@ create_favorite_launcher (gpointer item, { GtkWidget *btn = phosh_app_grid_button_new_favorite (G_APP_INFO (item)); + g_object_bind_property (self, "filter-adaptive", + btn, "desktop-mode", + G_BINDING_SYNC_CREATE); + g_signal_connect (btn, "app-launched", G_CALLBACK (app_launched_cb), self); @@ -328,6 +245,10 @@ create_launcher (gpointer item, { GtkWidget *btn = phosh_app_grid_button_new (G_APP_INFO (item)); + g_object_bind_property (self, "filter-adaptive", + btn, "desktop-mode", + G_BINDING_SYNC_CREATE); + g_signal_connect (btn, "app-launched", G_CALLBACK (app_launched_cb), self); @@ -371,15 +292,6 @@ phosh_app_grid_init (PhoshAppGrid *self) G_LIST_MODEL (priv->model), create_launcher, self, NULL); - priv->settings = g_settings_new ("sm.puri.phosh"); - g_object_connect (priv->settings, - "swapped-signal::changed::force-adaptive", - G_CALLBACK (on_filter_setting_changed), self, - "swapped-signal::changed::app-filter-mode", - G_CALLBACK (on_filter_setting_changed), self, - NULL); - on_filter_setting_changed (self, NULL, NULL); - priv->actions = g_simple_action_group_new (); gtk_widget_insert_action_group (GTK_WIDGET (self), "app-grid", G_ACTION_GROUP (priv->actions)); @@ -396,7 +308,6 @@ phosh_app_grid_dispose (GObject *object) g_clear_object (&priv->actions); g_clear_object (&priv->model); - g_clear_object (&priv->settings); g_clear_handle_id (&priv->debounce, g_source_remove); G_OBJECT_CLASS (phosh_app_grid_parent_class)->dispose (object); @@ -410,7 +321,6 @@ phosh_app_grid_finalize (GObject *object) PhoshAppGridPrivate *priv = phosh_app_grid_get_instance_private (self); g_clear_pointer (&priv->search_string, g_free); - g_strfreev (priv->force_adaptive); G_OBJECT_CLASS (phosh_app_grid_parent_class)->finalize (object); } @@ -589,9 +499,6 @@ phosh_app_grid_class_init (PhoshAppGridClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/sm/puri/phosh/ui/app-grid.ui"); gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGrid, apps); - gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGrid, btn_adaptive); - gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGrid, btn_adaptive_img); - gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGrid, btn_adaptive_lbl); gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGrid, favs); gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGrid, favs_revealer); gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGrid, scrolled_window); @@ -679,8 +586,6 @@ phosh_app_grid_set_filter_adaptive (PhoshAppGrid *self, gboolean enable) return; priv->filter_adaptive = enable; - update_filter_adaptive_button (self); - gtk_filter_list_model_refilter (priv->model); g_object_notify_by_pspec (G_OBJECT (self), props[PROP_FILTER_ADAPTIVE]); } diff --git a/src/stylesheet/common.css b/src/stylesheet/common.css index faee8a5fe..0e8b838ba 100644 --- a/src/stylesheet/common.css +++ b/src/stylesheet/common.css @@ -184,20 +184,6 @@ phosh-app-grid-button image { /* -gtk-icon-shadow: 0 1px 2px rgba(0,0,0,0.4), 0 1px 8px rgba(0,0,0,0.2); */ } -#phosh-filter-adaptive-btn, -#phosh-filter-adaptive-btn:hover, -#phosh-filter-adaptive-btn.toggle { - border-radius: 9999px; - padding-top: 6px; - padding-left: 24px; - padding-right: 24px; - margin-top: 24px; - margin-bottom: 24px; - background-image: none; - background: @phosh_button_bg_color; - outline-style: none; -} - /* * Lock screen diff --git a/src/ui/app-grid.ui b/src/ui/app-grid.ui index 28490394a..540306602 100644 --- a/src/ui/app-grid.ui +++ b/src/ui/app-grid.ui @@ -103,7 +103,7 @@ 12 3 3 - 3 + 24 True False start @@ -118,51 +118,6 @@ 2 - - - True - horizontal - start - - - True - True - start - center - app-grid.filter-adaptive - phosh-filter-adaptive-btn - - - True - horizontal - 6 - - - True - eye-not-looking-symbolic - - - - - True - middle - - - - - - - False - False - - - - - False - True - 3 - - -- GitLab From 7e4dc586735e4eb7144f9ed561118dfd0b280d37 Mon Sep 17 00:00:00 2001 From: Adrien Plazas Date: Tue, 18 Jan 2022 15:16:36 +0100 Subject: [PATCH 4/4] app-grid: Rename filter-adaptive into desktop-mode This isn't about filtering apps out anymore. --- src/app-grid.c | 36 +++++++++++++++++++----------------- src/app-grid.h | 2 +- src/shell.c | 4 ++-- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/app-grid.c b/src/app-grid.c index 5b63d0f8c..3e5d3abda 100644 --- a/src/app-grid.c +++ b/src/app-grid.c @@ -26,7 +26,7 @@ enum { PROP_0, - PROP_FILTER_ADAPTIVE, + PROP_DESKTOP_MODE, PROP_LAST_PROP }; static GParamSpec *props[PROP_LAST_PROP]; @@ -48,7 +48,7 @@ struct _PhoshAppGridPrivate { GtkWidget *scrolled_window; char *search_string; - gboolean filter_adaptive; + gboolean desktop_mode; GSimpleActionGroup *actions; PhoshAppFilterModeFlags filter_mode; guint debounce; @@ -65,8 +65,8 @@ phosh_app_grid_set_property (GObject *object, PhoshAppGrid *self = PHOSH_APP_GRID (object); switch (property_id) { - case PROP_FILTER_ADAPTIVE: - phosh_app_grid_set_filter_adaptive (self, g_value_get_boolean (value)); + case PROP_DESKTOP_MODE: + phosh_app_grid_set_desktop_mode (self, g_value_get_boolean (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -85,8 +85,8 @@ phosh_app_grid_get_property (GObject *object, PhoshAppGridPrivate *priv = phosh_app_grid_get_instance_private (self); switch (property_id) { - case PROP_FILTER_ADAPTIVE: - g_value_set_boolean (value, priv->filter_adaptive); + case PROP_DESKTOP_MODE: + g_value_set_boolean (value, priv->desktop_mode); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -212,7 +212,7 @@ create_favorite_launcher (gpointer item, { GtkWidget *btn = phosh_app_grid_button_new_favorite (G_APP_INFO (item)); - g_object_bind_property (self, "filter-adaptive", + g_object_bind_property (self, "desktop-mode", btn, "desktop-mode", G_BINDING_SYNC_CREATE); @@ -245,7 +245,7 @@ create_launcher (gpointer item, { GtkWidget *btn = phosh_app_grid_button_new (G_APP_INFO (item)); - g_object_bind_property (self, "filter-adaptive", + g_object_bind_property (self, "desktop-mode", btn, "desktop-mode", G_BINDING_SYNC_CREATE); @@ -295,7 +295,7 @@ phosh_app_grid_init (PhoshAppGrid *self) priv->actions = g_simple_action_group_new (); gtk_widget_insert_action_group (GTK_WIDGET (self), "app-grid", G_ACTION_GROUP (priv->actions)); - action = (GAction*) g_property_action_new ("filter-adaptive", self, "filter-adaptive"); + action = (GAction*) g_property_action_new ("desktop-mode", self, "desktop-mode"); g_action_map_add_action (G_ACTION_MAP (priv->actions), action); } @@ -483,12 +483,12 @@ phosh_app_grid_class_init (PhoshAppGridClass *klass) widget_class->key_press_event = phosh_app_grid_key_press_event; /** - * PhoshAppGrid:filter-adaptive: + * PhoshAppGrid:desktop-mode: * * Whether only adaptive apps should be shown */ - props[PROP_FILTER_ADAPTIVE] = - g_param_spec_boolean ("filter-adaptive", + props[PROP_DESKTOP_MODE] = + g_param_spec_boolean ("desktop-mode", "", "", FALSE, @@ -573,19 +573,21 @@ phosh_app_grid_handle_search (PhoshAppGrid *self, GdkEvent *event) void -phosh_app_grid_set_filter_adaptive (PhoshAppGrid *self, gboolean enable) +phosh_app_grid_set_desktop_mode (PhoshAppGrid *self, gboolean desktop_mode) { PhoshAppGridPrivate *priv; - g_debug ("Filter-adaptive: %d", enable); + g_debug ("desktop-mode: %d", desktop_mode); g_return_if_fail (PHOSH_IS_APP_GRID (self)); priv = phosh_app_grid_get_instance_private (self); - if (priv->filter_adaptive == enable) + desktop_mode = !!desktop_mode; + + if (priv->desktop_mode == desktop_mode) return; - priv->filter_adaptive = enable; + priv->desktop_mode = desktop_mode; - g_object_notify_by_pspec (G_OBJECT (self), props[PROP_FILTER_ADAPTIVE]); + g_object_notify_by_pspec (G_OBJECT (self), props[PROP_DESKTOP_MODE]); } diff --git a/src/app-grid.h b/src/app-grid.h index 3be16e69f..cb951ad48 100644 --- a/src/app-grid.h +++ b/src/app-grid.h @@ -38,7 +38,7 @@ GtkWidget *phosh_app_grid_new (void); void phosh_app_grid_reset (PhoshAppGrid *self); void phosh_app_grid_focus_search (PhoshAppGrid *self); gboolean phosh_app_grid_handle_search (PhoshAppGrid *self, GdkEvent *event); -void phosh_app_grid_set_filter_adaptive (PhoshAppGrid *self, gboolean enable); +void phosh_app_grid_set_desktop_mode (PhoshAppGrid *self, gboolean desktop_mode); G_END_DECLS diff --git a/src/shell.c b/src/shell.c index 57e631032..fb74f907f 100644 --- a/src/shell.c +++ b/src/shell.c @@ -244,8 +244,8 @@ panels_create (PhoshShell *self) g_object_bind_property (priv->docked_manager, "enabled", app_grid, - "filter-adaptive", - G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN); + "desktop-mode", + G_BINDING_SYNC_CREATE); } -- GitLab