From 50884b70f43350f1904807834cc8a210fee54efb Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Thu, 7 Nov 2002 19:35:37 +0000 Subject: [PATCH] Add a snap_edge_set property to deal with the fact that we have an unset Thu Nov 7 14:24:45 2002 Owen Taylor * gtk/gtkhandlebox.c: Add a snap_edge_set property to deal with the fact that we have an unset state for the snap_edge property. (Reported by Matthias Clasen #97505) --- ChangeLog | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-2 | 7 +++++++ ChangeLog.pre-2-4 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ gtk/gtkhandlebox.c | 26 ++++++++++++++++++++++++-- 7 files changed, 66 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 08b46a5cd..aca30263e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu Nov 7 14:24:45 2002 Owen Taylor + + * gtk/gtkhandlebox.c: Add a snap_edge_set property to + deal with the fact that we have an unset state for + the snap_edge property. (Reported by Matthias Clasen + #97505) + Thu Nov 7 12:53:08 2002 Owen Taylor * gtk/gtkwidget.[ch] gtk/gtkwindow.c gtk/gtkinvisible.c: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 08b46a5cd..aca30263e 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +Thu Nov 7 14:24:45 2002 Owen Taylor + + * gtk/gtkhandlebox.c: Add a snap_edge_set property to + deal with the fact that we have an unset state for + the snap_edge property. (Reported by Matthias Clasen + #97505) + Thu Nov 7 12:53:08 2002 Owen Taylor * gtk/gtkwidget.[ch] gtk/gtkwindow.c gtk/gtkinvisible.c: diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 08b46a5cd..aca30263e 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,10 @@ +Thu Nov 7 14:24:45 2002 Owen Taylor + + * gtk/gtkhandlebox.c: Add a snap_edge_set property to + deal with the fact that we have an unset state for + the snap_edge property. (Reported by Matthias Clasen + #97505) + Thu Nov 7 12:53:08 2002 Owen Taylor * gtk/gtkwidget.[ch] gtk/gtkwindow.c gtk/gtkinvisible.c: diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 08b46a5cd..aca30263e 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,10 @@ +Thu Nov 7 14:24:45 2002 Owen Taylor + + * gtk/gtkhandlebox.c: Add a snap_edge_set property to + deal with the fact that we have an unset state for + the snap_edge property. (Reported by Matthias Clasen + #97505) + Thu Nov 7 12:53:08 2002 Owen Taylor * gtk/gtkwidget.[ch] gtk/gtkwindow.c gtk/gtkinvisible.c: diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 08b46a5cd..aca30263e 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +Thu Nov 7 14:24:45 2002 Owen Taylor + + * gtk/gtkhandlebox.c: Add a snap_edge_set property to + deal with the fact that we have an unset state for + the snap_edge property. (Reported by Matthias Clasen + #97505) + Thu Nov 7 12:53:08 2002 Owen Taylor * gtk/gtkwidget.[ch] gtk/gtkwindow.c gtk/gtkinvisible.c: diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 08b46a5cd..aca30263e 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +Thu Nov 7 14:24:45 2002 Owen Taylor + + * gtk/gtkhandlebox.c: Add a snap_edge_set property to + deal with the fact that we have an unset state for + the snap_edge property. (Reported by Matthias Clasen + #97505) + Thu Nov 7 12:53:08 2002 Owen Taylor * gtk/gtkwidget.[ch] gtk/gtkwindow.c gtk/gtkinvisible.c: diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c index ec7c22d5f..aa31060f5 100644 --- a/gtk/gtkhandlebox.c +++ b/gtk/gtkhandlebox.c @@ -37,7 +37,8 @@ enum { PROP_SHADOW, PROP_SHADOW_TYPE, PROP_HANDLE_POSITION, - PROP_SNAP_EDGE + PROP_SNAP_EDGE, + PROP_SNAP_EDGE_SET }; #define DRAG_HANDLE_SIZE 10 @@ -214,6 +215,14 @@ gtk_handle_box_class_init (GtkHandleBoxClass *class) GTK_POS_TOP, G_PARAM_READABLE | G_PARAM_WRITABLE)); + g_object_class_install_property (gobject_class, + PROP_SNAP_EDGE_SET, + g_param_spec_boolean ("snap_edge_set", + _("Snap edge set"), + _("Whether to use the value from the snap_edge property or a value derived from handle_position"), + FALSE, + G_PARAM_READABLE | G_PARAM_WRITABLE)); + object_class->destroy = gtk_handle_box_destroy; widget_class->map = gtk_handle_box_map; @@ -291,6 +300,10 @@ gtk_handle_box_set_property (GObject *object, case PROP_SNAP_EDGE: gtk_handle_box_set_snap_edge (handle_box, g_value_get_enum (value)); break; + case PROP_SNAP_EDGE_SET: + if (!g_value_get_boolean (value)) + gtk_handle_box_set_snap_edge (handle_box, (GtkPositionType)-1); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -315,7 +328,12 @@ gtk_handle_box_get_property (GObject *object, g_value_set_enum (value, handle_box->handle_position); break; case PROP_SNAP_EDGE: - g_value_set_enum (value, handle_box->snap_edge); + g_value_set_enum (value, + (handle_box->snap_edge == -1 ? + GTK_POS_TOP : handle_box->snap_edge)); + break; + case PROP_SNAP_EDGE_SET: + g_value_set_boolean (value, handle_box->snap_edge != -1); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -819,7 +837,11 @@ gtk_handle_box_set_snap_edge (GtkHandleBox *handle_box, if (handle_box->snap_edge != edge) { handle_box->snap_edge = edge; + + g_object_freeze_notify (G_OBJECT (handle_box)); g_object_notify (G_OBJECT (handle_box), "snap_edge"); + g_object_notify (G_OBJECT (handle_box), "snap_edge_set"); + g_object_thaw_notify (G_OBJECT (handle_box)); } } -- 2.43.2