[gnome-latex: 153/205] BibTeX and MakeIndex support



commit 22a5a982f4b253ef89743940443398abb09e3992
Author: Sébastien Wilmet <sebastien wilmet gmail com>
Date:   Wed Dec 23 00:28:27 2009 +0100

    BibTeX and MakeIndex support

 CMakeLists.txt          |  24 +++---
 TODO                    |   4 +-
 src/callbacks.c         |  22 +++++-
 src/callbacks.h         |   2 +
 src/config.h.cmake      |   2 +
 src/external_commands.c | 189 ++++++++++++++++++++++++++++--------------------
 src/external_commands.h |   2 +
 src/main.h              |   4 +
 src/prefs.c             |  74 ++++++++++++++++++-
 src/ui.c                |  10 ++-
 src/ui.xml              |   3 +
 11 files changed, 242 insertions(+), 94 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8f639e4..44db1a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,8 @@ SET(COMMAND_LATEX "latex")
 SET(COMMAND_PDFLATEX "pdflatex")
 SET(COMMAND_DVIPDF "dvipdf")
 SET(COMMAND_DVIPS "dvips")
+SET(COMMAND_BIBTEX "bibtex")
+SET(COMMAND_MAKEINDEX "makeindex")
 
 FIND_PACKAGE(LATEX)
 
@@ -60,8 +62,17 @@ IF(DVIPS_CONVERTER)
   SET(COMMAND_DVIPS ${DVIPS_CONVERTER})
 ENDIF(DVIPS_CONVERTER)
 
+IF(BIBTEX_COMPILER)
+  SET(COMMAND_BIBTEX ${BIBTEX_COMPILER})
+ENDIF(BIBTEX_COMPILER)
+
+IF(MAKEINDEX_COMPILER)
+  SET(COMMAND_MAKEINDEX ${MAKEINDEX_COMPILER})
+ENDIF(MAKEINDEX_COMPILER)
+
 MESSAGE(STATUS "Commands: " ${COMMAND_LATEX} " ; " ${COMMAND_PDFLATEX} " ; "
-       ${COMMAND_DVIPDF} " ; " ${COMMAND_DVIPS})
+       ${COMMAND_DVIPDF} " ; " ${COMMAND_DVIPS} " ; " ${COMMAND_BIBTEX} " ; "
+       ${COMMAND_MAKEINDEX})
 
 
 INCLUDE_DIRECTORIES(${GTK2_INCLUDE_DIRS} ${latexila_BINARY_DIR}/src)
@@ -71,14 +82,3 @@ CONFIGURE_FILE(${latexila_SOURCE_DIR}/src/config.h.cmake
 
 ADD_SUBDIRECTORY(src)
 ADD_SUBDIRECTORY(data)
-
-# packages
-SET(CPACK_GENERATOR "TGZ")
-SET(CPACK_PACKAGE_VERSION_MAJOR ${latexila_MAJOR})
-SET(CPACK_PACKAGE_VERSION_MINOR ${latexila_MINOR})
-SET(CPACK_PACKAGE_VERSION_PATCH ${latexila_PATCH})
-SET(CPACK_SOURCE_GENERATOR "TGZ")
-SET(CPACK_SOURCE_PACKAGE_FILE_NAME latexila-${latexila_VERSION})
-SET(CPACK_SOURCE_IGNORE_FILES "~$" ".gz$")
-
-INCLUDE(CPack)
diff --git a/TODO b/TODO
index 10a61a5..cb531e9 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,7 @@
 TODO LaTeXila
 
-[-] BibTeX support
+[-] underscores in the menu
+
+[-] write the HACKING file
 
 [-] update French translation
diff --git a/src/callbacks.c b/src/callbacks.c
index f39ec6e..dc338b1 100644
--- a/src/callbacks.c
+++ b/src/callbacks.c
@@ -692,6 +692,24 @@ cb_dvi_to_ps (void)
        convert_document (_("DVI to PS"), ".dvi", latexila.prefs.command_dvips);
 }
 
