[Xfce4-commits] <xfce4-panel:master> Make vertical clock rotation optional (bug #7002).
Nick Schermer
noreply at xfce.org
Tue Dec 21 15:52:01 CET 2010
Updating branch refs/heads/master
to 5056f2d6c85aaad73f588ddc7b87a058b158bc72 (commit)
from 295841f8050728a3c0644dd66fe2ca5abe3f8e9a (commit)
commit 5056f2d6c85aaad73f588ddc7b87a058b158bc72
Author: Nick Schermer <nick at xfce.org>
Date: Tue Dec 21 15:43:30 2010 +0100
Make vertical clock rotation optional (bug #7002).
Not always nice to rotate the clock in some panel situations,
so make this optional in a hidden property "rotate-vertically".
In 4.10 this will be configurable in the interface (bug #7027).
plugins/clock/clock-digital.c | 6 +++---
plugins/clock/clock-fuzzy.c | 6 +++---
plugins/clock/clock.c | 34 +++++++++++++++++++++++++++++++---
3 files changed, 37 insertions(+), 9 deletions(-)
diff --git a/plugins/clock/clock-digital.c b/plugins/clock/clock-digital.c
index 99121af..f042c19 100644
--- a/plugins/clock/clock-digital.c
+++ b/plugins/clock/clock-digital.c
@@ -46,9 +46,9 @@ static gboolean xfce_clock_digital_update (gpointer user_dat
enum
{
- PROP_0,
- PROP_DIGITAL_FORMAT,
- PROP_SIZE_RATIO,
+ PROP_0,
+ PROP_DIGITAL_FORMAT,
+ PROP_SIZE_RATIO,
PROP_ORIENTATION
};
diff --git a/plugins/clock/clock-fuzzy.c b/plugins/clock/clock-fuzzy.c
index cbf2964..f1dcab5 100644
--- a/plugins/clock/clock-fuzzy.c
+++ b/plugins/clock/clock-fuzzy.c
@@ -61,9 +61,9 @@ enum
enum
{
- PROP_0,
- PROP_FUZZINESS,
- PROP_SIZE_RATIO,
+ PROP_0,
+ PROP_FUZZINESS,
+ PROP_SIZE_RATIO,
PROP_ORIENTATION
};
diff --git a/plugins/clock/clock.c b/plugins/clock/clock.c
index fe69faf..e76e655 100644
--- a/plugins/clock/clock.c
+++ b/plugins/clock/clock.c
@@ -83,7 +83,8 @@ enum
PROP_MODE,
PROP_SHOW_FRAME,
PROP_TOOLTIP_FORMAT,
- PROP_COMMAND
+ PROP_COMMAND,
+ PROP_ROTATE_VERTICALLY
};
typedef enum
@@ -116,6 +117,7 @@ struct _ClockPlugin
guint show_frame : 1;
gchar *command;
ClockPluginMode mode;
+ guint rotate_vertically : 1;
gchar *tooltip_format;
ClockPluginTimeout *tooltip_timeout;
@@ -221,6 +223,13 @@ clock_plugin_class_init (ClockPluginClass *klass)
EXO_PARAM_READWRITE));
g_object_class_install_property (gobject_class,
+ PROP_ROTATE_VERTICALLY,
+ g_param_spec_boolean ("rotate-vertically",
+ NULL, NULL,
+ FALSE,
+ EXO_PARAM_READWRITE));
+
+ g_object_class_install_property (gobject_class,
PROP_COMMAND,
g_param_spec_string ("command",
NULL, NULL, NULL,
@@ -238,6 +247,7 @@ clock_plugin_init (ClockPlugin *plugin)
plugin->tooltip_format = g_strdup (DEFAULT_TOOLTIP_FORMAT);
plugin->tooltip_timeout = NULL;
plugin->command = NULL;
+ plugin->rotate_vertically = FALSE;
plugin->frame = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (plugin), plugin->frame);
@@ -273,6 +283,10 @@ clock_plugin_get_property (GObject *object,
g_value_set_string (value, plugin->command);
break;
+ case PROP_ROTATE_VERTICALLY:
+ g_value_set_boolean (value, plugin->rotate_vertically);
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -289,6 +303,7 @@ clock_plugin_set_property (GObject *object,
{
ClockPlugin *plugin = XFCE_CLOCK_PLUGIN (object);
gboolean show_frame;
+ gboolean rotate_vertically;
switch (prop_id)
{
@@ -320,6 +335,15 @@ clock_plugin_set_property (GObject *object,
plugin->command = g_value_dup_string (value);
break;
+ case PROP_ROTATE_VERTICALLY:
+ rotate_vertically = g_value_get_boolean (value);
+ if (plugin->rotate_vertically != rotate_vertically)
+ {
+ plugin->rotate_vertically = rotate_vertically;
+ clock_plugin_set_mode (plugin);
+ }
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -402,6 +426,7 @@ clock_plugin_construct (XfcePanelPlugin *panel_plugin)
{ "show-frame", G_TYPE_BOOLEAN },
{ "tooltip-format", G_TYPE_STRING },
{ "command", G_TYPE_STRING },
+ { "rotate-vertically", G_TYPE_BOOLEAN },
{ NULL }
};
@@ -805,14 +830,17 @@ 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);
+
+ if (plugin->rotate_vertically)
+ exo_binding_new (G_OBJECT (plugin), "orientation", G_OBJECT (plugin->clock), "orientation");
/* watch width/height changes */
g_signal_connect_swapped (G_OBJECT (plugin->clock), "notify::size-ratio",
G_CALLBACK (clock_plugin_size_ratio_changed), plugin);
+
+ gtk_widget_show (plugin->clock);
}
More information about the Xfce4-commits
mailing list