From 12496f8e93cd3ba041b9248de1afe02bdd1ef705 Mon Sep 17 00:00:00 2001 From: Cristian Henzel Date: Sat, 21 May 2011 00:46:33 +0300 Subject: [PATCH] ClipIt-1.4.0-20110520002 + Fixed: Remove duplicate truncate_history functionality. + Added: Added basic history item structure. Changes to be committed: modified: ChangeLog modified: TODO modified: src/history.c modified: src/history.h modified: src/main.h --- ChangeLog | 6 +++++- TODO | 1 + src/history.c | 15 ++------------- src/history.h | 13 +++++++++---- src/main.h | 6 ++---- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index 43c3975..3cbeedf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ +ClipIt-1.4.0-20110520002 - 20 May. 2011 + + Fixed: Remove duplicate truncate_history functionality. + + Added: Added basic history item structure. + ClipIt-1.4.0-20110520001 - 20 May. 2011 - + Fixed: Delted items are now properly removed from the history. + + Fixed: Deleted items are now properly removed from the history. + Fixed: Double clicking an item in the "Manage history" dialog now properly selects it again. + Added: [Enter] (for selecting the item) and [Delete] (for removing diff --git a/TODO b/TODO index 448bdb4..075aae3 100644 --- a/TODO +++ b/TODO @@ -6,3 +6,4 @@ + Clean up the code and indent it properly. + Move all pop-up and menu functions from main.c to menus.c. + Use the shipped icon in the display. ++ history structure has to be changed in: main.c, manage.c, history.c diff --git a/src/history.c b/src/history.c index 5ef6274..05a9c60 100644 --- a/src/history.c +++ b/src/history.c @@ -33,7 +33,7 @@ GSList *history; /* Reads history from DATADIR/clipit/history */ -void read_history () +void read_history() { /* Build file path */ gchar *history_path = g_build_filename(g_get_user_data_dir(), @@ -140,18 +140,7 @@ void check_and_append(gchar *item) void append_item(gchar *item) { history = g_slist_prepend(history, g_strdup(item)); - /* Shorten history if necessary */ - GSList *last_possible_element = g_slist_nth(history, - prefs.history_limit - 1); - if (last_possible_element) - { - /* Free last posible element and subsequent elements */ - g_slist_free(last_possible_element->next); - last_possible_element->next = NULL; - } - /* Save changes */ - if (prefs.save_history) - save_history(); + truncate_history(); } /* Truncates history to history_limit items */ diff --git a/src/history.h b/src/history.h index 9cdbf06..b386b4e 100644 --- a/src/history.h +++ b/src/history.h @@ -32,21 +32,26 @@ G_BEGIN_DECLS * 1 GB of RAM. If you don't want that, set this lower. */ #define ENTRY_MAX_SIZE 1048576 -extern GSList* history; +typedef struct { + gboolean is_static; + char *content; +} history_item; + +extern GSList *history; void read_history(); void save_history(); -void check_and_append(gchar* item); +void check_and_append(gchar *item); -void append_item(gchar* item); +void append_item(gchar *item); void truncate_history(); gpointer get_last_item(); -void delete_duplicate(gchar* item); +void delete_duplicate(gchar *item); G_END_DECLS diff --git a/src/main.h b/src/main.h index 19ea346..c25b3bd 100644 --- a/src/main.h +++ b/src/main.h @@ -30,8 +30,7 @@ G_BEGIN_DECLS #define POPUP_DELAY 30 #define CHECK_INTERVAL 500 -typedef struct -{ +typedef struct { gboolean use_copy; /* Use copy */ gboolean use_primary; /* Use primary */ gboolean synchronize; /* Synchronize copy and primary */ @@ -59,8 +58,7 @@ typedef struct gchar* search_key; /* ClipIt search hotkey */ gboolean no_icon; /* No icon */ -} -prefs_t; +} prefs_t; extern prefs_t prefs;