[libadwaita/wip/exalm/leaflet-shortcuts: 2/6] preferences-window: can-swipe-back -> can-navigate-back
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/wip/exalm/leaflet-shortcuts: 2/6] preferences-window: can-swipe-back -> can-navigate-back
- Date: Fri, 12 Nov 2021 12:15:20 +0000 (UTC)
commit 5827046fce2c69c11dd02f3de6b0b22ee281f6de
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Fri Nov 12 14:48:00 2021 +0500
preferences-window: can-swipe-back -> can-navigate-back
Same as in leaflet.
demo/adw-demo-preferences-window.ui | 2 +-
doc/migrating-between-development-versions.md | 7 ++++
doc/migrating-libhandy-1-4-to-libadwaita.md | 7 ++++
src/adw-preferences-window.c | 58 ++++++++++++++-------------
src/adw-preferences-window.h | 6 +--
src/adw-preferences-window.ui | 2 +-
6 files changed, 50 insertions(+), 32 deletions(-)
---
diff --git a/demo/adw-demo-preferences-window.ui b/demo/adw-demo-preferences-window.ui
index a270fe0d..d0351288 100644
--- a/demo/adw-demo-preferences-window.ui
+++ b/demo/adw-demo-preferences-window.ui
@@ -3,7 +3,7 @@
<requires lib="gtk" version="4.0"/>
<requires lib="libadwaita" version="1.0"/>
<template class="AdwDemoPreferencesWindow" parent="AdwPreferencesWindow">
- <property name="can-swipe-back">True</property>
+ <property name="can-navigate-back">True</property>
<child>
<object class="AdwPreferencesPage">
<property name="icon_name">preferences-window-layout-symbolic</property>
diff --git a/doc/migrating-between-development-versions.md b/doc/migrating-between-development-versions.md
index 0634ad77..7f683251 100644
--- a/doc/migrating-between-development-versions.md
+++ b/doc/migrating-between-development-versions.md
@@ -287,3 +287,10 @@ propagation.
The `can-swipe-back` and `can-swipe-forward` properties have been renamed to
[property@AdwLeaflet:can-navigate-back] and
[property@AdwLeaflet:can-navigate-forward], along with their accessors.
+
+### Adapt to [class@Adw.PreferencesWindow] API changes
+
+The `can-swipe-back` and `can-swipe-forward` properties have been renamed to
+[property@AdwPreferencesWindow:can-navigate-back] and
+[property@AdwPreferencesWindow:can-navigate-forward], along with their
+accessors.
diff --git a/doc/migrating-libhandy-1-4-to-libadwaita.md b/doc/migrating-libhandy-1-4-to-libadwaita.md
index e8c8655e..00b7879e 100644
--- a/doc/migrating-libhandy-1-4-to-libadwaita.md
+++ b/doc/migrating-libhandy-1-4-to-libadwaita.md
@@ -344,6 +344,13 @@ If some of these shortcuts conflict with another widget, the latter has
priority, and it should work automatically if the widget correctly stops event
propagation.
+### Adapt to [class@Adw.PreferencesWindow] API changes
+
+The `can-swipe-back` and `can-swipe-forward` properties have been renamed to
+[property@AdwPreferencesWindow:can-navigate-back] and
+[property@AdwPreferencesWindow:can-navigate-forward], along with their
+accessors.
+
### Adapt to Stylesheet Changes
Most widgets don't have a backdrop state anymore, and the following public
diff --git a/src/adw-preferences-window.c b/src/adw-preferences-window.c
index 01476077..a8ea5997 100644
--- a/src/adw-preferences-window.c
+++ b/src/adw-preferences-window.c
@@ -52,7 +52,7 @@ typedef struct
AdwViewSwitcherTitle *view_switcher_title;
gboolean search_enabled;
- gboolean can_swipe_back;
+ gboolean can_navigate_back;
GtkFilter *filter;
GtkFilterListModel *filter_model;
@@ -74,7 +74,7 @@ enum {
PROP_VISIBLE_PAGE,
PROP_VISIBLE_PAGE_NAME,
PROP_SEARCH_ENABLED,
- PROP_CAN_SWIPE_BACK,
+ PROP_CAN_NAVIGATE_BACK,
LAST_PROP,
};
@@ -423,8 +423,8 @@ adw_preferences_window_get_property (GObject *object,
case PROP_SEARCH_ENABLED:
g_value_set_boolean (value, adw_preferences_window_get_search_enabled (self));
break;
- case PROP_CAN_SWIPE_BACK:
- g_value_set_boolean (value, adw_preferences_window_get_can_swipe_back (self));
+ case PROP_CAN_NAVIGATE_BACK:
+ g_value_set_boolean (value, adw_preferences_window_get_can_navigate_back (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -449,8 +449,8 @@ adw_preferences_window_set_property (GObject *object,
case PROP_SEARCH_ENABLED:
adw_preferences_window_set_search_enabled (self, g_value_get_boolean (value));
break;
- case PROP_CAN_SWIPE_BACK:
- adw_preferences_window_set_can_swipe_back (self, g_value_get_boolean (value));
+ case PROP_CAN_NAVIGATE_BACK:
+ adw_preferences_window_set_can_navigate_back (self, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -493,7 +493,7 @@ close_cb (GtkWidget *widget,
AdwPreferencesWindowPrivate *priv = adw_preferences_window_get_instance_private (self);
if (priv->subpage) {
- if (!adw_preferences_window_get_can_swipe_back (self))
+ if (!adw_preferences_window_get_can_navigate_back (self))
return GDK_EVENT_PROPAGATE;
adw_preferences_window_close_subpage (self);
@@ -561,16 +561,20 @@ adw_preferences_window_class_init (AdwPreferencesWindowClass *klass)
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
/**
- * AdwPreferencesWindow:can-swipe-back: (attributes
org.gtk.Property.get=adw_preferences_window_get_can_swipe_back
org.gtk.Property.set=adw_preferences_window_set_can_swipe_back)
+ * AdwPreferencesWindow:can-navigate-back: (attributes
org.gtk.Property.get=adw_preferences_window_get_can_navigate_back
org.gtk.Property.set=adw_preferences_window_set_can_navigate_back)
*
- * Whether or not the window allows closing subpages via a swipe gesture.
+ * Whether gestures and shortcuts for closing subpages are enabled.
+ *
+ * The supported gestures are:
+ * - One-finger swipe on touchscreens
+ * - Horizontal scrolling on touchpads (usually two-finger swipe)
*
* Since: 1.0
*/
- props[PROP_CAN_SWIPE_BACK] =
- g_param_spec_boolean ("can-swipe-back",
- "Can swipe back",
- "Whether or not the window allows closing subpages via a swipe gesture",
+ props[PROP_CAN_NAVIGATE_BACK] =
+ g_param_spec_boolean ("can-navigate-back",
+ "Can navigate back",
+ "Whether gestures and shortcuts for closing subpages are enabled",
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
@@ -736,17 +740,17 @@ adw_preferences_window_set_search_enabled (AdwPreferencesWindow *self,
}
/**
- * adw_preferences_window_set_can_swipe_back: (attributes org.gtk.Method.set_property=can-swipe-back)
+ * adw_preferences_window_set_can_navigate_back: (attributes org.gtk.Method.set_property=can-navigate-back)
* @self: a `AdwPreferencesWindow`
- * @can_swipe_back: the new value
+ * @can_navigate_back: the new value
*
- * Sets whether or not @self allows closing subpages via a swipe gesture.
+ * Sets whether gestures and shortcuts for closing subpages are enabled.
*
* Since: 1.0
*/
void
-adw_preferences_window_set_can_swipe_back (AdwPreferencesWindow *self,
- gboolean can_swipe_back)
+adw_preferences_window_set_can_navigate_back (AdwPreferencesWindow *self,
+ gboolean can_navigate_back)
{
AdwPreferencesWindowPrivate *priv;
@@ -754,28 +758,28 @@ adw_preferences_window_set_can_swipe_back (AdwPreferencesWindow *self,
priv = adw_preferences_window_get_instance_private (self);
- can_swipe_back = !!can_swipe_back;
+ can_navigate_back = !!can_navigate_back;
- if (priv->can_swipe_back == can_swipe_back)
+ if (priv->can_navigate_back == can_navigate_back)
return;
- priv->can_swipe_back = can_swipe_back;
+ priv->can_navigate_back = can_navigate_back;
- g_object_notify_by_pspec (G_OBJECT (self), props[PROP_CAN_SWIPE_BACK]);
+ g_object_notify_by_pspec (G_OBJECT (self), props[PROP_CAN_NAVIGATE_BACK]);
}
/**
- * adw_preferences_window_get_can_swipe_back: (attributes org.gtk.Method.get_property=can-swipe-back)
+ * adw_preferences_window_get_can_navigate_back: (attributes org.gtk.Method.get_property=can-navigate-back)
* @self: a `AdwPreferencesWindow`
*
- * Gets whether or not @self allows closing subpages via a swipe gesture.
+ * Gets whether gestures and shortcuts for closing subpages are enabled.
*
- * Returns: whether back swipe is enabled.
+ * Returns: whether gestures and shortcuts are enabled.
*
* Since: 1.0
*/
gboolean
-adw_preferences_window_get_can_swipe_back (AdwPreferencesWindow *self)
+adw_preferences_window_get_can_navigate_back (AdwPreferencesWindow *self)
{
AdwPreferencesWindowPrivate *priv;
@@ -783,7 +787,7 @@ adw_preferences_window_get_can_swipe_back (AdwPreferencesWindow *self)
priv = adw_preferences_window_get_instance_private (self);
- return priv->can_swipe_back;
+ return priv->can_navigate_back;
}
/**
diff --git a/src/adw-preferences-window.h b/src/adw-preferences-window.h
index 85bfa6d9..4add1c23 100644
--- a/src/adw-preferences-window.h
+++ b/src/adw-preferences-window.h
@@ -46,10 +46,10 @@ void adw_preferences_window_set_search_enabled (AdwPreferencesWindow *self,
gboolean search_enabled);
ADW_AVAILABLE_IN_ALL
-gboolean adw_preferences_window_get_can_swipe_back (AdwPreferencesWindow *self);
+gboolean adw_preferences_window_get_can_navigate_back (AdwPreferencesWindow *self);
ADW_AVAILABLE_IN_ALL
-void adw_preferences_window_set_can_swipe_back (AdwPreferencesWindow *self,
- gboolean can_swipe_back);
+void adw_preferences_window_set_can_navigate_back (AdwPreferencesWindow *self,
+ gboolean can_navigate_back);
ADW_AVAILABLE_IN_ALL
void adw_preferences_window_present_subpage (AdwPreferencesWindow *self,
diff --git a/src/adw-preferences-window.ui b/src/adw-preferences-window.ui
index b6f38906..8b3062b2 100644
--- a/src/adw-preferences-window.ui
+++ b/src/adw-preferences-window.ui
@@ -15,7 +15,7 @@
<object class="AdwToastOverlay" id="toast_overlay">
<child>
<object class="AdwLeaflet" id="subpages_leaflet">
- <property name="can-navigate-back" bind-source="AdwPreferencesWindow"
bind-property="can-swipe-back" bind-flags="sync-create"/>
+ <property name="can-navigate-back" bind-source="AdwPreferencesWindow"
bind-property="can-navigate-back" bind-flags="sync-create"/>
<property name="can-unfold">False</property>
<property name="width-request">360</property>
<signal name="notify::child-transition-running"
handler="subpages_leaflet_child_transition_running_cb" swapped="yes"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]