[latexila] Use tepl_application_get_active_main_window()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila] Use tepl_application_get_active_main_window()
- Date: Sat, 14 Oct 2017 09:46:13 +0000 (UTC)
commit 948c5c564b7acd13558f927ca6c21f1e728ee148
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Oct 14 11:30:17 2017 +0200
Use tepl_application_get_active_main_window()
But it's more convenient to still return the MainWindow type.
Porting to tepl_application_get_active_main_window() has the benefit to
test that function in latexila. In the future latexila will rely on
other Tepl features that will use that function.
src/latexila_app.vala | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/latexila_app.vala b/src/latexila_app.vala
index 2f6d187..6f22801 100644
--- a/src/latexila_app.vala
+++ b/src/latexila_app.vala
@@ -57,13 +57,13 @@ public class LatexilaApp : Gtk.Application
public MainWindow? get_active_main_window ()
{
- foreach (Gtk.Window window in get_windows ())
- {
- if (window is MainWindow)
- return window as MainWindow;
- }
+ Tepl.Application tepl_app = Tepl.Application.get_from_gtk_application (this);
+ Gtk.ApplicationWindow? main_window = tepl_app.get_active_main_window ();
+
+ if (main_window == null)
+ return null;
- return null;
+ return main_window as MainWindow;
}
private void setup_main_option_entries ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]