Using G_STRLOC ends up embedding unique strings of the form
__FILE__:__LINE__ in the compiled binary. We can avoid these
by passing __FILE__ and __LINE__ separately when constructing
the warning text.
This probably reduces the size of the binary as __FILE__ is
likely already contained as string otherwise.
Note that for GCC 2.x this changes behavior because G_STRLOC
also contained __PRETTY_FUNCTION__.
https://bugzilla.gnome.org/show_bug.cgi?id=741654
Along the same lines as g_clear_object(), g_set_object() is a
convenience function to update a GObject pointer, handling reference
counting transparently and correctly.
Specifically, it handles the case where a pointer is set to its current
value. If handled naïvely, that could result in the object instance
being finalised. In the following code, that happens when
(my_obj == new_value) and the object has a single reference:
g_clear_object (&my_obj);
my_obj = g_object_ref (new_value);
It also simplifies boilerplate code such as set_property()
implementations, which are otherwise long and boring.
Test cases included.
https://bugzilla.gnome.org/show_bug.cgi?id=741589
g_type_is_fundamentally_a (see bug 730984) is a new API/ABI and is
marked with a version macro. We should therefore avoid its
unconditional use from G_IS_OBJECT() and G_IS_PARAM_SPEC() which are
APIs that have been around for a long time.
This prevents deprecation warnings from being emitted when these
functions are used with an older GLIB_VERSION_MAX_ALLOWED and also
prevents linking to the new ABI in that case (so that it's possible to
use the resulting binary with an older version of GLib).
https://bugzilla.gnome.org/show_bug.cgi?id=731335
Back in the far-off twentieth century, it was normal on unix
workstations for U+0060 GRAVE ACCENT to be drawn as "‛" and for U+0027
APOSTROPHE to be drawn as "’". This led to the convention of using
them as poor-man's ‛smart quotes’ in ASCII-only text.
However, "'" is now universally drawn as a vertical line, and "`" at a
45-degree angle, making them an `odd couple' when used together.
Unfortunately, there are lots of very old strings in glib, and also
lots of new strings in which people have kept up the old tradition,
perhaps entirely unaware that it used to not look stupid.
Fix this by just using 'dumb quotes' everywhere.
https://bugzilla.gnome.org/show_bug.cgi?id=700746
Add the GLIB_AVAILABLE_IN_ALL annotation to all old functions (that
haven't already been annotated with the GLIB_AVAILABLE_IN_* macros or a
deprecation macro).
If we discover in the future that we cannot use only one macro on
Windows, it will be an easy sed patch to fix that.
https://bugzilla.gnome.org/show_bug.cgi?id=688681
At least GDBus had code that had "_object" as a parameter to one of
its functions, but this clashes with the GObject macro
G_OBJECT_WARN_INVALID_PROPERTY_ID() which created a local "_object".
Since many of us cargo cult around copies of objects, let's be
defensive here and use local variable names less likely to clash with
application code.
https://bugzilla.gnome.org/show_bug.cgi?id=689377
Since we added g_object_notify_by_pspec(), an efficient way to install
and notify properties relies on storing the GParamSpec pointers inside
a static arrays, like we do for signal identifiers.
Instead of multiple calls to g_object_class_install_property(), we
should have a single function to take the static array of GParamSpecs
and iterate it.
https://bugzilla.gnome.org/show_bug.cgi?id=626919
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
g_object_notify_by_pspec() will emit the "notify" signal on the given
pspec, short-circuiting the hash table lookup needed by
g_object_notify(). The suggested and documented way of using
g_object_notify_by_pspec() is similar to the way of emitting signals
with their ID.
Emission tests (with no handler attached to the notify signal) show a
10-15% speedup over using g_object_notify().
https://bugzilla.gnome.org/show_bug.cgi?id=615425
2008-08-21 Johan Dahlin <johan@gnome.org>
* gobject.h:
Mark g_object_get_type function as const, it's
a fundamental type and can safely marked as const,
as opposed to traditionally *_get_type functions.
svn path=/trunk/; revision=7378
* docs/reference/gobject/tmpl/gobject-unused.sgml:
* gobject/gobject.h:
* gobject/gtype.c:
* gobject/gtype.h:
Move some content for gobject-unused.sgml and cleared empty entries.
The remaining 4 ones should be checked by some else. If they are not
needed. The file can be removed.
svn path=/trunk/; revision=7087
Tue Apr 3 12:34:14 2007 Tim Janik <timj@gtk.org>
* gobject.[hc]: invoke GObjectClass.constructed() only for newly
constructed objects, and invoke it while the notify queue is
still being frozen, after all CONSTRUCT* properties have been
set and before random other properties are being set.
* applied modified patch from Ryan Lortie to implement
GObjectClass.constructed() to fix#425324.
2007-04-02 Ryan Lortie <desrt@desrt.ca>
* gobject/gobject.h: Add 'constructed' vcall to GObjectClass.
* gobject/gobject.c (g_object_newv): call ->constructed() as last
step of object construction.
svn path=/trunk/; revision=5441
Wed Aug 23 10:35:32 2006 Tim Janik <timj@gtk.org>
* gobject.[hc]: changed return value of g_value_dup_object(), fixes#343292.
2006-08-23 Sven Neumann <sven@gimp.org>
* gobject/glib-genmarshal.[c1]: added new command-line option
"--internal" that can be used to let glib-genmarshal generate
internal functions using the G_GNUC_INTERNAL attribute (bug #346647).
2006-01-18 Matthias Clasen <mclasen@redhat.com>
* gobject.h: Make g_object_compat_control() visible
for GTK+ compilation, to avoid segfaults on 64bit
platforms.
Thu Dec 22 14:59:24 2005 Tim Janik <timj@imendio.com>
* gvaluetypes.[hc]: implemented G_TYPE_GTPYE. applied patch
from matthias which implements GType accessors for GValue.
* gparamspecs.[hc]: applied patch from matthias which
implements G_TYPE_PARAM_GTYPE.
* gobject.[hc]:
GUnowned: introduced a new object type that has an initially
floating reference.
g_object_compat_control(): allow setting of a floating flag handler.
Wed Nov 23 18:01:46 2005 Tim Janik <timj@imendio.com>
* gobject.[hc]: added floating reference count.
g_object_is_floating():
g_object_ref_sink(): new functions to deal with floating references.
g_object_force_floating(): new funciton for object implementations
to set the floating flag.
* gobject.c (g_object_init): make objects initially floating.
Wed Nov 23 17:58:13 2005 Tim Janik <timj@gtk.org>
* gparam.[hc]: added g_param_spec_ref_sink().
Mon Aug 1 23:00:42 2005 Tim Janik <timj@imendio.com>
* gclosure.c: turned all modifications to the first 32 integer bits in a
closure into atomic accesses. wrapped write accesses into special macros
to keep the atomic modification logic in a single place. comment cleanups.
* gclosure.h: made all atomicly accessed closure fields volatile.
* gobject.h: made ref_count field volatile.
2005-07-11 Matthias Clasen <mclasen@redhat.com>
* gobject.h:
* gobject.symbols: Remove G_GNUC_NULL_TERMINATED from
g_object_new again, since that makes gcc warn on calls of
the form g_object_new (some_type, NULL)
2005-05-05 Owen Taylor <otaylor@redhat.com>
* gobject.[ch] gobject.symbols: Add
g_object_add/remove_toggle_ref() functions to get notification
when a reference count is the last remaining reference; this
enables better memory management for language bindings.
(http://mail.gnome.org/archives/gtk-devel-list/2005-April/msg00095.html)
2005-05-05 Owen Taylor <otaylor@redhat.com>
* glib/gdataset.[ch] glib/gdatasetprivate.h: Add
g_datalist_set/unset_flags(), g_datalist_get_flags() functions
to squeeze some bits into a GDataSet... this is needed for
efficient implementation of toggle references in GObject.
* tests/gobject/references.c tests/gobject/Makefile.am:
Add a test case for weak and toggle references.
* glib/gfileutils.[ch]: Rename g_file_replace() back
to g_file_set_contents().
* glib/glib.symbols: Update.
2005-05-05 Owen Taylor <otaylor@redhat.com>
* glib/Makefile.am glib/glib-sections.txt gobject/gobject-sections.txt:
Update
* gobject/tmpl/objects.sgml: Document toggle-references.
Tue Oct 14 17:40:19 2003 Owen Taylor <otaylor@redhat.com>
* gparamspecs.[ch]: Add a new GParamSpecOverride type
that is a pointer to a different paramspec in a parent
class or interface.
* gparam.[ch]: Add g_paramspec_get_redirect_target()
which follows GParamSpecOverride to the real property.
Make g_param_spec_pool_list() hand redirections,
properties on interfaces.
* gobject.[ch] gobjectnotifyqueue.c: Add
g_object_interface_install_property,
g_object_interface_find_property,
g_object_interface_list_properties(). Redirect virtually all
publically exposed GParamSpec's to the redirect target if
any. (->constructor is the exception.)
(#105894)
2003-09-12 Matthias Clasen <maclas@gmx.de>
Make the g_value_set_x_take_ownership() functions "official"
part of the API (#100948):
* gvaluetypes.[hc]: Add g_value_take_string() (synonym to the
now deprecated g_value_set_string_take_ownership()).
* gparam.[hc]: Add g_value_take_param() (synonym to the
now deprecated g_value_set_param_take_ownership()).
* gobject.[hc]: Add g_value_take_object() (synonym to the
now deprecated g_value_set_object_take_ownership()).
* gboxed.[hc]: Add g_value_take_boxed() (synonym to the
now deprecated g_value_set_boxed_take_ownership()).
* gobject/gobject-sections.txt: Add new g_value_take_x() functions.
* gobject/tmpl/param_value_types.sgml: Document new g_value_take_x()
functions. (#100948)
Sun Feb 16 22:08:48 2002 Tim Janik <timj@gtk.org>
* gobject.[hc]:
* gparam.[hc]: provide marshaller specific value_set_*_take_ownership()
variants.
* gvalue.h: shrink GValue's data contents to 2 unions.
* glib-genmarshal.c: fix release and realeas_check hackage by always
using _take_ownership() variants. directly access value contents if
G_ENABLE_DEBUG is not defined.
* gobject.h: add padding pointers to the class struct.
Mon Nov 19 14:35:56 2001 Owen Taylor <otaylor@redhat.com>
* *.h: Improve the detection of invalid includes by moving
the test outside the duplicate include guards.
* gsourceclosure.c (g_source_set_closure): Doc fix.
Sat Nov 17 14:10:35 2001 Owen Taylor <otaylor@redhat.com>
* glib/gbsearcharray.h: Include gtypes.h not gobject/gtype.h
* glib/glib-object.h gobject/*.h: Prevent headers from
being included directly except when compiling GObject.
* gobject/gvaluecollector.h: Include glib-object.h so that
this file can be included directly, since we don't
include it _from_ glib-object.h.
* gobject/gtype.c: Remove struct _GValue hack since we
now include glib/gvaluecollector.h which simply pulls in
glib-object.h.
Mon Sep 10 20:31:37 2001 Tim Janik <timj@gtk.org>
* gobject.[hc]: removed extraneous GObject* returns from a
couple functions that are very unlikely to be used in nested.
changed gpointer->GObject* for a couple return values/arguments.
this fixes#50206.