diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2020-01-10 23:04:51 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2020-01-10 23:04:51 (GMT) |
commit | 6b785b0e6c6048a4a8f1f81f9eaa407e05622368 (patch) | |
tree | dc6dc802b65ec37b3cbc3c65e9d6637654f0981c /src/gui/menus/edition.c | |
parent | c0528230469b10d606b9d1fa66a18696b2584fed (diff) |
Cleaned editor items by removing a direct link to the main window.
Diffstat (limited to 'src/gui/menus/edition.c')
-rw-r--r-- | src/gui/menus/edition.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c index cdf8aa3..e1ef696 100644 --- a/src/gui/menus/edition.c +++ b/src/gui/menus/edition.c @@ -237,7 +237,8 @@ GtkWidget *build_menu_edition(GObject *ref, GMenuBar *bar) /****************************************************************************** * * -* Paramètres : new = nouvelle vue du contenu chargé analysé. * +* Paramètres : ref = espace de référencement global. * +* new = nouvelle vue du contenu chargé analysé. * * * * Description : Lance une actualisation du fait d'un changement de support. * * * @@ -247,14 +248,11 @@ GtkWidget *build_menu_edition(GObject *ref, GMenuBar *bar) * * ******************************************************************************/ -void update_access_for_view_in_menu_edition(GLoadedPanel *new) +void update_access_for_view_in_menu_edition(GObject *ref, GLoadedPanel *new) { - GObject *ref; /* Espace de référencements */ gboolean access; /* Accès à déterminer */ GtkWidget *item; /* Elément de menu à traiter */ - ref = get_global_ref(); - /* Déplacements ciblés */ access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new); @@ -325,7 +323,8 @@ void update_access_for_view_in_menu_edition(GLoadedPanel *new) /****************************************************************************** * * -* Paramètres : panel = vue d'affichage active ou NULL si aucune. * +* Paramètres : ref = espace de référencement global. * +* panel = vue d'affichage active ou NULL si aucune. * * cursor = suivi des positions à consulter. * * * * Description : Met à jour les accès du menu "Edition" selon une position. * @@ -336,15 +335,12 @@ void update_access_for_view_in_menu_edition(GLoadedPanel *new) * * ******************************************************************************/ -void update_access_for_cursor_in_menu_edition(GLoadedPanel *panel, const GLineCursor *cursor) +void update_access_for_cursor_in_menu_edition(GObject *ref, GLoadedPanel *panel, const GLineCursor *cursor) { - GObject *ref; /* Espace de référencements */ GObject *creator; /* Créateur à l'orgine du seg. */ gboolean access; /* Accès à déterminer */ GtkWidget *item; /* Elément de menu à traiter */ - ref = get_global_ref(); - /* Préliminaire */ /** @@ -420,14 +416,15 @@ void update_access_for_cursor_in_menu_edition(GLoadedPanel *panel, const GLineCu static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar) { - GObject *ref; /* Espace de référencements */ + GtkWindow *editor; /* Fenêtre graphique principale*/ GtkWidget *dialog; /* Boîte de dialogue à montrer */ vmpa2t *addr; /* Adresse de destination */ GLoadedPanel *panel; /* Afficheur effectif de code */ GLoadedBinary *binary; /* Binaire en cours d'édition */ - ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar)); - dialog = create_goto_dialog(GTK_WINDOW(ref)); + editor = get_editor_window(); + + dialog = create_goto_dialog(editor); if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { @@ -450,6 +447,8 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar) gtk_widget_destroy(dialog); + g_object_unref(G_OBJECT(editor)); + } @@ -616,7 +615,7 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) GLoadedBinary *binary; /* Représentation binaire */ GArchProcessor *proc; /* Processeur de l'architecture*/ GArchInstruction *instr; /* Point de croisements */ - GObject *ref; /* Espace de référencements */ + GtkWindow *editor; /* Fenêtre graphique principale*/ GtkWidget *dialog; /* Boîte de dialogue à montrer */ vmpa2t *dest; /* Adresse de destination */ @@ -642,9 +641,9 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) if (instr != NULL) { - ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar)); + editor = get_editor_window(); - dialog = create_gotox_dialog_for_cross_references(GTK_WINDOW(ref), binary, instr, true); + dialog = create_gotox_dialog_for_cross_references(editor, binary, instr, true); if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { @@ -658,6 +657,8 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) gtk_widget_destroy(dialog); + g_object_unref(G_OBJECT(editor)); + g_object_unref(G_OBJECT(instr)); } @@ -691,7 +692,7 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar) GLoadedBinary *binary; /* Binaire en cours d'étude */ GDbCollection *collec; /* Collection à manipuler */ GDbItem *exist; /* Sens du basculement courant */ - GObject *ref; /* Espace de référencements */ + GtkWindow *editor; /* Fenêtre graphique principale*/ GtkBuilder *builder; /* Constructeur utilisé */ GtkWidget *dialog; /* Boîte de dialogue à montrer */ GDbItem *bookmark; /* Nouveau signet défini */ @@ -727,9 +728,9 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar) else { - ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar)); + editor = get_editor_window(); - dialog = create_bookmark_dialog(GTK_WINDOW(ref), &builder); + dialog = create_bookmark_dialog(editor, &builder); ret = gtk_dialog_run(GTK_DIALOG(dialog)); @@ -745,6 +746,8 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar) g_object_unref(G_OBJECT(builder)); + g_object_unref(G_OBJECT(editor)); + } g_object_unref(G_OBJECT(collec)); |