Commit Graph

826 Commits

Author SHA1 Message Date
Benjamin Otte
67740263e9 gobject: Cast token type to guint to avoid gcc warning
The usual fix for all things GScanner...
2010-12-02 20:11:28 +01:00
Jonas Holmberg
dec8323b4b gobject: added property test
Added test for setting properties with g_object_new.
2010-11-28 18:27:47 -05:00
Jonas Holmberg
349f547561 gobject: initialize memory in g_object_new_valist
memset parameters array in g_object_new_valist to zeroes when expanding
the array to avoid acces to uninitialized memory.
2010-11-28 18:27:30 -05:00
Dan Winship
e910205557 Add g_source_set_dummy_callback()
Use g_source_set_closure() and g_close_set_meta_marshal() to allow
setting a do-nothing callback on any source.

https://bugzilla.gnome.org/show_bug.cgi?id=634239
2010-11-26 15:07:28 -05:00
Ryan Lortie
1a1fc130ec New function: g_clear_object()
By analogy to g_clear_error, takes a pass-by-reference GObject reference
and, if non-%NULL, unrefs it and sets it equal to %NULL.

Bug #620263.
2010-11-08 18:21:51 -05:00
Florian Müllner
a62b43fd9c Fix deadlock in g_object_remove_toggle_ref()
The code section guarded with toggle_refs_mutex includes a call to
g_object_unref(), which may call toggle_refs_notify(). As the latter
tries to acquire the same mutex, glib locks up.

https://bugzilla.gnome.org/show_bug.cgi?id=632884
2010-10-22 14:52:41 +02:00
Alberto Garcia
b7616114c6 Protect access to closure, weak refs and toggle refs arrays
This fixes https://bugzilla.gnome.org/show_bug.cgi?id=613822
2010-10-21 15:20:55 +02:00
Ryan Lortie
3c808dc874 GSignal: fix trivial docs typo 2010-10-12 21:34:26 -04:00
Ryan Lortie
15d87c2cc4 GObject: add g_signal_accumulator_first_wins
Deals with the case where we want exactly one signal handler to run.
2010-10-12 21:34:17 -04:00
Javier Jardón
5fa7a1e9ce gtypemodule: Mention g_object_run_dispose correctly in a warning
https://bugzilla.gnome.org/show_bug.cgi?id=630797
2010-10-08 17:22:19 +02:00
Emmanuele Bassi
44a8ff2f8f gobject: Improve install_properties()
Cache the parent type outside of the loop, and fix a typo in the
documentation.
2010-10-08 16:10:18 +01:00
Johan Dahlin
701ce5d201 [introspection] Add GObject annotations
These were moved in from gobject-introspection
2010-09-24 16:23:31 -03:00
Will Thompson
ba17efc396 g_strdup_value_contents(): dump GStrv more usefully
Previously, dumping a GValue holding a GStrv just yielded "((GStrv *)
0xDEADBEEF)". I think it'd be more useful to dump a Python list-style
representation of the GStrv's contents, if it's not NULL.

Fixes: <https://bugzilla.gnome.org/show_bug.cgi?id=629192>
2010-09-13 19:19:46 +01:00
Emmanuele Bassi
9cd43d7a4c gobject: Add install_properties()
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>
2010-09-13 12:34:53 +01:00
Emmanuele Bassi
016cecb179 Revert hack that broke things badly on Windows
This should fix bug #628952.

Don't include glib/gdatasetprivate.h directly. Especially don't define
GLIB_COMPILATION when doing that, as that causes breakage on Windows
because of the variable dllimport/dllexport stuff in gtypes.h that
checks GLIB_COMPILATION. That macro really should be defined only when
compiling code that goes into the libglib DLL. Otherwise the compiler
thinks that variables that should be imported from libglib are
actually defined in the code being compiled.

Just call g_atomic_pointer_get() as such, don't bother with
G_DATALIST_GET_FLAGS.

Signed-off-by: Tor Lillqvist <tml@iki.fi>
2010-09-08 12:06:49 +03:00
Emmanuele Bassi
01a46e5c65 Hack to include glib/gdatasetprivate.h directly
The gdatasetprivate.h header includes gatomic.h directly. It all works
well in GLib, but inside GObject it will trigger the single inclusion
guard.

