summaryrefslogtreecommitdiff
path: root/src/gui/panels
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-02-09 22:07:42 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-02-09 22:07:42 (GMT)
commit1d79469f69bba33a2280d4bd531652b71148029f (patch)
treee81c094d6e829fb1a79d4c413c1cd162e14868a3 /src/gui/panels
parent8d326041a0379b87e54be44506d544367567e89b (diff)
Created a dialog box to create new bookmarks.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@468 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gui/panels')
-rw-r--r--src/gui/panels/bookmarks.c89
1 files changed, 86 insertions, 3 deletions
diff --git a/src/gui/panels/bookmarks.c b/src/gui/panels/bookmarks.c
index 9239203..7397ef5 100644
--- a/src/gui/panels/bookmarks.c
+++ b/src/gui/panels/bookmarks.c
@@ -110,6 +110,9 @@ static void g_bookmarks_panel_finalize(GBookmarksPanel *);
/* Recharge une collection de signets à l'affichage. */
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 *);
+
/* Réagit au changement de sélection des signets. */
static void on_bookmarks_selection_change(GtkTreeSelection *, GBookmarksPanel *);
@@ -471,8 +474,8 @@ GPanelItem *create_bookmarks_panel(GObject *ref)
static void reload_bookmarks_into_treeview(GBookmarksPanel *panel, GLoadedBinary *binary)
{
- GtkTreeStore *store; /* Modèle de gestion */
GDbCollection *collec; /* Collection à lister ici */
+ GtkTreeStore *store; /* Modèle de gestion */
GArchProcessor *proc; /* Architecture du binaire */
MemoryDataSize msize; /* Taille par défaut */
GList *items; /* Liste des éléments groupés */
@@ -486,13 +489,25 @@ static void reload_bookmarks_into_treeview(GBookmarksPanel *panel, GLoadedBinary
/* 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(collec, "content-changed", G_CALLBACK(on_collection_content_changed), panel);
+
+ }
+
store = GTK_TREE_STORE(gtk_tree_view_get_model(panel->treeview));
gtk_tree_store_clear(store);
@@ -506,8 +521,6 @@ 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(binary, DBF_BOOKMARKS);
-
g_db_collection_rlock(collec);
items = g_db_collection_list_items(collec);
@@ -539,6 +552,76 @@ static void reload_bookmarks_into_treeview(GBookmarksPanel *panel, GLoadedBinary
/******************************************************************************
* *
+* Paramètres : collec = collection dont le contenu vient de changer. *
+* action = type de modification notifiée par la collection. *
+* bookmark = élément en cause dans le changement survenu. *
+* pane = structure contenant les informations maîtresses. *
+* *
+* Description : Met à jour une collection suite à une modification. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void on_collection_content_changed(GDbCollection *collec, DBAction action, GDbBookmark *bookmark, GBookmarksPanel *panel)
+{
+
+ GtkTreeStore *store; /* Modèle de gestion */
+
+
+ GExeFormat *format; /* Format du fichier binaire */
+ 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 */
+
+
+
+
+ printf(" Passage :: %d\n", action);
+
+
+ store = GTK_TREE_STORE(gtk_tree_view_get_model(panel->treeview));
+
+ format = g_loaded_binary_get_format(panel->binary);
+
+
+ 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_tree_store_append(store, &iter, NULL);
+ gtk_tree_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);
+
+
+
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : selection = sélection modifiée. *
* panel = structure contenant les informations maîtresses. *
* *