summaryrefslogtreecommitdiff
path: root/src/gui/menus
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/menus')
-rw-r--r--src/gui/menus/Makefile.am1
-rw-r--r--src/gui/menus/binary.c190
-rw-r--r--src/gui/menus/binary.h10
-rw-r--r--src/gui/menus/debug.c92
-rw-r--r--src/gui/menus/debug.h4
-rw-r--r--src/gui/menus/edition.c493
-rw-r--r--src/gui/menus/edition.h9
-rw-r--r--src/gui/menus/file.c59
-rw-r--r--src/gui/menus/file.h4
-rw-r--r--src/gui/menus/help.c39
-rw-r--r--src/gui/menus/help.h4
-rw-r--r--src/gui/menus/options.c31
-rw-r--r--src/gui/menus/options.h7
-rw-r--r--src/gui/menus/plugins.c63
-rw-r--r--src/gui/menus/plugins.h38
-rw-r--r--src/gui/menus/project.c173
-rw-r--r--src/gui/menus/project.h7
-rw-r--r--src/gui/menus/view.c841
-rw-r--r--src/gui/menus/view.h16
19 files changed, 843 insertions, 1238 deletions
diff --git a/src/gui/menus/Makefile.am b/src/gui/menus/Makefile.am
index 4218374..02ed19f 100644
--- a/src/gui/menus/Makefile.am
+++ b/src/gui/menus/Makefile.am
@@ -8,7 +8,6 @@ libguimenus_la_SOURCES = \
file.h file.c \
help.h help.c \
options.h options.c \
- plugins.h plugins.c \
project.h project.c \
view.h view.c
diff --git a/src/gui/menus/binary.c b/src/gui/menus/binary.c
index 9e85520..98563a0 100644
--- a/src/gui/menus/binary.c
+++ b/src/gui/menus/binary.c
@@ -30,6 +30,7 @@
#include "../agroup.h"
#include "../item-int.h"
+#include "../menubar.h"
#include "../core/global.h"
#include "../dialogs/export_disass.h"
#include "../dialogs/export_graph.h"
@@ -64,88 +65,9 @@ static void mcb_binary_export_graph(GtkMenuItem *, gpointer);
/******************************************************************************
* *
-* Paramètres : ref = espace de référencement global. *
-* bar = barre de menu parente. *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
* *
-* Description : Construit le menu "Binaire". *
-* *
-* Retour : Panneau de menus mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GtkWidget *build_menu_binary(GObject *ref, GMenuBar *bar)
-{
- GtkWidget *result; /* Support à retourner */
- GtkWidget *menubar; /* Support pour éléments */
- GtkWidget *submenuitem; /* Sous-élément de menu #1 */
- GtkWidget *deepmenubar; /* Support pour éléments #2 */
- GtkWidget *deepmenuitem; /* Sous-élément de menu #2 */
-
- result = gtk_menu_item_new_with_mnemonic(_("_Binary"));
- gtk_widget_show(result);
-
- menubar = qck_create_menu(GTK_MENU_ITEM(result));
-
- submenuitem = qck_create_menu_item(ref, "mnu_binary_epoints", _("Entry points"),
- G_CALLBACK(mcb_binary_entry_points), bar);
- add_accelerator_to_widget(submenuitem, "<Ctrl>E");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_binary_attach_debugger", _("Attach a debugger"),
- G_CALLBACK(mcb_binary_attach_debugger), bar);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Séparation */
-
- submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Bases de données */
-
- submenuitem = qck_create_menu_item(ref, "mnu_binary_storage", _("Storage"),
- G_CALLBACK(mcb_binary_storage), bar);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_binary_snapshots", _("Snapshots"),
- G_CALLBACK(mcb_binary_snapshots), bar);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Séparation */
-
- submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Exportations */
-
- submenuitem = qck_create_menu_item(NULL, NULL, _("Export"), NULL, NULL);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- deepmenubar = qck_create_menu(GTK_MENU_ITEM(submenuitem));
-
- deepmenuitem = qck_create_menu_item(ref, "mnu_binary_export_disass", _("Disassembly"),
- G_CALLBACK(mcb_binary_export_disass), bar);
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- deepmenuitem = qck_create_menu_item(ref, "mnu_binary_export_graph", _("Graph view"),
- G_CALLBACK(mcb_binary_export_graph), NULL);
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : ref = espace de référencement global. *
-* new = nouveau contenu chargé à analyser. *
-* *
-* Description : Réagit à un changement d'affichage principal de contenu. *
+* Description : Complète la définition du menu "Binaire". *
* *
* Retour : - *
* *
@@ -153,47 +75,19 @@ GtkWidget *build_menu_binary(GObject *ref, GMenuBar *bar)
* *
******************************************************************************/
-void update_access_for_content_in_menu_binary(GObject *ref, GLoadedContent *new)
+void setup_menu_binary_callbacks(GtkBuilder *builder)
{
- gboolean access; /* Accès à déterminer */
- GtkWidget *item; /* Elément de menu à traiter */
- access = G_IS_LOADED_BINARY(new);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_binary_epoints"));
- gtk_widget_set_sensitive(item, access);
+#define DEFINE_CALLBACK(cb) #cb, G_CALLBACK(cb)
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_binary_storage"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_binary_export_disass"));
- gtk_widget_set_sensitive(item, access);
-
-}
-
-
-/******************************************************************************
-* *
-* 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. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void update_access_for_view_in_menu_binary(GObject *ref, GLoadedPanel *new)
-{
- gboolean access; /* Accès à déterminer */
- GtkWidget *item; /* Elément de menu à traiter */
-
- access = GTK_IS_GRAPH_DISPLAY(new);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_binary_export_graph"));
- gtk_widget_set_sensitive(item, access);
+ gtk_builder_add_callback_symbols(builder,
+ DEFINE_CALLBACK(mcb_binary_entry_points),
+ DEFINE_CALLBACK(mcb_binary_attach_debugger),
+ DEFINE_CALLBACK(mcb_binary_storage),
+ DEFINE_CALLBACK(mcb_binary_snapshots),
+ DEFINE_CALLBACK(mcb_binary_export_disass),
+ DEFINE_CALLBACK(mcb_binary_export_graph),
+ NULL);
}
@@ -415,3 +309,61 @@ static void mcb_binary_export_graph(GtkMenuItem *menuitem, gpointer unused)
g_object_unref(G_OBJECT(binary));
}
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
+* new = nouveau contenu chargé à analyser. *
+* *
+* Description : Réagit à un changement d'affichage principal de contenu. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void update_access_for_content_in_menu_binary(GtkBuilder *builder, GLoadedContent *new)
+{
+ gboolean access; /* Accès à déterminer */
+ GtkWidget *item; /* Elément de menu à traiter */
+
+ access = G_IS_LOADED_BINARY(new);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "binary_entry_points"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "binary_storage"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "binary_export_disass"));
+ gtk_widget_set_sensitive(item, access);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
+* new = nouvelle vue du contenu chargé analysé. *
+* *
+* Description : Lance une actualisation du fait d'un changement de support. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void update_access_for_view_in_menu_binary(GtkBuilder *builder, GLoadedPanel *new)
+{
+ gboolean access; /* Accès à déterminer */
+ GtkWidget *item; /* Elément de menu à traiter */
+
+ access = GTK_IS_GRAPH_DISPLAY(new);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "binary_export_graph"));
+ gtk_widget_set_sensitive(item, access);
+
+}
diff --git a/src/gui/menus/binary.h b/src/gui/menus/binary.h
index 056b918..86a68ba 100644
--- a/src/gui/menus/binary.h
+++ b/src/gui/menus/binary.h
@@ -29,19 +29,19 @@
#include <gtk/gtk.h>
-#include "../menubar.h"
#include "../../analysis/loaded.h"
+#include "../../glibext/gloadedpanel.h"
-/* Construit le menu "Binaire". */
-GtkWidget *build_menu_binary(GObject *, GMenuBar *);
+/* Complète la définition du menu "Binaire". */
+void setup_menu_binary_callbacks(GtkBuilder *);
/* Réagit à un changement d'affichage principal de contenu. */
-void update_access_for_content_in_menu_binary(GObject *, GLoadedContent *);
+void update_access_for_content_in_menu_binary(GtkBuilder *, GLoadedContent *);
/* Lance une actualisation du fait d'un changement de support. */
-void update_access_for_view_in_menu_binary(GObject *, GLoadedPanel *);
+void update_access_for_view_in_menu_binary(GtkBuilder *, GLoadedPanel *);
diff --git a/src/gui/menus/debug.c b/src/gui/menus/debug.c
index 74844e2..bfa9229 100644
--- a/src/gui/menus/debug.c
+++ b/src/gui/menus/debug.c
@@ -73,86 +73,34 @@ static void mcb_debug_options(GtkMenuItem *, GObject *);
/******************************************************************************
* *
-* Paramètres : ref = espace de référencement global. *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
* *
-* Description : Construit le menu "Aide". *
+* Description : Complète la définition du menu "Débogage". *
* *
-* Retour : Panneau de menus mis en place. *
+* Retour : - *
* *
* Remarques : - *
* *
******************************************************************************/
-GtkWidget *build_menu_debug(GObject *ref)
+void setup_menu_debug_callbacks(GtkBuilder *builder)
{
- GtkWidget *result; /* Support à retourner */
- GtkWidget *menubar; /* Support pour éléments */
- GtkWidget *submenuitem; /* Sous-élément de menu */
-
- result = gtk_menu_item_new_with_mnemonic(_("_Debug"));
- gtk_widget_show(result);
-
- menubar = qck_create_menu(GTK_MENU_ITEM(result));
-
- submenuitem = qck_create_menu_item(ref, "mnu_debug_continue", _("Continue"),
- G_CALLBACK(mcb_debug_continue), ref);
- add_accelerator_to_widget(submenuitem, "F9");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_debug_continue_to", _("Continue to selection"),
- G_CALLBACK(mcb_debug_continue_to), ref);
- add_accelerator_to_widget(submenuitem, "<Alt>F9");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_debug_pause", _("Pause"),
- G_CALLBACK(mcb_debug_pause), ref);
- add_accelerator_to_widget(submenuitem, "F10");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_debug_restart", _("Restart"),
- G_CALLBACK(mcb_debug_restart), ref);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_debug_close", _("Close"),
- G_CALLBACK(mcb_debug_close), ref);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_debug_step_into", _("Step into"),
- G_CALLBACK(mcb_debug_step_into), ref);
- add_accelerator_to_widget(submenuitem, "F7");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_debug_step_over", _("Step over"),
- G_CALLBACK(mcb_debug_step_over), ref);
- add_accelerator_to_widget(submenuitem, "<Alt>F7");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_debug_basic", _("Visit basic blocks into"),
- G_CALLBACK(mcb_debug_visit_blocks_into), ref);
- add_accelerator_to_widget(submenuitem, "F8");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_debug_basic", _("Visit basic blocks over"),
- G_CALLBACK(mcb_debug_visit_blocks_over), ref);
- add_accelerator_to_widget(submenuitem, "<Alt>F8");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_debug_return", _("Continue until return"),
- G_CALLBACK(mcb_debug_return), ref);
- add_accelerator_to_widget(submenuitem, "F12");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_debug_options", _("Debugging options..."),
- G_CALLBACK(mcb_debug_options), ref);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- return result;
+
+#define DEFINE_CALLBACK(cb) #cb, G_CALLBACK(cb)
+
+ gtk_builder_add_callback_symbols(builder,
+ DEFINE_CALLBACK(mcb_debug_continue),
+ DEFINE_CALLBACK(mcb_debug_continue_to),
+ DEFINE_CALLBACK(mcb_debug_pause),
+ DEFINE_CALLBACK(mcb_debug_restart),
+ DEFINE_CALLBACK(mcb_debug_close),
+ DEFINE_CALLBACK(mcb_debug_step_into),
+ DEFINE_CALLBACK(mcb_debug_step_over),
+ DEFINE_CALLBACK(mcb_debug_visit_blocks_into),
+ DEFINE_CALLBACK(mcb_debug_visit_blocks_over),
+ DEFINE_CALLBACK(mcb_debug_return),
+ DEFINE_CALLBACK(mcb_debug_options),
+ NULL);
}
diff --git a/src/gui/menus/debug.h b/src/gui/menus/debug.h
index aac8da9..4107bc1 100644
--- a/src/gui/menus/debug.h
+++ b/src/gui/menus/debug.h
@@ -30,8 +30,8 @@
-/* Construit le menu "Aide". */
-GtkWidget *build_menu_debug(GObject *);
+/* Complète la définition du menu "Débogage". */
+void setup_menu_debug_callbacks(GtkBuilder *);
diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c
index cebb733..f18e4e4 100644
--- a/src/gui/menus/edition.c
+++ b/src/gui/menus/edition.c
@@ -32,6 +32,7 @@
#include "../agroup.h"
+#include "../menubar.h"
#include "../core/global.h"
#include "../dialogs/bookmark.h"
#include "../dialogs/goto.h"
@@ -85,162 +86,9 @@ static void mcb_edition_comment_enter_next(GtkMenuItem *, GMenuBar *);
/******************************************************************************
* *
-* Paramètres : ref = espace de référencement global. *
-* bar = barre de menu parente. *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
* *
-* Description : Construit le menu "Edition". *
-* *
-* Retour : Panneau de menus mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GtkWidget *build_menu_edition(GObject *ref, GMenuBar *bar)
-{
- GtkWidget *result; /* Support à retourner */
- GtkWidget *menubar; /* Support pour éléments */
- GtkWidget *submenuitem; /* Sous-élément de menu #1 */
- GtkWidget *deepmenubar; /* Support pour éléments #2 */
- GtkWidget *deepmenuitem; /* Sous-élément de menu #2 */
-
- result = gtk_menu_item_new_with_mnemonic(_("_Edition"));
- gtk_widget_show(result);
-
- menubar = qck_create_menu(GTK_MENU_ITEM(result));
-
- /* Déplacements ciblés */
-
- submenuitem = qck_create_menu_item(ref, "mnu_edit_goto", _("Go to address..."),
- G_CALLBACK(mcb_edition_goto), bar);
- add_accelerator_to_widget(submenuitem, "<Ctrl>G");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Séparation */
-
- submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Bascule des opérandes numériques */
-
- submenuitem = qck_create_menu_item(NULL, NULL, _("Numeric operand"), NULL, NULL);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- deepmenubar = qck_create_menu(GTK_MENU_ITEM(submenuitem));
-
- deepmenuitem = qck_create_menu_item(ref, "mnu_edit_switch_hex", _("Hexadecimal"),
- G_CALLBACK(mcb_edition_switch_numeric_operand), NULL);
- add_accelerator_to_widget(deepmenuitem, "H");
- g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IOD_HEX));
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- deepmenuitem = qck_create_menu_item(ref, "mnu_edit_switch_dec", _("Decimal"),
- G_CALLBACK(mcb_edition_switch_numeric_operand), NULL);
- add_accelerator_to_widget(deepmenuitem, "D");
- g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IOD_DEC));
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- deepmenuitem = qck_create_menu_item(ref, "mnu_edit_switch_oct", _("Octal"),
- G_CALLBACK(mcb_edition_switch_numeric_operand), NULL);
- add_accelerator_to_widget(deepmenuitem, "O");
- g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IOD_OCT));
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- deepmenuitem = qck_create_menu_item(ref, "mnu_edit_switch_bin", _("Binary"),
- G_CALLBACK(mcb_edition_switch_numeric_operand), NULL);
- add_accelerator_to_widget(deepmenuitem, "B");
- g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IOD_BIN));
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- deepmenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- deepmenuitem = qck_create_menu_item(ref, "mnu_edit_switch_def", _("Default"),
- G_CALLBACK(mcb_edition_switch_numeric_operand), NULL);
- g_object_set_data(G_OBJECT(deepmenuitem), "kind_of_switch", GUINT_TO_POINTER(IOD_COUNT));
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- /* Séparation */
-
- submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Suivi de cibles */
-
- submenuitem = qck_create_menu_item(ref, "mnu_edit_go_back", _("Go back"),
- G_CALLBACK(mcb_edition_go_back), bar);
- add_accelerator_to_widget(submenuitem, "Escape");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_edit_follow_ref", _("Follow the reference"),
- G_CALLBACK(mcb_edition_follow_ref), NULL);
- add_accelerator_to_widget(submenuitem, "Return");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_edit_list_xrefs", _("List all references leading to..."),
- G_CALLBACK(mcb_edition_list_xrefs), bar);
- add_accelerator_to_widget(submenuitem, "X");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Séparation */
-
- submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Signets */
-
- submenuitem = qck_create_menu_item(NULL, NULL, _("Bookmarks"), NULL, NULL);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- deepmenubar = qck_create_menu(GTK_MENU_ITEM(submenuitem));
-
- deepmenuitem = qck_create_menu_item(ref, "mnu_edit_toggle_bmark", _("Toggle at current location"),
- G_CALLBACK(mcb_edition_bookmarks_toggle), bar);
- add_accelerator_to_widget(deepmenuitem, "<Ctrl>D");
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- deepmenuitem = qck_create_menu_item(ref, "mnu_edit_delete_bmarks", _("Delete all bookmarks"),
- G_CALLBACK(mcb_edition_bookmarks_delete_all), bar);
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- /* Commentaires */
-
- submenuitem = qck_create_menu_item(NULL, NULL, _("Comments"), NULL, NULL);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- deepmenubar = qck_create_menu(GTK_MENU_ITEM(submenuitem));
-
- deepmenuitem = qck_create_menu_item(ref, "mnu_edit_enter_comment", _("Enter a comment..."),
- G_CALLBACK(mcb_edition_comment_enter), bar);
- add_accelerator_to_widget(deepmenuitem, "semicolon");
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- deepmenuitem = qck_create_menu_item(ref, "mnu_edit_enter_rep_comment", _("Enter a repeatable comment..."),
- G_CALLBACK(mcb_edition_comment_enter_repeatable), bar);
- add_accelerator_to_widget(deepmenuitem, "colon");
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- deepmenuitem = qck_create_menu_item(ref, "mnu_edit_enter_prev", _("Enter a comment in the previous line..."),
- G_CALLBACK(mcb_edition_comment_enter_previous), bar);
- add_accelerator_to_widget(deepmenuitem, "Insert");
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- deepmenuitem = qck_create_menu_item(ref, "mnu_edit_enter_next", _("Enter a comment in the next line..."),
- G_CALLBACK(mcb_edition_comment_enter_next), bar);
- add_accelerator_to_widget(deepmenuitem, "<Shift>Insert");
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* 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. *
+* Description : Complète la définition du menu "Edition". *
* *
* Retour : - *
* *
@@ -248,155 +96,42 @@ GtkWidget *build_menu_edition(GObject *ref, GMenuBar *bar)
* *
******************************************************************************/
-void update_access_for_view_in_menu_edition(GObject *ref, GLoadedPanel *new)
+void setup_menu_edition_callbacks(GtkBuilder *builder)
{
- gboolean access; /* Accès à déterminer */
- GtkWidget *item; /* Elément de menu à traiter */
-
- /* Déplacements ciblés */
-
- access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_goto"));
- gtk_widget_set_sensitive(item, access);
+ GObject *item; /* Elément à compléter */
+
+#define DEFINE_CALLBACK(cb) #cb, G_CALLBACK(cb)
+
+ gtk_builder_add_callback_symbols(builder,
+ DEFINE_CALLBACK(mcb_edition_goto),
+ DEFINE_CALLBACK(mcb_edition_switch_numeric_operand),
+ DEFINE_CALLBACK(mcb_edition_go_back),
+ DEFINE_CALLBACK(mcb_edition_follow_ref),
+ DEFINE_CALLBACK(mcb_edition_list_xrefs),
+ DEFINE_CALLBACK(mcb_edition_bookmarks_toggle),
+ DEFINE_CALLBACK(mcb_edition_bookmarks_delete_all),
+ DEFINE_CALLBACK(mcb_edition_comment_enter),
+ DEFINE_CALLBACK(mcb_edition_comment_enter_repeatable),
+ DEFINE_CALLBACK(mcb_edition_comment_enter_previous),
+ DEFINE_CALLBACK(mcb_edition_comment_enter_next),
+ NULL);
/* Bascule des opérandes numériques */
- access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_hex"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_dec"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_oct"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_bin"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_def"));
- gtk_widget_set_sensitive(item, access);
-
- /* Suivi de cibles */
-
- access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_go_back"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_follow_ref"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_list_xrefs"));
- gtk_widget_set_sensitive(item, access);
-
- /* Signets */
-
- access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_toggle_bmark"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_delete_bmarks"));
- gtk_widget_set_sensitive(item, access);
+ item = gtk_builder_get_object(builder, "edition_switch_hex");
+ g_object_set_data(item, "kind_of_switch", GUINT_TO_POINTER(IOD_HEX));
- /* Commentaires */
+ item = gtk_builder_get_object(builder, "edition_switch_dec");
+ g_object_set_data(item, "kind_of_switch", GUINT_TO_POINTER(IOD_DEC));
- access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
+ item = gtk_builder_get_object(builder, "edition_switch_oct");
+ g_object_set_data(item, "kind_of_switch", GUINT_TO_POINTER(IOD_OCT));
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_enter_comment"));
- gtk_widget_set_sensitive(item, access);
+ item = gtk_builder_get_object(builder, "edition_switch_bin");
+ g_object_set_data(item, "kind_of_switch", GUINT_TO_POINTER(IOD_BIN));
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_enter_rep_comment"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_enter_prev"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_enter_next"));
- gtk_widget_set_sensitive(item, access);
-
-}
-
-
-/******************************************************************************
-* *
-* 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. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void update_access_for_cursor_in_menu_edition(GObject *ref, GLoadedPanel *panel, const GLineCursor *cursor)
-{
- GObject *creator; /* Créateur à l'orgine du seg. */
- gboolean access; /* Accès à déterminer */
- GtkWidget *item; /* Elément de menu à traiter */
-
- /* Préliminaire */
-
- /**
- * Seuls les affichages de blocs (en graphique ou non) distribuent ce
- * genre de curseur. Donc on valide dans le même temps la nature de la vue.
- */
-
- if (G_IS_BINARY_CURSOR(cursor))
- {
- assert(GTK_IS_HEX_DISPLAY(panel) || GTK_IS_BLOCK_DISPLAY(panel) || GTK_IS_GRAPH_DISPLAY(panel));
-
- if (g_line_cursor_is_valid(cursor))
- creator = gtk_display_panel_get_active_object(GTK_DISPLAY_PANEL(panel));
- else
- creator = NULL;
-
- }
-
- else
- creator = NULL;
-
- /* Bascule des opérandes numériques */
-
- access = G_IS_IMM_OPERAND(creator);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_hex"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_dec"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_oct"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_bin"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_switch_def"));
- gtk_widget_set_sensitive(item, access);
-
- /* Suivi de cibles */
-
- access = G_IS_TARGETABLE_OPERAND(creator);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_follow_ref"));
- gtk_widget_set_sensitive(item, access);
-
- access = g_line_cursor_is_valid(cursor);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_edit_list_xrefs"));
- gtk_widget_set_sensitive(item, access);
-
- /* Nettoyage et sortie finale */
-
- if (creator != NULL)
- g_object_unref(G_OBJECT(creator));
+ item = gtk_builder_get_object(builder, "edition_switch_def");
+ g_object_set_data(item, "kind_of_switch", GUINT_TO_POINTER(IOD_COUNT));
}
@@ -851,3 +586,169 @@ static void mcb_edition_comment_enter_next(GtkMenuItem *menuitem, GMenuBar *bar)
{
}
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
+* new = nouvelle vue du contenu chargé analysé. *
+* *
+* Description : Lance une actualisation du fait d'un changement de support. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void update_access_for_view_in_menu_edition(GtkBuilder *builder, GLoadedPanel *new)
+{
+ gboolean access; /* Accès à déterminer */
+ GtkWidget *item; /* Elément de menu à traiter */
+
+ /* Déplacements ciblés */
+
+ access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_goto"));
+ gtk_widget_set_sensitive(item, access);
+
+ /* Bascule des opérandes numériques */
+
+ access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_switch_hex"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_switch_dec"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_switch_oct"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_switch_bin"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_switch_def"));
+ gtk_widget_set_sensitive(item, access);
+
+ /* Suivi de cibles */
+
+ access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_go_back"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_follow_ref"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_list_xrefs"));
+ gtk_widget_set_sensitive(item, access);
+
+ /* Signets */
+
+ access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_bookmarks_toggle"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_bookmarks_delete_all"));
+ gtk_widget_set_sensitive(item, access);
+
+ /* Commentaires */
+
+ access = GTK_IS_BLOCK_DISPLAY(new) || GTK_IS_GRAPH_DISPLAY(new);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_comment_enter"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_comment_enter_rep"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_comment_enter_prev"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_comment_enter_next"));
+ gtk_widget_set_sensitive(item, access);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
+* 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. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void update_access_for_cursor_in_menu_edition(GtkBuilder *builder, GLoadedPanel *panel, const GLineCursor *cursor)
+{
+ GObject *creator; /* Créateur à l'orgine du seg. */
+ gboolean access; /* Accès à déterminer */
+ GtkWidget *item; /* Elément de menu à traiter */
+
+ /* Préliminaire */
+
+ /**
+ * Seuls les affichages de blocs (en graphique ou non) distribuent ce
+ * genre de curseur. Donc on valide dans le même temps la nature de la vue.
+ */
+
+ if (G_IS_BINARY_CURSOR(cursor))
+ {
+ assert(GTK_IS_HEX_DISPLAY(panel) || GTK_IS_BLOCK_DISPLAY(panel) || GTK_IS_GRAPH_DISPLAY(panel));
+
+ if (g_line_cursor_is_valid(cursor))
+ creator = gtk_display_panel_get_active_object(GTK_DISPLAY_PANEL(panel));
+ else
+ creator = NULL;
+
+ }
+
+ else
+ creator = NULL;
+
+ /* Bascule des opérandes numériques */
+
+ access = G_IS_IMM_OPERAND(creator);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_switch_hex"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_switch_dec"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_switch_oct"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_switch_bin"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_switch_def"));
+ gtk_widget_set_sensitive(item, access);
+
+ /* Suivi de cibles */
+
+ access = G_IS_TARGETABLE_OPERAND(creator);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_follow_ref"));
+ gtk_widget_set_sensitive(item, access);
+
+ access = g_line_cursor_is_valid(cursor);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "edition_list_xrefs"));
+ gtk_widget_set_sensitive(item, access);
+
+ /* Nettoyage et sortie finale */
+
+ if (creator != NULL)
+ g_object_unref(G_OBJECT(creator));
+
+}
diff --git a/src/gui/menus/edition.h b/src/gui/menus/edition.h
index 909d5ec..d87bff6 100644
--- a/src/gui/menus/edition.h
+++ b/src/gui/menus/edition.h
@@ -29,19 +29,18 @@
#include <gtk/gtk.h>
-#include "../menubar.h"
#include "../../glibext/gloadedpanel.h"
-/* Construit le menu "Edition". */
-GtkWidget *build_menu_edition(GObject *, GMenuBar *);
+/* Complète la définition du menu "Edition". */
+void setup_menu_edition_callbacks(GtkBuilder *);
/* Lance une actualisation du fait d'un changement de support. */
-void update_access_for_view_in_menu_edition(GObject *, GLoadedPanel *);
+void update_access_for_view_in_menu_edition(GtkBuilder *, GLoadedPanel *);
/* Met à jour les accès du menu "Edition" selon une position. */
-void update_access_for_cursor_in_menu_edition(GObject *, GLoadedPanel *, const GLineCursor *);
+void update_access_for_cursor_in_menu_edition(GtkBuilder *, GLoadedPanel *, const GLineCursor *);
diff --git a/src/gui/menus/file.c b/src/gui/menus/file.c
index 62b8381..b7c8dc8 100644
--- a/src/gui/menus/file.c
+++ b/src/gui/menus/file.c
@@ -52,41 +52,37 @@ static void mcb_file_quit(GtkMenuItem *, gpointer);
/******************************************************************************
* *
-* Paramètres : - *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
* *
-* Description : Construit le menu "Fichier". *
+* Description : Complète la définition du menu "Fichier". *
* *
-* Retour : Panneau de menus mis en place. *
+* Retour : - *
* *
* Remarques : - *
* *
******************************************************************************/
-GtkWidget *build_menu_file(void)
+void setup_menu_file_callbacks(GtkBuilder *builder)
{
+
+#define DEFINE_CALLBACK(cb) #cb, G_CALLBACK(cb)
+
+ gtk_builder_add_callback_symbols(builder,
+ DEFINE_CALLBACK(mcb_file_new_project),
+ DEFINE_CALLBACK(mcb_file_open_project),
+ DEFINE_CALLBACK(mcb_file_save_project),
+ DEFINE_CALLBACK(mcb_file_save_project_as),
+ DEFINE_CALLBACK(mcb_file_quit),
+ NULL);
+
+
+#if 0
GtkWidget *result; /* Support à retourner */
GtkWidget *menubar; /* Support pour éléments */
GtkWidget *submenuitem; /* Sous-élément de menu #1 */
GtkWidget *deepmenuitem; /* Sous-élément de menu #2 */
GtkRecentFilter *filter; /* Filtre gardant les projets */
- result = gtk_menu_item_new_with_mnemonic(_("_File"));
- gtk_widget_show(result);
-
- menubar = qck_create_menu(GTK_MENU_ITEM(result));
-
- submenuitem = qck_create_menu_item(NULL, NULL, _("New project"),
- G_CALLBACK(mcb_file_new_project), NULL);
- add_accelerator_to_widget(submenuitem, "<Ctrl>N");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(NULL, NULL, _("Open project"),
- G_CALLBACK(mcb_file_open_project), NULL);
- add_accelerator_to_widget(submenuitem, "<Ctrl>O");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
submenuitem = qck_create_menu_item(NULL, NULL, _("Recent projects..."), NULL, NULL);
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
@@ -100,27 +96,8 @@ GtkWidget *build_menu_file(void)
filter = gtk_recent_filter_new();
gtk_recent_filter_add_mime_type(filter, "application/chrysalide.project");
gtk_recent_chooser_add_filter(GTK_RECENT_CHOOSER(deepmenuitem), filter);
+#endif
- submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(NULL, NULL, _("Save project"),
- G_CALLBACK(mcb_file_save_project), NULL);
- add_accelerator_to_widget(submenuitem, "<Ctrl>S");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(NULL, NULL, _("Save project as..."),
- G_CALLBACK(mcb_file_save_project_as), NULL);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(NULL, NULL, _("Quit"), G_CALLBACK(mcb_file_quit), NULL);
- add_accelerator_to_widget(submenuitem, "<Ctrl>Q");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- return result;
}
diff --git a/src/gui/menus/file.h b/src/gui/menus/file.h
index 7b98a93..c939067 100644
--- a/src/gui/menus/file.h
+++ b/src/gui/menus/file.h
@@ -30,8 +30,8 @@
-/* Construit le menu "Fichier". */
-GtkWidget *build_menu_file(void);
+/* Complète la définition du menu "Fichier". */
+void setup_menu_file_callbacks(GtkBuilder *);
/* Réagit au menu "Fichier -> Enregistrer le projet". */
void mcb_file_save_project(GtkMenuItem *, gpointer);
diff --git a/src/gui/menus/help.c b/src/gui/menus/help.c
index c265703..655c68e 100644
--- a/src/gui/menus/help.c
+++ b/src/gui/menus/help.c
@@ -50,44 +50,27 @@ static void mcb_help_about(GtkMenuItem *, gpointer);
/******************************************************************************
* *
-* Paramètres : - *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
* *
-* Description : Construit le menu "Aide". *
+* Description : Complète la définition du menu "Aide". *
* *
-* Retour : Panneau de menus mis en place. *
+* Retour : - *
* *
* Remarques : - *
* *
******************************************************************************/
-GtkWidget *build_menu_help(void)
+void setup_menu_help_callbacks(GtkBuilder *builder)
{
- GtkWidget *result; /* Support à retourner */
- GtkWidget *menubar; /* Support pour éléments */
- GtkWidget *submenuitem; /* Sous-élément de menu */
-
- result = gtk_menu_item_new_with_mnemonic(_("_Help"));
- gtk_widget_show(result);
-
- menubar = qck_create_menu(GTK_MENU_ITEM(result));
-
- submenuitem = qck_create_menu_item(NULL, NULL, _("Website"), G_CALLBACK(mcb_help_website), NULL);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(NULL, NULL, _("Python API documentation"),
- G_CALLBACK(mcb_help_python_api_documentation), NULL);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(NULL, NULL, _("Bug report"), G_CALLBACK(mcb_help_bug_report), NULL);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
- submenuitem = qck_create_menu_item(NULL, NULL, _("About"), G_CALLBACK(mcb_help_about), NULL);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+#define DEFINE_CALLBACK(cb) #cb, G_CALLBACK(cb)
- return result;
+ gtk_builder_add_callback_symbols(builder,
+ DEFINE_CALLBACK(mcb_help_website),
+ DEFINE_CALLBACK(mcb_help_python_api_documentation),
+ DEFINE_CALLBACK(mcb_help_bug_report),
+ DEFINE_CALLBACK(mcb_help_about),
+ NULL);
}
diff --git a/src/gui/menus/help.h b/src/gui/menus/help.h
index 1deeb5a..b8816a4 100644
--- a/src/gui/menus/help.h
+++ b/src/gui/menus/help.h
@@ -30,8 +30,8 @@
-/* Construit le menu "Aide". */
-GtkWidget *build_menu_help(void);
+/* Complète la définition du menu "Aide". */
+void setup_menu_help_callbacks(GtkBuilder *);
diff --git a/src/gui/menus/options.c b/src/gui/menus/options.c
index 62f58f5..03f5259 100644
--- a/src/gui/menus/options.c
+++ b/src/gui/menus/options.c
@@ -29,6 +29,7 @@
#include "../item-int.h"
+#include "../menubar.h"
#include "../core/global.h"
#include "../dialogs/identity.h"
#include "../dialogs/preferences.h"
@@ -46,37 +47,25 @@ static void mcb_options_identity(GtkMenuItem *, gpointer);
/******************************************************************************
* *
-* Paramètres : ref = espace de référencement global. *
-* bar = barre de menu parente. *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
* *
-* Description : Construit le menu "Options". *
+* Description : Complète la définition du menu "Options". *
* *
-* Retour : Panneau de menus mis en place. *
+* Retour : - *
* *
* Remarques : - *
* *
******************************************************************************/
-GtkWidget *build_menu_options(GObject *ref, GMenuBar *bar)
+void setup_menu_options_callbacks(GtkBuilder *builder)
{
- GtkWidget *result; /* Support à retourner */
- GtkWidget *menubar; /* Support pour éléments */
- GtkWidget *submenuitem; /* Sous-élément de menu */
-
- result = gtk_menu_item_new_with_mnemonic(_("_Options"));
- gtk_widget_show(result);
-
- menubar = qck_create_menu(GTK_MENU_ITEM(result));
-
- submenuitem = qck_create_menu_item(ref, "mnu_options_preferences", _("Preferences"),
- G_CALLBACK(mcb_options_preferences), NULL);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
- submenuitem = qck_create_menu_item(ref, "mnu_options_identity", _("Identity"),
- G_CALLBACK(mcb_options_identity), NULL);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+#define DEFINE_CALLBACK(cb) #cb, G_CALLBACK(cb)
- return result;
+ gtk_builder_add_callback_symbols(builder,
+ DEFINE_CALLBACK(mcb_options_preferences),
+ DEFINE_CALLBACK(mcb_options_identity),
+ NULL);
}
diff --git a/src/gui/menus/options.h b/src/gui/menus/options.h
index 7176a09..0818fac 100644
--- a/src/gui/menus/options.h
+++ b/src/gui/menus/options.h
@@ -29,12 +29,9 @@
#include <gtk/gtk.h>
-#include "../menubar.h"
-
-
-/* Construit le menu "Options". */
-GtkWidget *build_menu_options(GObject *, GMenuBar *);
+/* Complète la définition du menu "Options". */
+void setup_menu_options_callbacks(GtkBuilder *);
diff --git a/src/gui/menus/plugins.c b/src/gui/menus/plugins.c
deleted file mode 100644
index dfe3caa..0000000
--- a/src/gui/menus/plugins.c
+++ /dev/null
@@ -1,63 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * plugins.c - gestion du menu 'Greffons'
- *
- * Copyright (C) 2015-2018 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#include "plugins.h"
-
-
-#include <string.h>
-
-
-#include <i18n.h>
-
-
-#include "../../gtkext/easygtk.h"
-
-
-
-/******************************************************************************
-* *
-* Paramètres : ref = espace de référencement global. *
-* *
-* Description : Construit le menu "Aide". *
-* *
-* Retour : Panneau de menus mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GtkWidget *build_menu_plugins(GObject *ref)
-{
- GtkWidget *result; /* Support à retourner */
- GtkWidget *menubar; /* Support pour éléments */
-
- result = gtk_menu_item_new_with_mnemonic(_("_Plugins"));
- gtk_widget_show(result);
-
- menubar = qck_create_menu(GTK_MENU_ITEM(result));
- g_object_set_data(ref, "menubar_plugins", G_OBJECT(menubar));
-
- return result;
-
-}
diff --git a/src/gui/menus/plugins.h b/src/gui/menus/plugins.h
deleted file mode 100644
index 43cc4ee..0000000
--- a/src/gui/menus/plugins.h
+++ /dev/null
@@ -1,38 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * plugins.h - prototypes pour la gestion du menu 'Greffons'
- *
- * Copyright (C) 2015-2018 Cyrille Bagard
- *
- * This file is part of Chrysalide.
- *
- * Chrysalide is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * Chrysalide is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-
-#ifndef _GUI_MENUS_PLUGINS_H
-#define _GUI_MENUS_PLUGINS_H
-
-
-#include <gtk/gtk.h>
-
-
-
-/* Construit le menu "Aide". */
-GtkWidget *build_menu_plugins(GObject *);
-
-
-
-#endif /* _GUI_MENUS_PLUGINS_H */
diff --git a/src/gui/menus/project.c b/src/gui/menus/project.c
index e472419..e9e690c 100644
--- a/src/gui/menus/project.c
+++ b/src/gui/menus/project.c
@@ -32,6 +32,7 @@
#include "../item-int.h"
+#include "../menubar.h"
#include "../core/global.h"
#include "../../analysis/loading.h"
#include "../../analysis/contents/file.h"
@@ -50,57 +51,9 @@ static void mcb_project_remove_content(GtkMenuItem *, GStudyProject *);
/******************************************************************************
* *
-* Paramètres : ref = espace de référencement global. *
-* bar = barre de menu parente. *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
* *
-* Description : Construit le menu "Projet". *
-* *
-* Retour : Panneau de menus mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GtkWidget *build_menu_project(GObject *ref, GMenuBar *bar)
-{
- GtkWidget *result; /* Support à retourner */
- GtkWidget *menubar; /* Support pour éléments #1 */
- GtkWidget *submenuitem; /* Sous-élément de menu #1 */
- GtkWidget *deepmenubar; /* Support pour éléments #2 */
- GtkWidget *deepmenuitem; /* Sous-élément de menu #2 */
-
- result = gtk_menu_item_new_with_mnemonic(_("_Project"));
- gtk_widget_show(result);
-
- menubar = qck_create_menu(GTK_MENU_ITEM(result));
-
- submenuitem = qck_create_menu_item(NULL, NULL, _("Add a binary..."), NULL, NULL);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- deepmenubar = qck_create_menu(GTK_MENU_ITEM(submenuitem));
-
- deepmenuitem = qck_create_menu_item(ref, "mnu_project_add_binary", _("File"),
- G_CALLBACK(mcb_project_add_binary_file), bar);
- gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem);
-
- submenuitem = qck_create_menu_item(G_OBJECT(result), "menu_prj_remove_bin", _("Remove a binary"),
- NULL, NULL);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- deepmenubar = qck_create_menu(GTK_MENU_ITEM(submenuitem));
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : widget = menu principal à actualiser. *
-* project = projet visé par la procédure. *
-* bar = barre de menu parente. *
-* *
-* Description : Lance une actualisation relative à l'étendue du projet. *
+* Description : Complète la définition du menu "Projet". *
* *
* Retour : - *
* *
@@ -108,56 +61,21 @@ GtkWidget *build_menu_project(GObject *ref, GMenuBar *bar)
* *
******************************************************************************/
-void update_menu_project_for_project(GtkWidget *widget, GStudyProject *project, GMenuBar *bar)
+void setup_menu_project_callbacks(GtkBuilder *builder)
{
- GtkWidget *menuitem; /* Menu principal à compléter */
- GtkWidget *menubar; /* Support pour éléments */
- GList *list; /* Liste des éléments en place */
- GList *iter; /* Boucle de parcours #1 */
- size_t count; /* Nombre de contenus attachés */
- GLoadedContent **contents; /* Liste de ces contenus */
- size_t i; /* Boucle de parcours #2 */
- char *desc; /* Description à afficher */
- GtkWidget *submenuitem; /* Sous-menu à ajouter */
-
- menuitem = GTK_WIDGET(g_object_get_data(G_OBJECT(widget), "menu_prj_remove_bin"));
- menubar = gtk_menu_item_get_submenu(GTK_MENU_ITEM(menuitem));
-
- /* Remise à zéro */
-
- list = gtk_container_get_children(GTK_CONTAINER(menubar));
-
- for (iter = list; iter != NULL; iter = g_list_next(iter))
- gtk_container_remove(GTK_CONTAINER(menubar), GTK_WIDGET(iter->data));
-
- g_list_free(list);
-
- /* Ajout des entrées */
-
- contents = g_study_project_get_contents(project, &count);
-
- for (i = 0; i < count; i++)
- {
- desc = g_loaded_content_describe(contents[i], true);
+ GObject *item; /* Elément à compléter */
- submenuitem = qck_create_menu_item(NULL, NULL, desc,
- G_CALLBACK(mcb_project_remove_content), project);
- g_object_set_data_full(G_OBJECT(submenuitem), "content", contents[i], g_object_unref);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+#define DEFINE_CALLBACK(cb) #cb, G_CALLBACK(cb)
- free(desc);
+ gtk_builder_add_callback_symbols(builder,
+ DEFINE_CALLBACK(mcb_project_add_binary_file),
+ NULL);
- /**
- * Note : l'appel à g_object_unref() est réalisé lorsque la référence
- * est retirée du menu.
- */
+ /* Projet -> Retirer un binaire */
- }
-
- if (contents != NULL)
- free(contents);
+ item = gtk_builder_get_object(builder, "project_remove");
- gtk_widget_set_sensitive(menuitem, count > 0);
+ qck_create_menu(GTK_MENU_ITEM(item));
}
@@ -255,3 +173,70 @@ static void mcb_project_remove_content(GtkMenuItem *menuitem, GStudyProject *pro
g_object_set_data(ref, "content", NULL);
}
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
+* project = projet visé par la procédure. *
+* *
+* Description : Lance une actualisation relative à l'étendue du projet. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void update_menu_project_for_project(GtkBuilder *builder, GStudyProject *project)
+{
+ GtkWidget *menuitem; /* Menu principal à compléter */
+ GtkWidget *submenu; /* Support pour éléments */
+ GList *list; /* Liste des éléments en place */
+ GList *iter; /* Boucle de parcours #1 */
+ size_t count; /* Nombre de contenus attachés */
+ GLoadedContent **contents; /* Liste de ces contenus */
+ size_t i; /* Boucle de parcours #2 */
+ char *desc; /* Description à afficher */
+ GtkWidget *submenuitem; /* Sous-menu à ajouter */
+
+ menuitem = GTK_WIDGET(gtk_builder_get_object(builder, "project_remove"));
+ submenu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(menuitem));
+
+ /* Remise à zéro */
+
+ list = gtk_container_get_children(GTK_CONTAINER(submenu));
+
+ for (iter = list; iter != NULL; iter = g_list_next(iter))
+ gtk_container_remove(GTK_CONTAINER(submenu), GTK_WIDGET(iter->data));
+
+ g_list_free(list);
+
+ /* Ajout des entrées */
+
+ contents = g_study_project_get_contents(project, &count);
+
+ for (i = 0; i < count; i++)
+ {
+ desc = g_loaded_content_describe(contents[i], true);
+
+ submenuitem = qck_create_menu_item(NULL, NULL, desc,
+ G_CALLBACK(mcb_project_remove_content), project);
+ g_object_set_data_full(G_OBJECT(submenuitem), "content", contents[i], g_object_unref);
+ gtk_container_add(GTK_CONTAINER(submenu), submenuitem);
+
+ free(desc);
+
+ /**
+ * Note : l'appel à g_object_unref() est réalisé lorsque la référence
+ * est retirée du menu.
+ */
+
+ }
+
+ if (contents != NULL)
+ free(contents);
+
+ gtk_widget_set_sensitive(menuitem, count > 0);
+
+}
diff --git a/src/gui/menus/project.h b/src/gui/menus/project.h
index 6fddf74..78370a0 100644
--- a/src/gui/menus/project.h
+++ b/src/gui/menus/project.h
@@ -29,16 +29,15 @@
#include <gtk/gtk.h>
-#include "../menubar.h"
#include "../../analysis/project.h"
-/* Construit le menu "Projet". */
-GtkWidget *build_menu_project(GObject *, GMenuBar *);
+/* Complète la définition du menu "Projet". */
+void setup_menu_project_callbacks(GtkBuilder *);
/* Lance une actualisation relative à l'étendue du projet. */
-void update_menu_project_for_project(GtkWidget *, GStudyProject *, GMenuBar *);
+void update_menu_project_for_project(GtkBuilder *, GStudyProject *);
diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c
index c2f3f28..b778f8c 100644
--- a/src/gui/menus/view.c
+++ b/src/gui/menus/view.c
@@ -45,9 +45,6 @@
-/* Met à jour les accès du menu "Affichage -> Basculer...". */
-static void update_switch_access_in_menu_view(GObject *);
-
/* Réagit avec le menu "Affichage -> Panneaux latéraux -> ...". */
static void mcb_view_change_panel_docking(GtkCheckMenuItem *, GPanelItem *);
@@ -55,10 +52,10 @@ static void mcb_view_change_panel_docking(GtkCheckMenuItem *, GPanelItem *);
static void mcb_view_change_support(GtkRadioMenuItem *, gpointer);
/* Réagit avec le menu "Affichage -> Basculer vers le suivant". */
-static void mcb_view_switch_to_next_support(GtkRadioMenuItem *, GObject *);
+static void mcb_view_switch_to_next_support(GtkRadioMenuItem *, GMenuBar *);
/* Réagit avec le menu "Affichage -> Basculer vers le précédent". */
-static void mcb_view_switch_to_prev_support(GtkRadioMenuItem *, GObject *);
+static void mcb_view_switch_to_prev_support(GtkRadioMenuItem *, GMenuBar *);
/* Accompagne la première allocation d'un panneau d'affichage. */
static void handle_loaded_panel_first_allocation(GtkWidget *, GdkRectangle *, GLineCursor *);
@@ -75,212 +72,16 @@ static void mcb_view_display_column(GtkCheckMenuItem *, gpointer);
/* Réagit avec le menu "Affichage -> Plein écran". */
static void mcb_view_show_full_screen(GtkCheckMenuItem *, gpointer);
+/* Met à jour les accès du menu "Affichage -> Basculer...". */
+static void update_switch_access_in_menu_view(GtkBuilder *);
-/******************************************************************************
-* *
-* Paramètres : ref = espace de référencement global. *
-* bar = barre de menu parente. *
-* *
-* Description : Construit le menu "Affichage". *
-* *
-* Retour : Panneau de menus mis en place. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-GtkWidget *build_menu_view(GObject *ref, GMenuBar *bar)
-{
- GtkWidget *result; /* Support à retourner */
- GtkWidget *menubar; /* Support pour éléments */
- GtkWidget *submenuitem; /* Sous-élément de menu */
-
- result = gtk_menu_item_new_with_mnemonic(_("_View"));
- gtk_widget_show(result);
-
- menubar = qck_create_menu(GTK_MENU_ITEM(result));
-
- /* Affichage -> Panneaux latéraux */
-
- submenuitem = qck_create_menu_item(ref, "mnu_view_side_panels", _("Side panels"), NULL, NULL);
- g_signal_connect(submenuitem, "select", G_CALLBACK(mcb_view_update_side_panels_list), bar);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- qck_create_menu(GTK_MENU_ITEM(submenuitem));
-
- /* Séparation */
-
- submenuitem = qck_create_menu_separator();
- g_object_set_data(ref, "mnu_view_start_panels", submenuitem);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Types de panneau de code */
-
- submenuitem = qck_create_menu_item(ref, "mnu_view_switch_to_next_support", _("Switch to next"),
- G_CALLBACK(mcb_view_switch_to_next_support), ref);
- add_accelerator_to_widget(submenuitem, "Tab");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_view_switch_to_prev_support", _("Switch to previous"),
- G_CALLBACK(mcb_view_switch_to_prev_support), ref);
- add_accelerator_to_widget(submenuitem, "<Shift>Tab");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Séparation */
-
- submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Zooms */
-
- submenuitem = qck_create_menu_item(ref, "mnu_view_zoom_in", _("Zoom in"),
- G_CALLBACK(mcb_view_zoom), GINT_TO_POINTER(0));
- add_accelerator_to_widget(submenuitem, "<Ctrl>plus");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_view_zoom_out", _("Zoom out"),
- G_CALLBACK(mcb_view_zoom), GINT_TO_POINTER(1));
- add_accelerator_to_widget(submenuitem, "<Ctrl>minus");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- submenuitem = qck_create_menu_item(ref, "mnu_view_zoom_reset", _("Reset zoom"),
- G_CALLBACK(mcb_view_zoom), GINT_TO_POINTER(2));
- add_accelerator_to_widget(submenuitem, "<Ctrl>0");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Séparation */
-
- submenuitem = qck_create_menu_separator();
- g_object_set_data(ref, "mnu_view_start_options", submenuitem);
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Séparation */
-
- submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- /* Affichage -> Plein écran */
-
- submenuitem = qck_create_check_menu_item(NULL, NULL, _("Full screen"),
- G_CALLBACK(mcb_view_show_full_screen), NULL);
- add_accelerator_to_widget(submenuitem, "F11");
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : widget = menu principal à actualiser. *
-* ref = espace de référencement global. *
-* new = nouveau contenu chargé à analyser. *
-* *
-* Description : Réagit à un changement d'affichage principal de contenu. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void rebuild_menu_view_for_content(GtkWidget *widget, GObject *ref, GLoadedContent *new)
-{
- GtkWidget *menubar; /* Support pour éléments */
- unsigned int i; /* Boucle de parcours */
- char *key; /* Clef pour accès ultérieurs */
- GtkWidget *submenuitem; /* Sous-élément de menu */
- void *marker; /* Menu de référence */
- GList *list; /* Liste des éléments en place */
- gint position; /* Point d'insertion */
- GList *iter; /* Boucle de parcours */
- unsigned int count; /* Nombre d'itérations à mener */
- GSList *rgroup; /* Groupe des boutons radio */
- char *caption; /* Etiquette pour un menu */
-
- /* Retrait d'éventuels anciens menus */
-
- menubar = gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget));
-
- for (i = 0; ; i++)
- {
- asprintf(&key, "mnu_view_panel_%u", i);
-
- submenuitem = g_object_get_data(ref, key);
-
- free(key);
-
- if (submenuitem == NULL)
- break;
- else
- gtk_container_remove(GTK_CONTAINER(menubar), GTK_WIDGET(submenuitem));
-
- }
-
- if (new != NULL)
- {
- /* Insertion des différentes vues */
-
- marker = g_object_get_data(ref, "mnu_view_start_panels");
-
- list = gtk_container_get_children(GTK_CONTAINER(menubar));
-
- position = 0;
-
- for (iter = list; iter != NULL; iter = g_list_next(iter))
- {
- position++;
-
- if (marker == iter->data)
- break;
-
- }
-
- g_list_free(list);
-
- count = g_loaded_content_count_views(new);
-
- rgroup = NULL;
-
- for (i = 0; i < count; i++)
- {
- asprintf(&key, "mnu_view_panel_%u", i);
- caption = g_loaded_content_get_view_name(new, i);
-
- submenuitem = qck_create_radio_menu_item(ref, key, rgroup, caption,
- G_CALLBACK(mcb_view_change_support), NULL);
- g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(i));
-
- free(caption);
- free(key);
-
- asprintf(&key, "F%u", 3 + i);
-
- add_accelerator_to_widget(submenuitem, key);
-
- free(key);
-
- if (rgroup == NULL)
- rgroup = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(submenuitem));
-
- gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), submenuitem, position + i);
-
- }
-
- }
-
-}
-
/******************************************************************************
* *
-* Paramètres : widget = menu principal à actualiser. *
-* ref = espace de référencement global. *
-* new = nouvelle vue du contenu chargé analysé. *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
* *
-* Description : Lance une actualisation du fait d'un changement de support. *
+* Description : Complète la définition du menu "Affichage". *
* *
* Retour : - *
* *
@@ -288,227 +89,36 @@ void rebuild_menu_view_for_content(GtkWidget *widget, GObject *ref, GLoadedConte
* *
******************************************************************************/
-void rebuild_menu_view_for_view(GtkWidget *widget, GObject *ref, GLoadedPanel *new)
+void setup_menu_view_callbacks(GtkBuilder *builder)
{
- GLoadedContent *content; /* Contenu en cours d'analyse */
- unsigned int index; /* Indice de la vue */
- GtkWidget *menubar; /* Support pour éléments */
- void *marker; /* Menu de référence */
- size_t i; /* Boucle de parcours */
- char *key; /* Clef pour accès ultérieurs */
- GtkWidget *submenuitem; /* Sous-élément de menu */
- GtkRadioMenuItem *item; /* Elément de menu arbitraire */
- GSList *radios; /* Liste des menus d'affichage */
- GList *list; /* Liste des éléments en place */
- gint position; /* Point d'insertion */
- GList *iter; /* Boucle de parcours */
- GDisplayOptions *options; /* Paramètres de rendus */
- size_t count; /* Nombre d'itérations à mener */
- bool status; /* Consigne d'affichage */
-
- content = get_current_content();
- assert((content == NULL && new == NULL) || (content != NULL && new != NULL));
-
- /* Retrait d'éventuels anciens menus */
+ GObject *item; /* Elément à compléter */
- menubar = gtk_menu_item_get_submenu(GTK_MENU_ITEM(widget));
+#define DEFINE_CALLBACK(cb) #cb, G_CALLBACK(cb)
- marker = g_object_get_data(ref, "mnu_view_start_options");
+ gtk_builder_add_callback_symbols(builder,
+ DEFINE_CALLBACK(mcb_view_update_side_panels_list),
+ DEFINE_CALLBACK(mcb_view_switch_to_next_support),
+ DEFINE_CALLBACK(mcb_view_switch_to_prev_support),
+ DEFINE_CALLBACK(mcb_view_zoom),
+ DEFINE_CALLBACK(mcb_view_show_full_screen),
+ NULL);
- for (i = 0; ; i++)
- {
- asprintf(&key, "mnu_view_display_option_%zu", i);
-
- submenuitem = g_object_get_data(ref, key);
-
- free(key);
-
- if (submenuitem == NULL)
- break;
- else
- gtk_container_remove(GTK_CONTAINER(menubar), GTK_WIDGET(submenuitem));
-
- }
-
- if (content != NULL)
- {
- index = g_loaded_content_get_view_index(content, GTK_WIDGET(new));
-
- /* Mise à jour du choix de la vue */
-
- item = GTK_RADIO_MENU_ITEM(g_object_get_data(ref, "mnu_view_panel_0"));
-
- radios = gtk_radio_menu_item_get_group(item);
-
- void disconnect_display_radio(GtkWidget *wgt, gpointer unused)
- {
- g_signal_handlers_disconnect_by_func(wgt, G_CALLBACK(mcb_view_change_support), NULL);
- }
-
- g_slist_foreach(radios, (GFunc)disconnect_display_radio, NULL);
-
- asprintf(&key, "mnu_view_panel_%u", index);
-
- item = GTK_RADIO_MENU_ITEM(g_object_get_data(ref, key));
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
-
- free(key);
-
- void reconnect_display_radio(GtkWidget *wgt, gpointer unused)
- {
- g_signal_connect(wgt, "toggled", G_CALLBACK(mcb_view_change_support), NULL);
- }
-
- g_slist_foreach(radios, (GFunc)reconnect_display_radio, NULL);
-
- /* Insertion des options de rendu */
-
- list = gtk_container_get_children(GTK_CONTAINER(menubar));
-
- position = 0;
-
- for (iter = list; iter != NULL; iter = g_list_next(iter))
- {
- position++;
-
- if (marker == iter->data)
- break;
-
- }
-
- g_list_free(list);
-
- options = g_loaded_content_get_display_options(content, index);
-
- count = g_display_options_count(options);
-
- for (i = 0; i < count; i++)
- {
- asprintf(&key, "mnu_view_display_option_%zu", i);
-
- submenuitem = qck_create_check_menu_item(ref, key,
- g_display_options_get_name(options, i),
- G_CALLBACK(mcb_view_display_column), NULL);
- g_object_set_data(G_OBJECT(submenuitem), "kind_of_opt", GUINT_TO_POINTER(i));
-
- gtk_menu_shell_insert(GTK_MENU_SHELL(menubar), submenuitem, position + i);
-
- free(key);
-
- /**
- * Un signal va être émis pour le menu, mais il n'ira pas très loin :
- * l'ensemble des options ne notifie un changement que si changement il y a !
- */
-
- status = g_display_options_get(options, i);
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(submenuitem), status);
-
- }
-
- g_object_unref(G_OBJECT(options));
-
- g_object_unref(G_OBJECT(content));
-
- }
-
- else
- count = 0;
-
- /* Utilité de la séparation ? */
-
- gtk_widget_set_visible(GTK_WIDGET(marker), count > 0);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : ref = espace de référencement global. *
-* new = nouvelle vue du contenu chargé analysé. *
-* *
-* Description : Met à jour les accès du menu "Affichage" selon le contenu. *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-void update_access_for_view_in_menu_view(GObject *ref, GLoadedPanel *new)
-{
- gboolean access; /* Accès à déterminer */
- GtkWidget *item; /* Elément de menu à traiter */
+ /* Affichage -> Panneaux latéraux */
- /* Bascules */
+ item = gtk_builder_get_object(builder, "view_side_panels");
- update_switch_access_in_menu_view(ref);
+ qck_create_menu(GTK_MENU_ITEM(item));
/* Zooms */
- access = GTK_IS_GRAPH_DISPLAY(new);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_view_zoom_in"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_view_zoom_out"));
- gtk_widget_set_sensitive(item, access);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_view_zoom_reset"));
- gtk_widget_set_sensitive(item, access);
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : ref = espace de référencement global. *
-* *
-* Description : Met à jour les accès du menu "Affichage -> Basculer...". *
-* *
-* Retour : - *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static void update_switch_access_in_menu_view(GObject *ref)
-{
- GLoadedPanel *panel; /* Afficheur effectif de code */
- GLoadedContent *content; /* Contenu représenté */
- unsigned int count; /* Nombre de vues possibles */
- unsigned int index; /* Indice de la vue courante */
- gboolean access; /* Accès à déterminer */
- GtkWidget *item; /* Elément de menu à traiter */
-
- panel = get_current_view();
+ item = gtk_builder_get_object(builder, "view_zoom_in");
+ g_object_set_data(item, "kind_of_zoom", GINT_TO_POINTER(0));
- if (panel == NULL)
- content = NULL;
+ item = gtk_builder_get_object(builder, "view_zoom_out");
+ g_object_set_data(item, "kind_of_zoom", GINT_TO_POINTER(1));
- else
- {
- content = g_loaded_panel_get_content(panel);
-
- count = g_loaded_content_count_views(content);
- index = g_loaded_content_get_view_index(content, GTK_WIDGET(panel));
-
- }
-
- access = (panel != NULL && (index + 1) < count);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_view_switch_to_next_support"));
- gtk_widget_set_sensitive(item, access);
-
- access = (panel != NULL && index > 0);
-
- item = GTK_WIDGET(g_object_get_data(ref, "mnu_view_switch_to_prev_support"));
- gtk_widget_set_sensitive(item, access);
-
- if (panel != NULL)
- {
- g_object_unref(G_OBJECT(content));
- g_object_unref(G_OBJECT(panel));
- }
+ item = gtk_builder_get_object(builder, "view_zoom_reset");
+ g_object_set_data(item, "kind_of_zoom", GINT_TO_POINTER(2));
}
@@ -528,7 +138,8 @@ static void update_switch_access_in_menu_view(GObject *ref)
void mcb_view_update_side_panels_list(GtkMenuItem *menuitem, GMenuBar *bar)
{
- GtkWidget *menubar; /* Support pour éléments */
+ GtkWidget *menu; /* Support pour éléments */
+ GtkBuilder *builder; /* Constructeur principal */
typedef struct _panels_loading_filter
{
@@ -539,10 +150,9 @@ void mcb_view_update_side_panels_list(GtkMenuItem *menuitem, GMenuBar *bar)
} panels_loading_filter;
- panels_loading_filter pfilter;
-
+ panels_loading_filter pfilter; /* Mécanismes de filtrage */
- menubar = gtk_menu_item_get_submenu(menuitem);
+ menu = gtk_menu_item_get_submenu(menuitem);
/* Réinitialisation */
@@ -552,7 +162,7 @@ void mcb_view_update_side_panels_list(GtkMenuItem *menuitem, GMenuBar *bar)
}
- gtk_container_foreach(GTK_CONTAINER(menubar), (GtkCallback)remove_panel_menu_item, menubar);
+ gtk_container_foreach(GTK_CONTAINER(menu), (GtkCallback)remove_panel_menu_item, menu);
/* Ajout des panneaux uniques */
@@ -572,7 +182,7 @@ void mcb_view_update_side_panels_list(GtkMenuItem *menuitem, GMenuBar *bar)
filter->first = false;
submenuitem = qck_create_menu_separator();
- gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+ gtk_container_add(GTK_CONTAINER(menu), submenuitem);
}
@@ -588,7 +198,11 @@ void mcb_view_update_side_panels_list(GtkMenuItem *menuitem, GMenuBar *bar)
bindings = gtk_panel_item_get_key_bindings(panel);
if (bindings != NULL)
- add_accelerator_to_widget(submenuitem, bindings);
+ {
+ builder = g_menu_bar_get_builder(bar);
+ add_accelerator_to_widget(builder, submenuitem, bindings);
+ g_object_unref(G_OBJECT(builder));
+ }
gtk_container_add(filter->support, submenuitem);
@@ -610,7 +224,7 @@ void mcb_view_update_side_panels_list(GtkMenuItem *menuitem, GMenuBar *bar)
}
- pfilter.support = GTK_CONTAINER(menubar);
+ pfilter.support = GTK_CONTAINER(menu);
pfilter.personality = PIP_SINGLETON;
pfilter.first = false;
@@ -706,7 +320,7 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, gpointer unused)
/******************************************************************************
* *
* Paramètres : menuitem = élément de menu ayant basculé. *
-* ref = espace de référencement global. *
+* bar = barre de menu parente. *
* *
* Description : Réagit avec le menu "Affichage -> Basculer vers le suivant". *
* *
@@ -716,7 +330,7 @@ static void mcb_view_change_support(GtkRadioMenuItem *menuitem, gpointer unused)
* *
******************************************************************************/
-static void mcb_view_switch_to_next_support(GtkRadioMenuItem *menuitem, GObject *ref)
+static void mcb_view_switch_to_next_support(GtkRadioMenuItem *menuitem, GMenuBar *bar)
{
GLoadedPanel *panel; /* Afficheur effectif de code */
GLoadedContent *content; /* Contenu représenté */
@@ -724,6 +338,7 @@ static void mcb_view_switch_to_next_support(GtkRadioMenuItem *menuitem, GObject
#ifndef NDEBUG
unsigned int count; /* Nombre de vues possibles */
#endif
+ GtkBuilder *builder; /* Constructeur lié au menu */
panel = get_current_view();
content = g_loaded_panel_get_content(panel);
@@ -741,7 +356,11 @@ static void mcb_view_switch_to_next_support(GtkRadioMenuItem *menuitem, GObject
g_object_unref(G_OBJECT(content));
g_object_unref(G_OBJECT(panel));
- update_switch_access_in_menu_view(ref);
+ builder = g_menu_bar_get_builder(bar);
+
+ update_switch_access_in_menu_view(builder);
+
+ g_object_unref(G_OBJECT(builder));
}
@@ -749,7 +368,7 @@ static void mcb_view_switch_to_next_support(GtkRadioMenuItem *menuitem, GObject
/******************************************************************************
* *
* Paramètres : menuitem = élément de menu ayant basculé. *
-* ref = espace de référencement global. *
+* bar = barre de menu parente. *
* *
* Description : Réagit avec le menu "Affichage -> Basculer ... précédent". *
* *
@@ -759,11 +378,12 @@ static void mcb_view_switch_to_next_support(GtkRadioMenuItem *menuitem, GObject
* *
******************************************************************************/
-static void mcb_view_switch_to_prev_support(GtkRadioMenuItem *menuitem, GObject *ref)
+static void mcb_view_switch_to_prev_support(GtkRadioMenuItem *menuitem, GMenuBar *bar)
{
GLoadedPanel *panel; /* Afficheur effectif de code */
GLoadedContent *content; /* Contenu représenté */
unsigned int index; /* Indice de la vue courante */
+ GtkBuilder *builder; /* Constructeur lié au menu */
panel = get_current_view();
content = g_loaded_panel_get_content(panel);
@@ -777,7 +397,11 @@ static void mcb_view_switch_to_prev_support(GtkRadioMenuItem *menuitem, GObject
g_object_unref(G_OBJECT(content));
g_object_unref(G_OBJECT(panel));
- update_switch_access_in_menu_view(ref);
+ builder = g_menu_bar_get_builder(bar);
+
+ update_switch_access_in_menu_view(builder);
+
+ g_object_unref(G_OBJECT(builder));
}
@@ -883,7 +507,7 @@ static void change_current_view_support(unsigned int wanted)
/******************************************************************************
* *
* Paramètres : menuitem = élément de menu sélectionné. *
-* data = données indiquant la nature du zoom. *
+* unused = adresse non utilisée ici. *
* *
* Description : Réagit avec le menu "Affichage -> Zoom *". *
* *
@@ -893,16 +517,19 @@ static void change_current_view_support(unsigned int wanted)
* *
******************************************************************************/
-static void mcb_view_zoom(GtkCheckMenuItem *menuitem, gpointer data)
+static void mcb_view_zoom(GtkCheckMenuItem *menuitem, gpointer unused)
{
GtkDisplayPanel *panel; /* Afficheur effectif de code */
double scale; /* Echelle à appliquer */
+ int zoom_kind; /* Type de zoom à appliquer */
panel = GTK_DISPLAY_PANEL(get_current_view());
scale = gtk_display_panel_get_scale(panel);
- switch (GPOINTER_TO_INT(data))
+ zoom_kind = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(menuitem), "kind_of_zoom"));
+
+ switch (zoom_kind)
{
case 0:
scale /= 1.25;
@@ -916,6 +543,11 @@ static void mcb_view_zoom(GtkCheckMenuItem *menuitem, gpointer data)
scale = 1.0;
break;
+ default:
+ assert(false);
+ scale = 1.0;
+ break;
+
}
gtk_display_panel_set_scale(panel, scale);
@@ -996,3 +628,348 @@ static void mcb_view_show_full_screen(GtkCheckMenuItem *menuitem, gpointer unuse
g_object_unref(G_OBJECT(editor));
}
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
+* new = nouveau contenu chargé à analyser. *
+* *
+* Description : Réagit à un changement d'affichage principal de contenu. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void rebuild_menu_view_for_content(GtkBuilder *builder, GLoadedContent *new)
+{
+ GObject *menuitem; /* Menu d'affichage */
+ GtkWidget *menu; /* Support pour éléments */
+ unsigned int i; /* Boucle de parcours */
+ char *key; /* Clef pour accès ultérieurs */
+ GtkWidget *submenuitem; /* Sous-élément de menu */
+ void *marker; /* Menu de référence */
+ GList *list; /* Liste des éléments en place */
+ gint position; /* Point d'insertion */
+ GList *iter; /* Boucle de parcours */
+ unsigned int count; /* Nombre d'itérations à mener */
+ GSList *rgroup; /* Groupe des boutons radio */
+ char *caption; /* Etiquette pour un menu */
+
+ /* Retrait d'éventuels anciens menus */
+
+ menuitem = gtk_builder_get_object(builder, "view");
+
+ menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(menuitem));
+
+ for (i = 0; ; i++)
+ {
+ asprintf(&key, "view_panel_%u", i);
+
+ submenuitem = g_object_get_data(menuitem, key);
+
+ free(key);
+
+ if (submenuitem == NULL)
+ break;
+ else
+ gtk_container_remove(GTK_CONTAINER(menu), GTK_WIDGET(submenuitem));
+
+ }
+
+ if (new != NULL)
+ {
+ /* Insertion des différentes vues */
+
+ marker = gtk_builder_get_object(builder, "view_sep_0");
+
+ list = gtk_container_get_children(GTK_CONTAINER(menu));
+
+ position = 0;
+
+ for (iter = list; iter != NULL; iter = g_list_next(iter))
+ {
+ position++;
+
+ if (marker == iter->data)
+ break;
+
+ }
+
+ g_list_free(list);
+
+ count = g_loaded_content_count_views(new);
+
+ rgroup = NULL;
+
+ for (i = 0; i < count; i++)
+ {
+ asprintf(&key, "view_panel_%u", i);
+ caption = g_loaded_content_get_view_name(new, i);
+
+ submenuitem = qck_create_radio_menu_item(menuitem, key, rgroup, caption,
+ G_CALLBACK(mcb_view_change_support), NULL);
+ g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(i));
+
+ free(caption);
+ free(key);
+
+ asprintf(&key, "F%u", 3 + i);
+
+ add_accelerator_to_widget(builder, submenuitem, key);
+
+ free(key);
+
+ if (rgroup == NULL)
+ rgroup = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(submenuitem));
+
+ gtk_menu_shell_insert(GTK_MENU_SHELL(menu), submenuitem, position + i);
+
+ }
+
+ }
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
+* new = nouvelle vue du contenu chargé analysé. *
+* *
+* Description : Lance une actualisation du fait d'un changement de support. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void rebuild_menu_view_for_view(GtkBuilder *builder, GLoadedPanel *new)
+{
+ GObject *menuitem; /* Menu d'affichage */
+ GLoadedContent *content; /* Contenu en cours d'analyse */
+ unsigned int index; /* Indice de la vue */
+ GtkWidget *menu; /* Support pour éléments */
+ void *marker; /* Menu de référence */
+ size_t i; /* Boucle de parcours */
+ char *key; /* Clef pour accès ultérieurs */
+ GtkWidget *submenuitem; /* Sous-élément de menu */
+ GtkRadioMenuItem *item; /* Elément de menu arbitraire */
+ GSList *radios; /* Liste des menus d'affichage */
+ GList *list; /* Liste des éléments en place */
+ gint position; /* Point d'insertion */
+ GList *iter; /* Boucle de parcours */
+ GDisplayOptions *options; /* Paramètres de rendus */
+ size_t count; /* Nombre d'itérations à mener */
+ bool status; /* Consigne d'affichage */
+
+ menuitem = gtk_builder_get_object(builder, "view");
+
+ content = get_current_content();
+ assert((content == NULL && new == NULL) || (content != NULL && new != NULL));
+
+ /* Retrait d'éventuels anciens menus */
+
+ menu = gtk_menu_item_get_submenu(GTK_MENU_ITEM(menuitem));
+
+ marker = gtk_builder_get_object(builder, "view_sep_2");
+
+ for (i = 0; ; i++)
+ {
+ asprintf(&key, "view_display_option_%zu", i);
+
+ submenuitem = g_object_get_data(menuitem, key);
+
+ free(key);
+
+ if (submenuitem == NULL)
+ break;
+ else
+ gtk_container_remove(GTK_CONTAINER(menu), GTK_WIDGET(submenuitem));
+
+ }
+
+ if (content != NULL)
+ {
+ index = g_loaded_content_get_view_index(content, GTK_WIDGET(new));
+
+ /* Mise à jour du choix de la vue */
+
+ item = GTK_RADIO_MENU_ITEM(g_object_get_data(menuitem, "view_panel_0"));
+
+ radios = gtk_radio_menu_item_get_group(item);
+
+ void disconnect_display_radio(GtkWidget *wgt, gpointer unused)
+ {
+ g_signal_handlers_disconnect_by_func(wgt, G_CALLBACK(mcb_view_change_support), NULL);
+ }
+
+ g_slist_foreach(radios, (GFunc)disconnect_display_radio, NULL);
+
+ asprintf(&key, "view_panel_%u", index);
+
+ item = GTK_RADIO_MENU_ITEM(g_object_get_data(menuitem, key));
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
+
+ free(key);
+
+ void reconnect_display_radio(GtkWidget *wgt, gpointer unused)
+ {
+ g_signal_connect(wgt, "toggled", G_CALLBACK(mcb_view_change_support), NULL);
+ }
+
+ g_slist_foreach(radios, (GFunc)reconnect_display_radio, NULL);
+
+ /* Insertion des options de rendu */
+
+ list = gtk_container_get_children(GTK_CONTAINER(menu));
+
+ position = 0;
+
+ for (iter = list; iter != NULL; iter = g_list_next(iter))
+ {
+ position++;
+
+ if (marker == iter->data)
+ break;
+
+ }
+
+ g_list_free(list);
+
+ options = g_loaded_content_get_display_options(content, index);
+
+ count = g_display_options_count(options);
+
+ for (i = 0; i < count; i++)
+ {
+ asprintf(&key, "view_display_option_%zu", i);
+
+ submenuitem = qck_create_check_menu_item(menuitem, key,
+ g_display_options_get_name(options, i),
+ G_CALLBACK(mcb_view_display_column), NULL);
+ g_object_set_data(G_OBJECT(submenuitem), "kind_of_opt", GUINT_TO_POINTER(i));
+
+ gtk_menu_shell_insert(GTK_MENU_SHELL(menu), submenuitem, position + i);
+
+ free(key);
+
+ /**
+ * Un signal va être émis pour le menu, mais il n'ira pas très loin :
+ * l'ensemble des options ne notifie un changement que si changement il y a !
+ */
+
+ status = g_display_options_get(options, i);
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(submenuitem), status);
+
+ }
+
+ g_object_unref(G_OBJECT(options));
+
+ g_object_unref(G_OBJECT(content));
+
+ }
+
+ else
+ count = 0;
+
+ /* Utilité de la séparation ? */
+
+ gtk_widget_set_visible(GTK_WIDGET(marker), count > 0);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
+* new = nouvelle vue du contenu chargé analysé. *
+* *
+* Description : Met à jour les accès du menu "Affichage" selon le contenu. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void update_access_for_view_in_menu_view(GtkBuilder *builder, GLoadedPanel *new)
+{
+ gboolean access; /* Accès à déterminer */
+ GtkWidget *item; /* Elément de menu à traiter */
+
+ /* Bascules */
+
+ update_switch_access_in_menu_view(builder);
+
+ /* Zooms */
+
+ access = GTK_IS_GRAPH_DISPLAY(new);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "view_zoom_in"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "view_zoom_out"));
+ gtk_widget_set_sensitive(item, access);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "view_zoom_reset"));
+ gtk_widget_set_sensitive(item, access);
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : builder = constructeur avec l'ensemble des références. *
+* *
+* Description : Met à jour les accès du menu "Affichage -> Basculer...". *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void update_switch_access_in_menu_view(GtkBuilder *builder)
+{
+ GLoadedPanel *panel; /* Afficheur effectif de code */
+ GLoadedContent *content; /* Contenu représenté */
+ unsigned int count; /* Nombre de vues possibles */
+ unsigned int index; /* Indice de la vue courante */
+ gboolean access; /* Accès à déterminer */
+ GtkWidget *item; /* Elément de menu à traiter */
+
+ panel = get_current_view();
+
+ if (panel == NULL)
+ content = NULL;
+
+ else
+ {
+ content = g_loaded_panel_get_content(panel);
+
+ count = g_loaded_content_count_views(content);
+ index = g_loaded_content_get_view_index(content, GTK_WIDGET(panel));
+
+ }
+
+ access = (panel != NULL && (index + 1) < count);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "view_switch_to_next"));
+ gtk_widget_set_sensitive(item, access);
+
+ access = (panel != NULL && index > 0);
+
+ item = GTK_WIDGET(gtk_builder_get_object(builder, "view_switch_to_prev"));
+ gtk_widget_set_sensitive(item, access);
+
+ if (panel != NULL)
+ {
+ g_object_unref(G_OBJECT(content));
+ g_object_unref(G_OBJECT(panel));
+ }
+
+}
diff --git a/src/gui/menus/view.h b/src/gui/menus/view.h
index 3d4b69f..963f3fd 100644
--- a/src/gui/menus/view.h
+++ b/src/gui/menus/view.h
@@ -34,20 +34,20 @@
-/* Construit le menu "Affichage". */
-GtkWidget *build_menu_view(GObject *, GMenuBar *);
+/* Complète la définition du menu "Affichage". */
+void setup_menu_view_callbacks(GtkBuilder *);
+
+/* Réagit avec le menu "Affichage -> Panneaux latéraux". */
+void mcb_view_update_side_panels_list(GtkMenuItem *, GMenuBar *);
/* Réagit à un changement d'affichage principal de contenu. */
-void rebuild_menu_view_for_content(GtkWidget *, GObject *, GLoadedContent *);
+void rebuild_menu_view_for_content(GtkBuilder *, GLoadedContent *);
/* Lance une actualisation du fait d'un changement de support. */
-void rebuild_menu_view_for_view(GtkWidget *, GObject *, GLoadedPanel *);
+void rebuild_menu_view_for_view(GtkBuilder *, GLoadedPanel *);
/* Met à jour les accès du menu "Affichage" selon le contenu. */
-void update_access_for_view_in_menu_view(GObject *, GLoadedPanel *);
-
-/* Réagit avec le menu "Affichage -> Panneaux latéraux". */
-void mcb_view_update_side_panels_list(GtkMenuItem *, GMenuBar *);
+void update_access_for_view_in_menu_view(GtkBuilder *, GLoadedPanel *);