summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/Makefile.am2
-rw-r--r--src/gui/dialogs/gresource.xml1
-rw-r--r--src/gui/dialogs/identity.c2
-rw-r--r--src/gui/dialogs/identity.h2
-rw-r--r--src/gui/dialogs/preferences.c93
-rw-r--r--src/gui/dialogs/preferences.h37
-rw-r--r--src/gui/dialogs/preferences.ui283
-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
11 files changed, 483 insertions, 27 deletions
diff --git a/src/gui/dialogs/Makefile.am b/src/gui/dialogs/Makefile.am
index 35dfb0a..755ddbd 100644
--- a/src/gui/dialogs/Makefile.am
+++ b/src/gui/dialogs/Makefile.am
@@ -6,6 +6,7 @@ noinst_LTLIBRARIES = libguidialogs.la
UI_FILES = \
bookmark.ui \
identity.ui \
+ preferences.ui \
storage.ui
libguidialogs_la_SOURCES = \
@@ -16,6 +17,7 @@ libguidialogs_la_SOURCES = \
gotox.h gotox.c \
identity.h identity.c \
plugins.h plugins.c \
+ preferences.h preferences.c \
resources.h resources.c \
storage.h storage.c
diff --git a/src/gui/dialogs/gresource.xml b/src/gui/dialogs/gresource.xml
index e44045c..b6e3c32 100644
--- a/src/gui/dialogs/gresource.xml
+++ b/src/gui/dialogs/gresource.xml
@@ -3,6 +3,7 @@
<gresource prefix="/org/chrysalide/gui/dialogs">
<file compressed="true">bookmark.ui</file>
<file compressed="true">identity.ui</file>
+ <file compressed="true">preferences.ui</file>
<file compressed="true">storage.ui</file>
</gresource>
</gresources>
diff --git a/src/gui/dialogs/identity.c b/src/gui/dialogs/identity.c
index 9e3cfd7..5f51bc0 100644
--- a/src/gui/dialogs/identity.c
+++ b/src/gui/dialogs/identity.c
@@ -45,7 +45,7 @@ static void update_identity(GtkButton *button, GtkBuilder *);
* Paramètres : parent = fenêtre principale de l'éditeur. *
* outb = constructeur à détruire après usage. [OUT] *
* *
-* Description : Propose une édition des informations conernant l'utilisateur.*
+* Description : Propose une édition d'informations concernant l'utilisateur. *
* *
* Retour : Adresse de la fenêtre mise en place. *
* *
diff --git a/src/gui/dialogs/identity.h b/src/gui/dialogs/identity.h
index 99c0ca6..8d51c4d 100644
--- a/src/gui/dialogs/identity.h
+++ b/src/gui/dialogs/identity.h
@@ -29,7 +29,7 @@
-/* Propose une édition des informations conernant l'utilisateur. */
+/* Propose une édition d'informations concernant l'utilisateur. */
GtkWidget *create_identity_dialog(GtkWindow *, GtkBuilder **);
diff --git a/src/gui/dialogs/preferences.c b/src/gui/dialogs/preferences.c
new file mode 100644
index 0000000..dcb4cc7
--- /dev/null
+++ b/src/gui/dialogs/preferences.c
@@ -0,0 +1,93 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * preferences.c - (re)définition de l'identité de l'utilisateur
+ *
+ * Copyright (C) 2017 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "preferences.h"
+
+
+#include <i18n.h>
+
+
+
+/* Eléments de la liste de sections */
+typedef enum _PrefListItem
+{
+ PLI_TITLE, /* Etiquette de la section */
+ PLI_PANEL, /* Panneau graphique associé */
+
+} PrefListItem;
+
+
+
+/******************************************************************************
+* *
+* Paramètres : parent = fenêtre principale de l'éditeur. *
+* outb = constructeur à détruire après usage. [OUT] *
+* *
+* Description : Propose une boîte de dialogue pour la configuration générale.*
+* *
+* Retour : Adresse de la fenêtre mise en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+GtkWidget *create_preferences_dialog(GtkWindow *parent, GtkBuilder **outb)
+{
+ GtkWidget *result; /* Fenêtre à renvoyer */
+ GtkBuilder *builder; /* Constructeur utilisé */
+ GtkTreeStore *store; /* Arborescence des sections */
+ GtkTreeIter iter; /* Point d'insertion */
+
+ builder = gtk_builder_new_from_resource("/org/chrysalide/gui/dialogs/preferences.ui");
+ *outb = builder;
+
+ result = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
+
+ gtk_window_set_transient_for(GTK_WINDOW(result), parent);
+
+ /* Intégration des différentes sections */
+
+ store = GTK_TREE_STORE(gtk_builder_get_object(builder, "pref_list"));
+
+ gtk_tree_store_append(store, &iter, NULL);
+
+ gtk_tree_store_set(store, &iter,
+ PLI_TITLE, _("Colored labels"),
+ PLI_PANEL, gtk_builder_get_object(builder, "colored_labels_panel"),
+ -1);
+
+ /* Mise à jour de l'interface */
+
+ /* Connexion des signaux */
+
+ /*
+ gtk_builder_add_callback_symbols(builder,
+ "update_preferences", G_CALLBACK(update_preferences),
+ NULL);
+ */
+
+ gtk_builder_connect_signals(builder, builder);
+
+ return result;
+
+}
diff --git a/src/gui/dialogs/preferences.h b/src/gui/dialogs/preferences.h
new file mode 100644
index 0000000..a608dc3
--- /dev/null
+++ b/src/gui/dialogs/preferences.h
@@ -0,0 +1,37 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * preferences.h - prototypes pour la (re)définition de l'identité de l'utilisateur
+ *
+ * Copyright (C) 2017 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 Chrysalide. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef _GUI_DIALOGS_PREFERENCES_H
+#define _GUI_DIALOGS_PREFERENCES_H
+
+
+#include <gtk/gtk.h>
+
+
+
+/* Propose une boîte de dialogue pour la configuration générale. */
+GtkWidget *create_preferences_dialog(GtkWindow *, GtkBuilder **);
+
+
+
+#endif /* _GUI_DIALOGS_PREFERENCES_H */
diff --git a/src/gui/dialogs/preferences.ui b/src/gui/dialogs/preferences.ui
new file mode 100644
index 0000000..2760399
--- /dev/null
+++ b/src/gui/dialogs/preferences.ui
@@ -0,0 +1,283 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.21.0 -->
+<interface>
+ <requires lib="gtk+" version="3.20"/>
+ <object class="GtkListStore" id="colored_label_types">
+ <columns>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ </columns>
+ <data>
+ <row>
+ <col id="0" translatable="yes">global colored labels</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">colored labels for symbols</col>
+ </row>
+ <row>
+ <col id="0" translatable="yes">colored labels for basic blocks</col>
+ </row>
+ </data>
+ </object>
+ <object class="GtkTreeStore" id="pref_list">
+ <columns>
+ <!-- column-name title -->
+ <column type="gchararray"/>
+ <!-- column-name panel -->
+ <column type="GObject"/>
+ </columns>
+ </object>
+ <object class="GtkDialog" id="window">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">General preferences</property>
+ <property name="modal">True</property>
+ <property name="default_width">800</property>
+ <property name="default_height">500</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="can_focus">False</property>
+ <property name="margin_left">8</property>
+ <property name="margin_right">8</property>
+ <property name="margin_top">8</property>
+ <property name="margin_bottom">8</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="label">gtk-apply</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkPaned">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="position">200</property>
+ <property name="wide_handle">True</property>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="margin_left">8</property>
+ <property name="margin_right">8</property>
+ <property name="margin_top">8</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="model">pref_list</property>
+ <property name="headers_visible">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn">
+ <property name="title" translatable="yes">column</property>
+ <child>
+ <object class="GtkCellRendererText"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="resize">False</property>
+ <property name="shrink">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkStack">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_left">8</property>
+ <property name="margin_right">8</property>
+ <property name="margin_top">8</property>
+ <child>
+ <object class="GtkBox" id="colored_labels_panel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">8</property>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">8</property>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Specify:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="colored_labels_combo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="model">colored_label_types</property>
+ <child>
+ <object class="GtkCellRendererText"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">8</property>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection"/>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolbar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="toolbar_style">icons</property>
+ <property name="show_arrow">False</property>
+ <property name="icon_size">4</property>
+ <child>
+ <object class="GtkToolButton" id="colored_label_add">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">list-add</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="colored_label_remove">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">list-remove</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="name">page0</property>
+ <property name="title" translatable="yes">page0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="resize">True</property>
+ <property name="shrink">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">button1</action-widget>
+ <action-widget response="-10">button2</action-widget>
+ </action-widgets>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+</interface>
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 */