[latexila/wip/finance] Finance: show dialog on start-up (not finished)
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila/wip/finance] Finance: show dialog on start-up (not finished)
- Date: Wed, 28 Jan 2015 12:37:39 +0000 (UTC)
commit 51f01c702e50ca5bf8d6553f6f612145ff6d9b9f
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Jan 22 16:53:00 2015 +0100
Finance: show dialog on start-up (not finished)
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/finance.vala | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++
src/main_window.vala | 12 ++------
4 files changed, 81 insertions(+), 9 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 78100b4..dd7c1bf 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -22,6 +22,7 @@ src/document_view.vala
src/encodings.vala
src/error_entry.vala
src/file_browser.vala
+src/finance.vala
src/latexila_app.vala
src/latex_menu.vala
src/liblatexila/latexila-build-job.c
diff --git a/src/Makefile.am b/src/Makefile.am
index bdd5b42..4c32300 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -33,6 +33,7 @@ vala_files = \
encodings.vala \
error_entry.vala \
file_browser.vala \
+ finance.vala \
latexila_app.vala \
latex_menu.vala \
main.vala \
diff --git a/src/finance.vala b/src/finance.vala
new file mode 100644
index 0000000..378be23
--- /dev/null
+++ b/src/finance.vala
@@ -0,0 +1,76 @@
+/*
+ * This file is part of LaTeXila.
+ *
+ * Copyright © 2015 - Sébastien Wilmet
+ *
+ * LaTeXila is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * LaTeXila is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with LaTeXila. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+using Gtk;
+
+namespace Finance
+{
+ public void show_dialog (MainWindow window)
+ {
+ Dialog dialog = new Dialog.with_buttons ("LaTeXila Finance",
+ window,
+ DialogFlags.DESTROY_WITH_PARENT,
+ "_Close", ResponseType.CLOSE,
+ "_More Information", ResponseType.ACCEPT,
+ null);
+
+ dialog.set_resizable (false);
+ dialog.set_default_response (ResponseType.ACCEPT);
+
+ unowned Box content_area = dialog.get_content_area ();
+ content_area.set_spacing (6);
+
+ Label label = new Label (null);
+ label.set_markup ("<big>Did you know...</big>");
+ content_area.add (label);
+
+ label = new Label ("...that you can support financially LaTeXila?");
+ content_area.add (label);
+
+ label = new Label (null);
+ label.set_markup ("LaTeXila is a free/<i>libre</i> LaTeX editor and comes" +
+ " free of charge. But if you appreciate this software, you are encouraged" +
+ " to make a donation to help its future development.");
+ label.max_width_chars = 60;
+ label.set_line_wrap (true);
+ content_area.add (label);
+
+ content_area.show_all ();
+
+ int response = dialog.run ();
+
+ if (response == ResponseType.ACCEPT)
+ open_donate_page (window);
+
+ dialog.destroy ();
+ }
+
+ public void open_donate_page (MainWindow window)
+ {
+ try
+ {
+ string uri = "https://wiki.gnome.org/Apps/LaTeXila/donate";
+ show_uri (window.get_screen (), uri, Gdk.CURRENT_TIME);
+ }
+ catch (Error e)
+ {
+ warning ("Impossible to open the donate page: %s", e.message);
+ }
+ }
+}
diff --git a/src/main_window.vala b/src/main_window.vala
index 14b4bd7..c4c789c 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -267,6 +267,8 @@ public class MainWindow : Window
restore_state ();
show_or_hide_widgets ();
show ();
+
+ Finance.show_dialog (this);
}
// Force to show icons in the menu.
@@ -1163,15 +1165,7 @@ public class MainWindow : Window
public void on_help_donate ()
{
- try
- {
- string uri = "https://wiki.gnome.org/Apps/LaTeXila/donate";
- show_uri (this.get_screen (), uri, Gdk.CURRENT_TIME);
- }
- catch (Error e)
- {
- warning ("Impossible to open the donate page: %s", e.message);
- }
+ Finance.open_donate_page (this);
}
public void on_about_dialog ()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]