[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 01/01: Fix losing categories by reverting single garcon instance. (bug #12541)

noreply at xfce.org noreply at xfce.org
Fri Apr 15 02:10:05 CEST 2016


This is an automated email from the git hooks/post-receive script.

gottcode pushed a commit to branch master
in repository panel-plugins/xfce4-whiskermenu-plugin.

commit d643f54344a00db479fe47a37c77c98862ef7e68
Author: Graeme Gott <graeme at gottcode.org>
Date:   Thu Apr 14 19:33:02 2016 -0400

    Fix losing categories by reverting single garcon instance. (bug #12541)
---
 panel-plugin/applications-page.cpp | 78 ++++++++++++++++++--------------------
 1 file changed, 37 insertions(+), 41 deletions(-)

diff --git a/panel-plugin/applications-page.cpp b/panel-plugin/applications-page.cpp
index 993850e..2b9afa1 100644
--- a/panel-plugin/applications-page.cpp
+++ b/panel-plugin/applications-page.cpp
@@ -69,18 +69,6 @@ ApplicationsPage::ApplicationsPage(Window* window) :
 ApplicationsPage::~ApplicationsPage()
 {
 	clear_applications();
-
-	// Free menu
-	if (G_LIKELY(m_garcon_menu))
-	{
-		g_object_unref(m_garcon_menu);
-	}
-
-	// Free settings menu
-	if (G_LIKELY(m_garcon_settings_menu))
-	{
-		g_object_unref(m_garcon_settings_menu);
-	}
 }
 
 //-----------------------------------------------------------------------------
@@ -217,6 +205,20 @@ void ApplicationsPage::clear_applications()
 		delete i->second;
 	}
 	m_items.clear();
+
+	// Free menu
+	if (G_LIKELY(m_garcon_menu))
+	{
+		g_object_unref(m_garcon_menu);
+		m_garcon_menu = NULL;
+	}
+
+	// Free settings menu
+	if (G_LIKELY(m_garcon_settings_menu))
+	{
+		g_object_unref(m_garcon_settings_menu);
+		m_garcon_settings_menu = NULL;
+	}
 }
 
 //-----------------------------------------------------------------------------
@@ -224,47 +226,41 @@ void ApplicationsPage::clear_applications()
 void ApplicationsPage::load_contents()
 {
 	// Create menu
-	if (!m_garcon_menu)
+	if (wm_settings->custom_menu_file.empty())
 	{
-		if (wm_settings->custom_menu_file.empty())
-		{
-			m_garcon_menu = garcon_menu_new_applications();
-		}
-		else
-		{
-			m_garcon_menu = garcon_menu_new_for_path(wm_settings->custom_menu_file.c_str());
-		}
-
-		if (!m_garcon_menu)
-		{
-			m_load_status = STATUS_INVALID;
-			return;
-		}
-
-		g_signal_connect_slot<GarconMenu*>(m_garcon_menu, "reload-required", &ApplicationsPage::invalidate_applications, this);
+		m_garcon_menu = garcon_menu_new_applications();
 	}
-
-	// Create settings menu
-	if (!m_garcon_settings_menu)
+	else
 	{
-		gchar* path = xfce_resource_lookup(XFCE_RESOURCE_CONFIG, "menus/xfce-settings-manager.menu");
-		m_garcon_settings_menu = garcon_menu_new_for_path(path != NULL ? path : SETTINGS_MENUFILE);
-		g_free(path);
-
-		if (m_garcon_settings_menu)
-		{
-			g_signal_connect_slot<GarconMenu*>(m_garcon_settings_menu, "reload-required", &ApplicationsPage::invalidate_applications, this);
-		}
+		m_garcon_menu = garcon_menu_new_for_path(wm_settings->custom_menu_file.c_str());
 	}
 
 	// Load menu
-	if (!garcon_menu_load(m_garcon_menu, NULL, NULL))
+	if (m_garcon_menu && !garcon_menu_load(m_garcon_menu, NULL, NULL))
+	{
+		g_object_unref(m_garcon_menu);
+		m_garcon_menu = NULL;
+	}
+
+	if (!m_garcon_menu)
 	{
 		m_load_status = STATUS_INVALID;
 		return;
 	}
+
+	g_signal_connect_slot<GarconMenu*>(m_garcon_menu, "reload-required", &ApplicationsPage::invalidate_applications, this);
 	load_menu(m_garcon_menu, NULL);
 
+	// Create settings menu
+	gchar* path = xfce_resource_lookup(XFCE_RESOURCE_CONFIG, "menus/xfce-settings-manager.menu");
+	m_garcon_settings_menu = garcon_menu_new_for_path(path != NULL ? path : SETTINGS_MENUFILE);
+	g_free(path);
+
+	if (m_garcon_settings_menu)
+	{
+		g_signal_connect_slot<GarconMenu*>(m_garcon_settings_menu, "reload-required", &ApplicationsPage::invalidate_applications, this);
+	}
+
 	// Load settings menu
 	if (m_garcon_settings_menu && garcon_menu_load(m_garcon_settings_menu, NULL, NULL))
 	{

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list