[gtksourceview/wip/minimap] Minor cleanup
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/minimap] Minor cleanup
- Date: Thu, 7 May 2015 13:17:39 +0000 (UTC)
commit c45794ec2b99001525708467f60aaf9a820a77ed
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Thu May 7 15:12:46 2015 +0200
Minor cleanup
gtksourceview/gtksourcemap.c | 103 +++++++++++++++++++++---------------------
1 files changed, 52 insertions(+), 51 deletions(-)
---
diff --git a/gtksourceview/gtksourcemap.c b/gtksourceview/gtksourcemap.c
index 935efaf..9557b91 100644
--- a/gtksourceview/gtksourcemap.c
+++ b/gtksourceview/gtksourcemap.c
@@ -79,9 +79,16 @@ static void
gtk_source_map_rebuild_css (GtkSourceMap *map)
{
GtkSourceMapPrivate *priv;
+ GtkSourceStyleScheme *style_scheme;
+ GtkTextBuffer *buffer;
priv = gtk_source_map_get_instance_private (map);
+ if (priv->view == NULL)
+ {
+ return;
+ }
+
if (priv->font_desc != NULL)
{
gchar *css;
@@ -94,62 +101,56 @@ gtk_source_map_rebuild_css (GtkSourceMap *map)
g_free (tmp);
}
- if (priv->view != NULL)
- {
- GtkSourceStyleScheme *style_scheme;
- GtkTextBuffer *buffer;
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->view));
+ style_scheme = gtk_source_buffer_get_style_scheme (GTK_SOURCE_BUFFER (buffer));
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->view));
- style_scheme = gtk_source_buffer_get_style_scheme (GTK_SOURCE_BUFFER (buffer));
+ if (style_scheme != NULL)
+ {
+ gchar *background = NULL;
+ GtkSourceStyle *style;
- if (style_scheme != NULL)
+ style = gtk_source_style_scheme_get_style (style_scheme, "map-overlay");
+ if (style == NULL)
{
- gchar *background = NULL;
- GtkSourceStyle *style;
-
- style = gtk_source_style_scheme_get_style (style_scheme, "map-overlay");
- if (style == NULL)
- {
- GtkStyleContext *context;
- GdkRGBA color;
-
- /* FIXME: how was again to get the selection color? */
- context = gtk_widget_get_style_context (GTK_WIDGET (priv->view));
- gtk_style_context_save (context);
- gtk_style_context_add_class (context, "view");
- gtk_style_context_get_color (context,
- GTK_STATE_FLAG_NORMAL,
- &color);
- gtk_style_context_restore (context);
- background = gdk_rgba_to_string (&color);
- }
- else
- {
- g_object_get (style,
- "background", &background,
- NULL);
- }
-
- if (background != NULL)
- {
- gchar *css;
-
- css = g_strdup_printf ("GtkSourceMap GtkEventBox {"
- "background-color: %s;"
- "opacity: 0.75;"
- "border-top: 1px solid shade(%s,0.9);"
- "border-bottom: 1px solid shade(%s,0.9);"
- "}\n",
- background,
- background,
- background);
-
- gtk_css_provider_load_from_data (priv->box_css_provider, css, -1, NULL);
- g_free (css);
- }
+ GtkStyleContext *context;
+ GdkRGBA color;
+
+ /* FIXME: how was again to get the selection color? */
+ context = gtk_widget_get_style_context (GTK_WIDGET (priv->view));
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, "view");
+ gtk_style_context_get_color (context,
+ GTK_STATE_FLAG_NORMAL,
+ &color);
+ gtk_style_context_restore (context);
+ background = gdk_rgba_to_string (&color);
+ }
+ else
+ {
+ g_object_get (style,
+ "background", &background,
+ NULL);
+ }
- g_free (background);
+ if (background != NULL)
+ {
+ gchar *css;
+
+ css = g_strdup_printf ("GtkSourceMap GtkEventBox {"
+ "background-color: %s;"
+ "opacity: 0.75;"
+ "border-top: 1px solid shade(%s,0.9);"
+ "border-bottom: 1px solid shade(%s,0.9);"
+ "}\n",
+ background,
+ background,
+ background);
+
+ gtk_css_provider_load_from_data (priv->box_css_provider, css, -1, NULL);
+ g_free (css);
}
+
+ g_free (background);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]