[glibmm] propertyproxy_base: Fix using notify w/o prop name



commit 4f1e7af1ffc1a67f6da1795e5061c6a4840b7633
Author: Daniel Boles <dboles src gnome org>
Date:   Wed Jun 3 08:39:47 2020 +0100

    propertyproxy_base: Fix using notify w/o prop name
    
    GLib has now specified that if you want to connect to a signal without a
    detail argument, you omit the `::`. So, glibmm users previously
    connecting to `notify::` to listen for changes to all properties broke.
    Fix that by only passing `notify` i.e. no superfluous `::` in that case.
    
    Close https://gitlab.gnome.org/GNOME/glibmm/-/issues/74
    Close https://gitlab.gnome.org/GNOME/glibmm/-/merge_requests/35

 glib/glibmm/propertyproxy_base.cc | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/glib/glibmm/propertyproxy_base.cc b/glib/glibmm/propertyproxy_base.cc
index d473c63e..bc643498 100644
--- a/glib/glibmm/propertyproxy_base.cc
+++ b/glib/glibmm/propertyproxy_base.cc
@@ -39,12 +39,21 @@ PropertyProxyConnectionNode::PropertyProxyConnectionNode(sigc::slot_base&& slot,
 {
 }
 
+static Glib::ustring
+get_detailed_signal_name(const Glib::ustring& signal_name, const Glib::ustring& detail)
+{
+  if (detail.empty())
+    return signal_name;
+
+  return signal_name + "::" + detail;
+}
+
 sigc::connection
 PropertyProxyConnectionNode::connect_changed(const Glib::ustring& property_name)
 {
   // connect it to glib
   // 'this' will be passed as the data argument to the callback.
-  const Glib::ustring notify_signal_name = "notify::" + property_name;
+  const Glib::ustring notify_signal_name = get_detailed_signal_name("notify", property_name);
   connection_id_ = g_signal_connect_data(object_, notify_signal_name.c_str(),
     (GCallback)(&PropertyProxyConnectionNode::callback), this,
     &PropertyProxyConnectionNode::destroy_notify_handler, G_CONNECT_AFTER);


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