Install gdesktopappinfo as unix-specific api

svn path=/trunk/; revision=6090
This commit is contained in:
Matthias Clasen 2007-12-10 18:51:21 +00:00
parent 1105ce1193
commit 355d85b171
9 changed files with 60 additions and 18 deletions

View File

@ -1,3 +1,9 @@
2007-12-10 Matthias Clasen <mclasen@redhat.com>
* gio/gio-sections.txt:
* gio/gio-docs.xml:
* gio/gio.types: Add gdesktopappinfo
2007-12-10 Bastien Nocera <hadess@hadess.net>
* glib/tmpl/keyfile.sgml: Mention the difference

View File

@ -67,6 +67,7 @@
<title>File types and applications</title>
<xi:include href="xml/gcontenttype.xml"/>
<xi:include href="xml/gappinfo.xml"/>
<xi:include href="xml/gdesktopappinfo.xml"/>
</chapter>
<chapter id="volume_mon">

View File

@ -134,7 +134,6 @@ g_file_enumerator_close_finish
g_file_enumerator_is_closed
g_file_enumerator_has_pending
g_file_enumerator_set_pending
g_output_stream_clear_pending
<SUBSECTION Standard>
GFileEnumeratorClass
G_FILE_ENUMERATOR
@ -631,6 +630,7 @@ g_output_stream_close_finish
g_output_stream_is_closed
g_output_stream_has_pending
g_output_stream_set_pending
g_output_stream_clear_pending
<SUBSECTION Standard>
GOutputStreamClass
G_OUTPUT_STREAM
@ -1125,6 +1125,25 @@ G_IS_UNIX_MOUNT_MONITOR_CLASS
g_unix_mount_monitor_get_type
</SECTION>
<SECTION>
<FILE>gdesktopappinfo</FILE>
<TITLE>Desktop file based GAppInfo</TITLE>
GDesktopAppInfo
g_desktop_app_info_new_from_filename
g_desktop_app_info_new
g_desktop_app_info_get_is_hidden
<SUBSECTION Standard>
GDesktopAppInfoClass
G_TYPE_DESKTOP_APP_INFO
G_DESKTOP_APP_INFO
G_DESKTOP_APP_INFO_CLASS
G_IS_DESKTOP_APP_INFO
G_IS_DESKTOP_APP_INFO_CLASS
G_DESKTOP_APP_INFO_GET_CLASS
<SUBSECTION Private>
g_desktop_app_info_get_type
</SECTION>
<SECTION>
<FILE>giomodule</FILE>
<TITLE>GIOModule</TITLE>

View File

@ -4,6 +4,7 @@ g_unix_mount_monitor_get_type
g_data_output_stream_get_type
g_unix_output_stream_get_type
g_unix_input_stream_get_type
g_desktop_app_info_get_type
g_memory_input_stream_get_type
g_volume_get_type
g_file_monitor_get_type

View File

@ -1,3 +1,9 @@
2007-12-10 Matthias Clasen <mclasen@redhat.com>
* Makefile.am: Install gdesktopappinfo.h as unix-specific header.
* gio.symbols:
* gdesktopappinfo.[hc]: Remove _-prefixes
2007-12-10 Tor Lillqvist <tml@novell.com>
* glocalfile.c: Add some more G_OS_WIN32 conditionals to silence

View File

@ -104,6 +104,7 @@ unix_sources = \
giounixincludedir=$(includedir)/gio-unix-2.0/gio
giounixinclude_HEADERS = \
gdesktopappinfo.h \
gunixmounts.h \
gunixinputstream.h \
gunixoutputstream.h \

View File

