[gnome-builder] source-view-mode: add CSS class upfront when creating mode



commit 629a385d36f6c33b184178d68e6baaa5afb7043e
Author: Christian Hergert <christian hergert me>
Date:   Wed Apr 22 11:33:35 2015 -0700

    source-view-mode: add CSS class upfront when creating mode
    
    This fixes Vim mode on gtk+ 3.17.0.

 libide/ide-source-view-mode.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/libide/ide-source-view-mode.c b/libide/ide-source-view-mode.c
index a0b306f..cec0944 100644
--- a/libide/ide-source-view-mode.c
+++ b/libide/ide-source-view-mode.c
@@ -49,18 +49,14 @@ get_param (IdeSourceViewMode *self,
            const gchar       *param,
            GValue            *value)
 {
-  IdeSourceViewModePrivate *priv = ide_source_view_mode_get_instance_private (self);
   GtkStyleContext *context;
 
   g_assert (IDE_IS_SOURCE_VIEW_MODE (self));
   g_assert (param != NULL);
   g_assert (value != NULL);
-  context = gtk_widget_get_style_context (GTK_WIDGET (self));
 
-  gtk_style_context_save (context);
-  gtk_style_context_add_class (context, priv->name);
+  context = gtk_widget_get_style_context (GTK_WIDGET (self));
   gtk_style_context_get_style_property (context, param, value);
-  gtk_style_context_restore (context);
 }
 
 gboolean
@@ -467,6 +463,15 @@ _ide_source_view_mode_new (GtkWidget             *view,
   priv->view = g_object_ref (view);
   priv->name = g_strdup (name);
   priv->type = type;
+
+  if (priv->name != NULL)
+    {
+      GtkStyleContext *context;
+
+      context = gtk_widget_get_style_context (GTK_WIDGET (mode));
+      gtk_style_context_add_class (context, priv->name);
+    }
+
   priv->default_mode = get_string_param (mode, "default-mode");
   priv->display_name = get_string_param (mode, "display-name");
 


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