[gnome-latex] LaTeX commands: port Math spaces commands to GAction
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex] LaTeX commands: port Math spaces commands to GAction
- Date: Sun, 25 Feb 2018 18:39:52 +0000 (UTC)
commit 0def359b606b5b32e7d14853e9061e4ef8bc9195
Author: cvfsammmm <34792612+cvfosammmm user noreply github com>
Date: Sun Feb 25 19:16:48 2018 +0100
LaTeX commands: port Math spaces commands to GAction
src/latex_menu.vala | 52 ++++++++++---------------------
src/liblatexila/latexila-latex-commands.c | 33 ++++++++++++++++++++
2 files changed, 50 insertions(+), 35 deletions(-)
---
diff --git a/src/latex_menu.vala b/src/latex_menu.vala
index 6c6ffa4..63254f6 100644
--- a/src/latex_menu.vala
+++ b/src/latex_menu.vala
@@ -355,14 +355,11 @@ public class LatexMenu : Gtk.ActionGroup
// Math Spaces
{ "MathSpaces", null, N_("Math _Spaces") },
- { "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 },
+ { "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 },
// Math: Left Delimiters
@@ -799,6 +796,18 @@ 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)
@@ -819,33 +828,6 @@ 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 84e87eb..4b3d19e 100644
--- a/src/liblatexila/latexila-latex-commands.c
+++ b/src/liblatexila/latexila-latex-commands.c
@@ -700,6 +700,36 @@ 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.
@@ -739,6 +769,9 @@ 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_small_cb },
+ { "math-command-spaces-medium", math_command_spaces_medium_cb },
+ { "math-command-spaces-large", math_command_spaces_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]