From 0cd517399a4fafa6578b63ba45cee8968b317058 Mon Sep 17 00:00:00 2001 From: Kjell Ahlstedt Date: Sat, 2 Feb 2019 10:08:42 +0100 Subject: Glib::KeyFile: Make it a _CLASS_OPAQUE_REFCOUNTED * examples/keyfile/main.cc: * gio/src/desktopappinfo.hg: Store KeyFile in a RefPtr. * glib/src/keyfile.[ccg|hg]: Replace _CLASS_GENERIC by _CLASS_OPAQUE_REFCOUNTED. Remove handcoded methods that are now generated by gmmproc. * tools/m4/convert_glib.m4: Update conversion for KeyFile. GKeyFile is refcounted since 2009. --- examples/keyfile/main.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'examples/keyfile/main.cc') diff --git a/examples/keyfile/main.cc b/examples/keyfile/main.cc index c75719d0..a1b61556 100644 --- a/examples/keyfile/main.cc +++ b/examples/keyfile/main.cc @@ -24,12 +24,12 @@ main(int, char**) const std::string filepath = "./example.ini"; - Glib::KeyFile keyfile; + auto keyfile = Glib::KeyFile::create(); // An exception will be thrown if the file is not there, or if the file is incorrectly formatted: try { - keyfile.load_from_file(filepath); + keyfile->load_from_file(filepath); } catch (const Glib::Error& ex) { @@ -41,7 +41,7 @@ main(int, char**) // An exception will be thrown if the value is not in the file: try { - const Glib::ustring value = keyfile.get_value("somegroup", "somekey"); + const Glib::ustring value = keyfile->get_value("somegroup", "somekey"); std::cout << "somekey value=" << value << std::endl; } catch (const Glib::KeyFileError& ex) @@ -53,7 +53,7 @@ main(int, char**) // An exception will be thrown if the value is not in the file: try { - const Glib::ustring value = keyfile.get_value("First Group", "Welcome"); + const Glib::ustring value = keyfile->get_value("First Group", "Welcome"); std::cout << "Welcome value=" << value << std::endl; } catch (const Glib::KeyFileError& ex) @@ -65,7 +65,7 @@ main(int, char**) // An exception will be thrown if the value is not in the file: try { - const auto values = keyfile.get_integer_list("Another Group", "Numbers"); + const auto values = keyfile->get_integer_list("Another Group", "Numbers"); for (const auto& p : values) std::cout << "Number list value: item=" << p << std::endl; -- cgit v1.2.1