[libhandy/wip/exalm/isolated: 53/54] preferences-row: Add isolated property



commit 8892363b49b219098e63830278e32b94faea158d
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sun May 24 19:06:04 2020 +0500

    preferences-row: Add isolated property
    
    This will allow to make custom expanding rows using the same isolated style
    as HdyExpanderRow, while not being limited by its layout.
    
    Fixes https://gitlab.gnome.org/GNOME/libhandy/-/issues/277
    
    Signed-off-by: Alexander Mikhaylenko <alexm gnome org>

 src/hdy-preferences-row.c          | 138 +++++++++++++++++++++++++++++++++++--
 src/hdy-preferences-row.h          |   4 ++
 src/themes/Adwaita-dark.css        |  10 +--
 src/themes/Adwaita.css             |  10 +--
 src/themes/HighContrast.css        |  10 +--
 src/themes/HighContrastInverse.css |  10 +--
 src/themes/_Adwaita-base.scss      |  27 ++++----
 tests/test-preferences-row.c       |  20 ++++++
 8 files changed, 190 insertions(+), 39 deletions(-)
---
diff --git a/src/hdy-preferences-row.c b/src/hdy-preferences-row.c
index 9327509d..0c5aaf24 100644
--- a/src/hdy-preferences-row.c
+++ b/src/hdy-preferences-row.c
@@ -22,6 +22,17 @@
  * they take care of presenting the preference's title while letting you compose
  * the inputs of the preference around it.
  *
+ * #HdyPreferencesRow can be made to look separate from the rest of the list by
+ * using the #HdyPreferencesRow:isolated property, that can be used, for
+ * example, with expanding rows.
+ *
+ * # CSS nodes
+ *
+ * #HdyPreferencesRow has a main CSS node with name row.
+ * When #HdyPreferencesRow:isolated is %TRUE, #HdyPreferencesRow will have the
+ * .isolated style class, and also will add the .isolated-row-previous-sibling
+ * style class to its previous sibling, and remove it when not isolated.
+ *
  * Since: 0.0.10
  */
 
@@ -30,6 +41,7 @@ typedef struct
   gchar *title;
 
   gboolean use_underline;
+  gboolean isolated;
 } HdyPreferencesRowPrivate;
 
 G_DEFINE_TYPE_WITH_PRIVATE (HdyPreferencesRow, hdy_preferences_row, GTK_TYPE_LIST_BOX_ROW)
@@ -38,16 +50,53 @@ enum {
   PROP_0,
   PROP_TITLE,
   PROP_USE_UNDERLINE,
+  PROP_ISOLATED,
   LAST_PROP,
 };
 
 static GParamSpec *props[LAST_PROP];
 
