[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 03/03: Only force width when commands are next to search.

noreply at xfce.org noreply at xfce.org
Fri Aug 12 11:43:35 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 0c58dc524f3dae7b5ad60baf08a1ea27769c5dea
Author: Graeme Gott <graeme at gottcode.org>
Date:   Fri Aug 12 05:29:07 2016 -0400

    Only force width when commands are next to search.
---
 panel-plugin/window.cpp | 22 ++++++++++++++--------
 panel-plugin/window.h   |  1 +
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/panel-plugin/window.cpp b/panel-plugin/window.cpp
index dbd9c93..3a6b909 100644
--- a/panel-plugin/window.cpp
+++ b/panel-plugin/window.cpp
@@ -41,6 +41,7 @@ using namespace WhiskerMenu;
 
 WhiskerMenu::Window::Window() :
 	m_window(NULL),
+	m_sidebar_size_group(NULL),
 	m_layout_left(true),
 	m_layout_bottom(true),
 	m_layout_search_alternate(false),
@@ -198,10 +199,6 @@ WhiskerMenu::Window::Window() :
 	gtk_container_add(GTK_CONTAINER(m_sidebar), viewport);
 	gtk_container_add(GTK_CONTAINER(viewport), GTK_WIDGET(m_sidebar_buttons));
 
-	GtkSizeGroup* sidebar_size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
-	gtk_size_group_add_widget(sidebar_size_group, GTK_WIDGET(m_sidebar));
-	gtk_size_group_add_widget(sidebar_size_group, GTK_WIDGET(m_commands_align));
-
 	// Show widgets
 	gtk_widget_show_all(frame);
 	gtk_widget_hide(m_favorites->get_widget());
@@ -437,20 +434,29 @@ void WhiskerMenu::Window::show(GtkWidget* parent, bool horizontal)
 	{
 		m_layout_left = !layout_left;
 		m_layout_commands_alternate = wm_settings->position_commands_alternate;
+
+		g_object_ref(m_commands_align);
 		if (m_layout_commands_alternate)
 		{
-			g_object_ref(m_commands_align);
+			if (!wm_settings->position_categories_alternate)
+			{
+				m_sidebar_size_group = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+				gtk_size_group_add_widget(m_sidebar_size_group, GTK_WIDGET(m_sidebar));
+				gtk_size_group_add_widget(m_sidebar_size_group, GTK_WIDGET(m_commands_align));
+			}
+
 			gtk_container_remove(GTK_CONTAINER(m_title_box), GTK_WIDGET(m_commands_align));
 			gtk_box_pack_start(m_search_box, GTK_WIDGET(m_commands_align), false, false, 0);
-			g_object_unref(m_commands_align);
 		}
 		else
 		{
-			g_object_ref(m_commands_align);
+			g_object_unref(m_sidebar_size_group);
+			m_sidebar_size_group = NULL;
+
 			gtk_container_remove(GTK_CONTAINER(m_search_box), GTK_WIDGET(m_commands_align));
 			gtk_box_pack_start(m_title_box, GTK_WIDGET(m_commands_align), false, false, 0);
-			g_object_unref(m_commands_align);
 		}
+		g_object_unref(m_commands_align);
 	}
 	if ((layout_left && !wm_settings->position_categories_alternate)
 			|| (!layout_left && wm_settings->position_categories_alternate))
diff --git a/panel-plugin/window.h b/panel-plugin/window.h
index e8f3e3c..fec8e50 100644
--- a/panel-plugin/window.h
+++ b/panel-plugin/window.h
@@ -121,6 +121,7 @@ private:
 	SectionButton* m_favorites_button;
 	SectionButton* m_recent_button;
 	SectionButton* m_default_button;
+	GtkSizeGroup* m_sidebar_size_group;
 
 	GdkRectangle m_geometry;
 	bool m_layout_left;

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


More information about the Xfce4-commits mailing list