[libhandy/wip/exalm/isolated: 2/2] expander-row: Use isolated property for styling
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libhandy/wip/exalm/isolated: 2/2] expander-row: Use isolated property for styling
- Date: Sun, 24 May 2020 14:11:23 +0000 (UTC)
commit d90a5cc19bd750782c45830d914dbb3276c41994
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sun May 24 19:08:56 2020 +0500
expander-row: Use isolated property for styling
Signed-off-by: Alexander Mikhaylenko <alexm gnome org>
src/hdy-expander-row.c | 34 ++++++++++------------------------
1 file changed, 10 insertions(+), 24 deletions(-)
---
diff --git a/src/hdy-expander-row.c b/src/hdy-expander-row.c
index e4b11e39..056cd45f 100644
--- a/src/hdy-expander-row.c
+++ b/src/hdy-expander-row.c
@@ -19,6 +19,9 @@
* also allows the user to enable the expansion of the row, allowing to disable
* all that the row contains.
*
+ * When expanded, the #HdyPreferencesRow:isolated property will be set to %TRUE
+ * and vice versa.
+ *
* # CSS nodes
*
* #HdyExpanderRow has a main CSS node with name row, and the .expander style
@@ -27,9 +30,9 @@
* It contains the subnodes row.header for its main embedded row, list.nested
* for the list it can expand, and image.expander-row-arrow for its arrow.
*
- * When expanded, #HdyExpanderRow will add the
- * .checked-expander-row-previous-sibling style class to its previous sibling,
- * and remove it when retracted.
+ * When expanded, the main node will have the .isolated style class and the row
+ * before it will have the .isolated-row-previous-sibling style class. See
+ * #HdyPreferencesRow for more details.
*
* Since: 0.0.6
*/
@@ -68,32 +71,11 @@ static void
update_arrow (HdyExpanderRow *self)
{
HdyExpanderRowPrivate *priv = hdy_expander_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;
- }
if (priv->expanded)
gtk_widget_set_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_CHECKED, FALSE);
else
gtk_widget_unset_state_flags (GTK_WIDGET (self), GTK_STATE_FLAG_CHECKED);
-
- if (previous_sibling) {
- GtkStyleContext *previous_sibling_context = gtk_widget_get_style_context (previous_sibling);
-
- if (priv->expanded)
- gtk_style_context_add_class (previous_sibling_context, "checked-expander-row-previous-sibling");
- else
- gtk_style_context_remove_class (previous_sibling_context, "checked-expander-row-previous-sibling");
- }
}
static void
@@ -389,6 +371,10 @@ hdy_expander_row_init (HdyExpanderRow *self)
g_signal_connect_object (priv->action_row, "notify::subtitle", G_CALLBACK (notify_subtitle_cb), self,
G_CONNECT_SWAPPED);
g_signal_connect_object (priv->action_row, "notify::use-underline", G_CALLBACK (notify_use_underline_cb),
self, G_CONNECT_SWAPPED);
g_signal_connect_object (priv->action_row, "notify::icon-name", G_CALLBACK (notify_icon_name_cb), self,
G_CONNECT_SWAPPED);
+
+ g_object_bind_property (self, "isolated",
+ self, "expanded",
+ G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]