[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 298/473: Add support for custom menu files. Closes #48.

noreply at xfce.org noreply at xfce.org
Mon Feb 16 23:57:48 CET 2015


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 822fa9fc8d19fa52d33549d9722045db08dd2be4
Author: Graeme Gott <graeme at gottcode.org>
Date:   Fri Dec 13 11:29:34 2013 -0500

    Add support for custom menu files. Closes #48.
---
 panel-plugin/applications-page.cpp |   11 +++++++++--
 panel-plugin/settings.cpp          |    7 +++++++
 panel-plugin/settings.h            |    2 ++
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/panel-plugin/applications-page.cpp b/panel-plugin/applications-page.cpp
index ed01a01..27503eb 100644
--- a/panel-plugin/applications-page.cpp
+++ b/panel-plugin/applications-page.cpp
@@ -194,9 +194,16 @@ void ApplicationsPage::clear_applications()
 
 void ApplicationsPage::load_garcon_menu()
 {
-	m_garcon_menu = garcon_menu_new_applications();
+	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 (!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;
diff --git a/panel-plugin/settings.cpp b/panel-plugin/settings.cpp
index 3e400cf..c550cb4 100644
--- a/panel-plugin/settings.cpp
+++ b/panel-plugin/settings.cpp
@@ -155,6 +155,8 @@ void Settings::load(char* file)
 	read_vector_entry(rc, "favorites", favorites);
 	read_vector_entry(rc, "recent", recent);
 
+	custom_menu_file = xfce_rc_read_entry(rc, "custom-menu-file", custom_menu_file.c_str());
+
 	button_title = xfce_rc_read_entry(rc, "button-title", button_title.c_str());
 	button_icon_name = xfce_rc_read_entry(rc, "button-icon", button_icon_name.c_str());
 	button_title_visible = xfce_rc_read_bool_entry(rc, "show-button-title", button_title_visible);
@@ -241,6 +243,11 @@ void Settings::save(char* file)
 	write_vector_entry(rc, "favorites", favorites);
 	write_vector_entry(rc, "recent", recent);
 
+	if (!custom_menu_file.empty())
+	{
+		xfce_rc_write_entry(rc, "custom-menu-file", custom_menu_file.c_str());
+	}
+
 	xfce_rc_write_entry(rc, "button-title", button_title.c_str());
 	xfce_rc_write_entry(rc, "button-icon", button_icon_name.c_str());
 	xfce_rc_write_bool_entry(rc, "show-button-title", button_title_visible);
diff --git a/panel-plugin/settings.h b/panel-plugin/settings.h
index 8e7fcf8..9e7e325 100644
--- a/panel-plugin/settings.h
+++ b/panel-plugin/settings.h
@@ -57,6 +57,8 @@ public:
 	std::vector<std::string> favorites;
 	std::vector<std::string> recent;
 
+	std::string custom_menu_file;
+
 	std::string button_title;
 	std::string button_icon_name;
 	bool button_title_visible;

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


More information about the Xfce4-commits mailing list