summaryrefslogtreecommitdiff
path: root/src/gui/menus
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-02-18 17:45:39 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-02-18 17:45:39 (GMT)
commit55184eaa3682f704ddb9e2da63cd14bc0a62b7a3 (patch)
treeb3e22bf071f647ba418ef7dc83e9d7bf2749c2ca /src/gui/menus
parent899291f3cbf9b90ccda7af0bee9c3ce3928df0be (diff)
Prepared room for an incoming preferences dialog box.
Diffstat (limited to 'src/gui/menus')
-rw-r--r--src/gui/menus/Makefile.am2
-rw-r--r--src/gui/menus/menubar.c10
-rw-r--r--src/gui/menus/options.c (renamed from src/gui/menus/tools.c)64
-rw-r--r--src/gui/menus/options.h (renamed from src/gui/menus/tools.h)14
4 files changed, 65 insertions, 25 deletions
diff --git a/src/gui/menus/Makefile.am b/src/gui/menus/Makefile.am
index d1e1564..49214e1 100644
--- a/src/gui/menus/Makefile.am
+++ b/src/gui/menus/Makefile.am
@@ -8,9 +8,9 @@ libguimenus_la_SOURCES = \
file.h file.c \
help.h help.c \
menubar.h menubar.c \
+ options.h options.c \
plugins.h plugins.c \
project.h project.c \
- tools.h tools.c \
view.h view.c
libguimenus_la_LDFLAGS =
diff --git a/src/gui/menus/menubar.c b/src/gui/menus/menubar.c
index 863ac54..886387c 100644
--- a/src/gui/menus/menubar.c
+++ b/src/gui/menus/menubar.c
@@ -30,9 +30,9 @@
#include "edition.h"
#include "file.h"
#include "help.h"
+#include "options.h"
#include "plugins.h"
#include "project.h"
-#include "tools.h"
#include "view.h"
#include "../editem-int.h"
@@ -49,7 +49,7 @@ struct _GMenuBar
GtkWidget *project; /* Menu "Projet" */
GtkWidget *binary; /* Menu "Binaire" */
GtkWidget *debug; /* Menu "Débogage" */
- GtkWidget *tools; /* Menu "Outils" */
+ GtkWidget *options; /* Menu "Options" */
GtkWidget *plugins; /* Menu "Greffons" */
GtkWidget *help; /* Menu "Aide" */
@@ -246,10 +246,10 @@ GEditorItem *g_menu_bar_new(GObject *ref)
result->debug = build_menu_debug(ref);
gtk_container_add(GTK_CONTAINER(item->widget), result->debug);
- /* Outils */
+ /* Options */
- result->tools = build_menu_tools(ref, result);
- gtk_container_add(GTK_CONTAINER(item->widget), result->tools);
+ result->options = build_menu_options(ref, result);
+ gtk_container_add(GTK_CONTAINER(item->widget), result->options);
/* Greffons */
diff --git a/src/gui/menus/tools.c b/src/gui/menus/options.c
index d606c02..3702d42 100644
--- a/src/gui/menus/tools.c
+++ b/src/gui/menus/options.c
@@ -1,8 +1,8 @@
/* Chrysalide - Outil d'analyse de fichiers binaires
- * tools.c - gestion du menu 'Outils'
+ * options.c - gestion du menu 'Options'
*
- * Copyright (C) 2017 Cyrille Bagard
+ * Copyright (C) 2019 Cyrille Bagard
*
* This binary is part of Chrysalide.
*
@@ -22,7 +22,7 @@
*/
-#include "tools.h"
+#include "options.h"
#include <i18n.h>
@@ -30,12 +30,16 @@
#include "../editem-int.h"
#include "../dialogs/identity.h"
+#include "../dialogs/preferences.h"
#include "../../gtkext/easygtk.h"
-/* Réagit au menu "Outils -> Identité". */
-static void mcb_tools_identity(GtkMenuItem *, GMenuBar *);
+/* Réagit au menu "Options -> Préférences". */
+static void mcb_options_preferences(GtkMenuItem *, GMenuBar *);
+
+/* Réagit au menu "Options -> Identité". */
+static void mcb_options_identity(GtkMenuItem *, GMenuBar *);
@@ -44,7 +48,7 @@ static void mcb_tools_identity(GtkMenuItem *, GMenuBar *);
* Paramètres : ref = espace de référencement global. *
* bar = barre de menu parente. *
* *
-* Description : Construit le menu "Outils". *
+* Description : Construit le menu "Options". *
* *
* Retour : Panneau de menus mis en place. *
* *
@@ -52,19 +56,23 @@ static void mcb_tools_identity(GtkMenuItem *, GMenuBar *);
* *
******************************************************************************/
-GtkWidget *build_menu_tools(GObject *ref, GMenuBar *bar)
+GtkWidget *build_menu_options(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(_("_Tools"));
+ 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_tools_identity", _("Identity"),
- G_CALLBACK(mcb_tools_identity), bar);
+ submenuitem = qck_create_menu_item(ref, "mnu_options_preferences", _("Preferences"),
+ G_CALLBACK(mcb_options_preferences), bar);
+ gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
+
+ submenuitem = qck_create_menu_item(ref, "mnu_options_identity", _("Identity"),
+ G_CALLBACK(mcb_options_identity), bar);
gtk_container_add(GTK_CONTAINER(menubar), submenuitem);
return result;
@@ -77,7 +85,39 @@ GtkWidget *build_menu_tools(GObject *ref, GMenuBar *bar)
* Paramètres : menuitem = élément de menu sélectionné. *
* bar = barre de menu parente. *
* *
-* Description : Réagit au menu "Outils -> Identité". *
+* Description : Réagit au menu "Options -> Préférences". *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void mcb_options_preferences(GtkMenuItem *menuitem, GMenuBar *bar)
+{
+ GObject *ref; /* Espace de référencements */
+ GtkBuilder *builder; /* Constructeur utilisé */
+ GtkWidget *dialog; /* Boîte de dialogue à montrer */
+
+ ref = g_editor_item_get_global_ref(G_EDITOR_ITEM(bar));
+
+ dialog = create_preferences_dialog(GTK_WINDOW(ref), &builder);
+
+ gtk_dialog_run(GTK_DIALOG(dialog));
+
+ gtk_widget_destroy(dialog);
+
+ g_object_unref(G_OBJECT(builder));
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : menuitem = élément de menu sélectionné. *
+* bar = barre de menu parente. *
+* *
+* Description : Réagit au menu "Options -> Identité". *
* *
* Retour : - *
* *
@@ -85,7 +125,7 @@ GtkWidget *build_menu_tools(GObject *ref, GMenuBar *bar)
* *
******************************************************************************/
-static void mcb_tools_identity(GtkMenuItem *menuitem, GMenuBar *bar)
+static void mcb_options_identity(GtkMenuItem *menuitem, GMenuBar *bar)
{
GObject *ref; /* Espace de référencements */
GtkBuilder *builder; /* Constructeur utilisé */
diff --git a/src/gui/menus/tools.h b/src/gui/menus/options.h
index 441e46d..f73d659 100644
--- a/src/gui/menus/tools.h
+++ b/src/gui/menus/options.h
@@ -1,8 +1,8 @@
/* Chrysalide - Outil d'analyse de fichiers binaires
- * tools.h - prototypes pour la gestion du menu 'Outils'
+ * options.h - prototypes pour la gestion du menu 'Options'
*
- * Copyright (C) 2017 Cyrille Bagard
+ * Copyright (C) 2019 Cyrille Bagard
*
* This binary is part of Chrysalide.
*
@@ -22,8 +22,8 @@
*/
-#ifndef _GUI_MENUS_TOOLS_H
-#define _GUI_MENUS_TOOLS_H
+#ifndef _GUI_MENUS_OPTIONS_H
+#define _GUI_MENUS_OPTIONS_H
#include <gtk/gtk.h>
@@ -33,9 +33,9 @@
-/* Construit le menu "Outils". */
-GtkWidget *build_menu_tools(GObject *, GMenuBar *);
+/* Construit le menu "Options". */
+GtkWidget *build_menu_options(GObject *, GMenuBar *);
-#endif /* _GUI_MENUS_TOOLS_H */
+#endif /* _GUI_MENUS_OPTIONS_H */