From: Pierre-Luc Beaudoin Date: Tue, 28 Jul 2009 02:45:41 +0000 (-0400) Subject: Set the highlight color to use Gtk's selection color X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=044b08f5e42ea0a3419354146364901dcc1d1369;p=libchamplain Set the highlight color to use Gtk's selection color --- diff --git a/champlain-gtk/gtk-champlain-embed.c b/champlain-gtk/gtk-champlain-embed.c index 755a34a..5330191 100644 --- a/champlain-gtk/gtk-champlain-embed.c +++ b/champlain-gtk/gtk-champlain-embed.c @@ -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 diff --git a/champlain/champlain-marker.c b/champlain/champlain-marker.c index 6589d89..0f4f683 100644 --- a/champlain/champlain-marker.c +++ b/champlain/champlain-marker.c @@ -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, diff --git a/champlain/champlain-marker.h b/champlain/champlain-marker.h index d43a835..f52e4cb 100644 --- a/champlain/champlain-marker.h +++ b/champlain/champlain-marker.h @@ -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