[empathy] call-window: use colors from the theme for placeholders



commit 81f4651c54df81345644dd7fb2d88ca7bec8350c
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu Mar 22 13:17:33 2012 -0400

    call-window: use colors from the theme for placeholders
    
    Use color shades from the color theme for preview placeholders, instead
    of hardcoding black/red.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672561

 src/empathy-call-window.c |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index be00f28..e1668ec 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -873,27 +873,55 @@ empathy_call_window_move_video_preview (EmpathyCallWindow *self,
 }
 
 static void
+_clutter_color_from_rgba (ClutterColor *color,
+                          const GdkRGBA *rgba)
+{
+  color->red = (guint8) floor (rgba->red * 255);
+  color->green = (guint8) floor (rgba->green * 255);
+  color->blue = (guint8) floor (rgba->blue * 255);
+  color->alpha = (guint8) floor (rgba->alpha * 255);
+}
+
+static void
 empathy_call_window_highlight_preview_rectangle (EmpathyCallWindow *self,
     PreviewPosition pos)
 {
   ClutterActor *rectangle;
+  GtkStyleContext *context;
+  GdkRGBA rgba;
+  ClutterColor color, highlight;
 
   rectangle = empathy_call_window_get_preview_rectangle (self, pos);
+  context = gtk_widget_get_style_context (GTK_WIDGET (self));
+  gtk_style_context_get_color (context, 0, &rgba);
+
+  _clutter_color_from_rgba (&color, &rgba);
+  clutter_color_shade (&color, 1.4, &highlight);
 
   empathy_rounded_rectangle_set_border_width (
       EMPATHY_ROUNDED_RECTANGLE (rectangle), 2 * SELF_VIDEO_SECTION_MARGIN);
   empathy_rounded_rectangle_set_border_color (
-      EMPATHY_ROUNDED_RECTANGLE (rectangle), CLUTTER_COLOR_Red);
+      EMPATHY_ROUNDED_RECTANGLE (rectangle), &highlight);
 }
 
 static void
 empathy_call_window_darken_preview_rectangle (EmpathyCallWindow *self,
     ClutterActor *rectangle)
 {
+  GtkStyleContext *context;
+  GdkRGBA rgba;
+  ClutterColor color, darker;
+
+  context = gtk_widget_get_style_context (GTK_WIDGET (self));
+  gtk_style_context_get_background_color (context, 0, &rgba);
+
+  _clutter_color_from_rgba (&color, &rgba);
+  clutter_color_shade (&color, 0.55, &darker);
+
   empathy_rounded_rectangle_set_border_width (
       EMPATHY_ROUNDED_RECTANGLE (rectangle), 1);
   empathy_rounded_rectangle_set_border_color (
-      EMPATHY_ROUNDED_RECTANGLE (rectangle), CLUTTER_COLOR_Black);
+      EMPATHY_ROUNDED_RECTANGLE (rectangle), &darker);
 }
 
 static void



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