Add skeleton for start of dot-desktop-file parser
[dana/openbox.git] / obt / ddfile.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2  
3    obt/ddfile.h for the Openbox window manager
4    Copyright (c) 2009        Dana Jansens
5  
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10  
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15  
16    See the COPYING file for a copy of the GNU General Public License.
17 */
18
19 #ifndef __obt_ddfile_h
20 #define __obt_ddfile_h
21
22 #include <glib.h>
23
24 G_BEGIN_DECLS
25
26 typedef enum {
27         OBT_DDFILE_TYPE_APPLICATION = 0,
28         OBT_DDFILE_TYPE_LINK        = 1,
29         OBT_DDFILE_TYPE_DIRECTORY   = 2
30 } ObtDDFileType;
31
32 typedef enum {
33         OBT_DDFILE_APP_STARTUP_NO_SUPPORT,
34         OBT_DDFILE_APP_STARTUP_PROTOCOL_SUPPORT,
35         OBT_DDFILE_APP_STARTUP_LEGACY_SUPPORT
36 } ObtDDFileAppStartup;
37
38 typedef enum {
39         /*! The app can be launched with a single local file */
40         OBT_DDFILE_APP_SINGLE_LOCAL = 1 << 0,
41         /*! The app can be launched with multiple local files */
42         OBT_DDFILE_APP_MULTI_LOCAL  = 1 << 1,
43         /*! The app can be launched with a single URL */
44         OBT_DDFILE_APP_SINGLE_URL   = 1 << 2,
45         /*! The app can be launched with multiple URLs */
46         OBT_DDFILE_APP_MULTI_URL    = 1 << 3
47 } ObtDDFileAppOpen;
48
49 typedef struct _ObtDDFile     ObtDDFile;
50
51 ObtDDFile* obt_ddfile_new_from_file(const gchar *name);
52
53 void obt_ddfile_ref(ObtDDFile *e);
54 void obt_ddfile_unref(ObtDDFile *e);
55
56 /*! Returns TRUE if the file exists but says it should be ignored, with
57     the Hidden flag.  No other functions can be used for the ObtDDFile
58     in this case. */
59 gboolean obt_ddfile_deleted (ObtDDFile *e);
60
61 /*! Returns the type of object refered to by the .desktop file. */
62 ObtDDFileType obt_ddfile_type (ObtDDFile *e);
63
64 /*! Returns TRUE if the .desktop file should be displayed to users, given the
65     current     environment.  If FALSE, the .desktop file should not be showed.
66         This also uses the TryExec option if it is present.
67     @env A semicolon-deliminated list of environemnts.  Can be one or more of:
68          GNOME, KDE, ROX, XFCE.  Other environments not listed here may also
69          be supported.  This can be null also if not listing any environment. */
70 gboolean obt_ddfile_display(ObtDDFile *e, const gchar *env);
71
72 const gchar* obt_ddfile_name           (ObtDDFile *e);
73 const gchar* obt_ddfile_generic_name   (ObtDDFile *e);
74 const gchar* obt_ddfile_comment        (ObtDDFile *e);
75 /*! Returns the icon for the object referred to by the .desktop file.
76     Returns either an absolute path, or a string which can be used to find the
77     icon using the algorithm given by:
78     http://freedesktop.org/wiki/Specifications/icon-theme-spec?action=show&redirect=Standards/icon-theme-spec
79 */
80 const gchar* obt_ddfile_icon           (ObtDDFile *e);
81
82 const gchar *obt_ddfile_link_url(ObtDDFile *e);
83
84 const gchar*  obt_ddfile_app_executable      (ObtDDFile *e);
85 /*! Returns the path in which the application should be run */
86 const gchar*  obt_ddfile_app_path            (ObtDDFile *e);
87 gboolean      obt_ddfile_app_run_in_terminal (ObtDDFile *e);
88 const gchar** obt_ddfile_app_mime_types      (ObtDDFile *e);
89 /*! Returns a combination of values in the ObtDDFileAppOpen enum,
90     specifying if the application can be launched to open one or more files
91     and URLs. */
92 ObtDDFileAppOpen obt_ddfile_app_open(ObtDDFile *e);
93
94 ObtDDFileAppStartup obt_ddfile_app_startup_notify(ObtDDFile *e);
95 const gchar* obt_ddfile_app_startup_wmclass(ObtDDFile *e);
96
97
98 G_END_DECLS
99
100 #endif