]> git.0d.be Git - empathy.git/commitdiff
call-window: use colors from the theme for placeholders
authorCosimo Cecchi <cosimoc@gnome.org>
Thu, 22 Mar 2012 17:17:33 +0000 (13:17 -0400)
committerCosimo Cecchi <cosimoc@gnome.org>
Tue, 27 Mar 2012 13:15:36 +0000 (09:15 -0400)
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

index be00f28682af980947970bf403d68e69e3319c50..e1668ec03868d79137b40089679bb4f9151e98ab 100644 (file)
@@ -872,28 +872,56 @@ empathy_call_window_move_video_preview (EmpathyCallWindow *self,
   g_settings_set_enum (self->priv->settings, "camera-position", pos);
 }
 
+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