diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2019-09-11 22:08:42 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2019-09-11 22:08:42 (GMT) |
commit | 1c2949f6828b995c7b9f8feba8fd7214f52f8f4d (patch) | |
tree | 0bdff13f6ac8d87725d6783a2f1ecc7511426cd1 /src/analysis/db/items/bookmark.c | |
parent | 83faef9c8f78b20cb031af686f763cfb215cf9d7 (diff) |
Built suitable dynamic labels for bookmarks.
Diffstat (limited to 'src/analysis/db/items/bookmark.c')
-rw-r--r-- | src/analysis/db/items/bookmark.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/src/analysis/db/items/bookmark.c b/src/analysis/db/items/bookmark.c index 819528d..5715737 100644 --- a/src/analysis/db/items/bookmark.c +++ b/src/analysis/db/items/bookmark.c @@ -83,7 +83,7 @@ static bool g_db_bookmark_unpack(GDbBookmark *, packed_buffer *); static bool g_db_bookmark_pack(const GDbBookmark *, packed_buffer *); /* Construit la description humaine d'un signet sur un tampon. */ -static void g_db_bookmark_build_label(GDbBookmark *); +static char *g_db_bookmark_build_label(GDbBookmark *); /* Exécute un signet sur un tampon de binaire chargé. */ static bool g_db_bookmark_run(GDbBookmark *, GLoadedBinary *, bool *, bool); @@ -414,15 +414,34 @@ static bool g_db_bookmark_pack(const GDbBookmark *bookmark, packed_buffer *pbuf) * * * Description : Construit la description humaine d'un signet sur un tampon. * * * -* Retour : - * +* Retour : Chaîne de caractère correspondante. * * * * Remarques : - * * * ******************************************************************************/ -static void g_db_bookmark_build_label(GDbBookmark *bookmark) +static char *g_db_bookmark_build_label(GDbBookmark *bookmark) { - asprintf(&G_DB_ITEM(bookmark)->label, _("Bookmark \"%s\""), get_rle_string(&bookmark->comment)); + char *result; /* Description à retourner */ + DbItemFlags flags; /* Propriétés de l'élément */ + const char *prefix; /* Préfixe à ajouter */ + const char *text; /* Commentaire associé */ + + flags = g_db_item_get_flags(G_DB_ITEM(bookmark)); + + if (flags & DIF_ERASER) + prefix = _("Removed"); + else + prefix = _("Created"); + + text = get_rle_string(&bookmark->comment); + + if (text != NULL) + asprintf(&result, _("%s bookmark \"%s\""), prefix, text); + else + asprintf(&result, _("%s empty bookmark"), prefix); + + return result; } |