[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 37/473: Fix plugin not respecting panel row height.
noreply at xfce.org
noreply at xfce.org
Mon Feb 16 23:53:27 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 173f099ef725e971d2f7bafd1d6116090e836f92
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 4c7a2fb..bea95f0 100644
--- a/src/panel_plugin.cpp
+++ b/src/panel_plugin.cpp
@@ -68,7 +68,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);
@@ -80,6 +79,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(plugin, "remote-event", SLOT_CALLBACK(PanelPlugin::remote_event), this);
g_signal_connect_swapped(plugin, "save", SLOT_CALLBACK(PanelPlugin::save), this);
g_signal_connect(plugin, "size-changed", SLOT_CALLBACK(PanelPlugin::size_changed), this);
@@ -164,6 +164,13 @@ void PanelPlugin::configure()
//-----------------------------------------------------------------------------
+void PanelPlugin::orientation_changed(XfcePanelPlugin*, GtkOrientation)
+{
+ size_changed(m_plugin, xfce_panel_plugin_get_size(m_plugin));
+}
+
+//-----------------------------------------------------------------------------
+
gboolean PanelPlugin::remote_event(XfcePanelPlugin*, gchar* name, GValue*)
{
if (strcmp(name, "popup") || gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(m_button)))
@@ -200,7 +207,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 e556b22..a30932c 100644
--- a/src/panel_plugin.hpp
+++ b/src/panel_plugin.hpp
@@ -56,6 +56,7 @@ private:
SLOT_2(gboolean, PanelPlugin, button_clicked, GtkWidget*, GdkEventButton*);
SLOT_0(void, PanelPlugin, menu_hidden);
SLOT_0(void, PanelPlugin, configure);
+ SLOT_2(void, PanelPlugin, orientation_changed, XfcePanelPlugin*, GtkOrientation);
SLOT_3(gboolean, PanelPlugin, remote_event, XfcePanelPlugin*, gchar*, GValue*);
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