Commit 355d85b1 authored by Matthias Clasen's avatar Matthias Clasen

Install gdesktopappinfo as unix-specific api

svn path=/trunk/; revision=6090
parent 1105ce11
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> 2007-12-10 Bastien Nocera <hadess@hadess.net>
* glib/tmpl/keyfile.sgml: Mention the difference * glib/tmpl/keyfile.sgml: Mention the difference
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
<title>File types and applications</title> <title>File types and applications</title>
<xi:include href="xml/gcontenttype.xml"/> <xi:include href="xml/gcontenttype.xml"/>
<xi:include href="xml/gappinfo.xml"/> <xi:include href="xml/gappinfo.xml"/>
<xi:include href="xml/gdesktopappinfo.xml"/>
</chapter> </chapter>
<chapter id="volume_mon"> <chapter id="volume_mon">
......
...@@ -134,7 +134,6 @@ g_file_enumerator_close_finish ...@@ -134,7 +134,6 @@ g_file_enumerator_close_finish
g_file_enumerator_is_closed g_file_enumerator_is_closed
g_file_enumerator_has_pending g_file_enumerator_has_pending
g_file_enumerator_set_pending g_file_enumerator_set_pending
g_output_stream_clear_pending
<SUBSECTION Standard> <SUBSECTION Standard>
GFileEnumeratorClass GFileEnumeratorClass
G_FILE_ENUMERATOR G_FILE_ENUMERATOR
...@@ -631,6 +630,7 @@ g_output_stream_close_finish ...@@ -631,6 +630,7 @@ g_output_stream_close_finish
g_output_stream_is_closed g_output_stream_is_closed
g_output_stream_has_pending g_output_stream_has_pending
g_output_stream_set_pending g_output_stream_set_pending
g_output_stream_clear_pending
<SUBSECTION Standard> <SUBSECTION Standard>
GOutputStreamClass GOutputStreamClass
G_OUTPUT_STREAM G_OUTPUT_STREAM
...@@ -1125,6 +1125,25 @@ G_IS_UNIX_MOUNT_MONITOR_CLASS ...@@ -1125,6 +1125,25 @@ G_IS_UNIX_MOUNT_MONITOR_CLASS
g_unix_mount_monitor_get_type g_unix_mount_monitor_get_type
</SECTION> </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> <SECTION>
<FILE>giomodule</FILE> <FILE>giomodule</FILE>
<TITLE>GIOModule</TITLE> <TITLE>GIOModule</TITLE>
......
...@@ -4,6 +4,7 @@ g_unix_mount_monitor_get_type ...@@ -4,6 +4,7 @@ g_unix_mount_monitor_get_type
g_data_output_stream_get_type g_data_output_stream_get_type
g_unix_output_stream_get_type g_unix_output_stream_get_type
g_unix_input_stream_get_type g_unix_input_stream_get_type
g_desktop_app_info_get_type
g_memory_input_stream_get_type g_memory_input_stream_get_type
g_volume_get_type g_volume_get_type
g_file_monitor_get_type g_file_monitor_get_type
......
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> 2007-12-10 Tor Lillqvist <tml@novell.com>
* glocalfile.c: Add some more G_OS_WIN32 conditionals to silence * glocalfile.c: Add some more G_OS_WIN32 conditionals to silence
......
...@@ -104,6 +104,7 @@ unix_sources = \ ...@@ -104,6 +104,7 @@ unix_sources = \
giounixincludedir=$(includedir)/gio-unix-2.0/gio giounixincludedir=$(includedir)/gio-unix-2.0/gio
giounixinclude_HEADERS = \ giounixinclude_HEADERS = \
gdesktopappinfo.h \
gunixmounts.h \ gunixmounts.h \
gunixinputstream.h \ gunixinputstream.h \
gunixoutputstream.h \ gunixoutputstream.h \
......
...@@ -72,7 +72,6 @@ struct _GDesktopAppInfo ...@@ -72,7 +72,6 @@ struct _GDesktopAppInfo
/* FIXME: what about StartupWMClass ? */ /* 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_DEFINE_TYPE_WITH_CODE (GDesktopAppInfo, g_desktop_app_info, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_APP_INFO, G_IMPLEMENT_INTERFACE (G_TYPE_APP_INFO,
g_desktop_app_info_iface_init)) g_desktop_app_info_iface_init))
...@@ -152,7 +151,7 @@ g_desktop_app_info_init (GDesktopAppInfo *local) ...@@ -152,7 +151,7 @@ g_desktop_app_info_init (GDesktopAppInfo *local)
* Returns: a new #GDesktopAppInfo or %NULL on error. * Returns: a new #GDesktopAppInfo or %NULL on error.
**/ **/
GDesktopAppInfo * GDesktopAppInfo *
_g_desktop_app_info_new_from_filename (const char *filename) g_desktop_app_info_new_from_filename (const char *filename)
{ {
GDesktopAppInfo *info; GDesktopAppInfo *info;
GKeyFile *key_file; GKeyFile *key_file;
...@@ -258,7 +257,7 @@ _g_desktop_app_info_new_from_filename (const char *filename) ...@@ -258,7 +257,7 @@ _g_desktop_app_info_new_from_filename (const char *filename)
* Returns: a new #GDesktopAppInfo. * Returns: a new #GDesktopAppInfo.
**/ **/
GDesktopAppInfo * GDesktopAppInfo *
_g_desktop_app_info_new (const char *desktop_id) g_desktop_app_info_new (const char *desktop_id)
{ {
GDesktopAppInfo *appinfo; GDesktopAppInfo *appinfo;
const char * const *dirs; const char * const *dirs;
...@@ -273,7 +272,7 @@ _g_desktop_app_info_new (const char *desktop_id) ...@@ -273,7 +272,7 @@ _g_desktop_app_info_new (const char *desktop_id)
char *p; char *p;
filename = g_build_filename (dirs[i], desktop_id, NULL); 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); g_free (filename);
if (appinfo != NULL) if (appinfo != NULL)
{ {
...@@ -287,7 +286,7 @@ _g_desktop_app_info_new (const char *desktop_id) ...@@ -287,7 +286,7 @@ _g_desktop_app_info_new (const char *desktop_id)
*p = '/'; *p = '/';
filename = g_build_filename (dirs[i], basename, NULL); 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); g_free (filename);
if (appinfo != NULL) if (appinfo != NULL)
{ {
...@@ -304,7 +303,7 @@ _g_desktop_app_info_new (const char *desktop_id) ...@@ -304,7 +303,7 @@ _g_desktop_app_info_new (const char *desktop_id)
found: found:
appinfo->desktop_id = g_strdup (desktop_id); 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); g_object_unref (appinfo);
appinfo = NULL; appinfo = NULL;
...@@ -381,7 +380,7 @@ g_desktop_app_info_get_name (GAppInfo *appinfo) ...@@ -381,7 +380,7 @@ g_desktop_app_info_get_name (GAppInfo *appinfo)
* Returns: %TRUE if hidden, %FALSE otherwise. * Returns: %TRUE if hidden, %FALSE otherwise.
**/ **/
gboolean gboolean
_g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info) g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info)
{ {
return info->hidden; return info->hidden;
} }
...@@ -1437,7 +1436,7 @@ g_app_info_create_from_commandline (const char *commandline, ...@@ -1437,7 +1436,7 @@ g_app_info_create_from_commandline (const char *commandline,
run_update_command ("update-desktop-database", "applications"); 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); g_free (filename);
if (info == NULL) if (info == NULL)
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, 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) ...@@ -1509,7 +1508,7 @@ g_app_info_get_all_for_type (const char *content_type)
{ {
char *desktop_entry = l->data; char *desktop_entry = l->data;
info = _g_desktop_app_info_new (desktop_entry); info = g_desktop_app_info_new (desktop_entry);
if (info) if (info)
{ {
if (app_info_in_list (G_APP_INFO (info), infos)) 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, ...@@ -1550,7 +1549,7 @@ g_app_info_get_default_for_type (const char *content_type,
{ {
char *desktop_entry = l->data; 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 (info)
{ {
if (must_support_uris && !g_app_info_supports_uris (info)) if (must_support_uris && !g_app_info_supports_uris (info))
...@@ -1614,11 +1613,11 @@ get_apps_from_dir (GHashTable *apps, ...@@ -1614,11 +1613,11 @@ get_apps_from_dir (GHashTable *apps,
/* Use _extended so we catch NULLs too (hidden) */ /* Use _extended so we catch NULLs too (hidden) */
if (!g_hash_table_lookup_extended (apps, desktop_id, NULL, NULL)) 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 */ /* Don't return apps that don't take arguments */
if (appinfo && 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,"%u") == NULL && strstr (appinfo->exec,"%u") == NULL &&
strstr (appinfo->exec,"%f") == NULL && strstr (appinfo->exec,"%f") == NULL &&
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
G_BEGIN_DECLS 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(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_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)) #define G_IS_DESKTOP_APP_INFO(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DESKTOP_APP_INFO))
...@@ -42,11 +42,11 @@ struct _GDesktopAppInfoClass ...@@ -42,11 +42,11 @@ struct _GDesktopAppInfoClass
GObjectClass parent_class; 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_from_filename (const char *filename);
GDesktopAppInfo *_g_desktop_app_info_new (const char *desktop_id); GDesktopAppInfo *g_desktop_app_info_new (const char *desktop_id);
gboolean _g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info); gboolean g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info);
G_END_DECLS G_END_DECLS
......
...@@ -61,6 +61,15 @@ g_app_info_get_default_for_uri_scheme ...@@ -61,6 +61,15 @@ g_app_info_get_default_for_uri_scheme
#endif #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_HEADER(__G_ASYNC_RESULT_H__)
#if IN_FILE(__G_ASYNC_RESULT_C__) #if IN_FILE(__G_ASYNC_RESULT_C__)
g_async_result_get_type G_GNUC_CONST g_async_result_get_type G_GNUC_CONST
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment