gdesktopappinfo.h 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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. #ifndef __G_DESKTOP_APP_INFO_H__
  21. #define __G_DESKTOP_APP_INFO_H__
  22. #include <gio/gio.h>
  23. G_BEGIN_DECLS
  24. #define G_TYPE_DESKTOP_APP_INFO (g_desktop_app_info_get_type ())
  25. #define G_DESKTOP_APP_INFO(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DESKTOP_APP_INFO, GDesktopAppInfo))
  26. #define G_DESKTOP_APP_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DESKTOP_APP_INFO, GDesktopAppInfoClass))
  27. #define G_IS_DESKTOP_APP_INFO(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DESKTOP_APP_INFO))
  28. #define G_IS_DESKTOP_APP_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DESKTOP_APP_INFO))
  29. #define G_DESKTOP_APP_INFO_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DESKTOP_APP_INFO, GDesktopAppInfoClass))
  30. typedef struct _GDesktopAppInfo GDesktopAppInfo;
  31. typedef struct _GDesktopAppInfoClass GDesktopAppInfoClass;
  32. G_DEFINE_AUTOPTR_CLEANUP_FUNC(GDesktopAppInfo, g_object_unref)
  33. struct _GDesktopAppInfoClass
  34. {
  35. GObjectClass parent_class;
  36. };
  37. GLIB_AVAILABLE_IN_ALL
  38. GType g_desktop_app_info_get_type (void) G_GNUC_CONST;
  39. GLIB_AVAILABLE_IN_ALL
  40. GDesktopAppInfo *g_desktop_app_info_new_from_filename (const char *filename);
  41. GLIB_AVAILABLE_IN_ALL
  42. GDesktopAppInfo *g_desktop_app_info_new_from_keyfile (GKeyFile *key_file);
  43. GLIB_AVAILABLE_IN_ALL
  44. const char * g_desktop_app_info_get_filename (GDesktopAppInfo *info);
  45. GLIB_AVAILABLE_IN_2_30
  46. const char * g_desktop_app_info_get_generic_name (GDesktopAppInfo *info);
  47. GLIB_AVAILABLE_IN_2_30
  48. const char * g_desktop_app_info_get_categories (GDesktopAppInfo *info);
  49. GLIB_AVAILABLE_IN_2_30
  50. const char * const *g_desktop_app_info_get_keywords (GDesktopAppInfo *info);
  51. GLIB_AVAILABLE_IN_2_30
  52. gboolean g_desktop_app_info_get_nodisplay (GDesktopAppInfo *info);
  53. GLIB_AVAILABLE_IN_2_30
  54. gboolean g_desktop_app_info_get_show_in (GDesktopAppInfo *info,
  55. const gchar *desktop_env);
  56. GLIB_AVAILABLE_IN_2_34
  57. const char * g_desktop_app_info_get_startup_wm_class (GDesktopAppInfo *info);
  58. GLIB_AVAILABLE_IN_ALL
  59. GDesktopAppInfo *g_desktop_app_info_new (const char *desktop_id);
  60. GLIB_AVAILABLE_IN_ALL
  61. gboolean g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info);
  62. GLIB_DEPRECATED_IN_2_42
  63. void g_desktop_app_info_set_desktop_env (const char *desktop_env);
  64. GLIB_AVAILABLE_IN_2_36
  65. gboolean g_desktop_app_info_has_key (GDesktopAppInfo *info,
  66. const char *key);
  67. GLIB_AVAILABLE_IN_2_36
  68. char * g_desktop_app_info_get_string (GDesktopAppInfo *info,
  69. const char *key);
  70. GLIB_AVAILABLE_IN_2_36
  71. gboolean g_desktop_app_info_get_boolean (GDesktopAppInfo *info,
  72. const char *key);
  73. GLIB_AVAILABLE_IN_2_38
  74. const gchar * const * g_desktop_app_info_list_actions (GDesktopAppInfo *info);
  75. GLIB_AVAILABLE_IN_2_38
  76. void g_desktop_app_info_launch_action (GDesktopAppInfo *info,
  77. const gchar *action_name,
  78. GAppLaunchContext *launch_context);
  79. GLIB_AVAILABLE_IN_2_38
  80. gchar * g_desktop_app_info_get_action_name (GDesktopAppInfo *info,
  81. const gchar *action_name);
  82. #ifndef G_DISABLE_DEPRECATED
  83. #define G_TYPE_DESKTOP_APP_INFO_LOOKUP (g_desktop_app_info_lookup_get_type ())
  84. #define G_DESKTOP_APP_INFO_LOOKUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP, GDesktopAppInfoLookup))
  85. #define G_IS_DESKTOP_APP_INFO_LOOKUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP))
  86. #define G_DESKTOP_APP_INFO_LOOKUP_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DESKTOP_APP_INFO_LOOKUP, GDesktopAppInfoLookupIface))
  87. /**
  88. * G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME:
  89. *
  90. * Extension point for default handler to URI association. See
  91. * [Extending GIO][extending-gio].
  92. */
  93. #define G_DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME "gio-desktop-app-info-lookup"
  94. #endif /* G_DISABLE_DEPRECATED */
  95. /**
  96. * GDesktopAppInfoLookupIface:
  97. * @get_default_for_uri_scheme: Virtual method for
  98. * g_desktop_app_info_lookup_get_default_for_uri_scheme().
  99. *
  100. * Interface that is used by backends to associate default
  101. * handlers with URI schemes.
  102. */
  103. typedef struct _GDesktopAppInfoLookup GDesktopAppInfoLookup;
  104. typedef struct _GDesktopAppInfoLookupIface GDesktopAppInfoLookupIface;
  105. struct _GDesktopAppInfoLookupIface
  106. {
  107. GTypeInterface g_iface;
  108. GAppInfo * (* get_default_for_uri_scheme) (GDesktopAppInfoLookup *lookup,
  109. const char *uri_scheme);
  110. };
  111. GLIB_DEPRECATED
  112. GType g_desktop_app_info_lookup_get_type (void) G_GNUC_CONST;
  113. GLIB_DEPRECATED
  114. GAppInfo *g_desktop_app_info_lookup_get_default_for_uri_scheme (GDesktopAppInfoLookup *lookup,
  115. const char *uri_scheme);
  116. /**
  117. * GDesktopAppLaunchCallback:
  118. * @appinfo: a #GDesktopAppInfo
  119. * @pid: Process identifier
  120. * @user_data: User data
  121. *
  122. * During invocation, g_desktop_app_info_launch_uris_as_manager() may
  123. * create one or more child processes. This callback is invoked once
  124. * for each, providing the process ID.
  125. */
  126. typedef void (*GDesktopAppLaunchCallback) (GDesktopAppInfo *appinfo,
  127. GPid pid,
  128. gpointer user_data);
  129. GLIB_AVAILABLE_IN_2_28
  130. gboolean g_desktop_app_info_launch_uris_as_manager (GDesktopAppInfo *appinfo,
  131. GList *uris,
  132. GAppLaunchContext *launch_context,
  133. GSpawnFlags spawn_flags,
  134. GSpawnChildSetupFunc user_setup,
  135. gpointer user_setup_data,
  136. GDesktopAppLaunchCallback pid_callback,
  137. gpointer pid_callback_data,
  138. GError **error);
  139. GLIB_AVAILABLE_IN_2_40
  140. gchar *** g_desktop_app_info_search (const gchar *search_string);
  141. GLIB_AVAILABLE_IN_2_42
  142. GList *g_desktop_app_info_get_implementations (const gchar *interface);
  143. G_END_DECLS
  144. #endif /* __G_DESKTOP_APP_INFO_H__ */