summaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* Fix exceptions thrown by Thread::create() and Threads::Thread::create.Kjell Ahlstedt2012-02-286-8/+7
| | | | | | | | | | | | | | | | | * glib/src/thread.ccg: create(): Call g_thread_try_new() instead of g_thread_new(). Throw a Glib::ThreadError when appropriate, instead of calling Glib::Error::throw_exception(), which would throw Glib::Threads::ThreadError. * glib/src/threads.ccg:create(): Call g_thread_try_new() instead of g_thread_new(). Remove parameter 'joinable'. * glib/src/threads.hg: Remove parameter 'joinable'. Remove comments about non-joinable threads and thread priorities. * examples/network/resolver.cc: * examples/network/socket-client.cc: * examples/network/socket-server.cc: * examples/thread/dispatcher.cc: * examples/thread/dispatcher2.cc: * examples/thread/thread.cc: Remove parameter 'joinable' in calls to Glib::Threads::Thread::create(). Bug #640029.
* Add Glib::Threads::* in threads.h, deprecating everything in thread.hMurray Cumming2011-11-237-22/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | * glib/src/filelist.am: * glib/src/thread.[hg|ccg]: Deprecate the whole file, adding deprecation doxygen comments to all API. * glib/src/threads.[hg|ccg]: A new Threads namespace containing equivalents for everything in thread.h, implemented using only non-deprecated glib API. This was necessary because we had to break the ABI to do this. * glib/glibmm.h: Include threads.h * glib/glibmm/main.[h|cc]: Added a wait() method overload that takes the new types, deprecating the existing wait() method. * examples/network/resolver.cc: * examples/network/socket-client.cc: * examples/network/socket-server.cc: * examples/thread/dispatcher.cc: * examples/thread/dispatcher2.cc: * examples/thread/thread.cc: * examples/thread/threadpool.cc: * glib/glibmm/dispatcher.cc: * glib/glibmm/exceptionhandler.cc: * glib/glibmm/threadpool.[h|cc]: Use the new Glib::Threads::* types instead of thread.h.
* Avoid use of deprecated API in tests and examples.Murray Cumming2011-10-266-9/+6
| | | | | | | | | | | * tests/Makefile.am: * examples/Makefile.am: Disable deprecated API. * examples/network/socket-client.cc: * examples/network/socket-server.cc: * examples/thread/dispatcher.cc: * examples/thread/dispatcher2.cc: * examples/thread/thread.cc: Remove calls to Glib::thread_init(), instead calling Glib::init() where that side-effect was also intended.
* threadpool example: Use Mutex instead of StaticMutex.Murray Cumming2011-10-261-3/+1
| | | | | | | | | * examples/thread/threadpool.cc: The advantage of StaticMutex was that it would silently do nothing if threads were not initialized. That was never a useful distinction in this example anyway. Also remove the deprecated thread_init() call. * glib/src/thread.ccg: Mutex: Add a TODO about not using the deprecated API.
* thread.h: Allow use of this without causing deprecation compiler warnings.Murray Cumming2011-10-262-2/+2
| | | | | | | | | | | | | | | | | | | | | * glib/src/thread.hg: undef and then redefine G_DISABLE_DEPRECATED, and define GLIB_DISABLE_DEPRECATION_WARNINGS, if G_DISABLE_DEPRECATED is defined, so we can use the deprecated API in this header (though only in our own deprecated API). * tools/generate_wrap_init.pl.in: Include glibmm.h instead of glib.h so we can include thread.h first (via glibmm.h) instead of only later. This seems more logical than explicitly including thread.h in all (even non-glibmm) generated wrap_init.cc files. * tools/m4/base.m4: * glib/glibmm.h: * glib/glibmm/dispatcher.cc: * glib/glibmm/exceptionhandler.cc: * glib/glibmm/main.cc: * examples/thread/thread.cc: * examples/thread/threadpool.cc: Adjust the includes to include thread.h first.
* Fix the make check build by always linking to gthread-2.0.Murray Cumming2011-10-252-26/+7
| | | | | | | | | | | | | * configure.ac: Always use gthread-2.0 because there is now no advantage to not doing that, because threading is now always enabled in glib. Remove the separate GTHREAD* variables. * glib/glibmm/Makefile.am: * gio/giomm/Makefile.am: * tests/Makefile.am: * tools/Makefile.am: * examples/Makefile.am: Remove use of the GTHREAD* variables.. * examples/network/resolver.cc: Remove the non-threading option and code that uses it.
* Examples build: Use the GLIB_COMPILE_SCHEMAS variable.Volker Grabsch2011-05-031-1/+1
| | | | | | * examples/Makefile.am: Instead of hard-coding glib-compile-schemas. This was an issue in cross-toolchain environments. Bug #648485.
* Gio::DBus examples: Renamed one and removed one.Murray Cumming2011-04-023-343/+3
| | | | | | | | | | | | * examples/dbus/server.cc: Rename this to server_without_bus.cc to make its purpose clearer. This is not the common case. It is for private peer-to-peer connections not involving the usual session or system buses, or any bus for that matter. Meaning, for instance, that it does not assign names or provide introspection, I think. * examples/dbus/peer.cc: Removed this because it seems like just a complicated version of the server_without_bus example, and this is not in sync with the C versoin. Well, we should probably add a client for the server example.
* Fix compiler warnings.Murray Cumming2011-04-022-2/+2
|
* Slight cleanup to D-Bus example code.Murray Cumming2011-04-022-72/+0
| | | | | | | * examples/dbus/server.cc: * examples/dbus/session_bus_service.cc: Remove code to handle the now non-existant GetStdOut D-Bus method. That code was left over from an earlier version of an example.
* Gio::DBus::NodeInfo::lookup_interface(): Add a method overload with no name.Murray Cumming2011-04-023-3/+3
| | | | | | | | | | | * gio/src/dbusintrospection.[hg|ccg]: Add a lookup_interface() method overload that just returns the first interface, avoiding the need to specify the name when there is only one interface. The C API will not do this itself: See bug #646417. * examples/dbus/peer.cc: * examples/dbus/server.cc: * examples/dbus/session_bus_service.cc: Use the new method to simplify the code slightly.
* Added a simple example of a D-Bus session bus service.Murray Cumming2011-04-013-9/+226
| | | | | | | * examples/dbus/session_bus_service.cc: This uses Gio::DBus::own_name(). * examples/Makefile.am: Mention the new test. * examples/dbus/server.cc: Mention the return (out) value for the GetTime method here too, and catch an exception.
* Gio::DBus: Minor API changes.Murray Cumming2011-04-013-83/+107
| | | | | | | | | | | | | | | | | | | | | * gio/src/dbusconnection.[hg|ccg]: register_object(), register_subtree(): Take the VTable by reference, not pointer. register_object() can take a NULL but that needs documentation (see the bug mentioned) and a future method overload. * gio/src/dbusmethodinvocation.ccg: get_parameters(): Return a VariantContainerBase instead of taking a VariantBase output parameter, because this is always a tuple. Well, I think so: See the bug mentioned. * gio/src/dbusmethodinvocation.hg: return_value(): Take a VariantContainerBase instead of a VariantBase, because this is always a tuple. return_gerror(), return_error_literal(): Rename them both to return_error(). * glib/src/variant.hg: VariantContainerBase::create_tuple(): Add a method overload that takes a single VariantBase, for convenience, so that applications don't need to create a single-item vector. * examples/dbus/busserver.cc: Adapted. * examples/dbus/busserver.cc: Rename to server.cc and actually implement it, though I am currently confused about whether this server's object should be available on an existing bus. Maybe we should use Gio::DBus::own_name() instead of Gio::DBus::Server.
* Code style change.Murray Cumming2011-04-011-2/+2
|
* Rename a D-Bus client example.Murray Cumming2011-04-012-3/+3
| | | | | * examples/dbus/userbus.cc: Rename to client_bus_listnames.cc to make it more obvious what it does.
* Code style improvementMurray Cumming2011-04-011-5/+5
|
* Variant: Rename get(index) to get_child(index).Murray Cumming2011-03-292-3/+3
| | | | | | | | | | | * glib/src/variant.[hg|ccg]: Rename all get() methods that return children to get_child() to make the API clearer and to avoid ambiguity with get() methods that return the underlying type instead. * examples/dbus/peer.cc: * examples/dbus/userbus.cc: * tests/glibmm_variant/main.cc: Adapted. https://bugzilla.gnome.org/show_bug.cgi?id=644207#c7 (Yannick Guesnet)
* Gio::DBus: Use VariantContainerBase for tuple Variants.Murray Cumming2011-03-252-4/+3
| | | | | | | | | | | | * gio/src/dbusconnection.[hg|ccg]: * gio/src/dbusproxy.ccg.[hg|ccg]: call_sync(), call(), call_finish(): Use VariantContainerBase, instead of VariantBase, for GVariants that are documented as being tuples. Because the type is known we can also use it as a simple return type instead of an output parameter. * tools/m4/convert_gio.m4: Added a necessary conversion. * examples/dbus/peer.cc: * examples/dbus/userbus.cc: Adapted. These already correctly assumed that the type should be VariantContainerBase.
* Rename Gio::DBus::DBusError to Gio::DBus::Error.Murray Cumming2011-02-241-3/+3
| | | | | | | | | | | * gio/src/dbuserror.hg: Rename the class to Error. * examples/dbus/busserver.cc: Adapated. * tests/giomm_ioerror_and_iodbuserror/main.cc: Added a test to check that both Gio::Error and Gio::DBus::Error are working. * tests/Makefile.am: Set TESTS, so that the test is actually run. We should add others to this too. This current fails, so I need to fix the problem in a subsequent commit.
* Move Gio::DBusError to Gio::Dbus::DBusError.Murray Cumming2011-02-241-3/+3
| | | | | | | | | | | | * tools/m4/base.m4: Added a SECTION_H_GERROR_PRIVATE section. * tools/m4/gerror.m4: Import the SECTION_H_GERROR_PRIVATE section. * gio/src/dbuserror.hg: Put this back into the DBus namespace. Push a custom friend declaration into the SECTION_H_GERROR_PRIVATE section, because the standard generated friend declaration would not specify the correct one. This still does not rename DBusError to DBus::Error, but this is a step on the way. * examples/dbus/busserver.cc: Adapated.
* Bring back Gio::Error registration.Murray Cumming2011-02-231-3/+3
| | | | | | | | * gio/src/error.[hg|ccg]: Move Gio::DBus::Error to * gio/src/dbuserror.[hg|ccg]: and temporarily rename it to Gio::DBusError because generate_wrap_init.pl.in is wrapping only on of Gio::Error and Gio::DBus::Error. Unfortunately, we need to fix the generation to handle this properly even when it is called Gio::DBus::DBusError.
* Move the DBus classes into a Gio::DBus namespace.Murray Cumming2011-02-163-31/+31
| | | | | | | | | | | | | | | | | | | | | | * gio/giomm.h: * gio/src/dbus*.[hg|ccg] * gio/src/error.hg: Rename all DBus* classes to remove the prefix, putting them in a Gio::DBus namespace. This required the use of the new _GMMPROC_EXTRA_NAMESPACE macro, to avoid generating a confused wrap_init.cc. Along the way, I removed unnecessary class predeclarations, instead including the relevant header, because that is more convenient for users of the API. * gio/src/dbuserror.[hg|ccg]: Renamed to dbuserrorutils.[hg|ccg] and renamed the Error namespace to ErrorUtils, to avoid a clash with the Gio::DBus::Error exception. * gio/src/filelist.am: * tools/m4/convert_gio.m4: Changed some conversions. * examples/dbus/busserver.cc: * examples/dbus/peer.cc: * examples/dbus/userbus.cc: Adapted. This is generally more organized. A prefix, instead of a namespace, looked generally wrong to C++ coders.
* OptionGroup: Add add_entry() that takes a slot with callback function.Kjell Ahlstedt2011-02-151-3/+91
| | | | | | | | | | | * glib/src/optiongroup.[hg|ccg]: Add add_entry() and add_entry_filename() that take a slot. Add protected option_arg_callback(). An exception thrown by on_pre_parse() or on_post_parse() is propagated to the error argument of g_callback_pre_parse() or post_parse_callback(). * glib/src/optionentry.hg: Add description of set_flags(). * examples/options/main.cc: Add more OptionEntries and callback functions for parsing command option values. Bug 589197 (Hubert Figuiere)
* Fix the make check build with --enable-warnings=fatal.Murray Cumming2011-02-081-3/+3
| | | | * examples/options/main.cc: Comment-out unused method parameters.
* OptionGroup: An on_post_parse() override need not call the base class.Kjell Ahlstedt2011-02-081-6/+7
| | | | | | | | * glib/src/optiongroup.[hg|ccg]: The C post_parse callback is a static protected member function, which performs all necessary post-parsing. OptionGroup::on_post_parse is a dummy function. * examples/options/main.cc: The on_pre_parse, on_post_parse, and on_error overrides don't call the base class functions. Bug 588988.
* Fix the make check build.Murray Cumming2011-01-171-3/+7
| | | | | | * examples/dbus/busserver.cc: Comment out unused methods, to fix the build. I guess this example is still in progress. Otherwise, the commented code should really be removed.
* DBus: Add initial implementation of a bus server/client example.José Alburquerque2011-01-173-5/+206
| | | | | | | | * examples/Makefile.am: * examples/dbus/busserver.cc: Add a partial implementation of the server part of a server/client example that communicate through the user's bus. * examples/dbus/peer.cc: Typos.
* DBus: Avoid errors/exceptions in callbacks due to NULL C strings.José Alburquerque2011-01-131-3/+69
| | | | | | | | | | | * gio/src/dbusconnection.ccg: Modify the callbacks so that if a C string parameter might be NULL, it is passed to the slots as an empty string (""). This avoids possible exceptions from constructing a Glib::ustring from NULL. * gio/src/dbusconnection.hg: Typos. * examples/dbus/peer.cc: Add the usage examples from the C API's example.
* DBusServer: Add docs to the signal_new_connection() signal.José Alburquerque2011-01-131-2/+2
| | | | | | | | | | | * gio/src/dbusserver.hg: Add the docs from the C API to make sure it clear to users that when handling the "new-connection" signal that a reference to the new connection must be kept or the connection will not be accepted. * examples/dbus/peer.cc: Make an exception message more general to cover both a possible exception from the call_sync() call and the close_sync() call.
* DBus Peer Example: Correct some code to complete the example.José Alburquerque2011-01-121-4/+28
| | | | | | | | | | | | | | | | | | | * examples/dbus/peer.cc (keep_connection): renamed to curr_connection. (on_method_call): Place the return value of the method in a tuple which is then returned. (curr_connection): Use this variable to manage incoming connections. The C API docs says that when handling ther DBusServer's signal_new_connection() a reference to the connection should be kept and the handler should return true if the connection should be kept. This variable keeps a reference to the current connection. When the caller finishes, it closes the connection thus allowing the server to accept another connection. (try/catches): Add return statements in the catches that fail so that execution does not continue. The example runs successfully with the previous commit and the patch in bug #639391 filed in the glib bugzilla product page. Hopefully the request will be accepted.
* DBus: Add a peer example to test the DBusServer class.José Alburquerque2011-01-103-4/+265
| | | | | | | | | | | | | | | | | | | | | | | * gio/src/dbusconnection.{ccg,hg}: Reorder the VariantBase 'parameters' parameter in the call*() methods to come after the method_name parameter. * gio/src/dbusintrospection.hg: Use refreturn for methods where the C API does not automatically reference the return. * gio/src/dbusserver.{ccg,hg}: Add non-observable constructors and create() methods. * glib/src/variant.{ccg,hg} (create_tuple): Renamed from create(). Write this method to be more specific for tuples (it's probably the only case where this method might be used). Dealing with tuples still feels awkward with the method. Maybe there's a better way. * examples/Makefile.am: * examples/dbus/peer.cc: * examples/dbus/userbus.cc: * examples/dbus/well-known-address-client.cc: Add the new server/client peer example (named peer). The example crashes because the C API seems to not deal with empty strings "" well, but at least there is now an example. Making sure it runs well is necessary. Also rename the previous example to userbus.cc.
* Variant: Add dictionary entry and dictionary specializations.José Alburquerque2010-12-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | * glib/src/varianttype.hg: * glib/src/variant_basictypes.h.m4: Renamed the glibmmVariant doxygen group to 'Variant'. * glib/src/variant.{ccg,hg}: Throw a std::out_of_range exception instead of a std::runtime_error one from methods that throw them because of indexes being out of bounds. (Variant< std::pair<K, V> >): Added this specialization to deal with a dictionary entry variant type. (Variant< std::map<K, V> >): Added this specialization to deal with variant dictionary types. (VariantContainerBase::get): Have this method throw a std::out_of_range exception if the index is out of range. (Variant< std::vector<Glib::ustring> >::get) (Variant< std::vector<std::string> >::get): Free the shallow copy of the returned string arrays in the get methods of the string variant arrays as the docs of the C API say. * gio/src/dbusconnection.hg: Added missing _IGNORE()'s. * gio/src/dbusproxy.hg: Updated a TODO. * examples/dbus/well-known-address-client.cc: Typo.
* Variant< std::vector<std::string> >: Correct the getting of the array.José Alburquerque2010-12-221-5/+4
| | | | | | | | | | * glib/src/variant.{ccg,hg} (get): Use g_variant_get_bytestring_array() in the get() methods instead of g_variant_get_strv(). * examples/dbus/well-known-address-client.cc: Use a VariantContainerBase to get the result of the proxy's call method instead of a Variant<VariantBase>. Also corrected the comment about why it is done that way.
* DBus: Well known service example: Complete the example.José Alburquerque2010-12-211-4/+25
| | | | | | * examples/dbus/well-known-address-client.cc: Complete the well known service example by calling the 'ListNames' method of the user's session bus.
* 2.27.4.12.27.4.1Murray Cumming2010-12-151-1/+1
|
* DBus Client Example: create a DBusProxy in preparation for method call.José Alburquerque2010-12-141-0/+48
| | | | | | | | | | | * examples/dbus/well-known-address-client.cc: Asynchronously create a DBusProxy which can then be used to call a method on the user's session bus. This tests asynchronous creation of objects that derive from the AsyncInitable interface. The reference counting of the newly created object should be checked because in the SlotAsyncReady slot, the proxy has a reference count of two when it should possibly be one (the g_dbus_proxy_new_finish() docs say that in the callback, unreferencing the proxy destroys it).
* DBus: Client Example: Choose a better name for the source file.José Alburquerque2010-12-082-3/+4
| | | | | | | * examples/dbus/client.cc: Renamed to: * examples/dbus/well-known-address-client.cc: * examples/Makefile.am: Corrected according to renaming above.
* DBus: Client Example: Correct typo.José Alburquerque2010-12-081-1/+1
| | | | | | * examples/dbus/client.cc: Correct a typo in a comment. * tools/m4/convert_gio.m4: Correct alphabetizing of last enum conversion.
* DBus: Add an initial client example accessing a user's bus.José Alburquerque2010-12-082-0/+40
| | | | | * examples/dbus/client.cc: Initial example opening a connection to the user's bus and then printing its unique name.
* Variant<>: Make this usable as an ouput parameter.Murray Cumming2010-07-221-1/+8
| | | | | | | | | * glib/src/variant.[hg|ccg]: VariantBase: Added init(), like Value::init(). This just changes the gobject_, with appropriate unref and ref. * gio/src/settings.[hg|ccg]: get_value(): Use an output parameter for the VariantBase, instead of a return value, as we do for Value, allowing the caller to use a derived (templated) type. * examples/settings/settings.cc: Show how Variant<> can be used.
* Settings example: Minor change.Murray Cumming2010-07-221-2/+2
| | | | | * examples/settings/settings.cc: Remove the unnecessary use of Glib::ustring::raw().
* Revert changes that I did not mean to commit yet.Murray Cumming2010-07-221-8/+1
|
* Variant: Added some methods.Murray Cumming2010-07-221-28/+40
| | | | | | | | | | * glib/src/variant.[hg|ccg]: ValueBase: Wrap some simple functions with _WRAP_METHOD(). * glib/src/variant_basictypes.h.m4: Syntax changes, and make the castitem constructor explicit. * tools/m4/convert_gio.m4: Added necessary conversion. We need to decide how to use this in get*() methods and add some tests.
* Do not install the schema of the gsettings exampleDaniel Elstner2010-06-072-20/+25
| | | | | | | | | | | | | | | | * examples/Makefile.am: Do not install the schema file of the settings example to the user's system. Instead, compile the binary shema cache in a local directory and have the example use that. As a side effect, this also resolves the "make distcheck" failure when trying to install the schema. * examples/settings/settings.cc (main): Do not try to determine the schema directory from the executable name, as it depends too much on the libtool setup with the hidden .libs directory being part of the path name. Requiring the user to change to the example directory is good enough. Also, initialize the C++ locale on program startup, and call Gio::init() instead of Glib::init(). (on_key_changed): Call ustring::raw() to suppress the locale-aware comparison ustring performs by default.
* Avoid compiler warning.Murray Cumming2010-06-041-1/+1
| | | | | * examples/settings/settings.cc: Comment out an unused paramter to fix a compiler warning, to partly fix the distcheck.
* Fix make dist with gsettings exampleJonathon Jongsma2010-06-011-4/+3
|
* Remove the reduced API options and code, as discussed on mailing list.Murray Cumming2010-05-317-163/+0
| | | | | | | | | * configure.ac: Removed the --enable-api-exceptions, --enable-api-properties, --enable-api-vfuncs and --enable-api-default-signal-handlers options. * build/reduced.m4: Removed. * tools/m4/*.m4: * tools/pm/Output.pm: Remove any use of ifdefs and auto_ptr for reduced API. * *.[hg|ccg|h|cc]: Remove the idefed code.
* Add basic Gio::Settings exampleJonathon Jongsma2010-04-213-3/+91
|
* Add compose example to MSVC project filesArmin Burgmeier2010-04-121-2/+6
| | | | | | | | | | | | | 2010-04-12 Armin Burgmeier <armin@arbur.net> * examples/compose/main.cc: Don't use ustring::format with std::fixed with MSVC 2005 or below (see #599340). * MSVC_Net2005/examples/compose/compose.vcproj: * MSVC_Net2005/glibmm.sln: * MSVC_Net2008/examples/compose/compose.vcproj: * MSVC_Net2008/glibmm.sln: Added the compose example for both MSVC versions.
* Update MSVC projects for 2.24Armin Burgmeier2010-04-022-3/+9
|