diff options
Diffstat (limited to 'src/gui/panels/logs.c')
-rw-r--r-- | src/gui/panels/logs.c | 227 |
1 files changed, 227 insertions, 0 deletions
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; + +} |