[Xfce4-commits] <xfce4-panel:devel> Fix default shadow types in the systray and clock.
Nick Schermer
noreply at xfce.org
Wed Oct 28 16:20:05 CET 2009
Updating branch refs/heads/devel
to 008dde15f09452c9e63549ca4fddebde3b048037 (commit)
from 4ea2bbee76145dcf3fe68b686abc2cf11ddc4f2a (commit)
commit 008dde15f09452c9e63549ca4fddebde3b048037
Author: Nick Schermer <nick at xfce.org>
Date: Wed Oct 28 12:14:05 2009 +0100
Fix default shadow types in the systray and clock.
Also change the frame shadow to etched in since this is
a bit more subtile.
plugins/clock/clock.c | 27 +++++++++++++++++++--------
plugins/systray/systray.c | 26 +++++++++++++++-----------
2 files changed, 34 insertions(+), 19 deletions(-)
diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c
index 406b8a0..016a6f7 100644
--- a/plugins/clock/clock.c
+++ b/plugins/clock/clock.c
@@ -107,6 +107,8 @@ struct _ClockPlugin
GtkWidget *clock;
GtkWidget *frame;
+ guint show_frame : 1;
+
ClockPluginMode mode;
gchar *tooltip_format;
@@ -176,7 +178,7 @@ clock_plugin_class_init (ClockPluginClass *klass)
PROP_SHOW_FRAME,
g_param_spec_boolean ("show-frame",
NULL, NULL,
- FALSE,
+ TRUE,
EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
@@ -194,11 +196,13 @@ clock_plugin_init (ClockPlugin *plugin)
{
plugin->mode = CLOCK_PLUGIN_MODE_DEFAULT;
plugin->clock = NULL;
+ plugin->show_frame = TRUE;
plugin->tooltip_format = g_strdup (DEFAULT_TOOLTIP_FORMAT);
plugin->tooltip_timeout = NULL;
plugin->frame = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (plugin), plugin->frame);
+ gtk_frame_set_shadow_type (GTK_FRAME (plugin->frame), GTK_SHADOW_ETCHED_IN);
gtk_widget_show (plugin->frame);
}
@@ -210,8 +214,7 @@ clock_plugin_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- ClockPlugin *plugin = XFCE_CLOCK_PLUGIN (object);
- GtkShadowType shadow_type;
+ ClockPlugin *plugin = XFCE_CLOCK_PLUGIN (object);
switch (prop_id)
{
@@ -220,8 +223,7 @@ clock_plugin_get_property (GObject *object,
break;
case PROP_SHOW_FRAME:
- shadow_type = gtk_frame_get_shadow_type (GTK_FRAME (plugin->frame));
- g_value_set_boolean (value, shadow_type == GTK_SHADOW_IN);
+ g_value_set_boolean (value, plugin->show_frame);
break;
case PROP_TOOLTIP_FORMAT:
@@ -243,6 +245,7 @@ clock_plugin_set_property (GObject *object,
GParamSpec *pspec)
{
ClockPlugin *plugin = XFCE_CLOCK_PLUGIN (object);
+ gboolean show_frame;
switch (prop_id)
{
@@ -255,8 +258,13 @@ clock_plugin_set_property (GObject *object,
break;
case PROP_SHOW_FRAME:
- gtk_frame_set_shadow_type (GTK_FRAME (plugin->frame),
- g_value_get_boolean (value) ? GTK_SHADOW_IN : GTK_SHADOW_NONE);
+ show_frame = g_value_get_boolean (value);
+ if (plugin->show_frame != show_frame)
+ {
+ plugin->show_frame = show_frame;
+ gtk_frame_set_shadow_type (GTK_FRAME (plugin->frame),
+ show_frame ? GTK_SHADOW_ETCHED_IN : GTK_SHADOW_NONE);
+ }
break;
case PROP_TOOLTIP_FORMAT:
@@ -355,12 +363,15 @@ clock_plugin_size_changed (XfcePanelPlugin *panel_plugin,
{
ClockPlugin *plugin = XFCE_CLOCK_PLUGIN (panel_plugin);
gint clock_size;
+ gint border = 0;
if (plugin->clock == NULL)
return TRUE;
/* set the frame border */
- gtk_container_set_border_width (GTK_CONTAINER (plugin->frame), size > 26 ? 1 : 0);
+ if (plugin->show_frame && size > 26)
+ border = 1;
+ gtk_container_set_border_width (GTK_CONTAINER (plugin->frame), border);
/* get the clock size */
clock_size = CLAMP (size - (size > 26 ? 6 : 4), 1, 128);
diff --git a/plugins/systray/systray.c b/plugins/systray/systray.c
index 0805312..c9105aa 100644
--- a/plugins/systray/systray.c
+++ b/plugins/systray/systray.c
@@ -143,7 +143,7 @@ systray_plugin_class_init (SystrayPluginClass *klass)
PROP_SHOW_FRAME,
g_param_spec_boolean ("show-frame",
NULL, NULL,
- FALSE,
+ TRUE,
EXO_PARAM_READWRITE));
}
@@ -153,12 +153,12 @@ static void
systray_plugin_init (SystrayPlugin *plugin)
{
plugin->manager = NULL;
- plugin->show_frame = FALSE;
+ plugin->show_frame = TRUE;
/* plugin widgets */
plugin->frame = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (plugin), plugin->frame);
- gtk_frame_set_shadow_type (GTK_FRAME (plugin->frame), GTK_SHADOW_NONE);
+ gtk_frame_set_shadow_type (GTK_FRAME (plugin->frame), GTK_SHADOW_ETCHED_IN);
gtk_widget_show (plugin->frame);
plugin->box = systray_box_new ();
@@ -205,6 +205,7 @@ systray_plugin_set_property (GObject *object,
{
SystrayPlugin *plugin = XFCE_SYSTRAY_PLUGIN (object);
gint rows;
+ gboolean show_frame;
switch (prop_id)
{
@@ -214,11 +215,13 @@ systray_plugin_set_property (GObject *object,
break;
case PROP_SHOW_FRAME:
- plugin->show_frame = g_value_get_boolean (value);
-
- /* set the frame shadow */
- gtk_frame_set_shadow_type (GTK_FRAME (plugin->frame),
- plugin->show_frame ? GTK_SHADOW_IN : GTK_SHADOW_NONE);
+ show_frame = g_value_get_boolean (value);
+ if (plugin->show_frame != show_frame)
+ {
+ plugin->show_frame = show_frame;
+ gtk_frame_set_shadow_type (GTK_FRAME (plugin->frame),
+ show_frame ? GTK_SHADOW_ETCHED_IN : GTK_SHADOW_NONE);
+ }
break;
default:
@@ -420,10 +423,11 @@ systray_plugin_size_changed (XfcePanelPlugin *panel_plugin,
{
SystrayPlugin *plugin = XFCE_SYSTRAY_PLUGIN (panel_plugin);
GtkWidget *frame = plugin->frame;
- gint border;
+ gint border = 0;
- /* set frame border */
- border = (size > 26 && plugin->show_frame) ? 1 : 0;
+ /* set the frame border */
+ if (plugin->show_frame && size > 26)
+ border = 1;
gtk_container_set_border_width (GTK_CONTAINER (frame), border);
/* set the guess size this is used to get the initial icon size request
More information about the Xfce4-commits
mailing list