diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-11-12 20:03:12 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-11-12 20:03:12 (GMT) |
commit | 771f21b9d5dd2b394359304a660418bbc84befda (patch) | |
tree | 60d6a9350d388f2db7ad571e6edddf46a99444f2 /src/gui/menus | |
parent | de62d34d2dc6135b42af7f8a103c8c7af09fd54f (diff) |
Defined a new interface for displaying loaded contents.
Diffstat (limited to 'src/gui/menus')
-rw-r--r-- | src/gui/menus/binary.c | 7 | ||||
-rw-r--r-- | src/gui/menus/edition.c | 35 | ||||
-rw-r--r-- | src/gui/menus/menubar.c | 2 | ||||
-rw-r--r-- | src/gui/menus/view.c | 2 |
4 files changed, 30 insertions, 16 deletions
diff --git a/src/gui/menus/binary.c b/src/gui/menus/binary.c index e67c377..b7be1b9 100644 --- a/src/gui/menus/binary.c +++ b/src/gui/menus/binary.c @@ -160,7 +160,7 @@ static void mcb_binary_entry_points(GtkMenuItem *menuitem, GMenuBar *bar) GLoadedBinary *binary; /* Binaire présenté à l'écran */ GtkWidget *dialog; /* Boîte de dialogue à montrer */ vmpa2t *addr; /* Adresse de destination */ - GtkDisplayPanel *panel; /* Afficheur effectif de code */ + GLoadedPanel *panel; /* Afficheur effectif de code */ item = G_EDITOR_ITEM(bar); @@ -174,7 +174,10 @@ static void mcb_binary_entry_points(GtkMenuItem *menuitem, GMenuBar *bar) addr = get_address_from_gotox_dialog(dialog); panel = get_current_view(); - gtk_display_panel_request_move(panel, addr); + + if (GTK_IS_DISPLAY_PANEL(panel)) + gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), addr); + g_object_unref(G_OBJECT(panel)); delete_vmpa(addr); diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c index 2491e3d..848d04c 100644 --- a/src/gui/menus/edition.c +++ b/src/gui/menus/edition.c @@ -313,7 +313,7 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar) GObject *ref; /* Espace de référencements */ GtkWidget *dialog; /* Boîte de dialogue à montrer */ vmpa2t *addr; /* Adresse de destination */ - GtkDisplayPanel *panel; /* Afficheur effectif de code */ + GLoadedPanel *panel; /* Afficheur effectif de code */ ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar)); dialog = create_goto_dialog(GTK_WINDOW(ref)); @@ -323,7 +323,10 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar) addr = get_address_from_goto_dialog(dialog); panel = get_current_view(); - gtk_display_panel_request_move(panel, addr); + + if (GTK_IS_DISPLAY_PANEL(panel)) + gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), addr); + g_object_unref(G_OBJECT(panel)); delete_vmpa(addr); @@ -351,7 +354,7 @@ static void mcb_edition_goto(GtkMenuItem *menuitem, GMenuBar *bar) static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, gpointer unused) { ImmOperandDisplay display; /* Type de basculement */ - GtkDisplayPanel *panel; /* Afficheur effectif de code */ + GLoadedPanel *panel; /* Afficheur effectif de code */ GBufferLine *line; /* Ligne de position courante */ GObject *creator; /* Créateur à l'orgine du seg. */ GDbSwitcher *switcher; /* Bascule à mettre en place */ @@ -364,7 +367,8 @@ static void mcb_edition_switch_numeric_operand(GtkMenuItem *menuitem, gpointer u panel = get_current_view(); - if (gtk_display_panel_get_position(panel, &line, &creator)) + if (GTK_IS_DISPLAY_PANEL(panel) + && gtk_display_panel_get_position(GTK_DISPLAY_PANEL(panel), &line, &creator)) { assert(G_IS_IMM_OPERAND(creator)); @@ -429,7 +433,7 @@ static void mcb_edition_go_back(GtkMenuItem *menuitem, GMenuBar *bar) static void mcb_edition_follow_ref(GtkMenuItem *menuitem, gpointer unused) { - GtkDisplayPanel *panel; /* Afficheur effectif de code */ + GLoadedPanel *panel; /* Afficheur effectif de code */ GBufferLine *line; /* Ligne de position courante */ GObject *creator; /* Créateur à l'orgine du seg. */ bool defined; /* Adresse définie ? */ @@ -438,7 +442,8 @@ static void mcb_edition_follow_ref(GtkMenuItem *menuitem, gpointer unused) panel = get_current_view(); - if (gtk_display_panel_get_position(panel, &line, &creator)) + if (GTK_IS_DISPLAY_PANEL(panel) + && gtk_display_panel_get_position(GTK_DISPLAY_PANEL(panel), &line, &creator)) { assert(creator != NULL); @@ -460,7 +465,7 @@ static void mcb_edition_follow_ref(GtkMenuItem *menuitem, gpointer unused) } if (defined) - gtk_display_panel_request_move(panel, &addr); + gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), &addr); g_object_unref(creator); g_object_unref(G_OBJECT(line)); @@ -487,7 +492,7 @@ static void mcb_edition_follow_ref(GtkMenuItem *menuitem, gpointer unused) static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) { - GtkDisplayPanel *panel; /* Afficheur effectif de code */ + GLoadedPanel *panel; /* Afficheur effectif de code */ GBufferLine *line; /* Ligne de position courante */ const mrange_t *range; /* Couverture en mémoire */ GLoadedBinary *binary; /* Représentation binaire */ @@ -499,7 +504,8 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) panel = get_current_view(); - if (gtk_display_panel_get_position(panel, &line, NULL)) + if (GTK_IS_DISPLAY_PANEL(panel) + && gtk_display_panel_get_position(GTK_DISPLAY_PANEL(panel), &line, NULL)) { range = g_buffer_line_get_range(line); @@ -524,7 +530,7 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) { addr = get_address_from_gotox_dialog(dialog); - gtk_display_panel_request_move(panel, addr); + gtk_display_panel_request_move(GTK_DISPLAY_PANEL(panel), addr); delete_vmpa(addr); @@ -562,7 +568,7 @@ static void mcb_edition_list_xrefs(GtkMenuItem *menuitem, GMenuBar *bar) static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar) { - GtkDisplayPanel *panel; /* Vue offrant l'affichage */ + GLoadedPanel *panel; /* Vue offrant l'affichage */ const vmpa2t *curloc; /* Localisation d'un curseur */ GLoadedBinary *binary; /* Binaire en cours d'étude */ GDbCollection *collec; /* Collection à manipuler */ @@ -576,7 +582,10 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar) panel = get_current_view(); - curloc = gtk_display_panel_get_caret_location(panel); + if (!GTK_IS_DISPLAY_PANEL(panel)) + goto done_with_panel; + + curloc = gtk_display_panel_get_caret_location(GTK_DISPLAY_PANEL(panel)); /* Accès à la collection */ @@ -638,6 +647,8 @@ static void mcb_edition_bookmarks_toggle(GtkMenuItem *menuitem, GMenuBar *bar) g_object_unref(G_OBJECT(collec)); g_object_unref(G_OBJECT(binary)); + done_with_panel: + g_object_unref(G_OBJECT(panel)); } diff --git a/src/gui/menus/menubar.c b/src/gui/menus/menubar.c index 56540e9..32a8f20 100644 --- a/src/gui/menus/menubar.c +++ b/src/gui/menus/menubar.c @@ -295,7 +295,7 @@ static void update_menu_bar_for_view(GMenuBar *bar, GtkDisplayPanel *panel) /****************************************************************************** * * -* Paramètres : bar = barre de menus à actualiser. * +* Paramètres : bar = barre de menus à actualiser. * * panel = composant d'affichage concerné par l'opération. * * * * Description : Réagit à un changement de focus des panneaux d'affichage. * diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c index 5298af3..4298805 100644 --- a/src/gui/menus/view.c +++ b/src/gui/menus/view.c @@ -494,7 +494,7 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, gpointer unused) gtk_dock_panel_change_active_widget(station, scroll); - change_editor_items_current_view(new); + change_editor_items_current_view(G_LOADED_PANEL(new)); g_object_unref(G_OBJECT(panel)); |