[libdazzle] suggestion: handle multiple changes in orientation



commit 26c2193beb69f193037e98f1e4d75f82ec3412b9
Author: Christian Hergert <chergert redhat com>
Date:   Thu Apr 25 15:15:40 2019 -0700

    suggestion: handle multiple changes in orientation

 src/suggestions/dzl-suggestion-row.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/suggestions/dzl-suggestion-row.c b/src/suggestions/dzl-suggestion-row.c
index 264bfb1..be2b021 100644
--- a/src/suggestions/dzl-suggestion-row.c
+++ b/src/suggestions/dzl-suggestion-row.c
@@ -156,7 +156,7 @@ dzl_suggestion_row_get_property (GObject    *object,
     case PROP_ORIENTATION:
       g_value_set_enum (value, priv->orientation);
       break;
- 
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
     }
@@ -178,11 +178,13 @@ dzl_suggestion_row_set_property (GObject      *object,
       break;
 
     case PROP_ORIENTATION:
-      priv->orientation = g_value_get_enum (value);
-      if (priv->orientation == GTK_ORIENTATION_VERTICAL)
-        gtk_widget_set_visible (GTK_WIDGET (priv->separator), FALSE);
-
-      gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->box), priv->orientation);
+      if (priv->orientation != g_value_get_enum (value))
+        {
+          priv->orientation = g_value_get_enum (value);
+          gtk_widget_set_visible (GTK_WIDGET (priv->separator),
+                                  priv->orientation != GTK_ORIENTATION_VERTICAL);
+          gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->box), priv->orientation);
+        }
       break;
 
     default:
@@ -214,7 +216,7 @@ dzl_suggestion_row_class_init (DzlSuggestionRowClass *klass)
                        GTK_TYPE_ORIENTATION,
                        GTK_ORIENTATION_VERTICAL,
                        (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- 
+
    g_object_class_install_properties (object_class, N_PROPS, properties);
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/dazzle/ui/dzl-suggestion-row.ui");


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