StClipboard: add st_clipboard_get_mimetypes

Since the `MetaSelection` of the global `StClipboard` is private (and
should be), there is no reasonable way for extensions or external code
to query the supported mime-types.

Add `st_clipboard_get_mimetypes()` so this can be queried without
poking around in private code.

closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2819
This commit is contained in:
Andy Holmes 2020-05-21 12:24:14 -07:00 committed by Florian Müllner
parent 9cad7ae975
commit 669b0f193a
2 changed files with 26 additions and 0 deletions

View File

@ -146,6 +146,29 @@ transfer_cb (MetaSelection *selection,
g_free (text);
}
/**
* st_clipboard_get_mimetypes:
* @clipboard: a #StClipboard
*
* Gets a list of the mimetypes supported by the default #StClipboard.
*
* Returns: (element-type utf8) (transfer full): the supported mimetypes
*/
GList *
st_clipboard_get_mimetypes (StClipboard *clipboard,
StClipboardType type)
{
MetaSelectionType selection_type;
g_return_val_if_fail (ST_IS_CLIPBOARD (clipboard), NULL);
g_return_val_if_fail (meta_selection != NULL, NULL);
if (!convert_type (type, &selection_type))
return NULL;
return meta_selection_get_mimetypes (meta_selection, selection_type);
}
/**
* st_clipboard_get_text:
* @clipboard: A #StCliboard

View File

@ -65,6 +65,9 @@ typedef void (*StClipboardCallbackFunc) (StClipboard *clipboard,
StClipboard* st_clipboard_get_default (void);
GList * st_clipboard_get_mimetypes (StClipboard *clipboard,
StClipboardType type);
void st_clipboard_get_text (StClipboard *clipboard,
StClipboardType type,
StClipboardCallbackFunc callback,