From 84c05b793c1ac6524aeeaf5944c2a7f0a89a4a65 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Thu, 2 Oct 2014 02:03:22 +0200 Subject: [PATCH] client: cleanup, reuse enum_configs in command_list_configs --- client/snapper.cc | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/client/snapper.cc b/client/snapper.cc index 9be54576..d1c9f0fa 100644 --- a/client/snapper.cc +++ b/client/snapper.cc @@ -184,27 +184,14 @@ command_list_configs(DBus::Connection* conn, Snapper* snapper) header.add(_("Subvolume")); table.setHeader(header); - if (no_dbus) - { - list config_infos = Snapper::getConfigs(); - for (list::const_iterator it = config_infos.begin(); it != config_infos.end(); ++it) - { - TableRow row; - row.add(it->getConfigName()); - row.add(it->getSubvolume()); - table.add(row); - } - } - else + list > configs = enum_configs(conn); + + for (list >::iterator it = configs.begin(); it != configs.end(); ++it) { - list config_infos = command_list_xconfigs(*conn); - for (list::const_iterator it = config_infos.begin(); it != config_infos.end(); ++it) - { - TableRow row; - row.add(it->config_name); - row.add(it->subvolume); - table.add(row); - } + TableRow row; + row.add(it->first); + row.add(it->second); + table.add(row); } cout << table; -- 2.47.3