1
// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
3
* Copyright (c) 2013 Pantheon Developers (http://launchpad.net/elementary)
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
10
* This library 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 GNU
13
* Library General Public License for more details.
15
* You should have received a copy of the GNU Library General Public
16
* License along with this library; if not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
20
* Authored by: Corentin Noël <tintou@mailoo.org>
23
public class PantheonModule.FileChooserDialog : GLib.Object {
24
/* CATCHING DIALOGS SECTION BY: tintou (https://launchpad.net/~tintou) */
25
Gee.TreeSet<Gtk.FileChooserDialog> tree_set;
26
public FileChooserDialog () {
27
tree_set = new Gee.TreeSet<Gtk.FileChooserDialog> ();
28
/* It's the only way to get every new window */
29
var map_id = GLib.Signal.lookup ("window-state-event", typeof (Gtk.Dialog));
30
GLib.Signal.add_emission_hook (map_id, 0, (ihint, param_values) => {
31
if (param_values [0].type () == typeof (Gtk.FileChooserDialog)) {
32
var dialog = (Gtk.FileChooserDialog)param_values [0].dup_object ();
33
if (tree_set.contains (dialog) == false) {
34
tree_set.add (dialog);
35
new CustomFileChooserDialog (dialog);
36
dialog.destroy.connect (() => {
37
tree_set.remove (dialog);
47
public static PantheonModule.FileChooserDialog filechooser_module = null;
48
public void gtk_module_init ([CCode (array_length_cname = "argc", array_length_pos = 0.5)] ref unowned string[]? argv) {
50
filechooser_module = new PantheonModule.FileChooserDialog ();