1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 2003 Lars Clausen
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 /* persistence.h -- definitions for persistent storage.
36 typedef void (NullaryFunc
)();
38 void persistence_load(void);
39 void persistence_save(void);
40 void persistence_register_window(GtkWindow
*window
);
41 void persistence_register_window_create(gchar
*role
, NullaryFunc
*func
);
42 void persistence_register_string_entry(gchar
*role
, GtkWidget
*entry
);
43 gboolean
persistence_change_string_entry(gchar
*role
, gchar
*string
,
46 /** A persistently stored list of strings.
47 * The list contains no duplicates.
48 * If sorted is FALSE, any string added will be placed in front of the list
49 * (possibly removing it from further down), thus making it an LRU list.
50 * The list is not tied to any particular GTK widget, as it has uses
51 * in a number of different places (though mostly in menus)
53 typedef struct _PersistentList
{
61 typedef void (*PersistenceCallback
)(GObject
*, gpointer
);
63 PersistentList
*persistence_register_list(const gchar
*role
);
64 PersistentList
*persistent_list_get(const gchar
*role
);
65 GList
*persistent_list_get_glist(const gchar
*role
);
66 gboolean
persistent_list_add(const gchar
*role
, const gchar
*item
);
67 void persistent_list_set_max_length(const gchar
*role
, gint max
);
68 gboolean
persistent_list_remove(const gchar
*role
, const gchar
*item
);
69 void persistent_list_remove_all(const gchar
*role
);
70 void persistent_list_add_listener(const gchar
*role
, PersistenceCallback func
,
71 GObject
*watch
, gpointer userdata
);
73 gint
persistence_register_integer(gchar
*role
, int defaultvalue
);
74 gint
persistence_get_integer(gchar
*role
);
75 void persistence_set_integer(gchar
*role
, gint newvalue
);
77 real
persistence_register_real(gchar
*role
, real defaultvalue
);
78 real
persistence_get_real(gchar
*role
);
79 void persistence_set_real(gchar
*role
, real newvalue
);
81 gboolean
persistence_register_boolean(gchar
*role
, gboolean defaultvalue
);
82 gboolean
persistence_get_boolean(gchar
*role
);
83 void persistence_set_boolean(gchar
*role
, gboolean newvalue
);
85 gchar
*persistence_register_string(gchar
*role
, gchar
*defaultvalue
);
86 gchar
*persistence_get_string(gchar
*role
);
87 void persistence_set_string(gchar
*role
, gchar
*newvalue
);
89 Color
*persistence_register_color(gchar
*role
, Color
*defaultvalue
);
90 Color
*persistence_get_color(gchar
*role
);
91 void persistence_set_color(gchar
*role
, Color
*newvalue
);