[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 02/02: Stretch iconview columns to fit.
noreply at xfce.org
noreply at xfce.org
Sun Feb 9 18:44:07 CET 2020
This is an automated email from the git hooks/post-receive script.
g o t t c o d e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository panel-plugins/xfce4-whiskermenu-plugin.
commit 98a6cf3bc74f5c8722f5338c7272d6e8fc74ce3b
Author: Graeme Gott <graeme at gottcode.org>
Date: Sun Feb 9 10:01:39 2020 -0500
Stretch iconview columns to fit.
---
panel-plugin/icon-renderer.cpp | 27 ++++++++++++++++++++++++---
panel-plugin/launcher-icon-view.cpp | 22 +---------------------
2 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/panel-plugin/icon-renderer.cpp b/panel-plugin/icon-renderer.cpp
index f00f64d..5fb790c 100644
--- a/panel-plugin/icon-renderer.cpp
+++ b/panel-plugin/icon-renderer.cpp
@@ -28,6 +28,7 @@ struct _WhiskerMenuIconRenderer
gpointer launcher;
GIcon* gicon;
gint size;
+ bool stretch;
};
#define WHISKERMENU_TYPE_ICON_RENDERER whiskermenu_icon_renderer_get_type()
@@ -41,6 +42,7 @@ enum
PROP_LAUNCHER,
PROP_GICON,
PROP_SIZE,
+ PROP_STRETCH
};
//-----------------------------------------------------------------------------
@@ -53,14 +55,19 @@ static void whiskermenu_icon_renderer_get_preferred_width(GtkCellRenderer* rende
gtk_cell_renderer_get_padding(renderer, &pad, nullptr);
gint width = (pad * 2) + icon_renderer->size;
- if (minimum)
+ if (icon_renderer->stretch)
{
- *minimum = width;
+ width += 76 - (icon_renderer->size / 2);
}
- if (natural)
+ else if (natural)
{
*natural = width;
}
+
+ if (minimum)
+ {
+ *minimum = width;
+ }
}
//-----------------------------------------------------------------------------
@@ -174,6 +181,10 @@ static void whiskermenu_icon_renderer_get_property(GObject* object, guint prop_i
g_value_set_int(value, icon_renderer->size);
break;
+ case PROP_STRETCH:
+ g_value_set_boolean(value, icon_renderer->stretch);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -204,6 +215,10 @@ static void whiskermenu_icon_renderer_set_property(GObject* object, guint prop_i
icon_renderer->size = g_value_get_int(value);
break;
+ case PROP_STRETCH:
+ icon_renderer->stretch = g_value_get_boolean(value);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -254,6 +269,12 @@ static void whiskermenu_icon_renderer_class_init(WhiskerMenuIconRendererClass* k
g_param_spec_int("size", "size", "size",
1, G_MAXINT, 48,
GParamFlags(G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
+
+ g_object_class_install_property(gobject_class,
+ PROP_STRETCH,
+ g_param_spec_boolean("stretch", "stretch", "stretch",
+ false,
+ GParamFlags(G_PARAM_CONSTRUCT | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)));
}
//-----------------------------------------------------------------------------
diff --git a/panel-plugin/launcher-icon-view.cpp b/panel-plugin/launcher-icon-view.cpp
index 22b4c08..e5328d1 100644
--- a/panel-plugin/launcher-icon-view.cpp
+++ b/panel-plugin/launcher-icon-view.cpp
@@ -36,6 +36,7 @@ LauncherIconView::LauncherIconView() :
m_icon_renderer = whiskermenu_icon_renderer_new();
g_object_set(m_icon_renderer,
+ "stretch", true,
"xalign", 0.5,
"yalign", 1.0,
nullptr);
@@ -235,49 +236,28 @@ void LauncherIconView::reload_icon_size()
// Adjust item size
int padding = 2;
- int width = 88;
switch (wm_settings->launcher_icon_size)
{
case IconSize::Smallest:
- padding = 2;
- width = 88;
- break;
-
case IconSize::Smaller:
padding = 2;
- width = 92;
break;
case IconSize::Small:
- padding = 4;
- width = 100;
- break;
-
case IconSize::Normal:
- padding = 4;
- width = 108;
- break;
-
case IconSize::Large:
padding = 4;
- width = 116;
break;
case IconSize::Larger:
- padding = 6;
- width = 136;
- break;
-
case IconSize::Largest:
padding = 6;
- width = 152;
break;
default:
break;
}
gtk_icon_view_set_item_padding(m_view, padding);
- gtk_icon_view_set_item_width(m_view, width);
}
//-----------------------------------------------------------------------------
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list