| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
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/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.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Instead of a (now deprecated) Glib::Threads::Mutex*.
As discussed here:
https://bugzilla.gnome.org/show_bug.cgi?id=757674#c12
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
|
|
|
|
| |
Destructors are already noexcept, but this makes that even clearer.
This might be foolish.
|
|
|
|
|
| |
I am not entirely sure that this is the right thing to do.
See my comment in the next commit about the test.
|
|
|
|
|
| |
Add move constructors and move assignment operators so that derived
classes can have these too.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
| |
* glib/glibmm/interface.cc:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|