1/* GIO - GLib Input, Output and Streaming Library
2 *
3 * Copyright (C) 2006-2007 Red Hat, Inc.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library 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 GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General
16 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 *
18 * Author: Alexander Larsson <alexl@redhat.com>
19 */
20
21#ifndef __G_DESKTOP_APP_INFO_H__
22#define __G_DESKTOP_APP_INFO_H__
23
24#include <gio/gio.h>
25
26G_BEGIN_DECLS
27
28#define G_TYPE_DESKTOP_APP_INFO (g_desktop_app_info_get_type ())
29#define G_DESKTOP_APP_INFO(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DESKTOP_APP_INFO, GDesktopAppInfo))
30#define G_DESKTOP_APP_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DESKTOP_APP_INFO, GDesktopAppInfoClass))
31#define G_IS_DESKTOP_APP_INFO(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DESKTOP_APP_INFO))
32#define G_IS_DESKTOP_APP_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DESKTOP_APP_INFO))
33#define G_DESKTOP_APP_INFO_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DESKTOP_APP_INFO, GDesktopAppInfoClass))
34
35typedef struct _GDesktopAppInfo GDesktopAppInfo;
36typedef struct _GDesktopAppInfoClass GDesktopAppInfoClass;
37
38G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDesktopAppInfo, g_object_unref)
39
40struct _GDesktopAppInfoClass
41{
42 GObjectClass parent_class;
43};
44
45
46GLIB_AVAILABLE_IN_ALL
47GType g_desktop_app_info_get_type (void) G_GNUC_CONST;
48
49GLIB_AVAILABLE_IN_ALL
50GDesktopAppInfo *g_desktop_app_info_new_from_filename (const char *filename);
51GLIB_AVAILABLE_IN_ALL
52GDesktopAppInfo *g_desktop_app_info_new_from_keyfile (GKeyFile *key_file);
53
54GLIB_AVAILABLE_IN_ALL
55const char * g_desktop_app_info_get_filename (GDesktopAppInfo *info);
56
57GLIB_AVAILABLE_IN_2_30
58const char * g_desktop_app_info_get_generic_name (GDesktopAppInfo *info);
59GLIB_AVAILABLE_IN_2_30
60const char * g_desktop_app_info_get_categories (GDesktopAppInfo *info);
61GLIB_AVAILABLE_IN_2_30
62const char * const *g_desktop_app_info_get_keywords (GDesktopAppInfo *info);
63GLIB_AVAILABLE_IN_2_30
64gboolean g_desktop_app_info_get_nodisplay (GDesktopAppInfo *info);
65GLIB_AVAILABLE_IN_2_30
66gboolean g_desktop_app_info_get_show_in (GDesktopAppInfo *info,
67 const gchar *desktop_env);
68GLIB_AVAILABLE_IN_2_34
69const char * g_desktop_app_info_get_startup_wm_class (GDesktopAppInfo *info);
70
71GLIB_AVAILABLE_IN_ALL
72GDesktopAppInfo *g_desktop_app_info_new (const char *desktop_id);
73GLIB_AVAILABLE_IN_ALL
74gboolean g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info);
75
76GLIB_DEPRECATED_IN_2_42
77void g_desktop_app_info_set_desktop_env (const char *desktop_env);
78
79GLIB_AVAILABLE_IN_2_36
80gboolean g_desktop_app_info_has_key (GDesktopAppInfo *info,
81 const char *key);
82GLIB_AVAILABLE_IN_2_36
83char * g_desktop_app_info_get_string (GDesktopAppInfo *info,
84 const char *key);
85GLIB_AVAILABLE_IN_2_36
86gboolean g_desktop_app_info_get_boolean (GDesktopAppInfo *info,
87 const char *key);
88
89GLIB_AVAILABLE_IN_2_38
90const gchar * const * g_desktop_app_info_list_actions (GDesktopAppInfo *info);
91
92GLIB_AVAILABLE_IN_2_38
93void g_desktop_app_info_launch_action (GDesktopAppInfo *info,
94 const gchar *action_name,
95 GAppLaunchContext *launch_context);
96
97GLIB_AVAILABLE_IN_2_38
98gchar * g_desktop_app_info_get_action_name (GDesktopAppInfo *info,
99 const gchar *action_name);
100
101#ifndef G_DISABLE_DEPRECATED
102
103#define G_TYPE_DESKTOP_APP_INFO_LOOKUP (g_desktop_app_info_lookup_get_type ())
104#define G_DESKTOP_APP_INFO_LOOKUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP, GDesktopAppInfoLookup))
105#define G_IS_DESKTOP_APP_INFO_LOOKUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP))
106#define G_DESKTOP_APP_INFO_LOOKUP_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP, GDesktopAppInfoLookupIface))
107
108/**
109 * G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME:
110 *
111 * Extension point for default handler to URI association. See
112 * [Extending GIO][extending-gio].
113 */
114#define G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME "gio-desktop-app-info-lookup"
115
116#endif /* G_DISABLE_DEPRECATED */
117
118/**
119 * GDesktopAppInfoLookupIface:
120 * @get_default_for_uri_scheme: Virtual method for
121 * g_desktop_app_info_lookup_get_default_for_uri_scheme().
122 *
123 * Interface that is used by backends to associate default
124 * handlers with URI schemes.
125 */
126typedef struct _GDesktopAppInfoLookup GDesktopAppInfoLookup;
127typedef struct _GDesktopAppInfoLookupIface GDesktopAppInfoLookupIface;
128
129struct _GDesktopAppInfoLookupIface
130{
131 GTypeInterface g_iface;
132
133 GAppInfo * (* get_default_for_uri_scheme) (GDesktopAppInfoLookup *lookup,
134 const char *uri_scheme);
135};
136
137GLIB_DEPRECATED
138GType g_desktop_app_info_lookup_get_type (void) G_GNUC_CONST;
139
140GLIB_DEPRECATED
141GAppInfo *g_desktop_app_info_lookup_get_default_for_uri_scheme (GDesktopAppInfoLookup *lookup,
142 const char *uri_scheme);
143
144/**
145 * GDesktopAppLaunchCallback:
146 * @appinfo: a #GDesktopAppInfo
147 * @pid: Process identifier
148 * @user_data: User data
149 *
150 * During invocation, g_desktop_app_info_launch_uris_as_manager() may
151 * create one or more child processes. This callback is invoked once
152 * for each, providing the process ID.
153 */
154typedef void (*GDesktopAppLaunchCallback) (GDesktopAppInfo *appinfo,
155 GPid pid,
156 gpointer user_data);
157
158GLIB_AVAILABLE_IN_2_28
159gboolean g_desktop_app_info_launch_uris_as_manager (GDesktopAppInfo *appinfo,
160 GList *uris,
161 GAppLaunchContext *launch_context,
162 GSpawnFlags spawn_flags,
163 GSpawnChildSetupFunc user_setup,
164 gpointer user_setup_data,
165 GDesktopAppLaunchCallback pid_callback,
166 gpointer pid_callback_data,
167 GError **error);
168
169GLIB_AVAILABLE_IN_2_40
170gchar *** g_desktop_app_info_search (const gchar *search_string);
171
172GLIB_AVAILABLE_IN_2_42
173GList *g_desktop_app_info_get_implementations (const gchar *interface);
174
175G_END_DECLS
176
177#endif /* __G_DESKTOP_APP_INFO_H__ */
178