diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-02-19 11:55:28 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-02-19 11:55:28 (GMT) |
commit | 588c206289a84bfc939ac27dacba991d9b6d0793 (patch) | |
tree | 0de656a445e236de1846e8f40e6635077b9d3f19 /src/gui | |
parent | 1898c6ea16d0eee8ecc5ab9ebb26ac91ad7314b4 (diff) |
Created client/server certificates on demand for a given identity.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/dialogs/Makefile.am | 4 | ||||
-rw-r--r-- | src/gui/dialogs/gresource.xml | 3 | ||||
-rw-r--r-- | src/gui/dialogs/identity.c | 189 | ||||
-rw-r--r-- | src/gui/dialogs/identity.h | 37 | ||||
-rw-r--r-- | src/gui/dialogs/identity.ui | 278 | ||||
-rw-r--r-- | src/gui/menus/Makefile.am | 1 | ||||
-rw-r--r-- | src/gui/menus/menubar.c | 7 | ||||
-rw-r--r-- | src/gui/menus/tools.c | 105 | ||||
-rw-r--r-- | src/gui/menus/tools.h | 41 | ||||
-rw-r--r-- | src/gui/panels/regedit.c | 22 |
10 files changed, 686 insertions, 1 deletions
diff --git a/src/gui/dialogs/Makefile.am b/src/gui/dialogs/Makefile.am index e1774d7..bb2087b 100644 --- a/src/gui/dialogs/Makefile.am +++ b/src/gui/dialogs/Makefile.am @@ -4,7 +4,8 @@ BUILT_SOURCES = resources.h resources.c noinst_LTLIBRARIES = libguidialogs.la UI_FILES = \ - binadmin.ui + binadmin.ui \ + identity.ui libguidialogs_la_SOURCES = \ about.h about.c \ @@ -12,6 +13,7 @@ libguidialogs_la_SOURCES = \ export.h export.c \ goto.h goto.c \ gotox.h gotox.c \ + identity.h identity.c \ plugins.h plugins.c \ resources.h resources.c \ shellcode.h shellcode.c \ diff --git a/src/gui/dialogs/gresource.xml b/src/gui/dialogs/gresource.xml index 913b830..d1ba8b6 100644 --- a/src/gui/dialogs/gresource.xml +++ b/src/gui/dialogs/gresource.xml @@ -3,4 +3,7 @@ <gresource prefix="/org/chrysalide/gui/dialogs"> <file compressed="true">binadmin.ui</file> </gresource> + <gresource prefix="/org/chrysalide/gui/dialogs"> + <file compressed="true">identity.ui</file> + </gresource> </gresources> diff --git a/src/gui/dialogs/identity.c b/src/gui/dialogs/identity.c new file mode 100644 index 0000000..0f6a111 --- /dev/null +++ b/src/gui/dialogs/identity.c @@ -0,0 +1,189 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * identity.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 Foobar. If not, see <http://www.gnu.org/licenses/>. + */ + + +#include "identity.h" + + +#include <string.h> + + +#include <i18n.h> + + +#include "../panels/log.h" +#include "../../analysis/db/keymgn.h" + + + +/* Applique la nouvelle définition d'identité. */ +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.* +* * +* Retour : Adresse de la fenêtre mise en place. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GtkWidget *create_identity_dialog(GtkWindow *parent, GtkBuilder **outb) +{ + GtkWidget *result; /* Fenêtre à renvoyer */ + GtkBuilder *builder; /* Constructeur utilisé */ + x509_entries entries; /* Eléments identitaires */ + GtkEntry *entry; /* Zone de saisie à initialiser*/ + + builder = gtk_builder_new_from_resource("/org/chrysalide/gui/dialogs/identity.ui"); + *outb = builder; + + result = GTK_WIDGET(gtk_builder_get_object(builder, "window")); + + gtk_window_set_transient_for(GTK_WINDOW(result), parent); + + /* Mise à jour de l'interface */ + + load_identity(true, &entries); + + if (entries.country != NULL) + { + entry = GTK_ENTRY(gtk_builder_get_object(builder, "c")); + gtk_entry_set_text(entry, entries.country); + } + + if (entries.state != NULL) + { + entry = GTK_ENTRY(gtk_builder_get_object(builder, "st")); + gtk_entry_set_text(entry, entries.state); + } + + if (entries.locality != NULL) + { + entry = GTK_ENTRY(gtk_builder_get_object(builder, "l")); + gtk_entry_set_text(entry, entries.locality); + } + + if (entries.organisation != NULL) + { + entry = GTK_ENTRY(gtk_builder_get_object(builder, "o")); + gtk_entry_set_text(entry, entries.organisation); + } + + if (entries.organisational_unit != NULL) + { + entry = GTK_ENTRY(gtk_builder_get_object(builder, "ou")); + gtk_entry_set_text(entry, entries.organisational_unit); + } + + if (entries.country != NULL) + { + entry = GTK_ENTRY(gtk_builder_get_object(builder, "cn")); + gtk_entry_set_text(entry, entries.common_name); + + gtk_editable_select_region(GTK_EDITABLE(entry), 0, -1); + + } + + /* Connexion des signaux */ + + gtk_builder_add_callback_symbols(builder, + "update_identity", G_CALLBACK(update_identity), + NULL); + + gtk_builder_connect_signals(builder, builder); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : button = bouton à l'origine de la procédure. * +* builder = espace de référencement global. * +* * +* Description : Applique la nouvelle définition d'identité. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void update_identity(GtkButton *button, GtkBuilder *builder) +{ + GtkEntry *entry; /* Zone de saisie à consulter */ + const gchar *data; /* Données internes à GTK */ + x509_entries entries; /* Nouvelle identité à pousser */ + bool status; /* Bilan de la mise à jour */ + + /* Récupération des éléments */ + + entry = GTK_ENTRY(gtk_builder_get_object(builder, "c")); + data = gtk_entry_get_text(entry); + + entries.country = (strlen(data) > 0 ? strdup(data) : NULL); + + entry = GTK_ENTRY(gtk_builder_get_object(builder, "st")); + data = gtk_entry_get_text(entry); + + entries.state = (strlen(data) > 0 ? strdup(data) : NULL); + + entry = GTK_ENTRY(gtk_builder_get_object(builder, "l")); + data = gtk_entry_get_text(entry); + + entries.locality = (strlen(data) > 0 ? strdup(data) : NULL); + + entry = GTK_ENTRY(gtk_builder_get_object(builder, "o")); + data = gtk_entry_get_text(entry); + + entries.organisation = (strlen(data) > 0 ? strdup(data) : NULL); + + entry = GTK_ENTRY(gtk_builder_get_object(builder, "ou")); + data = gtk_entry_get_text(entry); + + entries.organisational_unit = (strlen(data) > 0 ? strdup(data) : NULL); + + entry = GTK_ENTRY(gtk_builder_get_object(builder, "cn")); + data = gtk_entry_get_text(entry); + + entries.common_name = (strlen(data) > 0 ? strdup(data) : NULL); + + /* Application de la nouvelle définition */ + + status = register_standalone_certs(&entries); + + free_x509_entries(&entries); + + if (status) + log_simple_message(LMT_INFO, _("New identity has been loaded with success!")); + else + log_simple_message(LMT_ERROR, _("Failure while loading the new identity...")); + +} diff --git a/src/gui/dialogs/identity.h b/src/gui/dialogs/identity.h new file mode 100644 index 0000000..2019eba --- /dev/null +++ b/src/gui/dialogs/identity.h @@ -0,0 +1,37 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * identity.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 Foobar. If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _GUI_DIALOGS_IDENTITY_H +#define _GUI_DIALOGS_IDENTITY_H + + +#include <gtk/gtk.h> + + + +/* Propose une édition des informations conernant l'utilisateur. */ +GtkWidget *create_identity_dialog(GtkWindow *, GtkBuilder **); + + + +#endif /* _GUI_DIALOGS_IDENTITY_H */ diff --git a/src/gui/dialogs/identity.ui b/src/gui/dialogs/identity.ui new file mode 100644 index 0000000..f622a91 --- /dev/null +++ b/src/gui/dialogs/identity.ui @@ -0,0 +1,278 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> +<interface> + <requires lib="gtk+" version="3.12"/> + <object class="GtkDialog" id="window"> + <property name="width_request">515</property> + <property name="can_focus">False</property> + <property name="title" translatable="yes">Identity</property> + <property name="modal">True</property> + <property name="window_position">center</property> + <property name="default_width">515</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="valign">start</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="orientation">vertical</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="margin_top">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> + <property name="always_show_image">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> + <property name="always_show_image">True</property> + <signal name="clicked" handler="update_identity" swapped="no"/> + </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="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">8</property> + <property name="column_spacing">8</property> + <child> + <object class="GtkSeparator" id="separator1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_left">8</property> + <property name="margin_right">8</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + <property name="width">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label1"> + <property name="width_request">500</property> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">All the following information is used to create your authentication certifcate. This certificate grants you access to database servers and identifies each analysis change. + +<b>Warning: </b> updating this information drives to new signing requests for remote servers!</property> + <property name="use_markup">True</property> + <property name="wrap">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + <property name="width">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">1</property> + <property name="label" translatable="yes">Common name (required):</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="cn"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="has_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkSeparator" id="separator3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_left">8</property> + <property name="margin_right">8</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + <property name="width">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">1</property> + <property name="label" translatable="yes">Organisational unit:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">4</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="ou"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">4</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="o"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">5</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">1</property> + <property name="label" translatable="yes">Organisation:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">5</property> + </packing> + </child> + <child> + <object class="GtkSeparator" id="separator4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="margin_left">8</property> + <property name="margin_right">8</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">6</property> + <property name="width">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">1</property> + <property name="label" translatable="yes">Locality:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">7</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="l"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">7</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="st"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">8</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">1</property> + <property name="label" translatable="yes">State:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">8</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">1</property> + <property name="label" translatable="yes">Country (two letters):</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">9</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="c"> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">9</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</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> + </object> +</interface> diff --git a/src/gui/menus/Makefile.am b/src/gui/menus/Makefile.am index 014f098..7e5a1c3 100644 --- a/src/gui/menus/Makefile.am +++ b/src/gui/menus/Makefile.am @@ -10,6 +10,7 @@ libguimenus_la_SOURCES = \ menubar.h menubar.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 1ccbb00..56540e9 100644 --- a/src/gui/menus/menubar.c +++ b/src/gui/menus/menubar.c @@ -32,6 +32,7 @@ #include "help.h" #include "plugins.h" #include "project.h" +#include "tools.h" #include "view.h" #include "../editem-int.h" @@ -48,6 +49,7 @@ struct _GMenuBar GtkWidget *project; /* Menu "Projet" */ GtkWidget *binary; /* Menu "Binaire" */ GtkWidget *debug; /* Menu "Débogage" */ + GtkWidget *tools; /* Menu "Outils" */ GtkWidget *plugins; /* Menu "Greffons" */ GtkWidget *help; /* Menu "Aide" */ @@ -247,6 +249,11 @@ GEditorItem *g_menu_bar_new(GObject *ref, GtkAccelGroup *accgroup) result->debug = build_menu_debug(ref, accgroup); gtk_container_add(GTK_CONTAINER(item->widget), result->debug); + /* Outils */ + + result->tools = build_menu_tools(ref, accgroup, result); + gtk_container_add(GTK_CONTAINER(item->widget), result->tools); + /* Greffons */ result->plugins = build_menu_plugins(ref, accgroup); diff --git a/src/gui/menus/tools.c b/src/gui/menus/tools.c new file mode 100644 index 0000000..2ec9551 --- /dev/null +++ b/src/gui/menus/tools.c @@ -0,0 +1,105 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * tools.c - gestion du menu 'Outils' + * + * Copyright (C) 2017 Cyrille Bagard + * + * This binary 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 "tools.h" + + +#include <i18n.h> + + +#include "../editem-int.h" +#include "../dialogs/identity.h" +#include "../../gtkext/easygtk.h" + + + +/* Réagit au menu "Outils -> Identité". */ +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. * +* * +* Description : Construit le menu "Outils". * +* * +* Retour : Panneau de menus mis en place. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GtkWidget *build_menu_tools(GObject *ref, GtkAccelGroup *accgroup, 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")); + 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); + gtk_container_add(GTK_CONTAINER(menubar), submenuitem); + + return result; + +} + + +/****************************************************************************** +* * +* Paramètres : menuitem = élément de menu sélectionné. * +* bar = barre de menu parente. * +* * +* Description : Réagit au menu "Outils -> Identité". * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void mcb_tools_identity(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_identity_dialog(GTK_WINDOW(ref), &builder); + + gtk_dialog_run(GTK_DIALOG(dialog)); + + gtk_widget_destroy(dialog); + + g_object_unref(G_OBJECT(builder)); + +} diff --git a/src/gui/menus/tools.h b/src/gui/menus/tools.h new file mode 100644 index 0000000..0c76137 --- /dev/null +++ b/src/gui/menus/tools.h @@ -0,0 +1,41 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * tools.h - prototypes pour la gestion du menu 'Outils' + * + * Copyright (C) 2017 Cyrille Bagard + * + * This binary 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_TOOLS_H +#define _GUI_MENUS_TOOLS_H + + +#include <gtk/gtk.h> + + +#include "menubar.h" + + + +/* Construit le menu "Outils". */ +GtkWidget *build_menu_tools(GObject *, GtkAccelGroup *, GMenuBar *); + + + +#endif /* _GUI_MENUS_TOOLS_H */ diff --git a/src/gui/panels/regedit.c b/src/gui/panels/regedit.c index 579c60b..501bd2f 100644 --- a/src/gui/panels/regedit.c +++ b/src/gui/panels/regedit.c @@ -458,6 +458,10 @@ static void reload_config_into_treeview(GRegeditPanel *panel, GGenConfig *config type_desc = _("Integer"); break; + case CPT_ULONG: + type_desc = _("Unsigned long"); + break; + case CPT_STRING: type_desc = _("String"); break; @@ -547,6 +551,8 @@ static void update_config_param_value(GtkTreeStore *store, GtkTreeIter *iter) bool boolean; /* Valeur booléenne */ int integer; /* Valeur entière */ char int_val[sizeof(XSTR(INT_MIN)) + 1];/* Valeur en chaîne de carac. */ + unsigned long ulong; /* Valeur entière positive */ + char ul_val[sizeof(XSTR(ULONG_MAX)) + 1];/* Valeur en chaîne de carac. */ char *string; /* Chaîne de caractères */ char *desc; /* Description à afficher */ @@ -579,6 +585,12 @@ static void update_config_param_value(GtkTreeStore *store, GtkTreeIter *iter) desc = int_val; break; + case CPT_ULONG: + g_config_param_get_value(param, &ulong); + snprintf(ul_val, sizeof(ul_val), "%lu", ulong); + desc = ul_val; + break; + case CPT_STRING: g_config_param_get_value(param, &string); desc = (string != NULL ? string : ""); @@ -720,6 +732,7 @@ static void on_param_value_edited(GtkCellRendererText *renderer, gchar *path, gc GCfgParam *param; /* Paramètre à actualiser */ bool boolean; /* Valeur booléenne */ int integer; /* Valeur entière */ + int ulong; /* Valeur entière positive */ char *end; /* Pointeur vers '\0' final ? */ tree_path = gtk_tree_path_new_from_string(path); @@ -751,6 +764,15 @@ static void on_param_value_edited(GtkCellRendererText *renderer, gchar *path, gc break; + case CPT_ULONG: + + ulong = strtoul(new, &end, 10); + if (*end != '\0') goto opve_bad_value; + + g_config_param_set_value(param, ulong); + + break; + case CPT_STRING: g_config_param_set_value(param, new); break; |