From c7b064cf1470974aa304d181e1174f9a329d4d49 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Wed, 18 Jul 2018 11:30:27 +0200 Subject: Disabled simple accelerators when a text entry gets focus. --- src/gtkext/easygtk.c | 53 --------------- src/gtkext/easygtk.h | 3 - src/gtkext/gtkdockable.c | 3 + src/gtkext/gtkstatusstack.c | 3 + src/gui/Makefile.am | 1 + src/gui/agroup.c | 153 ++++++++++++++++++++++++++++++++++++++++++++ src/gui/agroup.h | 41 ++++++++++++ src/gui/core/global.c | 43 ++++++++++++- src/gui/core/global.h | 6 ++ src/gui/editor.c | 17 +++-- src/gui/menus/binary.c | 10 +-- src/gui/menus/binary.h | 2 +- src/gui/menus/debug.c | 25 ++++---- src/gui/menus/debug.h | 2 +- src/gui/menus/edition.c | 34 +++++----- src/gui/menus/edition.h | 2 +- src/gui/menus/file.c | 14 ++-- src/gui/menus/file.h | 2 +- src/gui/menus/help.c | 5 +- src/gui/menus/help.h | 2 +- src/gui/menus/menubar.c | 25 ++++---- src/gui/menus/menubar.h | 2 +- src/gui/menus/plugins.c | 5 +- src/gui/menus/plugins.h | 2 +- src/gui/menus/project.c | 7 +- src/gui/menus/project.h | 2 +- src/gui/menus/tools.c | 7 +- src/gui/menus/tools.h | 2 +- src/gui/menus/view.c | 25 +++----- src/gui/menus/view.h | 2 +- src/gui/panels/bintree.c | 1 + src/gui/panels/bintree.ui | 2 + src/gui/panels/regedit.c | 3 + src/gui/panels/symbols.c | 2 + src/gui/panels/symbols.ui | 2 + src/gui/status.h | 2 +- 36 files changed, 353 insertions(+), 159 deletions(-) create mode 100644 src/gui/agroup.c create mode 100644 src/gui/agroup.h diff --git a/src/gtkext/easygtk.c b/src/gtkext/easygtk.c index b86955f..05de12e 100644 --- a/src/gtkext/easygtk.c +++ b/src/gtkext/easygtk.c @@ -40,9 +40,6 @@ static gboolean handle_escape_on_menu(GtkWidget *, GdkEventKey *, GtkMenuItem *) /* Assure que le menu parent est sélectionné comme attendu. */ static void show_parent_selection(GtkWidget *, GtkMenuItem *); -/* Détermine si un élément de menu peut être actionné. */ -static gboolean enable_accel_all_the_time(GtkWidget *, guint, gpointer); - /****************************************************************************** @@ -1022,56 +1019,6 @@ GtkWidget *qck_create_radio_menu_item(GObject *object, const char *name, GSList /****************************************************************************** * * -* Paramètres : widget = composant graphique à analyser. * -* signal_id = identifiant de signal. * -* unused = adresse non utilisée ici. * -* * -* Description : Détermine si un élément de menu peut être actionné. * -* * -* Retour : TRUE si l'élément de menu est accessible. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static gboolean enable_accel_all_the_time(GtkWidget *widget, guint signal_id, gpointer unused) -{ - return gtk_widget_is_sensitive(widget); - -} - - -/****************************************************************************** -* * -* Paramètres : item = élément d'un menu à mettre à jour. * -* accelerator = description sous forme de chaîne de caractères.* -* group = groupe d'appartenance du raccourci. * -* * -* Description : Ajoute un accélérateur à un élément de menu existant. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void add_accelerator_to_menu_item(GtkWidget *item, const char *accelerator, GtkAccelGroup *group) -{ - guint key; /* Touche concernée */ - GdkModifierType mods; /* Eventuels modificateurs */ - - gtk_accelerator_parse(accelerator, &key, &mods); - - g_signal_connect(item, "can-activate-accel", G_CALLBACK(enable_accel_all_the_time), NULL); - - gtk_widget_add_accelerator(item, "activate", group, - key, mods, GTK_ACCEL_VISIBLE); - -} - - -/****************************************************************************** -* * * Paramètres : - * * * * Description : Crée et enregistre un composant 'GtkSeparatorMenuItem'. * diff --git a/src/gtkext/easygtk.h b/src/gtkext/easygtk.h index 1c732b0..5f02a72 100644 --- a/src/gtkext/easygtk.h +++ b/src/gtkext/easygtk.h @@ -104,9 +104,6 @@ GtkWidget *qck_create_check_menu_item(GObject *, const char *, const char *, GCa /* Crée et enregistre un composant 'GtkRadioMenuItem'. */ GtkWidget *qck_create_radio_menu_item(GObject *, const char *, GSList *, const char *, GCallback, gpointer); -/* Ajoute un accélérateur à un élément de menu existant. */ -void add_accelerator_to_menu_item(GtkWidget *, const char *, GtkAccelGroup *); - /* Crée et enregistre un composant 'GtkSeparatorMenuItem'. */ GtkWidget *qck_create_menu_separator(void); diff --git a/src/gtkext/gtkdockable.c b/src/gtkext/gtkdockable.c index 3056402..71c6826 100644 --- a/src/gtkext/gtkdockable.c +++ b/src/gtkext/gtkdockable.c @@ -34,6 +34,7 @@ #include "easygtk.h" #include "gtkdockable-int.h" #include "tmgt.h" +#include "../gui/agroup.h" @@ -390,6 +391,8 @@ static GtkWidget *build_search_area(GtkDockable *dockable, GtkWidget **search) *search = gtk_search_entry_new(); g_signal_connect(*search, "search-changed", G_CALLBACK(on_dockable_search_changed), dockable); + g_signal_connect(*search, "focus-in-event", G_CALLBACK(track_focus_change_in_text_area), NULL); + g_signal_connect(*search, "focus-out-event", G_CALLBACK(track_focus_change_in_text_area), NULL); gtk_widget_set_hexpand(*search, TRUE); gtk_widget_show(*search); gtk_grid_attach_next_to(GTK_GRID(result), *search, label, GTK_POS_RIGHT, 1, 1); diff --git a/src/gtkext/gtkstatusstack.c b/src/gtkext/gtkstatusstack.c index 0bcb903..1765eaf 100644 --- a/src/gtkext/gtkstatusstack.c +++ b/src/gtkext/gtkstatusstack.c @@ -35,6 +35,7 @@ #include "easygtk.h" #include "../common/extstr.h" +#include "../gui/agroup.h" #include "../format/format.h" @@ -414,6 +415,8 @@ static GtkWidget *build_assembly_status_stack(GtkStatusStack *stack) zoom = qck_create_entry(ref, "zoom", "100%"); gtk_entry_set_icon_from_icon_name(GTK_ENTRY(zoom), GTK_ENTRY_ICON_SECONDARY, "go-up-symbolic"); + g_signal_connect(zoom, "focus-in-event", G_CALLBACK(track_focus_change_in_text_area), NULL); + g_signal_connect(zoom, "focus-out-event", G_CALLBACK(track_focus_change_in_text_area), NULL); g_signal_connect(zoom, "icon-press", G_CALLBACK(on_zoom_icon_press), stack); gtk_box_pack_start(GTK_BOX(hbox), zoom, FALSE, TRUE, 0); diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 19f011b..5adc0f9 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -2,6 +2,7 @@ noinst_LTLIBRARIES = libgui.la libgui_la_SOURCES = \ + agroup.h agroup.c \ editem-int.h \ editem.h editem.c \ editor.h editor.c \ diff --git a/src/gui/agroup.c b/src/gui/agroup.c new file mode 100644 index 0000000..00dbaef --- /dev/null +++ b/src/gui/agroup.c @@ -0,0 +1,153 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * agroup.h - prototypes pour l'activation et la désactivation de tous les raccourcis clavier + * + * Copyright (C) 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 "agroup.h" + + +#include + + +#include "core/global.h" + + + +/* Détermine si un élément graphique peut être actionné. */ +static gboolean enable_accel_all_the_time(GtkWidget *, guint, gpointer); + +/* Détermine si un élément graphique peut être actionné. */ +static gboolean enable_accel_with_care(GtkWidget *, guint, gpointer); + + + +/* Suivi des autorisations suivant la zone active. */ +static bool _entry_focused = false; + + + +/****************************************************************************** +* * +* Paramètres : widget = composant graphique à analyser. * +* signal_id = identifiant de signal. * +* unused = adresse non utilisée ici. * +* * +* Description : Détermine si un élément graphique peut être actionné. * +* * +* Retour : TRUE si l'élément de menu est accessible. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static gboolean enable_accel_all_the_time(GtkWidget *widget, guint signal_id, gpointer unused) +{ + gboolean result; /* Indication à retourner */ + + result = gtk_widget_is_sensitive(widget); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : widget = composant graphique à analyser. * +* signal_id = identifiant de signal. * +* unused = adresse non utilisée ici. * +* * +* Description : Détermine si un élément graphique peut être actionné. * +* * +* Retour : TRUE si l'élément de menu est accessible. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static gboolean enable_accel_with_care(GtkWidget *widget, guint signal_id, gpointer unused) +{ + gboolean result; /* Indication à retourner */ + + result = !_entry_focused && enable_accel_all_the_time(widget, signal_id, unused); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : widget = composant GTK à traiter. * +* accelerator = description sous forme de chaîne de caractères.* +* group = groupe d'appartenance du raccourci. * +* * +* Description : Ajoute un accélérateur à un composant graphique. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void add_accelerator_to_widget(GtkWidget *widget, const char *accelerator) +{ + guint key; /* Touche concernée */ + GdkModifierType mods; /* Eventuels modificateurs */ + GtkAccelGroup *group; /* Groupe de raccourcis */ + + gtk_accelerator_parse(accelerator, &key, &mods); + + if (mods == 0) + g_signal_connect(widget, "can-activate-accel", G_CALLBACK(enable_accel_with_care), NULL); + else + g_signal_connect(widget, "can-activate-accel", G_CALLBACK(enable_accel_all_the_time), NULL); + + group = get_accel_group(); + + gtk_widget_add_accelerator(widget, "activate", group, + key, mods, GTK_ACCEL_VISIBLE); + +} + + +/****************************************************************************** +* * +* Paramètres : widget = composant GTK à l'origine de la procédure. * +* event = informations liées à l'événement. * +* unused = adresse non utilisée ici. * +* * +* Description : Prend note d'un changement de focus sur une zone de saisie. * +* * +* Retour : FALSE pour poursuivre la propagation de l'événement. * +* * +* Remarques : - * +* * +******************************************************************************/ + +gboolean track_focus_change_in_text_area(GtkWidget *widget, GdkEventFocus *event, gpointer unused) +{ + _entry_focused = event->in; + + return FALSE; + +} diff --git a/src/gui/agroup.h b/src/gui/agroup.h new file mode 100644 index 0000000..30a63f9 --- /dev/null +++ b/src/gui/agroup.h @@ -0,0 +1,41 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * agroup.h - prototypes pour l'activation et la désactivation de tous les raccourcis clavier + * + * Copyright (C) 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_AGROUP_H +#define _GUI_AGROUP_H + + +#include + + + +/* Ajoute un accélérateur à un composant graphique. */ +void add_accelerator_to_widget(GtkWidget *, const char *); + +/* Prend note d'un changement de focus sur une zone de saisie. */ +gboolean track_focus_change_in_text_area(GtkWidget *, GdkEventFocus *, gpointer); + + + +#endif /* _GUI_AGROUP_H */ diff --git a/src/gui/core/global.c b/src/gui/core/global.c index 30dc174..dadece0 100644 --- a/src/gui/core/global.c +++ b/src/gui/core/global.c @@ -28,6 +28,9 @@ /* Fenêtre principale de l'éditeur */ static GtkWindow *_editor = NULL; +/* Gestion des raccourcis clavier */ +static GtkAccelGroup *_accgroup = NULL; + /* Barre de statut principale */ static GtkStatusStack *_status = NULL; @@ -102,7 +105,45 @@ GObject *get_global_ref(void) /****************************************************************************** * * -* Paramètres : status = barre de statut à tenir informée. * +* Paramètres : group = groupe d'accélérateurs. * +* * +* Description : Assigne un groupe de raccourcis clavier globaux. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void set_accel_group(GtkAccelGroup *group) +{ + _accgroup = group; + +} + + +/****************************************************************************** +* * +* Paramètres : - * +* * +* Description : Fournit le groupe de raccourcis clavier globaux. * +* * +* Retour : Goupe d'accélérateurs. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GtkAccelGroup *get_accel_group(void) +{ + return _accgroup; + +} + + +/****************************************************************************** +* * +* Paramètres : status = barre de statut à tenir informée. * * * * Description : Note l'adresse de la barre de statut principale. * * * diff --git a/src/gui/core/global.h b/src/gui/core/global.h index ee66399..c80bcb5 100644 --- a/src/gui/core/global.h +++ b/src/gui/core/global.h @@ -40,6 +40,12 @@ GtkWindow *get_editor_window(void); /* Fournit l'espace de références global en mode graphique. */ GObject *get_global_ref(void); +/* Assigne un groupe de raccourcis clavier globaux. */ +void set_accel_group(GtkAccelGroup *); + +/* Fournit le groupe de raccourcis clavier globaux. */ +GtkAccelGroup *get_accel_group(void); + /* Note l'adresse de la barre de statut principale. */ void set_global_status(GtkStatusStack *); diff --git a/src/gui/editor.c b/src/gui/editor.c index 3b8497c..910feb3 100644 --- a/src/gui/editor.c +++ b/src/gui/editor.c @@ -34,6 +34,7 @@ #include +#include "agroup.h" #include "status.h" #include "menus/menubar.h" #include "core/core.h" @@ -58,9 +59,6 @@ -/* Gestion des raccourcis clavier */ -static GtkAccelGroup *_accgroup = NULL; - /* Met en place la liste des icônes de l'éditeur. */ @@ -277,10 +275,13 @@ static GList *build_editor_icons_list(void) GtkWidget *create_editor(void) { GtkWidget *result; /* Fenêtre à renvoyer */ + + bool hide; /* Cachette de la barre ? */ bool maximized; /* Affichage en plein écran ? */ GList *icons; /* Liste d'images dimensionnées*/ GObject *ref; /* Version de référence */ + GtkAccelGroup *accgroup; /* Groupe de raccourcis clavier*/ GEditorItem *editem; /* Menus réactifs principaux */ GtkWidget *menuboard; /* Barre de menus principale */ @@ -324,8 +325,10 @@ GtkWidget *create_editor(void) - _accgroup = gtk_accel_group_new(); - gtk_window_add_accel_group(GTK_WINDOW(result), _accgroup); + accgroup = gtk_accel_group_new(); + set_accel_group(accgroup); + + gtk_window_add_accel_group(GTK_WINDOW(result), accgroup); @@ -336,7 +339,7 @@ GtkWidget *create_editor(void) /* Intégration des menus */ - editem = g_menu_bar_new(ref, _accgroup); + editem = g_menu_bar_new(ref); register_editor_item(editem); menuboard = g_editor_item_get_widget(editem); @@ -1486,7 +1489,7 @@ static void on_dock_menu_request(GtkDockStation *station, GtkWidget *button, gpo bindings = gtk_panel_item_get_key_bindings(panel); if (bindings != NULL) - add_accelerator_to_menu_item(submenuitem, bindings, _accgroup); + add_accelerator_to_widget(submenuitem, bindings); gtk_container_add(support, submenuitem); diff --git a/src/gui/menus/binary.c b/src/gui/menus/binary.c index 1360011..954f3d4 100644 --- a/src/gui/menus/binary.c +++ b/src/gui/menus/binary.c @@ -28,6 +28,7 @@ #include +#include "../agroup.h" #include "../editem-int.h" #include "../core/global.h" #include "../dialogs/export.h" @@ -54,9 +55,8 @@ static void mcb_binary_export(GtkMenuItem *, GMenuBar *); /****************************************************************************** * * -* Paramètres : ref = espace de référencement global. * -* accgroup = groupe d'accélérateurs pour les menus. * -* bar = barre de menu parente. * +* Paramètres : ref = espace de référencement global. * +* bar = barre de menu parente. * * * * Description : Construit le menu "Binaire". * * * @@ -66,7 +66,7 @@ static void mcb_binary_export(GtkMenuItem *, GMenuBar *); * * ******************************************************************************/ -GtkWidget *build_menu_binary(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar) +GtkWidget *build_menu_binary(GObject *ref, GMenuBar *bar) { GtkWidget *result; /* Support à retourner */ GtkWidget *menubar; /* Support pour éléments */ @@ -79,7 +79,7 @@ GtkWidget *build_menu_binary(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *ba submenuitem = qck_create_menu_item(ref, "mnu_binary_epoints", _("Entry points"), G_CALLBACK(mcb_binary_entry_points), bar); - add_accelerator_to_menu_item(submenuitem, "E", accgroup); + add_accelerator_to_widget(submenuitem, "E"); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); submenuitem = qck_create_menu_separator(); diff --git a/src/gui/menus/binary.h b/src/gui/menus/binary.h index 45140b6..c68b67c 100644 --- a/src/gui/menus/binary.h +++ b/src/gui/menus/binary.h @@ -35,7 +35,7 @@ /* Construit le menu "Binaire". */ -GtkWidget *build_menu_binary(GObject *, GtkAccelGroup *, GMenuBar *); +GtkWidget *build_menu_binary(GObject *, GMenuBar *); /* Réagit à un changement d'affichage principal de contenu. */ void update_access_for_content_in_menu_binary(GLoadedContent *); diff --git a/src/gui/menus/debug.c b/src/gui/menus/debug.c index 3e785b5..8684e49 100644 --- a/src/gui/menus/debug.c +++ b/src/gui/menus/debug.c @@ -28,8 +28,10 @@ #include -#include +#include + +#include "../agroup.h" #include "../../debug/debugger.h" /* REMME ! */ #include "../../gtkext/easygtk.h" @@ -72,8 +74,7 @@ static void mcb_debug_options(GtkMenuItem *, GObject *); /****************************************************************************** * * -* Paramètres : ref = espace de référencement global. * -* accgroup = groupe d'accélérateurs pour les menus. * +* Paramètres : ref = espace de référencement global. * * * * Description : Construit le menu "Aide". * * * @@ -83,7 +84,7 @@ static void mcb_debug_options(GtkMenuItem *, GObject *); * * ******************************************************************************/ -GtkWidget *build_menu_debug(GObject *ref, GtkAccelGroup *accgroup) +GtkWidget *build_menu_debug(GObject *ref) { GtkWidget *result; /* Support à retourner */ GtkWidget *menubar; /* Support pour éléments */ @@ -96,17 +97,17 @@ GtkWidget *build_menu_debug(GObject *ref, GtkAccelGroup *accgroup) submenuitem = qck_create_menu_item(ref, "mnu_debug_continue", _("Continue"), G_CALLBACK(mcb_debug_continue), ref); - add_accelerator_to_menu_item(submenuitem, "F9", accgroup); + 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_menu_item(submenuitem, "F9", accgroup); + add_accelerator_to_widget(submenuitem, "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_menu_item(submenuitem, "F10", accgroup); + add_accelerator_to_widget(submenuitem, "F10"); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); submenuitem = qck_create_menu_item(ref, "mnu_debug_restart", _("Restart"), @@ -122,27 +123,27 @@ GtkWidget *build_menu_debug(GObject *ref, GtkAccelGroup *accgroup) submenuitem = qck_create_menu_item(ref, "mnu_debug_step_into", _("Step into"), G_CALLBACK(mcb_debug_step_into), ref); - add_accelerator_to_menu_item(submenuitem, "F7", accgroup); + 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_menu_item(submenuitem, "F7", accgroup); + add_accelerator_to_widget(submenuitem, "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_menu_item(submenuitem, "F8", accgroup); + 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_menu_item(submenuitem, "F8", accgroup); + add_accelerator_to_widget(submenuitem, "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_menu_item(submenuitem, "F12", accgroup); + add_accelerator_to_widget(submenuitem, "F12"); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); submenuitem = qck_create_menu_separator(); diff --git a/src/gui/menus/debug.h b/src/gui/menus/debug.h index 1ca6853..e8405ea 100644 --- a/src/gui/menus/debug.h +++ b/src/gui/menus/debug.h @@ -31,7 +31,7 @@ /* Construit le menu "Aide". */ -GtkWidget *build_menu_debug(GObject *, GtkAccelGroup *); +GtkWidget *build_menu_debug(GObject *); diff --git a/src/gui/menus/edition.c b/src/gui/menus/edition.c index 4a24d33..80c0796 100644 --- a/src/gui/menus/edition.c +++ b/src/gui/menus/edition.c @@ -31,6 +31,7 @@ #include +#include "../agroup.h" #include "../core/global.h" #include "../dialogs/bookmark.h" #include "../dialogs/goto.h" @@ -82,9 +83,8 @@ static void mcb_edition_comment_enter_next(GtkMenuItem *, GMenuBar *); /****************************************************************************** * * -* Paramètres : ref = espace de référencement global. * -* accgroup = groupe d'accélérateurs pour les menus. * -* bar = barre de menu parente. * +* Paramètres : ref = espace de référencement global. * +* bar = barre de menu parente. * * * * Description : Construit le menu "Edition". * * * @@ -94,7 +94,7 @@ static void mcb_edition_comment_enter_next(GtkMenuItem *, GMenuBar *); * * ******************************************************************************/ -GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar) +GtkWidget *build_menu_edition(GObject *ref, GMenuBar *bar) { GtkWidget *result; /* Support à retourner */ GtkWidget *menubar; /* Support pour éléments */ @@ -111,7 +111,7 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b submenuitem = qck_create_menu_item(ref, "mnu_edit_goto", _("Go to address..."), G_CALLBACK(mcb_edition_goto), bar); - add_accelerator_to_menu_item(submenuitem, "G", accgroup); + add_accelerator_to_widget(submenuitem, "G"); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); /* Séparation */ @@ -128,25 +128,25 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b deepmenuitem = qck_create_menu_item(ref, "mnu_edit_switch_hex", _("Hexadecimal"), G_CALLBACK(mcb_edition_switch_numeric_operand), NULL); - add_accelerator_to_menu_item(deepmenuitem, "H", accgroup); + 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_menu_item(deepmenuitem, "D", accgroup); + 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_menu_item(deepmenuitem, "O", accgroup); + 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_menu_item(deepmenuitem, "B", accgroup); + 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); @@ -167,17 +167,17 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b submenuitem = qck_create_menu_item(ref, "mnu_edit_go_back", _("Go back"), G_CALLBACK(mcb_edition_go_back), bar); - add_accelerator_to_menu_item(submenuitem, "Escape", accgroup); + 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_menu_item(submenuitem, "Return", accgroup); + 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_menu_item(submenuitem, "X", accgroup); + add_accelerator_to_widget(submenuitem, "X"); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); /* Séparation */ @@ -194,7 +194,7 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b deepmenuitem = qck_create_menu_item(ref, "mnu_edit_toggle_bmark", _("Toggle at current location"), G_CALLBACK(mcb_edition_bookmarks_toggle), bar); - add_accelerator_to_menu_item(deepmenuitem, "D", accgroup); + add_accelerator_to_widget(deepmenuitem, "D"); gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem); deepmenuitem = qck_create_menu_item(ref, "mnu_edit_delete_bmarks", _("Delete all bookmarks"), @@ -210,22 +210,22 @@ GtkWidget *build_menu_edition(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *b deepmenuitem = qck_create_menu_item(ref, "mnu_edit_enter_comment", _("Enter a comment..."), G_CALLBACK(mcb_edition_comment_enter), bar); - add_accelerator_to_menu_item(deepmenuitem, "semicolon", accgroup); + 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_menu_item(deepmenuitem, "colon", accgroup); + 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_menu_item(deepmenuitem, "Insert", accgroup); + 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_menu_item(deepmenuitem, "Insert", accgroup); + add_accelerator_to_widget(deepmenuitem, "Insert"); gtk_container_add(GTK_CONTAINER(deepmenubar), deepmenuitem); return result; diff --git a/src/gui/menus/edition.h b/src/gui/menus/edition.h index a49e320..596ceba 100644 --- a/src/gui/menus/edition.h +++ b/src/gui/menus/edition.h @@ -35,7 +35,7 @@ /* Construit le menu "Edition". */ -GtkWidget *build_menu_edition(GObject *, GtkAccelGroup *, GMenuBar *); +GtkWidget *build_menu_edition(GObject *, GMenuBar *); /* Lance une actualisation du fait d'un changement de support. */ void update_access_for_view_in_menu_edition(GLoadedPanel *); diff --git a/src/gui/menus/file.c b/src/gui/menus/file.c index 9c0b218..ffe3e9e 100644 --- a/src/gui/menus/file.c +++ b/src/gui/menus/file.c @@ -28,6 +28,7 @@ #include +#include "../agroup.h" #include "../core/global.h" #include "../../analysis/project.h" #include "../../core/global.h" @@ -54,8 +55,7 @@ static void mcb_file_quit(GtkMenuItem *, GObject *); /****************************************************************************** * * -* Paramètres : ref = espace de référencement global. * -* accgroup = groupe d'accélérateurs pour les menus. * +* Paramètres : ref = espace de référencement global. * * * * Description : Construit le menu "Fichier". * * * @@ -65,7 +65,7 @@ static void mcb_file_quit(GtkMenuItem *, GObject *); * * ******************************************************************************/ -GtkWidget *build_menu_file(GObject *ref, GtkAccelGroup *accgroup) +GtkWidget *build_menu_file(GObject *ref) { GtkWidget *result; /* Support à retourner */ GtkWidget *menubar; /* Support pour éléments */ @@ -80,7 +80,7 @@ GtkWidget *build_menu_file(GObject *ref, GtkAccelGroup *accgroup) submenuitem = qck_create_menu_item(NULL, NULL, _("New project"), G_CALLBACK(mcb_file_new_project), NULL); - add_accelerator_to_menu_item(submenuitem, "N", accgroup); + add_accelerator_to_widget(submenuitem, "N"); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); submenuitem = qck_create_menu_separator(); @@ -88,7 +88,7 @@ GtkWidget *build_menu_file(GObject *ref, GtkAccelGroup *accgroup) submenuitem = qck_create_menu_item(NULL, NULL, _("Open project"), G_CALLBACK(mcb_file_open_project), NULL); - add_accelerator_to_menu_item(submenuitem, "O", accgroup); + add_accelerator_to_widget(submenuitem, "O"); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); submenuitem = qck_create_menu_item(NULL, NULL, _("Recent projects..."), NULL, NULL); @@ -109,7 +109,7 @@ GtkWidget *build_menu_file(GObject *ref, GtkAccelGroup *accgroup) submenuitem = qck_create_menu_item(NULL, NULL, _("Save project"), G_CALLBACK(mcb_file_save_project), NULL); - add_accelerator_to_menu_item(submenuitem, "S", accgroup); + add_accelerator_to_widget(submenuitem, "S"); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); submenuitem = qck_create_menu_item(NULL, NULL, _("Save project as..."), @@ -120,7 +120,7 @@ GtkWidget *build_menu_file(GObject *ref, GtkAccelGroup *accgroup) gtk_container_add(GTK_CONTAINER(menubar), submenuitem); submenuitem = qck_create_menu_item(NULL, NULL, _("Quit"), G_CALLBACK(mcb_file_quit), ref); - add_accelerator_to_menu_item(submenuitem, "Q", accgroup); + add_accelerator_to_widget(submenuitem, "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 f73eb85..f176c7f 100644 --- a/src/gui/menus/file.h +++ b/src/gui/menus/file.h @@ -31,7 +31,7 @@ /* Construit le menu "Fichier". */ -GtkWidget *build_menu_file(GObject *, GtkAccelGroup *); +GtkWidget *build_menu_file(GObject *); diff --git a/src/gui/menus/help.c b/src/gui/menus/help.c index 922fa31..0371e20 100644 --- a/src/gui/menus/help.c +++ b/src/gui/menus/help.c @@ -40,8 +40,7 @@ static void mcb_help_about(GtkMenuItem *, GObject *); /****************************************************************************** * * -* Paramètres : ref = espace de référencement global. * -* accgroup = groupe d'accélérateurs pour les menus. * +* Paramètres : ref = espace de référencement global. * * * * Description : Construit le menu "Aide". * * * @@ -51,7 +50,7 @@ static void mcb_help_about(GtkMenuItem *, GObject *); * * ******************************************************************************/ -GtkWidget *build_menu_help(GObject *ref, GtkAccelGroup *accgroup) +GtkWidget *build_menu_help(GObject *ref) { GtkWidget *result; /* Support à retourner */ GtkWidget *menubar; /* Support pour éléments */ diff --git a/src/gui/menus/help.h b/src/gui/menus/help.h index 85d18f8..dd83116 100644 --- a/src/gui/menus/help.h +++ b/src/gui/menus/help.h @@ -31,7 +31,7 @@ /* Construit le menu "Aide". */ -GtkWidget *build_menu_help(GObject *, GtkAccelGroup *); +GtkWidget *build_menu_help(GObject *); diff --git a/src/gui/menus/menubar.c b/src/gui/menus/menubar.c index 7bc7e85..2e81619 100644 --- a/src/gui/menus/menubar.c +++ b/src/gui/menus/menubar.c @@ -192,8 +192,7 @@ static void g_menu_bar_finalize(GMenuBar *bar) /****************************************************************************** * * -* Paramètres : ref = espace de référencement global. * -* accgroup = groupe d'accélérateurs pour les menus. * +* Paramètres : ref = espace de référencement global. * * * * Description : Compose la barre de menus principale. * * * @@ -203,15 +202,13 @@ static void g_menu_bar_finalize(GMenuBar *bar) * * ******************************************************************************/ -GEditorItem *g_menu_bar_new(GObject *ref, GtkAccelGroup *accgroup) +GEditorItem *g_menu_bar_new(GObject *ref) { GMenuBar *result; /* Structure à retourner */ GEditorItem *item; /* Autre version de l'élément */ result = g_object_new(G_TYPE_MENU_BAR, NULL); - g_object_set_data(G_OBJECT(result), "accgroup", accgroup); - /* Initialisation générique */ item = G_EDITOR_ITEM(result); @@ -221,47 +218,47 @@ GEditorItem *g_menu_bar_new(GObject *ref, GtkAccelGroup *accgroup) /* Fichier */ - result->file = build_menu_file(ref, accgroup); + result->file = build_menu_file(ref); gtk_container_add(GTK_CONTAINER(item->widget), result->file); /* Edition */ - result->edition = build_menu_edition(ref, accgroup, result); + result->edition = build_menu_edition(ref, result); gtk_container_add(GTK_CONTAINER(item->widget), result->edition); /* Affichage */ - result->view = build_menu_view(ref, accgroup, result); + result->view = build_menu_view(ref, result); gtk_container_add(GTK_CONTAINER(item->widget), result->view); /* Projet */ - result->project = build_menu_project(ref, accgroup, result); + result->project = build_menu_project(ref, result); gtk_container_add(GTK_CONTAINER(item->widget), result->project); /* Binaire */ - result->binary = build_menu_binary(ref, accgroup, result); + result->binary = build_menu_binary(ref, result); gtk_container_add(GTK_CONTAINER(item->widget), result->binary); /* Débogage */ - result->debug = build_menu_debug(ref, accgroup); + result->debug = build_menu_debug(ref); gtk_container_add(GTK_CONTAINER(item->widget), result->debug); /* Outils */ - result->tools = build_menu_tools(ref, accgroup, result); + result->tools = build_menu_tools(ref, result); gtk_container_add(GTK_CONTAINER(item->widget), result->tools); /* Greffons */ - result->plugins = build_menu_plugins(ref, accgroup); + result->plugins = build_menu_plugins(ref); gtk_container_add(GTK_CONTAINER(item->widget), result->plugins); /* Aide */ - result->help = build_menu_help(ref, accgroup); + result->help = build_menu_help(ref); gtk_container_add(GTK_CONTAINER(item->widget), result->help); return G_EDITOR_ITEM(result); diff --git a/src/gui/menus/menubar.h b/src/gui/menus/menubar.h index d943566..591442b 100644 --- a/src/gui/menus/menubar.h +++ b/src/gui/menus/menubar.h @@ -49,7 +49,7 @@ typedef struct _GMenuBarClass GMenuBarClass; GType g_menu_bar_get_type(void); /* Compose la barre de menus principale. */ -GEditorItem *g_menu_bar_new(GObject *, GtkAccelGroup *); +GEditorItem *g_menu_bar_new(GObject *); diff --git a/src/gui/menus/plugins.c b/src/gui/menus/plugins.c index c1b0fc7..36c7eff 100644 --- a/src/gui/menus/plugins.c +++ b/src/gui/menus/plugins.c @@ -37,8 +37,7 @@ /****************************************************************************** * * -* Paramètres : ref = espace de référencement global. * -* accgroup = groupe d'accélérateurs pour les menus. * +* Paramètres : ref = espace de référencement global. * * * * Description : Construit le menu "Aide". * * * @@ -48,7 +47,7 @@ * * ******************************************************************************/ -GtkWidget *build_menu_plugins(GObject *ref, GtkAccelGroup *accgroup) +GtkWidget *build_menu_plugins(GObject *ref) { GtkWidget *result; /* Support à retourner */ GtkWidget *menubar; /* Support pour éléments */ diff --git a/src/gui/menus/plugins.h b/src/gui/menus/plugins.h index 21a19a6..a3a8f50 100644 --- a/src/gui/menus/plugins.h +++ b/src/gui/menus/plugins.h @@ -31,7 +31,7 @@ /* Construit le menu "Aide". */ -GtkWidget *build_menu_plugins(GObject *, GtkAccelGroup *); +GtkWidget *build_menu_plugins(GObject *); diff --git a/src/gui/menus/project.c b/src/gui/menus/project.c index 20da138..a6a078b 100644 --- a/src/gui/menus/project.c +++ b/src/gui/menus/project.c @@ -49,9 +49,8 @@ static void mcb_project_remove_content(GtkMenuItem *, GStudyProject *); /****************************************************************************** * * -* Paramètres : ref = espace de référencement global. * -* accgroup = groupe d'accélérateurs pour les menus. * -* bar = barre de menu parente. * +* Paramètres : ref = espace de référencement global. * +* bar = barre de menu parente. * * * * Description : Construit le menu "Projet". * * * @@ -61,7 +60,7 @@ static void mcb_project_remove_content(GtkMenuItem *, GStudyProject *); * * ******************************************************************************/ -GtkWidget *build_menu_project(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar) +GtkWidget *build_menu_project(GObject *ref, GMenuBar *bar) { GtkWidget *result; /* Support à retourner */ GtkWidget *menubar; /* Support pour éléments #1 */ diff --git a/src/gui/menus/project.h b/src/gui/menus/project.h index 3754914..204846a 100644 --- a/src/gui/menus/project.h +++ b/src/gui/menus/project.h @@ -35,7 +35,7 @@ /* Construit le menu "Projet". */ -GtkWidget *build_menu_project(GObject *, GtkAccelGroup *, GMenuBar *); +GtkWidget *build_menu_project(GObject *, GMenuBar *); /* Lance une actualisation relative à l'étendue du projet. */ void update_menu_project_for_project(GtkWidget *, GStudyProject *, GMenuBar *); diff --git a/src/gui/menus/tools.c b/src/gui/menus/tools.c index 2ec9551..d606c02 100644 --- a/src/gui/menus/tools.c +++ b/src/gui/menus/tools.c @@ -41,9 +41,8 @@ static void mcb_tools_identity(GtkMenuItem *, GMenuBar *); /****************************************************************************** * * -* Paramètres : ref = espace de référencement global. * -* accgroup = groupe d'accélérateurs pour les menus. * -* bar = barre de menu parente. * +* Paramètres : ref = espace de référencement global. * +* bar = barre de menu parente. * * * * Description : Construit le menu "Outils". * * * @@ -53,7 +52,7 @@ static void mcb_tools_identity(GtkMenuItem *, GMenuBar *); * * ******************************************************************************/ -GtkWidget *build_menu_tools(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar) +GtkWidget *build_menu_tools(GObject *ref, GMenuBar *bar) { GtkWidget *result; /* Support à retourner */ GtkWidget *menubar; /* Support pour éléments */ diff --git a/src/gui/menus/tools.h b/src/gui/menus/tools.h index 0c76137..441e46d 100644 --- a/src/gui/menus/tools.h +++ b/src/gui/menus/tools.h @@ -34,7 +34,7 @@ /* Construit le menu "Outils". */ -GtkWidget *build_menu_tools(GObject *, GtkAccelGroup *, GMenuBar *); +GtkWidget *build_menu_tools(GObject *, GMenuBar *); diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c index f0e7450..d446278 100644 --- a/src/gui/menus/view.c +++ b/src/gui/menus/view.c @@ -31,6 +31,7 @@ #include +#include "../agroup.h" #include "../editem-int.h" #include "../core/global.h" #include "../core/items.h" @@ -73,9 +74,8 @@ static void mcb_view_show_full_screen(GtkCheckMenuItem *, GMenuBar *); /****************************************************************************** * * -* Paramètres : ref = espace de référencement global. * -* accgroup = groupe d'accélérateurs pour les menus. * -* bar = barre de menu parente. * +* Paramètres : ref = espace de référencement global. * +* bar = barre de menu parente. * * * * Description : Construit le menu "Affichage". * * * @@ -85,7 +85,7 @@ static void mcb_view_show_full_screen(GtkCheckMenuItem *, GMenuBar *); * * ******************************************************************************/ -GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar) +GtkWidget *build_menu_view(GObject *ref, GMenuBar *bar) { GtkWidget *result; /* Support à retourner */ GtkWidget *menubar; /* Support pour éléments */ @@ -114,7 +114,7 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar) submenuitem = qck_create_radio_menu_item(ref, "mnu_view_switch_textview", NULL, _("Text view"), G_CALLBACK(mcb_view_change_support), NULL); - add_accelerator_to_menu_item(submenuitem, "F3", accgroup); + add_accelerator_to_widget(submenuitem, "F3"); g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_BLOCK)); g_object_set_data(G_OBJECT(submenuitem), "kind_of_display", GSIZE_TO_POINTER(GTK_TYPE_BLOCK_DISPLAY)); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); @@ -123,19 +123,19 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar) submenuitem = qck_create_radio_menu_item(ref, "mnu_view_switch_graphview", rgroup, _("Graph view"), G_CALLBACK(mcb_view_change_support), NULL); - add_accelerator_to_menu_item(submenuitem, "F4", accgroup); + add_accelerator_to_widget(submenuitem, "F4"); g_object_set_data(G_OBJECT(submenuitem), "kind_of_view", GUINT_TO_POINTER(BVW_GRAPH)); g_object_set_data(G_OBJECT(submenuitem), "kind_of_display", GSIZE_TO_POINTER(GTK_TYPE_GRAPH_DISPLAY)); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); submenuitem = qck_create_menu_item(ref, "mcb_view_switch_to_next_support", _("Switch to next"), G_CALLBACK(mcb_view_switch_to_next_support), NULL); - add_accelerator_to_menu_item(submenuitem, "Tab", accgroup); + add_accelerator_to_widget(submenuitem, "Tab"); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); submenuitem = qck_create_menu_item(ref, "mcb_view_switch_to_prev_support", _("Switch to previous"), G_CALLBACK(mcb_view_switch_to_prev_support), NULL); - add_accelerator_to_menu_item(submenuitem, "Tab", accgroup); + add_accelerator_to_widget(submenuitem, "Tab"); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); /* Séparation */ @@ -169,7 +169,7 @@ GtkWidget *build_menu_view(GObject *ref, GtkAccelGroup *accgroup, GMenuBar *bar) submenuitem = qck_create_check_menu_item(NULL, NULL, _("Full screen"), G_CALLBACK(mcb_view_show_full_screen), bar); - add_accelerator_to_menu_item(submenuitem, "F11", accgroup); + add_accelerator_to_widget(submenuitem, "F11"); gtk_container_add(GTK_CONTAINER(menubar), submenuitem); return result; @@ -404,12 +404,10 @@ static void update_switch_access_in_menu_view(void) static void mcb_view_update_side_panels_list(GtkMenuItem *menuitem, GMenuBar *bar) { GtkWidget *menubar; /* Support pour éléments */ - GtkAccelGroup *accgroup; /* Groupe de raccourcis */ typedef struct _panels_loading_filter { GtkContainer *support; /* Support pour éléments */ - GtkAccelGroup *accel; /* Groupe de raccourcis */ PanelItemPersonality personality; /* Nature des éléments attendus*/ bool first; /* Premier ajout ? */ @@ -463,7 +461,7 @@ static void mcb_view_update_side_panels_list(GtkMenuItem *menuitem, GMenuBar *ba bindings = gtk_panel_item_get_key_bindings(panel); if (bindings != NULL) - add_accelerator_to_menu_item(submenuitem, bindings, filter->accel); + add_accelerator_to_widget(submenuitem, bindings); gtk_container_add(filter->support, submenuitem); @@ -485,10 +483,7 @@ static void mcb_view_update_side_panels_list(GtkMenuItem *menuitem, GMenuBar *ba } - accgroup = GTK_ACCEL_GROUP(g_object_get_data(G_OBJECT(bar), "accgroup")); - pfilter.support = GTK_CONTAINER(menubar); - pfilter.accel = accgroup; pfilter.personality = PIP_SINGLETON; pfilter.first = false; diff --git a/src/gui/menus/view.h b/src/gui/menus/view.h index 5216bcb..fadf881 100644 --- a/src/gui/menus/view.h +++ b/src/gui/menus/view.h @@ -35,7 +35,7 @@ /* Construit le menu "Affichage". */ -GtkWidget *build_menu_view(GObject *, GtkAccelGroup *, GMenuBar *); +GtkWidget *build_menu_view(GObject *, GMenuBar *); /* Lance une actualisation du fait d'un changement de vue. */ void rebuild_menu_view(GtkWidget *, GLoadedPanel *, GMenuBar *); diff --git a/src/gui/panels/bintree.c b/src/gui/panels/bintree.c index 5c8a19e..5da7e99 100644 --- a/src/gui/panels/bintree.c +++ b/src/gui/panels/bintree.c @@ -35,6 +35,7 @@ #include "panel-int.h" #include "updating-int.h" +#include "../agroup.h" #include "../core/global.h" #include "../../core/queue.h" #include "../../gtkext/gtkdisplaypanel.h" diff --git a/src/gui/panels/bintree.ui b/src/gui/panels/bintree.ui index 90aac50..ff7f60e 100644 --- a/src/gui/panels/bintree.ui +++ b/src/gui/panels/bintree.ui @@ -125,6 +125,8 @@ 1 adjustment1 True + + diff --git a/src/gui/panels/regedit.c b/src/gui/panels/regedit.c index bc19009..a0761aa 100644 --- a/src/gui/panels/regedit.c +++ b/src/gui/panels/regedit.c @@ -36,6 +36,7 @@ #include "panel-int.h" +#include "../agroup.h" #include "../../core/params.h" #include "../../common/cpp.h" #include "../../common/extstr.h" @@ -246,6 +247,8 @@ static void g_regedit_panel_init(GRegeditPanel *panel) search = gtk_search_entry_new(); g_signal_connect(search, "search-changed", G_CALLBACK(on_param_search_changed), panel); + g_signal_connect(search, "focus-in-event", G_CALLBACK(track_focus_change_in_text_area), NULL); + g_signal_connect(search, "focus-out-event", G_CALLBACK(track_focus_change_in_text_area), NULL); gtk_widget_show(search); gtk_widget_set_hexpand(search, TRUE); gtk_grid_attach_next_to(GTK_GRID(base->widget), search, label, GTK_POS_RIGHT, 1, 1); diff --git a/src/gui/panels/symbols.c b/src/gui/panels/symbols.c index ab138e8..74d1cf9 100644 --- a/src/gui/panels/symbols.c +++ b/src/gui/panels/symbols.c @@ -38,6 +38,7 @@ #include "panel-int.h" #include "updating-int.h" +#include "../agroup.h" #include "../core/global.h" #include "../../common/extstr.h" #include "../../core/paths.h" @@ -380,6 +381,7 @@ static void g_symbols_panel_init(GSymbolsPanel *panel) "reorganize_symbols_tree_view", G_CALLBACK(reorganize_symbols_tree_view), "on_symbols_filter_changed", G_CALLBACK(on_symbols_filter_changed), "on_symbols_selection_change", G_CALLBACK(on_symbols_selection_change), + "track_focus_change_in_text_area", G_CALLBACK(track_focus_change_in_text_area), NULL); gtk_builder_connect_signals(builder, panel); diff --git a/src/gui/panels/symbols.ui b/src/gui/panels/symbols.ui index 284e00a..3c34a29 100644 --- a/src/gui/panels/symbols.ui +++ b/src/gui/panels/symbols.ui @@ -170,6 +170,8 @@ edit-find-symbolic False False + + diff --git a/src/gui/status.h b/src/gui/status.h index 7904124..97e12c6 100644 --- a/src/gui/status.h +++ b/src/gui/status.h @@ -53,4 +53,4 @@ GEditorItem *g_status_info_new(GObject *); -#endif /* _GUI_MENUS_MENUBAR_H */ +#endif /* _GUI_STATUS_H */ -- cgit v0.11.2-87-g4458