summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-08-08 21:37:21 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-08-08 21:37:21 (GMT)
commit4370d2d77d623f560c7df94a3bc15b1395e4878b (patch)
tree57cc6268f504c19aaac3b1adda4295ed3b1ddc7f /plugins
parent34d28c7418342d3c67be4747b13cdcb124edda32 (diff)
Updated all the code relative to GUI items.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/pychrysalide/analysis/loaded.c4
-rw-r--r--plugins/pychrysalide/glibext/Makefile.am3
-rw-r--r--plugins/pychrysalide/glibext/module.c2
-rw-r--r--plugins/pychrysalide/glibext/named.c531
-rw-r--r--plugins/pychrysalide/glibext/named.h45
-rw-r--r--plugins/pychrysalide/gtkext/Makefile.am3
-rw-r--r--plugins/pychrysalide/gtkext/module.c2
-rw-r--r--plugins/pychrysalide/gtkext/named.c327
-rw-r--r--plugins/pychrysalide/gtkext/named.h42
-rw-r--r--plugins/pychrysalide/gui/Makefile.am2
-rw-r--r--plugins/pychrysalide/gui/constants.c56
-rw-r--r--plugins/pychrysalide/gui/constants.h3
-rw-r--r--plugins/pychrysalide/gui/item.c (renamed from plugins/pychrysalide/gui/editem.c)191
-rw-r--r--plugins/pychrysalide/gui/item.h (renamed from plugins/pychrysalide/gui/editem.h)10
-rw-r--r--plugins/pychrysalide/gui/module.c2
-rw-r--r--plugins/pychrysalide/gui/panel.c89
-rw-r--r--plugins/pychrysalide/helpers.c35
-rw-r--r--plugins/pychrysalide/helpers.h11
-rw-r--r--plugins/python/liveconv/panel.py22
-rw-r--r--plugins/python/liveconv/panel.ui381
20 files changed, 1539 insertions, 222 deletions
diff --git a/plugins/pychrysalide/analysis/loaded.c b/plugins/pychrysalide/analysis/loaded.c
index 3eaed81..3ed51d5 100644
--- a/plugins/pychrysalide/analysis/loaded.c
+++ b/plugins/pychrysalide/analysis/loaded.c
@@ -40,6 +40,7 @@
#include "content.h"
#include "../access.h"
#include "../helpers.h"
+#include "../glibext/named.h"
@@ -1445,6 +1446,9 @@ bool ensure_python_loaded_content_is_registered(void)
dict = PyModule_GetDict(module);
+ if (!ensure_python_named_widget_is_registered())
+ return false;
+
if (!register_interface_for_pygobject(dict, G_TYPE_LOADED_CONTENT, type, &info))
return false;
diff --git a/plugins/pychrysalide/glibext/Makefile.am b/plugins/pychrysalide/glibext/Makefile.am
index c5fee67..9faff31 100644
--- a/plugins/pychrysalide/glibext/Makefile.am
+++ b/plugins/pychrysalide/glibext/Makefile.am
@@ -12,7 +12,8 @@ libpychrysaglibext_la_SOURCES = \
linecursor.h linecursor.c \
linegen.h linegen.c \
loadedpanel.h loadedpanel.c \
- module.h module.c
+ module.h module.c \
+ named.h named.c
libpychrysaglibext_la_LDFLAGS =
diff --git a/plugins/pychrysalide/glibext/module.c b/plugins/pychrysalide/glibext/module.c
index b45da4d..176d815 100644
--- a/plugins/pychrysalide/glibext/module.c
+++ b/plugins/pychrysalide/glibext/module.c
@@ -37,6 +37,7 @@
#include "linecursor.h"
#include "linegen.h"
#include "loadedpanel.h"
+#include "named.h"
#include "../helpers.h"
@@ -114,6 +115,7 @@ bool populate_glibext_module(void)
if (result) result = ensure_python_line_cursor_is_registered();
if (result) result = ensure_python_line_generator_is_registered();
if (result) result = ensure_python_loaded_panel_is_registered();
+ if (result) result = ensure_python_named_widget_is_registered();
assert(result);
diff --git a/plugins/pychrysalide/glibext/named.c b/plugins/pychrysalide/glibext/named.c
new file mode 100644
index 0000000..4f21064
--- /dev/null
+++ b/plugins/pychrysalide/glibext/named.c
@@ -0,0 +1,531 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * named.c - équivalent Python du fichier "glibext/named.h"
+ *
+ * Copyright (C) 2018-2019 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 "named.h"
+
+
+#include <pygobject.h>
+#include <string.h>
+
+
+#include <glibext/named-int.h>
+
+
+#include "../access.h"
+#include "../helpers.h"
+
+
+
+/* ------------------------ GLUE POUR CREATION DEPUIS PYTHON ------------------------ */
+
+
+/* Procède à l'initialisation de l'interface de génération. */
+static void py_named_widget_interface_init(GNamedWidgetIface *, gpointer *);
+
+/* Fournit le désignation associée à un composant nommé. */
+static char *py_named_widget_get_name_wrapper(const GNamedWidget *, bool);
+
+/* Fournit le composant associé à un composant nommé. */
+static GtkWidget *py_named_widget_get_widget_wrapper(const GNamedWidget *);
+
+
+
+/* ------------------------- CONNEXION AVEC L'API DE PYTHON ------------------------- */
+
+
+/* Fournit le désignation associée à un composant nommé. */
+static PyObject *py_named_widget_get_name(PyObject *, void *);
+
+/* Fournit le désignation associée à un composant nommé. */
+static PyObject *py_named_widget_get_long_name(PyObject *, void *);
+
+/* Fournit le composant associé à un composant nommé. */
+static PyObject *py_named_widget_get_widget(PyObject *, void *);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* GLUE POUR CREATION DEPUIS PYTHON */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : iface = interface GLib à initialiser. *
+* unused = adresse non utilisée ici. *
+* *
+* Description : Procède à l'initialisation de l'interface de génération. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void py_named_widget_interface_init(GNamedWidgetIface *iface, gpointer *unused)
+{
+
+#define NAMED_WIDGET_DOC \
+ "NamedWidget is an interface linking GTK widget to short and long" \
+ " descriptions. Such interface is mainly used when inserting widgets" \
+ " into the main window as panels.\n" \
+ "\n" \
+ "A typical class declaration for a new implementation looks like:\n" \
+ "\n" \
+ " class NewImplem(GObject.Object, NamedWidget):\n" \
+ " ...\n" \
+ "\n" \
+ "Several items have to be defined as class attributes in the final" \
+ " class:\n" \
+ "* pychrysalide.glibext.NamedWidget._name;\n" \
+ "* pychrysalide.glibext.NamedWidget._long_name;\n" \
+ "* pychrysalide.glibext.NamedWidget._widget;\n"
+
+ iface->get_name = py_named_widget_get_name_wrapper;
+ iface->get_widget = py_named_widget_get_widget_wrapper;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : widget = composant nommé à consulter. *
+* lname = précise s'il s'agit d'une version longue ou non. *
+* *
+* Description : Fournit le désignation associée à un composant nommé. *
+* *
+* Retour : Description courante. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *py_named_widget_get_name_wrapper(const GNamedWidget *widget, bool lname)
+{
+ char *result; /* Désignation à retourner */
+ PyGILState_STATE gstate; /* Sauvegarde d'environnement */
+ PyObject *pyobj; /* Objet Python concerné */
+ PyObject *pyname; /* Nom en objet Python */
+ int ret; /* Bilan d'une conversion */
+
+#define NAMED_WIDGET_NAME_ATTRIB_WRAPPER PYTHON_GETTER_WRAPPER_DEF \
+( \
+ _name, \
+ "Provide the short name used to describe a named widget.\n" \
+ "\n" \
+ "The result has to be a string." \
+)
+
+#define NAMED_WIDGET_LONG_NAME_ATTRIB_WRAPPER PYTHON_GETTER_WRAPPER_DEF \
+( \
+ _long_name, \
+ "Provide the long name used to describe a named widget.\n" \
+ "\n" \
+ "The result has to be a string." \
+)
+
+ result = NULL;
+
+ gstate = PyGILState_Ensure();
+
+ pyobj = pygobject_new(G_OBJECT(widget));
+
+ if (PyObject_HasAttrString(pyobj, lname ? "_name" : "_long_name"))
+ {
+ pyname = PyObject_GetAttrString(pyobj, lname ? "_name" : "_long_name");
+
+ if (pyname != NULL)
+ {
+ ret = PyUnicode_Check(pyname);
+
+ if (ret)
+ result = strdup(PyUnicode_AsUTF8(pyname));
+
+ Py_DECREF(pyname);
+
+ }
+
+ }
+
+ Py_DECREF(pyobj);
+
+ PyGILState_Release(gstate);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : widget = composant nommé à consulter. *
+* *
+* Description : Fournit le composant associé à un composant nommé. *
+* *
+* Retour : Composant graphique GTK. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GtkWidget *py_named_widget_get_widget_wrapper(const GNamedWidget *widget)
+{
+ GtkWidget *result; /* Composant GTK à renvoyer */
+ PyGILState_STATE gstate; /* Sauvegarde d'environnement */
+ PyObject *pyobj; /* Objet Python concerné */
+ PyObject *pywidget; /* Composant en objet Python */
+ PyObject *gtk_mod; /* Module Python Gtk */
+ PyObject *type; /* Module "GtkWidget" */
+ int ret; /* Bilan d'une conversion */
+
+#define NAMED_WIDGET_WIDGET_ATTRIB_WRAPPER PYTHON_GETTER_WRAPPER_DEF \
+( \
+ _widget, \
+ "Provide the internal widget usable for a named widget.\n" \
+ "\n" \
+ "The result has to be a GTK.Widget instance." \
+)
+
+ result = NULL;
+
+ gstate = PyGILState_Ensure();
+
+ pyobj = pygobject_new(G_OBJECT(widget));
+
+ if (PyObject_HasAttrString(pyobj, "_widget"))
+ {
+ pywidget = PyObject_GetAttrString(pyobj, "_widget");
+
+ if (pywidget != NULL)
+ {
+ gtk_mod = PyImport_ImportModule("gi.repository.Gtk");
+
+ if (gtk_mod == NULL)
+ {
+ PyErr_SetString(PyExc_TypeError, "unable to find the Gtk Python module");
+ goto exit;
+ }
+
+ type = PyObject_GetAttrString(gtk_mod, "Widget");
+
+ Py_DECREF(gtk_mod);
+
+ ret = PyObject_TypeCheck(pywidget, (PyTypeObject *)type);
+
+ Py_DECREF(type);
+
+ if (ret)
+ result = GTK_WIDGET(pygobject_get(pywidget));
+
+ Py_DECREF(pywidget);
+
+ }
+
+ }
+
+ exit:
+
+ Py_DECREF(pyobj);
+
+ PyGILState_Release(gstate);
+
+ return result;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* CONNEXION AVEC L'API DE PYTHON */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : self = classe représentant un composant nommé à manipuler.*
+* closure = non utilisé ici. *
+* *
+* Description : Fournit le désignation associée à un composant nommé. *
+* *
+* Retour : Description courante. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_named_widget_get_name(PyObject *self, void *closure)
+{
+ PyObject *result; /* Décompte à retourner */
+ GNamedWidget *widget; /* Version native */
+ char *name; /* Désignation à convertir */
+
+#define NAMED_WIDGET_NAME_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ name, py_named_widget, \
+ "Short name used to describe a named widget.\n" \
+ "\n" \
+ "The result has to be a string." \
+)
+
+ widget = G_NAMED_WIDGET(pygobject_get(self));
+
+ name = g_named_widget_get_name(widget, false);
+
+ if (name == NULL)
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+ else
+ {
+ result = PyUnicode_FromString(name);
+ free(name);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = classe représentant un composant nommé à manipuler.*
+* closure = non utilisé ici. *
+* *
+* Description : Fournit le désignation associée à un composant nommé. *
+* *
+* Retour : Description courante. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_named_widget_get_long_name(PyObject *self, void *closure)
+{
+ PyObject *result; /* Décompte à retourner */
+ GNamedWidget *widget; /* Version native */
+ char *name; /* Désignation à convertir */
+
+#define NAMED_WIDGET_LONG_NAME_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ long_name, py_named_widget, \
+ "Long name used to describe a named widget.\n" \
+ "\n" \
+ "The result has to be a string." \
+)
+
+ widget = G_NAMED_WIDGET(pygobject_get(self));
+
+ name = g_named_widget_get_name(widget, true);
+
+ if (name == NULL)
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+ else
+ {
+ result = PyUnicode_FromString(name);
+ free(name);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = classe représentant un composant nommé à manipuler.*
+* closure = non utilisé ici. *
+* *
+* Description : Fournit le composant associé à un composant nommé. *
+* *
+* Retour : Composant graphique GTK. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_named_widget_get_widget(PyObject *self, void *closure)
+{
+ PyObject *result; /* Décompte à retourner */
+ GNamedWidget *widget; /* Version native */
+ GtkWidget *instance; /* Composant interne natif */
+
+#define NAMED_WIDGET_WIDGET_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ widget, py_named_widget, \
+ "Internal widget usable for a named widget.\n" \
+ "\n" \
+ "The result has to be a GTK *widget*." \
+)
+
+ widget = G_NAMED_WIDGET(pygobject_get(self));
+
+ instance = g_named_widget_get_widget(widget);
+
+ result = pygobject_new(G_OBJECT(instance));
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit un accès à une définition de type à diffuser. *
+* *
+* Retour : Définition d'objet pour Python. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyTypeObject *get_python_named_widget_type(void)
+{
+ static PyMethodDef py_named_widget_methods[] = {
+ { NULL }
+ };
+
+ static PyGetSetDef py_named_widget_getseters[] = {
+ NAMED_WIDGET_NAME_ATTRIB_WRAPPER,
+ NAMED_WIDGET_LONG_NAME_ATTRIB_WRAPPER,
+ NAMED_WIDGET_WIDGET_ATTRIB_WRAPPER,
+ NAMED_WIDGET_NAME_ATTRIB,
+ NAMED_WIDGET_LONG_NAME_ATTRIB,
+ NAMED_WIDGET_WIDGET_ATTRIB,
+ { NULL }
+ };
+
+ static PyTypeObject py_named_widget_type = {
+
+ PyVarObject_HEAD_INIT(NULL, 0)
+
+ .tp_name = "pychrysalide.glibext.NamedWidget",
+ .tp_basicsize = sizeof(PyObject),
+
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+
+ .tp_doc = NAMED_WIDGET_DOC,
+
+ .tp_methods = py_named_widget_methods,
+ .tp_getset = py_named_widget_getseters,
+
+ };
+
+ return &py_named_widget_type;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : module = module dont la définition est à compléter. *
+* *
+* Description : Prend en charge l'objet 'pychrysalide.glibext.NamedWidget'. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool ensure_python_named_widget_is_registered(void)
+{
+ PyTypeObject *type; /* Type Python 'NamedWidget' */
+ PyObject *module; /* Module à recompléter */
+ PyObject *dict; /* Dictionnaire du module */
+
+ static GInterfaceInfo info = { /* Paramètres d'inscription */
+
+ .interface_init = (GInterfaceInitFunc)py_named_widget_interface_init,
+ .interface_finalize = NULL,
+ .interface_data = NULL,
+
+ };
+
+ type = get_python_named_widget_type();
+
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.glibext");
+
+ dict = PyModule_GetDict(module);
+
+ if (!register_interface_for_pygobject(dict, G_TYPE_NAMED_WIDGET, type, &info))
+ return false;
+
+ }
+
+ return true;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : arg = argument quelconque à tenter de convertir. *
+* dst = destination des valeurs récupérées en cas de succès. *
+* *
+* Description : Tente de convertir en composant nommé. *
+* *
+* Retour : Bilan de l'opération, voire indications supplémentaires. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+int convert_to_named_widget(PyObject *arg, void *dst)
+{
+ int result; /* Bilan à retourner */
+
+ result = PyObject_IsInstance(arg, (PyObject *)get_python_named_widget_type());
+
+ switch (result)
+ {
+ case -1:
+ /* L'exception est déjà fixée par Python */
+ result = 0;
+ break;
+
+ case 0:
+ PyErr_SetString(PyExc_TypeError, "unable to convert the provided argument to named widget");
+ break;
+
+ case 1:
+ *((GNamedWidget **)dst) = G_NAMED_WIDGET(pygobject_get(arg));
+ break;
+
+ default:
+ assert(false);
+ break;
+
+ }
+
+ return result;
+
+}
diff --git a/plugins/pychrysalide/glibext/named.h b/plugins/pychrysalide/glibext/named.h
new file mode 100644
index 0000000..846df82
--- /dev/null
+++ b/plugins/pychrysalide/glibext/named.h
@@ -0,0 +1,45 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * named.h - prototypes pour l'équivalent Python du fichier "glibext/named.h"
+ *
+ * Copyright (C) 2020 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 _PLUGINS_PYCHRYSALIDE_GLIBEXT_NAMED_H
+#define _PLUGINS_PYCHRYSALIDE_GLIBEXT_NAMED_H
+
+
+#include <Python.h>
+#include <stdbool.h>
+
+
+
+/* Fournit un accès à une définition de type à diffuser. */
+PyTypeObject *get_python_named_widget_type(void);
+
+/* Prend en charge l'objet 'pychrysalide.glibext.NamedWidget'. */
+bool ensure_python_named_widget_is_registered(void);
+
+/* Tente de convertir en composant nommé. */
+int convert_to_named_widget(PyObject *, void *);
+
+
+
+#endif /* _PLUGINS_PYCHRYSALIDE_GLIBEXT_NAMED_H */
diff --git a/plugins/pychrysalide/gtkext/Makefile.am b/plugins/pychrysalide/gtkext/Makefile.am
index 5895f24..6e1a259 100644
--- a/plugins/pychrysalide/gtkext/Makefile.am
+++ b/plugins/pychrysalide/gtkext/Makefile.am
@@ -6,7 +6,8 @@ libpychrysagtkext_la_SOURCES = \
bufferdisplay.h bufferdisplay.c \
displaypanel.h displaypanel.c \
dockable.h dockable.c \
- module.h module.c
+ module.h module.c \
+ named.h named.c
libpychrysagtkext_la_LIBADD = \
graph/libpychrysagtkextgraph.la
diff --git a/plugins/pychrysalide/gtkext/module.c b/plugins/pychrysalide/gtkext/module.c
index 7c684e4..245dc3c 100644
--- a/plugins/pychrysalide/gtkext/module.c
+++ b/plugins/pychrysalide/gtkext/module.c
@@ -32,6 +32,7 @@
#include "bufferdisplay.h"
#include "displaypanel.h"
#include "dockable.h"
+#include "named.h"
#include "graph/module.h"
#include "../helpers.h"
@@ -101,6 +102,7 @@ bool populate_gtkext_module(void)
if (result) result = ensure_python_buffer_display_is_registered();
if (result) result = ensure_python_display_panel_is_registered();
if (result) result = ensure_python_dockable_is_registered();
+ if (result) result = ensure_python_built_named_widget_is_registered();
if (result) result = populate_gtkext_graph_module();
diff --git a/plugins/pychrysalide/gtkext/named.c b/plugins/pychrysalide/gtkext/named.c
new file mode 100644
index 0000000..e272097
--- /dev/null
+++ b/plugins/pychrysalide/gtkext/named.c
@@ -0,0 +1,327 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * named.c - prototypes pour l'équivalent Python du fichier "gtkext/named.c"
+ *
+ * Copyright (C) 2020 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 "named.h"
+
+
+#include <pygobject.h>
+
+
+#include <gtkext/named-int.h>
+#include <plugins/dt.h>
+
+
+#include "../access.h"
+#include "../helpers.h"
+#include "../glibext/named.h"
+
+
+
+/* ------------------------ GLUE POUR CREATION DEPUIS PYTHON ------------------------ */
+
+
+/* Accompagne la création d'une instance dérivée en Python. */
+static PyObject *py_built_named_widget_new(PyTypeObject *, PyObject *, PyObject *);
+
+/* Initialise une instance sur la base du dérivé de GObject. */
+static int py_built_named_widget_init(PyObject *, PyObject *, PyObject *);
+
+
+
+/* --------------------------- MANIPULATION DE COMPOSANTS --------------------------- */
+
+
+/* Fournit le constructeur facilitant l'affichage. */
+static PyObject *py_built_named_widget_get_builder(PyObject *, void *);
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* GLUE POUR CREATION DEPUIS PYTHON */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : type = type du nouvel objet à mettre en place. *
+* args = éventuelle liste d'arguments. *
+* kwds = éventuel dictionnaire de valeurs mises à disposition. *
+* *
+* Description : Accompagne la création d'une instance dérivée en Python. *
+* *
+* Retour : Nouvel objet Python mis en place ou NULL en cas d'échec. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_built_named_widget_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
+{
+ PyObject *result; /* Objet à retourner */
+ PyTypeObject *base; /* Type de base à dériver */
+ bool first_time; /* Evite les multiples passages*/
+ GType gtype; /* Nouveau type de processeur */
+ bool status; /* Bilan d'un enregistrement */
+
+ /* Validations diverses */
+
+ base = get_python_built_named_widget_type();
+
+ if (type == base)
+ goto simple_way;
+
+ /* Mise en place d'un type dédié */
+
+ first_time = (g_type_from_name(type->tp_name) == 0);
+
+ gtype = build_dynamic_type(GTK_TYPE_BUILT_NAMED_WIDGET, type->tp_name, NULL, NULL, NULL);
+
+ if (first_time)
+ {
+ status = register_class_for_dynamic_pygobject(gtype, type, base);
+
+ if (!status)
+ {
+ result = NULL;
+ goto exit;
+ }
+
+ }
+
+ /* On crée, et on laisse ensuite la main à PyGObject_Type.tp_init() */
+
+ simple_way:
+
+ result = PyType_GenericNew(type, args, kwds);
+
+ exit:
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet à initialiser (théoriquement). *
+* args = arguments fournis à l'appel. *
+* kwds = arguments de type key=val fournis. *
+* *
+* Description : Initialise une instance sur la base du dérivé de GObject. *
+* *
+* Retour : 0. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static int py_built_named_widget_init(PyObject *self, PyObject *args, PyObject *kwds)
+{
+ const char *name; /* Désignation courte à lier */
+ const char *lname; /* Description longue associée */
+ const char *path; /* Fichier à charger */
+ int ret; /* Bilan de lecture des args. */
+ GtkBuiltNamedWidget *widget; /* Instance native à consulter */
+
+#define BUILT_NAMED_WIDGET_DOC \
+ "The BuiltNamedWidget object offers a quick way to get a working" \
+ " implementation of the pychrysalide.glibext.NamedWidget interface by" \
+ " relying on an external resource file for widgets.\n" \
+ "\n" \
+ "These widgets are managed using a Gtk.Builder instance internally.\n" \
+ "\n" \
+ "Instances can be created using the following constructor:\n" \
+ "\n" \
+ " BuiltNamedWidget(name, lname, filename)" \
+ "\n" \
+ "Where *name* is a short description to link to the result, *lname* is" \
+ " a longer version of this description and *filename* points to the" \
+ " file containing the widgets definition to load." \
+
+ /* Récupération des paramètres */
+
+ ret = PyArg_ParseTuple(args, "sss", &name, &lname, &path);
+ if (!ret) return -1;
+
+ /* Initialisation d'un objet GLib */
+
+ ret = forward_pygobjet_init(self);
+ if (ret == -1) return -1;
+
+ /* Eléments de base */
+
+ widget = GTK_BUILT_NAMED_WIDGET(pygobject_get(self));
+
+ widget->name = strdup(name);
+ widget->lname = strdup(lname);
+
+ widget->builder = gtk_builder_new_from_file(path);
+
+ return 0;
+
+}
+
+
+
+/* ---------------------------------------------------------------------------------- */
+/* MANIPULATION DE COMPOSANTS */
+/* ---------------------------------------------------------------------------------- */
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* closure = non utilisé ici. *
+* *
+* Description : Fournit le constructeur facilitant l'affichage. *
+* *
+* Retour : Constructeur mis en place. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_built_named_widget_get_builder(PyObject *self, void *closure)
+{
+ PyObject *result; /* Contenu binaire à retourner */
+ GtkBuiltNamedWidget *widget; /* Instance native à consulter */
+ GtkBuilder *builder; /* Constructeur à retourner */
+
+#define BUILT_NAMED_WIDGET_BUILDER_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ builder, py_built_named_widget, \
+ "Gtk.Builder instance handling all the widgets loaded from a" \
+ " resource file, or None in case of loading errors." \
+)
+
+ widget = GTK_BUILT_NAMED_WIDGET(pygobject_get(self));
+
+ builder = gtk_built_named_widget_get_builder(widget);
+
+ if (builder != NULL)
+ {
+ result = pygobject_new(G_OBJECT(builder));
+ g_object_unref(G_OBJECT(builder));
+ }
+
+ else
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : - *
+* *
+* Description : Fournit un accès à une définition de type à diffuser. *
+* *
+* Retour : Définition d'objet pour Python. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyTypeObject *get_python_built_named_widget_type(void)
+{
+ static PyMethodDef py_built_named_widget_methods[] = {
+ { NULL }
+ };
+
+ static PyGetSetDef py_built_named_widget_getseters[] = {
+ BUILT_NAMED_WIDGET_BUILDER_ATTRIB,
+ { NULL }
+ };
+
+ static PyTypeObject py_built_named_widget_type = {
+
+ PyVarObject_HEAD_INIT(NULL, 0)
+
+ .tp_name = "pychrysalide.gtkext.BuiltNamedWidget",
+ .tp_basicsize = sizeof(PyGObject),
+
+ .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+
+ .tp_doc = BUILT_NAMED_WIDGET_DOC,
+
+ .tp_methods = py_built_named_widget_methods,
+ .tp_getset = py_built_named_widget_getseters,
+
+ .tp_init = py_built_named_widget_init,
+ .tp_new = py_built_named_widget_new
+
+ };
+
+ static PyTypeObject *result = NULL;
+
+ if (result == NULL)
+ result = define_python_dynamic_type(&py_built_named_widget_type);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : module = module dont la définition est à compléter. *
+* *
+* Description : Prend en charge l'objet 'pychrysalide....BuiltNamedWidget'. *
+* *
+* Retour : Bilan de l'opération. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+bool ensure_python_built_named_widget_is_registered(void)
+{
+ PyTypeObject *type; /* Type 'BuiltNamedWidget' */
+ PyObject *module; /* Module à recompléter */
+ PyObject *dict; /* Dictionnaire du module */
+
+ type = get_python_built_named_widget_type();
+
+ if (!PyType_HasFeature(type, Py_TPFLAGS_READY))
+ {
+ module = get_access_to_python_module("pychrysalide.gtkext");
+
+ dict = PyModule_GetDict(module);
+
+ if (!ensure_python_named_widget_is_registered())
+ return false;
+
+ if (!register_class_for_pygobject(dict, GTK_TYPE_BUILT_NAMED_WIDGET, type, &PyGObject_Type))
+ return false;
+
+ }
+
+ return true;
+
+}
diff --git a/plugins/pychrysalide/gtkext/named.h b/plugins/pychrysalide/gtkext/named.h
new file mode 100644
index 0000000..71421f4
--- /dev/null
+++ b/plugins/pychrysalide/gtkext/named.h
@@ -0,0 +1,42 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * named.h - prototypes pour l'équivalent Python du fichier "gtkext/named.h"
+ *
+ * Copyright (C) 2020 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 _PLUGINS_PYCHRYSALIDE_GTKEXT_NAMED_H
+#define _PLUGINS_PYCHRYSALIDE_GTKEXT_NAMED_H
+
+
+#include <Python.h>
+#include <stdbool.h>
+
+
+
+/* Fournit un accès à une définition de type à diffuser. */
+PyTypeObject *get_python_built_named_widget_type(void);
+
+/* Prend en charge l'objet 'pychrysalide.gtkext.BuiltNamedWidget'. */
+bool ensure_python_built_named_widget_is_registered(void);
+
+
+
+#endif /* _PLUGINS_PYCHRYSALIDE_GTKEXT_NAMED_H */
diff --git a/plugins/pychrysalide/gui/Makefile.am b/plugins/pychrysalide/gui/Makefile.am
index 7f983d9..06c9db9 100644
--- a/plugins/pychrysalide/gui/Makefile.am
+++ b/plugins/pychrysalide/gui/Makefile.am
@@ -3,7 +3,7 @@ noinst_LTLIBRARIES = libpychrysagui.la
libpychrysagui_la_SOURCES = \
constants.h constants.c \
- editem.h editem.c \
+ item.h item.c \
module.h module.c \
panel.h panel.c
diff --git a/plugins/pychrysalide/gui/constants.c b/plugins/pychrysalide/gui/constants.c
index 40942f6..3cd943c 100644
--- a/plugins/pychrysalide/gui/constants.c
+++ b/plugins/pychrysalide/gui/constants.c
@@ -71,3 +71,59 @@ bool define_panel_item_constants(PyTypeObject *type)
return result;
}
+
+
+/******************************************************************************
+* *
+* Paramètres : arg = argument quelconque à tenter de convertir. *
+* dst = destination des valeurs récupérées en cas de succès. *
+* *
+* Description : Tente de convertir en constante PanelItemPersonality. *
+* *
+* Retour : Bilan de l'opération, voire indications supplémentaires. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+int convert_to_panel_item_personality(PyObject *arg, void *dst)
+{
+ int result; /* Bilan à retourner */
+ unsigned long value; /* Valeur transcrite */
+
+ result = PyObject_IsInstance(arg, (PyObject *)&PyLong_Type);
+
+ switch (result)
+ {
+ case -1:
+ /* L'exception est déjà fixée par Python */
+ result = 0;
+ break;
+
+ case 0:
+ PyErr_SetString(PyExc_TypeError, "unable to convert the provided argument to PanelItemPersonality");
+ break;
+
+ case 1:
+ value = PyLong_AsUnsignedLong(arg);
+
+ if (value > PIP_COUNT)
+ {
+ PyErr_SetString(PyExc_TypeError, "invalid value for PanelItemPersonality");
+ result = 0;
+ }
+
+ else
+ *((PanelItemPersonality *)dst) = value;
+
+ break;
+
+ default:
+ assert(false);
+ break;
+
+ }
+
+ return result;
+
+}
diff --git a/plugins/pychrysalide/gui/constants.h b/plugins/pychrysalide/gui/constants.h
index 8810ee1..247546c 100644
--- a/plugins/pychrysalide/gui/constants.h
+++ b/plugins/pychrysalide/gui/constants.h
@@ -34,6 +34,9 @@
/* Définit les constantes pour les panneaux graphiques. */
bool define_panel_item_constants(PyTypeObject *);
+/* Tente de convertir en constante PanelItemPersonality. */
+int convert_to_panel_item_personality(PyObject *, void *);
+
#endif /* _PLUGINS_PYCHRYSALIDE_GUI_CONSTANTS_H */
diff --git a/plugins/pychrysalide/gui/editem.c b/plugins/pychrysalide/gui/item.c
index 504f074..45190e4 100644
--- a/plugins/pychrysalide/gui/editem.c
+++ b/plugins/pychrysalide/gui/item.c
@@ -1,6 +1,6 @@
/* Chrysalide - Outil d'analyse de fichiers binaires
- * editem.c - prototypes pour l'équivalent Python du fichier "gui/editem.c"
+ * item.c - prototypes pour l'équivalent Python du fichier "gui/item.c"
*
* Copyright (C) 2018-2020 Cyrille Bagard
*
@@ -22,13 +22,14 @@
*/
-#include "editem.h"
+#include "item.h"
+#include <malloc.h>
#include <pygobject.h>
-#include <gui/editem-int.h>
+#include <gui/item-int.h>
#include "../access.h"
@@ -47,6 +48,11 @@
" is aimed to deal with all editor items at once. Thus such functions are" \
" located in this module." \
"\n" \
+ "Several items have to be defined as class attributes in the final" \
+ " class:\n" \
+ "* *_key*: a string providing a small name used to identify the item;\n" \
+ "* *_widget*: a Gtk.Widget instance for the content to display.\n" \
+ "\n" \
"The following special method can be overridden:\n" \
"* _change_content(self, old, new): get notified about a" \
" pychrysalide.analysis.LoadedContent change.\n" \
@@ -66,6 +72,12 @@
/* ------------------------ GLUE POUR CREATION DEPUIS PYTHON ------------------------ */
+/* Fournit le nom interne attribué à l'élément réactif. */
+static char *py_editor_item_get_key_wrapper(const GEditorItem *);
+
+/* Fournit le composant GTK associé à l'élément réactif. */
+static GtkWidget *py_editor_item_get_widget_wrapper(const GEditorItem *);
+
/* Réagit à un changement de contenu chargé en cours d'analyse. */
static void py_editor_item_change_content_wrapper(GEditorItem *, GLoadedContent *, GLoadedContent *);
@@ -86,8 +98,8 @@ static void py_editor_item_focus_cursor_wrapper(GEditorItem *, GLoadedContent *,
/* -------------------------- FONCTIONNALITES D'UN ELEMENT -------------------------- */
-/* Fournit le nom humain attribué à l'élément réactif. */
-static PyObject *py_editor_item_get_name(PyObject *, void *);
+/* Fournit le nom interne attribué à l'élément réactif. */
+static PyObject *py_editor_item_get_key(PyObject *, void *);
/* Fournit le composant GTK associé à l'élément réactif. */
static PyObject *py_editor_item_get_widget(PyObject *, void *);
@@ -114,6 +126,9 @@ static PyObject *py_editor_item_get_widget(PyObject *, void *);
void py_editor_item_init_gclass(GEditorItemClass *class, gpointer unused)
{
+ class->get_key = py_editor_item_get_key_wrapper;
+ class->get_widget = py_editor_item_get_widget_wrapper;
+
class->change_content = py_editor_item_change_content_wrapper;
class->change_view = py_editor_item_change_view_wrapper;
class->update_view = py_editor_item_update_view_wrapper;
@@ -127,6 +142,144 @@ void py_editor_item_init_gclass(GEditorItemClass *class, gpointer unused)
/******************************************************************************
* *
* Paramètres : item = instance à consulter. *
+* *
+* Description : Fournit le nom interne attribué à l'élément réactif. *
+* *
+* Retour : Désignation (courte) de l'élément de l'éditeur. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static char *py_editor_item_get_key_wrapper(const GEditorItem *item)
+{
+ char *result; /* Désignation à retourner */
+ PyGILState_STATE gstate; /* Sauvegarde d'environnement */
+ PyObject *pyobj; /* Objet Python concerné */
+ PyObject *pykey; /* Clef en objet Python */
+ int ret; /* Bilan d'une conversion */
+
+#define EDITOR_ITEM_KEY_ATTRIB_WRAPPER PYTHON_GETTER_WRAPPER_DEF \
+( \
+ _key, \
+ "Provide the internal name to use for the editor item.\n" \
+ "\n" \
+ "The result has to be a string." \
+)
+
+ result = NULL;
+
+ gstate = PyGILState_Ensure();
+
+ pyobj = pygobject_new(G_OBJECT(item));
+
+ if (PyObject_HasAttrString(pyobj, "_key"))
+ {
+ pykey = PyObject_GetAttrString(pyobj, "_key");
+
+ if (pykey != NULL)
+ {
+ ret = PyUnicode_Check(pykey);
+
+ if (ret)
+ result = strdup(PyUnicode_AsUTF8(pykey));
+
+ Py_DECREF(pykey);
+
+ }
+
+ }
+
+ Py_DECREF(pyobj);
+
+ PyGILState_Release(gstate);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : item = instance à consulter. *
+* *
+* Description : Fournit le composant GTK associé à l'élément réactif. *
+* *
+* Retour : Instance de composant graphique chargé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GtkWidget *py_editor_item_get_widget_wrapper(const GEditorItem *item)
+{
+ GtkWidget *result; /* Composant GTK à renvoyer */
+ PyGILState_STATE gstate; /* Sauvegarde d'environnement */
+ PyObject *pyobj; /* Objet Python concerné */
+ PyObject *pywidget; /* Composant en objet Python */
+ PyObject *gtk_mod; /* Module Python Gtk */
+ PyObject *type; /* Module "GtkWidget" */
+ int ret; /* Bilan d'une conversion */
+
+#define EDITOR_ITEM_WIDGET_ATTRIB_WRAPPER PYTHON_GETTER_WRAPPER_DEF \
+( \
+ _widget, \
+ "Provide the Gtk widget base involved in the editor item.\n" \
+ "\n" \
+ "The result has to be a Gtk.Widget instance." \
+)
+
+ result = NULL;
+
+ gstate = PyGILState_Ensure();
+
+ pyobj = pygobject_new(G_OBJECT(item));
+
+ if (PyObject_HasAttrString(pyobj, "_widget"))
+ {
+ pywidget = PyObject_GetAttrString(pyobj, "_widget");
+
+ if (pywidget != NULL)
+ {
+ gtk_mod = PyImport_ImportModule("gi.repository.Gtk");
+
+ if (gtk_mod == NULL)
+ {
+ PyErr_SetString(PyExc_TypeError, "unable to find the Gtk Python module");
+ goto exit;
+ }
+
+ type = PyObject_GetAttrString(gtk_mod, "Widget");
+
+ Py_DECREF(gtk_mod);
+
+ ret = PyObject_TypeCheck(pywidget, (PyTypeObject *)type);
+
+ Py_DECREF(type);
+
+ if (ret)
+ result = GTK_WIDGET(pygobject_get(pywidget));
+
+ Py_DECREF(pywidget);
+
+ }
+
+ }
+
+ exit:
+
+ Py_DECREF(pyobj);
+
+ PyGILState_Release(gstate);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : item = instance à consulter. *
* old = ancien contenu chargé analysé. *
* new = nouveau contenu chargé à analyser. *
* *
@@ -404,7 +557,7 @@ static void py_editor_item_focus_cursor_wrapper(GEditorItem *item, GLoadedConten
* Paramètres : self = objet Python concerné par l'appel. *
* closure = non utilisé ici. *
* *
-* Description : Fournit le nom humain attribué à l'élément réactif. *
+* Description : Fournit le nom interne attribué à l'élément réactif. *
* *
* Retour : Désignation (courte) de l'élément de l'éditeur. *
* *
@@ -412,24 +565,26 @@ static void py_editor_item_focus_cursor_wrapper(GEditorItem *item, GLoadedConten
* *
******************************************************************************/
-static PyObject *py_editor_item_get_name(PyObject *self, void *closure)
+static PyObject *py_editor_item_get_key(PyObject *self, void *closure)
{
PyObject *result; /* Valeur à retourner */
GEditorItem *item; /* Elément à consulter */
- const char *name; /* Désignation humaine */
+ char *key; /* Désignation humaine */
-#define EDITOR_ITEM_NAME_ATTRIB PYTHON_GET_DEF_FULL \
+#define EDITOR_ITEM_KEY_ATTRIB PYTHON_GET_DEF_FULL \
( \
- name, py_editor_item, \
- "Human name given to the editor item." \
+ key, py_editor_item, \
+ "Internal name given to the editor item." \
)
item = G_EDITOR_ITEM(pygobject_get(self));
- name = g_editor_item_get_name(item);
-
- if (name != NULL)
- result = PyUnicode_FromString(name);
+ key = g_editor_item_get_key(item);
+ if (key != NULL)
+ {
+ result = PyUnicode_FromString(key);
+ free(key);
+ }
else
{
result = Py_None;
@@ -463,7 +618,7 @@ static PyObject *py_editor_item_get_widget(PyObject *self, void *closure)
#define EDITOR_ITEM_WIDGET_ATTRIB PYTHON_GET_DEF_FULL \
( \
widget, py_editor_item, \
- "Base GTK widget involed in the editor item." \
+ "GTK widget base involed in the editor item." \
)
item = G_EDITOR_ITEM(pygobject_get(self));
@@ -505,7 +660,9 @@ PyTypeObject *get_python_editor_item_type(void)
};
static PyGetSetDef py_editor_item_getseters[] = {
- EDITOR_ITEM_NAME_ATTRIB,
+ EDITOR_ITEM_KEY_ATTRIB_WRAPPER,
+ EDITOR_ITEM_WIDGET_ATTRIB_WRAPPER,
+ EDITOR_ITEM_KEY_ATTRIB,
EDITOR_ITEM_WIDGET_ATTRIB,
{ NULL }
};
diff --git a/plugins/pychrysalide/gui/editem.h b/plugins/pychrysalide/gui/item.h
index 6af3b18..2b54963 100644
--- a/plugins/pychrysalide/gui/editem.h
+++ b/plugins/pychrysalide/gui/item.h
@@ -1,6 +1,6 @@
/* Chrysalide - Outil d'analyse de fichiers binaires
- * editem.h - prototypes pour l'équivalent Python du fichier "gui/editem.h"
+ * item.h - prototypes pour l'équivalent Python du fichier "gui/item.h"
*
* Copyright (C) 2018 Cyrille Bagard
*
@@ -22,15 +22,15 @@
*/
-#ifndef _PLUGINS_PYCHRYSALIDE_GUI_EDITEM_H
-#define _PLUGINS_PYCHRYSALIDE_GUI_EDITEM_H
+#ifndef _PLUGINS_PYCHRYSALIDE_GUI_ITEM_H
+#define _PLUGINS_PYCHRYSALIDE_GUI_ITEM_H
#include <Python.h>
#include <stdbool.h>
-#include <gui/editem.h>
+#include <gui/item.h>
@@ -53,4 +53,4 @@ bool ensure_python_editor_item_is_registered(void);
-#endif /* _PLUGINS_PYCHRYSALIDE_GUI_EDITEM_H */
+#endif /* _PLUGINS_PYCHRYSALIDE_GUI_ITEM_H */
diff --git a/plugins/pychrysalide/gui/module.c b/plugins/pychrysalide/gui/module.c
index 9c06940..66f0f24 100644
--- a/plugins/pychrysalide/gui/module.c
+++ b/plugins/pychrysalide/gui/module.c
@@ -29,7 +29,7 @@
-#include "editem.h"
+#include "item.h"
#include "panel.h"
#include "core/module.h"
#include "../helpers.h"
diff --git a/plugins/pychrysalide/gui/panel.c b/plugins/pychrysalide/gui/panel.c
index 33ff4e3..d9a2bc5 100644
--- a/plugins/pychrysalide/gui/panel.c
+++ b/plugins/pychrysalide/gui/panel.c
@@ -36,9 +36,10 @@
#include "constants.h"
-#include "editem.h"
+#include "item.h"
#include "../access.h"
#include "../helpers.h"
+#include "../glibext/named.h"
#include "../gtkext/dockable.h"
@@ -66,6 +67,9 @@ static PyObject *py_panel_item_dock(PyObject *, PyObject *);
/* Supprime un panneau de l'ensemble affiché. */
static PyObject *py_panel_item_undock(PyObject *, PyObject *);
+/* Fournit le chemin d'accès à utiliser pour les encapsulations. */
+static PyObject *py_panel_item_get_named_widget(PyObject *, void *);
+
/* Fournit une indication sur la personnalité du panneau. */
static PyObject *py_panel_item_get_personality(PyObject *, void *);
@@ -184,17 +188,14 @@ static void py_panel_item_init_gclass(GPanelItemClass *class, gpointer unused)
static int py_panel_item_init(PyObject *self, PyObject *args, PyObject *kwds)
{
- unsigned long personality; /* Nature du panneau */
- const char *name; /* Désignation humaine */
- const char *lname; /* Nom version longue */
- PyGObject *widget; /* Composant visuel du panneau */
+ PanelItemPersonality personality; /* Nature du panneau */
+ GNamedWidget *widget; /* Composant visuel du panneau */
int startup; /* Recommandation au démarrage */
const char *path; /* Placement à l'affichage */
int ret; /* Bilan de lecture des args. */
GPanelItem *panel; /* Panneau à manipuler */
- GEditorItem *item; /* Version basique d'instance */
- static char *kwlist[] = { "name", "widget", "personality", "lname", "dock", "path", NULL };
+ static char *kwlist[] = { "personality", "widget", "dock", "path", NULL };
#define PANEL_ITEM_DOC \
"PanelItem is an abstract class for panels available in the main GUI" \
@@ -202,15 +203,14 @@ static int py_panel_item_init(PyObject *self, PyObject *args, PyObject *kwds)
"\n" \
"Instances can be created using the following constructor:\n" \
"\n" \
- " PanelItem(name=str, widget=Gtk.Widget," \
- " personality=PanelItemPersonality, lname=str, dock=bool, path=str)" \
+ " PanelItem(personality, widget, dock, path)" \
"\n" \
"Where:\n" \
- "* name is the displayed label on the notebook tab when docked.\n" \
- "* widget is the main widget inside the panel.\n" \
"* personality defines how many instances of the panels can be created" \
" at the same time.\n" \
- "* lname is the long description used for the tooltip.\n" \
+ "* widget is an implementation of the pychrysalide.glibext.NamedWidget" \
+ " interface (see pychrysalide.gtkext.BuiltNamedWidget for a ready-to-use" \
+ " helper).\n" \
"* dock defines if the panel is docked by default.\n" \
"* path states the location of the panel inside the main GUI.\n" \
"\n" \
@@ -218,22 +218,25 @@ static int py_panel_item_init(PyObject *self, PyObject *args, PyObject *kwds)
" transitional dictionary inside the panel *__init__()* constructor:\n" \
"\n" \
" params = {\n" \
- " 'name' : 'Tab label',\n" \
- " 'widget' : self._my_gtk_widget,\n" \
" 'personality' : PanelItemPersonality.PIP_SINGLETON,\n" \
- " 'lname' : 'Long description for tooltip',\n" \
+ " 'widget' : my_named_widget_instance,\n" \
" 'dock' : True,\n" \
" 'path' : 'MES'\n" \
" }\n" \
" super(MyPanel, self).__init__(**params)\n" \
"\n" \
+ "The PanelItem definition handles internally the supply of the *_widget*" \
+ " attribute for pychrysalide.gui.EditorItem.\n" \
+ "\n" \
"For more details about the panel path, please refer to" \
" pychrysalide.gtkext.GtkDockable."
/* Récupération des paramètres */
- ret = PyArg_ParseTupleAndKeywords(args, kwds, "sOksps", kwlist,
- &name, &widget, &personality, &lname, &startup, &path);
+ ret = PyArg_ParseTupleAndKeywords(args, kwds, "O&O&ps", kwlist,
+ convert_to_panel_item_personality, &personality,
+ convert_to_named_widget, &widget,
+ &startup, &path);
if (!ret) return -1;
/* Initialisation d'un objet GLib */
@@ -245,15 +248,7 @@ static int py_panel_item_init(PyObject *self, PyObject *args, PyObject *kwds)
panel = G_PANEL_ITEM(pygobject_get(self));
- item = G_EDITOR_ITEM(panel);
-
- item->name = strdup(name);;
- item->widget = GTK_WIDGET(pygobject_get(widget));
-
panel->personality = personality;
- panel->lname = strdup(lname);
- panel->dock_at_startup = startup;
- panel->path = strdup(path);
/**
* Si Python ne voit plus la variable représentant le panneau utilisée,
@@ -262,7 +257,11 @@ static int py_panel_item_init(PyObject *self, PyObject *args, PyObject *kwds)
* On sera donc en situation de Use-After-Free, dont les conséquences
* arrivent très vite.
*/
- g_object_ref(G_OBJECT(item->widget));
+ panel->widget = widget;
+ g_object_ref(G_OBJECT(widget));
+
+ panel->dock_at_startup = startup;
+ panel->path = strdup(path);
return 0;
@@ -346,6 +345,43 @@ static PyObject *py_panel_item_undock(PyObject *self, PyObject *args)
* Paramètres : self = objet Python concerné par l'appel. *
* closure = non utilisé ici. *
* *
+* Description : Fournit le chemin d'accès à utiliser pour les encapsulations.*
+* *
+* Retour : Chemin d'accès défini. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_panel_item_get_named_widget(PyObject *self, void *closure)
+{
+ PyObject *result; /* Valeur à retourner */
+ GPanelItem *item; /* Panneau à consulter */
+ GNamedWidget *widget; /* Composant nommé à transférer*/
+
+#define PANEL_ITEM_NAMED_WIDGET_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ named_widget, py_panel_item, \
+ "Named widget as core component of the panel item." \
+)
+
+ item = G_PANEL_ITEM(pygobject_get(self));
+ widget = gtk_panel_item_get_named_widget(item);
+
+ result = pygobject_new(G_OBJECT(widget));
+
+ g_object_unref(G_OBJECT(widget));
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* closure = non utilisé ici. *
+* *
* Description : Fournit une indication sur la personnalité du panneau. *
* *
* Retour : Identifiant lié à la nature du panneau. *
@@ -502,6 +538,7 @@ PyTypeObject *get_python_panel_item_type(void)
};
static PyGetSetDef py_panel_item_getseters[] = {
+ PANEL_ITEM_NAMED_WIDGET_ATTRIB,
PANEL_ITEM_PERSONALITY_ATTRIB,
PANEL_ITEM_PATH_ATTRIB,
PANEL_ITEM_DOCKED_ATTRIB,
diff --git a/plugins/pychrysalide/helpers.c b/plugins/pychrysalide/helpers.c
index 1e83ac7..e9f65a9 100644
--- a/plugins/pychrysalide/helpers.c
+++ b/plugins/pychrysalide/helpers.c
@@ -60,7 +60,10 @@ static bool include_python_type_into_features(PyObject *, PyTypeObject *);
#define NO_CONSTRUCTOR_MSG _("Chrysalide does not allow building this kind of object from Python")
/* Message d'erreur affiché puis recherché. */
-#define NOT_IMPLEMENTED_MSG _("Chrysalide method implementation is missing")
+#define NOT_IMPLEMENTED_ROUTINE_MSG _("Chrysalide method implementation is missing")
+
+/* Message d'erreur affiché puis recherché. */
+#define NOT_IMPLEMENTED_GETTER_MSG _("Chrysalide getter implementation is missing")
/* Détermine une documentation adaptée à un type interne. */
@@ -252,7 +255,7 @@ PyObject *run_python_method(PyObject *module, const char *method, PyObject *args
if (type != NULL && type == PyExc_NotImplementedError \
&& value != NULL && PyUnicode_Check(value))
{
- refmsg = PyUnicode_FromString(NOT_IMPLEMENTED_MSG);
+ refmsg = PyUnicode_FromString(NOT_IMPLEMENTED_ROUTINE_MSG);
if (PyUnicode_Compare(value, refmsg) == 0)
{
@@ -611,7 +614,7 @@ PyObject *not_yet_implemented_method(PyObject *self, PyObject *args)
result = NULL;
- PyErr_SetString(PyExc_NotImplementedError, NOT_IMPLEMENTED_MSG);
+ PyErr_SetString(PyExc_NotImplementedError, NOT_IMPLEMENTED_ROUTINE_MSG);
return result;
@@ -645,6 +648,32 @@ PyObject *py_return_none(PyObject *self, PyObject *args)
/******************************************************************************
* *
+* Paramètres : self = objet quelconque dont le code Python hérite. *
+* closure = non utilisé ici. *
+* *
+* Description : Marque l'absence d'implémentation pour un attribut donné. *
+* *
+* Retour : NULL pour la levée d'exception. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+PyObject *not_yet_implemented_getter(PyObject *self, void *closure)
+{
+ PyObject *result; /* Exception à retourner */
+
+ result = NULL;
+
+ PyErr_SetString(PyExc_NotImplementedError, NOT_IMPLEMENTED_GETTER_MSG);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : spec = définition à mettre en place dynamiquement. *
* *
* Description : Définit dans le tas de Python un nouveau type. *
diff --git a/plugins/pychrysalide/helpers.h b/plugins/pychrysalide/helpers.h
index c3ae535..f2a9a1d 100644
--- a/plugins/pychrysalide/helpers.h
+++ b/plugins/pychrysalide/helpers.h
@@ -124,6 +124,14 @@ bool register_python_module_object(PyObject *, PyTypeObject *);
#define PYTHON_GETSET_DEF_FULL(name, base, doc) \
PYTHON_GETSET_DEF(#name, base ## _get_ ## name, base ## _set_ ## name, doc, NULL)
+#define PYTHON_GETTER_WRAPPER_DEF(name, doc) \
+ { \
+ #name, \
+ (getter)not_yet_implemented_getter, \
+ NULL, \
+ doc, NULL \
+ }
+
/**
* Quelque chose est mal fait au niveau de l'abstraction GObject.
* Du coup, Py_TPFLAGS_IS_ABSTRACT n'est pas pris en compte.
@@ -143,6 +151,9 @@ PyObject *not_yet_implemented_method(PyObject *, PyObject *);
/* Retourne toujours rien. */
PyObject *py_return_none(PyObject *, PyObject *);
+/* Marque l'absence d'implémentation pour un attribut donné. */
+PyObject *not_yet_implemented_getter(PyObject *, void *);
+
/* Définit dans le tas de Python un nouveau type. */
PyTypeObject *define_python_dynamic_type(const PyTypeObject *);
diff --git a/plugins/python/liveconv/panel.py b/plugins/python/liveconv/panel.py
index 0fee3cf..6503b7b 100644
--- a/plugins/python/liveconv/panel.py
+++ b/plugins/python/liveconv/panel.py
@@ -2,6 +2,7 @@
import os
from gi.repository import Gtk
from pychrysalide.analysis import LoadedBinary
+from pychrysalide.gtkext import BuiltNamedWidget
from pychrysalide.gui import core
from pychrysalide.gui import PanelItem
@@ -10,21 +11,22 @@ from .converters import *
class ConvPanel(PanelItem):
+ _key = 'liveconv'
+
+
def __init__(self):
"""Initialize the GUI panel."""
directory = os.path.dirname(os.path.realpath(__file__))
+ filename = os.path.join(directory, 'panel.ui')
- self._builder = Gtk.Builder()
- self._builder.add_from_file(os.path.join(directory, 'panel.ui'))
+ widget = BuiltNamedWidget('Converter', 'Data live converter', filename)
params = {
- 'name' : 'Converter',
- 'widget' : self._builder.get_object('content'),
-
'personality' : PanelItem.PanelItemPersonality.SINGLETON,
- 'lname' : 'Data live converter',
+ 'widget' : widget,
+
'dock' : True,
'path' : 'MES'
@@ -59,9 +61,11 @@ class ConvPanel(PanelItem):
}
+ builder = self.named_widget.builder
+
for kind, func in self._conversions.items():
- label = self._builder.get_object('%s_value' % kind)
+ label = builder.get_object('%s_value' % kind)
label.set_text('-')
self._order = '@'
@@ -73,9 +77,11 @@ class ConvPanel(PanelItem):
loaded = core.get_current_content()
assert(loaded)
+ builder = self.named_widget.builder
+
for kind, func in self._conversions.items():
- label = self._builder.get_object('%s_value' % kind)
+ label = builder.get_object('%s_value' % kind)
try:
addr = cursor.retrieve()
diff --git a/plugins/python/liveconv/panel.ui b/plugins/python/liveconv/panel.ui
index 6c3d05a..326f0b5 100644
--- a/plugins/python/liveconv/panel.ui
+++ b/plugins/python/liveconv/panel.ui
@@ -1,318 +1,352 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.21.0 -->
+<!-- Generated with glade 3.37.0 -->
<interface>
<requires lib="gtk+" version="3.20"/>
- <object class="GtkScrolledWindow" id="content">
+ <object class="GtkScrolledWindow" id="box">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="shadow_type">in</property>
+ <property name="can-focus">True</property>
+ <property name="shadow-type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkExpander">
<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="margin_bottom">8</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="margin-bottom">8</property>
<property name="expanded">True</property>
<child>
+ <!-- n-columns=3 n-rows=11 -->
<object class="GtkGrid">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">8</property>
- <property name="margin_top">8</property>
- <property name="row_spacing">4</property>
- <property name="column_spacing">8</property>
+ <property name="can-focus">False</property>
+ <property name="margin-left">8</property>
+ <property name="margin-top">8</property>
+ <property name="row-spacing">4</property>
+ <property name="column-spacing">8</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">int8_t:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="int8_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">uint8_t:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="uint8_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">int16_t:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="int16_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">uint16_t:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="uint16_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">int32_t:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="int32_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">uint32_t:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">5</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="uint32_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">5</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">int64_t:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">6</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="int64_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">6</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">6</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">uint64_t:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">7</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="uint64_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">7</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes"> half-precision float:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">8</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">8</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="half_float_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">8</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">8</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes"> float:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">9</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">9</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="float_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">9</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">9</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes"> double:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">10</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">10</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="double_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">10</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">10</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">Numbers</property>
</object>
</child>
@@ -326,151 +360,167 @@
<child>
<object class="GtkExpander">
<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="margin_bottom">8</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="margin-bottom">8</property>
<property name="expanded">True</property>
<child>
+ <!-- n-columns=3 n-rows=5 -->
<object class="GtkGrid">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">8</property>
- <property name="margin_top">8</property>
- <property name="row_spacing">4</property>
- <property name="column_spacing">8</property>
+ <property name="can-focus">False</property>
+ <property name="margin-left">8</property>
+ <property name="margin-top">8</property>
+ <property name="row-spacing">4</property>
+ <property name="column-spacing">8</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">time_t:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="time_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">time64_t:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="time64_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">FILETIME:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="filetime_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">MS-DOS time:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="dostime_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">MS-DOS date:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="dosdate_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">4</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">4</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">Timestamps</property>
</object>
</child>
@@ -484,126 +534,139 @@
<child>
<object class="GtkExpander">
<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="margin_bottom">8</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="margin-bottom">8</property>
<property name="expanded">True</property>
<child>
+ <!-- n-columns=3 n-rows=4 -->
<object class="GtkGrid">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="margin_left">8</property>
- <property name="margin_top">8</property>
- <property name="row_spacing">4</property>
- <property name="column_spacing">8</property>
+ <property name="can-focus">False</property>
+ <property name="margin-left">8</property>
+ <property name="margin-top">8</property>
+ <property name="row-spacing">4</property>
+ <property name="column-spacing">8</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">char:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="char_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">ANSI:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="ansi_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">UTF-8:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="utf8_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">UTF-16:</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">0</property>
+ <property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="utf16_value">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
<property name="selectable">True</property>
<property name="xalign">0</property>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="top_attach">3</property>
+ <property name="left-attach">1</property>
+ <property name="top-attach">3</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
- <property name="can_focus">False</property>
+ <property name="can-focus">False</property>
<property name="label" translatable="yes">Strings</property>
</object>
</child>