summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/panels/bookmarks.c431
-rw-r--r--src/gui/panels/bookmarks.ui23
2 files changed, 164 insertions, 290 deletions
diff --git a/src/gui/panels/bookmarks.c b/src/gui/panels/bookmarks.c
index fe69f35..46069c1 100644
--- a/src/gui/panels/bookmarks.c
+++ b/src/gui/panels/bookmarks.c
@@ -38,8 +38,6 @@
#include "../panel-int.h"
#include "../core/global.h"
#include "../../analysis/db/items/bookmark.h"
-#include "../../common/cpp.h"
-#include "../../common/extstr.h"
#include "../../core/params.h"
#include "../../core/paths.h"
#include "../../core/queue.h"
@@ -121,27 +119,19 @@ static void change_bookmarks_panel_current_content(GBookmarksPanel *, GLoadedCon
static void reload_bookmarks_into_treeview(GBookmarksPanel *, GLoadedBinary *);
/* Met à jour une collection suite à une modification. */
-static void on_collection_content_changed(GDbCollection *, DBAction, GDbBookmark *, GBookmarksPanel *);
+static void on_collection_content_changed(GDbCollection *, ActiveItemChange, GDbBookmark *, GBookmarksPanel *);
/* Réagit au changement de sélection des signets. */
static void on_bookmarks_selection_change(GtkTreeSelection *, gpointer);
-
-
-/* Actualise l'affichage des données d'un paramètre modifié. */
-static void on_config_param_modified(GCfgParam *, GBookmarksPanel *);
-
-/* Actualise la valeur affichée d'un paramètre de configuration. */
-static void update_config_param_value(GtkListStore *, GtkTreeIter *);
-
/* Etablit une comparaison entre deux lignes de paramètres. */
static gint compare_bookmarks_list_columns(GtkTreeModel *, GtkTreeIter *, GtkTreeIter *, gpointer);
/* Réagit à une pression sur <Shift+F2> et simule l'édition. */
static gboolean on_key_pressed_over_params(GtkTreeView *, GdkEventKey *, GBookmarksPanel *);
-/* Réagit à une édition de la valeur d'un paramètre. */
-static void on_param_value_edited(GtkCellRendererText *, gchar *, gchar *, GtkTreeStore *);
+/* Réagit à une édition de la valeur d'un commentaire. */
+static void on_comment_value_edited(GtkCellRendererText *, gchar *, gchar *, GBookmarksPanel *);
@@ -252,6 +242,7 @@ static void g_bookmarks_panel_init(GBookmarksPanel *panel)
{
GPanelItem *pitem; /* Version parente du panneau */
GtkBuilder *builder; /* Constructeur utilisé */
+ GObject *crenderer; /* Moteur de rendu de colonne */
GtkTreeSortable *sortable; /* Autre vision de la liste */
/* Eléments de base */
@@ -271,6 +262,10 @@ static void g_bookmarks_panel_init(GBookmarksPanel *panel)
builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(pitem->widget));
+ crenderer = G_OBJECT(gtk_builder_get_object(builder, "crenderer"));
+
+ g_object_set(crenderer, "editable", TRUE, NULL);
+
/* Tri de la liste */
sortable = GTK_TREE_SORTABLE(gtk_builder_get_object(builder, "store"));
@@ -284,7 +279,7 @@ static void g_bookmarks_panel_init(GBookmarksPanel *panel)
gtk_tree_sortable_set_sort_func(sortable, BMC_COMMENT, compare_bookmarks_list_columns,
GINT_TO_POINTER(BMC_COMMENT), NULL);
- gtk_tree_sortable_set_sort_column_id(sortable, BMC_COMMENT, GTK_SORT_ASCENDING);
+ gtk_tree_sortable_set_sort_column_id(sortable, BMC_PHYSICAL, GTK_SORT_ASCENDING);
/* Préparation du menu contextuel */
@@ -293,9 +288,10 @@ static void g_bookmarks_panel_init(GBookmarksPanel *panel)
/* Connexion des signaux */
gtk_builder_add_callback_symbols(builder,
- "on_button_press_over_bookmarks", G_CALLBACK(on_button_press_over_bookmarks),
- "on_key_pressed_over_params", G_CALLBACK(on_key_pressed_over_params),
- "on_bookmarks_selection_change", G_CALLBACK(on_bookmarks_selection_change),
+ BUILDER_CALLBACK(on_button_press_over_bookmarks),
+ BUILDER_CALLBACK(on_key_pressed_over_params),
+ BUILDER_CALLBACK(on_comment_value_edited),
+ BUILDER_CALLBACK(on_bookmarks_selection_change),
NULL);
gtk_builder_connect_signals(builder, panel);
@@ -416,12 +412,36 @@ static char *g_bookmarks_panel_get_key(const GBookmarksPanel *panel)
static void change_bookmarks_panel_current_content(GBookmarksPanel *panel, GLoadedContent *old, GLoadedContent *new)
{
GLoadedBinary *binary; /* Autre version de l'instance */
+ GDbCollection *collec; /* Collection à lister ici */
if (G_IS_LOADED_BINARY(new))
binary = G_LOADED_BINARY(new);
else
binary = NULL;
+ /* Basculement du binaire utilisé */
+
+ if (panel->binary != NULL)
+ {
+ collec = g_loaded_binary_find_collection(panel->binary, DBF_BOOKMARKS);
+ g_signal_handlers_disconnect_by_func(collec, G_CALLBACK(on_collection_content_changed), panel);
+
+ g_object_unref(G_OBJECT(panel->binary));
+
+ }
+
+ panel->binary = binary;
+
+ if (panel->binary != NULL)
+ {
+ g_object_ref(G_OBJECT(binary));
+
+ collec = g_loaded_binary_find_collection(binary, DBF_BOOKMARKS);
+ g_signal_connect_to_main(collec, "active-changed", G_CALLBACK(on_collection_content_changed), panel,
+ g_cclosure_user_marshal_VOID__ENUM_OBJECT);
+
+ }
+
reload_bookmarks_into_treeview(panel, binary);
}
@@ -448,13 +468,14 @@ static void change_bookmarks_panel_current_content(GBookmarksPanel *panel, GLoad
static void reload_bookmarks_into_treeview(GBookmarksPanel *panel, GLoadedBinary *binary)
{
- GDbCollection *collec; /* Collection à lister ici */
GtkBuilder *builder; /* Constructeur utilisé */
GtkListStore *store; /* Modèle de gestion */
GArchProcessor *proc; /* Architecture du binaire */
MemoryDataSize msize; /* Taille par défaut */
- GList *items; /* Liste des éléments groupés */
- GList *b; /* Boucle de parcours */
+ GDbCollection *collec; /* Collection à lister ici */
+ size_t count; /* Taille de la liste obtenue */
+ GDbItem **items; /* Liste des éléments actifs */
+ size_t i; /* Boucle de parcours */
GDbBookmark *bookmark; /* Signet en cours d'étude */
const vmpa2t *addr; /* Adressse associée au signet */
VMPA_BUFFER(phys); /* Position physique */
@@ -462,29 +483,6 @@ static void reload_bookmarks_into_treeview(GBookmarksPanel *panel, GLoadedBinary
const char *comment; /* Commentaire associé */
GtkTreeIter iter; /* Point d'insertion */
- /* Basculement du binaire utilisé */
-
- if (panel->binary != NULL)
- {
- collec = g_loaded_binary_find_collection(panel->binary, DBF_BOOKMARKS);
- g_signal_handlers_disconnect_by_func(collec, G_CALLBACK(on_collection_content_changed), panel);
-
- g_object_unref(G_OBJECT(panel->binary));
-
- }
-
- panel->binary = binary;
-
- if (panel->binary != NULL)
- {
- g_object_ref(G_OBJECT(binary));
-
- collec = g_loaded_binary_find_collection(binary, DBF_BOOKMARKS);
- //g_signal_connect_to_main(collec, "content-changed", G_CALLBACK(on_collection_content_changed), panel,
- // g_cclosure_user_marshal_VOID__ENUM_OBJECT);
-
- }
-
builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget));
store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store"));
@@ -493,7 +491,7 @@ static void reload_bookmarks_into_treeview(GBookmarksPanel *panel, GLoadedBinary
/* Si le panneau actif ne représente pas un binaire... */
- if (binary == NULL) return;
+ if (panel->binary == NULL) return;
/* Actualisation de l'affichage */
@@ -501,15 +499,15 @@ static void reload_bookmarks_into_treeview(GBookmarksPanel *panel, GLoadedBinary
msize = g_arch_processor_get_memory_size(proc);
g_object_unref(G_OBJECT(proc));
+ collec = g_loaded_binary_find_collection(panel->binary, DBF_BOOKMARKS);
+
g_db_collection_rlock(collec);
- /*
- items = g_db_collection_get_items(collec);
+ items = g_db_collection_get_last_items(collec, &count);
- for (b = g_list_first(items); b != NULL; b = g_list_next(b))
+ for (i = 0; i < count; i++)
{
- bookmark = G_DB_BOOKMARK(b->data);
- if (!g_db_item_is_enabled(G_DB_ITEM(bookmark))) continue;
+ bookmark = G_DB_BOOKMARK(items[i]);
addr = g_db_bookmark_get_address(bookmark);
@@ -518,20 +516,25 @@ static void reload_bookmarks_into_treeview(GBookmarksPanel *panel, GLoadedBinary
comment = g_db_bookmark_get_comment(bookmark);
- if (is_bookmark_filtered(panel, phys, virt, comment))
- continue;
+ if (!is_bookmark_filtered(panel, phys, virt, comment))
+ {
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ BMC_BOOKMARK, bookmark,
+ BMC_PICTURE, G_BOOKMARKS_PANEL_GET_CLASS(panel)->bookmark_img,
+ BMC_PHYSICAL, phys,
+ BMC_VIRTUAL, virt,
+ BMC_COMMENT, comment,
+ -1);
+
+ }
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- BMC_BOOKMARK, bookmark,
- BMC_PICTURE, G_BOOKMARKS_PANEL_GET_CLASS(panel)->bookmark_img,
- BMC_PHYSICAL, phys,
- BMC_VIRTUAL, virt,
- BMC_COMMENT, comment,
- -1);
+ g_object_unref(G_OBJECT(bookmark));
}
- */
+
+ if (items != NULL)
+ free(items);
g_db_collection_runlock(collec);
@@ -555,76 +558,80 @@ static void reload_bookmarks_into_treeview(GBookmarksPanel *panel, GLoadedBinary
* *
******************************************************************************/
-static void on_collection_content_changed(GDbCollection *collec, DBAction action, GDbBookmark *bookmark, GBookmarksPanel *panel)
+static void on_collection_content_changed(GDbCollection *collec, ActiveItemChange change, GDbBookmark *bookmark, GBookmarksPanel *panel)
{
GtkBuilder *builder; /* Constructeur utilisé */
GtkListStore *store; /* Modèle de gestion */
-
-
+ GtkTreeModel *model; /* Modèle de gestion courant */
+ GDbBookmark *displayed; /* Elément de collection */
+ gboolean status; /* Bilan d'une comparaison */
GArchProcessor *proc; /* Architecture du binaire */
MemoryDataSize msize; /* Taille par défaut */
-
const vmpa2t *addr; /* Adressse associée au signet */
VMPA_BUFFER(phys); /* Position physique */
VMPA_BUFFER(virt); /* Adresse virtuelle */
GtkTreeIter iter; /* Point d'insertion */
- GtkTreeModel *model; /* Modèle de gestion courant */
- GDbBookmark *displayed; /* Elément de collection */
-
-
builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget));
store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store"));
- if (action == DBA_ADD_ITEM \
- || (action == DBA_CHANGE_STATE && !g_db_item_has_flag(G_DB_ITEM(bookmark), DIF_DISABLED)))
+ switch (change)
{
- proc = g_loaded_binary_get_processor(panel->binary);
- msize = g_arch_processor_get_memory_size(proc);
- g_object_unref(G_OBJECT(proc));
+ case AIC_REMOVED:
+ case AIC_UPDATED:
- addr = g_db_bookmark_get_address(bookmark);
+ model = GTK_TREE_MODEL(store);
- vmpa2_phys_to_string(addr, msize, phys, NULL);
- vmpa2_virt_to_string(addr, msize, virt, NULL);
+ if (gtk_tree_model_get_iter_first(model, &iter))
+ {
+ status = TRUE;
- gtk_list_store_append(store, &iter);
- gtk_list_store_set(store, &iter,
- BMC_BOOKMARK, bookmark,
- BMC_PICTURE, G_BOOKMARKS_PANEL_GET_CLASS(panel)->bookmark_img,
- BMC_PHYSICAL, phys,
- BMC_VIRTUAL, virt,
- BMC_COMMENT, g_db_bookmark_get_comment(bookmark),
- -1);
+ do
+ {
+ gtk_tree_model_get(model, &iter, BMC_BOOKMARK, &displayed, -1);
+ status = g_db_item_cmp_key(G_DB_ITEM(bookmark), G_DB_ITEM(displayed));
+ if (status)
+ gtk_list_store_remove(store, &iter);
+ g_object_unref(G_OBJECT(displayed));
- }
+ if (status)
+ break;
- else
- {
- model = GTK_TREE_MODEL(store);
+ }
+ while (gtk_tree_model_iter_next(model, &iter));
+ assert(status);
- if (gtk_tree_model_get_iter_first(model, &iter))
- do
- {
- gtk_tree_model_get(model, &iter, BMC_BOOKMARK, &displayed, -1);
+ }
- if (bookmark == displayed)
- {
- gtk_list_store_remove(store, &iter);
- break;
- }
+ if (change == AIC_REMOVED)
+ break;
- g_object_unref(G_OBJECT(displayed));
+ case AIC_ADDED:
- }
- while (gtk_tree_model_iter_next(model, &iter));
+ proc = g_loaded_binary_get_processor(panel->binary);
+ msize = g_arch_processor_get_memory_size(proc);
+ g_object_unref(G_OBJECT(proc));
+
+ addr = g_db_bookmark_get_address(bookmark);
+ vmpa2_phys_to_string(addr, msize, phys, NULL);
+ vmpa2_virt_to_string(addr, msize, virt, NULL);
+ gtk_list_store_append(store, &iter);
+ gtk_list_store_set(store, &iter,
+ BMC_BOOKMARK, bookmark,
+ BMC_PICTURE, G_BOOKMARKS_PANEL_GET_CLASS(panel)->bookmark_img,
+ BMC_PHYSICAL, phys,
+ BMC_VIRTUAL, virt,
+ BMC_COMMENT, g_db_bookmark_get_comment(bookmark),
+ -1);
+
+ break;
}
@@ -676,130 +683,6 @@ static void on_bookmarks_selection_change(GtkTreeSelection *selection, gpointer
/******************************************************************************
* *
-* Paramètres : param = instance dont le contenu a évolué. *
-* panel = panneau d'affichage de paramètres à mettre à jour. *
-* *
-* Description : Actualise l'affichage des données d'un paramètre modifié. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void on_config_param_modified(GCfgParam *param, GBookmarksPanel *panel)
-{
- GtkBuilder *builder; /* Constructeur utilisé */
- GtkTreeModel *model; /* Gestionnaire de données */
- GtkTreeIter iter; /* Point de recherche */
- gboolean looping; /* Autorisation de bouclage */
- GCfgParam *item; /* Elément de la liste */
-
- builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget));
-
- model = GTK_TREE_MODEL(gtk_builder_get_object(builder, "store"));
-
- for (looping = gtk_tree_model_get_iter_first(model, &iter);
- looping;
- looping = gtk_tree_model_iter_next(model, &iter))
- {
- gtk_tree_model_get(model, &iter, BMC_BOOKMARK, &item, -1);
-
- if (item == param)
- {
- update_config_param_value(GTK_LIST_STORE(model), &iter);
- break;
- }
-
- }
-
- g_object_unref(G_OBJECT(builder));
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : store = gestionnaire du tableau de données. *
-* iter = point de modification dans les lignes. *
-* param = paramètre dont la valeur est à afficher. *
-* *
-* Description : Actualise la valeur affichée d'un paramètre de configuration.*
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void update_config_param_value(GtkListStore *store, GtkTreeIter *iter)
-{
- GCfgParam *param; /* Paramètre à consulter */
- ConfigParamState state; /* Etat du paramètre */
- char *state_desc; /* Version chaînée de l'état */
- bool boolean; /* Valeur booléenne */
- int integer; /* Valeur entière */
- char int_val[sizeof(XSTR(INT_MIN)) + 1];/* Valeur en chaîne de carac. */
- char *string; /* Chaîne de caractères */
- char *desc; /* Description à afficher */
-
- gtk_tree_model_get(GTK_TREE_MODEL(store), iter, BMC_BOOKMARK, &param, -1);
-
- state = g_config_param_get_state(param);
-
- if (state & CPS_DEFAULT)
- state_desc = strdup(_("By default"));
- else
- state_desc = strdup(_("Changed"));
-
- if (state & CPS_EMPTY)
- state_desc = stradd(state_desc, _(" + empty"));
-
- if (state & CPS_EMPTY)
- desc = "";
-
- else
- switch (g_config_param_get_ptype(param))
- {
- case CPT_BOOLEAN:
- g_config_param_get_value(param, &boolean);
- desc = (boolean ? _("true") : _("false"));
- break;
-
- case CPT_INTEGER:
- g_config_param_get_value(param, &integer);
- snprintf(int_val, sizeof(int_val), "%d", integer);
- desc = int_val;
- break;
-
- case CPT_STRING:
- g_config_param_get_value(param, &string);
- desc = (string != NULL ? string : "");
- break;
-
- default:
- assert(false);
- desc = "???";
- break;
-
- }
-
- /*
- gtk_list_store_set(store, iter,
- CPC_BOLD, state & CPS_DEFAULT ? 400 : 800,
- CPC_STATUS, state_desc,
- CPC_VALUE, desc, -1);
- */
-
- free(state_desc);
-
- g_object_unref(G_OBJECT(param));
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : model = gestionnaire du tableau de données. *
* a = première ligne de données à traiter. *
* b = seconde ligne de données à traiter. *
@@ -860,16 +743,23 @@ static gboolean on_key_pressed_over_params(GtkTreeView *treeview, GdkEventKey *e
guint accel_key; /* Touche de raccourci */
GdkModifierType accel_mod; /* Modifiateurs attendus aussi */
- if (!g_generic_config_get_value(get_main_configuration(), MPK_KEYBINDINGS_EDIT, &accelerator))
- return FALSE;
+ if (event->keyval == GDK_KEY_Delete)
+ mcb_bookmarks_panel_delete(NULL, panel);
+
+ else
+ {
+ if (!g_generic_config_get_value(get_main_configuration(), MPK_KEYBINDINGS_EDIT, &accelerator))
+ return FALSE;
+
+ if (accelerator == NULL)
+ return FALSE;
- if (accelerator == NULL)
- return FALSE;
+ gtk_accelerator_parse(accelerator, &accel_key, &accel_mod);
- gtk_accelerator_parse(accelerator, &accel_key, &accel_mod);
+ if (event->keyval == accel_key && event->state == accel_mod)
+ mcb_bookmarks_panel_edit(NULL, panel);
- if (event->keyval == accel_key && event->state == accel_mod)
- mcb_bookmarks_panel_edit(NULL, panel);
+ }
return FALSE;
@@ -881,9 +771,9 @@ static gboolean on_key_pressed_over_params(GtkTreeView *treeview, GdkEventKey *e
* Paramètres : renderer = moteur de rendu pour la cellule. *
* path = chemin d'accès vers la cellule éditée. *
* new = nouvelle valeur sous forme de texte à valider. *
-* store = gestionnaire des données de la liste affichée. *
+* panel = panneau d'affichage sur lequel s'appuyer. *
* *
-* Description : Réagit à une édition de la valeur d'un paramètre. *
+* Description : Réagit à une édition de la valeur d'un commentaire. *
* *
* Retour : - *
* *
@@ -891,62 +781,40 @@ static gboolean on_key_pressed_over_params(GtkTreeView *treeview, GdkEventKey *e
* *
******************************************************************************/
-static void on_param_value_edited(GtkCellRendererText *renderer, gchar *path, gchar *new, GtkTreeStore *store)
+static void on_comment_value_edited(GtkCellRendererText *renderer, gchar *path, gchar *new, GBookmarksPanel *panel)
{
+ GtkBuilder *builder; /* Constructeur utilisé */
+ GtkListStore *store; /* Modèle de gestion */
GtkTreePath *tree_path; /* Chemin d'accès natif */
GtkTreeIter iter; /* Point de la modification */
- GCfgParam *param; /* Paramètre à actualiser */
- bool boolean; /* Valeur booléenne */
- int integer; /* Valeur entière */
- char *end; /* Pointeur vers '\0' final ? */
-
- tree_path = gtk_tree_path_new_from_string(path);
- if (tree_path == NULL) return;
-
- if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, tree_path))
- goto opve_bad_iter;
-
- gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, BMC_BOOKMARK, &param, -1);
-
- switch (g_config_param_get_ptype(param))
- {
- case CPT_BOOLEAN:
-
- if (strcmp(new, "true") != 0 && strcmp(new, "false") != 0)
- goto opve_bad_value;
+ GDbBookmark *mark; /* Signet sélectionné */
+ GDbBookmark *updater; /* Signet de mise à jour */
- boolean = (strcmp(new, "true") == 0);
- g_config_param_set_value(param, boolean);
+ builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget));
- break;
+ store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store"));
- case CPT_INTEGER:
+ tree_path = gtk_tree_path_new_from_string(path);
+ if (tree_path == NULL) goto bad_path;
- integer = strtol(new, &end, 10);
- if (*end != '\0') goto opve_bad_value;
-
- g_config_param_set_value(param, integer);
+ if (!gtk_tree_model_get_iter(GTK_TREE_MODEL(store), &iter, tree_path))
+ goto bad_iter;
- break;
+ gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, BMC_BOOKMARK, &mark, -1);
- case CPT_STRING:
- g_config_param_set_value(param, new);
- break;
+ updater = g_db_bookmark_new(g_db_bookmark_get_address(mark), new);
- default:
- assert(false);
- goto opve_bad_value;
- break;
+ g_loaded_binary_add_to_collection(panel->binary, G_DB_ITEM(updater));
- }
+ g_object_unref(G_OBJECT(mark));
- opve_bad_value:
+ bad_iter:
- g_object_unref(G_OBJECT(param));
+ gtk_tree_path_free(tree_path);
- opve_bad_iter:
+ bad_path:
- gtk_tree_path_free(tree_path);
+ g_object_unref(G_OBJECT(builder));
}
@@ -1185,7 +1053,7 @@ static void mcb_bookmarks_panel_edit(GtkMenuItem *menuitem, GBookmarksPanel *pan
path = gtk_tree_model_get_path(model, &iter);
gtk_tree_view_set_cursor(treeview, path,
- gtk_tree_view_get_column(treeview, BMC_COMMENT - BMC_PHYSICAL),
+ gtk_tree_view_get_column(treeview, BMC_COMMENT - BMC_PICTURE),
TRUE);
gtk_tree_path_free(path);
@@ -1215,17 +1083,24 @@ static void mcb_bookmarks_panel_delete(GtkMenuItem *menuitem, GBookmarksPanel *p
GtkBuilder *builder; /* Constructeur utilisé */
GtkTreeView *treeview; /* Affichage de la liste */
GDbBookmark *mark; /* Signet sélectionné */
+ GDbBookmark *eraser; /* Signet de suppression */
builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget));
treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview"));
mark = get_selected_panel_bookmark(treeview, NULL);
- if (mark == NULL) return;
- //g_loaded_binary_remove_from_collection(panel->binary, DBF_BOOKMARKS, G_DB_ITEM(mark));
+ if (mark != NULL)
+ {
+ eraser = g_db_bookmark_new(g_db_bookmark_get_address(mark), NULL);
+ g_db_item_add_flag(G_DB_ITEM(eraser), DIF_ERASER);
- g_object_unref(G_OBJECT(mark));
+ g_loaded_binary_add_to_collection(panel->binary, G_DB_ITEM(eraser));
+
+ g_object_unref(G_OBJECT(mark));
+
+ }
g_object_unref(G_OBJECT(builder));
diff --git a/src/gui/panels/bookmarks.ui b/src/gui/panels/bookmarks.ui
index 8ba6211..e068304 100644
--- a/src/gui/panels/bookmarks.ui
+++ b/src/gui/panels/bookmarks.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.21.0 -->
+<!-- Generated with glade 3.37.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkListStore" id="store">
@@ -17,16 +17,16 @@
</columns>
</object>
<object class="GtkOffscreenWindow">
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<child>
<object class="GtkScrolledWindow" id="box">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">in</property>
+ <property name="can-focus">True</property>
+ <property name="shadow-type">in</property>
<child>
<object class="GtkTreeView" id="treeview">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="can-focus">True</property>
<property name="model">store</property>
<signal name="button-press-event" handler="on_button_press_over_bookmarks" swapped="no"/>
<signal name="key-press-event" handler="on_key_pressed_over_params" swapped="no"/>
@@ -45,7 +45,7 @@
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Physical address</property>
- <property name="sort_column_id">2</property>
+ <property name="sort-column-id">2</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -57,7 +57,7 @@
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Virtual address</property>
- <property name="sort_column_id">3</property>
+ <property name="sort-column-id">3</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
@@ -69,9 +69,11 @@
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Comment</property>
- <property name="sort_column_id">4</property>
+ <property name="sort-column-id">4</property>
<child>
- <object class="GtkCellRendererText"/>
+ <object class="GtkCellRendererText" id="crenderer">
+ <signal name="edited" handler="on_comment_value_edited" swapped="no"/>
+ </object>
<attributes>
<attribute name="text">4</attribute>
</attributes>
@@ -82,8 +84,5 @@
</child>
</object>
</child>
- <child>
- <placeholder/>
- </child>
</object>
</interface>