diff --git a/gobject/gsignal.c b/gobject/gsignal.c
index 9208b6e..01456de 100644
--- a/gobject/gsignal.c
+++ b/gobject/gsignal.c
@@ -2097,6 +2097,27 @@ g_signal_get_invocation_hint (gpointer instance)
   return emission ? &emission->ihint : NULL;
 }
 
+static void
+signal_diagnostics (const gchar* detailed_signal,
+                    GSignalFlags flags)
+{
+  static gchar* enable_diagnostic = NULL;
+
+  if (G_UNLIKELY (!enable_diagnostic))
+    {
+      enable_diagnostic = g_getenv ("G_ENABLE_DIAGNOSTIC");
+      if (!enable_diagnostic)
+        enable_diagnostic = "0";
+    }
+  if (enable_diagnostic[0] == '1')
+    {
+      if (flags & G_SIGNAL_DEPRECATED)
+        g_warning ("The signal \"%s\" is deprecated and shouldn't be used "
+                   "anymore. It will be removed in a future version.",
+                   detailed_signal);
+    }
+}
+
 /**
  * g_signal_connect_closure_by_id:
  * @instance: the instance to connect to.
@@ -2128,6 +2149,7 @@ g_signal_connect_closure_by_id (gpointer  instance,
   node = LOOKUP_SIGNAL_NODE (signal_id);
   if (node)
     {
+      signal_diagnostics ("", node->flags);
       if (detail && !(node->flags & G_SIGNAL_DETAILED))
 	g_warning ("%s: signal id `%u' does not support detail (%u)", G_STRLOC, signal_id, detail);
       else if (!g_type_is_a (G_TYPE_FROM_INSTANCE (instance), node->itype))
@@ -2186,6 +2208,7 @@ g_signal_connect_closure (gpointer     instance,
     {
       SignalNode *node = LOOKUP_SIGNAL_NODE (signal_id);
 
+      signal_diagnostics (detailed_signal, node->flags);
       if (detail && !(node->flags & G_SIGNAL_DETAILED))
 	g_warning ("%s: signal `%s' does not support details", G_STRLOC, detailed_signal);
       else if (!g_type_is_a (itype, node->itype))
@@ -2255,6 +2278,7 @@ g_signal_connect_data (gpointer       instance,
     {
       SignalNode *node = LOOKUP_SIGNAL_NODE (signal_id);
 
+      signal_diagnostics (detailed_signal, node->flags);
       if (detail && !(node->flags & G_SIGNAL_DETAILED))
 	g_warning ("%s: signal `%s' does not support details", G_STRLOC, detailed_signal);
       else if (!g_type_is_a (itype, node->itype))
diff --git a/gobject/gsignal.h b/gobject/gsignal.h
index d612901..ffda29a 100644
--- a/gobject/gsignal.h
+++ b/gobject/gsignal.h
@@ -108,6 +108,10 @@ typedef gboolean (*GSignalAccumulator)	(GSignalInvocationHint *ihint,
  *  of as object methods which can be called generically by 
  *  third-party code.
  * @G_SIGNAL_NO_HOOKS: No emissions hooks are supported for this signal.
+ * @G_SIGNAL_DEPRECATED: The signal is deprecated and will be removed
+ *  in a future version. A warning will be generated if it is used
+ *  while running with G_ENABLE_DIAGNOSTIC=1.
+ *  Since: 2.26
  * 
  * The signal flags are used to specify a signal's behaviour, the overall
  * signal description outlines how especially the RUN flags control the
@@ -121,7 +125,8 @@ typedef enum
   G_SIGNAL_NO_RECURSE	= 1 << 3,
   G_SIGNAL_DETAILED	= 1 << 4,
   G_SIGNAL_ACTION	= 1 << 5,
-  G_SIGNAL_NO_HOOKS	= 1 << 6
+  G_SIGNAL_NO_HOOKS	= 1 << 6,
+  G_SIGNAL_DEPRECATED   = 1 << 7
 } GSignalFlags;
 /**
  * G_SIGNAL_FLAGS_MASK:
