From ee2e35f6dced8340682eab8cb013ba2911858c53 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Wed, 5 Jan 2011 00:40:05 +0000 Subject: Extended the logging system. git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@206 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a --- ChangeLog | 6 ++++++ src/panels/log.c | 24 ++++++++++++++++++++++++ src/panels/log.h | 2 ++ 3 files changed, 32 insertions(+) diff --git a/ChangeLog b/ChangeLog index 799389c..1e4a956 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +11-01-05 Cyrille Bagard + + * src/panels/log.c: + * src/panels/log.h: + Extend the logging system. + 11-01-03 Cyrille Bagard * configure.ac: diff --git a/src/panels/log.c b/src/panels/log.c index b13119a..175c185 100644 --- a/src/panels/log.c +++ b/src/panels/log.c @@ -78,6 +78,7 @@ GtkWidget *build_log_panel(void) g_object_set_data(G_OBJECT(result), "store", store); treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); + g_object_set_data(G_OBJECT(result), "treeview", treeview); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE); gtk_widget_show(treeview); gtk_container_add(GTK_CONTAINER(result), treeview); @@ -124,6 +125,8 @@ void log_simple_message(LogMessageType type, const char *msg) GtkWidget *panel; /* Panneau à traiter */ GtkTreeStore *store; /* Modèle de gestion */ GtkTreeIter iter; /* Point d'insertion */ + GtkTreeView *treeview; /* Affichage de la liste */ + GtkTreePath *path; /* Chemin d'accès à la ligne */ panel = get_panel(PNT_LOG); store = g_object_get_data(G_OBJECT(panel), "store"); @@ -153,6 +156,20 @@ void log_simple_message(LogMessageType type, const char *msg) -1); break; + case LMT_ERROR: + gtk_tree_store_set(store, &iter, + LGC_PICTURE, "gtk-dialog-error", + LGC_STRING, msg, + -1); + break; + + case LMT_WARNING: + gtk_tree_store_set(store, &iter, + LGC_PICTURE, "gtk-dialog-warning", + LGC_STRING, msg, + -1); + break; + default: gtk_tree_store_set(store, &iter, LGC_STRING, msg, @@ -161,6 +178,13 @@ void log_simple_message(LogMessageType type, const char *msg) } + treeview = GTK_TREE_VIEW(g_object_get_data(G_OBJECT(panel), "treeview")); + path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); + + gtk_tree_view_scroll_to_cell(treeview, path, NULL, FALSE, 0.0, 0.0); + + gtk_tree_path_free(path); + } diff --git a/src/panels/log.h b/src/panels/log.h index 5ea95cc..b0fc3e9 100644 --- a/src/panels/log.h +++ b/src/panels/log.h @@ -36,6 +36,8 @@ typedef enum _LogMessageType LMT_INFO, /* Information sur l'exécution */ LMT_BAD_BINARY, /* Binaire malformé */ LMT_PROCESS, /* Début de tâche quelconque */ + LMT_ERROR, /* Erreur de traitement */ + LMT_WARNING, /* Avertissment à remonter */ LMT_COUNT -- cgit v0.11.2-87-g4458