[gnome-commander] History: operator = (GList *list)
- From: Piotr Eljasiak <epiotr src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] History: operator = (GList *list)
- Date: Fri, 10 Jun 2011 17:30:22 +0000 (UTC)
commit 5dc297cd1afcb4117dde47728da26339af77ce45
Author: Piotr Eljasiak <epiotr src gnome org>
Date: Fri Jun 10 19:20:12 2011 +0200
History: operator = (GList *list)
src/history.h | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/history.h b/src/history.h
index 61a1351..f59be04 100644
--- a/src/history.h
+++ b/src/history.h
@@ -34,6 +34,8 @@ class History
History(gint max): is_locked(FALSE), ents(NULL), pos(NULL) { this->max = max; }
~History();
+ History &operator = (GList *list);
+
guint size() { return g_list_length (ents); }
gboolean empty() { return ents==NULL; }
@@ -56,4 +58,17 @@ class History
gboolean locked() const { return is_locked; }
};
+inline History &History::operator = (GList *list)
+{
+ if (ents)
+ {
+ g_list_foreach (ents, (GFunc) g_free, NULL);
+ g_list_free (ents);
+ }
+
+ pos = ents = list; // FIXME: no check for max and dups...
+
+ return *this;
+}
+
#endif // __HISTORY_H__
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]