[gnome-latex] Revert "LaTeX commands: port Math spaces commands to GAction"



commit 558be81df9703925e8e0fedc84cd58ca9650f4c4
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Feb 25 19:00:07 2018 +0100

    Revert "LaTeX commands: port Math spaces commands to GAction"
    
    This reverts commit d9357cc3d98d958832baeb7000e2ce0505b535b8.
    
    The code doesn't compile… I merged the commit from GitLab without
    verifying (and there is no CI configured yet for gnome-latex).

 src/latex_menu.vala                       | 52 +++++++++++++++++++++----------
 src/liblatexila/latexila-latex-commands.c | 33 --------------------
 2 files changed, 35 insertions(+), 50 deletions(-)
---
diff --git a/src/latex_menu.vala b/src/latex_menu.vala
index 63254f6..6c6ffa4 100644
--- a/src/latex_menu.vala
+++ b/src/latex_menu.vala
@@ -355,11 +355,14 @@ public class LatexMenu : Gtk.ActionGroup
         // Math Spaces
 
         { "MathSpaces", null, N_("Math _Spaces") },
-        { "MathSpaceSmall", null, N_("_Small"), null, N_("Small - \\,") },
-        { "MathSpaceMedium", null, N_("_Medium"), null, N_("Medium - \\:") },
-        { "MathSpaceLarge", null, N_("_Large"), null, N_("Large - \\;") },
-        { "MathSpaceQuad", null, "\\_quad", null, null },
-        { "MathSpaceQquad", null, "\\qqu_ad", null, null },
+        { "MathSpaceSmall", null, N_("_Small"), null,
+            N_("Small - \\,"), on_math_space_small },
+        { "MathSpaceMedium", null, N_("_Medium"), null,
+            N_("Medium - \\:"), on_math_space_medium },
+        { "MathSpaceLarge", null, N_("_Large"), null,
+            N_("Large - \\;"), on_math_space_large },
+        { "MathSpaceQuad", null, "\\_quad", null, null, on_math_space_quad },
+        { "MathSpaceQquad", null, "\\qqu_ad", null, null, on_math_space_qquad },
 
         // Math: Left Delimiters
 
@@ -796,18 +799,6 @@ public class LatexMenu : Gtk.ActionGroup
             this, "MathAccentDdot");
         Amtk.utils_bind_g_action_to_gtk_action (main_window, "latex-command-with-braces::mathring",
             this, "MathAccentRing");
-
-        // Math Spaces
-        Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-spaces-small",
-            this, "MathSpaceSmall");
-        Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-spaces-medium",
-            this, "MathSpaceMedium");
-        Amtk.utils_bind_g_action_to_gtk_action (main_window, "math-command-spaces-large",
-            this, "MathSpaceLarge");
-        Amtk.utils_bind_g_action_to_gtk_action (main_window, "latex-command-with-space::quad",
-            this, "MathSpaceQuad");
-        Amtk.utils_bind_g_action_to_gtk_action (main_window, "latex-command-with-space::qquad",
-            this, "MathSpaceQquad");
     }
 
     private Gtk.Action get_menu_tool_action (string name, string? label, string? icon_name)
@@ -828,6 +819,33 @@ public class LatexMenu : Gtk.ActionGroup
             text_if_no_selection);
     }
 
+    /* Math Spaces */
+
+    public void on_math_space_small ()
+    {
+        text_buffer_insert ("\\, ", "");
+    }
+
+    public void on_math_space_medium ()
+    {
+        text_buffer_insert ("\\: ", "");
+    }
+
+    public void on_math_space_large ()
+    {
+        text_buffer_insert ("\\; ", "");
+    }
+
+    public void on_math_space_quad ()
+    {
+        text_buffer_insert ("\\quad ", "");
+    }
+
+    public void on_math_space_qquad ()
+    {
+        text_buffer_insert ("\\qquad ", "");
+    }
+
     /* Left Delimiters */
 
     public void on_math_left_delimiter_1 ()
diff --git a/src/liblatexila/latexila-latex-commands.c b/src/liblatexila/latexila-latex-commands.c
index 88db169..84e87eb 100644
--- a/src/liblatexila/latexila-latex-commands.c
+++ b/src/liblatexila/latexila-latex-commands.c
@@ -700,36 +700,6 @@ math_command_misc_nth_root_cb (GSimpleAction *action,
        latexila_latex_commands_insert_text (tepl_window, "\\sqrt[]{", "}", NULL);
 }
 
-static void
-math_command_spaces_small_cb (GSimpleAction *action,
-                             GVariant      *parameter,
-                             gpointer       user_data)
-{
-       TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
-
-       latexila_latex_commands_insert_text (tepl_window, "\\, ", "", NULL);
-}
-
-static void
-math_command_spaces_medium_cb (GSimpleAction *action,
-                              GVariant      *parameter,
-                              gpointer       user_data)
-{
-       TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
-
-       latexila_latex_commands_insert_text (tepl_window, "\\: ", "", NULL);
-}
-
-static void
-math_command_spaces_large_cb (GSimpleAction *action,
-                             GVariant      *parameter,
-                             gpointer       user_data)
-{
-       TeplApplicationWindow *tepl_window = TEPL_APPLICATION_WINDOW (user_data);
-
-       latexila_latex_commands_insert_text (tepl_window, "\\; ", "", NULL);
-}
-
 /**
  * latexila_latex_commands_add_actions:
  * @gtk_window: a #GtkApplicationWindow.
@@ -769,9 +739,6 @@ latexila_latex_commands_add_actions (GtkApplicationWindow *gtk_window)
                { "math-command-misc-subscript", math_command_misc_subscript_cb },
                { "math-command-misc-frac", math_command_misc_frac_cb },
                { "math-command-misc-nth-root", math_command_misc_nth_root_cb },
-               { "math-command-spaces-small", math_command_spaces_math_space_small_cb },
-               { "math-command-spaces-medium", math_command_spaces_math_space_medium_cb },
-               { "math-command-spaces-large", math_command_spaces_math_space_large_cb },
        };
 
        g_return_if_fail (GTK_IS_APPLICATION_WINDOW (gtk_window));


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