From d40397906cb1e04cb225598ae0faacb8019ebf90 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 4 Nov 2014 18:27:35 -0600 Subject: Parse through sections as well --- tests/indicator-fixture.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/indicator-fixture.h b/tests/indicator-fixture.h index f2039f7..4b510a0 100644 --- a/tests/indicator-fixture.h +++ b/tests/indicator-fixture.h @@ -176,9 +176,14 @@ class IndicatorFixture : public ::testing::Test if (menuLocation + 1 == menuEnd) return getMenuAttributeVal(*menuLocation, menu, attribute, value); - auto submenu = std::shared_ptr(g_menu_model_get_item_link(menu.get(), *menuLocation, G_MENU_LINK_SUBMENU), [](GMenuModel * modelptr) { + auto clearfunc = [](GMenuModel * modelptr) { g_clear_object(&modelptr); - }); + }; + + auto submenu = std::shared_ptr(g_menu_model_get_item_link(menu.get(), *menuLocation, G_MENU_LINK_SUBMENU), clearfunc); + + if (submenu == nullptr) + submenu = std::shared_ptr(g_menu_model_get_item_link(menu.get(), *menuLocation, G_MENU_LINK_SECTION), clearfunc); if (submenu == nullptr) return nullptr; -- cgit v1.2.3