]> err.no Git - libchamplain/commitdiff
Set the highlight color to use Gtk's selection color
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Tue, 28 Jul 2009 02:45:41 +0000 (22:45 -0400)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Tue, 28 Jul 2009 21:23:18 +0000 (17:23 -0400)
champlain-gtk/gtk-champlain-embed.c
champlain/champlain-marker.c
champlain/champlain-marker.h

index 755a34a4315f5f247268f4303e68ad539b44aa22..533019113dc633f3bea6e5fd0f78a1b15ccf1047 100644 (file)
@@ -178,6 +178,7 @@ gtk_champlain_embed_init (GtkChamplainEmbed *embed)
 {
   ClutterColor stage_color = { 0x34, 0x39, 0x39, 0xff };
   ClutterActor *stage;
+  GtkStyle *style;
 
   GtkChamplainEmbedPrivate *priv = GTK_CHAMPLAIN_EMBED_GET_PRIVATE (embed);
   embed->priv = priv;
@@ -212,6 +213,13 @@ gtk_champlain_embed_init (GtkChamplainEmbed *embed)
   clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
 
   gtk_container_add (GTK_CONTAINER (embed), priv->clutter_embed);
+
+  /* Set selection color */
+  style = gtk_widget_get_style (GTK_WIDGET (embed));
+  ClutterColor color = {0, 0, 0, };
+  gtk_clutter_get_bg_color (GTK_WIDGET (embed), GTK_STATE_SELECTED, &color);
+  champlain_marker_set_highlight_color (&color);
+
 }
 
 static void
index 6589d896d55143623e1e20e29c37dec7761a1f94..0f4f683b2508db828dbdb834ae28cc8b77496ae2 100644 (file)
@@ -55,7 +55,7 @@
 
 #define DEFAULT_FONT_NAME "Sans 11"
 
-static ClutterColor SELECTED_COLOR = {0x00, 0x00, 0xff, 0xff};
+static ClutterColor SELECTED_COLOR = {0x00, 0x33, 0xcc, 0xff};
 
 static ClutterColor DEFAULT_COLOR = {0x33, 0x33, 0x33, 0xff};
 static ClutterColor DEFAULT_TEXT_COLOR = {0xee, 0xee, 0xee, 0xff};
@@ -115,6 +115,24 @@ G_DEFINE_TYPE (ChamplainMarker, champlain_marker, CHAMPLAIN_TYPE_BASE_MARKER);
 static void draw_marker (ChamplainMarker *marker);
 static void queue_redraw (ChamplainMarker *marker);
 
+/**
+ * champlain_marker_set_hightlight_color:
+ * @color: a #ClutterColor
+ *
+ * Changes the highlight color, this is to ensure a better integration with
+ * the desktop, this is automatically done by GtkChamplainEmbed.
+ *
+ * Since: 0.2
+ */
+void
+champlain_marker_set_highlight_color (ClutterColor *color)
+{
+  SELECTED_COLOR.red = color->red;
+  SELECTED_COLOR.green = color->green;
+  SELECTED_COLOR.blue = color->blue;
+  SELECTED_COLOR.alpha = color->alpha;
+}
+
 static void
 champlain_marker_get_property (GObject *object,
                                guint prop_id,
index d43a83501b41b7616c1150283895ebf242dee12d..f52e4cb60a7d793a6e122267534362b5c23842cd 100644 (file)
@@ -111,6 +111,8 @@ PangoEllipsizeMode champlain_marker_get_ellipsize (ChamplainMarker *marker);
 gboolean champlain_marker_get_single_line_mode (ChamplainMarker *marker);
 gboolean champlain_marker_get_draw_background (ChamplainMarker *marker);
 
+void champlain_marker_set_highlight_color (ClutterColor *color);
+
 G_END_DECLS
 
 #endif