diff options
Diffstat (limited to 'src/gui/panels')
-rw-r--r-- | src/gui/panels/Makefile.am | 41 | ||||
-rw-r--r-- | src/gui/panels/binary-int.h | 52 | ||||
-rw-r--r-- | src/gui/panels/binary-params-int.h | 50 | ||||
-rw-r--r-- | src/gui/panels/binary-params.c | 178 | ||||
-rw-r--r-- | src/gui/panels/binary-params.h | 41 | ||||
-rw-r--r-- | src/gui/panels/binary-params.ui | 42 | ||||
-rw-r--r-- | src/gui/panels/binary.c | 195 | ||||
-rw-r--r-- | src/gui/panels/binary.h | 48 | ||||
-rw-r--r-- | src/gui/panels/binary.ui | 16 | ||||
-rw-r--r-- | src/gui/panels/gresource.xml | 26 | ||||
-rw-r--r-- | src/gui/panels/log.c | 451 | ||||
-rw-r--r-- | src/gui/panels/log.h | 67 | ||||
-rw-r--r-- | src/gui/panels/log.ui | 59 | ||||
-rw-r--r-- | src/gui/panels/logs-col-icon.ui | 17 | ||||
-rw-r--r-- | src/gui/panels/logs-col-message.ui | 19 | ||||
-rw-r--r-- | src/gui/panels/logs-int.h | 53 | ||||
-rw-r--r-- | src/gui/panels/logs.c | 227 | ||||
-rw-r--r-- | src/gui/panels/logs.h | 47 | ||||
-rw-r--r-- | src/gui/panels/logs.ui | 58 | ||||
-rw-r--r-- | src/gui/panels/welcome-hints.txt | 23 | ||||
-rw-r--r-- | src/gui/panels/welcome-int.h | 61 | ||||
-rw-r--r-- | src/gui/panels/welcome.c | 881 | ||||
-rw-r--r-- | src/gui/panels/welcome.h | 37 | ||||
-rw-r--r-- | src/gui/panels/welcome.ui | 399 |
24 files changed, 1477 insertions, 1611 deletions
diff --git a/src/gui/panels/Makefile.am b/src/gui/panels/Makefile.am index 83e173b..ecff6c7 100644 --- a/src/gui/panels/Makefile.am +++ b/src/gui/panels/Makefile.am @@ -3,7 +3,7 @@ DEFAULT_INCLUDES = -idirafter. -I$(top_builddir) BUILT_SOURCES = resources.h resources.c -noinst_LTLIBRARIES = libguipanels.la +noinst_LTLIBRARIES = libguipanels4.la # libguipanels.la UI_FILES = \ bintree.ui \ @@ -11,11 +11,9 @@ UI_FILES = \ errors.ui \ glance.ui \ history.ui \ - log.ui \ regedit.ui \ strings.ui \ - symbols.ui \ - welcome.ui + symbols.ui libguipanels_la_SOURCES = \ bintree.h bintree.c \ @@ -23,25 +21,50 @@ libguipanels_la_SOURCES = \ errors.h errors.c \ glance.h glance.c \ history.h history.c \ - log.h log.c \ regedit.h regedit.c \ resources.h resources.c \ strings.h strings.c \ symbols.h symbols.c \ updating-int.h \ updating.h updating.c \ - view.h view.c \ - welcome.h welcome.c + view.h view.c libguipanels_la_CFLAGS = $(LIBGTK_CFLAGS) $(LIBXML_CFLAGS) +IMG_PATH = ../../../data/images + +RES_FILES = \ + binary.ui \ + binary-params.ui \ + $(IMG_PATH)/binfile-symbolic.svg \ + logs.ui \ + logs-col-icon.ui \ + logs-col-message.ui \ + welcome.ui \ + welcome-hints.txt \ + $(IMG_PATH)/tipoftheday-symbolic.svg + +libguipanels4_la_SOURCES = \ + binary-int.h \ + binary.h binary.c \ + binary-params-int.h \ + binary-params.h binary-params.c \ + logs-int.h \ + logs.h logs.c \ + resources.h resources.c \ + welcome-int.h \ + welcome.h welcome.c + +libguipanels4_la_CFLAGS = $(LIBGTK4_CFLAGS) + + devdir = $(includedir)/chrysalide/$(subdir:src/%=core/%) dev_HEADERS = $(libguipanels_la_SOURCES:%c=) -resources.c: gresource.xml $(UI_FILES) +resources.c: gresource.xml $(RES_FILES) glib-compile-resources --target=$@ --sourcedir=$(srcdir) --generate-source --c-name gui_panels gresource.xml resources.h: gresource.xml @@ -50,4 +73,4 @@ resources.h: gresource.xml CLEANFILES = resources.h resources.c -EXTRA_DIST = gresource.xml $(UI_FILES) +EXTRA_DIST = gresource.xml $(RES_FILES) diff --git a/src/gui/panels/binary-int.h b/src/gui/panels/binary-int.h new file mode 100644 index 0000000..5116f5c --- /dev/null +++ b/src/gui/panels/binary-int.h @@ -0,0 +1,52 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * binary-int.h - prototypes internes pour le panneau d'affichage de contenus d'un binaire, bruts ou non + * + * Copyright (C) 2024 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 _GUI_PANELS_BINARY_INT_H +#define _GUI_PANELS_BINARY_INT_H + + +#include "binary.h" +#include "../../gtkext/panel-int.h" + + + +/* Panneau d'accueil par défaut (instance) */ +struct _GtkBinaryPanel +{ + GtkTiledPanel parent; /* A laisser en premier */ + + GtkScrolledWindow *hex_scroll; /* Défilement pour contenu #0 */ + +}; + +/* Panneau d'accueil par défaut (classe) */ +struct _GtkBinaryPanelClass +{ + GtkTiledPanelClass parent; /* A laisser en premier */ + +}; + + + +#endif /* _GUI_PANELS_BINARY_INT_H */ diff --git a/src/gui/panels/binary-params-int.h b/src/gui/panels/binary-params-int.h new file mode 100644 index 0000000..0fbef24 --- /dev/null +++ b/src/gui/panels/binary-params-int.h @@ -0,0 +1,50 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * binary-params-int.h - définitions internes pour l'édition des paramètres initiaux d'un chargement de binaire + * + * Copyright (C) 2025 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * Chrysalide is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Chrysalide is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Chrysalide. If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _GUI_PANELS_BINARY_PARAMS_INT_H +#define _GUI_PANELS_BINARY_PARAMS_INT_H + + +#include "binary-params.h" + + + +/* Composant pour les paramètres de chargement d'un binaire (instance) */ +struct _GtkBinaryParameters +{ + GtkGrid parent; /* A laisser en premier */ + + GtkEntry *filename; /* CHemin d'un binaire */ + +}; + +/* Composant pour les paramètres de chargement d'un binaire (classe) */ +struct _GtkBinaryParametersClass +{ + GtkGridClass parent; /* A laisser en premier */ + +}; + + + +#endif /* _GUI_PANELS_BINARY_PARAMS_INT_H */ diff --git a/src/gui/panels/binary-params.c b/src/gui/panels/binary-params.c new file mode 100644 index 0000000..1059761 --- /dev/null +++ b/src/gui/panels/binary-params.c @@ -0,0 +1,178 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * binary-params.c - édition des paramètres initiaux d'un chargement de binaire + * + * Copyright (C) 2025 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * Chrysalide is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Chrysalide is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Chrysalide. If not, see <http://www.gnu.org/licenses/>. + */ + + +#include "binary-params.h" + + +#include "binary.h" +#include "binary-params-int.h" +#include "../window.h" +#include "../../analysis/contents/file.h" +#include "../../gtkext/helpers.h" + + + +/* Initialise la classe des composants d'édition de paramètres. */ +static void gtk_binary_parameters_class_init(GtkBinaryParametersClass *); + +/* Initialise une instance de composant d'édition de paramètres. */ +static void gtk_binary_parameters_init(GtkBinaryParameters *); + +/* Supprime toutes les références externes. */ +static void gtk_binary_parameters_dispose(GObject *); + +/* Procède à la libération totale de la mémoire. */ +static void gtk_binary_parameters_finalize(GObject *); + +/* Ouvre une boîte de dialogue pour récupérer un fichier. */ +static void gtk_binary_parameters_on_new_file_entry_icon_release(GtkEntry *, GtkEntryIconPosition, GtkBinaryParameters *); + + + +/* Détermine le type du composant d'édition des paramètres de chargement. */ +G_DEFINE_TYPE(GtkBinaryParameters, gtk_binary_parameters, GTK_TYPE_GRID); + + +/****************************************************************************** +* * +* Paramètres : class = classe GTK à initialiser. * +* * +* Description : Initialise la classe des composants d'édition de paramètres. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_binary_parameters_class_init(GtkBinaryParametersClass *class) +{ + GObjectClass *object; /* Plus haut niveau équivalent */ + GtkWidgetClass *widget; /* Classe de haut niveau */ + + object = G_OBJECT_CLASS(class); + + object->dispose = gtk_binary_parameters_dispose; + object->finalize = gtk_binary_parameters_finalize; + + widget = GTK_WIDGET_CLASS(class); + + gtk_widget_class_set_template_from_resource(widget, "/re/chrysalide/framework/gui/panels/binary-params.ui"); + + gtk_widget_class_bind_template_callback_full(widget, BUILDER_CB(gtk_binary_parameters_on_new_file_entry_icon_release)); + + gtk_widget_class_bind_template_child(widget, GtkBinaryParameters, filename); + +} + + +/****************************************************************************** +* * +* Paramètres : params = composant GTK à initialiser. * +* * +* Description : Initialise une instance de composant d'édition de paramètres.* +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_binary_parameters_init(GtkBinaryParameters *params) +{ + gtk_widget_init_template(GTK_WIDGET(params)); + +} + + +/****************************************************************************** +* * +* Paramètres : object = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_binary_parameters_dispose(GObject *object) +{ + gtk_widget_dispose_template(GTK_WIDGET(object), GTK_TYPE_BINARY_PARAMETERS); + + G_OBJECT_CLASS(gtk_binary_parameters_parent_class)->dispose(object); + +} + + +/****************************************************************************** +* * +* Paramètres : object = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_binary_parameters_finalize(GObject *object) +{ + G_OBJECT_CLASS(gtk_binary_parameters_parent_class)->finalize(object); + +} + + +/****************************************************************************** +* * +* Paramètres : entry = zone de saisie concernée par l'appel. * +* icon_pos = position de l'icone incrustée dans la zone. * +* params = composant d'édition des paramètres. * +* * +* Description : Ouvre une boîte de dialogue pour récupérer un fichier. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_binary_parameters_on_new_file_entry_icon_release(GtkEntry *entry, GtkEntryIconPosition icon_pos, GtkBinaryParameters *params) +{ + GtkRoot *root; /* Racine du composant */ + GBinContent *content; /* Contenu binaire à afficher */ + GtkTiledPanel *tiled; /* Panneau d'affichage complet */ + + root = gtk_widget_get_root(GTK_WIDGET(entry)); + + content = g_file_content_new("/bin/id"); + + tiled = gtk_binary_panel_new_for_content(content); + + unref_object(content); + + gtk_framework_window_add(GTK_FRAMEWORK_WINDOW(root), tiled); + +} diff --git a/src/gui/panels/binary-params.h b/src/gui/panels/binary-params.h new file mode 100644 index 0000000..450da25 --- /dev/null +++ b/src/gui/panels/binary-params.h @@ -0,0 +1,41 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * binary-params.h - prototypes pour l'édition des paramètres initiaux d'un chargement de binaire + * + * Copyright (C) 2025 Cyrille Bagard + * + * This file is part of Chrysalide. + * + * Chrysalide is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Chrysalide is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Chrysalide. If not, see <http://www.gnu.org/licenses/>. + */ + + +#ifndef _GUI_PANELS_BINARY_PARAMS_H +#define _GUI_PANELS_BINARY_PARAMS_H + + +#include <gtk/gtk.h> + + +#include "../../glibext/helpers.h" + + + +#define GTK_TYPE_BINARY_PARAMETERS (gtk_binary_parameters_get_type()) + +DECLARE_GTYPE(GtkBinaryParameters, gtk_binary_parameters, GTK, BINARY_PARAMETERS); + + + +#endif /* _GUI_PANELS_BINARY_PARAMS_H */ diff --git a/src/gui/panels/binary-params.ui b/src/gui/panels/binary-params.ui new file mode 100644 index 0000000..dcbaf7c --- /dev/null +++ b/src/gui/panels/binary-params.ui @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + + <template class="GtkBinaryParameters" parent="GtkGrid"> + <property name="margin-bottom">12</property> + <property name="margin-end">12</property> + <property name="margin-start">12</property> + <property name="margin-top">12</property> + <property name="column-spacing">12</property> + <property name="row-spacing">8</property> + + <child> + <object class="GtkLabel"> + <property name="label">Load and analyze a new file:</property> + <property name="xalign">0</property> + <layout> + <property name="column">0</property> + <property name="row">0</property> + </layout> + </object> + </child> + + <child> + <object class="GtkEntry" id="filename"> + <property name="secondary-icon-name">document-open-symbolic</property> + <property name="placeholder-text">File location</property> + <property name="hexpand">TRUE</property> + <property name="hexpand-set">TRUE</property> + <layout> + <property name="column">0</property> + <property name="row">1</property> + </layout> + <style> + <class name="background"/> + </style> + <signal name="icon-release" handler="gtk_binary_parameters_on_new_file_entry_icon_release"/> + </object> + </child> + + </template> + +</interface> diff --git a/src/gui/panels/binary.c b/src/gui/panels/binary.c new file mode 100644 index 0000000..f58c06b --- /dev/null +++ b/src/gui/panels/binary.c @@ -0,0 +1,195 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * binary.c - panneau d'affichage de contenus d'un binaire, bruts ou non + * + * Copyright (C) 2024 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 "binary.h" + + +#include "binary-int.h" +#include "../../gtkext/helpers.h" +#include "../../gtkext/hexview.h" + + + +/* ------------------------- COEUR D'UN PANNEAU D'AFFICHAGE ------------------------- */ + + +/* Initialise la classe des panneaux pour binaires. */ +static void gtk_binary_panel_class_init(GtkBinaryPanelClass *); + +/* Initialise une instance de panneau pour binaire. */ +static void gtk_binary_panel_init(GtkBinaryPanel *); + +/* Supprime toutes les références externes. */ +static void gtk_binary_panel_dispose(GObject *); + +/* Procède à la libération totale de la mémoire. */ +static void gtk_binary_panel_finalize(GObject *); + + + +/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */ + + + + + + +/* ---------------------------------------------------------------------------------- */ +/* COEUR D'UN PANNEAU D'AFFICHAGE */ +/* ---------------------------------------------------------------------------------- */ + + +/* Indique le type défini pour un panneau d'affichage de contenus d'un binaire. */ +G_DEFINE_TYPE(GtkBinaryPanel, gtk_binary_panel, GTK_TYPE_TILED_PANEL); + + +/****************************************************************************** +* * +* Paramètres : class = classe à initialiser. * +* * +* Description : Initialise la classe des panneaux pour binaires. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_binary_panel_class_init(GtkBinaryPanelClass *class) +{ + GObjectClass *object; /* Autre version de la classe */ + GtkWidgetClass *widget; /* Classe de haut niveau */ + + object = G_OBJECT_CLASS(class); + + object->dispose = gtk_binary_panel_dispose; + object->finalize = gtk_binary_panel_finalize; + + widget = GTK_WIDGET_CLASS(class); + + gtk_widget_class_set_template_from_resource(widget, "/re/chrysalide/framework/gui/panels/binary.ui"); + + gtk_widget_class_bind_template_child(widget, GtkBinaryPanel, hex_scroll); + +} + + +/****************************************************************************** +* * +* Paramètres : panel = instance à initialiser. * +* * +* Description : Initialise une instance de panneau pour binaire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_binary_panel_init(GtkBinaryPanel *panel) +{ + gtk_widget_init_template(GTK_WIDGET(panel)); + +} + + +/****************************************************************************** +* * +* Paramètres : object = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_binary_panel_dispose(GObject *object) +{ + gtk_widget_dispose_template(GTK_WIDGET(object), GTK_TYPE_BINARY_PANEL); + + G_OBJECT_CLASS(gtk_binary_panel_parent_class)->dispose(object); + +} + + +/****************************************************************************** +* * +* Paramètres : object = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_binary_panel_finalize(GObject *object) +{ + G_OBJECT_CLASS(gtk_binary_panel_parent_class)->finalize(object); + +} + + +/****************************************************************************** +* * +* Paramètres : content = contenu brut à exposer. * +* * +* Description : Crée une nouvelle instance de panneau pour binaire. * +* * +* Retour : Composant GTK mis en place. * +* * +* Remarques : - * +* * +******************************************************************************/ + +GtkTiledPanel *gtk_binary_panel_new_for_content(GBinContent *content) +{ + GtkTiledPanel *result; /* Instance à retourner */ + GtkHexView *view; /* Composant d'affichage */ + + result = g_object_new(GTK_TYPE_BINARY_PANEL, NULL); + + view = gtk_hex_view_new(content); + gtk_scrolled_window_set_child(GTK_BINARY_PANEL(result)->hex_scroll, GTK_WIDGET(view)); + + return result; + +} + + + +/* ---------------------------------------------------------------------------------- */ +/* IMPLEMENTATION DES FONCTIONS DE CLASSE */ +/* ---------------------------------------------------------------------------------- */ + + + + + + + + diff --git a/src/gui/panels/binary.h b/src/gui/panels/binary.h new file mode 100644 index 0000000..26f8a7d --- /dev/null +++ b/src/gui/panels/binary.h @@ -0,0 +1,48 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * binary.h - prototypes pour le panneau d'accueil par défaut + * + * Copyright (C) 2012-2024 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 _GUI_PANELS_BINARY_H +#define _GUI_PANELS_BINARY_H + + +#include <gtk/gtk.h> + + +#include "../../analysis/content.h" +#include "../../glibext/helpers.h" +#include "../../gtkext/panel.h" + + + +#define GTK_TYPE_BINARY_PANEL (gtk_binary_panel_get_type()) + +DECLARE_GTYPE(GtkBinaryPanel, gtk_binary_panel, GTK, BINARY_PANEL); + + +/* Crée une nouvelle instance de panneau pour binaire. */ +GtkTiledPanel *gtk_binary_panel_new_for_content(GBinContent *); + + + +#endif /* _GUI_PANELS_BINARY_H */ diff --git a/src/gui/panels/binary.ui b/src/gui/panels/binary.ui new file mode 100644 index 0000000..a34c409 --- /dev/null +++ b/src/gui/panels/binary.ui @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + + <template class="GtkBinaryPanel" parent="GtkTiledPanel"> + <child> + <object class="GtkScrolledWindow" id="hex_scroll"> + <property name="hscrollbar-policy">automatic</property> + <property name="vscrollbar-policy">automatic</property> + <property name="hexpand">TRUE</property> + <property name="vexpand">TRUE</property> + <property name="has-frame">0</property> + </object> + </child> + </template> + +</interface> diff --git a/src/gui/panels/gresource.xml b/src/gui/panels/gresource.xml index d996ef1..2765b25 100644 --- a/src/gui/panels/gresource.xml +++ b/src/gui/panels/gresource.xml @@ -1,20 +1,16 @@ <?xml version="1.0" encoding="UTF-8"?> <gresources> - <gresource prefix="/org/chrysalide/gui/panels"> - <file compressed="true">../../../pixmaps/tbutton_list_view.png</file> - <file compressed="true">../../../pixmaps/tbutton_tree_view.png</file> - <file compressed="true">../../../pixmaps/tbutton_collapse.png</file> - <file compressed="true">../../../pixmaps/tbutton_expand.png</file> - <file compressed="true">../../../pixmaps/symbol_class_classic.png</file> - <file compressed="true">bintree.ui</file> - <file compressed="true">bookmarks.ui</file> - <file compressed="true">errors.ui</file> - <file compressed="true">glance.ui</file> - <file compressed="true">history.ui</file> - <file compressed="true">log.ui</file> - <file compressed="true">regedit.ui</file> - <file compressed="true">strings.ui</file> - <file compressed="true">symbols.ui</file> + <gresource prefix="/re/chrysalide/framework/gui/panels"> + <file compressed="true">binary.ui</file> + <file compressed="true">binary-params.ui</file> + <file compressed="true">logs.ui</file> + <file compressed="true">logs-col-icon.ui</file> + <file compressed="true">logs-col-message.ui</file> <file compressed="true">welcome.ui</file> + <file compressed="true">welcome-hints.txt</file> + </gresource> + <gresource prefix="/re/chrysalide/framework/gui/icons/scalable/actions"> + <file compressed="true" alias="binfile-symbolic.svg">../../../data/images/binfile-symbolic.svg</file> + <file compressed="true" alias="tipoftheday-symbolic.svg">../../../data/images/tipoftheday-symbolic.svg</file> </gresource> </gresources> diff --git a/src/gui/panels/log.c b/src/gui/panels/log.c deleted file mode 100644 index d11fbd2..0000000 --- a/src/gui/panels/log.c +++ /dev/null @@ -1,451 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * log.c - panneau d'affichage des messages système - * - * Copyright (C) 2012-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 "log.h" - - -#include <malloc.h> -#include <stdarg.h> -#include <stdio.h> -#include <string.h> -#include <gtk/gtk.h> - - -#include "../panel-int.h" -#include "../core/panels.h" -#include "../../gtkext/easygtk.h" -#include "../../gtkext/named.h" - - - -/* Colonnes de la liste des messages */ -typedef enum _LogColumn -{ - LGC_PICTURE, /* Image de représentation */ - LGC_STRING, /* Chaîne de caractères */ - - LGC_COUNT /* Nombre de colonnes */ - -} LogColumn; - - -/* Paramètres à transmettre pour un affichage */ -typedef struct _log_data -{ - GPanelItem *item; /* Intermédiaire mis en place */ - LogMessageType type; /* Type de message à afficher */ - char *msg; /* Contenu du message */ - -} log_data; - - -/* Panneau d'accueil (instance) */ -struct _GLogPanel -{ - GPanelItem parent; /* A laisser en premier */ - -}; - - -/* Panneau d'accueil (classe) */ -struct _GLogPanelClass -{ - GPanelItemClass parent; /* A laisser en premier */ - -}; - - -/* Initialise la classe des panneaux d'affichage des messages. */ -static void g_log_panel_class_init(GLogPanelClass *); - -/* Initialise une instance de panneau d'affichage des messages. */ -static void g_log_panel_init(GLogPanel *); - -/* Supprime toutes les références externes. */ -static void g_log_panel_dispose(GLogPanel *); - -/* Procède à la libération totale de la mémoire. */ -static void g_log_panel_finalize(GLogPanel *); - -/* Fournit le nom interne attribué à l'élément réactif. */ -static char *g_log_panel_class_get_key(const GLogPanelClass *); - -/* Fournit une indication sur la personnalité du panneau. */ -static PanelItemPersonality g_log_panel_class_get_personality(const GLogPanelClass *); - -/* Indique le chemin initial de la localisation d'un panneau. */ -static char *g_log_panel_class_get_path(const GLogPanelClass *); - -/* Indique la définition d'un éventuel raccourci clavier. */ -static char *g_log_panel_class_get_key_bindings(const GLogPanelClass *); - -/* Affiche un message dans le journal des messages système. */ -static gboolean log_message(log_data *); - - - -/* Indique le type défini pour un panneau d'affichage de messages. */ -G_DEFINE_TYPE(GLogPanel, g_log_panel, G_TYPE_PANEL_ITEM); - - -/****************************************************************************** -* * -* Paramètres : class = classe à initialiser. * -* * -* Description : Initialise la classe des panneaux d'affichage des messages. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_log_panel_class_init(GLogPanelClass *class) -{ - GObjectClass *object; /* Autre version de la classe */ - GEditorItemClass *item; /* Encore une autre vision... */ - GPanelItemClass *panel; /* Version parente de la classe*/ - - object = G_OBJECT_CLASS(class); - - object->dispose = (GObjectFinalizeFunc/* ! */)g_log_panel_dispose; - object->finalize = (GObjectFinalizeFunc)g_log_panel_finalize; - - item = G_EDITOR_ITEM_CLASS(class); - - item->get_key = (get_item_key_fc)g_log_panel_class_get_key; - - panel = G_PANEL_ITEM_CLASS(class); - - panel->get_personality = (get_panel_personality_fc)g_log_panel_class_get_personality; - panel->get_path = (get_panel_path_fc)g_log_panel_class_get_path; - panel->get_bindings = (get_panel_bindings_fc)g_log_panel_class_get_key_bindings; - -} - - -/****************************************************************************** -* * -* Paramètres : panel = instance à initialiser. * -* * -* Description : Initialise une instance de panneau d'affichage des messages. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_log_panel_init(GLogPanel *panel) -{ - GPanelItem *pitem; /* Version parente du panneau */ - - /* Eléments de base */ - - pitem = G_PANEL_ITEM(panel); - - pitem->widget = G_NAMED_WIDGET(gtk_built_named_widget_new_for_panel(_("Messages"), - _("Misc information"), - PANEL_LOG_ID)); - -} - - -/****************************************************************************** -* * -* Paramètres : panel = instance d'objet GLib à traiter. * -* * -* Description : Supprime toutes les références externes. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_log_panel_dispose(GLogPanel *panel) -{ - G_OBJECT_CLASS(g_log_panel_parent_class)->dispose(G_OBJECT(panel)); - -} - - -/****************************************************************************** -* * -* Paramètres : panel = instance d'objet GLib à traiter. * -* * -* Description : Procède à la libération totale de la mémoire. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_log_panel_finalize(GLogPanel *panel) -{ - G_OBJECT_CLASS(g_log_panel_parent_class)->finalize(G_OBJECT(panel)); - -} - - -/****************************************************************************** -* * -* Paramètres : class = classe à 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 *g_log_panel_class_get_key(const GLogPanelClass *class) -{ - char *result; /* Description à renvoyer */ - - result = strdup(PANEL_LOG_ID); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : class = classe à consulter. * -* * -* Description : Fournit une indication sur la personnalité du panneau. * -* * -* Retour : Identifiant lié à la nature unique du panneau. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static PanelItemPersonality g_log_panel_class_get_personality(const GLogPanelClass *class) -{ - PanelItemPersonality result; /* Personnalité à retourner */ - - result = PIP_PERSISTENT_SINGLETON; - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : class = classe à consulter. * -* * -* Description : Indique le chemin initial de la localisation d'un panneau. * -* * -* Retour : Chemin fixé associé à la position initiale. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static char *g_log_panel_class_get_path(const GLogPanelClass *class) -{ - char *result; /* Emplacement à retourner */ - - result = strdup("Ms"); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : class = classe à consulter. * -* * -* Description : Indique la définition d'un éventuel raccourci clavier. * -* * -* Retour : Description d'un raccourci ou NULL si aucun de défini. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static char *g_log_panel_class_get_key_bindings(const GLogPanelClass *class) -{ - char *result; /* Emplacement à retourner */ - - result = strdup("<Shift>F1"); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : - * -* * -* Description : Crée un panneau d'affichage des messages système. * -* * -* Retour : Adresse de la structure mise en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GPanelItem *g_log_panel_new(void) -{ - GPanelItem *result; /* Structure à retourner */ - - result = g_object_new(G_TYPE_LOG_PANEL, NULL); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : panel = instance d'objet GLib à traiter. * -* type = espèce du message à ajouter. * -* msg = message à faire apparaître à l'écran. * -* * -* Description : Affiche un message dans le journal des messages système. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void g_log_panel_add_message(GLogPanel *panel, LogMessageType type, const char *msg) -{ - log_data *data; /* Paramètres à joindre */ - - data = calloc(1, sizeof(log_data)); - - data->item = G_PANEL_ITEM(panel); - data->type = type; - data->msg = strdup(msg); - - g_object_ref(G_OBJECT(data->item)); - - g_main_context_invoke(NULL, (GSourceFunc)log_message, data); - -} - - -/****************************************************************************** -* * -* Paramètres : data = paramètres destinés à l'affichage d'un message. * -* * -* Description : Affiche un message dans le journal des messages système. * -* * -* Retour : - * -* * -* Remarques : Cette fonction, et c'est tout son intérêt, est toujours * -* exécutée dans le contexte GTK principal. * -* * -******************************************************************************/ - -static gboolean log_message(log_data *data) -{ - GtkBuilder *builder; /* Constructeur utilisé */ - GtkListStore *store; /* Modèle de gestion */ - GtkTreeIter iter; /* Point d'insertion */ - GtkTreeView *treeview; /* Affichage de la liste */ - - builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(data->item)->widget)); - - /* Mise en place du message */ - - store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); - - gtk_list_store_append(store, &iter); - - switch (data->type) - { - case LMT_INFO: - gtk_list_store_set(store, &iter, - LGC_PICTURE, "gtk-info", - LGC_STRING, data->msg, - -1); - break; - - case LMT_PROCESS: - gtk_list_store_set(store, &iter, - LGC_PICTURE, "gtk-execute", - LGC_STRING, data->msg, - -1); - break; - - case LMT_WARNING: - gtk_list_store_set(store, &iter, - LGC_PICTURE, "gtk-dialog-warning", - LGC_STRING, data->msg, - -1); - break; - - case LMT_BAD_BINARY: - gtk_list_store_set(store, &iter, - LGC_PICTURE, "gtk-dialog-warning", - LGC_STRING, data->msg, - -1); - break; - - case LMT_ERROR: - case LMT_EXT_ERROR: - gtk_list_store_set(store, &iter, - LGC_PICTURE, "gtk-dialog-error", - LGC_STRING, data->msg, - -1); - break; - - default: - gtk_list_store_set(store, &iter, - LGC_STRING, data->msg, - -1); - break; - - } - - /* Défilement pour pointer à l'affichage */ - - treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); - - scroll_to_treeview_iter(treeview, GTK_TREE_MODEL(store), &iter); - - g_object_unref(G_OBJECT(builder)); - - /* Nettoyage de la mémoire */ - - g_object_unref(G_OBJECT(data->item)); - - free(data->msg); - - free(data); - - return G_SOURCE_REMOVE; - -} diff --git a/src/gui/panels/log.h b/src/gui/panels/log.h deleted file mode 100644 index 4d155a2..0000000 --- a/src/gui/panels/log.h +++ /dev/null @@ -1,67 +0,0 @@ - -/* Chrysalide - Outil d'analyse de fichiers binaires - * log.h - prototypes pour le panneau d'affichage des messages système - * - * Copyright (C) 2012-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 - */ - - -#ifndef _GUI_PANELS_LOG_H -#define _GUI_PANELS_LOG_H - - -#include <i18n.h> - - -#include "../panel.h" -#include "../../core/logs.h" - - - -#define PANEL_LOG_ID "log" - - -#define G_TYPE_LOG_PANEL g_log_panel_get_type() -#define G_LOG_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_log_panel_get_type(), GLogPanel)) -#define G_IS_LOG_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_log_panel_get_type())) -#define G_LOG_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_LOG_PANEL, GLogPanelClass)) -#define G_IS_LOG_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_LOG_PANEL)) -#define G_LOG_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_LOG_PANEL, GLogPanelClass)) - - -/* Panneau d'affichage de messages (instance) */ -typedef struct _GLogPanel GLogPanel; - -/* Panneau d'affichage de messages (classe) */ -typedef struct _GLogPanelClass GLogPanelClass; - - - -/* Indique le type défini pour un panneau d'affichage de messages. */ -GType g_log_panel_get_type(void); - -/* Crée un panneau d'affichage des messages système. */ -GPanelItem *g_log_panel_new(void); - -/* Affiche un message dans le journal des messages système. */ -void g_log_panel_add_message(GLogPanel *, LogMessageType, const char *); - - - -#endif /* _GUI_PANELS_LOG_H */ diff --git a/src/gui/panels/log.ui b/src/gui/panels/log.ui deleted file mode 100644 index 4ffe96c..0000000 --- a/src/gui/panels/log.ui +++ /dev/null @@ -1,59 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.21.0 --> -<interface> - <requires lib="gtk+" version="3.20"/> - <object class="GtkListStore" id="store"> - <columns> - <!-- column-name picture --> - <column type="gchararray"/> - <!-- column-name string --> - <column type="gchararray"/> - </columns> - </object> - <object class="GtkOffscreenWindow"> - <property name="can_focus">False</property> - <child> - <object class="GtkScrolledWindow" id="box"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="shadow_type">in</property> - <child> - <object class="GtkTreeView" id="treeview"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="model">store</property> - <property name="headers_visible">False</property> - <child internal-child="selection"> - <object class="GtkTreeSelection"/> - </child> - <child> - <object class="GtkTreeViewColumn"> - <property name="title" translatable="yes">picture</property> - <child> - <object class="GtkCellRendererPixbuf"/> - <attributes> - <attribute name="stock-id">0</attribute> - </attributes> - </child> - </object> - </child> - <child> - <object class="GtkTreeViewColumn"> - <property name="title" translatable="yes">string</property> - <child> - <object class="GtkCellRendererText"/> - <attributes> - <attribute name="markup">1</attribute> - </attributes> - </child> - </object> - </child> - </object> - </child> - </object> - </child> - <child type="titlebar"> - <placeholder/> - </child> - </object> -</interface> diff --git a/src/gui/panels/logs-col-icon.ui b/src/gui/panels/logs-col-icon.ui new file mode 100644 index 0000000..6463e84 --- /dev/null +++ b/src/gui/panels/logs-col-icon.ui @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + + <template class="GtkListItem"> + <property name="child"> + <object class="GtkImage"> + <binding name="icon-name"> + <lookup name="icon-name" type="GLogEntry"> + <lookup name="item">GtkListItem</lookup> + </lookup> + </binding> + </object> + </property> + + </template> + +</interface> diff --git a/src/gui/panels/logs-col-message.ui b/src/gui/panels/logs-col-message.ui new file mode 100644 index 0000000..49839e4 --- /dev/null +++ b/src/gui/panels/logs-col-message.ui @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + + <template class="GtkListItem"> + <property name="child"> + <object class="GtkLabel"> + <property name="xalign">0</property> + <property name="use-markup">true</property> + <binding name="label"> + <lookup name="message" type="GLogEntry"> + <lookup name="item">GtkListItem</lookup> + </lookup> + </binding> + </object> + </property> + + </template> + +</interface> diff --git a/src/gui/panels/logs-int.h b/src/gui/panels/logs-int.h new file mode 100644 index 0000000..692c1b4 --- /dev/null +++ b/src/gui/panels/logs-int.h @@ -0,0 +1,53 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * logs-int.h - prototypes internes pour le panneau d'affichage des messages système + * + * Copyright (C) 2025 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 _GUI_PANELS_LOGS_INT_H +#define _GUI_PANELS_LOGS_INT_H + + +#include "logs.h" +#include "../../gtkext/panel-int.h" + + + +/* Panneau d'affichage de messages (instance) */ +struct _GtkLogsPanel +{ + GtkTiledPanel parent; /* A laisser en premier */ + + GListStore *store; /* Liste des eléments conservés*/ + GtkWidget *list; /* Composant d'affichage */ + +}; + +/* Panneau d'affichage de messages (classe) */ +struct _GtkLogsPanelClass +{ + GtkTiledPanelClass parent; /* A laisser en premier */ + +}; + + + +#endif /* _GUI_PANELS_LOGS_INT_H */ diff --git a/src/gui/panels/logs.c b/src/gui/panels/logs.c new file mode 100644 index 0000000..399c4c0 --- /dev/null +++ b/src/gui/panels/logs.c @@ -0,0 +1,227 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * logs.c - panneau d'affichage des messages système + * + * Copyright (C) 2012-2025 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 "logs.h" + + +#include <assert.h> +#include <string.h> + + +#include "logs-int.h" +#include "../../gtkext/helpers.h" + + + +/* ------------------------- COEUR D'UN PANNEAU D'AFFICHAGE ------------------------- */ + + +/* Initialise la classe des panneaux d'affichage des journaux. */ +static void gtk_logs_panel_class_init(GtkLogsPanelClass *); + +/* Initialise une instance de panneau d'affichage des journaux. */ +static void gtk_logs_panel_init(GtkLogsPanel *); + +/* Supprime toutes les références externes. */ +static void gtk_logs_panel_dispose(GObject *); + +/* Procède à la libération totale de la mémoire. */ +static void gtk_logs_panel_finalize(GObject *); + + + +/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */ + + +/* Indique l'emplacement par défaut pour un affichage. */ +static char *gtk_logs_panel_get_default_path(const GtkTiledPanel *); + + + +/* ---------------------------------------------------------------------------------- */ +/* COEUR D'UN PANNEAU D'AFFICHAGE */ +/* ---------------------------------------------------------------------------------- */ + + +/* Indique le type défini pour un panneau d'accueil. */ +G_DEFINE_TYPE(GtkLogsPanel, gtk_logs_panel, GTK_TYPE_TILED_PANEL); + + +/****************************************************************************** +* * +* Paramètres : class = classe à initialiser. * +* * +* Description : Initialise la classe des panneaux d'affichage des journaux. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_logs_panel_class_init(GtkLogsPanelClass *class) +{ + GObjectClass *object; /* Autre version de la classe */ + GtkWidgetClass *widget; /* Classe de haut niveau */ + GtkTiledPanelClass *panel; /* Classe parente */ + + object = G_OBJECT_CLASS(class); + + object->dispose = gtk_logs_panel_dispose; + object->finalize = gtk_logs_panel_finalize; + + widget = GTK_WIDGET_CLASS(class); + + g_type_ensure(G_TYPE_LOG_ENTRY); + + gtk_widget_class_set_template_from_resource(widget, "/re/chrysalide/framework/gui/panels/logs.ui"); + + //gtk_widget_class_bind_template_callback_full(widget, BUILDER_CB(gtk_logs_panel_on_selected_rows_changed)); + + gtk_widget_class_bind_template_child(widget, GtkLogsPanel, store); + gtk_widget_class_bind_template_child(widget, GtkLogsPanel, list); + + panel = GTK_TILED_PANEL_CLASS(class); + + panel->get_default_path = gtk_logs_panel_get_default_path; + +} + + +/****************************************************************************** +* * +* Paramètres : panel = instance à initialiser. * +* * +* Description : Initialise une instance de panneau d'affichage des journaux. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_logs_panel_init(GtkLogsPanel *panel) +{ + GtkWidget *headers; /* Composant à cacher */ + + gtk_widget_init_template(GTK_WIDGET(panel)); + + /** + * Retrait des entêtes de colonne de l'affichage. + */ + + headers = gtk_widget_get_first_child(panel->list); + + gtk_widget_set_visible(headers, FALSE); + +} + + +/****************************************************************************** +* * +* Paramètres : object = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_logs_panel_dispose(GObject *object) +{ + gtk_widget_dispose_template(GTK_WIDGET(object), GTK_TYPE_LOGS_PANEL); + + G_OBJECT_CLASS(gtk_logs_panel_parent_class)->dispose(object); + +} + + +/****************************************************************************** +* * +* Paramètres : object = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void gtk_logs_panel_finalize(GObject *object) +{ + G_OBJECT_CLASS(gtk_logs_panel_parent_class)->finalize(object); + +} + + +/****************************************************************************** +* * +* Paramètres : panel = instance d'objet GLib à traiter. * +* entry = élément de journalisation à intégrer. * +* * +* Description : Affiche un message dans le journal des messages système. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +void g_log_panel_add_message(GtkLogsPanel *panel, GLogEntry *entry) +{ + g_list_store_append(panel->store, entry); + +} + + + +/* ---------------------------------------------------------------------------------- */ +/* IMPLEMENTATION DES FONCTIONS DE CLASSE */ +/* ---------------------------------------------------------------------------------- */ + + +/****************************************************************************** +* * +* Paramètres : panel = panneau graphique à consulter. * +* * +* Description : Indique l'emplacement par défaut pour un affichage. * +* * +* Retour : Chemin représenté ou NULL pour l'emplacement "M" par défaut. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static char *gtk_logs_panel_get_default_path(const GtkTiledPanel *panel) +{ + char *result; /* Chemin à retourner */ + + result = strdup("S"); + + return result; + +} diff --git a/src/gui/panels/logs.h b/src/gui/panels/logs.h new file mode 100644 index 0000000..a8b902b --- /dev/null +++ b/src/gui/panels/logs.h @@ -0,0 +1,47 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * logs.h - prototypes pour le panneau d'affichage des messages système + * + * Copyright (C) 2012-2025 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 _GUI_PANELS_LOGS_H +#define _GUI_PANELS_LOGS_H + + +#include <gtk/gtk.h> + + +#include "../../glibext/helpers.h" +#include "../../glibext/log.h" + + + +#define GTK_TYPE_LOGS_PANEL (gtk_logs_panel_get_type()) + +DECLARE_GTYPE(GtkLogsPanel, gtk_logs_panel, GTK, LOGS_PANEL); + + +/* Affiche un message dans le journal des messages système. */ +void g_log_panel_add_message(GtkLogsPanel *, GLogEntry *); + + + +#endif /* _GUI_PANELS_LOGS_H */ diff --git a/src/gui/panels/logs.ui b/src/gui/panels/logs.ui new file mode 100644 index 0000000..ba920cd --- /dev/null +++ b/src/gui/panels/logs.ui @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + + <object class="GtkNoSelection" id="noselection"> + <property name="model"> + <object class="GListStore" id="store"> + <property name="item-type">GLogEntry</property> + </object> + </property> + </object> + + <template class="GtkLogsPanel" parent="GtkTiledPanel"> + + <child> + <object class="GtkScrolledWindow"> + <property name="hscrollbar-policy">automatic</property> + <property name="vscrollbar-policy">automatic</property> + <property name="hexpand">true</property> + <property name="vexpand">true</property> + <property name="has-frame">0</property> + + <child> + <object class="GtkColumnView" id="list"> + <property name="vexpand">true</property> + <property name="model">noselection</property> + + <child> + <object class="GtkColumnViewColumn"> + <property name="title"></property> + <property name="factory"> + <object class="GtkBuilderListItemFactory"> + <property name="resource">/re/chrysalide/framework/gui/panels/logs-col-icon.ui</property> + </object> + </property> + </object> + </child> + + <child> + <object class="GtkColumnViewColumn"> + <property name="expand">true</property> + <property name="title">Message</property> + <property name="factory"> + <object class="GtkBuilderListItemFactory"> + <property name="resource">/re/chrysalide/framework/gui/panels/logs-col-message.ui</property> + </object> + </property> + </object> + </child> + + </object> + </child> + + </object> + </child> + + </template> + +</interface> diff --git a/src/gui/panels/welcome-hints.txt b/src/gui/panels/welcome-hints.txt new file mode 100644 index 0000000..a35ea64 --- /dev/null +++ b/src/gui/panels/welcome-hints.txt @@ -0,0 +1,23 @@ +Chrysalide's GUI offers launchers at startup in order to run main activities quickly. + +Once an activity is selected, options get displayed and allow some tunning before starting new processes. + +Such options are usually saved between runs. + + +There is no need to install Chrysalide on your system if you only want to give it a try. + +Just compile the source code and run the program from there. + + +Chrysalide can be used in external Python scripts by setting PYTHONPATH to the directory containing the 'pychrysalide.so' file. For instance: + + cd plugins/pychrysa/.libs/ + export PYTHONPATH=$PWD + +Then run the interpreter suitable to your configuration (debug or release): + + python3-dbg -c 'import pychrysalide ; print(pychrysalide.mod_version())' + + +All the configuration files for Chrysalide are located in $HOME/.config/chrysalide/.
\ No newline at end of file diff --git a/src/gui/panels/welcome-int.h b/src/gui/panels/welcome-int.h new file mode 100644 index 0000000..206bc2c --- /dev/null +++ b/src/gui/panels/welcome-int.h @@ -0,0 +1,61 @@ + +/* Chrysalide - Outil d'analyse de fichiers binaires + * welcome-int.h - prototypes internes pour le panneau d'accueil par défaut + * + * Copyright (C) 2024 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 _GUI_PANELS_WELCOME_INT_H +#define _GUI_PANELS_WELCOME_INT_H + + +#include "welcome.h" +#include "../../gtkext/panel-int.h" + + + +/* Panneau d'accueil par défaut (instance) */ +struct _GtkWelcomePanel +{ + GtkTiledPanel parent; /* A laisser en premier */ + + GtkListBox *list; /* Liste de lanceurs */ + GtkStack *properties; /* Premières propriétés */ + + GtkWidget *def_child; /* Contenu par défaut */ + GtkLabel *hints; /* Affichage d'astuces du jour */ + GtkWidget *other_child; /* Autre contenu, alternatif */ + + gchar **raw_hints; /* Liste d'astuces */ + guint raw_count; /* Taille de cette liste */ + guint cur_hint; /* Position dans le parcours */ + +}; + +/* Panneau d'accueil par défaut (classe) */ +struct _GtkWelcomePanelClass +{ + GtkTiledPanelClass parent; /* A laisser en premier */ + +}; + + + +#endif /* _GUI_PANELS_WELCOME_INT_H */ diff --git a/src/gui/panels/welcome.c b/src/gui/panels/welcome.c index 60593d1..6e8763b 100644 --- a/src/gui/panels/welcome.c +++ b/src/gui/panels/welcome.c @@ -2,7 +2,7 @@ /* Chrysalide - Outil d'analyse de fichiers binaires * welcome.c - panneau d'accueil par défaut * - * Copyright (C) 2012-2019 Cyrille Bagard + * Copyright (C) 2012-2024 Cyrille Bagard * * This file is part of Chrysalide. * @@ -26,130 +26,63 @@ #include <assert.h> -#include <malloc.h> -#include <stdbool.h> -#include <stdlib.h> -#include <string.h> -#include <i18n.h> - - -#include "../panel-int.h" -#include "../core/global.h" -#include "../../common/cpp.h" -#include "../../common/io.h" -#include "../../common/net.h" +#include "welcome-int.h" +#include "../core/panels.h" #include "../../common/shuffle.h" -#include "../../core/global.h" -#include "../../core/params.h" -#include "../../core/paths.h" -#include "../../gtkext/easygtk.h" -#include "../../gtkext/named.h" - - - -/* Panneau d'accueil par défaut (instance) */ -struct _GWelcomePanel -{ - GPanelItem parent; /* A laisser en premier */ +#include "../../gtkext/helpers.h" - cairo_surface_t *background; /* Fond pour astuces */ - char **tips; /* Liste de toutes les astuces */ - size_t count; /* Quantité d'astuces */ - size_t current; /* Indice de l'astuce courante */ - - bool uorigin; /* Origine de l'affichage */ - - gulong sig_id; /* Connexion par signal */ - -}; - -/* Panneau d'accueil par défaut (classe) */ -struct _GWelcomePanelClass -{ - GPanelItemClass parent; /* A laisser en premier */ -}; - - -/* Colonnes de la liste des messages */ -typedef enum _RecentProjectColumn -{ - RPC_VALID, /* Validité de l'entrée */ - RPC_FULLPATH, /* Chemin d'accès à un projet */ - - RPC_COUNT /* Nombre de colonnes */ - -} RecentProjectColumn; +/* ------------------------- COEUR D'UN PANNEAU D'AFFICHAGE ------------------------- */ /* Initialise la classe des panneaux d'accueil par défaut. */ -static void g_welcome_panel_class_init(GWelcomePanelClass *); +static void gtk_welcome_panel_class_init(GtkWelcomePanelClass *); /* Initialise une instance de panneau d'accueil par défaut. */ -static void g_welcome_panel_init(GWelcomePanel *); +static void gtk_welcome_panel_init(GtkWelcomePanel *); /* Supprime toutes les références externes. */ -static void g_welcome_panel_dispose(GWelcomePanel *); +static void gtk_welcome_panel_dispose(GObject *); /* Procède à la libération totale de la mémoire. */ -static void g_welcome_panel_finalize(GWelcomePanel *); +static void gtk_welcome_panel_finalize(GObject *); -/* Fournit le nom interne attribué à l'élément réactif. */ -static char *g_welcome_panel_class_get_key(const GWelcomePanelClass *); +/* Réagit à un changement de sélection de la liste de panneaux. */ +static void gtk_welcome_panel_on_selected_rows_changed(GtkListBox *, GtkWelcomePanel *); -/* Fournit une indication sur la personnalité du panneau. */ -static PanelItemPersonality g_welcome_panel_class_get_personality(const GWelcomePanelClass *); +/* Réagit à une demande d'affichage de l'astuce précédente. */ +static void gtk_welcome_panel_on_prev_hint_clicked(GtkButton *, GtkWelcomePanel *); -/* Indique le chemin initial de la localisation d'un panneau. */ -static char *g_welcome_panel_class_get_path(const GWelcomePanelClass *); +/* Réagit à une demande d'affichage de l'astuce suivante. */ +static void gtk_welcome_panel_on_next_hint_clicked(GtkButton *, GtkWelcomePanel *); -/* Place un panneau dans l'ensemble affiché. */ -static void g_welcome_panel_dock(GWelcomePanel *); -/* Charge l'ensemble des astuces. */ -static void g_welcome_panel_load_tips(GWelcomePanel *); -/* Assure le dessin du fond de la bulle d'astuce. */ -static gboolean on_tip_background_draw(GtkWidget *, cairo_t *, GWelcomePanel *); +/* --------------------- IMPLEMENTATION DES FONCTIONS DE CLASSE --------------------- */ -/* Réagit à la demande d'étude d'un nouveau binaire. */ -static void on_new_binary_clicked(GtkButton *, GWelcomePanel *); -/* Actualise au besoin la liste des projets récents. */ -static void on_recent_list_changed(GtkRecentManager *, GWelcomePanel *); -/* Recharge une liste à jour des projets récents. */ -static void g_welcome_panel_reload_project_list(GWelcomePanel *, GtkRecentManager *); -/* Réagit à une sélection décidée d'un projet particulier. */ -static void on_row_activated_for_projects(GtkTreeView *, GtkTreePath *, GtkTreeViewColumn *, GWelcomePanel *); -/* Enregistre les conditions d'affichage du panneau d'accueil. */ -static void on_startup_toggled(GtkToggleButton *, GWelcomePanel *); -/* Consulte les versions existantes et affiche une conclusion. */ -static void g_welcome_panel_check_version(GWelcomePanel *); -/* Affiche l'astuce précédente dans la liste globale. */ -static void on_tip_previous_clicked(GtkButton *, GWelcomePanel *); -/* Affiche l'astuce suivante dans la liste globale. */ -static void on_tip_next_clicked(GtkButton *, GWelcomePanel *); -/* Actualise l'affichage des astuces. */ -static void g_welcome_panel_refresh_tip(GWelcomePanel *); +/* ---------------------------------------------------------------------------------- */ +/* COEUR D'UN PANNEAU D'AFFICHAGE */ +/* ---------------------------------------------------------------------------------- */ /* Indique le type défini pour un panneau d'accueil. */ -G_DEFINE_TYPE(GWelcomePanel, g_welcome_panel, G_TYPE_PANEL_ITEM); +G_DEFINE_TYPE(GtkWelcomePanel, gtk_welcome_panel, GTK_TYPE_TILED_PANEL); /****************************************************************************** * * -* Paramètres : klass = classe à initialiser. * +* Paramètres : class = classe à initialiser. * * * * Description : Initialise la classe des panneaux d'accueil par défaut. * * * @@ -159,28 +92,28 @@ G_DEFINE_TYPE(GWelcomePanel, g_welcome_panel, G_TYPE_PANEL_ITEM); * * ******************************************************************************/ -static void g_welcome_panel_class_init(GWelcomePanelClass *klass) +static void gtk_welcome_panel_class_init(GtkWelcomePanelClass *class) { GObjectClass *object; /* Autre version de la classe */ - GEditorItemClass *item; /* Encore une autre vision... */ - GPanelItemClass *panel; /* Version parente de classe */ + GtkWidgetClass *widget; /* Classe de haut niveau */ - object = G_OBJECT_CLASS(klass); + object = G_OBJECT_CLASS(class); - object->dispose = (GObjectFinalizeFunc/* ! */)g_welcome_panel_dispose; - object->finalize = (GObjectFinalizeFunc)g_welcome_panel_finalize; + object->dispose = gtk_welcome_panel_dispose; + object->finalize = gtk_welcome_panel_finalize; - item = G_EDITOR_ITEM_CLASS(klass); + widget = GTK_WIDGET_CLASS(class); - item->get_key = (get_item_key_fc)g_welcome_panel_class_get_key; + gtk_widget_class_set_template_from_resource(widget, "/re/chrysalide/framework/gui/panels/welcome.ui"); - panel = G_PANEL_ITEM_CLASS(klass); + gtk_widget_class_bind_template_callback_full(widget, BUILDER_CB(gtk_welcome_panel_on_selected_rows_changed)); + gtk_widget_class_bind_template_callback_full(widget, BUILDER_CB(gtk_welcome_panel_on_prev_hint_clicked)); + gtk_widget_class_bind_template_callback_full(widget, BUILDER_CB(gtk_welcome_panel_on_next_hint_clicked)); - panel->get_personality = (get_panel_personality_fc)g_welcome_panel_class_get_personality; - panel->dock_at_startup = gtk_panel_item_class_return_false; - panel->get_path = (get_panel_path_fc)g_welcome_panel_class_get_path; - - panel->ack_dock = (ack_undock_process_fc)g_welcome_panel_dock; + gtk_widget_class_bind_template_child(widget, GtkWelcomePanel, list); + gtk_widget_class_bind_template_child(widget, GtkWelcomePanel, properties); + gtk_widget_class_bind_template_child(widget, GtkWelcomePanel, def_child); + gtk_widget_class_bind_template_child(widget, GtkWelcomePanel, hints); } @@ -197,93 +130,81 @@ static void g_welcome_panel_class_init(GWelcomePanelClass *klass) * * ******************************************************************************/ -static void g_welcome_panel_init(GWelcomePanel *panel) +static void gtk_welcome_panel_init(GtkWelcomePanel *panel) { - GPanelItem *pitem; /* Version parente du panneau */ - GtkBuilder *builder; /* Constructeur utilisé */ - GtkTreeView *treeview; /* Affichage de la liste */ - GtkCellRenderer *renderer; /* Moteur de rendu de colonne */ - GtkTreeViewColumn *column; /* Colonne de la liste */ - GtkToggleButton *button; /* Bouton à bascule à traiter */ - bool state; /* Etat de la coche à définir */ - gchar *filename; /* Chemin d'accès à une image */ - GtkRecentManager *manager; /* Gestionnaire global */ - - /* Eléments de base */ - - pitem = G_PANEL_ITEM(panel); - - pitem->widget = G_NAMED_WIDGET(gtk_built_named_widget_new_for_panel(_("Welcome"), - _("Welcome panel"), - PANEL_WELCOME_ID)); - - panel->uorigin = !gtk_panel_item_class_dock_at_startup(G_PANEL_ITEM_GET_CLASS(pitem)); + GBytes *bytes; /* Données brutes de ressource */ + const gchar *data; /* Données brutes natives */ + int min; /* Taille à gauche minimale */ + GtkConstraintLayout *layout; /* Disposition fixant la taille*/ + GtkConstraint *constraint; /* Contrainte à considérer */ - /* Représentation graphique */ + gtk_widget_init_template(GTK_WIDGET(panel)); - builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(pitem->widget)); + panel->other_child = NULL; - /* Liste des projets récents */ + /* Chargement des astuces */ - treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview")); + bytes = g_resources_lookup_data("/re/chrysalide/framework/gui/panels/welcome-hints.txt", + G_RESOURCE_LOOKUP_FLAGS_NONE, NULL); + assert(bytes != NULL); - column = gtk_tree_view_column_new(); - gtk_tree_view_append_column(treeview, column); - gtk_tree_view_set_expander_column(treeview, column); + data = g_bytes_get_data(bytes, NULL); - renderer = gtk_cell_renderer_text_new(); - gtk_tree_view_column_pack_start(column, renderer, TRUE); - gtk_tree_view_column_add_attribute(column, renderer, "markup", RPC_FULLPATH); + panel->raw_hints = g_strsplit(data, "\n\n\n", -1); - /* Affichage au démarrage ? */ + g_bytes_unref(bytes); - button = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "startup")); + panel->raw_count = g_strv_length(panel->raw_hints); + assert(panel->raw_count > 0); - g_generic_config_get_value(get_main_configuration(), MPK_WELCOME_STARTUP, &state); + panel->cur_hint = 0; - gtk_toggle_button_set_active(button, state); + /* Constitution de la liste des démarreurs */ - /* Chargement de l'image de fond */ + populate_framework_panel_launcher_list(panel->list); - filename = find_pixmap_file("tipoftheday.png"); + /* Dimensionnement de la zone d'astuces */ - panel->background = cairo_image_surface_create_from_png(filename); + gtk_widget_measure(GTK_WIDGET(panel->list), GTK_ORIENTATION_HORIZONTAL, -1, &min, NULL, NULL, NULL); - g_free(filename); + if (min > 150) + min -= 150; - /* Connexion des signaux */ + layout = GTK_CONSTRAINT_LAYOUT(gtk_widget_get_layout_manager(GTK_WIDGET(panel->hints))); - gtk_builder_add_callback_symbols(builder, - BUILDER_CALLBACK(on_tip_background_draw), - BUILDER_CALLBACK(on_new_binary_clicked), - BUILDER_CALLBACK(on_row_activated_for_projects), - BUILDER_CALLBACK(on_startup_toggled), - BUILDER_CALLBACK(on_tip_previous_clicked), - BUILDER_CALLBACK(on_tip_next_clicked), - NULL); + gtk_constraint_layout_remove_all_constraints(layout); - gtk_builder_connect_signals(builder, panel); + constraint = gtk_constraint_new_constant(NULL, + GTK_CONSTRAINT_ATTRIBUTE_LEFT, + GTK_CONSTRAINT_RELATION_EQ, + 0, + GTK_CONSTRAINT_STRENGTH_REQUIRED); + gtk_constraint_layout_add_constraint(layout, constraint); - g_object_unref(G_OBJECT(builder)); + constraint = gtk_constraint_new_constant(NULL, + GTK_CONSTRAINT_ATTRIBUTE_TOP, + GTK_CONSTRAINT_RELATION_EQ, + 0, + GTK_CONSTRAINT_STRENGTH_REQUIRED); + gtk_constraint_layout_add_constraint(layout, constraint); - /* Actualisation du contenu du panneau */ + constraint = gtk_constraint_new_constant(NULL, + GTK_CONSTRAINT_ATTRIBUTE_RIGHT, + GTK_CONSTRAINT_RELATION_EQ, + min, + GTK_CONSTRAINT_STRENGTH_REQUIRED); + gtk_constraint_layout_add_constraint(layout, constraint); - manager = get_project_manager(); + /* Premier affichage */ - panel->sig_id = g_signal_connect(manager, "changed", G_CALLBACK(on_recent_list_changed), panel); - - g_welcome_panel_reload_project_list(panel, manager); - - g_welcome_panel_load_tips(panel); - - g_welcome_panel_check_version(panel); + gtk_label_set_markup(panel->hints, panel->raw_hints[panel->cur_hint]); } /****************************************************************************** * * -* Paramètres : panel = instance d'objet GLib à traiter. * +* Paramètres : object = instance d'objet GLib à traiter. * * * * Description : Supprime toutes les références externes. * * * @@ -293,27 +214,24 @@ static void g_welcome_panel_init(GWelcomePanel *panel) * * ******************************************************************************/ -static void g_welcome_panel_dispose(GWelcomePanel *panel) +static void gtk_welcome_panel_dispose(GObject *object) { - GtkRecentManager *manager; /* Gestionnaire global */ + GtkWelcomePanel *panel; /* Version spécialisée */ - if (panel->sig_id > 0) - { - manager = get_project_manager(); + gtk_widget_dispose_template(GTK_WIDGET(object), GTK_TYPE_WELCOME_PANEL); - g_signal_handler_disconnect(manager, panel->sig_id); - panel->sig_id = 0; + panel = GTK_WELCOME_PANEL(object); - } + g_clear_object(&panel->other_child); - G_OBJECT_CLASS(g_welcome_panel_parent_class)->dispose(G_OBJECT(panel)); + G_OBJECT_CLASS(gtk_welcome_panel_parent_class)->dispose(object); } /****************************************************************************** * * -* Paramètres : panel = instance d'objet GLib à traiter. * +* Paramètres : object = instance d'objet GLib à traiter. * * * * Description : Procède à la libération totale de la mémoire. * * * @@ -323,133 +241,25 @@ static void g_welcome_panel_dispose(GWelcomePanel *panel) * * ******************************************************************************/ -static void g_welcome_panel_finalize(GWelcomePanel *panel) +static void gtk_welcome_panel_finalize(GObject *object) { - cairo_surface_destroy(panel->background); + GtkWelcomePanel *panel; /* Version spécialisée */ - free(panel->tips); + panel = GTK_WELCOME_PANEL(object); - G_OBJECT_CLASS(g_welcome_panel_parent_class)->finalize(G_OBJECT(panel)); + g_strfreev(panel->raw_hints); -} - - -/****************************************************************************** -* * -* Paramètres : class = classe à 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 *g_welcome_panel_class_get_key(const GWelcomePanelClass *class) -{ - char *result; /* Description à renvoyer */ - - result = strdup(PANEL_WELCOME_ID); - - return result; + G_OBJECT_CLASS(gtk_welcome_panel_parent_class)->finalize(object); } /****************************************************************************** * * -* Paramètres : class = classe à consulter. * -* * -* Description : Fournit une indication sur la personnalité du panneau. * +* Paramètres : box = liste GTK concernée par l'appel. * +* panel = panneau d'accueil lié à la liste. * * * -* Retour : Identifiant lié à la nature unique du panneau. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static PanelItemPersonality g_welcome_panel_class_get_personality(const GWelcomePanelClass *class) -{ - PanelItemPersonality result; /* Personnalité à retourner */ - - result = PIP_PERSISTENT_SINGLETON; - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : class = classe à consulter. * -* * -* Description : Indique le chemin initial de la localisation d'un panneau. * -* * -* Retour : Chemin fixé associé à la position initiale. * -* * -* Remarques : - * -* * -******************************************************************************/ - -static char *g_welcome_panel_class_get_path(const GWelcomePanelClass *class) -{ - char *result; /* Emplacement à retourner */ - - result = strdup("M"); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : - * -* * -* Description : Crée un panneau d'accueil par défaut. * -* * -* Retour : Adresse de la structure mise en place. * -* * -* Remarques : - * -* * -******************************************************************************/ - -GPanelItem *g_welcome_panel_new(void) -{ - GPanelItem *result; /* Structure à retourner */ - - result = g_object_new(G_TYPE_WELCOME_PANEL, NULL); - - return result; - -} - - -/****************************************************************************** -* * -* Paramètres : panel = composant à présenter à l'affichage. * -* * -* Description : Place un panneau dans l'ensemble affiché. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_welcome_panel_dock(GWelcomePanel *panel) -{ - g_welcome_panel_set_user_origin(panel, true); - -} - - -/****************************************************************************** -* * -* Paramètres : panel = panneau d'accueil à mettre à jour. * -* * -* Description : Charge l'ensemble des astuces. * +* Description : Réagit à un changement de sélection de la liste de panneaux. * * * * Retour : - * * * @@ -457,414 +267,58 @@ static void g_welcome_panel_dock(GWelcomePanel *panel) * * ******************************************************************************/ -static void g_welcome_panel_load_tips(GWelcomePanel *panel) +static void gtk_welcome_panel_on_selected_rows_changed(GtkListBox *box, GtkWelcomePanel *panel) { - size_t i; /* Boucle de parcours */ - - char *tips[] = { - - _("There is no need to install Chrysalide on your system if you only want to give it a try.\n\n" - "Just compile the source code and run the program from there."), - - _("Chrysalide can be used in external Python scripts by setting PYTHONPATH to the directory " - "containing the 'pychrysalide.so' file. For instance:\n\n" - " cd plugins/pychrysa/.libs/\n" - " export PYTHONPATH=$PWD\n\n" - "Then run the interpreter suitable to your configuration (debug or release):\n\n" - " python3-dbg -c 'import pychrysalide ; print(pychrysalide.mod_version())'"), - - _("All the configuration files for Chrysalide are located in $HOME/.config/chrysalide/."), - - _("The behavior of the main menu bar is copied from the one of a well known browser " - "with a fox mascot.\n\n" - "To make the menu bar appear and disappear, just press and release the Alt key.") - - }; - - panel->count = ARRAY_SIZE(tips); - - panel->tips = (char **)calloc(panel->count, sizeof(char *)); - - for (i = 0; i < panel->count; i++) - panel->tips[i] = tips[i]; - - shuffle(panel->tips, panel->count, sizeof(char *)); - - panel->current = 0; - - g_welcome_panel_refresh_tip(panel); - -} - - -/****************************************************************************** -* * -* Paramètres : widget = composant graphique à redessiner. * -* cr = contexte graphique à utiliser. * -* panel = panneau associé comportant des informations utiles. * -* * -* Description : Assure le dessin du fond de la bulle d'astuce. * -* * -* Retour : FALSE pour poursuivre la propagation de l'événement. * -* * -* Remarques : - * -* * -******************************************************************************/ + GtkListBoxRow *row; /* Ligne sélectionnée */ + GtkWidget *new; /* Nouvelles propriétés */ -static gboolean on_tip_background_draw(GtkWidget *widget, cairo_t *cr, GWelcomePanel *panel) -{ - int wgt_width; /* Largeur disponible totale */ - int wgt_height; /* Hauteur disponible totale */ - int img_width; /* Largeur de l'image de fond */ - int img_height; /* Hauteur de l'image de fond */ - double scale; /* Echelle à appliquer */ + row = gtk_list_box_get_selected_row(box); - if (cairo_surface_status(panel->background) == CAIRO_STATUS_SUCCESS) + /** + * Perte de sélection : bascule sur les informations d'accueil. + */ + if (row == NULL) { - wgt_width = gtk_widget_get_allocated_width(widget); - wgt_height = gtk_widget_get_allocated_height(widget); - - img_width = cairo_image_surface_get_width(panel->background); - img_height = cairo_image_surface_get_height(panel->background); + assert(panel->other_child != NULL); - scale = wgt_height / (2.0 * img_height); + gtk_stack_set_visible_child(panel->properties, panel->def_child); - cairo_scale(cr, scale, scale); - - cairo_set_source_surface(cr, panel->background, - (wgt_width / scale) - img_width, - ((wgt_height / scale) - img_height) / 2); - - cairo_paint(cr); + gtk_stack_remove(panel->properties, panel->other_child); + panel->other_child = NULL; } - return FALSE; - -} - - -/****************************************************************************** -* * -* Paramètres : button = bouton impliqué dans la procédure. * -* panel = panneau associé comportant des informations utiles. * -* * -* Description : Réagit à la demande d'étude d'un nouveau binaire. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void on_new_binary_clicked(GtkButton *button, GWelcomePanel *panel) -{ - GObject *ref; /* Espace de référencements */ - GtkMenuItem *item; /* Elément de menu simulé */ - - ref = G_OBJECT(get_editor_window()); - - item = GTK_MENU_ITEM(g_object_get_data(ref, "mnu_project_add_binary")); - - g_object_unref(ref); - - gtk_menu_item_activate(item); - -} - - -/****************************************************************************** -* * -* Paramètres : manager = gestion de fichiers récemment utilisés. * -* panel = panneau associé comportant des informations utiles.* -* * -* Description : Actualise au besoin la liste des projets récents. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void on_recent_list_changed(GtkRecentManager *manager, GWelcomePanel *panel) -{ - g_welcome_panel_reload_project_list(panel, manager); - -} - - -/****************************************************************************** -* * -* Paramètres : panel = panneau comportant des informations utiles. * -* manager = gestion de fichiers récemment utilisés. * -* * -* Description : Recharge une liste à jour des projets récents. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_welcome_panel_reload_project_list(GWelcomePanel *panel, GtkRecentManager *manager) -{ - GtkBuilder *builder; /* Constructeur utilisé */ - GtkListStore *store; /* Modèle de gestion */ - bool empty; /* Liste vide ? */ - GList *recents; /* Liste des fichiers récents */ - GList *recent; /* Elément à traiter */ - GtkRecentInfo *info; /* Informations sur l'élément */ - GtkTreeIter iter; /* Point d'insertion */ - - /* Réinitialisation */ - - builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); - - store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); - - gtk_list_store_clear(store); - - empty = true; - - /* Chargement */ - - recents = gtk_recent_manager_get_items(manager); - - if (recents != NULL) - { - for (recent = g_list_first(recents); recent != NULL; recent = g_list_next(recent)) - { - info = recent->data; - - if (strcmp(gtk_recent_info_get_mime_type(info), "application/chrysalide.project") == 0) - { - gtk_list_store_append(store, &iter); - - gtk_list_store_set(store, &iter, - RPC_VALID, true, - RPC_FULLPATH, gtk_recent_info_get_uri_display(info), - -1); - - empty = false; - - } - - gtk_recent_info_unref(info); - - } - - g_list_free(recents); - - } - - /* Indication par défaut */ - if (empty) - { - gtk_list_store_append(store, &iter); - - gtk_list_store_set(store, &iter, - RPC_VALID, false, - RPC_FULLPATH, _("<i>(No recent project)</i>"), - -1); - - } - - g_object_unref(G_OBJECT(builder)); - -} - - -/****************************************************************************** -* * -* Paramètres : treeview = liste graphique concernée par la procédure. * -* path = chemin d'accès à la ligne sélectionnée. * -* column = colonne concernée par la sélection. * -* panel = panneau associé avec des informations utiles. * -* * -* Description : Réagit à une sélection décidée d'un projet particulier. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void on_row_activated_for_projects(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *column, GWelcomePanel *panel) -{ - GtkTreeModel *model; /* Modèle de gestion */ - GtkTreeIter iter; /* Point de la consultation */ - gboolean valid; /* Validité de l'entrée */ - gchar *filename; /* Chemin d'accès au projet */ - GStudyProject *project; /* Nouveau projet à ouvrir */ - - model = gtk_tree_view_get_model(treeview); - - if (gtk_tree_model_get_iter(model, &iter, path)) + /** + * Bascule vers une nouvelle fenêtre. + */ + else { - gtk_tree_model_get(model, &iter, RPC_VALID, &valid, RPC_FULLPATH, &filename, -1); + new = get_framework_panel_parameters(row); + assert(new != NULL); - if (valid) + if (new != panel->other_child) { - project = g_study_project_open(filename, true); - - if (project != NULL) - { - set_current_project(project); - - push_project_into_recent_list(project); - - } - - g_free(filename); - - } - - } - -} - - -/****************************************************************************** -* * -* Paramètres : button = bouton de défilement des astuces activé; * -* panel = panneau associé comportant des informations utiles. * -* * -* Description : Enregistre les conditions d'affichage du panneau d'accueil. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void on_startup_toggled(GtkToggleButton *button, GWelcomePanel *panel) -{ - g_generic_config_set_value(get_main_configuration(), - MPK_WELCOME_STARTUP, gtk_toggle_button_get_active(button)); - -} - - -/****************************************************************************** -* * -* Paramètres : panel = panneau d'accueil à mettre à jour. * -* * -* Description : Consulte les versions existantes et affiche une conclusion. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -static void g_welcome_panel_check_version(GWelcomePanel *panel) -{ - bool skip; /* Saut de la vérification */ - bool unknown; /* Impossibilité de comparaison*/ - int current; /* Version courante */ - int sock; /* Canal de communication */ - bool status; /* Bilan d'une communication */ - char buffer[1024]; /* Tampon de réception */ - size_t got; /* Quantité de données reçues */ - char *version; /* Version récupérée */ - int available; /* Version disponible */ - GtkBuilder *builder; /* Constructeur utilisé */ - GtkLabel *label; /* Etiquette à éditer */ - char *msg; /* Message à faire paraître */ - - g_generic_config_get_value(get_main_configuration(), MPK_WELCOME_CHECK, &skip); - skip = !skip; - - unknown = true; - - current = atoi(VERSION); - - if (skip) goto check_process; - - /* Recherche en ligne */ + gtk_stack_add_child(panel->properties, new); + gtk_stack_set_visible_child(panel->properties, new); - sock = connect_via_tcp("www.chrysalide.re", "80", NULL); - if (sock == -1) goto check_process; + if (panel->other_child != NULL) + gtk_stack_remove(panel->properties, panel->other_child); -#define REQUEST "GET /version.last HTTP/1.1\r\nHost: www.chrysalide.re\r\n\r\n" - - status = safe_send(sock, REQUEST, strlen(REQUEST), 0); - if (!status) goto check_done; - - status = recv_all(sock, buffer, sizeof(buffer), &got); - if (!status) goto check_done; - - version = strstr(buffer, "\r\n\r\n"); - - if (version != NULL) - { - available = atoi(version + 4); - - unknown = false; - - } - - check_done: - - close(sock); - - check_process: - - /* Affichage */ - - builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); - - label = GTK_LABEL(gtk_builder_get_object(builder, "version")); - - if (skip) - asprintf(&msg, - "Your version is: <b>%d</b>\n\n" \ - "Automatic version check is disabled.", - current); - - else - { - if (unknown) - asprintf(&msg, - "Your version is: <b>%d</b>\n\n" \ - "Lastest available version is unknown.", - current); - - else - { - if (current >= available) - asprintf(&msg, - "Your version is: <b>%d</b>\n\n" \ - "Lastest version is: <b>%d</b>\n\n" \ - "Your software is <span color='green'><b>up-to-date</b></span>.", - current, available); - - else - asprintf(&msg, - "Your version is: <b>%d</b>\n\n" \ - "Lastest version is: <b>%d</b>\n\n" \ - "Your software is <span color='red'><b>outdated</b></span>.", - current, available); + panel->other_child = new; } } - gtk_label_set_markup(label, msg); - - free(msg); - - g_object_unref(G_OBJECT(builder)); - } /****************************************************************************** * * -* Paramètres : button = bouton de défilement des astuces activé; * -* panel = panneau associé comportant des informations utiles. * +* Paramètres : button = bouton GTK concerné par l'appel. * +* panel = panneau d'accueil lié à la liste. * * * -* Description : Affiche l'astuce précédente dans la liste globale. * +* Description : Réagit à une demande d'affichage de l'astuce précédente. * * * * Retour : - * * * @@ -872,24 +326,24 @@ static void g_welcome_panel_check_version(GWelcomePanel *panel) * * ******************************************************************************/ -static void on_tip_previous_clicked(GtkButton *button, GWelcomePanel *panel) +static void gtk_welcome_panel_on_prev_hint_clicked(GtkButton *button, GtkWelcomePanel *panel) { - if (panel->current > 0) - panel->current--; + if (panel->cur_hint > 0) + panel->cur_hint--; else - panel->current = panel->count - 1; + panel->cur_hint = panel->raw_count - 1; - g_welcome_panel_refresh_tip(panel); + gtk_label_set_markup(panel->hints, panel->raw_hints[panel->cur_hint]); } /****************************************************************************** * * -* Paramètres : button = bouton de défilement des astuces activé; * -* panel = panneau associé comportant des informations utiles. * +* Paramètres : button = bouton GTK concerné par l'appel. * +* panel = panneau d'accueil lié à la liste. * * * -* Description : Affiche l'astuce suivante dans la liste globale. * +* Description : Réagit à une demande d'affichage de l'astuce suivante. * * * * Retour : - * * * @@ -897,82 +351,27 @@ static void on_tip_previous_clicked(GtkButton *button, GWelcomePanel *panel) * * ******************************************************************************/ -static void on_tip_next_clicked(GtkButton *button, GWelcomePanel *panel) +static void gtk_welcome_panel_on_next_hint_clicked(GtkButton *button, GtkWelcomePanel *panel) { - if ((panel->current + 1) < panel->count) - panel->current++; + if ((panel->cur_hint + 1) < panel->raw_count) + panel->cur_hint++; else - panel->current = 0; + panel->cur_hint = 0; - g_welcome_panel_refresh_tip(panel); + gtk_label_set_markup(panel->hints, panel->raw_hints[panel->cur_hint]); } -/****************************************************************************** -* * -* Paramètres : panel = panneau associé comportant des informations utiles. * -* * -* Description : Actualise l'affichage des astuces. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ -static void g_welcome_panel_refresh_tip(GWelcomePanel *panel) -{ - GtkBuilder *builder; /* Constructeur utilisé */ - GtkLabel *label; /* Etiquette de présentation */ +/* ---------------------------------------------------------------------------------- */ +/* IMPLEMENTATION DES FONCTIONS DE CLASSE */ +/* ---------------------------------------------------------------------------------- */ - assert(panel->current < panel->count); - builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(panel)->widget)); - label = GTK_LABEL(gtk_builder_get_object(builder, "tip")); - gtk_label_set_markup(label, panel->tips[panel->current]); - g_object_unref(G_OBJECT(builder)); -} -/****************************************************************************** -* * -* Paramètres : panel = panneau associé comportant des informations utiles. * -* * -* Description : Indique l'origine de l'affichage du panneau d'accueil. * -* * -* Retour : true si l'affichage est le fait de l'utilisateur. * -* * -* Remarques : - * -* * -******************************************************************************/ - -bool g_welcome_panel_get_user_origin(const GWelcomePanel *panel) -{ - return panel->uorigin; - -} - - -/****************************************************************************** -* * -* Paramètres : panel = panneau associé comportant des informations utiles.* -* uorigin = true si l'affichage est le fait de l'utilisateur. * -* * -* Description : Détermine l'origine de l'affichage du panneau d'accueil. * -* * -* Retour : - * -* * -* Remarques : - * -* * -******************************************************************************/ - -void g_welcome_panel_set_user_origin(GWelcomePanel *panel, bool uorigin) -{ - panel->uorigin = uorigin; - -} diff --git a/src/gui/panels/welcome.h b/src/gui/panels/welcome.h index 5cdd6a1..d9ea18d 100644 --- a/src/gui/panels/welcome.h +++ b/src/gui/panels/welcome.h @@ -2,7 +2,7 @@ /* Chrysalide - Outil d'analyse de fichiers binaires * welcome.h - prototypes pour le panneau d'accueil par défaut * - * Copyright (C) 2012-2019 Cyrille Bagard + * Copyright (C) 2012-2024 Cyrille Bagard * * This file is part of Chrysalide. * @@ -26,42 +26,17 @@ #define _GUI_PANELS_WELCOME_H -#include <i18n.h> +#include <gtk/gtk.h> -#include "../panel.h" +#include "../../glibext/helpers.h" +#include "../../gtkext/panel.h" -#define PANEL_WELCOME_ID "welcome" +#define GTK_TYPE_WELCOME_PANEL (gtk_welcome_panel_get_type()) - -#define G_TYPE_WELCOME_PANEL g_welcome_panel_get_type() -#define G_WELCOME_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), g_welcome_panel_get_type(), GWelcomePanel)) -#define G_IS_WELCOME_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_welcome_panel_get_type())) -#define G_WELCOME_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_WELCOME_PANEL, GWelcomePanelClass)) -#define G_IS_WELCOME_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_WELCOME_PANEL)) -#define G_WELCOME_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_WELCOME_PANEL, GWelcomePanelClass)) - - -/* Panneau d'accueil par défaut (instance) */ -typedef struct _GWelcomePanel GWelcomePanel; - -/* Panneau d'accueil par défaut (classe) */ -typedef struct _GWelcomePanelClass GWelcomePanelClass; - - -/* Indique le type défini pour un panneau d'accueil. */ -GType g_welcome_panel_get_type(void); - -/* Crée un panneau d'accueil par défaut. */ -GPanelItem *g_welcome_panel_new(void); - -/* Indique l'origine de l'affichage du panneau d'accueil. */ -bool g_welcome_panel_get_user_origin(const GWelcomePanel *); - -/* Détermine l'origine de l'affichage du panneau d'accueil. */ -void g_welcome_panel_set_user_origin(GWelcomePanel *, bool); +DECLARE_GTYPE(GtkWelcomePanel, gtk_welcome_panel, GTK, WELCOME_PANEL); diff --git a/src/gui/panels/welcome.ui b/src/gui/panels/welcome.ui index d016907..c545b1d 100644 --- a/src/gui/panels/welcome.ui +++ b/src/gui/panels/welcome.ui @@ -1,245 +1,168 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> <interface> - <requires lib="gtk+" version="3.12"/> - <object class="GtkImage" id="image1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="stock">gtk-new</property> - <property name="icon_size">6</property> - </object> - <object class="GtkListStore" id="store"> - <columns> - <!-- column-name valid --> - <column type="gboolean"/> - <!-- column-name fullpath --> - <column type="gchararray"/> - </columns> - </object> - <object class="GtkOffscreenWindow" id="offscreenwindow1"> - <property name="can_focus">False</property> - <child> - <object class="GtkBox" id="box"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="homogeneous">True</property> - <child> - <object class="GtkBox" id="box2"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_left">8</property> - <property name="margin_right">8</property> - <property name="margin_top">8</property> - <property name="margin_bottom">8</property> - <property name="orientation">vertical</property> - <property name="spacing">8</property> - <child> - <object class="GtkAlignment" id="alignment1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="halign">center</property> - <property name="top_padding">180</property> - <property name="bottom_padding">30</property> - <child> - <object class="GtkButton" id="button1"> - <property name="label" translatable="yes">New binary...</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <property name="image">image1</property> - <property name="image_position">top</property> - <property name="always_show_image">True</property> - <signal name="clicked" handler="on_new_binary_clicked" swapped="no"/> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Last projects:</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkTreeView" id="treeview"> - <property name="height_request">250</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="margin_left">8</property> - <property name="hexpand">True</property> - <property name="model">store</property> - <property name="headers_visible">False</property> - <property name="rules_hint">True</property> - <signal name="row-activated" handler="on_row_activated_for_projects" swapped="no"/> - <child internal-child="selection"> - <object class="GtkTreeSelection" id="treeview-selection1"/> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="startup"> - <property name="label" translatable="yes">Show this panel at startup.</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="halign">start</property> - <property name="valign">end</property> - <property name="vexpand">True</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_startup_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> + + <template class="GtkWelcomePanel" parent="GtkTiledPanel"> <child> - <object class="GtkBox" id="box3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="margin_left">8</property> - <property name="margin_right">8</property> - <property name="margin_top">8</property> - <property name="margin_bottom">8</property> - <property name="orientation">vertical</property> - <property name="spacing">8</property> - <child> - <object class="GtkBox" id="box4"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="homogeneous">True</property> + <object class="GtkScrolledWindow"> + <property name="hscrollbar-policy">automatic</property> + <property name="vscrollbar-policy">automatic</property> + <property name="hexpand">TRUE</property> + <property name="vexpand">TRUE</property> + <property name="has-frame">0</property> <child> - <object class="GtkLabel" id="version"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="opacity">0.81999999977648264</property> - <property name="use_markup">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label3"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="opacity">0.81999999999999995</property> - <property name="label" translatable="yes">Get access to the online documentation and stay tuned by visiting the official website : <a href="http://chrysalide.re">chrysalide.re</a> - -You can also follow Chrysalide on Twitter : <a href="http://twitter.com/chrysalide_ref">@chrysalide_ref</a></property> - <property name="use_markup">True</property> - <property name="wrap">True</property> - <property name="track_visited_links">False</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="tip"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="yalign">1</property> - <property name="xpad">8</property> - <property name="ypad">8</property> - <property name="label" translatable="yes">label</property> - <property name="wrap">True</property> - <property name="selectable">True</property> - <signal name="draw" handler="on_tip_background_draw" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkButtonBox" id="buttonbox1"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="spacing">8</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="button3"> - <property name="label" translatable="yes">Previous</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <signal name="clicked" handler="on_tip_previous_clicked" swapped="no"/> - </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" translatable="yes">Next</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">True</property> - <signal name="clicked" handler="on_tip_next_clicked" swapped="no"/> - </object> - <packing> - <property name="expand">True</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> + <object class="GtkGrid"> + <property name="halign">center</property> + <property name="valign">center</property> + <property name="column-spacing">64</property> + <property name="column-homogeneous">TRUE</property> + <property name="margin-bottom">32</property> + <property name="margin-end">32</property> + <property name="margin-start">32</property> + <property name="margin-top">32</property> + + <!-- Launcher list --> + <child> + <object class="GtkListBox" id="list"> + <property name="halign">end</property> + <property name="valign">center</property> + <property name="selection-mode">GTK_SELECTION_SINGLE</property> + <property name="activate-on-single-click">0</property> + + <layout> + <property name="column">0</property> + <property name="row">0</property> + </layout> + + <style> + <class name="boxed-list"/> + <class name="frame"/> + </style> + + <signal name="selected-rows-changed" handler="gtk_welcome_panel_on_selected_rows_changed"/> + + </object> + </child> + + <!-- Hints / options --> + <child> + <object class="GtkStack" id="properties"> + <property name="halign">start</property> + <property name="valign">fill</property> + + <layout> + <property name="column">1</property> + <property name="row">0</property> + </layout> + + <child> + + <object class="GtkStackPage"> + <property name="name">default</property> + <property name="title">Welcome</property> + + <property name="child"> + <object class="GtkGrid" id="def_child"> + <property name="halign">start</property> + <property name="valign">fill</property> + <property name="column-spacing">16</property> + <property name="column-homogeneous">FALSE</property> + + <!-- Text --> + + <child> + <object class="GtkLabel" id="hints"> + <property name="halign">start</property> + <property name="valign">fill</property> + <property name="xalign">0</property> + <property name="yalign">1</property> + <property name="vexpand">1</property> + <property name="width-request">50</property> + <property name="wrap">TRUE</property> + + <property name="layout-manager"> + <object class="GtkConstraintLayout"> + <!-- + <constraints> + + <constraint target="super" target-attribute="left" + relation="eq" + constant="0" + strength="required"/> + + <constraint target="super" target-attribute="top" + relation="eq" + constant="0" + strength="required"/> + + <constraint target="super" target-attribute="right" + relation="eq" + constant="340" + strength="required"/> + + </constraints> + --> + </object> + </property> + + <layout> + <property name="column">0</property> + <property name="row">0</property> + </layout> + + </object> + </child> + + <!-- Prev/Next buttons --> + <child> + <object class="GtkBox"> + <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> + <property name="halign">fill</property> + <property name="valign">center</property> + <property name="homogeneous">TRUE</property> + <layout> + <property name="column">1</property> + <property name="row">1</property> + </layout> + + <child> + <object class="GtkButton"> + <property name="icon-name">go-previous-symbolic</property> + <property name="halign">end</property> + <signal name="clicked" handler="gtk_welcome_panel_on_prev_hint_clicked"/> + </object> + </child> + + <child> + <object class="GtkButton"> + <property name="icon-name">go-next-symbolic</property> + <property name="halign">start</property> + <signal name="clicked" handler="gtk_welcome_panel_on_next_hint_clicked"/> + </object> + </child> + + <style> + <class name="linked"/> + </style> + + </object> + </child> + + <style> + <class name="hints"/> + </style> + + </object> + + </property> + </object> + </child> + + </object> + </child> + </object> </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> + </object> </child> - </object> - </child> - </object> + </template> + </interface> |