[empathy] RoundedActor: allow to set a different round factor



commit 6e0b0622f3d9bbf47b7794cd232eab6530a3e909
Author: Emilio Pozuelo Monfort <emilio pozuelo collabora co uk>
Date:   Wed Sep 21 14:39:10 2011 +0100

    RoundedActor: allow to set a different round factor
    
    https://bugzilla.gnome.org/show_bug.cgi?id=656884

 src/empathy-rounded-actor.c |   22 +++++++++++++++++++++-
 src/empathy-rounded-actor.h |    6 ++++++
 2 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/src/empathy-rounded-actor.c b/src/empathy-rounded-actor.c
index 463a73c..0537dea 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 e4c83b0..4287cf3 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__*/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]