summaryrefslogtreecommitdiff
path: root/examples/dbus
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2015-07-15 14:22:59 +0200
committerMurray Cumming <murrayc@murrayc.com>2015-07-15 14:22:59 +0200
commitb5e068e288a0e9d031c725d5c9423d63daef6a44 (patch)
tree115f6415d22600a0f1d3df8c5e6d8ce2ff80d1b4 /examples/dbus
parentac8300539d154e6fb4d3663ed331971887df029d (diff)
downloadglibmm-b5e068e288a0e9d031c725d5c9423d63daef6a44.tar.gz
C++11: examples/tests: More use of auto.
Diffstat (limited to 'examples/dbus')
-rw-r--r--examples/dbus/client_bus_listnames.cc4
-rw-r--r--examples/dbus/server_without_bus.cc6
-rw-r--r--examples/dbus/session_bus_service.cc4
3 files changed, 7 insertions, 7 deletions
diff --git a/examples/dbus/client_bus_listnames.cc b/examples/dbus/client_bus_listnames.cc
index 06fc5887..7b9adad6 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)
call_result.get_child(names_variant);
// Get the vector of strings.
- std::vector<Glib::ustring> names = names_variant.get();
+ auto 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.
- Glib::RefPtr<Gio::DBus::Connection> connection =
+ auto 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 005dc554..6002c149 100644
--- a/examples/dbus/server_without_bus.cc
+++ b/examples/dbus/server_without_bus.cc
@@ -68,7 +68,7 @@ static void on_method_call(const Glib::RefPtr<Gio::DBus::Connection>& /* connect
curr_time.assign_current_time();
const Glib::ustring time_str = curr_time.as_iso8601();
- const Glib::Variant<Glib::ustring> time_var =
+ const auto time_var =
Glib::Variant<Glib::ustring>::create(time_str);
// Create the tuple.
@@ -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)
{
- Glib::RefPtr<Gio::Credentials> credentials =
+ auto credentials =
connection->get_peer_credentials();
std::string credentials_str;
@@ -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:
- Glib::RefPtr<Glib::MainLoop> loop = Glib::MainLoop::create();
+ auto 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 b5ec2a71..ed320b8b 100644
--- a/examples/dbus/session_bus_service.cc
+++ b/examples/dbus/session_bus_service.cc
@@ -66,7 +66,7 @@ static void on_method_call(const Glib::RefPtr<Gio::DBus::Connection>& /* connect
curr_time.assign_current_time();
const Glib::ustring time_str = curr_time.as_iso8601();
- const Glib::Variant<Glib::ustring> time_var =
+ const auto time_var =
Glib::Variant<Glib::ustring>::create(time_str);
// Create the tuple.
@@ -163,7 +163,7 @@ int main(int, char**)
sigc::ptr_fun(&on_name_lost));
//Keep the service running until the process is killed:
- Glib::RefPtr<Glib::MainLoop> loop = Glib::MainLoop::create();
+ auto loop = Glib::MainLoop::create();
loop->run();
Gio::DBus::unown_name(id);