diff --git a/gio/gappinfo.c b/gio/gappinfo.c index 6b0092502..d60ea1760 100644 --- a/gio/gappinfo.c +++ b/gio/gappinfo.c @@ -25,6 +25,7 @@ #include "gcontextspecificgroup.h" #include "gtask.h" #include "gcancellable.h" +#include "gicon.h" #include "glibintl.h" #include "gmarshal-internal.h" @@ -108,8 +109,198 @@ G_DEFINE_INTERFACE (GAppInfo, g_app_info, G_TYPE_OBJECT) static void g_app_info_default_init (GAppInfoInterface *iface) { -} + /** + * GAppInfo:id: (nullable) + * + * The ID of an application -- a string that identifies the application. + * + * The exact format of the ID is platform dependent. For instance, + * on Unix this is the desktop file ID from the xdg menu specification. + * + * May be %NULL, depending on how the GAppInfo has been constructed. + * + * Since: 2.66 + */ + g_object_interface_install_property (iface, + g_param_spec_string ("id", "ID", "ID", + NULL, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + /** + * GAppInfo:name: + * + * The name of the application. + * + * In #GAppInfos created from [desktop files](https://specifications.freedesktop.org/desktop-entry-spec/latest/), + * this is the value of the `Name` key. + * + * Since: 2.66 + */ + g_object_interface_install_property (iface, + g_param_spec_string ("name", "Name", "Name", + NULL, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /** + * GAppInfo:display-name: (nullable) + * + * The display name of the application. + * + * This string is meant to be displayed to the user; it is often more + * descriptive than #GAppInfo:name. + * + * In #GAppInfos created from [desktop files](https://specifications.freedesktop.org/desktop-entry-spec/latest/), + * this is the value of the `X-GNOME-FullName` key, falling back to the `Name` key. + * + * May be %NULL, depending on how the #GAppInfo has been constructed. + * + * Since: 2.66 + */ + g_object_interface_install_property (iface, + g_param_spec_string ("display-name", "Display Name", "Display Name", + NULL, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /** + * GAppInfo:description: (nullable) + * + * A human-readable description of the application. + * + * In #GAppInfos created from [desktop files](https://specifications.freedesktop.org/desktop-entry-spec/latest/), + * this is the value of the `Comment` key. + * + * May be %NULL, depending on how the #GAppInfo has been constructed. + * + * Since: 2.66 + */ + g_object_interface_install_property (iface, + g_param_spec_string ("description", "Description", "Description", + NULL, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /** + * GAppInfo:executable: (nullable) + * + * The executable's name for the application. + * + * In #GAppInfos created from [desktop files](https://specifications.freedesktop.org/desktop-entry-spec/latest/), + * this is the first word of the `Exec` key. + * + * May be %NULL, depending on how the #GAppInfo has been constructed. + * + * Since: 2.66 + */ + g_object_interface_install_property (iface, + g_param_spec_string ("executable", "Executable", "Executable", + NULL, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /** + * GAppInfo:commandline: (nullable) + * + * The commandline with which the application will be launched. + * + * In #GAppInfos created from [desktop files](https://specifications.freedesktop.org/desktop-entry-spec/latest/), + * this is the value of the `Exec` key. + * + * May be %NULL, depending on how the #GAppInfo has been constructed. + * + * Since: 2.66 + */ + g_object_interface_install_property (iface, + g_param_spec_string ("commandline", "Commandline", "Commandline", + NULL, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /** + * GAppInfo:icon: (nullable) + * + * The icon for the application. + * + * May be %NULL, depending on how the #GAppInfo has been constructed. + * + * Since: 2.66 + */ + g_object_interface_install_property (iface, + g_param_spec_object ("icon", "Icon", "Icon", + G_TYPE_ICON, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /** + * GAppInfo:supports-uris: + * + * %TRUE if the application supports reading files and directories + * from URIs when launched. See g_app_info_launch_uris(). + * + * Since: 2.66 + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("supports-uris", "Supports URIs", "Supports URIs", + FALSE, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /** + * GAppInfo:supports-files: + * + * %TRUE if the application supports files as arguments when launched. + * See g_app_info_launch_uris(). + * + * Since: 2.66 + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("supports-files", "Supports files", "Supports files", + FALSE, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /** + * GAppInfo:should-show: + * + * %TRUE if the application should be shown in menus that list + * available applications. + * + * In #GAppInfos created from [desktop files](https://specifications.freedesktop.org/desktop-entry-spec/latest/), + * this is the (inverted) value of the `NoDisplay` key. + * + * Since: 2.66 + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("should-show", "Should show", "Should show", + FALSE, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /** + * GAppInfo:supported-types: + * + * The list of content types that the application claims to support. + * Note that this property does not take into account associations + * added with g_app_info_add_supports_type(), but only those exported + * directly by the application. + * + * In #GAppInfos created from [desktop files](https://specifications.freedesktop.org/desktop-entry-spec/latest/), + * this is the value of the `MimeType` key. + * + * May be %NULL, depending on how the #GAppInfo has been constructed. + * + * Since: 2.66 + */ + g_object_interface_install_property (iface, + g_param_spec_boxed ("supported-types", "Supported types", "Supported types", + G_TYPE_STRV, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + + /** + * GAppInfo:can-delete: + * + * %TRUE if it makes sense to call g_app_info_delete() for this + * #GAppInfo. + * + * Since: 2.66 + */ + g_object_interface_install_property (iface, + g_param_spec_boolean ("can-delete", "Can delete", "Can delete", + FALSE, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); +} /** * g_app_info_dup: diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c index ed98570fe..aa52af8cd 100644 --- a/gio/gdesktopappinfo.c +++ b/gio/gdesktopappinfo.c @@ -81,7 +81,19 @@ enum { PROP_0, - PROP_FILENAME + PROP_FILENAME, + PROP_ID, + PROP_NAME, + PROP_DISPLAY_NAME, + PROP_DESCRIPTION, + PROP_EXECUTABLE, + PROP_COMMANDLINE, + PROP_ICON, + PROP_SUPPORTS_URIS, + PROP_SUPPORTS_FILES, + PROP_SHOULD_SHOW, + PROP_SUPPORTED_TYPES, + PROP_CAN_DELETE, }; static void g_desktop_app_info_iface_init (GAppInfoIface *iface); @@ -1657,12 +1669,62 @@ g_desktop_app_info_get_property (GObject *object, GParamSpec *pspec) { GDesktopAppInfo *self = G_DESKTOP_APP_INFO (object); + GAppInfo *app_info = G_APP_INFO (self); switch (prop_id) { case PROP_FILENAME: g_value_set_string (value, self->filename); break; + + case PROP_ID: + g_value_set_string (value, g_app_info_get_id (app_info)); + break; + + case PROP_NAME: + g_value_set_string (value, g_app_info_get_name (app_info)); + break; + + case PROP_DISPLAY_NAME: + g_value_set_string (value, g_app_info_get_display_name (app_info)); + break; + + case PROP_DESCRIPTION: + g_value_set_string (value, g_app_info_get_description (app_info)); + break; + + case PROP_EXECUTABLE: + g_value_set_string (value, g_app_info_get_executable (app_info)); + break; + + case PROP_COMMANDLINE: + g_value_set_string (value, g_app_info_get_commandline (app_info)); + break; + + case PROP_ICON: + g_value_set_object (value, g_app_info_get_icon (app_info)); + break; + + case PROP_SUPPORTS_URIS: + g_value_set_boolean (value, g_app_info_supports_uris (app_info)); + break; + + case PROP_SUPPORTS_FILES: + g_value_set_boolean (value, g_app_info_supports_uris (app_info)); + break; + + case PROP_SHOULD_SHOW: + g_value_set_boolean (value, g_app_info_should_show (app_info)); + break; + + case PROP_SUPPORTED_TYPES: + g_value_set_boxed (value, g_app_info_get_supported_types (app_info)); + break; + + case PROP_CAN_DELETE: + g_value_set_boolean (value, g_app_info_can_delete (app_info)); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1687,6 +1749,19 @@ g_desktop_app_info_class_init (GDesktopAppInfoClass *klass) PROP_FILENAME, g_param_spec_string ("filename", "Filename", "", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_override_property (gobject_class, PROP_ID, "id"); + g_object_class_override_property (gobject_class, PROP_NAME, "name"); + g_object_class_override_property (gobject_class, PROP_DISPLAY_NAME, "display-name"); + g_object_class_override_property (gobject_class, PROP_DESCRIPTION, "description"); + g_object_class_override_property (gobject_class, PROP_EXECUTABLE, "executable"); + g_object_class_override_property (gobject_class, PROP_COMMANDLINE, "commandline"); + g_object_class_override_property (gobject_class, PROP_ICON, "icon"); + g_object_class_override_property (gobject_class, PROP_SUPPORTS_URIS, "supports-uris"); + g_object_class_override_property (gobject_class, PROP_SUPPORTS_FILES, "supports-files"); + g_object_class_override_property (gobject_class, PROP_SHOULD_SHOW, "should-show"); + g_object_class_override_property (gobject_class, PROP_SUPPORTED_TYPES, "supported-types"); + g_object_class_override_property (gobject_class, PROP_CAN_DELETE, "can-delete"); } static void