[beast: 1/47] BSE: export ObjectImpl.uname property



commit 79d1e20da915342531d081c63329d6bcbdcb67a2
Author: Tim Janik <timj gnu org>
Date:   Thu Mar 30 02:03:32 2017 +0200

    BSE: export ObjectImpl.uname property
    
    Signed-off-by: Tim Janik <timj gnu org>

 bse/bseapi.idl   |    1 +
 bse/bseobject.cc |   18 ++++++++++++++++++
 bse/bseobject.hh |    6 ++++--
 3 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/bse/bseapi.idl b/bse/bseapi.idl
index 942ee39..8573614 100644
--- a/bse/bseapi.idl
+++ b/bse/bseapi.idl
@@ -460,6 +460,7 @@ sequence TrackPartSeq;
 
 /// Fundamental base type for all BSE objects.
 interface Object {
+  String      uname      = String ("UName", "Unique object name", GUI);
   String      debug_name (); ///< Object name useful for debugging output.
   int64       proxy_id   (); ///< Retrieve the BseObject proxy ID for an Object.
   signal void changed    (String what); ///< Notification for object state or property changes.
diff --git a/bse/bseobject.cc b/bse/bseobject.cc
index 44c66c1..31f83ac 100644
--- a/bse/bseobject.cc
+++ b/bse/bseobject.cc
@@ -48,6 +48,24 @@ ObjectImpl::changed (const String &what)
   sig_changed.emit (what);
 }
 
+std::string
+ObjectImpl::uname () const
+{
+  BseObject *object = *const_cast<ObjectImpl*> (this);
+  gchar *gstring = NULL;
+  g_object_get (object, "uname", &gstring, NULL);
+  std::string u = gstring ? gstring : "";
+  g_free (gstring);
+  return u;
+}
+
+void
+ObjectImpl::uname (const std::string &newname)
+{
+  BseObject *object = *this;
+  g_object_set (object, "uname", newname.c_str(), NULL);
+}
+
 void
 objects_debug_leaks ()
 {
diff --git a/bse/bseobject.hh b/bse/bseobject.hh
index 25f0953..3bf1035 100644
--- a/bse/bseobject.hh
+++ b/bse/bseobject.hh
@@ -11,12 +11,14 @@ class ObjectImpl : public virtual ObjectIface, public virtual DataListContainer
 public:
   explicit               ObjectImpl (BseObject*);
   virtual               ~ObjectImpl ();
-  virtual std::string    debug_name () override;
-  virtual int64_t        proxy_id   () override;
   void                   changed    (const String &what);
   operator               BseObject* ()          { return gobject_; }
   // template<class BseObjectPtr> BseObjectPtr as (); // provided by ObjectIface
   virtual BseObject*  as_bse_object () override { return gobject_; }
+  virtual std::string    debug_name () override;
+  virtual int64_t        proxy_id   () override;
+  virtual std::string    uname      () const;
+  virtual void           uname      (const std::string &newname);
 };
 typedef std::shared_ptr<ObjectImpl> ObjectImplP;
 


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