Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:54

0001 /* GIO - GLib Input, Output and Streaming Library
0002  *
0003  * Copyright (C) 2006-2007 Red Hat, Inc.
0004  *
0005  * SPDX-License-Identifier: LGPL-2.1-or-later
0006  *
0007  * This library is free software; you can redistribute it and/or
0008  * modify it under the terms of the GNU Lesser General Public
0009  * License as published by the Free Software Foundation; either
0010  * version 2.1 of the License, or (at your option) any later version.
0011  *
0012  * This library is distributed in the hope that it will be useful,
0013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0015  * Lesser General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Lesser General
0018  * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
0019  *
0020  * Author: Alexander Larsson <alexl@redhat.com>
0021  */
0022 
0023 #ifndef __G_APP_INFO_H__
0024 #define __G_APP_INFO_H__
0025 
0026 #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
0027 #error "Only <gio/gio.h> can be included directly."
0028 #endif
0029 
0030 #include <gio/giotypes.h>
0031 
0032 G_BEGIN_DECLS
0033 
0034 #define G_TYPE_APP_INFO            (g_app_info_get_type ())
0035 #define G_APP_INFO(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_APP_INFO, GAppInfo))
0036 #define G_IS_APP_INFO(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_APP_INFO))
0037 #define G_APP_INFO_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_APP_INFO, GAppInfoIface))
0038 
0039 #define G_TYPE_APP_LAUNCH_CONTEXT         (g_app_launch_context_get_type ())
0040 #define G_APP_LAUNCH_CONTEXT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContext))
0041 #define G_APP_LAUNCH_CONTEXT_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContextClass))
0042 #define G_IS_APP_LAUNCH_CONTEXT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_APP_LAUNCH_CONTEXT))
0043 #define G_IS_APP_LAUNCH_CONTEXT_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_APP_LAUNCH_CONTEXT))
0044 #define G_APP_LAUNCH_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContextClass))
0045 
0046 typedef struct _GAppLaunchContextClass   GAppLaunchContextClass;
0047 typedef struct _GAppLaunchContextPrivate GAppLaunchContextPrivate;
0048 
0049 /**
0050  * GAppInfoIface:
0051  * @g_iface: The parent interface.
0052  * @dup: Copies a [iface@Gio.AppInfo].
0053  * @equal: Checks two [iface@Gio.AppInfo]s for equality.
0054  * @get_id: Gets a string identifier for a [iface@Gio.AppInfo].
0055  * @get_name: Gets the name of the application for a [iface@Gio.AppInfo].
0056  * @get_description: Gets a short description for the application described by
0057  *   the [iface@Gio.AppInfo].
0058  * @get_executable: Gets the executable name for the [iface@Gio.AppInfo].
0059  * @get_icon: Gets the [iface@Gio.Icon] for the [iface@Gio.AppInfo].
0060  * @launch: Launches an application specified by the [iface@Gio.AppInfo].
0061  * @supports_uris: Indicates whether the application specified supports
0062  *   launching URIs.
0063  * @supports_files: Indicates whether the application specified accepts
0064  *   filename arguments.
0065  * @launch_uris: Launches an application with a list of URIs.
0066  * @should_show: Returns whether an application should be shown (e.g. when
0067  *   getting a list of installed applications).
0068  *   [FreeDesktop.Org Startup Notification Specification](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt).
0069  * @set_as_default_for_type: Sets an application as default for a given content
0070  *   type.
0071  * @set_as_default_for_extension: Sets an application as default for a given
0072  *   file extension.
0073  * @add_supports_type: Adds to the [iface@Gio.AppInfo] information about
0074  *   supported file types.
0075  * @can_remove_supports_type: Checks for support for removing supported file
0076  *   types from a [iface@Gio.AppInfo].
0077  * @remove_supports_type: Removes a supported application type from a
0078  *   [iface@Gio.AppInfo].
0079  * @can_delete: Checks if a [iface@Gio.AppInfo] can be deleted. (Since 2.20)
0080  * @do_delete: Deletes a [iface@Gio.AppInfo]. (Since 2.20)
0081  * @get_commandline: Gets the commandline for the [iface@Gio.AppInfo].
0082  *   (Since 2.20)
0083  * @get_display_name: Gets the display name for the [iface@Gio.AppInfo].
0084  *   (Since 2.24)
0085  * @set_as_last_used_for_type: Sets the application as the last used. See
0086  *   [method@Gio.AppInfo.set_as_last_used_for_type].
0087  * @get_supported_types: Retrieves the list of content types that @app_info
0088  *   claims to support.
0089  * @launch_uris_async: Asynchronously launches an application with a list of
0090  *   URIs. (Since: 2.60)
0091  * @launch_uris_finish: Finishes an operation started with @launch_uris_async.
0092  *   (Since: 2.60)
0093 
0094  * Application Information interface, for operating system portability.
0095  */
0096 typedef struct _GAppInfoIface    GAppInfoIface;
0097 
0098 struct _GAppInfoIface
0099 {
0100   GTypeInterface g_iface;
0101 
0102   /* Virtual Table */
0103 
0104   GAppInfo *   (* dup)                          (GAppInfo           *appinfo);
0105   gboolean     (* equal)                        (GAppInfo           *appinfo1,
0106                                                  GAppInfo           *appinfo2);
0107   const char * (* get_id)                       (GAppInfo           *appinfo);
0108   const char * (* get_name)                     (GAppInfo           *appinfo);
0109   const char * (* get_description)              (GAppInfo           *appinfo);
0110   const char * (* get_executable)               (GAppInfo           *appinfo);
0111   GIcon *      (* get_icon)                     (GAppInfo           *appinfo);
0112   gboolean     (* launch)                       (GAppInfo           *appinfo,
0113                                                  GList              *files,
0114                                                  GAppLaunchContext  *context,
0115                                                  GError            **error);
0116   gboolean     (* supports_uris)                (GAppInfo           *appinfo);
0117   gboolean     (* supports_files)               (GAppInfo           *appinfo);
0118   gboolean     (* launch_uris)                  (GAppInfo           *appinfo,
0119                                                  GList              *uris,
0120                                                  GAppLaunchContext  *context,
0121                                                  GError            **error);
0122   gboolean     (* should_show)                  (GAppInfo           *appinfo);
0123 
0124   /* For changing associations */
0125   gboolean     (* set_as_default_for_type)      (GAppInfo           *appinfo,
0126                                                  const char         *content_type,
0127                                                  GError            **error);
0128   gboolean     (* set_as_default_for_extension) (GAppInfo           *appinfo,
0129                                                  const char         *extension,
0130                                                  GError            **error);
0131   gboolean     (* add_supports_type)            (GAppInfo           *appinfo,
0132                                                  const char         *content_type,
0133                                                  GError            **error);
0134   gboolean     (* can_remove_supports_type)     (GAppInfo           *appinfo);
0135   gboolean     (* remove_supports_type)         (GAppInfo           *appinfo,
0136                                                  const char         *content_type,
0137                                                  GError            **error);
0138   gboolean     (* can_delete)                   (GAppInfo           *appinfo);
0139   gboolean     (* do_delete)                    (GAppInfo           *appinfo);
0140   const char * (* get_commandline)              (GAppInfo           *appinfo);
0141   const char * (* get_display_name)             (GAppInfo           *appinfo);
0142   gboolean     (* set_as_last_used_for_type)    (GAppInfo           *appinfo,
0143                                                  const char         *content_type,
0144                                                  GError            **error);
0145   const char ** (* get_supported_types)         (GAppInfo           *appinfo);
0146   void         (* launch_uris_async)            (GAppInfo           *appinfo,
0147                                                  GList              *uris,
0148                                                  GAppLaunchContext  *context,
0149                                                  GCancellable       *cancellable,
0150                                                  GAsyncReadyCallback callback,
0151                                                  gpointer            user_data);
0152   gboolean     (* launch_uris_finish)           (GAppInfo           *appinfo,
0153                                                  GAsyncResult       *result,
0154                                                  GError            **error);
0155 };
0156 
0157 GIO_AVAILABLE_IN_ALL
0158 GType       g_app_info_get_type                     (void) G_GNUC_CONST;
0159 GIO_AVAILABLE_IN_ALL
0160 GAppInfo *  g_app_info_create_from_commandline      (const char           *commandline,
0161                                                      const char           *application_name,
0162                                                      GAppInfoCreateFlags   flags,
0163                                                      GError              **error);
0164 GIO_AVAILABLE_IN_ALL
0165 GAppInfo *  g_app_info_dup                          (GAppInfo             *appinfo);
0166 GIO_AVAILABLE_IN_ALL
0167 gboolean    g_app_info_equal                        (GAppInfo             *appinfo1,
0168                                                      GAppInfo             *appinfo2);
0169 GIO_AVAILABLE_IN_ALL
0170 const char *g_app_info_get_id                       (GAppInfo             *appinfo);
0171 GIO_AVAILABLE_IN_ALL
0172 const char *g_app_info_get_name                     (GAppInfo             *appinfo);
0173 GIO_AVAILABLE_IN_ALL
0174 const char *g_app_info_get_display_name             (GAppInfo             *appinfo);
0175 GIO_AVAILABLE_IN_ALL
0176 const char *g_app_info_get_description              (GAppInfo             *appinfo);
0177 GIO_AVAILABLE_IN_ALL
0178 const char *g_app_info_get_executable               (GAppInfo             *appinfo);
0179 GIO_AVAILABLE_IN_ALL
0180 const char *g_app_info_get_commandline              (GAppInfo             *appinfo);
0181 GIO_AVAILABLE_IN_ALL
0182 GIcon *     g_app_info_get_icon                     (GAppInfo             *appinfo);
0183 GIO_AVAILABLE_IN_ALL
0184 gboolean    g_app_info_launch                       (GAppInfo             *appinfo,
0185                                                      GList                *files,
0186                                                      GAppLaunchContext    *context,
0187                                                      GError              **error);
0188 GIO_AVAILABLE_IN_ALL
0189 gboolean    g_app_info_supports_uris                (GAppInfo             *appinfo);
0190 GIO_AVAILABLE_IN_ALL
0191 gboolean    g_app_info_supports_files               (GAppInfo             *appinfo);
0192 GIO_AVAILABLE_IN_ALL
0193 gboolean    g_app_info_launch_uris                  (GAppInfo             *appinfo,
0194                                                      GList                *uris,
0195                                                      GAppLaunchContext    *context,
0196                                                      GError              **error);
0197 GIO_AVAILABLE_IN_2_60
0198 void        g_app_info_launch_uris_async            (GAppInfo             *appinfo,
0199                                                      GList                *uris,
0200                                                      GAppLaunchContext    *context,
0201                                                      GCancellable         *cancellable,
0202                                                      GAsyncReadyCallback   callback,
0203                                                      gpointer              user_data);
0204 GIO_AVAILABLE_IN_2_60
0205 gboolean    g_app_info_launch_uris_finish           (GAppInfo             *appinfo,
0206                                                      GAsyncResult         *result,
0207                                                      GError              **error);
0208 
0209 GIO_AVAILABLE_IN_ALL
0210 gboolean    g_app_info_should_show                  (GAppInfo             *appinfo);
0211 
0212 GIO_AVAILABLE_IN_ALL
0213 gboolean    g_app_info_set_as_default_for_type      (GAppInfo             *appinfo,
0214                                                      const char           *content_type,
0215                                                      GError              **error);
0216 GIO_AVAILABLE_IN_ALL
0217 gboolean    g_app_info_set_as_default_for_extension (GAppInfo             *appinfo,
0218                                                      const char           *extension,
0219                                                      GError              **error);
0220 GIO_AVAILABLE_IN_ALL
0221 gboolean    g_app_info_add_supports_type            (GAppInfo             *appinfo,
0222                                                      const char           *content_type,
0223                                                      GError              **error);
0224 GIO_AVAILABLE_IN_ALL
0225 gboolean    g_app_info_can_remove_supports_type     (GAppInfo             *appinfo);
0226 GIO_AVAILABLE_IN_ALL
0227 gboolean    g_app_info_remove_supports_type         (GAppInfo             *appinfo,
0228                                                      const char           *content_type,
0229                                                      GError              **error);
0230 GIO_AVAILABLE_IN_2_34
0231 const char **g_app_info_get_supported_types         (GAppInfo             *appinfo);
0232 
0233 GIO_AVAILABLE_IN_ALL
0234 gboolean    g_app_info_can_delete                   (GAppInfo   *appinfo);
0235 GIO_AVAILABLE_IN_ALL
0236 gboolean    g_app_info_delete                       (GAppInfo   *appinfo);
0237 
0238 GIO_AVAILABLE_IN_ALL
0239 gboolean    g_app_info_set_as_last_used_for_type    (GAppInfo             *appinfo,
0240                                                      const char           *content_type,
0241                                                      GError              **error);
0242 
0243 GIO_AVAILABLE_IN_ALL
0244 GList *   g_app_info_get_all                     (void);
0245 GIO_AVAILABLE_IN_ALL
0246 GList *   g_app_info_get_all_for_type            (const char  *content_type);
0247 GIO_AVAILABLE_IN_ALL
0248 GList *   g_app_info_get_recommended_for_type    (const gchar *content_type);
0249 GIO_AVAILABLE_IN_ALL
0250 GList *   g_app_info_get_fallback_for_type       (const gchar *content_type);
0251 
0252 GIO_AVAILABLE_IN_ALL
0253 void      g_app_info_reset_type_associations     (const char  *content_type);
0254 GIO_AVAILABLE_IN_ALL
0255 GAppInfo *g_app_info_get_default_for_type        (const char  *content_type,
0256                                                   gboolean     must_support_uris);
0257 GIO_AVAILABLE_IN_2_74
0258 void      g_app_info_get_default_for_type_async  (const char          *content_type,
0259                                                   gboolean             must_support_uris,
0260                                                   GCancellable        *cancellable,
0261                                                   GAsyncReadyCallback  callback,
0262                                                   gpointer             user_data);
0263 GIO_AVAILABLE_IN_2_74
0264 GAppInfo *g_app_info_get_default_for_type_finish (GAsyncResult         *result,
0265                                                   GError              **error);
0266 GIO_AVAILABLE_IN_ALL
0267 GAppInfo *g_app_info_get_default_for_uri_scheme  (const char  *uri_scheme);
0268 
0269 GIO_AVAILABLE_IN_2_74
0270 void      g_app_info_get_default_for_uri_scheme_async (const char          *uri_scheme,
0271                                                        GCancellable        *cancellable,
0272                                                        GAsyncReadyCallback  callback,
0273                                                        gpointer             user_data);
0274 GIO_AVAILABLE_IN_2_74
0275 GAppInfo *g_app_info_get_default_for_uri_scheme_finish (GAsyncResult         *result,
0276                                                         GError              **error);
0277 
0278 GIO_AVAILABLE_IN_ALL
0279 gboolean  g_app_info_launch_default_for_uri      (const char              *uri,
0280                                                   GAppLaunchContext       *context,
0281                                                   GError                 **error);
0282 
0283 GIO_AVAILABLE_IN_2_50
0284 void      g_app_info_launch_default_for_uri_async  (const char           *uri,
0285                                                     GAppLaunchContext    *context,
0286                                                     GCancellable         *cancellable,
0287                                                     GAsyncReadyCallback   callback,
0288                                                     gpointer              user_data);
0289 GIO_AVAILABLE_IN_2_50
0290 gboolean  g_app_info_launch_default_for_uri_finish (GAsyncResult         *result,
0291                                                     GError              **error);
0292 
0293 
0294 /**
0295  * GAppLaunchContext:
0296  *
0297  * Integrating the launch with the launching application. This is used to
0298  * handle for instance startup notification and launching the new application
0299  * on the same screen as the launching window.
0300  */
0301 struct _GAppLaunchContext
0302 {
0303   GObject parent_instance;
0304 
0305   /*< private >*/
0306   GAppLaunchContextPrivate *priv;
0307 };
0308 
0309 struct _GAppLaunchContextClass
0310 {
0311   GObjectClass parent_class;
0312 
0313   char * (* get_display)           (GAppLaunchContext *context,
0314                                     GAppInfo          *info,
0315                                     GList             *files);
0316   char * (* get_startup_notify_id) (GAppLaunchContext *context,
0317                                     GAppInfo          *info,
0318                                     GList             *files);
0319   void   (* launch_failed)         (GAppLaunchContext *context,
0320                                     const char        *startup_notify_id);
0321   void   (* launched)              (GAppLaunchContext *context,
0322                                     GAppInfo          *info,
0323                                     GVariant          *platform_data);
0324   void   (* launch_started)        (GAppLaunchContext *context,
0325                                     GAppInfo          *info,
0326                                     GVariant          *platform_data);
0327 
0328   /* Padding for future expansion */
0329   void (*_g_reserved1) (void);
0330   void (*_g_reserved2) (void);
0331   void (*_g_reserved3) (void);
0332 };
0333 
0334 GIO_AVAILABLE_IN_ALL
0335 GType              g_app_launch_context_get_type              (void) G_GNUC_CONST;
0336 GIO_AVAILABLE_IN_ALL
0337 GAppLaunchContext *g_app_launch_context_new                   (void);
0338 
0339 GIO_AVAILABLE_IN_2_32
0340 void               g_app_launch_context_setenv                (GAppLaunchContext *context,
0341                                                                const char        *variable,
0342                                                                const char        *value);
0343 GIO_AVAILABLE_IN_2_32
0344 void               g_app_launch_context_unsetenv              (GAppLaunchContext *context,
0345                                                                const char        *variable);
0346 GIO_AVAILABLE_IN_2_32
0347 char **            g_app_launch_context_get_environment       (GAppLaunchContext *context);
0348 
0349 GIO_AVAILABLE_IN_ALL
0350 char *             g_app_launch_context_get_display           (GAppLaunchContext *context,
0351                                                                GAppInfo          *info,
0352                                                                GList             *files);
0353 GIO_AVAILABLE_IN_ALL
0354 char *             g_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
0355                                                                GAppInfo          *info,
0356                                                                GList             *files);
0357 GIO_AVAILABLE_IN_ALL
0358 void               g_app_launch_context_launch_failed         (GAppLaunchContext *context,
0359                                                                const char *       startup_notify_id);
0360 
0361 #define G_TYPE_APP_INFO_MONITOR                             (g_app_info_monitor_get_type ())
0362 #define G_APP_INFO_MONITOR(inst)                            (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
0363                                                              G_TYPE_APP_INFO_MONITOR, GAppInfoMonitor))
0364 #define G_IS_APP_INFO_MONITOR(inst)                         (G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
0365                                                              G_TYPE_APP_INFO_MONITOR))
0366 
0367 typedef struct _GAppInfoMonitor                             GAppInfoMonitor;
0368 
0369 GIO_AVAILABLE_IN_2_40
0370 GType                   g_app_info_monitor_get_type                     (void);
0371 
0372 GIO_AVAILABLE_IN_2_40
0373 GAppInfoMonitor *       g_app_info_monitor_get                          (void);
0374 
0375 G_END_DECLS
0376 
0377 #endif /* __G_APP_INFO_H__ */