aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-09-21 21:39:10 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-09-26 18:16:01 +0800
commit6e0b0622f3d9bbf47b7794cd232eab6530a3e909 (patch)
treef67ebf4704be6116fcf5e70aba2e3968b8fd3fc7 /src
parentc5ab389bc8054c863dd4d611028b63d4acbfa638 (diff)
downloadgsoc2013-empathy-6e0b0622f3d9bbf47b7794cd232eab6530a3e909.tar
gsoc2013-empathy-6e0b0622f3d9bbf47b7794cd232eab6530a3e909.tar.gz
gsoc2013-empathy-6e0b0622f3d9bbf47b7794cd232eab6530a3e909.tar.bz2
gsoc2013-empathy-6e0b0622f3d9bbf47b7794cd232eab6530a3e909.tar.lz
gsoc2013-empathy-6e0b0622f3d9bbf47b7794cd232eab6530a3e909.tar.xz
gsoc2013-empathy-6e0b0622f3d9bbf47b7794cd232eab6530a3e909.tar.zst
gsoc2013-empathy-6e0b0622f3d9bbf47b7794cd232eab6530a3e909.zip
RoundedActor: allow to set a different round factor
https://bugzilla.gnome.org/show_bug.cgi?id=656884
Diffstat (limited to 'src')
-rw-r--r--src/empathy-rounded-actor.c22
-rw-r--r--src/empathy-rounded-actor.h6
2 files changed, 27 insertions, 1 deletions
diff --git a/src/empathy-rounded-actor.c b/src/empathy-rounded-actor.c
index 463a73c61..0537dea96 100644
--- a/src/empathy-rounded-actor.c
+++ b/src/empathy-rounded-actor.c
@@ -26,9 +26,15 @@
G_DEFINE_TYPE(EmpathyRoundedActor, empathy_rounded_actor, GTK_CLUTTER_TYPE_ACTOR)
+struct _EmpathyRoundedActorPriv
+{
+ guint round_factor;
+};
+
static void
empathy_rounded_actor_paint (ClutterActor *actor)
{
+ EmpathyRoundedActor *self = EMPATHY_ROUNDED_ACTOR (actor);
ClutterActorBox allocation = { 0, };
gfloat width, height;
@@ -38,7 +44,8 @@ empathy_rounded_actor_paint (ClutterActor *actor)
cogl_path_new ();
/* create and store a path describing a rounded rectangle */
- cogl_path_round_rectangle (0, 0, width, height, height / 2, 0.1);
+ cogl_path_round_rectangle (0, 0, width, height,
+ height / self->priv->round_factor, 0.1);
cogl_clip_push_from_path ();
@@ -50,6 +57,10 @@ empathy_rounded_actor_paint (ClutterActor *actor)
static void
empathy_rounded_actor_init (EmpathyRoundedActor *self)
{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
+ EMPATHY_TYPE_ROUNDED_ACTOR, EmpathyRoundedActorPriv);
+
+ self->priv->round_factor = 2;
}
static void
@@ -58,6 +69,8 @@ empathy_rounded_actor_class_init (EmpathyRoundedActorClass *klass)
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
actor_class->paint = empathy_rounded_actor_paint;
+
+ g_type_class_add_private (klass, sizeof (EmpathyRoundedActorPriv));
}
ClutterActor *
@@ -66,3 +79,10 @@ empathy_rounded_actor_new (void)
return CLUTTER_ACTOR (
g_object_new (EMPATHY_TYPE_ROUNDED_ACTOR, NULL));
}
+
+void
+empathy_rounded_actor_set_round_factor (EmpathyRoundedActor *self,
+ guint round_factor)
+{
+ self->priv->round_factor = round_factor;
+}
diff --git a/src/empathy-rounded-actor.h b/src/empathy-rounded-actor.h
index e4c83b078..4287cf389 100644
--- a/src/empathy-rounded-actor.h
+++ b/src/empathy-rounded-actor.h
@@ -27,6 +27,7 @@
G_BEGIN_DECLS
typedef struct _EmpathyRoundedActor EmpathyRoundedActor;
+typedef struct _EmpathyRoundedActorPriv EmpathyRoundedActorPriv;
typedef struct _EmpathyRoundedActorClass EmpathyRoundedActorClass;
struct _EmpathyRoundedActorClass {
@@ -35,6 +36,8 @@ struct _EmpathyRoundedActorClass {
struct _EmpathyRoundedActor {
GtkClutterActor parent;
+
+ EmpathyRoundedActorPriv *priv;
};
GType empathy_rounded_actor_get_type (void);
@@ -58,6 +61,9 @@ GType empathy_rounded_actor_get_type (void);
ClutterActor *empathy_rounded_actor_new (void);
+void empathy_rounded_actor_set_round_factor (EmpathyRoundedActor *self,
+ guint round_factor);
+
G_END_DECLS
#endif /* #ifndef __EMPATHY_ROUNDED_ACTOR_H__*/