Commit Graph

932 Commits

Author SHA1 Message Date
Dan Winship
7412e073d1 update .gitignores 2011-06-12 16:17:30 -04:00
Ryan Lortie
8073759f8c Remove all uses of G_CONST_RETURN
Just use 'const'.

https://bugzilla.gnome.org/show_bug.cgi?id=644611
2011-06-09 11:15:40 -04:00
Ryan Lortie
8f21e8145c gobject: remove -DG_DISABLE_CONST_RETURNS
GObject had a few cases of depending on G_CONST_RETURN not being defined
to 'const'.  Remove those in preparation for deprecation of
G_CONST_RETURN.
2011-06-09 11:11:30 -04:00
Colomban Wendling
6418769e4c Fix a typo in GBinding
https://bugzilla.gnome.org/show_bug.cgi?id=652081
2011-06-08 16:56:40 -04:00
Colin Walters
dad374b1a0 glib-types.h: Include glib.h, since we use G_BEGIN_DECLS
This header is included individually by g-ir-scanner.
2011-06-07 16:26:43 -04:00
Colin Walters
ab0e9dbfa7 Generate $module-public-headers.txt file, feed it to gtk-doc
Rather than having the gtk-doc build machinery have a list of header
files to exclude, change the GLib build to dump a list of public
header files generated from the maintained Makefile.am files for
each of glib/, gobject/, gio/.

Also, for glib, always install glib-unix.h, even on non-Unix
platforms, for the same reason we install gwin32.h even on Unix.

https://bugzilla.gnome.org/show_bug.cgi?id=651745
2011-06-07 14:18:36 -04:00
Chun-wei Fan
405b4ff4f4 Update the year in the *.rc.in files
Sorry this change came a bit late...
2011-06-07 08:55:31 +08:00
Chun-wei Fan
e154e3325e Clean up gobject/gvaluetransform.c a bit
The check for _MSC_VER here is not necessary here because:
-One cannot compile GLib out-of-the-box with VS 2003 (let alone VS6
 or earlier) since GLib 2.22.4 or so.
-This code compiles fine with the currently-supported VS versions
 (2008/2010) without the error mentioned in the comments.

This will close Bug 652002.
2011-06-07 08:25:07 +08:00
Matthias Clasen
d811f0cdc9 Fix a typo
And reword some docs.
2011-06-05 19:07:06 -04:00
Matthias Clasen
3b242bc5e9 Use g_param_spec_ref_sink instead of separate ref, sink 2011-06-04 23:43:05 -04:00
Matthias Clasen
9eda9d9195 GParamSpec: avoid unnecessary double initialization of qdata 2011-06-04 23:42:07 -04:00
Matthias Clasen
38dc7955e4 No necessary to init qdata atomically 2011-06-04 23:14:32 -04:00
Alexander Larsson
0a918c0d2a Make g_object_get_data use the new faster g_datalist_get_data
https://bugzilla.gnome.org/show_bug.cgi?id=650458
2011-06-03 21:11:26 -04:00
Colin Walters
3bd3067ffc gobject: Use _ prefixing in private headers over G_GNUC_INTERNAL in public headers
This helps out gtk-doc and g-ir-scanner, and also makes much clearer
what's private versus public.

https://bugzilla.gnome.org/show_bug.cgi?id=651745
2011-06-03 12:40:01 -04:00
Colin Walters
a06863de60 Add a boxed type for GVariantBuilder, mark GVariantIter as (skip)
Based on a patch by Giovanni Campagna <gcampagna@src.gnome.org>

