1 /* Copyright (C) 2007-2008 by Xyhthyx <xyhthyx@gmail.com> 2 * 3 * This file is part of Parcellite. 4 * 5 * Parcellite is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * Parcellite is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef HISTORY_H 20 #define HISTORY_H 21 22 G_BEGIN_DECLS 23 24 #define HISTORY_FILE "parcellite/history" 25 26 #define CLIP_TYPE_TEXT 0x1 27 #define CLIP_TYPE_IMG 0x2 28 #define CLIP_TYPE_PERSISTENT 0x4 29 30 #define HIST_DEL 0x10 31 #define HIST_CHECKDUP 1 32 #define HIST_KEEP_FLAGS 2 33 /**give us a genric struct for future expansion */ 34 struct history_gen{ /**16 bytes, for overlay over res, below. */ 35 gint16 a; 36 gint16 b; 37 gint16 c; 38 gint16 d; 39 }__attribute__((__packed__)); 40 struct history_item { 41 guint32 len; /**length of data item, MUST be first in structure */ 42 gint16 type; /**currently, text or image */ 43 gint16 flags; /**persistence, or?? */ 44 guint32 res[4]; 45 gchar text[8]; /**reserve 64 bits (8 bytes) for pointer to data. */ 46 }__attribute__((__packed__)); 47 48 49 extern GList* history_list; 50 51 glong validate_utf8_text(gchar *text, glong len); 52 53 void read_history(); 54 55 void save_history(); 56 57 struct history_item *new_clip_item(gint type, guint32 len, void *data); 58 gint is_duplicate(gchar* item, int mode,int *type); 59 60 void append_item(gchar* item, int checkdup, gint iflags, gint itype); 61 62 void truncate_history(); 63 64 gpointer get_last_item(); 65 void clear_history( void ); 66 67 void delete_duplicate(gchar* item); 68 69 void history_save_as(GtkMenuItem *menu_item, gpointer user_data); 70 G_END_DECLS 71 72 #endif 73