[Xfce4-commits] <xfce4-panel:devel> Change clock plugin size and orientation hangling.
Nick Schermer
noreply at xfce.org
Sat Feb 20 14:32:01 CET 2010
Updating branch refs/heads/devel
to 6e333bb9d206cfc77c48ff21ea74c8beeb710038 (commit)
from 0877a1ac13bd214293bbde203a752088bb5568dd (commit)
commit 6e333bb9d206cfc77c48ff21ea74c8beeb710038
Author: Nick Schermer <nick at xfce.org>
Date: Sat Feb 20 13:48:56 2010 +0100
Change clock plugin size and orientation hangling.
Not finished yet, but handle vertical panels better and
improve size requests for some clock widgets in a better
way.
plugins/clock/clock-analog.c | 44 +++++++++++++----------
plugins/clock/clock-binary.c | 80 ++++++++++++++++++++++------------------
plugins/clock/clock-digital.c | 29 ++++++++++++++-
plugins/clock/clock-fuzzy.c | 29 ++++++++++++++-
plugins/clock/clock-lcd.c | 81 ++++++++++++++++-------------------------
plugins/clock/clock.c | 39 +++++++++++++++++---
6 files changed, 191 insertions(+), 111 deletions(-)
diff --git a/plugins/clock/clock-analog.c b/plugins/clock/clock-analog.c
index cb39a44..c3dca8c 100644
--- a/plugins/clock/clock-analog.c
+++ b/plugins/clock/clock-analog.c
@@ -48,8 +48,6 @@ static void xfce_clock_analog_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void xfce_clock_analog_finalize (GObject *object);
-static void xfce_clock_analog_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
static gboolean xfce_clock_analog_expose_event (GtkWidget *widget,
GdkEventExpose *event);
static void xfce_clock_analog_draw_ticks (cairo_t *cr,
@@ -70,7 +68,9 @@ static gboolean xfce_clock_analog_update (gpointer user_dat
enum
{
PROP_0,
- PROP_SHOW_SECONDS
+ PROP_SHOW_SECONDS,
+ PROP_SIZE_RATIO,
+ PROP_ORIENTATION
};
struct _XfceClockAnalogClass
@@ -105,10 +105,24 @@ xfce_clock_analog_class_init (XfceClockAnalogClass *klass)
gobject_class->finalize = xfce_clock_analog_finalize;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->size_request = xfce_clock_analog_size_request;
gtkwidget_class->expose_event = xfce_clock_analog_expose_event;
g_object_class_install_property (gobject_class,
+ PROP_SIZE_RATIO,
+ g_param_spec_double ("size-ratio", NULL, NULL,
+ -1, G_MAXDOUBLE, 1.0,
+ G_PARAM_READABLE
+ | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class,
+ PROP_ORIENTATION,
+ g_param_spec_enum ("orientation", NULL, NULL,
+ GTK_TYPE_ORIENTATION,
+ GTK_ORIENTATION_HORIZONTAL,
+ G_PARAM_WRITABLE
+ | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class,
PROP_SHOW_SECONDS,
g_param_spec_boolean ("show-seconds", NULL, NULL,
FALSE,
@@ -139,6 +153,9 @@ xfce_clock_analog_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_ORIENTATION:
+ break;
+
case PROP_SHOW_SECONDS:
analog->show_seconds = g_value_get_boolean (value);
break;
@@ -170,6 +187,10 @@ xfce_clock_analog_get_property (GObject *object,
g_value_set_boolean (value, analog->show_seconds);
break;
+ case PROP_SIZE_RATIO:
+ g_value_set_double (value, 1.0);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -189,21 +210,6 @@ xfce_clock_analog_finalize (GObject *object)
-static void
-xfce_clock_analog_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- gint width, height;
-
- /* get the current widget size */
- gtk_widget_get_size_request (widget, &width, &height);
-
- /* square the widget */
- requisition->width = requisition->height = MAX (width, height);
-}
-
-
-
static gboolean
xfce_clock_analog_expose_event (GtkWidget *widget,
GdkEventExpose *event)
diff --git a/plugins/clock/clock-binary.c b/plugins/clock/clock-binary.c
index afe6a87..9ba30c8 100644
--- a/plugins/clock/clock-binary.c
+++ b/plugins/clock/clock-binary.c
@@ -48,8 +48,6 @@ static void xfce_clock_binary_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void xfce_clock_binary_finalize (GObject *object);
-static void xfce_clock_binary_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
static gboolean xfce_clock_binary_expose_event (GtkWidget *widget,
GdkEventExpose *event);
static gboolean xfce_clock_binary_update (gpointer user_data);
@@ -62,7 +60,9 @@ enum
PROP_SHOW_SECONDS,
PROP_TRUE_BINARY,
PROP_SHOW_INACTIVE,
- PROP_SHOW_GRID
+ PROP_SHOW_GRID,
+ PROP_SIZE_RATIO,
+ PROP_ORIENTATION
};
struct _XfceClockBinaryClass
@@ -100,10 +100,24 @@ xfce_clock_binary_class_init (XfceClockBinaryClass *klass)
gobject_class->finalize = xfce_clock_binary_finalize;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->size_request = xfce_clock_binary_size_request;
gtkwidget_class->expose_event = xfce_clock_binary_expose_event;
g_object_class_install_property (gobject_class,
+ PROP_SIZE_RATIO,
+ g_param_spec_double ("size-ratio", NULL, NULL,
+ -1, G_MAXDOUBLE, 1.0,
+ G_PARAM_READABLE
+ | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class,
+ PROP_ORIENTATION,
+ g_param_spec_enum ("orientation", NULL, NULL,
+ GTK_TYPE_ORIENTATION,
+ GTK_ORIENTATION_HORIZONTAL,
+ G_PARAM_WRITABLE
+ | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class,
PROP_SHOW_SECONDS,
g_param_spec_boolean ("show-seconds", NULL, NULL,
FALSE,
@@ -160,12 +174,17 @@ xfce_clock_binary_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_ORIENTATION:
+ break;
+
case PROP_SHOW_SECONDS:
binary->show_seconds = g_value_get_boolean (value);
+ g_object_notify (object, "size-ratio");
break;
case PROP_TRUE_BINARY:
binary->true_binary = g_value_get_boolean (value);
+ g_object_notify (object, "size-ratio");
break;
case PROP_SHOW_INACTIVE:
@@ -196,6 +215,7 @@ xfce_clock_binary_get_property (GObject *object,
GParamSpec *pspec)
{
XfceClockBinary *binary = XFCE_CLOCK_BINARY (object);
+ gdouble ratio;
switch (prop_id)
{
@@ -215,6 +235,14 @@ xfce_clock_binary_get_property (GObject *object,
g_value_set_boolean (value, binary->show_grid);
break;
+ case PROP_SIZE_RATIO:
+ if (binary->true_binary)
+ ratio = binary->show_seconds ? 2.0 : 3.0;
+ else
+ ratio = binary->show_seconds ? 1.5 : 1.0;
+ g_value_set_double (value, ratio);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -235,38 +263,6 @@ xfce_clock_binary_finalize (GObject *object)
static void
-xfce_clock_binary_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- gint width, height;
- gdouble ratio;
- XfceClockBinary *binary = XFCE_CLOCK_BINARY (widget);
-
- /* get the current widget size */
- gtk_widget_get_size_request (widget, &width, &height);
-
- /* ratio of the clock */
- if (binary->true_binary)
- ratio = binary->show_seconds ? 2.0 : 3.0;
- else
- ratio = binary->show_seconds ? 1.5 : 1.0;
-
- /* set requisition based on the plugin orientation */
- if (width == -1)
- {
- requisition->height = height;
- requisition->width = height * ratio;
- }
- else
- {
- requisition->height = width / ratio;
- requisition->width = width;
- }
-}
-
-
-
-static void
xfce_clock_binary_expose_event_true_binary (XfceClockBinary *binary,
cairo_t *cr,
GtkAllocation *alloc)
@@ -360,6 +356,7 @@ xfce_clock_binary_expose_event_binary (XfceClockBinary *binary,
gint w, h, y;
gint ticks;
gint pad_x, pad_y;
+ gint diff;
inactive = &(GTK_WIDGET (binary)->style->fg[GTK_STATE_NORMAL]);
active = &(GTK_WIDGET (binary)->style->bg[GTK_STATE_SELECTED]);
@@ -371,7 +368,12 @@ xfce_clock_binary_expose_event_binary (XfceClockBinary *binary,
remain_w = alloc->width - 1 - 2 * pad_x;
offset_x = alloc->x + 1 + pad_x;
+ /* make sure the cols are all equal */
cols = binary->show_seconds ? 6 : 4;
+ diff = remain_w - (floor ((gdouble) remain_w / cols) * cols);
+ remain_w -= diff;
+ offset_x += diff / 2;
+
for (col = 0; col < cols; col++)
{
/* get the time this row represents */
@@ -385,6 +387,12 @@ xfce_clock_binary_expose_event_binary (XfceClockBinary *binary,
/* reset sizes */
remain_h = alloc->height - 1 - 2 * pad_y;
offset_y = alloc->y + 1 + pad_x;
+
+ /* make sure the rows are all equal */
+ diff = remain_h - (floor ((gdouble) remain_h / rows) * rows);
+ remain_h -= diff;
+ offset_y += diff / 2;
+
w = remain_w / (cols - col);
remain_w -= w;
diff --git a/plugins/clock/clock-digital.c b/plugins/clock/clock-digital.c
index 6ff8d45..5d4a9c7 100644
--- a/plugins/clock/clock-digital.c
+++ b/plugins/clock/clock-digital.c
@@ -47,7 +47,9 @@ static gboolean xfce_clock_digital_update (gpointer user_dat
enum
{
PROP_0,
- PROP_DIGITAL_FORMAT
+ PROP_DIGITAL_FORMAT,
+ PROP_SIZE_RATIO,
+ PROP_ORIENTATION
};
struct _XfceClockDigitalClass
@@ -81,6 +83,21 @@ xfce_clock_digital_class_init (XfceClockDigitalClass *klass)
gobject_class->get_property = xfce_clock_digital_get_property;
g_object_class_install_property (gobject_class,
+ PROP_SIZE_RATIO,
+ g_param_spec_double ("size-ratio", NULL, NULL,
+ -1, G_MAXDOUBLE, 0.0,
+ G_PARAM_READABLE
+ | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class,
+ PROP_ORIENTATION,
+ g_param_spec_enum ("orientation", NULL, NULL,
+ GTK_TYPE_ORIENTATION,
+ GTK_ORIENTATION_HORIZONTAL,
+ G_PARAM_WRITABLE
+ | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class,
PROP_DIGITAL_FORMAT,
g_param_spec_string ("digital-format", NULL, NULL,
DEFAULT_DIGITAL_FORMAT,
@@ -113,6 +130,12 @@ xfce_clock_digital_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_ORIENTATION:
+ gtk_label_set_angle (GTK_LABEL (object),
+ g_value_get_enum (value) == GTK_ORIENTATION_HORIZONTAL ?
+ 0 : 270);
+ break;
+
case PROP_DIGITAL_FORMAT:
g_free (digital->format);
digital->format = g_value_dup_string (value);
@@ -145,6 +168,10 @@ xfce_clock_digital_get_property (GObject *object,
g_value_set_string (value, digital->format);
break;
+ case PROP_SIZE_RATIO:
+ g_value_set_double (value, -1.0);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
diff --git a/plugins/clock/clock-fuzzy.c b/plugins/clock/clock-fuzzy.c
index 9402471..940628e 100644
--- a/plugins/clock/clock-fuzzy.c
+++ b/plugins/clock/clock-fuzzy.c
@@ -62,7 +62,9 @@ enum
enum
{
PROP_0,
- PROP_FUZZINESS
+ PROP_FUZZINESS,
+ PROP_SIZE_RATIO,
+ PROP_ORIENTATION
};
struct _XfceClockFuzzyClass
@@ -162,6 +164,21 @@ xfce_clock_fuzzy_class_init (XfceClockFuzzyClass *klass)
gobject_class->finalize = xfce_clock_fuzzy_finalize;
g_object_class_install_property (gobject_class,
+ PROP_SIZE_RATIO,
+ g_param_spec_double ("size-ratio", NULL, NULL,
+ -1, G_MAXDOUBLE, -1.00,
+ G_PARAM_READABLE
+ | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class,
+ PROP_ORIENTATION,
+ g_param_spec_enum ("orientation", NULL, NULL,
+ GTK_TYPE_ORIENTATION,
+ GTK_ORIENTATION_HORIZONTAL,
+ G_PARAM_WRITABLE
+ | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class,
PROP_FUZZINESS,
g_param_spec_uint ("fuzziness", NULL, NULL,
FUZZINESS_MIN,
@@ -197,6 +214,12 @@ xfce_clock_fuzzy_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_ORIENTATION:
+ gtk_label_set_angle (GTK_LABEL (object),
+ g_value_get_enum (value) == GTK_ORIENTATION_HORIZONTAL ?
+ 0 : 270);
+ break;
+
case PROP_FUZZINESS:
fuzziness = g_value_get_uint (value);
if (G_LIKELY (fuzzy->fuzziness != fuzziness))
@@ -228,6 +251,10 @@ xfce_clock_fuzzy_get_property (GObject *object,
g_value_set_uint (value, fuzzy->fuzziness);
break;
+ case PROP_SIZE_RATIO:
+ g_value_set_double (value, -1.0);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
diff --git a/plugins/clock/clock-lcd.c b/plugins/clock/clock-lcd.c
index 16711cf..aaf345c 100644
--- a/plugins/clock/clock-lcd.c
+++ b/plugins/clock/clock-lcd.c
@@ -45,8 +45,6 @@ static void xfce_clock_lcd_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void xfce_clock_lcd_finalize (GObject *object);
-static void xfce_clock_lcd_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
static gboolean xfce_clock_lcd_expose_event (GtkWidget *widget,
GdkEventExpose *event);
static gdouble xfce_clock_lcd_get_ratio (XfceClockLcd *lcd);
@@ -62,6 +60,7 @@ static gdouble xfce_clock_lcd_draw_digit (cairo_t *cr,
static gboolean xfce_clock_lcd_update (gpointer user_data);
+
enum
{
PROP_0,
@@ -69,6 +68,8 @@ enum
PROP_SHOW_MILITARY,
PROP_SHOW_MERIDIEM,
PROP_FLASH_SEPARATORS,
+ PROP_SIZE_RATIO,
+ PROP_ORIENTATION
};
struct _XfceClockLcdClass
@@ -83,8 +84,8 @@ struct _XfceClockLcd
ClockPluginTimeout *timeout;
guint show_seconds : 1;
- guint show_military : 1;
- guint show_meridiem : 1;
+ guint show_military : 1; /* 24-hour clock */
+ guint show_meridiem : 1; /* am/pm */
guint flash_separators : 1;
};
@@ -106,12 +107,23 @@ xfce_clock_lcd_class_init (XfceClockLcdClass *klass)
gobject_class->finalize = xfce_clock_lcd_finalize;
gtkwidget_class = GTK_WIDGET_CLASS (klass);
- gtkwidget_class->size_request = xfce_clock_lcd_size_request;
gtkwidget_class->expose_event = xfce_clock_lcd_expose_event;
- /**
- * Whether we display seconds
- **/
+ g_object_class_install_property (gobject_class,
+ PROP_SIZE_RATIO,
+ g_param_spec_double ("size-ratio", NULL, NULL,
+ -1, G_MAXDOUBLE, -1.0,
+ G_PARAM_READABLE
+ | G_PARAM_STATIC_STRINGS));
+
+ g_object_class_install_property (gobject_class,
+ PROP_ORIENTATION,
+ g_param_spec_enum ("orientation", NULL, NULL,
+ GTK_TYPE_ORIENTATION,
+ GTK_ORIENTATION_HORIZONTAL,
+ G_PARAM_WRITABLE
+ | G_PARAM_STATIC_STRINGS));
+
g_object_class_install_property (gobject_class,
PROP_SHOW_SECONDS,
g_param_spec_boolean ("show-seconds", NULL, NULL,
@@ -119,9 +131,6 @@ xfce_clock_lcd_class_init (XfceClockLcdClass *klass)
G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS));
- /**
- * Whether we show a 24h clock
- **/
g_object_class_install_property (gobject_class,
PROP_SHOW_MILITARY,
g_param_spec_boolean ("show-military", NULL, NULL,
@@ -129,9 +138,6 @@ xfce_clock_lcd_class_init (XfceClockLcdClass *klass)
G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS));
- /**
- * Whether we show am or pm
- **/
g_object_class_install_property (gobject_class,
PROP_SHOW_MERIDIEM,
g_param_spec_boolean ("show-meridiem", NULL, NULL,
@@ -139,9 +145,6 @@ xfce_clock_lcd_class_init (XfceClockLcdClass *klass)
G_PARAM_READWRITE
| G_PARAM_STATIC_STRINGS));
- /**
- * Whether to flash the time separators
- **/
g_object_class_install_property (gobject_class,
PROP_FLASH_SEPARATORS,
g_param_spec_boolean ("flash-separators", NULL, NULL,
@@ -177,6 +180,9 @@ xfce_clock_lcd_set_property (GObject *object,
switch (prop_id)
{
+ case PROP_ORIENTATION:
+ break;
+
case PROP_SHOW_SECONDS:
lcd->show_seconds = g_value_get_boolean (value);
break;
@@ -198,6 +204,8 @@ xfce_clock_lcd_set_property (GObject *object,
break;
}
+ g_object_notify (object, "size-ratio");
+
/* reschedule the timeout and resize */
show_seconds = lcd->show_seconds || lcd->flash_separators;
clock_plugin_timeout_set_interval (lcd->timeout,
@@ -214,6 +222,7 @@ xfce_clock_lcd_get_property (GObject *object,
GParamSpec *pspec)
{
XfceClockLcd *lcd = XFCE_CLOCK_LCD (object);
+ gdouble ratio;
switch (prop_id)
{
@@ -233,6 +242,11 @@ xfce_clock_lcd_get_property (GObject *object,
g_value_set_boolean (value, lcd->flash_separators);
break;
+ case PROP_SIZE_RATIO:
+ ratio = xfce_clock_lcd_get_ratio (lcd);
+ g_value_set_double (value, ratio);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -252,37 +266,6 @@ xfce_clock_lcd_finalize (GObject *object)
-static void
-xfce_clock_lcd_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
-{
- gint width, height;
- gdouble ratio;
-
- /* get the current widget size */
- gtk_widget_get_size_request (widget, &width, &height);
-
- /* get the width:height ratio */
- ratio = xfce_clock_lcd_get_ratio (XFCE_CLOCK_LCD (widget));
-
- if (width == -1)
- {
- requisition->height = MAX (10, height - height % 10);
- requisition->width = requisition->height * ratio;
- }
- else
- {
- /* calc height */
- height = width / ratio;
- height = MAX (10, height - height % 10);
-
- requisition->height = height;
- requisition->width = height * ratio;
- }
-}
-
-
-
static gboolean
xfce_clock_lcd_expose_event (GtkWidget *widget,
GdkEventExpose *event)
@@ -339,7 +322,7 @@ xfce_clock_lcd_expose_event (GtkWidget *widget,
* the first minute */
if ((ticks == 10 || ticks == 0) && tm.tm_min == 0
&& (!lcd->show_seconds || tm.tm_sec < 3))
- gtk_widget_queue_resize (widget);
+ g_object_notify (G_OBJECT (lcd), "size-ratio");
if (ticks >= 10)
{
diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c
index 1e129a0..99770b8 100644
--- a/plugins/clock/clock.c
+++ b/plugins/clock/clock.c
@@ -23,6 +23,9 @@
#ifdef HAVE_TIME_H
#include <time.h>
#endif
+#ifdef HAVE_MATH_H
+#include <math.h>
+#endif
#include <gtk/gtk.h>
#include <exo/exo.h>
@@ -62,6 +65,7 @@ static void clock_plugin_construct (XfcePanelPlugin *p
static void clock_plugin_free_data (XfcePanelPlugin *panel_plugin);
static gboolean clock_plugin_size_changed (XfcePanelPlugin *panel_plugin,
gint size);
+static void clock_plugin_size_ratio_changed (XfcePanelPlugin *panel_plugin);
static void clock_plugin_orientation_changed (XfcePanelPlugin *panel_plugin,
GtkOrientation orientation);
static void clock_plugin_configure_plugin (XfcePanelPlugin *panel_plugin);
@@ -435,7 +439,8 @@ clock_plugin_size_changed (XfcePanelPlugin *panel_plugin,
gint size)
{
ClockPlugin *plugin = XFCE_CLOCK_PLUGIN (panel_plugin);
- gint clock_size;
+ gdouble ratio;
+ gint ratio_size;
gint border = 0;
if (plugin->clock == NULL)
@@ -446,14 +451,25 @@ clock_plugin_size_changed (XfcePanelPlugin *panel_plugin,
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);
+ /* get the width:height ratio */
+ g_object_get (G_OBJECT (plugin->clock), "size-ratio", &ratio, NULL);
+ ratio_size = ratio > 0 ? size : -1;
/* set the clock size */
if (xfce_panel_plugin_get_orientation (panel_plugin) == GTK_ORIENTATION_HORIZONTAL)
- gtk_widget_set_size_request (plugin->clock, -1, clock_size);
+ {
+ if (ratio > 0 && ratio != 1.0)
+ ratio_size = ceil (size * ratio);
+
+ gtk_widget_set_size_request (GTK_WIDGET (panel_plugin), ratio_size, size);
+ }
else
- gtk_widget_set_size_request (plugin->clock, clock_size, -1);
+ {
+ if (ratio > 0 && ratio != 1.0)
+ ratio_size = ceil (size / ratio);
+
+ gtk_widget_set_size_request (GTK_WIDGET (panel_plugin), size, ratio_size);
+ }
return TRUE;
}
@@ -461,6 +477,14 @@ clock_plugin_size_changed (XfcePanelPlugin *panel_plugin,
static void
+clock_plugin_size_ratio_changed (XfcePanelPlugin *panel_plugin)
+{
+ clock_plugin_size_changed (panel_plugin, xfce_panel_plugin_get_size (panel_plugin));
+}
+
+
+
+static void
clock_plugin_orientation_changed (XfcePanelPlugin *panel_plugin,
GtkOrientation orientation)
{
@@ -781,9 +805,14 @@ clock_plugin_set_mode (ClockPlugin *plugin)
properties[plugin->mode], FALSE);
gtk_container_add (GTK_CONTAINER (plugin->frame), plugin->clock);
+ exo_binding_new (G_OBJECT (plugin), "orientation", G_OBJECT (plugin->clock), "orientation");
clock_plugin_size_changed (XFCE_PANEL_PLUGIN (plugin),
xfce_panel_plugin_get_size (XFCE_PANEL_PLUGIN (plugin)));
gtk_widget_show (plugin->clock);
+
+ /* watch width/height changes */
+ g_signal_connect_swapped (G_OBJECT (plugin->clock), "notify::size-ratio",
+ G_CALLBACK (clock_plugin_size_ratio_changed), plugin);
}
More information about the Xfce4-commits
mailing list