appinfo: add g_app_info_set_as_last_used_for_type()

This commit also changes (maintaining compatibility) the way
user-specified default applications are stored (as in, those for which
g_app_info_set_as_default_for_type() has been called.

We now store the default application for a content type in a new group
in the mimeapps.list keyfile, and "Added Associations" tracks only the
applications that have been added by the user, following a
most-recently-used first order.

This is useful in GtkAppChooser-like widgets to pre-select the last used
application when constructing a widget.

https://bugzilla.gnome.org/show_bug.cgi?id=636311
This commit is contained in:
Cosimo Cecchi
2010-12-15 17:56:22 +01:00
parent 01ba7bd8e8
commit 678bcad92c
6 changed files with 314 additions and 64 deletions

View File

@@ -128,6 +128,9 @@ struct _GAppInfoIface
gboolean (* do_delete) (GAppInfo *appinfo);
const char * (* get_commandline) (GAppInfo *appinfo);
const char * (* get_display_name) (GAppInfo *appinfo);
gboolean (* set_as_last_used_for_type) (GAppInfo *appinfo,
const char *content_type,
GError **error);
};
GType g_app_info_get_type (void) G_GNUC_CONST;
@@ -173,6 +176,10 @@ gboolean g_app_info_remove_supports_type (GAppInfo *appin
gboolean g_app_info_can_delete (GAppInfo *appinfo);
gboolean g_app_info_delete (GAppInfo *appinfo);
gboolean g_app_info_set_as_last_used_for_type (GAppInfo *appinfo,
const char *content_type,
GError **error);
GList * g_app_info_get_all (void);
GList * g_app_info_get_all_for_type (const char *content_type);
GList * g_app_info_get_recommended_for_type (const gchar *content_type);