[Xfce4-commits] <xfce4-panel:master> Systray: Control the thinkness of the frame (bug #7593).
Nick Schermer
noreply at xfce.org
Sun Sep 11 20:18:01 CEST 2011
Updating branch refs/heads/master
to 00aea5208c00deb7e1f982815971b8cb15679f6e (commit)
from 3bb8fea830be758a8af556427ef81f41782ef39c (commit)
commit 00aea5208c00deb7e1f982815971b8cb15679f6e
Author: Nick Schermer <nick at xfce.org>
Date: Sun Sep 11 19:54:31 2011 +0200
Systray: Control the thinkness of the frame (bug #7593).
Instead of the previous commits, control the brightness in
a better way.
plugins/systray/systray-box.c | 2 +-
plugins/systray/systray.c | 20 ++++++++++++++++----
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/plugins/systray/systray-box.c b/plugins/systray/systray-box.c
index 11fe6da..06f0b46 100644
--- a/plugins/systray/systray-box.c
+++ b/plugins/systray/systray-box.c
@@ -399,7 +399,7 @@ systray_box_size_allocate (GtkWidget *widget,
border = GTK_CONTAINER (widget)->border_width;
alloc_size = box->horizontal ? allocation->height : allocation->width;
- alloc_size -= 2 * border;
+
systray_box_size_get_max_child_size (box, alloc_size, &rows, &row_size, &offset);
panel_debug_filtered (PANEL_DEBUG_SYSTRAY, "allocate rows=%d, row_size=%d, w=%d, h=%d, horiz=%s, border=%d",
diff --git a/plugins/systray/systray.c b/plugins/systray/systray.c
index 94b084e..154bc03 100644
--- a/plugins/systray/systray.c
+++ b/plugins/systray/systray.c
@@ -211,6 +211,8 @@ systray_plugin_class_init (SystrayPluginClass *klass)
static void
systray_plugin_init (SystrayPlugin *plugin)
{
+ GtkRcStyle *style;
+
plugin->manager = NULL;
plugin->show_frame = TRUE;
plugin->idle_startup = 0;
@@ -221,6 +223,11 @@ systray_plugin_init (SystrayPlugin *plugin)
gtk_frame_set_shadow_type (GTK_FRAME (plugin->frame), GTK_SHADOW_ETCHED_IN);
gtk_widget_show (plugin->frame);
+ style = gtk_rc_style_new ();
+ style->xthickness = style->ythickness = 1;
+ gtk_widget_modify_style (plugin->frame, style);
+ g_object_unref (G_OBJECT (style));
+
plugin->hvbox = xfce_hvbox_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 2);
gtk_container_add (GTK_CONTAINER (plugin->frame), plugin->hvbox);
gtk_widget_show (plugin->hvbox);
@@ -298,6 +305,7 @@ systray_plugin_set_property (GObject *object,
const GValue *tmp;
gchar *name;
guint i;
+ GtkRcStyle *style;
switch (prop_id)
{
@@ -314,8 +322,13 @@ systray_plugin_set_property (GObject *object,
gtk_frame_set_shadow_type (GTK_FRAME (plugin->frame),
show_frame ? GTK_SHADOW_ETCHED_IN : GTK_SHADOW_NONE);
- gtk_container_set_border_width (GTK_CONTAINER (plugin->box),
- plugin->show_frame ? FRAME_SPACING : 0);
+ style = gtk_rc_style_new ();
+ style->xthickness = style->ythickness = show_frame ? 1 : 0;
+ gtk_widget_modify_style (plugin->frame, style);
+ g_object_unref (G_OBJECT (style));
+
+ systray_plugin_size_changed (XFCE_PANEL_PLUGIN (plugin),
+ xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin)));
}
break;
@@ -525,8 +538,7 @@ systray_plugin_size_changed (XfcePanelPlugin *panel_plugin,
* behind the allocated size when resizing and during startup, we
* correct the maximum size set by the user with the size the panel
* will most likely allocated */
- if (plugin->show_frame)
- border += MAX (frame->style->xthickness, frame->style->ythickness);
+ border += MAX (frame->style->xthickness, frame->style->ythickness);
systray_box_set_size_alloc (XFCE_SYSTRAY_BOX (plugin->box), size - 2 * border);
return TRUE;
More information about the Xfce4-commits
mailing list