[latexila] Bind latexila GActions to GtkActions
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Bind latexila GActions to GtkActions
- Date: Mon, 14 Aug 2017 18:22:50 +0000 (UTC)
commit 70190d6ddfdd35ee5293fbc7d590019ae99e8329
Author: Sébastien Wilmet <swilmet gnome org>
Date: Mon Aug 14 19:17:13 2017 +0200
Bind latexila GActions to GtkActions
src/main_window.vala | 39 +++++++++++++------------------------
src/main_window_build_tools.vala | 11 ++++-----
src/main_window_edit.vala | 11 ++++-----
src/main_window_file.vala | 11 ++++-----
4 files changed, 29 insertions(+), 43 deletions(-)
---
diff --git a/src/main_window.vala b/src/main_window.vala
index 0b0d64d..0ee86d4 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -26,7 +26,7 @@ public class MainWindow : ApplicationWindow
private const Gtk.ActionEntry[] _action_entries =
{
{ "FileQuit", "application-exit", N_("_Quit"), "<Control>Q",
- N_("Quit the program"), on_quit },
+ N_("Quit the program") },
// View
{ "View", null, N_("_View") },
@@ -62,14 +62,13 @@ public class MainWindow : ApplicationWindow
// Help
{ "Help", null, N_("_Help") },
{ "HelpContents", "help-browser", N_("_Contents"), "<Release>F1",
- N_("Open the LaTeXila documentation"), on_help_contents },
+ N_("Open the LaTeXila documentation") },
{ "HelpLatexReference", null, N_("_LaTeX Reference"), null,
N_("The Kile LaTeX Reference"), on_help_latex_reference },
{ "HelpFinance", null, "LaTeXila _Fundraising", null,
- "Donate to demonstrate your appreciation of LaTeXila and help its future development",
- on_help_finance },
+ "Donate to demonstrate your appreciation of LaTeXila and help its future development" },
{ "HelpAbout", "help-about", N_("_About"), null,
- N_("About LaTeXila"), on_about_dialog }
+ N_("About LaTeXila") }
};
private const ToggleActionEntry[] _toggle_action_entries =
@@ -317,6 +316,16 @@ public class MainWindow : ApplicationWindow
add_accel_group (_ui_manager.get_accel_group ());
+ LatexilaApp app = LatexilaApp.get_instance ();
+ Amtk.utils_bind_g_action_to_gtk_action (app, "quit",
+ _action_group, "FileQuit");
+ Amtk.utils_bind_g_action_to_gtk_action (app, "help",
+ _action_group, "HelpContents");
+ Amtk.utils_bind_g_action_to_gtk_action (app, "fundraising",
+ _action_group, "HelpFinance");
+ Amtk.utils_bind_g_action_to_gtk_action (app, "about",
+ _action_group, "HelpAbout");
+
/* Show tooltips in the statusbar */
_ui_manager.connect_proxy.connect ((action, p) =>
@@ -1091,11 +1100,6 @@ public class MainWindow : ApplicationWindow
/*************************************************************************/
// Gtk.Action callbacks
- public void on_quit ()
- {
- LatexilaApp.get_instance ().activate_action ("quit", null);
- }
-
/* View */
public void on_view_zoom_in ()
@@ -1166,11 +1170,6 @@ public class MainWindow : ApplicationWindow
/* Help */
- public void on_help_contents ()
- {
- LatexilaApp.get_instance ().activate_action ("help", null);
- }
-
public void on_help_latex_reference ()
{
try
@@ -1184,14 +1183,4 @@ public class MainWindow : ApplicationWindow
warning ("Impossible to open the LaTeX reference: %s", e.message);
}
}
-
- public void on_help_finance ()
- {
- LatexilaApp.get_instance ().activate_action ("fundraising", null);
- }
-
- public void on_about_dialog ()
- {
- LatexilaApp.get_instance ().activate_action ("about", null);
- }
}
diff --git a/src/main_window_build_tools.vala b/src/main_window_build_tools.vala
index b7c9fdc..5045f6a 100644
--- a/src/main_window_build_tools.vala
+++ b/src/main_window_build_tools.vala
@@ -38,7 +38,7 @@ public class MainWindowBuildTools
N_("View Log"), on_view_log },
{ "BuildToolsPreferences", "preferences-system", N_("_Manage Build Tools"), null,
- N_("Manage Build Tools"), on_preferences }
+ N_("Manage Build Tools") }
};
private const ToggleActionEntry[] _toggle_action_entries =
@@ -82,6 +82,10 @@ public class MainWindowBuildTools
ui_manager.insert_action_group (_static_action_group, 0);
+ LatexilaApp app = LatexilaApp.get_instance ();
+ Amtk.utils_bind_g_action_to_gtk_action (app, "manage-build-tools",
+ _static_action_group, "BuildToolsPreferences");
+
/* Dynamic Gtk.Actions (the placeholder) */
_dynamic_action_group = new Gtk.ActionGroup ("BuildToolsActions");
ui_manager.insert_action_group (_dynamic_action_group, 0);
@@ -477,9 +481,4 @@ public class MainWindowBuildTools
else
tab.document.readonly = true;
}
-
- public void on_preferences ()
- {
- LatexilaApp.get_instance ().activate_action ("manage-build-tools", null);
- }
}
diff --git a/src/main_window_edit.vala b/src/main_window_edit.vala
index 3a3d26c..aea856d 100644
--- a/src/main_window_edit.vala
+++ b/src/main_window_edit.vala
@@ -72,7 +72,7 @@ public class MainWindowEdit
N_("Complete the LaTeX command"), on_completion },
{ "EditPreferences", "preferences-system", N_("_Preferences"), null,
- N_("Configure the application"), on_open_preferences }
+ N_("Configure the application") }
};
private unowned MainWindow _main_window;
@@ -88,6 +88,8 @@ public class MainWindowEdit
ui_manager.insert_action_group (_action_group, 0);
+ LatexilaApp app = LatexilaApp.get_instance ();
+
Amtk.utils_bind_g_action_to_gtk_action (main_window, "tepl-cut",
_action_group, "EditCut");
Amtk.utils_bind_g_action_to_gtk_action (main_window, "tepl-copy",
@@ -98,6 +100,8 @@ public class MainWindowEdit
_action_group, "EditDelete");
Amtk.utils_bind_g_action_to_gtk_action (main_window, "tepl-select-all",
_action_group, "EditSelectAll");
+ Amtk.utils_bind_g_action_to_gtk_action (app, "preferences",
+ _action_group, "EditPreferences");
}
/* Sensitivity */
@@ -224,9 +228,4 @@ public class MainWindowEdit
return_if_fail (_main_window.active_tab != null);
_main_window.active_view.show_completion ();
}
-
- public void on_open_preferences ()
- {
- LatexilaApp.get_instance ().activate_action ("preferences", null);
- }
}
diff --git a/src/main_window_file.vala b/src/main_window_file.vala
index 6bbd942..ade3c8e 100644
--- a/src/main_window_file.vala
+++ b/src/main_window_file.vala
@@ -33,7 +33,7 @@ public class MainWindowFile
N_("New file"), on_file_new },
{ "FileNewWindow", null, N_("New _Window"), null,
- N_("Create a new window"), on_new_window },
+ N_("Create a new window") },
{ "FileOpen", "document-open", N_("_Open"), "<Control>O",
N_("Open a file"), on_file_open },
@@ -72,6 +72,10 @@ public class MainWindowFile
_action_group.add_action (recent_action);
ui_manager.insert_action_group (_action_group, 0);
+
+ LatexilaApp app = LatexilaApp.get_instance ();
+ Amtk.utils_bind_g_action_to_gtk_action (app, "new-window",
+ _action_group, "FileNewWindow");
}
public ToolItem get_toolbar_open_button ()
@@ -141,11 +145,6 @@ public class MainWindowFile
}
}
- public void on_new_window ()
- {
- LatexilaApp.get_instance ().activate_action ("new-window", null);
- }
-
public void on_file_open ()
{
FileChooserDialog file_chooser = new FileChooserDialog (_("Open Files"),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]