+void
+cb_bibtex (void)
+{
+       if (latexila.active_doc == NULL)
+               return;
+
+       run_bibtex ();
+}
+
+void
+cb_makeindex (void)
+{
+       if (latexila.active_doc == NULL)
+               return;
+
+       run_makeindex ();
+}
+
 void
 cb_tools_comment (void)
 {
@@ -1704,6 +1722,8 @@ free_latexila (void)
        g_free (latexila.prefs.command_dvipdf);
        g_free (latexila.prefs.command_dvips);
        g_free (latexila.prefs.command_web_browser);
+       g_free (latexila.prefs.command_bibtex);
+       g_free (latexila.prefs.command_makeindex);
        g_free (latexila.prefs.file_chooser_dir);
        g_free (latexila.prefs.file_browser_dir);
        g_free (latexila.prefs.style_scheme_id);
@@ -1719,7 +1739,7 @@ delete_auxiliaries_files (const gchar *filename)
        if (! g_str_has_suffix (filename, ".tex"))
                return;
 
-       gchar *extensions[] = {".aux", ".bit", ".blg", ".bbl", ".lof", ".log", ".lot",
+       gchar *extensions[] = {".aux", ".bit", ".blg", ".lof", ".log", ".lot",
                ".glo", ".glx", ".gxg", ".gxs", ".idx", ".ilg", ".ind", ".out", ".url",
                ".svn", ".toc"};
        gint nb_extensions = G_N_ELEMENTS (extensions);
diff --git a/src/callbacks.h b/src/callbacks.h
index cb7d5e7..d6a52bb 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -56,6 +56,8 @@ void cb_view_pdf (void);
 void cb_view_ps (void);
 void cb_dvi_to_pdf (void);
 void cb_dvi_to_ps (void);
+void cb_bibtex (void);
+void cb_makeindex (void);
 void cb_tools_comment (void);
 void cb_tools_uncomment (void);
 void cb_tools_indent (void);
diff --git a/src/config.h.cmake b/src/config.h.cmake
index ef4c383..0ee971f 100644
--- a/src/config.h.cmake
+++ b/src/config.h.cmake
@@ -31,6 +31,8 @@
 #define COMMAND_PDFLATEX "@COMMAND_PDFLATEX@"
 #define COMMAND_DVIPDF "@COMMAND_DVIPDF@"
 #define COMMAND_DVIPS "@COMMAND_DVIPS@"
+#define COMMAND_BIBTEX "@COMMAND_BIBTEX@"
+#define COMMAND_MAKEINDEX "@COMMAND_MAKEINDEX@"
 
 #define DATA_DIR "${DATA_DIR}"
 
diff --git a/src/external_commands.c b/src/external_commands.c
index d223647..81d3b59 100644
--- a/src/external_commands.c
+++ b/src/external_commands.c
@@ -37,9 +37,11 @@ static gchar * get_command_line (gchar **command);
 static void command_running_finished (void);
 static gboolean cb_watch_output_command (GIOChannel *channel,
                GIOCondition condition, gpointer user_data);
-static void add_action (gchar *title, gchar *command);
+static void add_action (const gchar *title, const gchar *command);
 static void set_action_sensitivity (gboolean sensitive);
 static void view_document_run (gchar *filename);
+static void run_command_on_other_extension (gchar *title, gchar *message,
+               gchar *command, gchar *extension);
 
 static gchar *
 get_command_line (gchar **command)
@@ -319,82 +321,11 @@ view_document_run (gchar *filename)
 void
 convert_document (gchar *title, gchar *doc_extension, gchar *command)
 {
-       if (latexila.active_doc == NULL)
-               return;
-
-       gchar *command_output;
-
-       GRegex *regex = g_regex_new ("\\.tex$", 0, 0, NULL);
-
-       /* replace .tex by doc_extension (.pdf, .dvi, ...) */
-       gchar *doc_path = g_regex_replace_literal (regex,
-                       latexila.active_doc->path, -1, 0, doc_extension, 0, NULL);
-       g_regex_unref (regex);
-
-       gchar *full_command = g_strdup_printf ("%s %s", command, doc_path);
-       add_action (title, full_command);
-       g_free (full_command);
-
-       /* the document to convert exist? */
-       if (! g_file_test (doc_path, G_FILE_TEST_IS_REGULAR))
-       {
-               command_output = g_strdup_printf (
-                               _("%s does not exist. If this is not already made, compile the document with 
the right command."),
-                               g_path_get_basename (doc_path));
-               print_log_add (latexila.action_log.text_view, command_output, TRUE);
-
-               g_free (command_output);
-               g_free (doc_path);
-               return;
-       }
-
-       /* print a message in the statusbar */
-       guint context_id = gtk_statusbar_get_context_id (latexila.statusbar,
-                       "running-action");
-       gtk_statusbar_push (latexila.statusbar, context_id,
-                       _("Converting in progress. Please wait..."));
-
-       // without that, the message in the statusbar does not appear
-       while (gtk_events_pending ())
-               gtk_main_iteration ();
-
-       /* run the command */
-       gchar *argv[] = {command, doc_path, NULL};
-
-       GError *error = NULL;
-       gchar *dir = g_path_get_dirname (latexila.active_doc->path);
-       GPid pid;
-       gint out, err;
-       g_spawn_async_with_pipes (dir, argv, NULL, G_SPAWN_SEARCH_PATH, NULL,
-                       NULL, &pid, NULL, &out, &err, &error);
-
-       g_free (dir);
-       g_free (doc_path);
-
-       // an error occured
-       if (error != NULL)
-       {
-               command_output = g_strdup_printf (_("execution failed: %s"),
-                               error->message);
-               print_log_add (latexila.action_log.text_view, command_output, TRUE);
-
-               g_free (command_output);
-               g_error_free (error);
-               return;
-       }
-
-       // create the channels
-       GIOChannel *out_channel = g_io_channel_unix_new (out);
-       GIOChannel *err_channel = g_io_channel_unix_new (err);
-
-       // lock the action list and all the build actions
-       set_action_sensitivity (FALSE);
-
-       // add watches to channels
-       g_io_add_watch (out_channel, G_IO_IN | G_IO_HUP,
-                       (GIOFunc) cb_watch_output_command, NULL);
-       g_io_add_watch (err_channel, G_IO_IN | G_IO_HUP,
-                       (GIOFunc) cb_watch_output_command, NULL);
+       run_command_on_other_extension (
+                       title,
+                       _("Converting in progress. Please wait..."),
+                       command,
+                       doc_extension);
 }
 
 void
@@ -430,8 +361,28 @@ view_in_web_browser (gchar *title, gchar *filename)
        g_free (command_output);
 }
 
+void
+run_bibtex (void)
+{
+       run_command_on_other_extension (
+                       "BibTeX",
+                       _("BibTeX is running. Please wait..."),
+                       latexila.prefs.command_bibtex,
+                       ".aux");
+}
+
+void
+run_makeindex (void)
+{
+       run_command_on_other_extension (
+                       "MakeIndex",
+                       _("MakeIndex is running. Please wait..."),
+                       latexila.prefs.command_makeindex,
+                       ".idx");
+}
+
 static void
-add_action (gchar *title, gchar *command)
+add_action (const gchar *title, const gchar *command)
 {
        static gint num = 1;
        gchar *title2 = g_strdup_printf ("%d. %s", num, title);
@@ -498,4 +449,86 @@ set_action_sensitivity (gboolean sensitive)
        gtk_action_set_sensitive (latexila.actions.view_dvi, sensitive);
        gtk_action_set_sensitive (latexila.actions.view_pdf, sensitive);
        gtk_action_set_sensitive (latexila.actions.view_ps, sensitive);
+       gtk_action_set_sensitive (latexila.actions.bibtex, sensitive);
+       gtk_action_set_sensitive (latexila.actions.makeindex, sensitive);
+}
+
+static void
+run_command_on_other_extension (gchar *title, gchar *message, gchar *command,
+               gchar *extension)
+{
+       if (latexila.active_doc == NULL)
+               return;
+
+       gchar *command_output;
+
+       /* replace .tex by .aux */
+       GRegex *regex = g_regex_new ("\\.tex$", 0, 0, NULL);
+       gchar *doc_path = g_regex_replace_literal (regex,
+                       latexila.active_doc->path, -1, 0, extension, 0, NULL);
+       g_regex_unref (regex);
+
+       gchar *full_command = g_strdup_printf ("%s %s", command, doc_path);
+       add_action (title, full_command);
+       g_free (full_command);
+
+       /* the document to convert exist? */
+       if (! g_file_test (doc_path, G_FILE_TEST_IS_REGULAR))
+       {
+               command_output = g_strdup_printf (
+                               _("%s does not exist. If this is not already made, compile the document with 
the right command."),
+                               g_path_get_basename (doc_path));
+               print_log_add (latexila.action_log.text_view, command_output, TRUE);
+
+               g_free (command_output);
+               g_free (doc_path);
+               return;
+       }
+
+       /* print a message in the statusbar */
+       guint context_id = gtk_statusbar_get_context_id (latexila.statusbar,
+                       "running-action");
+       gtk_statusbar_push (latexila.statusbar, context_id, message);
+
+       // without that, the message in the statusbar does not appear
+       while (gtk_events_pending ())
+               gtk_main_iteration ();
+
+       /* run the command */
+       gchar *argv[] = {command, doc_path, NULL};
+
+       GError *error = NULL;
+       gchar *dir = g_path_get_dirname (latexila.active_doc->path);
+       GPid pid;
+       gint out, err;
+       g_spawn_async_with_pipes (dir, argv, NULL, G_SPAWN_SEARCH_PATH, NULL,
+                       NULL, &pid, NULL, &out, &err, &error);
+
+       g_free (dir);
+       g_free (doc_path);
+
+       // an error occured
+       if (error != NULL)
+       {
+               command_output = g_strdup_printf (_("execution failed: %s"),
+                               error->message);
+               print_log_add (latexila.action_log.text_view, command_output, TRUE);
+
+               g_free (command_output);
+               g_error_free (error);
+               return;
+       }
+
+       // create the channels
+       GIOChannel *out_channel = g_io_channel_unix_new (out);
+       GIOChannel *err_channel = g_io_channel_unix_new (err);
+
+       // lock the action list and all the build actions
+       set_action_sensitivity (FALSE);
+
+       // add watches to channels
+       g_io_add_watch (out_channel, G_IO_IN | G_IO_HUP,
+                       (GIOFunc) cb_watch_output_command, NULL);
+       g_io_add_watch (err_channel, G_IO_IN | G_IO_HUP,
+                       (GIOFunc) cb_watch_output_command, NULL);
 }
diff --git a/src/external_commands.h b/src/external_commands.h
index 454d93c..d50de1a 100644
--- a/src/external_commands.h
+++ b/src/external_commands.h
@@ -25,5 +25,7 @@ void view_current_document (gchar *title, gchar *doc_extension);
 void view_document (gchar *title, gchar *filename);
 void convert_document (gchar *title, gchar *doc_extension, gchar *command);
 void view_in_web_browser (gchar *title, gchar *filename);
+void run_bibtex (void);
+void run_makeindex (void);
 
 #endif /* EXTERNAL_COMMANDS_H */
diff --git a/src/main.h b/src/main.h
index 1fb3f02..371e712 100644
--- a/src/main.h
+++ b/src/main.h
@@ -90,6 +90,8 @@ typedef struct
        gchar                                   *command_dvipdf;
        gchar                                   *command_dvips;
        gchar                                   *command_web_browser;
+       gchar                                   *command_bibtex;
+       gchar                                   *command_makeindex;
        gchar                                   *file_chooser_dir;
        gchar                                   *file_browser_dir;
        gboolean                                file_browser_show_all_files;
@@ -116,6 +118,8 @@ typedef struct
        GtkAction *view_dvi;
        GtkAction *view_pdf;
        GtkAction *view_ps;
+       GtkAction *bibtex;
+       GtkAction *makeindex;
 } actions_t;
 
 typedef struct
diff --git a/src/prefs.c b/src/prefs.c
index c4175aa..c6a316b 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -56,6 +56,8 @@ static void cb_pref_command_pdflatex (GtkEditable *editable, gpointer user_data)
 static void cb_pref_command_dvipdf (GtkEditable *editable, gpointer user_data);
 static void cb_pref_command_dvips (GtkEditable *editable, gpointer user_data);
 static void cb_pref_web_browser (GtkEditable *editable, gpointer user_data);
+static void cb_pref_command_bibtex (GtkEditable *editable, gpointer user_data);
+static void cb_pref_command_makeindex (GtkEditable *editable, gpointer user_data);
 static void cb_style_scheme_changed (GtkTreeSelection *selection,
                gpointer user_data);
 static void cb_delete_aux_files (GtkToggleButton *toggle_button,
@@ -85,6 +87,8 @@ static gchar  *command_pdflatex_                              = COMMAND_PDFLATEX;
 static gchar   *command_dvipdf_                                = COMMAND_DVIPDF;
 static gchar   *command_dvips_                                 = COMMAND_DVIPS;
 static gchar   *command_web_browser_                   = "gnome-open";
+static gchar   *command_bibtex_                                = COMMAND_BIBTEX;
+static gchar   *command_makeindex_                             = COMMAND_MAKEINDEX;
 static gboolean delete_aux_files_                              = FALSE;
 static gboolean reopen_files_on_startup_               = TRUE;
 static gboolean file_browser_show_all_files_   = FALSE;
@@ -291,6 +295,26 @@ load_preferences (preferences_t *prefs)
                error = NULL;
        }
 
+       prefs->command_bibtex = g_key_file_get_string (key_file, PROGRAM_NAME,
+                       "command_bibtex", &error);
+       if (error != NULL)
+       {
+               print_warning ("%s", error->message);
+               prefs->command_bibtex = g_strdup (command_bibtex_);
+               g_error_free (error);
+               error = NULL;
+       }
+
+       prefs->command_makeindex = g_key_file_get_string (key_file, PROGRAM_NAME,
+                       "command_makeindex", &error);
+       if (error != NULL)
+       {
+               print_warning ("%s", error->message);
+               prefs->command_makeindex = g_strdup (command_makeindex_);
+               g_error_free (error);
+               error = NULL;
+       }
+
        prefs->file_chooser_dir = g_key_file_get_string (key_file, PROGRAM_NAME,
                        "file_chooser_directory", &error);
        if (error != NULL)
@@ -463,6 +487,10 @@ save_preferences (preferences_t *prefs)
                        prefs->command_dvips);
        g_key_file_set_string (key_file, PROGRAM_NAME, "command_web_browser",
                        prefs->command_web_browser);
+       g_key_file_set_string (key_file, PROGRAM_NAME, "command_bibtex",
+                       prefs->command_bibtex);
+       g_key_file_set_string (key_file, PROGRAM_NAME, "command_makeindex",
+                       prefs->command_makeindex);
        if (prefs->file_chooser_dir != NULL)
                g_key_file_set_string (key_file, PROGRAM_NAME, "file_chooser_directory",
                                prefs->file_chooser_dir);
@@ -582,6 +610,8 @@ load_default_preferences (preferences_t *prefs)
        prefs->command_dvipdf = g_strdup (command_dvipdf_);
        prefs->command_dvips = g_strdup (command_dvips_);
        prefs->command_web_browser = g_strdup (command_web_browser_);
+       prefs->command_bibtex = g_strdup (command_bibtex_);
+       prefs->command_makeindex = g_strdup (command_makeindex_);
        prefs->file_chooser_dir = NULL;
        prefs->file_browser_dir = g_strdup (g_get_home_dir ());
        prefs->list_opened_docs = g_ptr_array_new ();
@@ -779,6 +809,24 @@ cb_pref_web_browser (GtkEditable *editable, gpointer user_data)
        latexila.prefs.command_web_browser = g_strdup (new_command);
 }
 
