[gnome-latex: 94/205] Log zone: keep only the 5 last actions



commit e22f8787512b170068f98369c7b3a63be6ae93a6
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date:   Sat Oct 10 16:33:15 2009 +0200

    Log zone: keep only the 5 last actions

 TODO                    |  4 ++--
 src/external_commands.c | 12 +++++++++---
 2 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/TODO b/TODO
index facb9cf..f8eb30c 100644
--- a/TODO
+++ b/TODO
@@ -5,8 +5,8 @@ Sat Oct 10, 2009 to Fri Oct 16, 2009
 [x] execution of the actions
        x sensitivity of the actions when an action is running
 
-[-] log zone
-       - keep only the 5 last actions
+[x] log zone
+       x keep only the 5 last actions
 
 [-] symbol tables
        - mathematical sets (N, Z, Q, R, C) in misc math
diff --git a/src/external_commands.c b/src/external_commands.c
index 4f87a91..924c674 100644
--- a/src/external_commands.c
+++ b/src/external_commands.c
@@ -85,7 +85,6 @@ cb_watch_output_command (GIOChannel *channel, GIOCondition condition,
 
        if (condition == G_IO_HUP)
        {
-               print_info ("G_IO_HUP");
                g_io_channel_unref (channel);
                nb_channels_active--;
                
@@ -99,8 +98,6 @@ cb_watch_output_command (GIOChannel *channel, GIOCondition condition,
                return FALSE;
        }
 
-       print_info ("cb_watch_output_command ()");
-       
        GError *error = NULL;
        gchar *line;
        g_io_channel_read_line (channel, &line, NULL, NULL, &error);
@@ -423,6 +420,15 @@ add_action (gchar *title, gchar *command)
        gtk_tree_view_scroll_to_cell (latexila.action_log.list_view, path, NULL,
                        FALSE, 0, 0);
 
+       // delete the first entry
+       if (num > 5)
+       {
+               GtkTreeIter first;
+               gtk_tree_model_get_iter_first (
+                               GTK_TREE_MODEL (latexila.action_log.list_store), &first);
+               gtk_list_store_remove (latexila.action_log.list_store, &first);
+       }
+
        num++;
        g_free (title2);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]