[libpanel] position: add panel_position_equal()



commit 080b0b72fbc79ec6f5af1fdb4f98b5d50eae3be3
Author: Christian Hergert <chergert redhat com>
Date:   Fri Sep 16 20:44:03 2022 -0700

    position: add panel_position_equal()

 src/panel-position.c | 14 ++++++++++++++
 src/panel-position.h |  3 +++
 2 files changed, 17 insertions(+)
---
diff --git a/src/panel-position.c b/src/panel-position.c
index 9cf30bc..8cf4242 100644
--- a/src/panel-position.c
+++ b/src/panel-position.c
@@ -467,3 +467,17 @@ panel_position_new_from_variant (GVariant *variant)
 
   return self;
 }
+
+gboolean
+panel_position_equal (PanelPosition *a,
+                      PanelPosition *b)
+{
+  return a->area_set == b->area_set &&
+         a->column_set == b->column_set &&
+         a->row_set == b->row_set &&
+         a->depth_set == b->depth_set &&
+         (!a->area_set || a->area == b->area) &&
+         (!a->column_set || a->column == b->column) &&
+         (!a->row_set || a->row == b->row) &&
+         (!a->depth_set || a->depth == b->depth);
+}
diff --git a/src/panel-position.h b/src/panel-position.h
index 9087306..cdd71dd 100644
--- a/src/panel-position.h
+++ b/src/panel-position.h
@@ -78,5 +78,8 @@ void           panel_position_set_row          (PanelPosition *self,
 PANEL_AVAILABLE_IN_ALL
 void           panel_position_set_row_set      (PanelPosition *self,
                                                 gboolean       row_set);
+PANEL_AVAILABLE_IN_ALL
+gboolean       panel_position_equal            (PanelPosition *a,
+                                                PanelPosition *b);
 
 G_END_DECLS


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