diff options
author | Benjamin Otte <otte@redhat.com> | 2017-11-25 21:59:39 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2017-12-03 05:46:47 +0100 |
commit | 134076e7387abafa1599853edad38ddd703075d3 (patch) | |
tree | a6ca759f8410a62aa9cd5857a9e307b8021c29e4 /gdk/gdkcontentformats.c | |
parent | e2014850b9ef032d922648cdc7ee644a3f9b8429 (diff) | |
download | gtk+-134076e7387abafa1599853edad38ddd703075d3.tar.gz |
x11: Implement claiming the X Selection with the clipboard
... and of course support writing to other apps.
Diffstat (limited to 'gdk/gdkcontentformats.c')
-rw-r--r-- | gdk/gdkcontentformats.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/gdk/gdkcontentformats.c b/gdk/gdkcontentformats.c index 7b4a101e13..8369cdd6ee 100644 --- a/gdk/gdkcontentformats.c +++ b/gdk/gdkcontentformats.c @@ -63,7 +63,7 @@ #include "gdkcontentformats.h" #include "gdkcontentformatsprivate.h" -#include "gdkproperty.h" +#include <string.h> struct _GdkContentFormats { @@ -81,6 +81,37 @@ G_DEFINE_BOXED_TYPE (GdkContentFormats, gdk_content_formats, gdk_content_formats_unref) +/** + * gdk_intern_mime_type: + * @string: (transfer none): string of a potential mime type + * + * Canonicalizes the given mime type and interns the result. + * + * If @string is not a valid mime type, %NULL is returned instead. + * See RFC 2048 for the syntax if mime types. + * + * Returns: An interned string for the canonicalized mime type + * or %NULL if the string wasn't a valid mime type + **/ +const char * +gdk_intern_mime_type (const char *string) +{ + char *tmp; + + g_return_val_if_fail (string != NULL, NULL); + + if (!strchr (string, '/')) + return NULL; + + tmp = g_ascii_strdown (string, -1); + + string = g_intern_string (tmp); + + g_free (tmp); + + return string; +} + static GdkContentFormats * gdk_content_formats_new_take (GType * gtypes, gsize n_gtypes, |