Since this is a private header, and it's kind of a special case, one way
to fix it is to declare GLIB_COMPILATION around it and fool the single
inclusion guard in gatomic.h into thinking we're compiling GLib and not
GObject.
2010-09-04 17:25:37 +01:00
Matthias Clasen
42080449d0 Add a note about size limits of private structures
Also add some assertions to check these limits, instead of
failing silently.  Bug 604479.
2010-09-03 18:11:08 -04:00
Matthias Clasen
c75429d0a0 Make ordering for overridden interface properties consistent
g_object_class_list_properties tries to sort the returned list of
paramspecs by 'type depth' and param_id. But all the overridden
interface properties have a param_id of 0, so they come out in
a random order.

Bug 628253.
2010-09-03 14:54:22 -04:00
Emmanuele Bassi
d31c1c863a docs: Fix up GDateTime for the GObject reference 2010-08-25 16:24:46 +01:00
Thiago Santos
e35ed21f43 datetime: Add GDateTime to the GType system
As with other GLib data types, use a GBoxed.
2010-08-24 23:41:21 +01:00
Christian Persch
71e73ffdfb Use G_DEFINE_[BOXED|POINTER]_TYPE instead of handwritten code
Now that we have convenience macros to implement boxed and pointer
types, use them.
2010-08-18 00:12:28 +02:00
Christian Persch
dc1999316d Add G_DEFINE_{BOXED,POINTER}_TYPE[_WITH_CODE]
Add convenience type definition macros for boxed and pointer types
similar to G_DEFINE_TYPE for object types. Bug #449565.
2010-08-18 00:12:22 +02:00
Matthias Clasen
e02571e93b Add bug references to some tests 2010-08-13 21:23:23 -04:00
Benjamin Otte
4ac7f8f084 notifyqueue: Dedup pspecs when adding
The previous code dedup'd when thawing and threw nasty warnings your way
if you notified too often. This can now easily be avoided.

Performance should be roughly identical, as both are O(n²).
2010-08-06 23:35:24 +02:00
Ryan Lortie
b3b7ea8e22 Replace -I with $(glib_INCLUDES) and friends
Stop using ad hoc -I in all of our Makefile.am.  Use the new variables
instead.
2010-08-06 13:10:34 -04:00
paul
9f6faaffb6 Add $(top_builddir)/glib to includes
This is required to find glibconfig.h during srcdir != builddir builds
2010-08-05 09:08:34 -04:00
Emmanuele Bassi
4bc9654c63 binding: Add a default marshaller for the closure API
The g_object_bind_property_with_closures() function should set a
marshaller if the two GClosures don't have one already. This simplifies
the caller code and avoids duplication.

We need to add a new marshaller to the gmarshal.list matching the
signature of the GBindingTransformFunc function.
2010-08-04 01:09:28 +01:00
Mark Wielaard
f8ec75620d Don't add (extra) DESTDIR to tapsetdir for tapset_DATA.
https://bugzilla.gnome.org/show_bug.cgi?id=625876
2010-08-03 08:04:58 -04:00
Emmanuele Bassi
5e1c4b18a8 docs: Clarify user_data behavior for bind_property_full() 2010-08-03 10:34:59 +01:00
Emmanuele Bassi
90f7f171e6 binding: Add G_BINDING_INVERT_BOOLEAN
Since GSettings got the same functionality and flag in commit ca3b7b75b
GBinding should also have the ability to automatically invert a boolean
value without requiring a custom transformation function.
2010-08-03 10:29:50 +01:00
Emmanuele Bassi
3be3ad61d1 binding: Add a closure-based variant of bind_property_full()
Since using the function pointer version muddles the memory management
requirements of language bindings, we should implement a GClosure-based
variant on top of g_object_bind_property_full().

https://bugzilla.gnome.org/show_bug.cgi?id=622278
2010-08-03 09:51:49 +01:00
Benjamin Otte
86040bb2eb Revert "notify: Remove unused g_object_notify_queue_clear()"
This reverts commit 0201a81f04 and adds
locks in the right place.

