aboutsummaryrefslogtreecommitdiffstats
path: root/src/list_window.c
diff options
context:
space:
mode:
authorKalle Wallin <kaw@linux.se>2005-06-14 17:30:17 +0000
committerKalle Wallin <kaw@linux.se>2005-06-14 17:30:17 +0000
commit34637e024a702d5ff5a431f14d67e2a7fb6331c4 (patch)
tree1fd3d13e639e675d34dea70f99cb5c5fbfc1a1c4 /src/list_window.c
parentf522f83aa4d84c18d98c2d14e79e45d50043418d (diff)
downloadmpd-34637e024a702d5ff5a431f14d67e2a7fb6331c4.tar.gz
mpd-34637e024a702d5ff5a431f14d67e2a7fb6331c4.tar.xz
mpd-34637e024a702d5ff5a431f14d67e2a7fb6331c4.zip
Moved list window state code to list_window.c
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@3353 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/list_window.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/list_window.c b/src/list_window.c
index 896662292..5ee81d069 100644
--- a/src/list_window.c
+++ b/src/list_window.c
@@ -327,3 +327,62 @@ list_window_cmd(list_window_t *lw, int rows, command_t cmd)
}
+
+
+
+list_window_state_t *
+list_window_init_state(void)
+{
+ return g_malloc0(sizeof(list_window_state_t));
+}
+
+list_window_state_t *
+list_window_free_state(list_window_state_t *state)
+{
+ if( state )
+ {
+ if( state->list )
+ {
+ GList *list = state->list;
+ while( list )
+ {
+ g_free(list->data);
+ list->data = NULL;
+ list = list->next;
+ }
+ g_list_free(state->list);
+ state->list = NULL;
+ }
+ g_free(state);
+ }
+ return NULL;
+}
+
+void
+list_window_push_state(list_window_state_t *state, list_window_t *lw)
+{
+ if( state )
+ {
+ list_window_t *tmp = g_malloc(sizeof(list_window_t));
+ memcpy(tmp, lw, sizeof(list_window_t));
+ state->list = g_list_prepend(state->list, (gpointer) tmp);
+ list_window_reset(lw);
+ }
+}
+
+void
+list_window_pop_state(list_window_state_t *state, list_window_t *lw)
+{
+ if( state && state->list )
+ {
+ list_window_t *tmp = state->list->data;
+
+ memcpy(lw, tmp, sizeof(list_window_t));
+ g_free(tmp);
+ state->list->data = NULL;
+ state->list = g_list_delete_link(state->list, state->list);
+ }
+}
+
+
+