diff options
Diffstat (limited to 'src/panels')
-rw-r--r-- | src/panels/log.c | 24 | ||||
-rw-r--r-- | src/panels/log.h | 2 |
2 files changed, 26 insertions, 0 deletions
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 |