+static void
+toggle_style_class (GtkWidget   *widget,
+                    const gchar *style_class,
+                    gboolean     enable)
+{
+  GtkStyleContext *context = gtk_widget_get_style_context (widget);
+
+  if (enable)
+    gtk_style_context_add_class (context, style_class);
+  else
+    gtk_style_context_remove_class (context, style_class);
+}
+
+static void
+update_style_classes (HdyPreferencesRow *self)
+{
+  HdyPreferencesRowPrivate *priv = hdy_preferences_row_get_instance_private (self);
+  GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (self));
+  GtkWidget *previous_sibling = NULL;
+
+  if (parent) {
+    g_autoptr (GList) siblings = gtk_container_get_children (GTK_CONTAINER (parent));
+    GList *l;
+
+    for (l = siblings; l != NULL && l->next != NULL && l->next->data != self; l = l->next);
+
+    if (l && l->next && l->next->data == self)
+      previous_sibling = l->data;
+  }
+
+  toggle_style_class (GTK_WIDGET (self), "isolated", priv->isolated);
+
+  if (previous_sibling)
+    toggle_style_class (previous_sibling, "isolated-previous-sibling", priv->isolated);
+}
+
 static void
 hdy_preferences_row_get_property (GObject    *object,
-                             guint       prop_id,
-                             GValue     *value,
-                             GParamSpec *pspec)
+                                  guint       prop_id,
+                                  GValue     *value,
+                                  GParamSpec *pspec)
 {
   HdyPreferencesRow *self = HDY_PREFERENCES_ROW (object);
 
@@ -58,6 +107,9 @@ hdy_preferences_row_get_property (GObject    *object,
   case PROP_USE_UNDERLINE:
     g_value_set_boolean (value, hdy_preferences_row_get_use_underline (self));
     break;
+  case PROP_ISOLATED:
+    g_value_set_boolean (value, hdy_preferences_row_get_isolated (self));
+    break;
   default:
     G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
   }
@@ -65,9 +117,9 @@ hdy_preferences_row_get_property (GObject    *object,
 
 static void
 hdy_preferences_row_set_property (GObject      *object,
-                             guint         prop_id,
-                             const GValue *value,
-                             GParamSpec   *pspec)
+                                  guint         prop_id,
+                                  const GValue *value,
+                                  GParamSpec   *pspec)
 {
   HdyPreferencesRow *self = HDY_PREFERENCES_ROW (object);
 
@@ -78,6 +130,9 @@ hdy_preferences_row_set_property (GObject      *object,
   case PROP_USE_UNDERLINE:
     hdy_preferences_row_set_use_underline (self, g_value_get_boolean (value));
     break;
+  case PROP_ISOLATED:
+    hdy_preferences_row_set_isolated (self, g_value_get_boolean (value));
+    break;
   default:
     G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
   }
@@ -132,6 +187,21 @@ hdy_preferences_row_class_init (HdyPreferencesRowClass *klass)
                           FALSE,
                           G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
 
+  /**
+   * HdyPreferencesRow:isolated:
+   *
+   * Whether the row looks separated from the other rows in the #GtkListBox it's
+   * in.
+   *
+   * Since: 1.0
+   */
+  props[PROP_ISOLATED] =
+    g_param_spec_boolean ("isolated",
+                          _("Isolated"),
+                          _("Whether the row looks separated from the other rows in the #GtkListBox it's 
in."),
+                          FALSE,
+                          G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
+
   g_object_class_install_properties (object_class, LAST_PROP, props);
 }
 
@@ -257,3 +327,59 @@ hdy_preferences_row_set_use_underline (HdyPreferencesRow *self,
 
   g_object_notify_by_pspec (G_OBJECT (self), props[PROP_USE_UNDERLINE]);
 }
+
+/**
+ * hdy_preferences_row_get_isolated:
+ * @self: a #HdyPreferencesRow
+ *
+ * Gets whether the row looks separated from the other rows in the #GtkListBox
+ * it's in.
+ *
+ * Returns: %TRUE if the row looks separated from the other rows in the
+ * #GtkListBox it's in.
+ *
+ * Since: 1.0
+ */
+gboolean
+hdy_preferences_row_get_isolated (HdyPreferencesRow *self)
+{
+  HdyPreferencesRowPrivate *priv;
+
+  g_return_val_if_fail (HDY_IS_PREFERENCES_ROW (self), FALSE);
+
+  priv = hdy_preferences_row_get_instance_private (self);
+
+  return priv->isolated;
+}
+
+/**
+ * hdy_preferences_row_set_isolated:
+ * @self: a #HdyPreferencesRow
+ * @isolated: whether the row is isolated
+ *
+ * If %TRUE, the row looks separated from the other rows in the #GtkListBox
+ * it's in.
+ *
+ * Since: 1.0
+ */
+void
+hdy_preferences_row_set_isolated (HdyPreferencesRow *self,
+                                  gboolean           isolated)
+{
+  HdyPreferencesRowPrivate *priv;
+
+  g_return_if_fail (HDY_IS_PREFERENCES_ROW (self));
+
+  priv = hdy_preferences_row_get_instance_private (self);
+
+  isolated = !!isolated;
+
+  if (priv->isolated == isolated)
+    return;
+
+  priv->isolated = isolated;
+
+  update_style_classes (self);
+
+  g_object_notify_by_pspec (G_OBJECT (self), props[PROP_ISOLATED]);
+}
diff --git a/src/hdy-preferences-row.h b/src/hdy-preferences-row.h
index 516dd8de..40e81e26 100644
--- a/src/hdy-preferences-row.h
+++ b/src/hdy-preferences-row.h
@@ -37,4 +37,8 @@ gboolean hdy_preferences_row_get_use_underline (HdyPreferencesRow *self);
 void     hdy_preferences_row_set_use_underline (HdyPreferencesRow *self,
                                                 gboolean           use_underline);
 
+gboolean hdy_preferences_row_get_isolated (HdyPreferencesRow *self);
+void     hdy_preferences_row_set_isolated (HdyPreferencesRow *self,
+                                           gboolean           isolated);
+
 G_END_DECLS
diff --git a/src/themes/Adwaita-dark.css b/src/themes/Adwaita-dark.css
index 37d5e12a..597b0638 100644
--- a/src/themes/Adwaita-dark.css
+++ b/src/themes/Adwaita-dark.css
@@ -162,15 +162,15 @@ list.preferences > row, list.preferences > row list > row { border-color: alpha(
 
 list.preferences > row:not(:last-child) { border-width: 1px 1px 0px 1px; }
 
-list.preferences > row:first-child, list.preferences > row.expander:first-child row.header, list.preferences 
row.expander:checked, list.preferences > row.expander:checked row.header, list.preferences > 
row.expander:checked + row, list.preferences > row.expander:checked + row.expander row.header { 
border-top-left-radius: 8px; -gtk-outline-top-left-radius: 7px; border-top-right-radius: 8px; 
-gtk-outline-top-right-radius: 7px; }
+list.preferences > row:first-child, list.preferences > row.isolated, list.preferences > 
row.expander:first-child row.header, list.preferences > row.expander.isolated row.header, list.preferences > 
row.isolated + row, list.preferences > row.isolated + row.expander row.header { border-top-left-radius: 8px; 
-gtk-outline-top-left-radius: 7px; border-top-right-radius: 8px; -gtk-outline-top-right-radius: 7px; }
 
-list.preferences > row:last-child, list.preferences > row.checked-expander-row-previous-sibling, 
list.preferences > row.expander:checked { border-width: 1px; }
+list.preferences > row:last-child, list.preferences > row.isolated-previous-sibling, list.preferences > 
row.isolated { border-width: 1px; }
 
-list.preferences > row:last-child, list.preferences > row.checked-expander-row-previous-sibling, 
list.preferences > row.expander:checked, list.preferences > row.expander:not(:checked):last-child row.header, 
list.preferences > row.expander:not(:checked).checked-expander-row-previous-sibling row.header, 
list.preferences > row.expander.empty:checked row.header, list.preferences > row.expander list.nested > 
row:last-child { border-bottom-left-radius: 8px; -gtk-outline-bottom-left-radius: 7px; 
border-bottom-right-radius: 8px; -gtk-outline-bottom-right-radius: 7px; }
+list.preferences > row:last-child, list.preferences > row.isolated-previous-sibling, list.preferences > 
row.isolated, list.preferences > row.expander:not(:checked):last-child row.header, list.preferences > 
row.expander:not(:checked).isolated row.header, list.preferences > 
row.expander:not(:checked).isolated-previous-sibling row.header, list.preferences > 
row.expander.empty.isolated row.header, list.preferences > row.expander list.nested > row:last-child { 
border-bottom-left-radius: 8px; -gtk-outline-bottom-left-radius: 7px; border-bottom-right-radius: 8px; 
-gtk-outline-bottom-right-radius: 7px; }
 
-list.preferences > row.expander:checked:not(:first-child), list.preferences > row.expander:checked + row { 
margin-top: 6px; }
+list.preferences > row.isolated:not(:first-child), list.preferences > row.isolated + row { margin-top: 6px; }
 
-button.list-button:not(:active):not(:checked):not(:hover) { background: none; border: 1px solid 
alpha(#1b1b1b, 0.5); box-shadow: none; }
+button.list-button:not(:active):not(.isolated):not(:hover) { background: none; border: 1px solid 
alpha(#1b1b1b, 0.5); box-shadow: none; }
 
 window.csd.unified:not(.solid-csd):not(.fullscreen) headerbar { box-shadow: none; }
 
diff --git a/src/themes/Adwaita.css b/src/themes/Adwaita.css
index 1061d9ab..c52c1312 100644
--- a/src/themes/Adwaita.css
+++ b/src/themes/Adwaita.css
@@ -162,15 +162,15 @@ list.preferences > row, list.preferences > row list > row { border-color: alpha(
 
 list.preferences > row:not(:last-child) { border-width: 1px 1px 0px 1px; }
 
-list.preferences > row:first-child, list.preferences > row.expander:first-child row.header, list.preferences 
row.expander:checked, list.preferences > row.expander:checked row.header, list.preferences > 
row.expander:checked + row, list.preferences > row.expander:checked + row.expander row.header { 
border-top-left-radius: 8px; -gtk-outline-top-left-radius: 7px; border-top-right-radius: 8px; 
-gtk-outline-top-right-radius: 7px; }
+list.preferences > row:first-child, list.preferences > row.isolated, list.preferences > 
row.expander:first-child row.header, list.preferences > row.expander.isolated row.header, list.preferences > 
row.isolated + row, list.preferences > row.isolated + row.expander row.header { border-top-left-radius: 8px; 
-gtk-outline-top-left-radius: 7px; border-top-right-radius: 8px; -gtk-outline-top-right-radius: 7px; }
 
-list.preferences > row:last-child, list.preferences > row.checked-expander-row-previous-sibling, 
list.preferences > row.expander:checked { border-width: 1px; }
+list.preferences > row:last-child, list.preferences > row.isolated-previous-sibling, list.preferences > 
row.isolated { border-width: 1px; }
 
-list.preferences > row:last-child, list.preferences > row.checked-expander-row-previous-sibling, 
list.preferences > row.expander:checked, list.preferences > row.expander:not(:checked):last-child row.header, 
list.preferences > row.expander:not(:checked).checked-expander-row-previous-sibling row.header, 
list.preferences > row.expander.empty:checked row.header, list.preferences > row.expander list.nested > 
row:last-child { border-bottom-left-radius: 8px; -gtk-outline-bottom-left-radius: 7px; 
border-bottom-right-radius: 8px; -gtk-outline-bottom-right-radius: 7px; }
+list.preferences > row:last-child, list.preferences > row.isolated-previous-sibling, list.preferences > 
row.isolated, list.preferences > row.expander:not(:checked):last-child row.header, list.preferences > 
row.expander:not(:checked).isolated row.header, list.preferences > 
row.expander:not(:checked).isolated-previous-sibling row.header, list.preferences > 
row.expander.empty.isolated row.header, list.preferences > row.expander list.nested > row:last-child { 
border-bottom-left-radius: 8px; -gtk-outline-bottom-left-radius: 7px; border-bottom-right-radius: 8px; 
-gtk-outline-bottom-right-radius: 7px; }
 
-list.preferences > row.expander:checked:not(:first-child), list.preferences > row.expander:checked + row { 
margin-top: 6px; }
+list.preferences > row.isolated:not(:first-child), list.preferences > row.isolated + row { margin-top: 6px; }
 
-button.list-button:not(:active):not(:checked):not(:hover) { background: none; border: 1px solid 
alpha(#cdc7c2, 0.5); box-shadow: none; }
+button.list-button:not(:active):not(.isolated):not(:hover) { background: none; border: 1px solid 
alpha(#cdc7c2, 0.5); box-shadow: none; }
 
 window.csd.unified:not(.solid-csd):not(.fullscreen) headerbar { box-shadow: none; }
 
diff --git a/src/themes/HighContrast.css b/src/themes/HighContrast.css
index 0f3559a9..2e583c55 100644
--- a/src/themes/HighContrast.css
+++ b/src/themes/HighContrast.css
@@ -162,15 +162,15 @@ list.preferences > row, list.preferences > row list > row { border-color: alpha(
 
 list.preferences > row:not(:last-child) { border-width: 1px 1px 0px 1px; }
 
-list.preferences > row:first-child, list.preferences > row.expander:first-child row.header, list.preferences 
row.expander:checked, list.preferences > row.expander:checked row.header, list.preferences > 
row.expander:checked + row, list.preferences > row.expander:checked + row.expander row.header { 
border-top-left-radius: 8px; -gtk-outline-top-left-radius: 7px; border-top-right-radius: 8px; 
-gtk-outline-top-right-radius: 7px; }
+list.preferences > row:first-child, list.preferences > row.isolated, list.preferences > 
row.expander:first-child row.header, list.preferences > row.expander.isolated row.header, list.preferences > 
row.isolated + row, list.preferences > row.isolated + row.expander row.header { border-top-left-radius: 8px; 
-gtk-outline-top-left-radius: 7px; border-top-right-radius: 8px; -gtk-outline-top-right-radius: 7px; }
 
-list.preferences > row:last-child, list.preferences > row.checked-expander-row-previous-sibling, 
list.preferences > row.expander:checked { border-width: 1px; }
+list.preferences > row:last-child, list.preferences > row.isolated-previous-sibling, list.preferences > 
row.isolated { border-width: 1px; }
 
-list.preferences > row:last-child, list.preferences > row.checked-expander-row-previous-sibling, 
list.preferences > row.expander:checked, list.preferences > row.expander:not(:checked):last-child row.header, 
list.preferences > row.expander:not(:checked).checked-expander-row-previous-sibling row.header, 
list.preferences > row.expander.empty:checked row.header, list.preferences > row.expander list.nested > 
row:last-child { border-bottom-left-radius: 8px; -gtk-outline-bottom-left-radius: 7px; 
border-bottom-right-radius: 8px; -gtk-outline-bottom-right-radius: 7px; }
+list.preferences > row:last-child, list.preferences > row.isolated-previous-sibling, list.preferences > 
row.isolated, list.preferences > row.expander:not(:checked):last-child row.header, list.preferences > 
row.expander:not(:checked).isolated row.header, list.preferences > 
row.expander:not(:checked).isolated-previous-sibling row.header, list.preferences > 
row.expander.empty.isolated row.header, list.preferences > row.expander list.nested > row:last-child { 
border-bottom-left-radius: 8px; -gtk-outline-bottom-left-radius: 7px; border-bottom-right-radius: 8px; 
-gtk-outline-bottom-right-radius: 7px; }
 
-list.preferences > row.expander:checked:not(:first-child), list.preferences > row.expander:checked + row { 
margin-top: 6px; }
+list.preferences > row.isolated:not(:first-child), list.preferences > row.isolated + row { margin-top: 6px; }
 
-button.list-button:not(:active):not(:checked):not(:hover) { background: none; border: 1px solid 
alpha(#877b6e, 0.5); box-shadow: none; }
+button.list-button:not(:active):not(.isolated):not(:hover) { background: none; border: 1px solid 
alpha(#877b6e, 0.5); box-shadow: none; }
 
 window.csd.unified:not(.solid-csd):not(.fullscreen) headerbar { box-shadow: none; }
 
diff --git a/src/themes/HighContrastInverse.css b/src/themes/HighContrastInverse.css
index df682d0c..0b9ed16c 100644
--- a/src/themes/HighContrastInverse.css
+++ b/src/themes/HighContrastInverse.css
@@ -162,15 +162,15 @@ list.preferences > row, list.preferences > row list > row { border-color: alpha(
 
 list.preferences > row:not(:last-child) { border-width: 1px 1px 0px 1px; }
 
-list.preferences > row:first-child, list.preferences > row.expander:first-child row.header, list.preferences 
row.expander:checked, list.preferences > row.expander:checked row.header, list.preferences > 
row.expander:checked + row, list.preferences > row.expander:checked + row.expander row.header { 
border-top-left-radius: 8px; -gtk-outline-top-left-radius: 7px; border-top-right-radius: 8px; 
-gtk-outline-top-right-radius: 7px; }
+list.preferences > row:first-child, list.preferences > row.isolated, list.preferences > 
row.expander:first-child row.header, list.preferences > row.expander.isolated row.header, list.preferences > 
row.isolated + row, list.preferences > row.isolated + row.expander row.header { border-top-left-radius: 8px; 
-gtk-outline-top-left-radius: 7px; border-top-right-radius: 8px; -gtk-outline-top-right-radius: 7px; }
 
-list.preferences > row:last-child, list.preferences > row.checked-expander-row-previous-sibling, 
list.preferences > row.expander:checked { border-width: 1px; }
+list.preferences > row:last-child, list.preferences > row.isolated-previous-sibling, list.preferences > 
row.isolated { border-width: 1px; }
 
-list.preferences > row:last-child, list.preferences > row.checked-expander-row-previous-sibling, 
list.preferences > row.expander:checked, list.preferences > row.expander:not(:checked):last-child row.header, 
list.preferences > row.expander:not(:checked).checked-expander-row-previous-sibling row.header, 
list.preferences > row.expander.empty:checked row.header, list.preferences > row.expander list.nested > 
row:last-child { border-bottom-left-radius: 8px; -gtk-outline-bottom-left-radius: 7px; 
border-bottom-right-radius: 8px; -gtk-outline-bottom-right-radius: 7px; }
+list.preferences > row:last-child, list.preferences > row.isolated-previous-sibling, list.preferences > 
row.isolated, list.preferences > row.expander:not(:checked):last-child row.header, list.preferences > 
row.expander:not(:checked).isolated row.header, list.preferences > 
row.expander:not(:checked).isolated-previous-sibling row.header, list.preferences > 
row.expander.empty.isolated row.header, list.preferences > row.expander list.nested > row:last-child { 
border-bottom-left-radius: 8px; -gtk-outline-bottom-left-radius: 7px; border-bottom-right-radius: 8px; 
-gtk-outline-bottom-right-radius: 7px; }
 
-list.preferences > row.expander:checked:not(:first-child), list.preferences > row.expander:checked + row { 
margin-top: 6px; }
+list.preferences > row.isolated:not(:first-child), list.preferences > row.isolated + row { margin-top: 6px; }
 
-button.list-button:not(:active):not(:checked):not(:hover) { background: none; border: 1px solid 
alpha(#686868, 0.5); box-shadow: none; }
+button.list-button:not(:active):not(.isolated):not(:hover) { background: none; border: 1px solid 
alpha(#686868, 0.5); box-shadow: none; }
 
 window.csd.unified:not(.solid-csd):not(.fullscreen) headerbar { box-shadow: none; }
 
diff --git a/src/themes/_Adwaita-base.scss b/src/themes/_Adwaita-base.scss
index df287ed3..3246e7cc 100644
--- a/src/themes/_Adwaita-base.scss
+++ b/src/themes/_Adwaita-base.scss
@@ -265,35 +265,36 @@ list.preferences {
 
     // Rounded top
     &:first-child,
+    &.isolated,
     &.expander:first-child row.header,
-    &.expander:checked,
-    &.expander:checked row.header,
-    &.expander:checked + row,
-    &.expander:checked + row.expander row.header {
+    &.expander.isolated row.header,
+    &.isolated + row,
+    &.isolated + row.expander row.header {
       @include rounded-border(top);
     }
 
     // Bottom border
     &:last-child,
-    &.checked-expander-row-previous-sibling,
-    &.expander:checked {
+    &.isolated-previous-sibling,
+    &.isolated {
       border-width: 1px;
     }
 
     // Rounded bottom
     &:last-child,
-    &.checked-expander-row-previous-sibling,
-    &.expander:checked,
+    &.isolated-previous-sibling,
+    &.isolated,
     &.expander:not(:checked):last-child row.header,
-    &.expander:not(:checked).checked-expander-row-previous-sibling row.header,
-    &.expander.empty:checked row.header,
+    &.expander:not(:checked).isolated row.header,
+    &.expander:not(:checked).isolated-previous-sibling row.header,
+    &.expander.empty.isolated row.header,
     &.expander list.nested > row:last-child {
       @include rounded-border(bottom);
     }
 
     // Add space around expanded rows
-    &.expander:checked:not(:first-child),
-    &.expander:checked + row {
+    &.isolated:not(:first-child),
+    &.isolated + row {
       margin-top: 6px;
     }
   }
@@ -301,7 +302,7 @@ list.preferences {
 
 // List button
 
-button.list-button:not(:active):not(:checked):not(:hover) {
+button.list-button:not(:active):not(.isolated):not(:hover) {
   background: none;
   border: 1px solid hdyalpha($borders_color, 0.5);
   box-shadow: none;
diff --git a/tests/test-preferences-row.c b/tests/test-preferences-row.c
index 7b62581d..97c4eb95 100644
--- a/tests/test-preferences-row.c
+++ b/tests/test-preferences-row.c
@@ -44,6 +44,25 @@ test_hdy_preferences_row_use_undeline (void)
 }
 
 
+
+static void
+test_hdy_preferences_row_isolated (void)
+{
+  g_autoptr (HdyPreferencesRow) row = NULL;
+
+  row = g_object_ref_sink (HDY_PREFERENCES_ROW (hdy_preferences_row_new ()));
+  g_assert_nonnull (row);
+
+  g_assert_false (hdy_preferences_row_get_isolated (row));
+
+  hdy_preferences_row_set_isolated (row, TRUE);
+  g_assert_true (hdy_preferences_row_get_isolated (row));
+
+  hdy_preferences_row_set_isolated (row, FALSE);
+  g_assert_false (hdy_preferences_row_get_isolated (row));
+}
+
+
 gint
 main (gint argc,
       gchar *argv[])
@@ -52,6 +71,7 @@ main (gint argc,
 
   g_test_add_func("/Handy/PreferencesRow/title", test_hdy_preferences_row_title);
   g_test_add_func("/Handy/PreferencesRow/use_underline", test_hdy_preferences_row_use_undeline);
+  g_test_add_func("/Handy/PreferencesRow/isolated", test_hdy_preferences_row_isolated);
 
   return g_test_run();
 }


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