As this file is a public header (see last commit), we cannot just remove
functions from it.
2010-07-23 10:52:51 +02:00
Benjamin Otte
2819dd60b7 notify: Readd g_object_notify_queue_from_object()
gobjectnotifyqueue.c is a public header, so we cannot remove files from
it. (Yes you read that right, this .c file is a public header. See your
installation directory.)
2010-07-23 10:52:51 +02:00
Benjamin Otte
0483ef000a notify: Make dedup code clearer
A for loops seems easier to understand to me than gotos.
2010-07-22 21:56:21 +02:00
Olivier Crête
9026b11e38 notify: Make GObject property change notifications thread safe
Adds locking around object property change notification handling. The
notifications are only emitted after all threads have called
g_object_thaw_notify().

https://bugzilla.gnome.org/show_bug.cgi?id=166020
2010-07-22 21:56:20 +02:00
Olivier Crête
65797f7e54 notify: Remove g_object_notify_queue_from_object()
The function will not be safe with object locking in place, so we remove
it. The workaround is somewhat ugly, but it works.

https://bugzilla.gnome.org/show_bug.cgi?id=166020
2010-07-22 21:56:20 +02:00
Olivier Crête
83026092eb notify: Refactor g_object_notify_queue_thaw()
This adds better error reporting and simplifies the code for adding
thread safety.

https://bugzilla.gnome.org/show_bug.cgi?id=166020
2010-07-22 21:56:20 +02:00
Olivier Crête
0201a81f04 notify: Remove unused g_object_notify_queue_clear()
https://bugzilla.gnome.org/show_bug.cgi?id=166020
2010-07-22 21:56:20 +02:00
Benjamin Otte
a2c5bba31d notify: Emit a g_critical() instead g_return_if_fail()ing
This does not change the code semantically in any way but avoids a
return in the middle of the code.

https://bugzilla.gnome.org/show_bug.cgi?id=166020
2010-07-22 21:56:20 +02:00
Benjamin Otte
24161d9c46 binding: Cast to avoid compiler warning 2010-07-22 21:56:20 +02:00
Ryan Lortie
adde752ec5 More docs fixes
Remove the g*alias.h from the ignore lists

  Remove other old files from ignore lists

  Clean up gobject docs
2010-07-12 17:46:17 -04:00
Ryan Lortie
83d67bf2e7 move glibconfig.h to glib/ 2010-07-12 15:33:05 -04:00
Will Thompson
2504ec988e Document NULL shortcut to g_value_array_insert etc.
You can pass a NULL GValue * to any of g_value_array_insert, _prepend or
_append to add a new, uninitialized value. This is a very useful
shortcut, and it should be documented rather than left languishing in a
comment in the implementation.

Fixes Gnome bug #552363.
2010-07-08 19:30:53 -04:00
Ryan Lortie
0fc50fa5f7 gobject/: fully remove gobjectalias hacks 2010-07-07 19:40:48 -04:00
Matthias Clasen
c2997efb66 Add some more checks to the binding tests 2010-07-05 23:13:18 -04:00
Matthias Clasen
4e97c96654 Remove a redundant branch
Since the name has been interned already at pspec creation time,
we can just call g_intern_string().
2010-07-05 23:13:18 -04:00
Colin Walters
499ece9b52 [gbinding] Move argument reference out of first column
It makes gobject-introspection complain.
2010-06-25 09:26:23 -04:00
Christian Dywan
272836936e Introduce G_PARAM_DEPRECATED and G_ENABLE_DIAGNOSTIC
See https://bugzilla.gnome.org/show_bug.cgi?id=601686
2010-06-23 16:45:12 +02:00
Emmanuele Bassi
f587cb57f2 binding: Add SYNC_CREATE to the flags
When creating a binding between two object properties we might want to
automatically synchronize the two values at the moment of the binding
creation, instead of waiting for the next change.

The G_BINDING_SYNC_CREATE flag does exactly what it says on the tin.

https://bugzilla.gnome.org/show_bug.cgi?id=622281
2010-06-23 15:19:24 +01:00
Ryan Lortie
d3af9c0ec5 neutralise pltcheck.sh 2010-06-23 10:12:14 -04:00