1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 obt/link.h for the Openbox window manager
4 Copyright (c) 2009 Dana Jansens
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.
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.
16 See the COPYING file for a copy of the GNU General Public License.
29 OBT_LINK_TYPE_APPLICATION = 1,
30 OBT_LINK_TYPE_URL = 2,
31 OBT_LINK_TYPE_DIRECTORY = 3
35 OBT_LINK_APP_STARTUP_NO_SUPPORT,
36 OBT_LINK_APP_STARTUP_PROTOCOL_SUPPORT,
37 OBT_LINK_APP_STARTUP_LEGACY_SUPPORT
40 /*! These bit flags are environments for links. Some links are used or not
41 used in various environments. */
43 OBT_LINK_ENV_OPENBOX = 1 << 0,
44 OBT_LINK_ENV_GNOME = 1 << 1,
45 OBT_LINK_ENV_KDE = 1 << 2,
46 OBT_LINK_ENV_LXDE = 1 << 3,
47 OBT_LINK_ENV_ROX = 1 << 4,
48 OBT_LINK_ENV_XFCE = 1 << 5,
49 OBT_LINK_ENV_OLD = 1 << 6
53 /*! The app can be launched with a single local file */
54 OBT_LINK_APP_SINGLE_LOCAL = 1 << 0,
55 /*! The app can be launched with multiple local files */
56 OBT_LINK_APP_MULTI_LOCAL = 1 << 1,
57 /*! The app can be launched with a single URL */
58 OBT_LINK_APP_SINGLE_URL = 1 << 2,
59 /*! The app can be launched with multiple URLs */
60 OBT_LINK_APP_MULTI_URL = 1 << 3
63 typedef struct _ObtLink ObtLink;
65 /*! Parse a .desktop (dd) file.
66 @param basepath The base directory in which to read the file.
67 @param filename The full path to the .desktop file _relative to_ basepath.
68 It must be in basepath or a subdirectory of it.
69 @param o An ObtPaths structure, which contains the executable paths.
71 ObtLink* obt_link_from_ddfile(const gchar *basepath, const gchar *filename,
74 void obt_link_ref(ObtLink *e);
75 void obt_link_unref(ObtLink *e);
77 /*! Returns TRUE if the file exists but says it should be ignored, with
78 the Hidden flag. No other functions can be used for the ObtLink
80 gboolean obt_link_deleted (ObtLink *e);
82 /*! Returns the type of object refered to by the .desktop file. */
83 ObtLinkType obt_link_type (ObtLink *e);
85 /*! Returns TRUE if the .desktop file should be displayed to users, given the
86 current environment. If FALSE, the .desktop file should not be showed.
87 This also uses the TryExec option if it is present.
88 @env A semicolon-deliminated list of environemnts. Can be one or more of:
89 GNOME, KDE, ROX, XFCE. Other environments not listed here may also
90 be supported. This can be null also if not listing any environment. */
91 gboolean obt_link_display(ObtLink *e, const gchar *env);
93 const gchar* obt_link_name (ObtLink *e);
94 const gchar* obt_link_generic_name (ObtLink *e);
95 const gchar* obt_link_comment (ObtLink *e);
96 /*! Returns the icon for the object referred to by the .desktop file.
97 Returns either an absolute path, or a string which can be used to find the
98 icon using the algorithm given by:
99 http://freedesktop.org/wiki/Specifications/icon-theme-spec?action=show&redirect=Standards/icon-theme-spec
101 const gchar* obt_link_icon (ObtLink *e);
103 const gchar *obt_link_url_path(ObtLink *e);
105 const gchar* obt_link_app_executable (ObtLink *e);
106 /*! Returns the path in which the application should be run */
107 const gchar* obt_link_app_path (ObtLink *e);
108 gboolean obt_link_app_run_in_terminal (ObtLink *e);
109 const gchar*const* obt_link_app_mime_types (ObtLink *e);
110 const GQuark* obt_link_app_categories (ObtLink *e, gulong *n);
111 /*! Returns a combination of values in the ObtLinkAppOpen enum,
112 specifying if the application can be launched to open one or more files
114 ObtLinkAppOpen obt_link_app_open(ObtLink *e);
116 ObtLinkAppStartup obt_link_app_startup_notify(ObtLink *e);
117 const gchar* obt_link_app_startup_wmclass(ObtLink *e);