[libadwaita/wip/exalm/view-switcher-cleanup: 7/14] view-switcher-title: Remove policy




commit e01c04d4156dbd17827a24edde97cec1ff9b2bb8
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Aug 31 15:41:41 2021 +0500

    view-switcher-title: Remove policy
    
    Use auto only, people can easily reimplement the widget themselves if they
    need other policies.

 doc/migrating-libhandy-1-4-to-libadwaita.md |  7 ++++
 src/adw-view-switcher-title.c               | 65 -----------------------------
 src/adw-view-switcher-title.h               |  6 ---
 3 files changed, 7 insertions(+), 71 deletions(-)
---
diff --git a/doc/migrating-libhandy-1-4-to-libadwaita.md b/doc/migrating-libhandy-1-4-to-libadwaita.md
index 6801f91e..d5528c70 100644
--- a/doc/migrating-libhandy-1-4-to-libadwaita.md
+++ b/doc/migrating-libhandy-1-4-to-libadwaita.md
@@ -259,6 +259,13 @@ You should stop using [property@Gtk.Stack:transition-type] and
 The "policy" property has been removed. If you had used it, use a plain
 [class@Adw.ViewSwitcher] in a [class@Gtk.ActionBar] instead.
 
+### Adapt to [class@Adw.ViewSwitcherTitle] API Changes
+
+The "policy" property has been removed, the behavior is similar to the `auto`
+policy. If you had used `wide` or `narrow` policies, use an [class@Adw.Squeezer]
+with an [class@Adw.ViewSwitcher] and an [class@Adw.WindowTitle] inside, with the
+switcher having the desired policy.
+
 ### Adapt to [class@Adw.Avatar] API Changes
 
 The `HdyAvatar:loadable-icon` property has been removed along with its getter
diff --git a/src/adw-view-switcher-title.c b/src/adw-view-switcher-title.c
index 353dd681..e27efd88 100644
--- a/src/adw-view-switcher-title.c
+++ b/src/adw-view-switcher-title.c
@@ -69,7 +69,6 @@
 
 enum {
   PROP_0,
-  PROP_POLICY,
   PROP_STACK,
   PROP_TITLE,
   PROP_SUBTITLE,
@@ -138,9 +137,6 @@ adw_view_switcher_title_get_property (GObject    *object,
   AdwViewSwitcherTitle *self = ADW_VIEW_SWITCHER_TITLE (object);
 
   switch (prop_id) {
-  case PROP_POLICY:
-    g_value_set_enum (value, adw_view_switcher_title_get_policy (self));
-    break;
   case PROP_STACK:
     g_value_set_object (value, adw_view_switcher_title_get_stack (self));
     break;
@@ -171,9 +167,6 @@ adw_view_switcher_title_set_property (GObject      *object,
   AdwViewSwitcherTitle *self = ADW_VIEW_SWITCHER_TITLE (object);
 
   switch (prop_id) {
-  case PROP_POLICY:
-    adw_view_switcher_title_set_policy (self, g_value_get_enum (value));
-    break;
   case PROP_STACK:
     adw_view_switcher_title_set_stack (self, g_value_get_object (value));
     break;
@@ -215,21 +208,6 @@ adw_view_switcher_title_class_init (AdwViewSwitcherTitleClass *klass)
   object_class->get_property = adw_view_switcher_title_get_property;
   object_class->set_property = adw_view_switcher_title_set_property;
 
-  /**
-   * AdwViewSwitcherTitle:policy: (attributes org.gtk.Property.get=adw_view_switcher_title_get_policy 
org.gtk.Property.set=adw_view_switcher_title_set_policy)
-   *
-   * The policy to determine which mode to use.
-   *
-   * Since: 1.0
-   */
-  props[PROP_POLICY] =
-    g_param_spec_enum ("policy",
-                       "Policy",
-                       "The policy to determine the mode to use",
-                       ADW_TYPE_VIEW_SWITCHER_POLICY,
-                       ADW_VIEW_SWITCHER_POLICY_AUTO,
-                       G_PARAM_EXPLICIT_NOTIFY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
   /**
    * AdwViewSwitcherTitle:stack: (attributes org.gtk.Property.get=adw_view_switcher_title_get_stack 
org.gtk.Property.set=adw_view_switcher_title_set_stack)
    *
@@ -357,49 +335,6 @@ adw_view_switcher_title_new (void)
   return g_object_new (ADW_TYPE_VIEW_SWITCHER_TITLE, NULL);
 }
 
-/**
- * adw_view_switcher_title_get_policy: (attributes org.gtk.Method.get_property=policy)
- * @self: a `AdwViewSwitcherTitle`
- *
- * Gets the policy of @self.
- *
- * Returns: the policy of @self
- *
- * Since: 1.0
- */
-AdwViewSwitcherPolicy
-adw_view_switcher_title_get_policy (AdwViewSwitcherTitle *self)
-{
-  g_return_val_if_fail (ADW_IS_VIEW_SWITCHER_TITLE (self), ADW_VIEW_SWITCHER_POLICY_NARROW);
-
-  return adw_view_switcher_get_policy (self->wide_view_switcher);
-}
-
-/**
- * adw_view_switcher_title_set_policy: (attributes org.gtk.Method.set_property=policy)
- * @self: a `AdwViewSwitcherTitle`
- * @policy: the new policy
- *
- * Sets the policy of @self.
- *
- * Since: 1.0
- */
-void
-adw_view_switcher_title_set_policy (AdwViewSwitcherTitle  *self,
-                                    AdwViewSwitcherPolicy  policy)
-{
-  g_return_if_fail (ADW_IS_VIEW_SWITCHER_TITLE (self));
-
-  if (adw_view_switcher_get_policy (self->wide_view_switcher) == policy)
-    return;
-
-  adw_view_switcher_set_policy (self->wide_view_switcher, policy);
-
-  g_object_notify_by_pspec (G_OBJECT (self), props[PROP_POLICY]);
-
-  gtk_widget_queue_resize (GTK_WIDGET (self));
-}
-
 /**
  * adw_view_switcher_title_get_stack: (attributes org.gtk.Method.get_property=stack)
  * @self: a `AdwViewSwitcherTitle`
diff --git a/src/adw-view-switcher-title.h b/src/adw-view-switcher-title.h
index 9e65d193..7d2f17eb 100644
--- a/src/adw-view-switcher-title.h
+++ b/src/adw-view-switcher-title.h
@@ -27,12 +27,6 @@ G_DECLARE_FINAL_TYPE (AdwViewSwitcherTitle, adw_view_switcher_title, ADW, VIEW_S
 ADW_AVAILABLE_IN_ALL
 GtkWidget *adw_view_switcher_title_new (void) G_GNUC_WARN_UNUSED_RESULT;
 
-ADW_AVAILABLE_IN_ALL
-AdwViewSwitcherPolicy adw_view_switcher_title_get_policy (AdwViewSwitcherTitle  *self);
-ADW_AVAILABLE_IN_ALL
-void                  adw_view_switcher_title_set_policy (AdwViewSwitcherTitle  *self,
-                                                          AdwViewSwitcherPolicy  policy);
-
 ADW_AVAILABLE_IN_ALL
 AdwViewStack *adw_view_switcher_title_get_stack (AdwViewSwitcherTitle *self);
 ADW_AVAILABLE_IN_ALL


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]