[latexila/wip/finance] Finance: show dialog on start-up (not finished)



commit ada2819b3ce7d1a34d1f08ce45d21fcd0bcc9b29
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     |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/main_window.vala |   12 ++--------
 4 files changed, 60 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..a0c8283
--- /dev/null
+++ b/src/finance.vala
@@ -0,0 +1,55 @@
+/*
+ * 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,
+            "_OK", ResponseType.OK,
+            "_More Information", ResponseType.ACCEPT,
+            null);
+
+        dialog.set_default_response (ResponseType.ACCEPT);
+
+        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]