@ -72,7 +72,6 @@ struct _GDesktopAppInfo
/* FIXME: what about StartupWMClass ? */
};
#define g_desktop_app_info_get_type _g_desktop_app_info_get_type
G_DEFINE_TYPE_WITH_CODE (GDesktopAppInfo, g_desktop_app_info, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_APP_INFO,
g_desktop_app_info_iface_init))
@ -152,7 +151,7 @@ g_desktop_app_info_init (GDesktopAppInfo *local)
* Returns: a new #GDesktopAppInfo or %NULL on error.
**/
GDesktopAppInfo *
_g_desktop_app_info_new_from_filename (const char *filename)
g_desktop_app_info_new_from_filename (const char *filename)
{
GDesktopAppInfo *info;
GKeyFile *key_file;
@ -258,7 +257,7 @@ _g_desktop_app_info_new_from_filename (const char *filename)
* Returns: a new #GDesktopAppInfo.
**/
GDesktopAppInfo *
_g_desktop_app_info_new (const char *desktop_id)
g_desktop_app_info_new (const char *desktop_id)
{
GDesktopAppInfo *appinfo;
const char * const *dirs;
@ -273,7 +272,7 @@ _g_desktop_app_info_new (const char *desktop_id)
char *p;
filename = g_build_filename (dirs[i], desktop_id, NULL);
appinfo = _g_desktop_app_info_new_from_filename (filename);
appinfo = g_desktop_app_info_new_from_filename (filename);
g_free (filename);
if (appinfo != NULL)
{
@ -287,7 +286,7 @@ _g_desktop_app_info_new (const char *desktop_id)
*p = '/';
filename = g_build_filename (dirs[i], basename, NULL);
appinfo = _g_desktop_app_info_new_from_filename (filename);
appinfo = g_desktop_app_info_new_from_filename (filename);
g_free (filename);
if (appinfo != NULL)
{
@ -304,7 +303,7 @@ _g_desktop_app_info_new (const char *desktop_id)
found:
appinfo->desktop_id = g_strdup (desktop_id);
if (_g_desktop_app_info_get_is_hidden (appinfo))
if (g_desktop_app_info_get_is_hidden (appinfo))
{
g_object_unref (appinfo);
appinfo = NULL;
@ -381,7 +380,7 @@ g_desktop_app_info_get_name (GAppInfo *appinfo)
* Returns: %TRUE if hidden, %FALSE otherwise.
**/
gboolean
_g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info)
g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info)
{
return info->hidden;
}
@ -1437,7 +1436,7 @@ g_app_info_create_from_commandline (const char *commandline,
run_update_command ("update-desktop-database", "applications");
info = _g_desktop_app_info_new_from_filename (filename);
info = g_desktop_app_info_new_from_filename (filename);
g_free (filename);
if (info == NULL)
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
@ -1509,7 +1508,7 @@ g_app_info_get_all_for_type (const char *content_type)
{
char *desktop_entry = l->data;
info = _g_desktop_app_info_new (desktop_entry);
info = g_desktop_app_info_new (desktop_entry);
if (info)
{
if (app_info_in_list (G_APP_INFO (info), infos))
@ -1550,7 +1549,7 @@ g_app_info_get_default_for_type (const char *content_type,
{
char *desktop_entry = l->data;
info = (GAppInfo *)_g_desktop_app_info_new (desktop_entry);
info = (GAppInfo *)g_desktop_app_info_new (desktop_entry);
if (info)
{
if (must_support_uris && !g_app_info_supports_uris (info))
@ -1614,11 +1613,11 @@ get_apps_from_dir (GHashTable *apps,
/* Use _extended so we catch NULLs too (hidden) */
if (!g_hash_table_lookup_extended (apps, desktop_id, NULL, NULL))
{
appinfo = _g_desktop_app_info_new_from_filename (filename);
appinfo = g_desktop_app_info_new_from_filename (filename);
/* Don't return apps that don't take arguments */
if (appinfo &&
_g_desktop_app_info_get_is_hidden (appinfo) &&
g_desktop_app_info_get_is_hidden (appinfo) &&
strstr (appinfo->exec,"%U") == NULL &&
strstr (appinfo->exec,"%u") == NULL &&
strstr (appinfo->exec,"%f") == NULL &&

View File

@ -27,7 +27,7 @@
G_BEGIN_DECLS
#define G_TYPE_DESKTOP_APP_INFO (_g_desktop_app_info_get_type ())
#define G_TYPE_DESKTOP_APP_INFO (g_desktop_app_info_get_type ())
#define G_DESKTOP_APP_INFO(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DESKTOP_APP_INFO, GDesktopAppInfo))
#define G_DESKTOP_APP_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DESKTOP_APP_INFO, GDesktopAppInfoClass))
#define G_IS_DESKTOP_APP_INFO(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DESKTOP_APP_INFO))
@ -42,11 +42,11 @@ struct _GDesktopAppInfoClass
GObjectClass parent_class;
};
GType _g_desktop_app_info_get_type (void) G_GNUC_CONST;
GType g_desktop_app_info_get_type (void) G_GNUC_CONST;
GDesktopAppInfo *_g_desktop_app_info_new_from_filename (const char *filename);
GDesktopAppInfo *_g_desktop_app_info_new (const char *desktop_id);
gboolean _g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info);
GDesktopAppInfo *g_desktop_app_info_new_from_filename (const char *filename);
GDesktopAppInfo *g_desktop_app_info_new (const char *desktop_id);
gboolean g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info);
G_END_DECLS

View File

@ -61,6 +61,15 @@ g_app_info_get_default_for_uri_scheme
#endif
#if IN_HEADER(__G_DESKTOP_APP_INFO_H__)
#if IN_FILE(__G_DESKTOP_APP_INFO_C__)
g_desktop_app_info_new_from_filename
g_desktop_app_info_new
g_desktop_app_info_get_is_hidden
#endif
#endif
#if IN_HEADER(__G_ASYNC_RESULT_H__)
#if IN_FILE(__G_ASYNC_RESULT_C__)
g_async_result_get_type G_GNUC_CONST