From discussion, GVariantIter is not useful for bindings, but
GVariantBuilder may be.

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-05-31 13:37:14 -04:00
Ryan Lortie
8382135265 glib: Rewrite gatomic.[ch]
- remove all inline assembly versions

 - implement the atomic operations using either GCC intrinsics, the
   Windows interlocked API or a mutex-based fallback

 - drop gatomic-gcc.c since these are now defined in the header file.
   Adjust Makefile.am accordingly.

 - expand the set of operations: support 'get', 'set', 'compare and
   exchange', 'add', 'or', and 'xor' for both integers and pointers

 - deprecate g_atomic_int_exchange_and_add since g_atomic_int_add (as
   with all the new arithmetic operations) now returns the prior value

 - unify the use of macros: all functions are now wrapped in macros that
   perform the proper casts and checks

 - remove G_GNUC_MAY_ALIAS use; it was never required for the integer
   operations (since casting between pointers that only vary in
   signedness of the target is explicitly permitted) and we avoid the
   need for the pointer operations by using simple 'void *' instead of
   'gpointer *' (which caused the 'type-punned pointer' warning)

 - provide function implementations of g_atomic_int_inc and
   g_atomic_int_dec_and_test: these were strictly macros before

 - improve the documentation to make it very clear exactly which types
   of pointers these operations may be used with

 - remove a few uses of the now-deprecated g_atomic_int_exchange_and_add

 - drop initialisation of gatomic from gthread (by using a GStaticMutex
   instead of a GMutex)

 - update glib.symbols and documentation sections files

Closes #650823 and #650935
2011-05-28 16:10:44 -04:00
Matthias Clasen
2fb57ff46f Quiet down the build a bit 2011-05-28 14:29:08 -04:00
Matthias Clasen
b5056fbaf9 Simply symbols files
The grouping in files/headers is not used anymore, and
the function attributes neither. Adapt abicheck scripts
and .def file generation rules accordingly.
2011-05-23 00:21:06 -04:00
Giovanni Campagna
7c63370e3a GObject: move GLib type definitions to a separate header
This way it is possible to pull them into the GLib GIR file.

Some cleanups by Colin Walters <walters@verbum.org>

https://bugzilla.gnome.org/show_bug.cgi?id=646635
2011-05-19 17:39:33 -04:00
Colin Walters
5645c7aa41 gtype: Remove unused variable 2011-05-18 11:57:21 -04:00
Benjamin Otte
d9440687ff gobject: Speed up g_type_from_name()
The hash table used exclusively for looking up types by name used to map
quarks => types. But we can easily make it map strings => types, which
avoids the quark lookup. And that in trun avoids taking a lock and
consulting another hash table. So this change should make
g_type_from_name() roughly twice as fast.
2011-05-17 15:01:36 +02:00
Benjamin Otte
02877e2902 gobject: Warn if someone uses the wrong property in g_object_get/set
"Interface::property" was not detected before and led to a crash.
2011-05-02 19:33:51 +02:00
Dan Winship
bdc23c44e8 Fix compiler warnings 2011-05-02 11:50:23 -04:00
Dan Winship
181763438a Update .gitignores 2011-05-02 09:54:15 -04:00
David Zeuthen
88ab35f3cb Add a generic libffi based marshaller to libgobject
This code is from https://bugzilla.gnome.org/show_bug.cgi?id=567087
and was adapted by myself to also support the GVariant fundamental
type.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-08 17:34:44 -04:00
Ryan Lortie
7a752e0817 Improve .gitignore 2011-03-31 15:51:01 +05:30
Murray Cumming
30fdc1a799 Docs: Changed can not to cannot. 2011-03-24 09:33:55 +01:00
Emmanuele Bassi
08f0a31289 Revert "Remove all uses of G_CONST_RETURN"
This reverts commit 36741245cc.

The removal has not been discussed, except on Bugzilla:

https://bugzilla.gnome.org/show_bug.cgi?id=644611
2011-03-15 09:03:28 +00:00
Ryan Lortie
36741245cc Remove all uses of G_CONST_RETURN
Just use 'const'.
2011-03-15 01:32:22 -04:00
Christian Persch
61b0e1c8d4 Add G_SIGNAL_MUST_COLLECT
In some cases, signal arguments have to be collected, even if there are i
no signal handlers connected (e.g. for GVariant parameters, where collection
consumes a floating variant).

Based on a patch by Christian Persch.

Bug #643624.
2011-03-15 01:32:22 -04:00
Will Thompson
72016418d3 g_value_array_remove(): clarify docstring formatting 2011-03-03 14:51:41 +00:00
Chun-wei Fan
7b118b0c41 Visual C++ 2010 Project Files: autotools files
These are the updates to the autotools files to
ensure the expansion of the GIO, GLib and GObject
project files (*.vcxproj, *.vcxproj.filters) and to
enable the distribution of the VS2010 project files

