2013-02-20 [colin] 3.9.0cvs85
[claws.git] / src / plugins / notification / gtkhotkey / gtk-hotkey-utils.c
1 /*
2  * This file is part of GtkHotkey.
3  * Copyright Mikkel Kamstrup Erlandsen, March, 2008
4  *
5  *   GtkHotkey is free software: you can redistribute it and/or modify
6  *   it under the terms of the GNU Lesser 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  *   GtkHotkey 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 Lesser General Public License for more details.
14  *
15  *   You should have received a copy of the GNU Lesser General Public License
16  *   along with GtkHotkey.  If not, see <http://www.gnu.org/licenses/>.
17  */
18  
19 #include <gio/gio.h>
20
21 GFileType
22 gtk_hotkey_g_file_get_type (GFile *file)
23 {
24         GFileInfo   *info;
25         GFileType   type;
26         GError          *error;
27         
28         g_return_val_if_fail (G_IS_FILE(file), G_FILE_TYPE_UNKNOWN);
29         
30         if (!g_file_query_exists(file, NULL))
31                 return G_FILE_TYPE_UNKNOWN;
32         
33         g_return_val_if_fail (G_IS_FILE(file), G_FILE_TYPE_UNKNOWN);
34         error = NULL;
35         info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TYPE,
36                                                           0, NULL, &error);
37         
38         if (error) {
39                 g_critical ("Failed to create GFileInfo: %s", error->message);
40                 g_error_free (error);
41                 return G_FILE_TYPE_UNKNOWN;
42         }
43         
44         type = g_file_info_get_file_type (info);
45         g_object_unref (info);
46         
47         return type;
48 }