diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2020-08-08 21:37:21 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2020-08-08 21:37:21 (GMT) |
commit | 4370d2d77d623f560c7df94a3bc15b1395e4878b (patch) | |
tree | 57cc6268f504c19aaac3b1adda4295ed3b1ddc7f /src/gui/menus | |
parent | 34d28c7418342d3c67be4747b13cdcb124edda32 (diff) |
Updated all the code relative to GUI items.
Diffstat (limited to 'src/gui/menus')
-rw-r--r-- | src/gui/menus/binary.c | 2 | ||||
-rw-r--r-- | src/gui/menus/menubar.c | 108 | ||||
-rw-r--r-- | src/gui/menus/menubar.h | 2 | ||||
-rw-r--r-- | src/gui/menus/options.c | 2 | ||||
-rw-r--r-- | src/gui/menus/project.c | 2 | ||||
-rw-r--r-- | src/gui/menus/view.c | 10 |
6 files changed, 91 insertions, 35 deletions
diff --git a/src/gui/menus/binary.c b/src/gui/menus/binary.c index b307333..9e85520 100644 --- a/src/gui/menus/binary.c +++ b/src/gui/menus/binary.c @@ -29,7 +29,7 @@ #include "../agroup.h" -#include "../editem-int.h" +#include "../item-int.h" #include "../core/global.h" #include "../dialogs/export_disass.h" #include "../dialogs/export_graph.h" diff --git a/src/gui/menus/menubar.c b/src/gui/menus/menubar.c index 08e9e5e..44761b9 100644 --- a/src/gui/menus/menubar.c +++ b/src/gui/menus/menubar.c @@ -25,6 +25,9 @@ #include "menubar.h" +#include <string.h> + + #include "binary.h" #include "debug.h" #include "edition.h" @@ -34,7 +37,7 @@ #include "plugins.h" #include "project.h" #include "view.h" -#include "../editem-int.h" +#include "../item-int.h" #include "../core/global.h" @@ -44,6 +47,8 @@ struct _GMenuBar { GEditorItem parent; /* A laisser en premier */ + GtkWidget *support; /* Composant principal */ + GtkWidget *file; /* Menu "Fichier" */ GtkWidget *edition; /* Menu "Edition" */ GtkWidget *view; /* Menu "Affichage" */ @@ -77,6 +82,12 @@ static void g_menu_bar_dispose(GMenuBar *); /* Procède à la libération totale de la mémoire. */ static void g_menu_bar_finalize(GMenuBar *); +/* Fournit le nom humain attribué à l'élément réactif. */ +static char *g_menu_bar_get_key(const GMenuBar *); + +/* Fournit le composant GTK associé à l'élément réactif. */ +static GtkWidget *g_menu_bar_get_widget(const GMenuBar *); + /* Réagit à un changement d'affichage principal de contenu. */ static void change_menubar_current_content(GMenuBar *, GLoadedContent *, GLoadedContent *); @@ -110,19 +121,22 @@ G_DEFINE_TYPE(GMenuBar, g_menu_bar, G_TYPE_EDITOR_ITEM); static void g_menu_bar_class_init(GMenuBarClass *klass) { GObjectClass *object; /* Autre version de la classe */ - GEditorItemClass *editem; /* Encore une autre vision... */ + GEditorItemClass *item; /* Encore une autre vision... */ object = G_OBJECT_CLASS(klass); object->dispose = (GObjectFinalizeFunc/* ! */)g_menu_bar_dispose; object->finalize = (GObjectFinalizeFunc)g_menu_bar_finalize; - editem = G_EDITOR_ITEM_CLASS(klass); + item = G_EDITOR_ITEM_CLASS(klass); + + item->get_key = (get_item_key_fc)g_menu_bar_get_key; + item->get_widget = (get_item_widget_fc)g_menu_bar_get_widget; - editem->change_content = (change_item_content_fc)change_menubar_current_content; - editem->change_view = (change_item_view_fc)change_menubar_current_view; - editem->track_cursor = (track_cursor_in_view_fc)track_caret_address_for_menu_bar; - editem->update_project = (update_project_fc)update_menu_bar_for_project; + item->change_content = (change_item_content_fc)change_menubar_current_content; + item->change_view = (change_item_view_fc)change_menubar_current_view; + item->track_cursor = (track_cursor_in_view_fc)track_caret_address_for_menu_bar; + item->update_project = (update_project_fc)update_menu_bar_for_project; } @@ -141,14 +155,8 @@ static void g_menu_bar_class_init(GMenuBarClass *klass) static void g_menu_bar_init(GMenuBar *bar) { - GEditorItem *item; /* Autre version de l'élément */ - - item = G_EDITOR_ITEM(bar); - - item->name = "menus"; - - item->widget = gtk_menu_bar_new(); - gtk_widget_show(item->widget); + bar->support = gtk_menu_bar_new(); + gtk_widget_show(bar->support); } @@ -206,56 +214,53 @@ static void g_menu_bar_finalize(GMenuBar *bar) 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); - item = G_EDITOR_ITEM(result); - /* Fichier */ result->file = build_menu_file(); - gtk_container_add(GTK_CONTAINER(item->widget), result->file); + gtk_container_add(GTK_CONTAINER(result->support), result->file); /* Edition */ result->edition = build_menu_edition(ref, result); - gtk_container_add(GTK_CONTAINER(item->widget), result->edition); + gtk_container_add(GTK_CONTAINER(result->support), result->edition); /* Affichage */ result->view = build_menu_view(ref, result); - gtk_container_add(GTK_CONTAINER(item->widget), result->view); + gtk_container_add(GTK_CONTAINER(result->support), result->view); /* Projet */ result->project = build_menu_project(ref, result); - gtk_container_add(GTK_CONTAINER(item->widget), result->project); + gtk_container_add(GTK_CONTAINER(result->support), result->project); /* Binaire */ result->binary = build_menu_binary(ref, result); - gtk_container_add(GTK_CONTAINER(item->widget), result->binary); + gtk_container_add(GTK_CONTAINER(result->support), result->binary); /* Débogage */ result->debug = build_menu_debug(ref); - gtk_container_add(GTK_CONTAINER(item->widget), result->debug); + gtk_container_add(GTK_CONTAINER(result->support), result->debug); /* Options */ result->options = build_menu_options(ref, result); - gtk_container_add(GTK_CONTAINER(item->widget), result->options); + gtk_container_add(GTK_CONTAINER(result->support), result->options); /* Greffons */ result->plugins = build_menu_plugins(ref); - gtk_container_add(GTK_CONTAINER(item->widget), result->plugins); + gtk_container_add(GTK_CONTAINER(result->support), result->plugins); /* Aide */ result->help = build_menu_help(); - gtk_container_add(GTK_CONTAINER(item->widget), result->help); + gtk_container_add(GTK_CONTAINER(result->support), result->help); return G_EDITOR_ITEM(result); @@ -264,6 +269,55 @@ GEditorItem *g_menu_bar_new(GObject *ref) /****************************************************************************** * * +* Paramètres : bar = instance à consulter. * +* * +* Description : Fournit le nom humain attribué à l'élément réactif. * +* * +* Retour : Désignation (courte) de l'élément de l'éditeur. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static char *g_menu_bar_get_key(const GMenuBar *bar) +{ + char *result; /* Description à renvoyer */ + + result = strdup("menus"); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : bar = instance à consulter. * +* * +* Description : Fournit le composant GTK associé à l'élément réactif. * +* * +* Retour : Instance de composant graphique chargé. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static GtkWidget *g_menu_bar_get_widget(const GMenuBar *bar) +{ + GtkWidget *result; /* Composant à retourner */ + + result = bar->support; + + if (result != NULL) + g_object_ref(G_OBJECT(result)); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : bar = barre de menus à mettre à jour. * * old = ancien contenu chargé analysé. * * new = nouveau contenu chargé à analyser. * diff --git a/src/gui/menus/menubar.h b/src/gui/menus/menubar.h index 4f0a450..5b77dc6 100644 --- a/src/gui/menus/menubar.h +++ b/src/gui/menus/menubar.h @@ -26,7 +26,7 @@ #define _GUI_MENUS_MENUBAR_H -#include "../editem.h" +#include "../item.h" diff --git a/src/gui/menus/options.c b/src/gui/menus/options.c index 981ae91..62f58f5 100644 --- a/src/gui/menus/options.c +++ b/src/gui/menus/options.c @@ -28,7 +28,7 @@ #include <i18n.h> -#include "../editem-int.h" +#include "../item-int.h" #include "../core/global.h" #include "../dialogs/identity.h" #include "../dialogs/preferences.h" diff --git a/src/gui/menus/project.c b/src/gui/menus/project.c index a5992bf..e472419 100644 --- a/src/gui/menus/project.c +++ b/src/gui/menus/project.c @@ -31,7 +31,7 @@ #include <string.h> -#include "../editem-int.h" +#include "../item-int.h" #include "../core/global.h" #include "../../analysis/loading.h" #include "../../analysis/contents/file.h" diff --git a/src/gui/menus/view.c b/src/gui/menus/view.c index b9451e0..c2f3f28 100644 --- a/src/gui/menus/view.c +++ b/src/gui/menus/view.c @@ -34,7 +34,7 @@ #include "../agroup.h" -#include "../editem-int.h" +#include "../item-int.h" #include "../core/global.h" #include "../core/items.h" #include "../core/panels.h" @@ -558,7 +558,7 @@ void mcb_view_update_side_panels_list(GtkMenuItem *menuitem, GMenuBar *bar) bool add_side_panel_to_list(GPanelItem *panel, panels_loading_filter *filter) { - const char *name; /* Désignation de l'entrée */ + char *key; /* Désignation de l'entrée */ GtkWidget *submenuitem; /* Sous-élément de menu */ const char *bindings; /* Raccourcis clavier bruts */ @@ -578,11 +578,13 @@ void mcb_view_update_side_panels_list(GtkMenuItem *menuitem, GMenuBar *bar) /* Elément de menu */ - name = g_editor_item_get_name(G_EDITOR_ITEM(panel)); + key = g_editor_item_get_key(G_EDITOR_ITEM(panel)); - submenuitem = qck_create_check_menu_item(NULL, NULL, name, + submenuitem = qck_create_check_menu_item(NULL, NULL, key, G_CALLBACK(mcb_view_change_panel_docking), panel); + free(key); + bindings = gtk_panel_item_get_key_bindings(panel); if (bindings != NULL) |