[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 325/473: Fixes to the button layout
noreply at xfce.org
noreply at xfce.org
Mon Feb 16 23:58:15 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 84e3f26535e04c1e37cf02754ff1a161630a25ce
Author: Andrzej <ndrwrdck at gmail.com>
Date: Sun Dec 29 20:51:55 2013 +0000
Fixes to the button layout
Mostly in vertical and deskbar mode.
---
panel-plugin/plugin.cpp | 26 +++++++++++++++++++++-----
1 file changed, 21 insertions(+), 5 deletions(-)
diff --git a/panel-plugin/plugin.cpp b/panel-plugin/plugin.cpp
index 01680c4..18d3c1d 100644
--- a/panel-plugin/plugin.cpp
+++ b/panel-plugin/plugin.cpp
@@ -87,7 +87,7 @@ Plugin::Plugin(XfcePanelPlugin* plugin) :
gtk_widget_show(GTK_WIDGET(m_button_box));
m_button_icon = XFCE_PANEL_IMAGE(xfce_panel_image_new_from_source(wm_settings->button_icon_name.c_str()));
- gtk_box_pack_start(m_button_box, GTK_WIDGET(m_button_icon), false, false, 0);
+ gtk_box_pack_start(m_button_box, GTK_WIDGET(m_button_icon), true, false, 0);
if (wm_settings->button_icon_visible)
{
gtk_widget_show(GTK_WIDGET(m_button_icon));
@@ -333,14 +333,13 @@ void Plugin::save()
gboolean Plugin::size_changed(XfcePanelPlugin*, gint size)
{
+ GtkOrientation panel_orientation = xfce_panel_plugin_get_orientation(m_plugin);
+ GtkOrientation orientation = panel_orientation;
#if (LIBXFCE4PANEL_CHECK_VERSION(4,9,0))
gint row_size = size / xfce_panel_plugin_get_nrows(m_plugin);
XfcePanelPluginMode mode = xfce_panel_plugin_get_mode(m_plugin);
- GtkOrientation orientation = (mode == XFCE_PANEL_PLUGIN_MODE_HORIZONTAL)
- ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL;
#else
gint row_size = size;
- GtkOrientation orientation = xfce_panel_plugin_get_orientation(m_plugin);
#endif
// Resize icon
@@ -356,7 +355,10 @@ gboolean Plugin::size_changed(XfcePanelPlugin*, gint size)
// Put title next to icon if panel is wide enough
GtkRequisition label_size;
gtk_widget_size_request(GTK_WIDGET(m_button_label), &label_size);
- if (label_size.width <= (size - row_size))
+ if (mode == XFCE_PANEL_PLUGIN_MODE_DESKBAR &&
+ wm_settings->button_title_visible &&
+ wm_settings->button_icon_visible &&
+ label_size.width <= (size - row_size))
{
orientation = GTK_ORIENTATION_HORIZONTAL;
}
@@ -367,8 +369,22 @@ gboolean Plugin::size_changed(XfcePanelPlugin*, gint size)
}
#endif
+ // Fix alignment in deskbar mode
+ if (panel_orientation == GTK_ORIENTATION_VERTICAL &&
+ orientation == GTK_ORIENTATION_HORIZONTAL)
+ {
+ gtk_box_set_child_packing(m_button_box, GTK_WIDGET(m_button_icon), false, false, 0, GTK_PACK_START);
+ gtk_box_set_child_packing(m_button_box, GTK_WIDGET(m_button_label), false, false, 0, GTK_PACK_START);
+ }
+ else
+ {
+ gtk_box_set_child_packing(m_button_box, GTK_WIDGET(m_button_icon), true, false, 0, GTK_PACK_START);
+ gtk_box_set_child_packing(m_button_box, GTK_WIDGET(m_button_label), true, true, 0, GTK_PACK_START);
+ }
+
gtk_orientable_set_orientation(GTK_ORIENTABLE(m_button_box), orientation);
+
return true;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list