[gnome-builder/wip/libide] libide: clear count when permanent mode changes



commit 01975903d408afdd39bb3c30b5a0bd59508aeb78
Author: Christian Hergert <christian hergert me>
Date:   Fri Mar 6 14:46:36 2015 -0800

    libide: clear count when permanent mode changes

 libide/ide-source-view.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index feea40b..e02915e 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -141,6 +141,10 @@ enum {
 static GParamSpec *gParamSpecs [LAST_PROP];
 static guint       gSignals [LAST_SIGNAL];
 
+static void ide_source_view_real_set_mode (IdeSourceView         *self,
+                                           const gchar           *name,
+                                           IdeSourceViewModeType  type);
+
 static void
 activate_action (GtkWidget   *widget,
                  const gchar *prefix,
@@ -1390,8 +1394,7 @@ ide_source_view_do_mode (IdeSourceView *self,
     }
 
   if (!priv->mode)
-    priv->mode = _ide_source_view_mode_new (GTK_WIDGET (self), "default",
-                                            IDE_SOURCE_VIEW_MODE_TYPE_PERMANENT);
+    ide_source_view_real_set_mode (self, NULL,  IDE_SOURCE_VIEW_MODE_TYPE_PERMANENT);
 
   return ret;
 }
@@ -2070,6 +2073,10 @@ ide_source_view_real_set_mode (IdeSourceView         *self,
       type = IDE_SOURCE_VIEW_MODE_TYPE_PERMANENT;
     }
 
+  /* reset the count when switching to permanent mode */
+  if (type == IDE_SOURCE_VIEW_MODE_TYPE_PERMANENT)
+    priv->count = 0;
+
   priv->mode = _ide_source_view_mode_new (GTK_WIDGET (self), mode, type);
 
   IDE_EXIT;


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