summaryrefslogtreecommitdiff
path: root/glib/glibmm/interface.cc
Commit message (Collapse)AuthorAgeFilesLines
* Add and use make_refptr_for_instance().Murray Cumming2017-04-051-1/+1
|
* Object construction: Add custom class init and instance init functionsKjell Ahlstedt2017-02-151-4/+3
| | | | | | | Make it possible for named custom types to register additions to the class init function and to register an instance init function. An extra class init function is useful in Gtk::WidgetCustomDraw and Gtk::WidgetCustomSnapshot. Bug 775348
* Glib::ObjectBase: Use std::forward_list for interface class pointersKjell Ahlstedt2016-11-251-1/+2
| | | | | | | std::forward_list is ideally suited for storing pointers to the interfaces of custom types. The list is often empty, never long. No need to use a pointer to a container in order to save storage space (as I did in the previous commit). An empty std::forward_list consists of nothing but a pointer.
* Glib::ObjectBase: Replace extra_object_base_data map by instance dataKjell Ahlstedt2016-11-241-3/+2
| | | | | | | | | | | | | | | | | | * glib/glibmm/class.[cc|h]: Remove the clone_custom_type() overload without an interface_class_vector_type argument. * glib/glibmm/interface.cc: * glib/glibmm/object.cc: * glib/glibmm/objectbase.[cc|h]: Replace the std::map containing ExtraObjectBaseData with instance data in ObjectBase. The map was just a way of avoiding an ABI break, but now we can break ABI. The new data is a std::unique_ptr<Class::interface_class_vector_type> rather than a Class::interface_class_vector_type. It's a vector which is used only during a short period during object construction, and only for custom objects. With a pointer to the vector, it need not be created for the majority of objects, and if it is created, it can be deleted when it's no longer needed. * gio/src/application.ccg: * glib/glibmm/main.cc: Add #include <mutex> that should have been there before, but now became necessary, when it was removed from objectbase.h.
* Run clang-format on glib .cc files.Murray Cumming2016-02-261-41/+46
|
* C++11: Use emplace_back() instead of push_back().Murray Cumming2016-02-051-2/+2
|
* Remove now-unnecessary includes of glibmm/threads.h.Murray Cumming2015-11-271-1/+0
|
* ObjectBase: Change extra_object_base_data_mutex to a std::mutex.Murray Cumming2015-11-261-1/+1
| | | | | | Instead of a (now deprecated) Glib::Threads::Mutex*. As discussed here: https://bugzilla.gnome.org/show_bug.cgi?id=757674#c12
* Glib: More nullptr instead of 0.Murray Cumming2015-11-201-2/+2
|
* ObjectBase, Object, Interface: Fix move constructors and move assignmentsKjell Ahlstedt2015-10-311-8/+12
| | | | | | | | | | | | | | | | * glib/glibmm/interface.cc: Don't call ObjectBase's move assignment operator from Interface's move assignment operator. * glib/glibmm/object.cc: Perform of job of sigc::trackable's move constructor in Object's move constructor. * glib/glibmm/objectbase.cc: Move constructor: Set gobject_ = nullptr. Fix the assignment of cpp_destruction_in_progress_. Move assignment: Add self-assignment guard. Avoid the risk of accidentally deleting *this. Let a call to initialize_move() do most of the job. * tests/glibmm_interface_move/main.cc: * tests/glibmm_object_move/main.cc: * tests/glibmm_objectbase_move/main.cc: Really test move assignment. Test that the wrapped C object has been moved, and not copied. Bug #756962.
* Interface: Make move operations noexcept.Murray Cumming2015-08-311-2/+2
|
* Make destructors explicitly noexcept.Murray Cumming2015-08-311-1/+1
| | | | | Destructors are already noexcept, but this makes that even clearer. This might be foolish.
* Interface: Move constructor: Add comment about not calling initialize_move().Murray Cumming2015-08-221-1/+7
| | | | | I am not entirely sure that this is the right thing to do. See my comment in the next commit about the test.
* Glib::ObjectBase, Object, Interface: Add move operators.Murray Cumming2015-08-221-0/+10
| | | | | Add move constructors and move assignment operators so that derived classes can have these too.
* C++11: Use nullptr.Murray Cumming2015-07-161-1/+1
|
* Rename ambiguously named overridden property variable and typePovilas Kanapickas2014-07-071-4/+4
| | | | | | | | | | | * glib/glibmm/class.[cc|h]: * glib/glibmm/interface.cc: * glib/glibmm/property.cc: Rename properties_quark and properties_type to iface_properties_quark and iface_properties_type. As custom_[set|get]_property_callback() in property.cc also sets and gets user-defined properties, this naming choice may be confusing. These names are intended for use by glibmm only. Renaming is not an ABI/API break. Bug #731484.
* Fix tiny typo in commitMurray Cumming2014-03-041-1/+1
|
* Add interfaces to custom types before class_init.Kjell Ahlstedt2013-08-011-36/+42
| | | | | | | | | | | | | | | | | | | | | * glib/glibmm/class.[h|cc]: Add a clone_custom_type() overload that takes a vector of pointers to Interface_Class instances, so we can call their add_interface() functions on the GType just after registering it, but before instantiating the first GObject. custom_class_init_function(): Override properties of implemented interfaces that have not been overridden in a base class. * glib/glibmm/interface.cc: Interface::Interface(const Interface_Class& interface_class): If the GObject has not been instantiated yet, then add interface_class to the Class::custom_interface_classes vector. * glib/glibmm/objectbase.[h|cc]: Add extra_object_base_data and extra_object_base_data_mutex. * glib/glibmm/objectbase.cc: ~ObjectBase(): Erase 'this' from extra_object_base_data. * glib/glibmm/object.cc: Default constructor and Object::Object(const Glib::ConstructParams& construct_params): Pass the list of Interface_Class pointers to the new Class::clone_custom_type() method overload. Bug #697229.
* Custom Interface Properties: Use base finalize function to free data.José Alburquerque2013-05-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | * glib/glibmm/class.cc (Class::clone_custom_type): Specify a custom base finalize function for the custom type which would free the properties data that might exist due to properties of implemented interfaces being overridden. This is better than having an interface finalize function because the custom type could implement several interfaces which would mean that the interface finalize function would execute more than once as opposed to just once for the base finalize function. * glib/glibmm/class.h (Class::interface_finalize_function): Replace with Class::custom_class_base_finalize_function(). * glib/glibmm/interface.cc (Interface_Class::add_interface): Do not specify a custom interface finalize function. (Interface::Interface(const Interface_Class&): Also initialize the property GValues using g_param_value_set_default() so that they are initialized with the default values of the properties and not just the default value of the GValue type. Bug #697229.
* Interface: Add a comment about overriding properties in constructor.José Alburquerque2013-04-251-0/+2
| | | | | | * glib/glibmm/interface.cc (Interface(onst Interface_Class&)): Explain what is happening with the lines that override the properties of the implemented interface, if any, for a custom type.
* Custom Interfaces: Implement derived interface properties in present.José Alburquerque2013-04-221-4/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * glib/glibmm/class.cc (Class::properties_quark): Initialize this GQuark which is used to store/get the data used for setting and getting the properties of the interfaces that a custom type overrides. (Class::interface_finalize_function): Add this function which once invoked frees the property data stored as gqata in the GType and allocated/appended to in the Glib::Interface constructor below. * glib/glibmm/class.h: Declare the interface_finalize_function above. Also declare the quark used to store/get the property data and the typedef data type of the property data. * glib/glibmm/interface.cc (Interface_Class::add_interface): Specify a custom interface finalize function when adding the interface so that the resources allocated for handling the derived interface properties can be freed if the type is a custom interface type. (Interface::Interface(const Interface_Class&)): Modify the constructor so that when dealing with a custom interface type, it gets a list of the properties of the interface to be added and overrides these by appending approperiate GValues to the data used to handle getting/setting properties that is stored as qdata in the GType. The constructor uses g_param_spec_overrided() to override the properties of the implemented interface and g_object_install_property() to install the properties. * glib/glibmm/property.cc (PropertyBase::install_property): Rewrite this method so that the acquired generated id's of custom implemented properties does not collide with the id's of properties of implemented interfaces that have been overridden in a custom type. This is done by offsetting the acquired generated id (by addition) with the number of already existing properties (the ones that have been overridden). (custom_get_property_callback): Rewrite this function (which gets properties for custom types) so that if the property id is less than or equal to the number of overridden interface properties (which would mean that an overridden interface property should be gotten) the correct overridden interface property is gotten. Otherwise, a custom property should be retrieved, in which case the id is offset (by subtraction) when the PropertyBase is retrieved from the id which would ensure getting the correct PropertyBase. (custom_set_property_callback): Rewrite this function as the above custom_get_property_callback was rewritten.
* Interface: Fix a small typo.José Alburquerque2013-04-081-2/+1
| | | | * glib/glibmm/interface.cc:
* Gio::TlsClientConnection: Make the class work correctly.José Alburquerque2013-04-071-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * tools/m4/class_interface.m4 (_CUSTOM_CTOR_CAST): Add a new macro so that classes wrapped by the _CLASS_INTERFACE() macro can implement a custom cast constructor. This is so that classes like Tls[Client|Server]Connection, that derive from Glib::Interface but should also derive from a Glib::Object derived type, though they do not do so in the C API, don't produce warnings from an attempt to set the non-existent properties of the GObject derived type when an attempt to construct the C object is made in the default Glib::Object constructor. Glib::wrap_auto_interface<>(), which is called by Glib::wrap() for interfaces, uses the cast constructor to create the wrapper which calls the cast constructor of Glib::Interface. If the Glib::Object derived base class of the wrapper has a default constructor, that constructor is then called which leads to the Glib::Object default constructor being called, which tries to construct the C object and set its properties thus producing the property setting warnings. A custom cast constructor can chain up to the cast constructor of the Glib::Object derived type thus avoiding the call to the Glib::Object default constructor and the non-existent property setting warnings. * glib/glibmm/interface.cc: * glib/glibmm/interface.h (Interface): Add a default constructor so that in the cases above (when the cast constructor of the Glib::Object's derived type is used), the compiler can find a Glib::Interface default constructor to use. Using the Glib::Interface cast constructor as well as the cast constructor of the Glib::Object derived type would cause "ObjectBase::initialize() called twice for the same GObject" errors.
* Change license header to mention Lesser General Public License version 2.1Deng Xiyue2009-01-191-4/+4
| | | | | | | | | | 2009-01-20 Deng Xiyue <manphiz@gmail.com> * Change license header to mention Lesser General Public License version 2.1 instead of Library General Public License, to be consistent with COPYING. svn path=/trunk/; revision=779
* 2.6.1:Murray Cumming2005-03-071-3/+4
| | | | | | | | 2005-03-07 Murray Cumming <murrayc@murrayc.com> * glib/glibmm/interface.cc: Disable the new check for pre-existing interface implementations, because it checks all base gtypes and not just the current gtype. Bug #169442 by Bryan Forbes.
* Interface_Class:add_interface(), used by add_interface() methods ofMurray Cumming2005-02-181-6/+9
| | | | | | | | | 2005-02-18 Murray Cumming <murrayc@murrayc.com> * glib/glibmm/interface.cc: Interface_Class:add_interface(), used by add_interface() methods of Interfaces: Do not add interfaces that have been added before, to avoid the warning from glib. This allows application code to be simpler.
* Initial revisionMurray Cumming2003-01-071-0/+91