[model/wip/api-redesign] ModelSimpleList: Add new constructor function and fix children counter bug



commit 7a2a727ca6b500dd8ff93d4b5e8c16381f44c3ca
Author: Alberto Ruiz <aruiz gnome org>
Date:   Sun Oct 28 01:41:55 2012 +0200

    ModelSimpleList: Add new constructor function and fix children counter bug

 model/model-simple-list.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/model/model-simple-list.c b/model/model-simple-list.c
index 159af0c..8000942 100644
--- a/model/model-simple-list.c
+++ b/model/model-simple-list.c
@@ -14,8 +14,6 @@
 #include "model-implementation.h"
 #include "model.h"
 
-#include <string.h>
-
 /**
  * SECTION:simplelist
  * @Short_Description: a very simple implementation of #ModelList
@@ -77,7 +75,7 @@ model_simple_list_splice (ModelSimpleList     *list,
   old_count = list->n_items;
   old_items = list->items;
 
-  new_count = old_count + n_inserts + n_removes;
+  new_count = old_count + n_inserts - n_removes;
 
   if (new_count != old_count)
     {
@@ -196,3 +194,9 @@ model_simple_list_class_init (ModelSimpleListClass *class)
   list_class->n_children = model_simple_list_n_children;
   list_class->get_child = model_simple_list_get_child;
 }
+
+ModelSimpleList*
+model_simple_list_new (void)
+{
+  return (ModelSimpleList*)g_object_new (MODEL_TYPE_SIMPLE_LIST, NULL);
+}



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