diff options
Diffstat (limited to 'src/gui/panels/log.c')
-rw-r--r-- | src/gui/panels/log.c | 51 |
1 files changed, 40 insertions, 11 deletions
diff --git a/src/gui/panels/log.c b/src/gui/panels/log.c index cf79f70..43021cf 100644 --- a/src/gui/panels/log.c +++ b/src/gui/panels/log.c @@ -35,6 +35,7 @@ #include "../panel-int.h" #include "../core/panels.h" #include "../../gtkext/easygtk.h" +#include "../../gtkext/named.h" @@ -87,6 +88,9 @@ 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_get_key(const GLogPanel *); + /* Affiche un message dans le journal des messages système. */ static gboolean log_message(log_data *); @@ -111,6 +115,7 @@ G_DEFINE_TYPE(GLogPanel, g_log_panel, G_TYPE_PANEL_ITEM); static void g_log_panel_class_init(GLogPanelClass *klass) { GObjectClass *object; /* Autre version de la classe */ + GEditorItemClass *item; /* Encore une autre vision... */ GPanelItemClass *panel; /* Version parente de la classe*/ object = G_OBJECT_CLASS(klass); @@ -118,6 +123,10 @@ static void g_log_panel_class_init(GLogPanelClass *klass) object->dispose = (GObjectFinalizeFunc/* ! */)g_log_panel_dispose; object->finalize = (GObjectFinalizeFunc)g_log_panel_finalize; + item = G_EDITOR_ITEM_CLASS(klass); + + item->get_key = (get_item_key_fc)g_log_panel_get_key; + panel = G_PANEL_ITEM_CLASS(klass); panel->unique = true; @@ -140,25 +149,20 @@ static void g_log_panel_class_init(GLogPanelClass *klass) static void g_log_panel_init(GLogPanel *panel) { - GEditorItem *base; /* Version basique d'instance */ GPanelItem *pitem; /* Version parente du panneau */ /* Eléments de base */ - base = G_EDITOR_ITEM(panel); - - base->name = PANEL_LOG_ID; - pitem = G_PANEL_ITEM(panel); pitem->personality = PIP_SINGLETON; - pitem->lname = _("Misc information"); - pitem->dock_at_startup = true; - pitem->path = strdup("Ms"); - /* Représentation graphique */ + pitem->widget = G_NAMED_WIDGET(gtk_built_named_widget_new_for_panel(_("Messages"), + _("Misc information"), + PANEL_LOG_ID)); - g_panel_item_build(pitem, "log"); + pitem->dock_at_startup = true; + pitem->path = strdup("Ms"); } @@ -226,6 +230,29 @@ GPanelItem *g_log_panel_new(void) /****************************************************************************** * * +* Paramètres : panel = instance à consulter. * +* * +* Description : Fournit le nom interne attribué à l'élément réactif. * +* * +* Retour : Désignation (courte) de l'élément de l'éditeur. * +* * +* Remarques : - * +* * +******************************************************************************/ + +static char *g_log_panel_get_key(const GLogPanel *panel) +{ + char *result; /* Description à renvoyer */ + + result = strdup(PANEL_LOG_ID); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : panel = instance d'objet GLib à traiter. * * type = espèce du message à ajouter. * * msg = message à faire apparaître à l'écran. * @@ -275,7 +302,7 @@ static gboolean log_message(log_data *data) GtkTreeIter iter; /* Point d'insertion */ GtkTreeView *treeview; /* Affichage de la liste */ - builder = G_PANEL_ITEM(data->item)->builder; + builder = gtk_built_named_widget_get_builder(GTK_BUILT_NAMED_WIDGET(G_PANEL_ITEM(data->item)->widget)); /* Mise en place du message */ @@ -335,6 +362,8 @@ static gboolean log_message(log_data *data) 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)); |