Blame gio/gappinfo.h

Packit ae235b
/* GIO - GLib Input, Output and Streaming Library
Packit ae235b
 *
Packit ae235b
 * Copyright (C) 2006-2007 Red Hat, Inc.
Packit ae235b
 *
Packit ae235b
 * This library is free software; you can redistribute it and/or
Packit ae235b
 * modify it under the terms of the GNU Lesser General Public
Packit ae235b
 * License as published by the Free Software Foundation; either
Packit ae235b
 * version 2.1 of the License, or (at your option) any later version.
Packit ae235b
 *
Packit ae235b
 * This library is distributed in the hope that it will be useful,
Packit ae235b
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit ae235b
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit ae235b
 * Lesser General Public License for more details.
Packit ae235b
 *
Packit ae235b
 * You should have received a copy of the GNU Lesser General
Packit ae235b
 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
Packit ae235b
 *
Packit ae235b
 * Author: Alexander Larsson <alexl@redhat.com>
Packit ae235b
 */
Packit ae235b
Packit ae235b
#ifndef __G_APP_INFO_H__
Packit ae235b
#define __G_APP_INFO_H__
Packit ae235b
Packit ae235b
#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
Packit ae235b
#error "Only <gio/gio.h> can be included directly."
Packit ae235b
#endif
Packit ae235b
Packit ae235b
#include <gio/giotypes.h>
Packit ae235b
Packit ae235b
G_BEGIN_DECLS
Packit ae235b
Packit ae235b
#define G_TYPE_APP_INFO            (g_app_info_get_type ())
Packit ae235b
#define G_APP_INFO(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_APP_INFO, GAppInfo))
Packit ae235b
#define G_IS_APP_INFO(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_APP_INFO))
Packit ae235b
#define G_APP_INFO_GET_IFACE(obj)  (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_APP_INFO, GAppInfoIface))
Packit ae235b
Packit ae235b
#define G_TYPE_APP_LAUNCH_CONTEXT         (g_app_launch_context_get_type ())
Packit ae235b
#define G_APP_LAUNCH_CONTEXT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContext))
Packit ae235b
#define G_APP_LAUNCH_CONTEXT_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContextClass))
Packit ae235b
#define G_IS_APP_LAUNCH_CONTEXT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_APP_LAUNCH_CONTEXT))
Packit ae235b
#define G_IS_APP_LAUNCH_CONTEXT_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_APP_LAUNCH_CONTEXT))
Packit ae235b
#define G_APP_LAUNCH_CONTEXT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_APP_LAUNCH_CONTEXT, GAppLaunchContextClass))
Packit ae235b
Packit ae235b
typedef struct _GAppLaunchContextClass   GAppLaunchContextClass;
Packit ae235b
typedef struct _GAppLaunchContextPrivate GAppLaunchContextPrivate;
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * GAppInfo:
Packit ae235b
 *
Packit ae235b
 * Information about an installed application and methods to launch
Packit ae235b
 * it (with file arguments).
Packit ae235b
 */
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * GAppInfoIface:
Packit ae235b
 * @g_iface: The parent interface.
Packit ae235b
 * @dup: Copies a #GAppInfo.
Packit ae235b
 * @equal: Checks two #GAppInfos for equality.
Packit ae235b
 * @get_id: Gets a string identifier for a #GAppInfo.
Packit ae235b
 * @get_name: Gets the name of the application for a #GAppInfo.
Packit ae235b
 * @get_description: Gets a short description for the application described by the #GAppInfo.
Packit ae235b
 * @get_executable: Gets the executable name for the #GAppInfo.
Packit ae235b
 * @get_icon: Gets the #GIcon for the #GAppInfo.
Packit ae235b
 * @launch: Launches an application specified by the #GAppInfo.
Packit ae235b
 * @supports_uris: Indicates whether the application specified supports launching URIs.
Packit ae235b
 * @supports_files: Indicates whether the application specified accepts filename arguments.
Packit ae235b
 * @launch_uris: Launches an application with a list of URIs.
Packit ae235b
 * @should_show: Returns whether an application should be shown (e.g. when getting a list of installed applications).
Packit ae235b
 * [FreeDesktop.Org Startup Notification Specification](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt).
Packit ae235b
 * @set_as_default_for_type: Sets an application as default for a given content type.
Packit ae235b
 * @set_as_default_for_extension: Sets an application as default for a given file extension.
