mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
gcontenttype: Add platform-independent top level API file
This file doesn’t contain any real implementation, it just call the `impl` functions from the platform-specific files `gcontenttype-{fdo,osx,win32}.[cm]`. It serves as a location for the doc comments, introspection annotations and API preconditions, and will be built on every platform. In particular, this means that we get consistent GIR output for the `g_content_type_*()` APIs regardless of whether GLib was built on Linux or Windows or macOS. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #3399
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "gcontenttype.h"
|
||||
#include "gcontenttypeprivate.h"
|
||||
#include "gthemedicon.h"
|
||||
#include "gicon.h"
|
||||
#include "glibintl.h"
|
||||
@@ -87,22 +88,22 @@ get_registry_classes_key (const char *subdir,
|
||||
|
||||
/*< private >*/
|
||||
void
|
||||
g_content_type_set_mime_dirs (const gchar * const *dirs)
|
||||
g_content_type_set_mime_dirs_impl (const gchar * const *dirs)
|
||||
{
|
||||
/* noop on Windows */
|
||||
}
|
||||
|
||||
/*< private >*/
|
||||
const gchar * const *
|
||||
g_content_type_get_mime_dirs (void)
|
||||
g_content_type_get_mime_dirs_impl (void)
|
||||
{
|
||||
const gchar * const *mime_dirs = { NULL };
|
||||
return mime_dirs;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_content_type_equals (const gchar *type1,
|
||||
const gchar *type2)
|
||||
g_content_type_equals_impl (const gchar *type1,
|
||||
const gchar *type2)
|
||||
{
|
||||
char *progid1, *progid2;
|
||||
gboolean res;
|
||||
@@ -126,8 +127,8 @@ g_content_type_equals (const gchar *type1,
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_content_type_is_a (const gchar *type,
|
||||
const gchar *supertype)
|
||||
g_content_type_is_a_impl (const gchar *type,
|
||||
const gchar *supertype)
|
||||
{
|
||||
gboolean res;
|
||||
char *perceived_type;
|
||||
@@ -152,8 +153,8 @@ g_content_type_is_a (const gchar *type,
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_content_type_is_mime_type (const gchar *type,
|
||||
const gchar *mime_type)
|
||||
g_content_type_is_mime_type_impl (const gchar *type,
|
||||
const gchar *mime_type)
|
||||
{
|
||||
gchar *content_type;
|
||||
gboolean ret;
|
||||
@@ -169,7 +170,7 @@ g_content_type_is_mime_type (const gchar *type,
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_content_type_is_unknown (const gchar *type)
|
||||
g_content_type_is_unknown_impl (const gchar *type)
|
||||
{
|
||||
g_return_val_if_fail (type != NULL, FALSE);
|
||||
|
||||
@@ -177,7 +178,7 @@ g_content_type_is_unknown (const gchar *type)
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_content_type_get_description (const gchar *type)
|
||||
g_content_type_get_description_impl (const gchar *type)
|
||||
{
|
||||
char *progid;
|
||||
char *description;
|
||||
@@ -201,7 +202,7 @@ g_content_type_get_description (const gchar *type)
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_content_type_get_mime_type (const gchar *type)
|
||||
g_content_type_get_mime_type_impl (const gchar *type)
|
||||
{
|
||||
char *mime;
|
||||
|
||||
@@ -224,17 +225,8 @@ g_content_type_get_mime_type (const gchar *type)
|
||||
G_LOCK_DEFINE_STATIC (_type_icons);
|
||||
static GHashTable *_type_icons = NULL;
|
||||
|
||||
/**
|
||||
* g_content_type_get_icon:
|
||||
* @type: a content type string
|
||||
*
|
||||
* Gets the icon for a content type.
|
||||
*
|
||||
* Returns: (transfer full): #GIcon corresponding to the content type. Free the returned
|
||||
* object with g_object_unref()
|
||||
*/
|
||||
GIcon *
|
||||
g_content_type_get_icon (const gchar *type)
|
||||
g_content_type_get_icon_impl (const gchar *type)
|
||||
{
|
||||
GIcon *themed_icon;
|
||||
char *name = NULL;
|
||||
@@ -292,19 +284,19 @@ g_content_type_get_icon (const gchar *type)
|
||||
}
|
||||
|
||||
GIcon *
|
||||
g_content_type_get_symbolic_icon (const gchar *type)
|
||||
g_content_type_get_symbolic_icon_impl (const gchar *type)
|
||||
{
|
||||
return g_content_type_get_icon (type);
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_content_type_get_generic_icon_name (const gchar *type)
|
||||
g_content_type_get_generic_icon_name_impl (const gchar *type)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gboolean
|
||||
g_content_type_can_be_executable (const gchar *type)
|
||||
g_content_type_can_be_executable_impl (const gchar *type)
|
||||
{
|
||||
g_return_val_if_fail (type != NULL, FALSE);
|
||||
|
||||
@@ -343,7 +335,7 @@ looks_like_text (const guchar *data,
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_content_type_from_mime_type (const gchar *mime_type)
|
||||
g_content_type_from_mime_type_impl (const gchar *mime_type)
|
||||
{
|
||||
char *key, *content_type;
|
||||
|
||||
@@ -362,10 +354,10 @@ g_content_type_from_mime_type (const gchar *mime_type)
|
||||
}
|
||||
|
||||
gchar *
|
||||
g_content_type_guess (const gchar *filename,
|
||||
const guchar *data,
|
||||
gsize data_size,
|
||||
gboolean *result_uncertain)
|
||||
g_content_type_guess_impl (const gchar *filename,
|
||||
const guchar *data,
|
||||
gsize data_size,
|
||||
gboolean *result_uncertain)
|
||||
{
|
||||
char *basename;
|
||||
char *type;
|
||||
@@ -410,7 +402,7 @@ g_content_type_guess (const gchar *filename,
|
||||
}
|
||||
|
||||
GList *
|
||||
g_content_types_get_registered (void)
|
||||
g_content_types_get_registered_impl (void)
|
||||
{
|
||||
DWORD index;
|
||||
wchar_t keyname[256];
|
||||
@@ -446,7 +438,7 @@ g_content_types_get_registered (void)
|
||||
}
|
||||
|
||||
gchar **
|
||||
g_content_type_guess_for_tree (GFile *root)
|
||||
g_content_type_guess_for_tree_impl (GFile *root)
|
||||
{
|
||||
/* FIXME: implement */
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user