Commit Graph

30 Commits

Author SHA1 Message Date
Xavier Claessens
940fa98290 Tests: add session_bus_run() and use it where possible
This is to avoid having again the subtil bug in dbus-appinfo.c:
session_bus_down() was called before g_test_run() so the test was
running on the user's dbus session.

https://bugzilla.gnome.org/show_bug.cgi?id=697348
2013-10-29 13:30:22 -04:00
Dan Winship
4b94c0831e Use 'dumb quotes' rather than `really dumb quotes'
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
2013-05-21 11:23:22 -03:00
Colin Walters
67466b41af build: Don't use C99 declarations
Since GLib needs to compile with MSVC, we can't use them.  This fixes
compilation when using -Werror=declaration-after-statement.

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-01 20:12:01 -04:00
Ryan Lortie
1dc774a653 Remove g_type_init() calls
Very many testcases, some GLib tools (resource compiler, etc) and
GApplication were calling g_type_init().

Remove those uses, as they are no longer required.

https://bugzilla.gnome.org/show_bug.cgi?id=686161
2012-10-16 09:39:24 -04:00
Matthias Clasen
cbf346ce53 Remove some more 'the the' 2012-08-19 02:27:04 -04:00
David Zeuthen
d72116d8b7 gdbus-codegen: Don't generate invalid GObject property names
For a D-Bus property with name "Type" (fairly common), we used to
generate a GObject property with name "type-" and C accessors
get_type_() (to avoid clashing with the GType getter), set_type_()
(for symmetri).

However, the rules for GObject property names are fairly rigid and
specifically prohibit names ending in a dash.

Therefore change things so the chosen GObject property name is "type"
but preserve the naming rules for the C getter and setter (for the
same reasons: avoiding name clashing and symmetri).

This change does break the API of generated code (but only on the
GObject property level, the C symbols are not changed) but strictly
speaking the behavior was undefined since "type-" was an invalid
GObject property name.

Also add a test case for this.

Bug 679473.

https://bugzilla.gnome.org/show_bug.cgi?id=679473

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
2012-07-06 09:26:41 -04:00
Dan Winship
7d0db04223 gdbus: fix generated code to not warn under -Wfloat-equal
https://bugzilla.gnome.org/show_bug.cgi?id=678333
2012-06-20 08:20:50 -04:00
Xavier Claessens
415a8d81f6 Use GTestDBus in all GDBus unit tests
To make port easier, this rewrites dbus-sessionbus.c using a
GTestDBus singleton internally.

https://bugzilla.gnome.org/show_bug.cgi?id=672985
2012-04-19 10:07:39 +02:00
David Zeuthen
a6f83d73e5 Revert "Add GTestDBus object"
This reverts commit 1b5f70b5b0.
2012-04-18 13:47:51 -04:00
Xavier Claessens
1b5f70b5b0 Add GTestDBus object
This is a helper to write unit tests using a private dbus-daemon.

session_bus_up/down() are now just wrappers around a GTestDBus singleton.

https://bugzilla.gnome.org/show_bug.cgi?id=672985
2012-04-18 11:19:13 -04:00
David Zeuthen
7f5f47ae15 gdbus-codegen: Don't leak stuff in tests
Signed-off-by: David Zeuthen <davidz@redhat.com>
2012-04-17 17:51:55 -04:00
Matthias Clasen
9ea9471d26 Improve GBusObjectManager test coverage 2012-04-02 09:09:10 -04:00
Javier Jardón
ee044fd839 gio/tests: Use g_list_free_full() convenience function 2012-01-02 23:18:22 +01:00
Ryan Lortie
430c5635f2 g_thread_new: never fail
Remove the GError argument from g_thread_new() and abort on failure.
Introduce g_thread_try() for those who want to handle failure.
2011-10-13 01:00:57 -04:00
Ryan Lortie
015f4b4513 thread: nuke the concept of 'joinable'
And remove the 'joinable' argument from g_thread_new() and
g_thread_new_full().

Change the wording in the docs.  Clarify expectations for
(deprecated) g_thread_create().
2011-10-13 00:43:33 -04:00
Matthias Clasen
93e49aea1b Don't use deprecated GThread API in gio tests 2011-10-10 09:49:50 -04:00
David Zeuthen
88f2b32eb0 GDBusObjectManagerServer: Add test for export_uniquely() method
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-19 17:31:21 -04:00
David Zeuthen
48494dd552 gdbus-codegen: Support Ugly_Case for given C namespace
https://bugzilla.gnome.org/show_bug.cgi?id=658976

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-09-16 16:01:13 -04:00
David Zeuthen
05448a6bef gdbus-codegen: Rework C property getters
Rework property getters to use a vfunc so we can take the fast path
and avoid allocating memory for both the skeleton and the proxy
cases. This requires some special case because of how GVariant expects
you to free memory in some cases, see #657100. Add test cases for
this.

Document the _get_ functions as not being thread-safe and also
generate _dup_ C getters (which are thread-safe).

Mark all the generated _get_, _dup_ and _set_ as (skip) as non-C
languages should just use GObject properties and not the (socalled)
"C binding".

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-08-23 12:54:27 -04:00
David Zeuthen
419bfe325c gdbus-codegen: Use G_TYPE_STRV/gchar** for GVariant type 'ao'
This is possible now that we have better support for object path
arrays, see

 http://git.gnome.org/browse/glib/commit/?id=19878998bc386db78614f1c92ff8524a81479c7b

Note that this breaks the ABI of generated code but since
gdbus-codegen(1) has never yet been in a stable GLib release, this is
fine.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-07-21 09:32:38 -04:00
Colin Walters
d54c65448c gdbus-test-codegen: Allocate full integer space for uint16 properties
Because there is no G_TYPE_[U]INT16, we need to use integer types,
otherwise we'll end up overwriting memory (in this case on the stack).
2011-06-20 14:03:05 -04:00
David Zeuthen
1ab29b6c4a GDBusObjectManagerServer: Allow setting :connection property
.. and add a C setter to do this. Also make the C getter return a
reference since the property may be set from another thread. Also
change the constructor to _not_ take a GDBusConnection since this is
something you almost always want to do _after_ creating it. The
API/ABI break is fine as there has never been a GLib release with this
type.

https://bugzilla.gnome.org/show_bug.cgi?id=648959

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-05-04 03:43:52 -04:00
David Zeuthen
bbe945183b gdbus-codegen: Generate GDBusObject{,Proxy,Skeleton} subtypes
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-25 09:29:18 -04:00
David Zeuthen
affc6f7475 GDBusObjectManagerClient: Add a GDestroyNotify to the user_data
For bindings, obviously.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-16 15:24:42 -04:00
David Zeuthen
3cef28a2f0 gdbus-codegen: Make generated code introspectable
Specific changes

 - Use get_type(), not get_gtype() for the GType function
   - so we need to use the lower-case name type_ for properties called type
 - Don't return a function pointer, just make the function returned
   available instead
 - Add (type) annotations in constructors so g-ir-scanner detects them as such
 - Add (transfer none) annotations to property getters
 - Add (out) annotations to D-Bus method call functions

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-16 14:08:47 -04:00
David Zeuthen
6bccc46d15 gdbus-codegen: Don't send out PropertiesChanged if value ends up not changing
A fairly typical pattern is to have code that does

 foo_set_bar (object, "");
 if (some_condition)
   {
     foo_set_bar (object, "yes");
   }

where some_condition is often true every time @object is updated.

With this code, bar is essentially always "yes" but because of how
gdbus-codegen works, useless PropertiesChanged events got scheduled
and sent out. With this patch, we avoid that by always keeping the
original value around and comparing it only when we deem it's time to
send out the ::PropertiesChanged signal (typically in an idle but can
be forced by the user via flush()).

Also add a test case for this.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-15 15:53:28 -04:00
David Zeuthen
febfc45fbe GDBus: Support Ugly_Case and use org.gtk.GDBus.C.Name since it's C-only
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-15 08:24:40 -04:00
David Zeuthen
6ccca55752 GDBus: Use Skeleton instead of Stub
After some brainstorming with Simon, see

 https://bugzilla.gnome.org/show_bug.cgi?id=647577#c8

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-13 16:33:51 -04:00
David Zeuthen
34a28f2f06 Add support for org.gtk.GDBus.Since annotation
And use this for a) documentation purposes; and b) to preserve C ABI
when an interface is extended. See

 https://bugzilla.gnome.org/show_bug.cgi?id=647577#c5

for more details. Also add test cases for this.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-12 16:17:28 -04:00
David Zeuthen
9c1941c07f GDBus: Add test-suite for new ObjectManager and gdbus-codegen(1) code
Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-04-11 10:54:52 -04:00