summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2013-06-27 09:47:26 +0200
committerMurray Cumming <murrayc@murrayc.com>2013-06-27 09:47:26 +0200
commitf2a14f8f1a5eeaabd8cd2bb9d445e3d04a9b2743 (patch)
tree95cd85789a4977d18530579e4e0e4d5c64c6884d /examples
parent110ac620ad7bfa248e4bde54758846847a0fe9f5 (diff)
downloadglibmm-f2a14f8f1a5eeaabd8cd2bb9d445e3d04a9b2743.tar.gz
Revert "C++11: Use auto in examples."
This reverts commit 9b0554e2c9deca2399e654e7984c9dfe3b67e387. This was not meant to be in the master branch.
Diffstat (limited to 'examples')
-rw-r--r--examples/child_watch/main.cc4
-rw-r--r--examples/dbus/client_bus_listnames.cc4
-rw-r--r--examples/dbus/server_without_bus.cc16
-rw-r--r--examples/dbus/session_bus_service.cc12
-rw-r--r--examples/iochannel_stream/fdstream.cc2
-rw-r--r--examples/keyfile/main.cc8
-rw-r--r--examples/markup/parser.cc10
-rw-r--r--examples/network/resolver.cc40
-rw-r--r--examples/network/socket-client.cc24
-rw-r--r--examples/network/socket-server.cc14
-rw-r--r--examples/options/main.cc4
-rw-r--r--examples/properties/properties_example.cc2
-rw-r--r--examples/regex/main.cc2
-rw-r--r--examples/settings/settings.cc4
-rw-r--r--examples/thread/dispatcher.cc2
-rw-r--r--examples/thread/dispatcher2.cc5
-rw-r--r--examples/thread/thread.cc6
17 files changed, 86 insertions, 73 deletions
diff --git a/examples/child_watch/main.cc b/examples/child_watch/main.cc
index 5e9fb673..3bbc368b 100644
--- a/examples/child_watch/main.cc
+++ b/examples/child_watch/main.cc
@@ -38,7 +38,7 @@ private:
void ChildWatch::run()
{
- auto pid = fork();
+ GPid pid = fork();
if(pid==0)
{
@@ -59,7 +59,7 @@ void ChildWatch::on_child_exited(GPid pid, int status)
int main()
{
- auto mainLoop = Glib::MainLoop::create();
+ Glib::RefPtr<Glib::MainLoop> mainLoop = Glib::MainLoop::create();
ChildWatch cwatch(mainLoop);
cwatch.run();
diff --git a/examples/dbus/client_bus_listnames.cc b/examples/dbus/client_bus_listnames.cc
index b44c933e..b46fdcf8 100644
--- a/examples/dbus/client_bus_listnames.cc
+++ b/examples/dbus/client_bus_listnames.cc
@@ -56,7 +56,7 @@ void on_dbus_proxy_available(Glib::RefPtr<Gio::AsyncResult>& result)
result.get_child(names_variant);
// Get the vector of strings.
- const auto names = names_variant.get();
+ std::vector<Glib::ustring> names = names_variant.get();
std::cout << "The names on the message bus are:" << std::endl;
@@ -81,7 +81,7 @@ int main(int, char**)
loop = Glib::MainLoop::create();
// Get the user session bus connection.
- auto connection =
+ Glib::RefPtr<Gio::DBus::Connection> connection =
Gio::DBus::Connection::get_sync(Gio::DBus::BUS_TYPE_SESSION);
// Check for an unavailable connection.
diff --git a/examples/dbus/server_without_bus.cc b/examples/dbus/server_without_bus.cc
index efdda932..d50632dc 100644
--- a/examples/dbus/server_without_bus.cc
+++ b/examples/dbus/server_without_bus.cc
@@ -35,7 +35,7 @@ namespace
static Glib::RefPtr<Gio::DBus::NodeInfo> introspection_data;
-static auto introspection_xml =
+static Glib::ustring introspection_xml =
"<node>"
" <interface name='org.glibmm.DBus.Clock'>"
" <method name='GetTime'>"
@@ -67,12 +67,12 @@ static void on_method_call(const Glib::RefPtr<Gio::DBus::Connection>& /* connect
Glib::TimeVal curr_time;
curr_time.assign_current_time();
- const auto time_str = curr_time.as_iso8601();
- const auto time_var =
+ const Glib::ustring time_str = curr_time.as_iso8601();
+ const Glib::Variant<Glib::ustring> time_var =
Glib::Variant<Glib::ustring>::create(time_str);
// Create the tuple.
- auto response =
+ Glib::VariantContainerBase response =
Glib::VariantContainerBase::create_tuple(time_var);
// Return the tuple with the included time.
@@ -89,7 +89,7 @@ static void on_method_call(const Glib::RefPtr<Gio::DBus::Connection>& /* connect
parameters.get_child(param);
// Get the time string.
- const auto time_str = param.get();
+ const Glib::ustring time_str = param.get();
if(!curr_alarm.assign_from_iso8601(time_str))
{
@@ -114,7 +114,7 @@ const Gio::DBus::InterfaceVTable interface_vtable(sigc::ptr_fun(&on_method_call)
bool on_server_new_connection(const Glib::RefPtr<Gio::DBus::Connection>& connection)
{
- auto credentials =
+ Glib::RefPtr<Gio::Credentials> credentials =
connection->get_peer_credentials();
std::string credentials_str;
@@ -179,7 +179,7 @@ int main(int, char**)
Glib::RefPtr<Gio::DBus::Server> server;
- const auto address = "unix:abstract=myadd";
+ const Glib::ustring address = "unix:abstract=myadd";
try
{
server = Gio::DBus::Server::create_sync(address,
@@ -200,7 +200,7 @@ int main(int, char**)
server->signal_new_connection().connect(sigc::ptr_fun(&on_server_new_connection));
//Keep the server running until the process is killed:
- auto loop = Glib::MainLoop::create();
+ Glib::RefPtr<Glib::MainLoop> loop = Glib::MainLoop::create();
loop->run();
return EXIT_SUCCESS;
diff --git a/examples/dbus/session_bus_service.cc b/examples/dbus/session_bus_service.cc
index dd735f61..0f0bd01d 100644
--- a/examples/dbus/session_bus_service.cc
+++ b/examples/dbus/session_bus_service.cc
@@ -35,7 +35,7 @@ namespace
static Glib::RefPtr<Gio::DBus::NodeInfo> introspection_data;
-static auto introspection_xml =
+static Glib::ustring introspection_xml =
"<node>"
" <interface name='org.glibmm.DBusExample.Clock'>"
" <method name='GetTime'>"
@@ -65,12 +65,12 @@ static void on_method_call(const Glib::RefPtr<Gio::DBus::Connection>& /* connect
Glib::TimeVal curr_time;
curr_time.assign_current_time();
- const auto time_str = curr_time.as_iso8601();
- const auto time_var =
+ const Glib::ustring time_str = curr_time.as_iso8601();
+ const Glib::Variant<Glib::ustring> time_var =
Glib::Variant<Glib::ustring>::create(time_str);
// Create the tuple.
- auto response =
+ Glib::VariantContainerBase response =
Glib::VariantContainerBase::create_tuple(time_var);
// Return the tuple with the included time.
@@ -87,7 +87,7 @@ static void on_method_call(const Glib::RefPtr<Gio::DBus::Connection>& /* connect
parameters.get_child(param);
// Get the time string.
- const auto time_str = param.get();
+ const Glib::ustring time_str = param.get();
if(!curr_alarm.assign_from_iso8601(time_str))
{
@@ -163,7 +163,7 @@ int main(int, char**)
sigc::ptr_fun(&on_name_lost));
//Keep the service running until the process is killed:
- auto loop = Glib::MainLoop::create();
+ Glib::RefPtr<Glib::MainLoop> loop = Glib::MainLoop::create();
loop->run();
Gio::DBus::unown_name(id);
diff --git a/examples/iochannel_stream/fdstream.cc b/examples/iochannel_stream/fdstream.cc
index 50e168eb..be97676f 100644
--- a/examples/iochannel_stream/fdstream.cc
+++ b/examples/iochannel_stream/fdstream.cc
@@ -200,7 +200,7 @@ std::streamsize fdstreambuf::xsgetn(char* dest, std::streamsize num)
// available would normally be 0, but could be up to 2 if there
// have been putbacks or a peek and a putback
- auto available = egptr() - gptr();
+ std::streamsize available = egptr() - gptr();
// if num is less than or equal to the characters already in the
// putback buffer, extract from buffer
diff --git a/examples/keyfile/main.cc b/examples/keyfile/main.cc
index 4562044f..533bc532 100644
--- a/examples/keyfile/main.cc
+++ b/examples/keyfile/main.cc
@@ -42,7 +42,7 @@ int main(int, char**)
// An exception will be thrown if the value is not in the file:
try
{
- const auto 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)
@@ -54,7 +54,7 @@ int main(int, char**)
// An exception will be thrown if the value is not in the file:
try
{
- const auto 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)
@@ -66,9 +66,9 @@ int 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 std::vector<int> values = keyfile.get_integer_list("Another Group", "Numbers");
- for(auto p = values.begin(); p != values.end(); ++p)
+ for(std::vector<int>::const_iterator p = values.begin(); p != values.end(); ++p)
std::cout << "Number list value: item=" << *p << std::endl;
}
catch(const Glib::KeyFileError& ex)
diff --git a/examples/markup/parser.cc b/examples/markup/parser.cc
index 08e33422..30423a66 100644
--- a/examples/markup/parser.cc
+++ b/examples/markup/parser.cc
@@ -32,13 +32,13 @@ void file_get_contents(const std::string& filename, Glib::ustring& contents)
Glib::ustring trim_whitespace(const Glib::ustring& text)
{
- auto pbegin (text.begin());
- auto pend (text.end());
+ Glib::ustring::const_iterator pbegin (text.begin());
+ Glib::ustring::const_iterator pend (text.end());
while(pbegin != pend && Glib::Unicode::isspace(*pbegin))
++pbegin;
- auto temp (pend);
+ Glib::ustring::const_iterator temp (pend);
while(pbegin != temp && Glib::Unicode::isspace(*--temp))
pend = temp;
@@ -84,7 +84,7 @@ void DumpParser::on_start_element(Glib::Markup::ParseContext&,
indent();
std::cout << '<' << element_name;
- for(auto p = attributes.begin(); p != attributes.end(); ++p)
+ for(AttributeMap::const_iterator p = attributes.begin(); p != attributes.end(); ++p)
{
std::cout << ' ' << p->first << "=\"" << p->second << '"';
}
@@ -104,7 +104,7 @@ void DumpParser::on_end_element(Glib::Markup::ParseContext&, const Glib::ustring
void DumpParser::on_text(Glib::Markup::ParseContext&, const Glib::ustring& text)
{
- const auto trimmed_text = trim_whitespace(text);
+ const Glib::ustring trimmed_text = trim_whitespace(text);
if(!trimmed_text.empty())
{
diff --git a/examples/network/resolver.cc b/examples/network/resolver.cc
index 54196f69..4112c146 100644
--- a/examples/network/resolver.cc
+++ b/examples/network/resolver.cc
@@ -95,7 +95,7 @@ print_resolved_addresses (const Glib::ustring& name,
{
G_LOCK (response);
std::cout << Glib::ustring::compose ("Name: %1\n", name);
- for (auto iter = addresses.begin ();
+ for (std::list<Glib::RefPtr<Gio::InetAddress> >::const_iterator iter = addresses.begin ();
iter != addresses.end (); ++iter)
{
std::cout << Glib::ustring::compose ("Address: %1\n", (*iter)->to_string ());
@@ -112,7 +112,7 @@ print_resolved_service (const Glib::ustring& service,
{
G_LOCK (response);
std::cout << Glib::ustring::compose ("Service: %1\n", service);
- for (auto iter = targets.begin ();
+ for (std::list<Gio::SrvTarget>::const_iterator iter = targets.begin ();
iter != targets.end (); ++iter)
{
std::cout <<
@@ -132,14 +132,14 @@ static std::vector<Glib::ustring>
split_service_parts (const Glib::ustring& arg)
{
std::vector<Glib::ustring> parts;
- auto delim1 = arg.find ('/', 0);
+ std::size_t delim1 = 0;
+ std::size_t delim2 = 0;
+ delim1 = arg.find ('/', 0);
if (delim1 == std::string::npos)
return parts;
-
- auto delim2 = arg.find ('/', delim1 + 1);
+ delim2 = arg.find ('/', delim1 + 1);
if (delim2 == std::string::npos)
return parts;
-
parts.push_back (arg.substr (0, delim1));
parts.push_back (arg.substr (delim1 + 1, delim2 - delim1 - 1));
parts.push_back (arg.substr (delim2 + 1));
@@ -154,7 +154,7 @@ lookup_one_sync (const Glib::ustring& arg)
{
std::list<Gio::SrvTarget> targets;
/* service/protocol/domain */
- auto parts = split_service_parts (arg);
+ std::vector<Glib::ustring> parts = split_service_parts (arg);
if (parts.size () != 3) {
usage ();
return;
@@ -173,10 +173,10 @@ lookup_one_sync (const Glib::ustring& arg)
}
else if (Gio::hostname_is_ip_address (arg))
{
- auto addr = Gio::InetAddress::create (arg);
+ Glib::RefPtr<Gio::InetAddress> addr = Gio::InetAddress::create (arg);
try
{
- const auto name = resolver->lookup_by_address (addr, cancellable);
+ Glib::ustring name = resolver->lookup_by_address (addr, cancellable);
print_resolved_name (arg, name);
}
catch (const Gio::ResolverError& err)
@@ -186,9 +186,11 @@ lookup_one_sync (const Glib::ustring& arg)
}
else
{
+ std::list<Glib::RefPtr<Gio::InetAddress> > addresses;
+
try
{
- const auto addresses = resolver->lookup_by_name (arg, cancellable);
+ addresses = resolver->lookup_by_name (arg, cancellable);
print_resolved_addresses (arg, addresses);
}
catch (const Gio::ResolverError& err)
@@ -269,7 +271,7 @@ start_async_lookups (char **argv, int argc)
if (arg.find ('/') != std::string::npos)
{
/* service/protocol/domain */
- auto parts = split_service_parts (arg);
+ std::vector<Glib::ustring> parts = split_service_parts (arg);
if (parts.size () != 3) {
usage ();
return;
@@ -284,7 +286,7 @@ start_async_lookups (char **argv, int argc)
}
else if (Gio::hostname_is_ip_address (argv[i]))
{
- auto addr = Gio::InetAddress::create (argv[i]);
+ Glib::RefPtr<Gio::InetAddress> addr = Gio::InetAddress::create (argv[i]);
resolver->lookup_by_address_async (addr,
sigc::bind (sigc::ptr_fun
@@ -309,7 +311,8 @@ start_async_lookups (char **argv, int argc)
static void
print_connectable_sockaddr (Glib::RefPtr<Gio::SocketAddress> sockaddr)
{
- auto isa =
+ Glib::ustring phys;
+ Glib::RefPtr<Gio::InetSocketAddress> isa =
Glib::RefPtr<Gio::InetSocketAddress>::cast_dynamic (sockaddr);
if (!isa)
@@ -320,7 +323,7 @@ print_connectable_sockaddr (Glib::RefPtr<Gio::SocketAddress> sockaddr)
}
else
{
- const auto phys = isa->get_address ()->to_string ();
+ phys = isa->get_address ()->to_string ();
std::cout << Glib::ustring::compose ("Address: %1%2%3:%4\n",
phys.find (':') != std::string::npos ? "[" : "",
phys,
@@ -379,12 +382,14 @@ Glib::RefPtr<Gio::SocketConnectable> global_connectable;
static void
do_connectable (const std::string& arg, gboolean synchronous)
{
+ std::vector<Glib::ustring> parts;
Glib::RefPtr<Gio::SocketConnectable> connectable;
+ Glib::RefPtr<Gio::SocketAddressEnumerator> enumerator;
if (arg.find ('/') != std::string::npos)
{
/* service/protocol/domain */
- auto parts = split_service_parts (arg);
+ parts = split_service_parts (arg);
if (parts.size () != 3) {
usage ();
return;
@@ -416,7 +421,7 @@ do_connectable (const std::string& arg, gboolean synchronous)
connectable = Gio::NetworkAddress::create (arg, port);
}
- auto enumerator = connectable->enumerate ();
+ enumerator = connectable->enumerate ();
if (synchronous)
do_sync_connectable (enumerator);
@@ -430,10 +435,9 @@ static volatile int cancel_fd;
static void
interrupted (int /*sig*/)
{
- const auto save_errno = errno;
+ const int save_errno = errno;
while (write(cancel_fd, "", 1) < 0 && errno == EINTR)
{}
-
errno = save_errno;
}
diff --git a/examples/network/socket-client.cc b/examples/network/socket-client.cc
index 44ed7046..29122573 100644
--- a/examples/network/socket-client.cc
+++ b/examples/network/socket-client.cc
@@ -28,14 +28,18 @@ static GOptionEntry cmd_entries[] = {
Glib::ustring
socket_address_to_string (const Glib::RefPtr<Gio::SocketAddress>& address)
{
- auto isockaddr =
+ Glib::RefPtr<Gio::InetAddress> inet_address;
+ Glib::ustring str, res;
+ int port;
+
+ Glib::RefPtr<Gio::InetSocketAddress> isockaddr =
Glib::RefPtr<Gio::InetSocketAddress>::cast_dynamic (address);
if (!isockaddr)
return Glib::ustring ();
- auto inet_address = isockaddr->get_address ();
- auto str = inet_address->to_string ();
- auto port = isockaddr->get_port ();
- auto res = Glib::ustring::compose ("%1:%2", str, port);
+ inet_address = isockaddr->get_address ();
+ str = inet_address->to_string ();
+ port = isockaddr->get_port ();
+ res = Glib::ustring::compose ("%1:%2", str, port);
return res;
}
@@ -53,12 +57,14 @@ ensure_condition (const Glib::RefPtr<Gio::Socket>& socket,
const Glib::RefPtr<Gio::Cancellable>& cancellable,
Glib::IOCondition condition)
{
+ GSource *source;
+
if (!non_blocking)
return;
if (use_source)
{
- auto source = g_socket_create_source (socket->gobj (),
+ source = g_socket_create_source (socket->gobj (),
(GIOCondition) condition,
cancellable->gobj ());
g_source_set_callback (source,
@@ -97,12 +103,14 @@ main (int argc,
Glib::RefPtr<Gio::SocketAddress> address;
Gio::SocketType socket_type;
GError *error = NULL;
+ GOptionContext *context;
Glib::RefPtr<Gio::Cancellable> cancellable;
+ Glib::RefPtr<Gio::SocketAddressEnumerator> enumerator;
Glib::RefPtr<Gio::SocketConnectable> connectable;
Gio::init ();
- auto context = g_option_context_new (" <hostname>[:port] - Test GSocket client stuff");
+ context = g_option_context_new (" <hostname>[:port] - Test GSocket client stuff");
g_option_context_add_main_entries (context, cmd_entries, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error))
{
@@ -148,7 +156,7 @@ main (int argc,
return 1;
}
- auto enumerator = connectable->enumerate ();
+ enumerator = connectable->enumerate ();
while (true)
{
try {
diff --git a/examples/network/socket-server.cc b/examples/network/socket-server.cc
index 597e7236..d5078596 100644
--- a/examples/network/socket-server.cc
+++ b/examples/network/socket-server.cc
@@ -62,12 +62,14 @@ ensure_condition (const Glib::RefPtr<Gio::Socket>& socket,
const Glib::RefPtr<Gio::Cancellable>& cancellable,
Glib::IOCondition condition)
{
+ GSource *source;
+
if (!non_blocking)
return;
if (use_source)
{
- const auto source = g_socket_create_source (socket->gobj (),
+ source = g_socket_create_source (socket->gobj (),
(GIOCondition) condition,
cancellable->gobj ());
g_source_set_callback (source,
@@ -102,14 +104,16 @@ main (int argc,
char *argv[])
{
Glib::RefPtr<Gio::Socket> socket, new_socket, recv_socket;
+ Glib::RefPtr<Gio::SocketAddress> src_address;
Glib::RefPtr<Gio::SocketAddress> address;
Gio::SocketType socket_type;
- Glib::RefPtr<Gio::Cancellable> cancellable;
GError *error = NULL;
+ GOptionContext *context;
+ Glib::RefPtr<Gio::Cancellable> cancellable;
Gio::init ();
- auto context = g_option_context_new (" - Test GSocket server stuff");
+ context = g_option_context_new (" - Test GSocket server stuff");
g_option_context_add_main_entries (context, cmd_entries, NULL);
if (!g_option_context_parse (context, &argc, &argv, &error))
{
@@ -141,7 +145,7 @@ main (int argc,
if (non_blocking)
socket->set_blocking (false);
- auto src_address = Gio::InetSocketAddress::create (Gio::InetAddress::create_any ((Gio::SocketFamily) G_SOCKET_FAMILY_IPV4), port);
+ src_address = Gio::InetSocketAddress::create (Gio::InetAddress::create_any ((Gio::SocketFamily) G_SOCKET_FAMILY_IPV4), port);
try {
socket->bind (src_address, !dont_reuse_address);
} catch (const Gio::Error& error) {
@@ -177,7 +181,7 @@ main (int argc,
new_socket->set_blocking (false);
try {
- address = new_socket->get_remote_address ();
+ address = new_socket->get_remote_address ();
} catch (const Gio::Error& error)
{
std::cerr << Glib::ustring::compose ("Error getting remote address: %1\n",
diff --git a/examples/options/main.cc b/examples/options/main.cc
index f0f06699..ee524dac 100644
--- a/examples/options/main.cc
+++ b/examples/options/main.cc
@@ -222,7 +222,7 @@ int main(int argc, char** argv)
//This one shows the results of multiple instance of the same option, such as --list=1 --list=a --list=b
std::cout << " list = ";
- for(auto iter = group.m_arg_list.begin(); iter != group.m_arg_list.end(); ++iter)
+ for(Glib::OptionGroup::vecustrings::const_iterator iter = group.m_arg_list.begin(); iter != group.m_arg_list.end(); ++iter)
{
std::cout << *iter << ", ";
}
@@ -230,7 +230,7 @@ int main(int argc, char** argv)
//This one shows the remaining arguments on the command line, which had no name= form:
std::cout << " remaining = ";
- for(auto iter = group.m_remaining_list.begin(); iter != group.m_remaining_list.end(); ++iter)
+ for(Glib::OptionGroup::vecustrings::const_iterator iter = group.m_remaining_list.begin(); iter != group.m_remaining_list.end(); ++iter)
{
std::cout << *iter << ", ";
}
diff --git a/examples/properties/properties_example.cc b/examples/properties/properties_example.cc
index b12c7631..90111408 100644
--- a/examples/properties/properties_example.cc
+++ b/examples/properties/properties_example.cc
@@ -40,10 +40,8 @@ public:
// the 'changed' signal, etc.
Glib::PropertyProxy<Glib::ustring> property_firstname ()
{ return prop_firstname.get_proxy (); }
-
Glib::PropertyProxy<Glib::ustring> property_lastname ()
{ return prop_lastname.get_proxy (); }
-
Glib::PropertyProxy<int> property_age ()
{ return prop_age.get_proxy (); }
diff --git a/examples/regex/main.cc b/examples/regex/main.cc
index 624b3284..cc128ab2 100644
--- a/examples/regex/main.cc
+++ b/examples/regex/main.cc
@@ -24,7 +24,7 @@ int main(int, char**)
Glib::init();
/* Reusing one regex pattern: */
- auto regex = Glib::Regex::create("(a)?(b)");
+ Glib::RefPtr<Glib::Regex> regex = Glib::Regex::create("(a)?(b)");
std::cout << "Pattern=" << regex->get_pattern()
<< ", with string=abcd, result="
<< std::boolalpha << regex->match("abcd")
diff --git a/examples/settings/settings.cc b/examples/settings/settings.cc
index 8ab588d2..b7ce0ca5 100644
--- a/examples/settings/settings.cc
+++ b/examples/settings/settings.cc
@@ -30,7 +30,7 @@ static void on_key_changed(const Glib::ustring& key, const Glib::RefPtr<Gio::Set
std::cout << Glib::ustring::compose("'%1' changed\n", key);
if (key == STRING_KEY)
{
- auto str = settings->get_string(key);
+ Glib::ustring str = settings->get_string(key);
std::cout << Glib::ustring::compose("New value of '%1': '%2'\n",
key, str);
@@ -63,7 +63,7 @@ int main(int, char**)
Glib::setenv("GSETTINGS_SCHEMA_DIR", ".", true);
Glib::setenv("GSETTINGS_BACKEND", "memory", true);
- const auto settings =
+ const Glib::RefPtr<Gio::Settings> settings =
Gio::Settings::create("org.gtkmm.demo");
settings->signal_changed().connect(sigc::bind(sigc::ptr_fun(&on_key_changed), settings));
diff --git a/examples/thread/dispatcher.cc b/examples/thread/dispatcher.cc
index 5e11fa96..21833e7f 100644
--- a/examples/thread/dispatcher.cc
+++ b/examples/thread/dispatcher.cc
@@ -152,7 +152,7 @@ Application::Application()
{
for (std::vector<ThreadProgress*>::size_type i = 0; i < progress_threads_.size(); ++i)
{
- const auto progress = new ThreadProgress(i + 1);
+ ThreadProgress *const progress = new ThreadProgress(i + 1);
progress_threads_[i] = progress;
progress->signal_finished().connect(
diff --git a/examples/thread/dispatcher2.cc b/examples/thread/dispatcher2.cc
index ac909c88..dd7d7de8 100644
--- a/examples/thread/dispatcher2.cc
+++ b/examples/thread/dispatcher2.cc
@@ -156,10 +156,9 @@ bool ThreadTimer::timeout_handler()
void ThreadTimer::thread_function()
{
// create a new Main Context
- auto context = Glib::MainContext::create();
-
+ Glib::RefPtr<Glib::MainContext> context = Glib::MainContext::create();
// create a new Main Loop
- auto mainloop = Glib::MainLoop::create(context, true);
+ Glib::RefPtr<Glib::MainLoop> mainloop = Glib::MainLoop::create(context, true);
// attach a timeout handler, that is called every second, to the
// newly created MainContext
diff --git a/examples/thread/thread.cc b/examples/thread/thread.cc
index 5601e8c3..ad7cfebd 100644
--- a/examples/thread/thread.cc
+++ b/examples/thread/thread.cc
@@ -70,7 +70,7 @@ void MessageQueue::consumer()
while(queue_.empty())
cond_push_.wait(mutex_);
- const auto i = queue_.front();
+ const int i = queue_.front();
queue_.pop();
std::cout << "\x08 \x08";
std::cout.flush();
@@ -97,10 +97,10 @@ int main(int, char**)
MessageQueue queue;
- const auto producer = Glib::Threads::Thread::create(
+ Glib::Threads::Thread *const producer = Glib::Threads::Thread::create(
sigc::mem_fun(queue, &MessageQueue::producer));
- const auto consumer = Glib::Threads::Thread::create(
+ Glib::Threads::Thread *const consumer = Glib::Threads::Thread::create(
sigc::mem_fun(queue, &MessageQueue::consumer));
producer->join();