2007-11-26 17:13:05 +01:00
|
|
|
/* GIO - GLib Input, Output and Streaming Library
|
2008-09-02 21:05:58 +02:00
|
|
|
*
|
2007-11-26 17:13:05 +01:00
|
|
|
* Copyright (C) 2006-2007 Red Hat, Inc.
|
|
|
|
*
|
2022-05-18 10:12:45 +02:00
|
|
|
* SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
*
|
2007-11-26 17:13:05 +01:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2017-05-27 18:21:30 +02:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2007-11-26 17:13:05 +01:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General
|
2014-01-23 12:58:29 +01:00
|
|
|
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
2007-11-26 17:13:05 +01:00
|
|
|
*
|
|
|
|
* Author: Alexander Larsson <alexl@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __G_DESKTOP_APP_INFO_H__
|
|
|
|
#define __G_DESKTOP_APP_INFO_H__
|
|
|
|
|
2007-12-14 11:35:24 +01:00
|
|
|
#include <gio/gio.h>
|
2007-11-26 17:13:05 +01:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2007-12-10 19:51:21 +01:00
|
|
|
#define G_TYPE_DESKTOP_APP_INFO (g_desktop_app_info_get_type ())
|
2007-11-26 17:13:05 +01:00
|
|
|
#define G_DESKTOP_APP_INFO(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DESKTOP_APP_INFO, GDesktopAppInfo))
|
|
|
|
#define G_DESKTOP_APP_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DESKTOP_APP_INFO, GDesktopAppInfoClass))
|
|
|
|
#define G_IS_DESKTOP_APP_INFO(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DESKTOP_APP_INFO))
|
|
|
|
#define G_IS_DESKTOP_APP_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DESKTOP_APP_INFO))
|
|
|
|
#define G_DESKTOP_APP_INFO_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DESKTOP_APP_INFO, GDesktopAppInfoClass))
|
|
|
|
|
|
|
|
typedef struct _GDesktopAppInfo GDesktopAppInfo;
|
|
|
|
typedef struct _GDesktopAppInfoClass GDesktopAppInfoClass;
|
|
|
|
|
2015-01-30 15:21:20 +01:00
|
|
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDesktopAppInfo, g_object_unref)
|
|
|
|
|
2007-11-26 17:13:05 +01:00
|
|
|
struct _GDesktopAppInfoClass
|
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
|
|
|
};
|
|
|
|
|
2008-01-29 13:18:48 +01:00
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_ALL
|
2008-09-02 21:05:58 +02:00
|
|
|
GType g_desktop_app_info_get_type (void) G_GNUC_CONST;
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_ALL
|
2007-12-10 19:51:21 +01:00
|
|
|
GDesktopAppInfo *g_desktop_app_info_new_from_filename (const char *filename);
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_ALL
|
2008-07-02 18:23:23 +02:00
|
|
|
GDesktopAppInfo *g_desktop_app_info_new_from_keyfile (GKeyFile *key_file);
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_ALL
|
2010-03-14 00:11:31 +01:00
|
|
|
const char * g_desktop_app_info_get_filename (GDesktopAppInfo *info);
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_30
|
2011-04-27 17:34:23 +02:00
|
|
|
const char * g_desktop_app_info_get_generic_name (GDesktopAppInfo *info);
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_30
|
2011-04-15 21:52:33 +02:00
|
|
|
const char * g_desktop_app_info_get_categories (GDesktopAppInfo *info);
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_30
|
2011-10-13 22:33:21 +02:00
|
|
|
const char * const *g_desktop_app_info_get_keywords (GDesktopAppInfo *info);
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_30
|
2011-06-14 09:01:25 +02:00
|
|
|
gboolean g_desktop_app_info_get_nodisplay (GDesktopAppInfo *info);
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_30
|
2011-07-21 15:23:00 +02:00
|
|
|
gboolean g_desktop_app_info_get_show_in (GDesktopAppInfo *info,
|
|
|
|
const gchar *desktop_env);
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_34
|
2012-04-05 23:26:12 +02:00
|
|
|
const char * g_desktop_app_info_get_startup_wm_class (GDesktopAppInfo *info);
|
2011-04-15 21:52:33 +02:00
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_ALL
|
2007-12-10 19:51:21 +01:00
|
|
|
GDesktopAppInfo *g_desktop_app_info_new (const char *desktop_id);
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_ALL
|
2007-12-10 19:51:21 +01:00
|
|
|
gboolean g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info);
|
2007-11-26 17:13:05 +01:00
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_DEPRECATED_IN_2_42
|
2008-09-02 21:05:58 +02:00
|
|
|
void g_desktop_app_info_set_desktop_env (const char *desktop_env);
|
2008-01-04 11:51:56 +01:00
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_36
|
2012-11-17 00:22:45 +01:00
|
|
|
gboolean g_desktop_app_info_has_key (GDesktopAppInfo *info,
|
|
|
|
const char *key);
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_36
|
2012-11-17 00:22:45 +01:00
|
|
|
char * g_desktop_app_info_get_string (GDesktopAppInfo *info,
|
|
|
|
const char *key);
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_56
|
2018-01-07 12:14:46 +01:00
|
|
|
char * g_desktop_app_info_get_locale_string (GDesktopAppInfo *info,
|
|
|
|
const char *key);
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_36
|
2012-11-17 00:22:45 +01:00
|
|
|
gboolean g_desktop_app_info_get_boolean (GDesktopAppInfo *info,
|
|
|
|
const char *key);
|
2010-11-09 13:19:19 +01:00
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_60
|
gdesktopappinfo: add get_string_list() function
The X-Flatpak-RenamedFrom key is used in .desktop files to identify past
names for the desktop file. It is defined to be a list of strings.
However, there was previously no correct way to retrieve a list of
strings from the GKeyFile wrapped by GDesktopAppInfo, short of
re-parsing the file with GKeyFile.
Note that doing something like:
g_strsplit (g_desktop_app_info_get_string (...), ";", -1)
is not correct: the raw value "a\;b;" represents the one-element list
["a;b"], but g_key_file_get_string() rejects the sequence "\;", and so
g_desktop_app_info_get_string() returns NULL in this case. (Of course, a
.desktop file with a semicolon in its name is a pathological case.)
Add g_desktop_app_info_get_string_list(), a trivial wrapper around
g_key_file_get_string_list(), similar to g_desktop_app_info_get_string()
and co.
The change from g_key_file_free() to g_key_file_unref() in the test is
needed because g_key_file_free() clears the contents of the keyfile.
This is fine for all the fields which are eagerly loaded and copied into
GDesktopAppInfo, but not when we want to access arbitrary stuff from the
keyfile.
2018-09-20 17:26:55 +02:00
|
|
|
gchar ** g_desktop_app_info_get_string_list (GDesktopAppInfo *info,
|
|
|
|
const char *key,
|
|
|
|
gsize *length);
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_38
|
2013-07-11 18:46:59 +02:00
|
|
|
const gchar * const * g_desktop_app_info_list_actions (GDesktopAppInfo *info);
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_38
|
2013-07-11 18:46:59 +02:00
|
|
|
void g_desktop_app_info_launch_action (GDesktopAppInfo *info,
|
|
|
|
const gchar *action_name,
|
|
|
|
GAppLaunchContext *launch_context);
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_38
|
2013-07-11 18:46:59 +02:00
|
|
|
gchar * g_desktop_app_info_get_action_name (GDesktopAppInfo *info,
|
|
|
|
const gchar *action_name);
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
#define G_TYPE_DESKTOP_APP_INFO_LOOKUP (g_desktop_app_info_lookup_get_type ()) GIO_DEPRECATED_MACRO_IN_2_28
|
|
|
|
#define G_DESKTOP_APP_INFO_LOOKUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP, GDesktopAppInfoLookup)) GIO_DEPRECATED_MACRO_IN_2_28
|
|
|
|
#define G_IS_DESKTOP_APP_INFO_LOOKUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP)) GIO_DEPRECATED_MACRO_IN_2_28
|
|
|
|
#define G_DESKTOP_APP_INFO_LOOKUP_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP, GDesktopAppInfoLookupIface)) GIO_DEPRECATED_MACRO_IN_2_28
|
2010-11-09 13:19:19 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME:
|
|
|
|
*
|
|
|
|
* Extension point for default handler to URI association. See
|
2014-04-15 16:18:59 +02:00
|
|
|
* [Extending GIO][extending-gio].
|
2019-05-27 19:09:08 +02:00
|
|
|
*
|
|
|
|
* Deprecated: 2.28: The #GDesktopAppInfoLookup interface is deprecated and
|
|
|
|
* unused by GIO.
|
2010-11-09 13:19:19 +01:00
|
|
|
*/
|
2022-10-05 19:39:21 +02:00
|
|
|
#define G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME "gio-desktop-app-info-lookup" GIO_DEPRECATED_MACRO_IN_2_28
|
2011-11-03 05:16:41 +01:00
|
|
|
|
2010-11-09 13:19:19 +01:00
|
|
|
/**
|
2015-02-05 16:20:43 +01:00
|
|
|
* GDesktopAppInfoLookupIface:
|
|
|
|
* @get_default_for_uri_scheme: Virtual method for
|
|
|
|
* g_desktop_app_info_lookup_get_default_for_uri_scheme().
|
2010-11-09 13:19:19 +01:00
|
|
|
*
|
|
|
|
* Interface that is used by backends to associate default
|
|
|
|
* handlers with URI schemes.
|
|
|
|
*/
|
|
|
|
typedef struct _GDesktopAppInfoLookup GDesktopAppInfoLookup;
|
|
|
|
typedef struct _GDesktopAppInfoLookupIface GDesktopAppInfoLookupIface;
|
|
|
|
|
|
|
|
struct _GDesktopAppInfoLookupIface
|
|
|
|
{
|
|
|
|
GTypeInterface g_iface;
|
|
|
|
|
|
|
|
GAppInfo * (* get_default_for_uri_scheme) (GDesktopAppInfoLookup *lookup,
|
|
|
|
const char *uri_scheme);
|
|
|
|
};
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_DEPRECATED
|
2010-11-09 13:19:19 +01:00
|
|
|
GType g_desktop_app_info_lookup_get_type (void) G_GNUC_CONST;
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_DEPRECATED
|
2010-11-09 13:19:19 +01:00
|
|
|
GAppInfo *g_desktop_app_info_lookup_get_default_for_uri_scheme (GDesktopAppInfoLookup *lookup,
|
|
|
|
const char *uri_scheme);
|
|
|
|
|
2010-12-20 20:48:53 +01:00
|
|
|
/**
|
|
|
|
* GDesktopAppLaunchCallback:
|
|
|
|
* @appinfo: a #GDesktopAppInfo
|
|
|
|
* @pid: Process identifier
|
|
|
|
* @user_data: User data
|
|
|
|
*
|
|
|
|
* During invocation, g_desktop_app_info_launch_uris_as_manager() may
|
|
|
|
* create one or more child processes. This callback is invoked once
|
|
|
|
* for each, providing the process ID.
|
|
|
|
*/
|
2011-01-05 19:00:50 +01:00
|
|
|
typedef void (*GDesktopAppLaunchCallback) (GDesktopAppInfo *appinfo,
|
|
|
|
GPid pid,
|
|
|
|
gpointer user_data);
|
2010-12-20 20:48:53 +01:00
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_28
|
2010-12-20 20:48:53 +01:00
|
|
|
gboolean g_desktop_app_info_launch_uris_as_manager (GDesktopAppInfo *appinfo,
|
|
|
|
GList *uris,
|
|
|
|
GAppLaunchContext *launch_context,
|
|
|
|
GSpawnFlags spawn_flags,
|
2011-01-05 19:49:20 +01:00
|
|
|
GSpawnChildSetupFunc user_setup,
|
2010-12-20 20:48:53 +01:00
|
|
|
gpointer user_setup_data,
|
2011-01-05 19:49:20 +01:00
|
|
|
GDesktopAppLaunchCallback pid_callback,
|
2010-12-20 20:48:53 +01:00
|
|
|
gpointer pid_callback_data,
|
|
|
|
GError **error);
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_58
|
2018-06-06 14:59:59 +02:00
|
|
|
gboolean g_desktop_app_info_launch_uris_as_manager_with_fds (GDesktopAppInfo *appinfo,
|
|
|
|
GList *uris,
|
|
|
|
GAppLaunchContext *launch_context,
|
|
|
|
GSpawnFlags spawn_flags,
|
|
|
|
GSpawnChildSetupFunc user_setup,
|
|
|
|
gpointer user_setup_data,
|
|
|
|
GDesktopAppLaunchCallback pid_callback,
|
|
|
|
gpointer pid_callback_data,
|
|
|
|
gint stdin_fd,
|
|
|
|
gint stdout_fd,
|
|
|
|
gint stderr_fd,
|
|
|
|
GError **error);
|
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_40
|
2013-11-06 04:51:48 +01:00
|
|
|
gchar *** g_desktop_app_info_search (const gchar *search_string);
|
2010-11-09 13:19:19 +01:00
|
|
|
|
2022-10-05 19:39:21 +02:00
|
|
|
GIO_AVAILABLE_IN_2_42
|
2013-11-15 20:40:37 +01:00
|
|
|
GList *g_desktop_app_info_get_implementations (const gchar *interface);
|
|
|
|
|
2007-11-26 17:13:05 +01:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __G_DESKTOP_APP_INFO_H__ */
|