summaryrefslogtreecommitdiff
path: root/glib/glibmm/object.cc
Commit message (Collapse)AuthorAgeFilesLines
* Glib: NodeTree etc.: Use callback functions with C linkageKjell Ahlstedt2023-04-021-0/+16
| | | | | | | | | | | | | * glib/glibmm/class.cc: Use glibmm_custom_[get|set]_property_callback(). * glib/glibmm/object.[cc|h]: Add set_data_with_c_callback(). Don't call g_object_set_qdata_full() with a function with C++ linkage, if GLIBMM_CAN_ASSIGN_NON_EXTERN_C_FUNCTIONS_TO_EXTERN_C_CALLBACKS is defined. * glib/glibmm/property.[cc|h]: Declare some local functions extern "C". Add glibmm_custom_[get|set]_property_callback(). * glib/src/nodetree.[ccg|hg]: Add glibmm_NodeTree_c_callback_[traverse|foreach]() and struct NodeTreeCallback[Traverse|Foreach]Data. Part of issue #1
* Update the Free Software Foundation address in copyright noticesKjell Ahlstedt2017-08-301-2/+1
| | | | Bug 786824
* ConstructParams: Do not increment allocation size twiceDaniel Elstner2017-05-091-2/+3
|
* Remove Glib::WeakRefMurray Cumming2017-04-071-22/+0
| | | | | | | | | | | Now that RefPtr is really a std::shared_ptr<>, we should use std::weak_ref<> instead. Note that a std::weak_ptr<> tells you nothing about whether the underlying GObject is still alive, which Glib::RefPtr did. It just tells you whether our std::shared_ptr<> still holds a reference to it. That's why I removed one of the checks in tests/giomm_listmodel/main.cc.
* ConstructParams: Remove copy constructor.Murray Cumming2017-04-061-27/+0
| | | | | I doubt that this is really necessary with C++11. Please file a bug if this causes a real compilation problem.
* Object: Use g_object_new_with_properties().Murray Cumming2017-04-041-24/+36
| | | | | | | Instead of (deprecated) g_object_newv() and (deprecated) GParameter. This seems to work. It is meant to be the simplest possible change. I would like to translate this code properly to C++ now that I've noticed it.
* Object construction: Add custom class init and instance init functionsKjell Ahlstedt2017-02-151-9/+9
| | | | | | | 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-4/+9
| | | | | | | 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-26/+4
| | | | | | | | | | | | | | | | | | * 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-81/+85
|
* 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-12/+14
| | | | | | 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-3/+3
|
* ObjectBase, Object, Interface: Fix move constructors and move assignmentsKjell Ahlstedt2015-10-311-4/+6
| | | | | | | | | | | | | | | | * 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.
* Make destructors explicitly noexcept.Murray Cumming2015-08-311-2/+2
| | | | | Destructors are already noexcept, but this makes that even clearer. This might be foolish.
* Object: Move constructor: Use initialize_move().Murray Cumming2015-08-221-2/+4
| | | | | Because the call to the ObjectBase move constructor will not actually happen. See the comment for the previous commit.
* 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-2/+2
|
* Add interfaces to custom types before class_init.Kjell Ahlstedt2013-08-011-3/+29
| | | | | | | | | | | | | | | | | | | | | * 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.
* 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
* Clean up glib includes (Bug #563987)Jonathon Jongsma2008-12-101-1/+0
| | | | svn path=/trunk/; revision=749
* Include string.h to fix the build with SUN CC. Bug #498438.Tim Mooney2008-03-101-0/+2
| | | | | | | | | | 2008-03-10 Tim Mooney <murrayc@murrayc.com> * glib/glibmm/object.cc: Include string.h to fix the build with SUN CC. Bug #498438. svn path=/trunk/; revision=639
* fix build issue when using gcc4.3 (#498438)Sebastien Bacher2007-11-201-0/+1
| | | | | | | | | 2007-11-20 Sebastien Bacher <seb128@ubuntu.com> * glib/glibmm/object.cc: fix build issue when using gcc4.3 (#498438) svn path=/trunk/; revision=465
* Clean up the code a bit. (get_application_name): Remove the code thatDaniel Elstner2007-01-201-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * glib/glibmm/miscutils.cc: Clean up the code a bit. (get_application_name): Remove the code that checked the string for valid UTF-8, and attempted conversion if not valid. I must have been on crack when I wrote this, as the combination of conditions that would cause the string to be invalid UTF-8 is quite unlikely. If this is a valid concern at all, it should be filed as a GLib bug and not worked around in glibmm. (build_filename(const std::string&, const std::string&)): Just call the plain g_build_filename() instead of building a temporary array and passing that via ArrayHandle to the build_filename() overload for containers. (build_path): Remove the already deactivated custom implementation from the time before g_build_pathv() was added to GLib. * glib/glibmm/object.{cc,h}: Improve/fix a couple of comments. (ConstructParams::ConstructParams): Add G_GNUC_NULL_TERMINATED function attribute to make the compiler complain if the variadic argument list is not terminated by a NULL pointer. * glib/glibmm/ustring.{cc,h} (utf8_find_last_of): Avoid applying bitwise logical operators directly to (possibly signed) operands of char type. In order to avoid relying on implementation-defined behavior, make sure that the operands are of unsigned integer type. (ustring::is_ascii): Likewise, (ustring_Iterator<T>::operator--): Likewise. (get_unichar_from_std_iterator): De-obfuscate this highly optimized piece of code, as the current stable release of GCC (4.1.2-pre on my system) generates better assembler output without the voodoo. svn path=/trunk/; revision=369
* Spring cleaning. ditto.Daniel Elstner2004-06-201-21/+16
| | | | | * glib/glibmm/objectbase.cc: Spring cleaning. * glib/glibmm/object.cc: ditto.
* :ConstructParams): Implement the copy constructor in a way that actuallyDaniel Elstner2004-05-131-10/+18
| | | | | | * glib/glibmm/object.{cc,h} (ConstructParams::ConstructParams): Implement the copy constructor in a way that actually works if used. Relying on the compiler to optimize it away is a bad idea. (#132300)
* Remove the parent get_type() call from the Class::init() function, becauseMurray Cumming2004-03-131-0/+10
| | | | | | | | | | | | | 2004-03-13 Murray Cumming <murrayc@murrayc.com> * tools/m4/class_shared.m4: Remove the parent get_type() call from the Class::init() function, because it is optimised away, and g++ 3.4 actually complains that it does nothing. * glib/glibmm/object.[h|cc]: Add a public ConstructParams copy constructor, needed by g++ 3.4. See comments in the code. * tests/glibmm_value/glibmm_value.cc: Instantiate instances of value types, to fix the g++ 3.4 build. I don't know what the code was meant to do before anyway.
* Object::Object() default constructor. Remove the warning because we reallyMurray Cumming2004-01-121-3/+25
| | | | | | | | | | | 2004-01-12 Murray Cumming <murrayc@usa.net> * glib/glibmm/object.cc: Object::Object() default constructor. Remove the warning because we really need this to implement a custom TreeModel. Derive a new GType, as in the Object::Object(ConstructParams) constructor. Like that constructor, the default one also assumes that you have called a suitable ObjectBase constructor, such as ObejctBase(typeid(MyCustomClass)).
* Now uses ObjectBase instead of Object, because glib can now haveMurray Cumming2003-11-011-10/+0
| | | | | | | | | | | | | | | 2003-11-01 Murray Cumming <murrayc@usa.net> * glib/glibmm/propertyproxy.h, propertyproxy_base.[h|cc]: Now uses ObjectBase instead of Object, because glib can now have properties on interfaces. This is needed, for instance, by the GtkFileChooser interface wrapper in gtkmm. * glib/glibmm/object.h: Moved get/set_property() methods into ObjectBase, for the same reason. * tools/pm/WrapParser.pm, Output.pm: Added optional no_default_handler parameter to gmmproc _WRAP_SIGNAL() macro, for signals whose default signal handler is not in the klass struct and therefore can not be overridden.
* Initial revisionMurray Cumming2003-01-071-0/+287