Use a gsource instead of gio channels for watching x events
[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 struct _ObtPaths;
27
28 typedef enum {
29         OBT_LINK_TYPE_APPLICATION = 1,
30         OBT_LINK_TYPE_URL         = 2,
31         OBT_LINK_TYPE_DIRECTORY   = 3
32 } ObtLinkType;
33
34 typedef enum {
35         OBT_LINK_APP_STARTUP_NO_SUPPORT,
36         OBT_LINK_APP_STARTUP_PROTOCOL_SUPPORT,
37         OBT_LINK_APP_STARTUP_LEGACY_SUPPORT
38 } ObtLinkAppStartup;
39
40 /*! These bit flags are environments for links.  Some links are used or not
41   used in various environments. */
42 typedef enum {
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
50 } ObtLinkEnvFlags;
51
52 typedef enum {
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
61 } ObtLinkAppOpen;
62
63 typedef struct _ObtLink     ObtLink;
64
65 ObtLink* obt_link_from_ddfile(const gchar *name, GSList *paths,
66                               struct _ObtPaths *p);
67
68 void obt_link_ref(ObtLink *e);
69 void obt_link_unref(ObtLink *e);
70
71 /*! Returns TRUE if the file exists but says it should be ignored, with
72     the Hidden flag.  No other functions can be used for the ObtLink
73     in this case. */
74 gboolean obt_link_deleted (ObtLink *e);
75
76 /*! Returns the type of object refered to by the .desktop file. */
77 ObtLinkType obt_link_type (ObtLink *e);
78
79 /*! Returns TRUE if the .desktop file should be displayed to users, given the
80     current     environment.  If FALSE, the .desktop file should not be showed.
81         This also uses the TryExec option if it is present.
82     @env A semicolon-deliminated list of environemnts.  Can be one or more of:
83          GNOME, KDE, ROX, XFCE.  Other environments not listed here may also
84          be supported.  This can be null also if not listing any environment. */
85 gboolean obt_link_display(ObtLink *e, const gchar *env);
86
87 const gchar* obt_link_name           (ObtLink *e);
88 const gchar* obt_link_generic_name   (ObtLink *e);
89 const gchar* obt_link_comment        (ObtLink *e);
90 /*! Returns the icon for the object referred to by the .desktop file.
91     Returns either an absolute path, or a string which can be used to find the
92     icon using the algorithm given by:
93     http://freedesktop.org/wiki/Specifications/icon-theme-spec?action=show&redirect=Standards/icon-theme-spec
94 */
95 const gchar* obt_link_icon           (ObtLink *e);
96
97 const gchar *obt_link_url_path(ObtLink *e);
98
99 const gchar*  obt_link_app_executable      (ObtLink *e);
100 /*! Returns the path in which the application should be run */
101 const gchar*  obt_link_app_path            (ObtLink *e);
102 gboolean      obt_link_app_run_in_terminal (ObtLink *e);
103 const gchar*const* obt_link_app_mime_types      (ObtLink *e);
104 const GQuark* obt_link_app_categories      (ObtLink *e, gulong *n);
105 /*! Returns a combination of values in the ObtLinkAppOpen enum,
106     specifying if the application can be launched to open one or more files
107     and URLs. */
108 ObtLinkAppOpen obt_link_app_open(ObtLink *e);
109
110 ObtLinkAppStartup obt_link_app_startup_notify(ObtLink *e);
111 const gchar* obt_link_app_startup_wmclass(ObtLink *e);
112
113
114 G_END_DECLS
115
116 #endif