+static void
+cb_pref_command_bibtex (GtkEditable *editable, gpointer user_data)
+{
+       GtkEntry *entry = GTK_ENTRY (editable);
+       const gchar *new_command = gtk_entry_get_text (entry);
+       g_free (latexila.prefs.command_bibtex);
+       latexila.prefs.command_bibtex = g_strdup (new_command);
+}
+
+static void
+cb_pref_command_makeindex (GtkEditable *editable, gpointer user_data)
+{
+       GtkEntry *entry = GTK_ENTRY (editable);
+       const gchar *new_command = gtk_entry_get_text (entry);
+       g_free (latexila.prefs.command_makeindex);
+       latexila.prefs.command_makeindex = g_strdup (new_command);
+}
+
 static void
 cb_style_scheme_changed (GtkTreeSelection *selection, gpointer user_data)
 {
@@ -1093,6 +1141,26 @@ create_preferences (void)
        gtk_box_pack_start (GTK_BOX (hbox), command_dvips, FALSE, FALSE, 0);
        gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
 
+       hbox = gtk_hbox_new (FALSE, 5);
+       GtkWidget *label5 = gtk_label_new (_("BibTeX command:"));
+       GtkWidget *command_bibtex = gtk_entry_new ();
+       gtk_entry_set_text (GTK_ENTRY (command_bibtex), latexila.prefs.command_bibtex);
+       g_signal_connect (G_OBJECT (command_bibtex), "changed",
+                       G_CALLBACK (cb_pref_command_bibtex), NULL);
+       gtk_box_pack_start (GTK_BOX (hbox), label5, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (hbox), command_bibtex, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
+
+       hbox = gtk_hbox_new (FALSE, 5);
+       GtkWidget *label6 = gtk_label_new (_("MakeIndex command:"));
+       GtkWidget *command_makeindex = gtk_entry_new ();
+       gtk_entry_set_text (GTK_ENTRY (command_makeindex), latexila.prefs.command_makeindex);
+       g_signal_connect (G_OBJECT (command_makeindex), "changed",
+                       G_CALLBACK (cb_pref_command_makeindex), NULL);
+       gtk_box_pack_start (GTK_BOX (hbox), label6, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (hbox), command_makeindex, FALSE, FALSE, 0);
+       gtk_box_pack_start (GTK_BOX (vbox_latex), hbox, FALSE, FALSE, 0);
+
        // set the same width for the labels
        // the longer label is label3
        GtkRequisition size;
@@ -1100,11 +1168,15 @@ create_preferences (void)
        gtk_widget_set_size_request (label1, size.width, 0);
        gtk_widget_set_size_request (label2, size.width, 0);
        gtk_widget_set_size_request (label4, size.width, 0);
+       gtk_widget_set_size_request (label5, size.width, 0);
+       gtk_widget_set_size_request (label6, size.width, 0);
 
        // flush left
        gtk_misc_set_alignment (GTK_MISC (label1), 0.0, 0.5);
        gtk_misc_set_alignment (GTK_MISC (label2), 0.0, 0.5);
        gtk_misc_set_alignment (GTK_MISC (label4), 0.0, 0.5);
+       gtk_misc_set_alignment (GTK_MISC (label5), 0.0, 0.5);
+       gtk_misc_set_alignment (GTK_MISC (label6), 0.0, 0.5);
 
        /* web browser */
        hbox = gtk_hbox_new (FALSE, 5);
@@ -1140,7 +1212,7 @@ create_preferences (void)
        GtkWidget *delete_aux_files = gtk_check_button_new_with_label (
                        _("Clean-up auxiliaries files after close (*.aux, *.log, *.out, *.toc, etc)"));
        gtk_widget_set_tooltip_text (delete_aux_files,
-                       ".aux .bit .blg .bbl .lof .log .lot .glo .glx .gxg .gxs .idx .ilg .ind .out .url .svn 
.toc");
+                       ".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),
                        latexila.prefs.delete_aux_files);
        g_signal_connect (G_OBJECT (delete_aux_files), "toggled",
diff --git a/src/ui.c b/src/ui.c
index ea70654..638ea09 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -145,6 +145,10 @@ static GtkActionEntry entries[] = {
                N_("Convert the DVI document to the PostScript format"), G_CALLBACK (cb_dvi_to_ps)},
        {"viewPS", "view_ps", N_("View PS"), NULL,
                N_("View the PostScript file"), G_CALLBACK (cb_view_ps)},
+       {"compile_bibtex", NULL, "BibTeX", NULL,
+               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)},
 
        {"Tools", NULL, N_("Tools"), NULL, NULL, NULL},
        {"ToolsComment", NULL, N_("Comment"), "<Control>D",
@@ -304,7 +308,7 @@ static GtkActionEntry latex_entries[] = {
        {"MathSuperscript", "math-superscript", N_("Superscript - ^{}"), NULL,
                N_("Superscript - ^{}"), G_CALLBACK (cb_math_superscript)},
        {"MathSubscript", "math-subscript", N_("Subscript - __{}"), NULL,
-               N_("Subscript - __{}"), G_CALLBACK (cb_math_subscript)},
+               N_("Subscript - _{}"), G_CALLBACK (cb_math_subscript)},
        {"MathFrac", "math-frac", N_("Fraction - \\frac{}{}"), NULL,
                N_("Fraction - \\frac{}{}"), G_CALLBACK (cb_math_frac)},
        {"MathSquareRoot", "math-square-root", N_("Square Root - \\sqrt{}"), NULL,
@@ -518,6 +522,10 @@ init_ui (GtkWidget *box)
                        "viewPDF");
        latexila.actions.view_ps = gtk_action_group_get_action (action_group,
                        "viewPS");
+       latexila.actions.bibtex = gtk_action_group_get_action (action_group,
+                       "compile_bibtex");
+       latexila.actions.makeindex = gtk_action_group_get_action (action_group,
+                       "compile_makeindex");
 
 
        GtkToggleAction *show_side_pane = GTK_TOGGLE_ACTION (
diff --git a/src/ui.xml b/src/ui.xml
index 17976b5..1dc3d7f 100644
--- a/src/ui.xml
+++ b/src/ui.xml
@@ -78,6 +78,9 @@ In the code, GtkUIManager is used to construct them.
       <menuitem action="DVItoPDF" />
       <menuitem action="DVItoPS" />
       <menuitem action="viewPS" />
+      <separator />
+      <menuitem action="compile_bibtex" />
+      <menuitem action="compile_makeindex" />
     </menu>
 
     <menu action="Latex">


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