[gnome-latex: 166/205] New action: clean-up build files



commit 15b3d35b7f9425a50819b9d4c453a223664d59c7
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date:   Thu Jan 7 00:51:39 2010 +0100

    New action: clean-up build files
    
    Now it is possible the clean-up build files via the menu, and not only
    on closing the document.

 TODO            |  3 ---
 src/callbacks.c | 15 ++++++++++++---
 src/callbacks.h |  1 +
 src/prefs.c     |  2 +-
 src/ui.c        |  5 +++++
 5 files changed, 19 insertions(+), 7 deletions(-)
---
diff --git a/TODO b/TODO
index 3426900..d12f3a2 100644
--- a/TODO
+++ b/TODO
@@ -13,6 +13,3 @@ TODO LaTeXila
 - Auto-completion of LaTeX commands
 
 - Change the title of the window with the filename of the current document
-
-- New action: clean-up auxiliaries file
-       (for the moment it is possible when we close the document)
diff --git a/src/callbacks.c b/src/callbacks.c
index f839082..0c30939 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -52,7 +52,7 @@ static void find (gboolean backward);
 static gboolean find_next_match (const gchar *what, GtkSourceSearchFlags flags,
                gboolean backward, GtkTextIter *match_start, GtkTextIter *match_end);
 static void free_latexila (void);
-static void delete_auxiliaries_files (const gchar *filename);
+static void delete_build_files (const gchar *filename);
 static void set_entry_background (GtkWidget *entry, gboolean error);
 static void insert_text_at_beginning_of_selected_lines (gchar *text);
 
@@ -712,6 +712,15 @@ cb_makeindex (void)
        run_makeindex ();
 }
 
+void
+cb_clean_up_build_files (void)
+{
+       if (latexila.active_doc == NULL || latexila.active_doc->path == NULL)
+               return;
+
+       delete_build_files (latexila.active_doc->path);
+}
+
 void
 cb_tools_comment (void)
 {
@@ -1375,7 +1384,7 @@ close_document (gint index)
                        g_ptr_array_add (latexila.prefs.list_opened_docs,
                                        (gpointer) g_strdup (latexila.active_doc->path));
 
-               delete_auxiliaries_files (latexila.active_doc->path);
+               delete_build_files (latexila.active_doc->path);
 
                g_free (latexila.active_doc->path);
        }
@@ -1737,7 +1746,7 @@ free_latexila (void)
 }
 
 static void
-delete_auxiliaries_files (const gchar *filename)
+delete_build_files (const gchar *filename)
 {
        if (! g_str_has_suffix (filename, ".tex"))
                return;
diff --git a/src/callbacks.h b/src/callbacks.h
index d6a52bb..53471b5 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -58,6 +58,7 @@ void cb_dvi_to_pdf (void);
 void cb_dvi_to_ps (void);
 void cb_bibtex (void);
 void cb_makeindex (void);
+void cb_clean_up_build_files (void);
 void cb_tools_comment (void);
 void cb_tools_uncomment (void);
 void cb_tools_indent (void);
diff --git a/src/prefs.c b/src/prefs.c
index b255995..cb692f8 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -1205,7 +1205,7 @@ create_preferences (void)
 
        /* delete auxiliaries files on exit */
        GtkWidget *delete_aux_files = gtk_check_button_new_with_label (
-                       _("Clean-up auxiliaries files after close (*.aux, *.log, *.out, *.toc, etc)"));
+                       _("Clean-up build files after close (*.aux, *.log, *.out, *.toc, etc)"));
        gtk_widget_set_tooltip_text (delete_aux_files,
                        ".aux .bit .blg .lof .log .lot .glo .glx .gxg .gxs .idx .ilg .ind .out .url .svn 
.toc");
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (delete_aux_files),
diff --git a/src/ui.c b/src/ui.c
index 7dc4265..4327cce 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -136,6 +136,8 @@ static const char *ui =
 "      <separator />"
 "      <menuitem action='compile_bibtex' />"
 "      <menuitem action='compile_makeindex' />"
+"      <separator />"
+"      <menuitem action='clean_up_build_files' />"
 "    </menu>"
 
 "    <menu action='Latex'>"
@@ -488,6 +490,9 @@ static GtkActionEntry entries[] = {
                N_("Run BibTeX on the current document"), G_CALLBACK (cb_bibtex)},
        {"compile_makeindex", NULL, "_MakeIndex", NULL,
                N_("Run MakeIndex on the current document"), G_CALLBACK (cb_makeindex)},
+       {"clean_up_build_files", GTK_STOCK_DELETE, N_("Cleanup Build Files"), NULL,
+               N_("Clean-up build files (*.aux, *.log, *.out, *.toc, etc)"),
+               G_CALLBACK (cb_clean_up_build_files)},
 
        {"Tools", NULL, N_("_Tools"), NULL, NULL, NULL},
        {"ToolsComment", NULL, N_("_Comment"), "<Control>D",


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