[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 25/28: Fix plugin not respecting panel row height.

noreply at xfce.org noreply at xfce.org
Sat Aug 20 18:33:21 CEST 2016


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

gottcode pushed a commit to annotated tag v1.0.1
in repository panel-plugins/xfce4-whiskermenu-plugin.

commit 1619b4ca044a7f1bd59443f9b282c0cf837561fc
Author: Graeme Gott <graeme at gottcode.org>
Date:   Thu Jun 27 06:15:41 2013 -0400

    Fix plugin not respecting panel row height.
---
 src/panel_plugin.cpp | 25 +++++++++++++++++++++++--
 src/panel_plugin.hpp |  1 +
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/panel_plugin.cpp b/src/panel_plugin.cpp
index 885cf7e..c5967c8 100644
--- a/src/panel_plugin.cpp
+++ b/src/panel_plugin.cpp
@@ -69,7 +69,6 @@ PanelPlugin::PanelPlugin(XfcePanelPlugin* plugin) :
 	m_button = xfce_create_panel_toggle_button();
 	gtk_button_set_relief(GTK_BUTTON(m_button), GTK_RELIEF_NONE);
 	m_button_icon = XFCE_PANEL_IMAGE(xfce_panel_image_new_from_source(m_button_icon_name.c_str()));
-	xfce_panel_image_set_size(m_button_icon, -1);
 	gtk_container_add(GTK_CONTAINER(m_button), GTK_WIDGET(m_button_icon));
 	gtk_widget_show_all(m_button);
 	g_signal_connect(m_button, "button-press-event", SLOT_CALLBACK(PanelPlugin::button_clicked), this);
@@ -81,6 +80,7 @@ PanelPlugin::PanelPlugin(XfcePanelPlugin* plugin) :
 	// Connect plugin signals to functions
 	g_signal_connect(plugin, "free-data", G_CALLBACK(whiskermenu_free), this);
 	g_signal_connect_swapped(plugin, "configure-plugin", SLOT_CALLBACK(PanelPlugin::configure), this);
+	g_signal_connect(plugin, "orientation-changed", SLOT_CALLBACK(PanelPlugin::orientation_changed), this);
 	g_signal_connect_swapped(plugin, "save", SLOT_CALLBACK(PanelPlugin::save), this);
 	g_signal_connect(plugin, "size-changed", SLOT_CALLBACK(PanelPlugin::size_changed), this);
 	xfce_panel_plugin_menu_show_configure(plugin);
@@ -172,6 +172,13 @@ void PanelPlugin::configure()
 
 //-----------------------------------------------------------------------------
 
+void PanelPlugin::orientation_changed(XfcePanelPlugin*, GtkOrientation)
+{
+	size_changed(m_plugin, xfce_panel_plugin_get_size(m_plugin));
+}
+
+//-----------------------------------------------------------------------------
+
 void PanelPlugin::save()
 {
 	gchar* file = xfce_panel_plugin_save_location(m_plugin, true);
@@ -194,7 +201,21 @@ void PanelPlugin::save()
 
 gboolean PanelPlugin::size_changed(XfcePanelPlugin*, gint size)
 {
-	gtk_widget_set_size_request(GTK_WIDGET(m_plugin), size, size);
+#if (LIBXFCE4PANEL_CHECK_VERSION(4,10,0))
+	gint row_size = size / xfce_panel_plugin_get_nrows(m_plugin);
+#else
+	gint row_size = size;
+#endif
+
+	xfce_panel_image_set_size(m_button_icon, -1);
+	if (xfce_panel_plugin_get_orientation(m_plugin) == GTK_ORIENTATION_HORIZONTAL)
+	{
+		gtk_widget_set_size_request(GTK_WIDGET(m_plugin), row_size, size);
+	}
+	else
+	{
+		gtk_widget_set_size_request(GTK_WIDGET(m_plugin), size, row_size);
+	}
 	return true;
 }
 
diff --git a/src/panel_plugin.hpp b/src/panel_plugin.hpp
index 4ba3efb..3f7a107 100644
--- a/src/panel_plugin.hpp
+++ b/src/panel_plugin.hpp
@@ -57,6 +57,7 @@ private:
 	SLOT_0(void, PanelPlugin, menu_hidden);
 	SLOT_0(void, PanelPlugin, menu_shown);
 	SLOT_0(void, PanelPlugin, configure);
+	SLOT_2(void, PanelPlugin, orientation_changed, XfcePanelPlugin*, GtkOrientation);
 	SLOT_0(void, PanelPlugin, save);
 	SLOT_2(gboolean, PanelPlugin, size_changed, XfcePanelPlugin*, gint);
 

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


More information about the Xfce4-commits mailing list