Packit ae235b
 * @add_supports_type: Adds to the #GAppInfo information about supported file types.
Packit ae235b
 * @can_remove_supports_type: Checks for support for removing supported file types from a #GAppInfo.
Packit ae235b
 * @remove_supports_type: Removes a supported application type from a #GAppInfo.
Packit ae235b
 * @can_delete: Checks if a #GAppInfo can be deleted. Since 2.20
Packit ae235b
 * @do_delete: Deletes a #GAppInfo. Since 2.20
Packit ae235b
 * @get_commandline: Gets the commandline for the #GAppInfo. Since 2.20
Packit ae235b
 * @get_display_name: Gets the display name for the #GAppInfo. Since 2.24
Packit ae235b
 * @set_as_last_used_for_type: Sets the application as the last used. See g_app_info_set_as_last_used_for_type().
Packit ae235b
 * @get_supported_types: Retrieves the list of content types that @app_info claims to support.
Packit ae235b
 *
Packit ae235b
 * Application Information interface, for operating system portability.
Packit ae235b
 */
Packit ae235b
typedef struct _GAppInfoIface    GAppInfoIface;
Packit ae235b
Packit ae235b
struct _GAppInfoIface
Packit ae235b
{
Packit ae235b
  GTypeInterface g_iface;
Packit ae235b
Packit ae235b
  /* Virtual Table */
Packit ae235b
Packit ae235b
  GAppInfo *   (* dup)                          (GAppInfo           *appinfo);
Packit ae235b
  gboolean     (* equal)                        (GAppInfo           *appinfo1,
Packit ae235b
                                                 GAppInfo           *appinfo2);
Packit ae235b
  const char * (* get_id)                       (GAppInfo           *appinfo);
Packit ae235b
  const char * (* get_name)                     (GAppInfo           *appinfo);
Packit ae235b
  const char * (* get_description)              (GAppInfo           *appinfo);
Packit ae235b
  const char * (* get_executable)               (GAppInfo           *appinfo);
Packit ae235b
  GIcon *      (* get_icon)                     (GAppInfo           *appinfo);
Packit ae235b
  gboolean     (* launch)                       (GAppInfo           *appinfo,
Packit ae235b
                                                 GList              *files,
Packit ae235b
                                                 GAppLaunchContext  *context,
Packit ae235b
                                                 GError            **error);
Packit ae235b
  gboolean     (* supports_uris)                (GAppInfo           *appinfo);
Packit ae235b
  gboolean     (* supports_files)               (GAppInfo           *appinfo);
Packit ae235b
  gboolean     (* launch_uris)                  (GAppInfo           *appinfo,
Packit ae235b
                                                 GList              *uris,
Packit ae235b
                                                 GAppLaunchContext  *context,
Packit ae235b
                                                 GError            **error);
Packit ae235b
  gboolean     (* should_show)                  (GAppInfo           *appinfo);
Packit ae235b
Packit ae235b
  /* For changing associations */
Packit ae235b
  gboolean     (* set_as_default_for_type)      (GAppInfo           *appinfo,
Packit ae235b
                                                 const char         *content_type,
Packit ae235b
                                                 GError            **error);
Packit ae235b
  gboolean     (* set_as_default_for_extension) (GAppInfo           *appinfo,
Packit ae235b
                                                 const char         *extension,
Packit ae235b
                                                 GError            **error);
Packit ae235b
  gboolean     (* add_supports_type)            (GAppInfo           *appinfo,
Packit ae235b
                                                 const char         *content_type,
Packit ae235b
                                                 GError            **error);
Packit ae235b
  gboolean     (* can_remove_supports_type)     (GAppInfo           *appinfo);
Packit ae235b
  gboolean     (* remove_supports_type)         (GAppInfo           *appinfo,
Packit ae235b
                                                 const char         *content_type,
Packit ae235b
                                                 GError            **error);
Packit ae235b
  gboolean     (* can_delete)                   (GAppInfo           *appinfo);
Packit ae235b
  gboolean     (* do_delete)                    (GAppInfo           *appinfo);
Packit ae235b
  const char * (* get_commandline)              (GAppInfo           *appinfo);
Packit ae235b
  const char * (* get_display_name)             (GAppInfo           *appinfo);
Packit ae235b
  gboolean     (* set_as_last_used_for_type)    (GAppInfo           *appinfo,
Packit ae235b
                                                 const char         *content_type,
Packit ae235b
                                                 GError            **error);
Packit ae235b
  const char ** (* get_supported_types)         (GAppInfo           *appinfo);
Packit ae235b
};
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType       g_app_info_get_type                     (void) G_GNUC_CONST;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GAppInfo *  g_app_info_create_from_commandline      (const char           *commandline,
Packit ae235b
                                                     const char           *application_name,
Packit ae235b
                                                     GAppInfoCreateFlags   flags,
Packit ae235b
                                                     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GAppInfo *  g_app_info_dup                          (GAppInfo             *appinfo);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean    g_app_info_equal                        (GAppInfo             *appinfo1,
Packit ae235b
                                                     GAppInfo             *appinfo2);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
const char *g_app_info_get_id                       (GAppInfo             *appinfo);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
const char *g_app_info_get_name                     (GAppInfo             *appinfo);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
const char *g_app_info_get_display_name             (GAppInfo             *appinfo);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
const char *g_app_info_get_description              (GAppInfo             *appinfo);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
const char *g_app_info_get_executable               (GAppInfo             *appinfo);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
const char *g_app_info_get_commandline              (GAppInfo             *appinfo);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GIcon *     g_app_info_get_icon                     (GAppInfo             *appinfo);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean    g_app_info_launch                       (GAppInfo             *appinfo,
Packit ae235b
                                                     GList                *files,
Packit ae235b
                                                     GAppLaunchContext    *context,
Packit ae235b
                                                     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean    g_app_info_supports_uris                (GAppInfo             *appinfo);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean    g_app_info_supports_files               (GAppInfo             *appinfo);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean    g_app_info_launch_uris                  (GAppInfo             *appinfo,
Packit ae235b
                                                     GList                *uris,
Packit ae235b
                                                     GAppLaunchContext    *context,
Packit ae235b
                                                     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean    g_app_info_should_show                  (GAppInfo             *appinfo);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean    g_app_info_set_as_default_for_type      (GAppInfo             *appinfo,
Packit ae235b
                                                     const char           *content_type,
Packit ae235b
                                                     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean    g_app_info_set_as_default_for_extension (GAppInfo             *appinfo,
Packit ae235b
                                                     const char           *extension,
Packit ae235b
                                                     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean    g_app_info_add_supports_type            (GAppInfo             *appinfo,
Packit ae235b
                                                     const char           *content_type,
Packit ae235b
                                                     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean    g_app_info_can_remove_supports_type     (GAppInfo             *appinfo);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean    g_app_info_remove_supports_type         (GAppInfo             *appinfo,
Packit ae235b
                                                     const char           *content_type,
Packit ae235b
                                                     GError              **error);
Packit ae235b
GLIB_AVAILABLE_IN_2_34
Packit ae235b
const char **g_app_info_get_supported_types         (GAppInfo             *appinfo);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean    g_app_info_can_delete                   (GAppInfo   *appinfo);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean    g_app_info_delete                       (GAppInfo   *appinfo);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean    g_app_info_set_as_last_used_for_type    (GAppInfo             *appinfo,
Packit ae235b
                                                     const char           *content_type,
Packit ae235b
                                                     GError              **error);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GList *   g_app_info_get_all                     (void);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GList *   g_app_info_get_all_for_type            (const char  *content_type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GList *   g_app_info_get_recommended_for_type    (const gchar *content_type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GList *   g_app_info_get_fallback_for_type       (const gchar *content_type);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void      g_app_info_reset_type_associations     (const char  *content_type);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GAppInfo *g_app_info_get_default_for_type        (const char  *content_type,
Packit ae235b
                                                  gboolean     must_support_uris);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GAppInfo *g_app_info_get_default_for_uri_scheme  (const char  *uri_scheme);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
gboolean  g_app_info_launch_default_for_uri      (const char              *uri,
Packit ae235b
                                                  GAppLaunchContext       *context,
Packit ae235b
                                                  GError                 **error);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_2_50
Packit ae235b
void      g_app_info_launch_default_for_uri_async  (const char           *uri,
Packit ae235b
                                                    GAppLaunchContext    *context,
Packit ae235b
                                                    GCancellable         *cancellable,
Packit ae235b
                                                    GAsyncReadyCallback   callback,
Packit ae235b
                                                    gpointer              user_data);
Packit ae235b
GLIB_AVAILABLE_IN_2_50
Packit ae235b
gboolean  g_app_info_launch_default_for_uri_finish (GAsyncResult         *result,
Packit ae235b
                                                    GError              **error);
Packit ae235b
Packit ae235b
Packit ae235b
/**
Packit ae235b
 * GAppLaunchContext:
Packit ae235b
 *
Packit ae235b
 * Integrating the launch with the launching application. This is used to
Packit ae235b
 * handle for instance startup notification and launching the new application
Packit ae235b
 * on the same screen as the launching window.
Packit ae235b
 */
Packit ae235b
struct _GAppLaunchContext
Packit ae235b
{
Packit ae235b
  GObject parent_instance;
Packit ae235b
Packit ae235b
  /*< private >*/
Packit ae235b
  GAppLaunchContextPrivate *priv;
Packit ae235b
};
Packit ae235b
Packit ae235b
struct _GAppLaunchContextClass
Packit ae235b
{
Packit ae235b
  GObjectClass parent_class;
Packit ae235b
Packit ae235b
  char * (* get_display)           (GAppLaunchContext *context,
Packit ae235b
                                    GAppInfo          *info,
Packit ae235b
                                    GList             *files);
Packit ae235b
  char * (* get_startup_notify_id) (GAppLaunchContext *context,
Packit ae235b
                                    GAppInfo          *info,
Packit ae235b
                                    GList             *files);
Packit ae235b
  void   (* launch_failed)         (GAppLaunchContext *context,
Packit ae235b
                                    const char        *startup_notify_id);
Packit ae235b
  void   (* launched)              (GAppLaunchContext *context,
Packit ae235b
                                    GAppInfo          *info,
Packit ae235b
                                    GVariant          *platform_data);
Packit ae235b
Packit ae235b
  /* Padding for future expansion */
Packit ae235b
  void (*_g_reserved1) (void);
Packit ae235b
  void (*_g_reserved2) (void);
Packit ae235b
  void (*_g_reserved3) (void);
Packit ae235b
  void (*_g_reserved4) (void);
Packit ae235b
};
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GType              g_app_launch_context_get_type              (void) G_GNUC_CONST;
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
GAppLaunchContext *g_app_launch_context_new                   (void);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_2_32
Packit ae235b
void               g_app_launch_context_setenv                (GAppLaunchContext *context,
Packit ae235b
                                                               const char        *variable,
Packit ae235b
                                                               const char        *value);
Packit ae235b
GLIB_AVAILABLE_IN_2_32
Packit ae235b
void               g_app_launch_context_unsetenv              (GAppLaunchContext *context,
Packit ae235b
                                                               const char        *variable);
Packit ae235b
GLIB_AVAILABLE_IN_2_32
Packit ae235b
char **            g_app_launch_context_get_environment       (GAppLaunchContext *context);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
char *             g_app_launch_context_get_display           (GAppLaunchContext *context,
Packit ae235b
                                                               GAppInfo          *info,
Packit ae235b
                                                               GList             *files);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
char *             g_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
Packit ae235b
                                                               GAppInfo          *info,
Packit ae235b
                                                               GList             *files);
Packit ae235b
GLIB_AVAILABLE_IN_ALL
Packit ae235b
void               g_app_launch_context_launch_failed         (GAppLaunchContext *context,
Packit ae235b
                                                               const char *       startup_notify_id);
Packit ae235b
Packit ae235b
#define G_TYPE_APP_INFO_MONITOR                             (g_app_info_monitor_get_type ())
Packit ae235b
#define G_APP_INFO_MONITOR(inst)                            (G_TYPE_CHECK_INSTANCE_CAST ((inst),                     \
Packit ae235b
                                                             G_TYPE_APP_INFO_MONITOR, GAppInfoMonitor))
Packit ae235b
#define G_IS_APP_INFO_MONITOR(inst)                         (G_TYPE_CHECK_INSTANCE_TYPE ((inst),                     \
Packit ae235b
                                                             G_TYPE_APP_INFO_MONITOR))
Packit ae235b
Packit ae235b
typedef struct _GAppInfoMonitor                             GAppInfoMonitor;
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_2_40
Packit ae235b
GType                   g_app_info_monitor_get_type                     (void);
Packit ae235b
Packit ae235b
GLIB_AVAILABLE_IN_2_40
Packit ae235b
GAppInfoMonitor *       g_app_info_monitor_get                          (void);
Packit ae235b
Packit ae235b
G_END_DECLS
Packit ae235b
Packit ae235b
#endif /* __G_APP_INFO_H__ */