The actual VS2010 project files will follow shortly
2011-02-22 19:58:18 +08:00
Matthias Clasen
2c0a8ff4dc Add a testcase for bug 637738 2011-02-18 23:46:09 -05:00
Matthias Clasen
9dd1f75a41 Document G_VALUE_NOCOPY_CONTENTS
https://bugzilla.gnome.org/show_bug.cgi?id=624943
2011-02-18 22:42:24 -05:00
Matthias Clasen
2a1eed20b4 Expand the documentation of g_type_get_qdata()
https://bugzilla.gnome.org/show_bug.cgi?id=613269
2011-02-18 22:35:49 -05:00
Stef Walter
6cd08472b2 Better documentation for g_value_dup_object().
State that NULL is returned when value is NULL.
2011-02-16 00:21:27 -05:00
Matthias Clasen
f1a88e7e42 More GValue conversion tests 2011-02-14 19:20:44 -05:00
Matthias Clasen
cfe8ec429a Vary the order of unreffing dest and src
For slightly better test coverage.
2011-02-14 19:20:44 -05:00
Matthias Clasen
309f5f978b Improve test coverage
Various test additions, mainly in GObject
2011-02-13 23:49:19 -05:00
Matthias Clasen
1e48bff207 Cosmetic rearrangement 2011-02-13 23:49:19 -05:00
Will Thompson
c2d98c5609 GObject: correct documentation typos 2011-02-11 15:21:12 +00:00
Matthias Clasen
126beeee33 Fix a typo 2011-02-07 23:46:02 -05:00
Matthias Clasen
25ab13fd3c Don't use -w in shebang line
This can cause warnings when PERL_PATH gets expanded to /usr/bin/env.
Patch by Adam Sampson, https://bugzilla.gnome.org/show_bug.cgi?id=641477
2011-02-07 23:27:19 -05:00
Matthias Clasen
6fe2f5f11b Prevent unused variable warnings from G_DEFINE_DYNAMIC_TYPE 2011-01-28 12:26:23 -05:00
Michael Natterer
634e9e43cf gobject: add an empty default impl of GObject::constructed()
to allow unconditional upchaining.
2011-01-12 19:45:40 +01:00
Pavel Holejsovsky
422a76b3cd Fix typo in GI annotation 2010-12-29 11:42:14 +01:00
Pavel Holejsovsky
562a834328 Fix typo in function annotation. 2010-12-28 11:59:58 +01:00
Matthias Clasen
bf1027f826 Move ifaceproperties test to gobject/tests/ 2010-12-27 23:49:12 -05:00
Matthias Clasen
068d53358b Make object_interface_check_properties work
As pointed out in bug 637738, it does not currently work, since
g_type_class_peek always returns NULL.
2010-12-27 23:41:10 -05:00
Pavel Holejsovsky
58e36daf29 Add GI annotations to GObject 2010-12-27 22:08:15 +01:00
Pavel Holejsovsky
282366c326 Add GI annotations to GParamSpec 2010-12-27 22:08:07 +01:00
Pavel Holejsovsky
3955bbfde0 Add GI annotations to GType 2010-12-27 20:56:58 +01:00
Pavel Holejsovsky
3264d8d159 Add GI annotations to GClosure and friends. 2010-12-19 22:20:21 +01:00
Pavel Holejsovsky
ea577d60d4 Add GI annotations to GValue and GValueArray. 2010-12-19 10:39:36 +01:00
Will Thompson
ac4722df1c g_object_get_property: document that value must be initialized
I couldn't tell from reading the documentation whether I had to pass in
an uninitialized value, or a value initialized to the exact type, or
something else. It turns out (from reading the source) that you have to
pass in an initialized value, but you can use any type to which the
property's actual type can be transformed.

So, let's document this.
2010-12-17 13:21:07 +00:00
Matthias Clasen
8071012728 Avoid shadowing the dir builtin
Proposed by David Malcolm,

https://bugzilla.gnome.org/show_bug.cgi?id=636387
2010-12-03 14:08:36 -05:00
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