]> icculus.org git repositories - dana/openbox.git/blob - obt/link.h
Add a new ObtLink type, which is going to be a generalization of a .desktop entry.
[dana/openbox.git] / obt / link.h
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2  
3    obt/link.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_link_h
20 #define __obt_link_h
21
22 #include <glib.h>
23
24 G_BEGIN_DECLS
25
26 typedef enum {
27         OBT_LINK_TYPE_APPLICATION = 1,
28         OBT_LINK_TYPE_URL         = 2,
29         OBT_LINK_TYPE_DIRECTORY   = 3
30 } ObtLinkType;
31
32 typedef enum {
33         OBT_LINK_APP_STARTUP_NO_SUPPORT,
34         OBT_LINK_APP_STARTUP_PROTOCOL_SUPPORT,
35         OBT_LINK_APP_STARTUP_LEGACY_SUPPORT
36 } ObtLinkAppStartup;
37
38 typedef enum {
39         /*! The app can be launched with a single local file */
40         OBT_LINK_APP_SINGLE_LOCAL = 1 << 0,
41         /*! The app can be launched with multiple local files */
42         OBT_LINK_APP_MULTI_LOCAL  = 1 << 1,
43         /*! The app can be launched with a single URL */
44         OBT_LINK_APP_SINGLE_URL   = 1 << 2,
45         /*! The app can be launched with multiple URLs */
46         OBT_LINK_APP_MULTI_URL    = 1 << 3
47 } ObtLinkAppOpen;
48
49 typedef struct _ObtLink     ObtLink;
50
51 ObtLink* obt_link_from_ddfile(const gchar *name, GSList *paths);
52
53 void obt_link_ref(ObtLink *e);
54 void obt_link_unref(ObtLink *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 ObtLink
58     in this case. */
59 gboolean obt_link_deleted (ObtLink *e);
60
61 /*! Returns the type of object refered to by the .desktop file. */
62 ObtLinkType obt_link_type (ObtLink *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_link_display(ObtLink *e, const gchar *env);
71
72 const gchar* obt_link_name           (ObtLink *e);
73 const gchar* obt_link_generic_name   (ObtLink *e);
74 const gchar* obt_link_comment        (ObtLink *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_link_icon           (ObtLink *e);
81
82 const gchar *obt_link_url_path(ObtLink *e);
83
84 const gchar*  obt_link_app_executable      (ObtLink *e);
85 /*! Returns the path in which the application should be run */
86 const gchar*  obt_link_app_path            (ObtLink *e);
87 gboolean      obt_link_app_run_in_terminal (ObtLink *e);
88 const gchar** obt_link_app_mime_types      (ObtLink *e);
89 /*! Returns a combination of values in the ObtLinkAppOpen enum,
90     specifying if the application can be launched to open one or more files
91     and URLs. */
92 ObtLinkAppOpen obt_link_app_open(ObtLink *e);
93
94 ObtLinkAppStartup obt_link_app_startup_notify(ObtLink *e);
95 const gchar* obt_link_app_startup_wmclass(ObtLink *e);
96
97
98 G_END_DECLS
99
100 #endif