[gtk+] sizegroup: Simplify comparison
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] sizegroup: Simplify comparison
- Date: Wed, 14 Nov 2012 01:05:39 +0000 (UTC)
commit 70ba973d1d9e14ab8b5d8dd528fef8b4580a6be7
Author: Benjamin Otte <otte redhat com>
Date: Wed Nov 14 01:29:06 2012 +0100
sizegroup: Simplify comparison
gtk/gtksizegroup.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtksizegroup.c b/gtk/gtksizegroup.c
index b51b824..7c57558 100644
--- a/gtk/gtksizegroup.c
+++ b/gtk/gtksizegroup.c
@@ -147,6 +147,10 @@ static void gtk_size_group_buildable_custom_finished (GtkBuildable *buildable,
const gchar *tagname,
gpointer user_data);
+G_STATIC_ASSERT (GTK_SIZE_GROUP_HORIZONTAL == (1 << GTK_ORIENTATION_HORIZONTAL));
+G_STATIC_ASSERT (GTK_SIZE_GROUP_VERTICAL == (1 << GTK_ORIENTATION_VERTICAL));
+G_STATIC_ASSERT (GTK_SIZE_GROUP_BOTH == (GTK_SIZE_GROUP_HORIZONTAL | GTK_SIZE_GROUP_VERTICAL));
+
static void
add_widget_to_closure (GHashTable *set,
GtkWidget *widget,
@@ -169,9 +173,7 @@ add_widget_to_closure (GHashTable *set,
if (tmp_priv->ignore_hidden && hidden)
continue;
- if (tmp_priv->mode != GTK_SIZE_GROUP_BOTH &&
- (!(tmp_priv->mode == GTK_SIZE_GROUP_HORIZONTAL && orientation == GTK_ORIENTATION_HORIZONTAL)) &&
- (!(tmp_priv->mode == GTK_SIZE_GROUP_VERTICAL && orientation == GTK_ORIENTATION_VERTICAL)))
+ if (!(tmp_priv->mode & (1 << orientation)))
continue;
for (tmp_widgets = tmp_priv->widgets; tmp_widgets; tmp_widgets = tmp_widgets->next)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]