summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2018-07-04 00:52:21 +0200
committerMatthias Clasen <mclasen@redhat.com>2018-07-12 13:02:42 +0200
commit59c2efbcd63835854ccd405a0151f6e4def01f2e (patch)
tree6cd757423dfed5a3576d747206f4d0a4e88574db
parent94af080fb693c4dba24237d88fc7527e257f3503 (diff)
downloadgtk+-59c2efbcd63835854ccd405a0151f6e4def01f2e.tar.gz
Add a GdkDrag::actions property
To go along the GdkDrop::actions property.
-rw-r--r--gdk/gdkdrag.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/gdk/gdkdrag.c b/gdk/gdkdrag.c
index c79f1ef0f3..63c76153f7 100644
--- a/gdk/gdkdrag.c
+++ b/gdk/gdkdrag.c
@@ -246,6 +246,13 @@ gdk_drag_set_property (GObject *gobject,
}
break;
+ case PROP_ACTIONS:
+ {
+ GdkDragAction actions = g_value_get_flags (value);
+ gdk_drag_set_actions (drag, actions, drag->suggested_action);
+ }
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@@ -282,6 +289,10 @@ gdk_drag_get_property (GObject *gobject,
g_value_set_flags (value, drag->selected_action);
break;
+ case PROP_ACTIONS:
+ g_value_set_flags (value, drag->actions);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@@ -382,6 +393,15 @@ gdk_drag_class_init (GdkDragClass *klass)
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY);
+ properties[PROP_ACTIONS] =
+ g_param_spec_flags ("actions",
+ "Actions",
+ "The possible actions",
+ GDK_TYPE_DRAG_ACTION,
+ 0,
+ G_PARAM_READWRITE |
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_EXPLICIT_NOTIFY);
/**
* GdkDrag::cancel:
* @drag: The object on which the signal is emitted
@@ -593,8 +613,14 @@ gdk_drag_set_actions (GdkDrag *drag,
GdkDragAction actions,
GdkDragAction suggested_action)
{
- drag->actions = actions;
drag->suggested_action = suggested_action;
+
+ if (drag->actions == actions)
+ return;
+
+ drag->actions = actions;
+
+ g_object_notify_by_pspec (G_OBJECT (drag), properties[PROP_ACTIONS]);
}
void