| 1 | /* main.vala |
|---|
| 2 | * |
|---|
| 3 | * Copyright (C) 2010 Matias De la Puente |
|---|
| 4 | * |
|---|
| 5 | * This program is free software: you can redistribute it and/or modify |
|---|
| 6 | * it under the terms of the GNU General Public License as published by |
|---|
| 7 | * the Free Software Foundation, either version 3 of the License, or |
|---|
| 8 | * (at your option) any later version. |
|---|
| 9 | * |
|---|
| 10 | * This program is distributed in the hope that it will be useful, |
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | * GNU General Public License for more details. |
|---|
| 14 | * |
|---|
| 15 | * You should have received a copy of the GNU General Public License |
|---|
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | * |
|---|
| 18 | * Author: |
|---|
| 19 | * Matias De la Puente <mfpuente.ar@gmail.com> |
|---|
| 20 | */ |
|---|
| 21 | using I4uc; |
|---|
| 22 | |
|---|
| 23 | void main (string[] args) |
|---|
| 24 | { |
|---|
| 25 | Gtk.init (ref args); |
|---|
| 26 | |
|---|
| 27 | load_settings (); |
|---|
| 28 | |
|---|
| 29 | var main_window_view = new MainWindowView (); |
|---|
| 30 | main_window_view.show_all (); |
|---|
| 31 | |
|---|
| 32 | var main_window_presenter = new MainWindowPresenter (main_window_view); |
|---|
| 33 | var documents_presenter = new DocumentsPresenter (main_window_view.documents_view); |
|---|
| 34 | |
|---|
| 35 | main_window_view.exit_clicked.connect (() => { |
|---|
| 36 | if (!documents_presenter.close_all ()) |
|---|
| 37 | return true; |
|---|
| 38 | return false; |
|---|
| 39 | }); |
|---|
| 40 | |
|---|
| 41 | Gtk.main (); |
|---|
| 42 | I4uc.Settings.instance.save (); |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | void load_settings () |
|---|
| 46 | { |
|---|
| 47 | var settings_folder = Path.build_filename (Environment.get_home_dir (), ".i4uc"); |
|---|
| 48 | if (!FileUtils.test (settings_folder, FileTest.EXISTS)) |
|---|
| 49 | DirUtils.create (settings_folder, 0755); |
|---|
| 50 | var settings_filename = Path.build_filename (settings_folder, "i4ucrc"); |
|---|
| 51 | I4uc.Settings.instance.open (settings_filename); |
|---|
| 52 | } |
|---|