[gtk+/wip/otte/clipboard: 95/107] contentprovider: Add ref_storable_formats()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/clipboard: 95/107] contentprovider: Add ref_storable_formats()
- Date: Fri, 1 Dec 2017 14:05:55 +0000 (UTC)
commit afd251703a280889690a0fa38aae3380a7962ddd
Author: Benjamin Otte <otte redhat com>
Date: Wed Nov 29 10:07:52 2017 +0100
contentprovider: Add ref_storable_formats()
This is to be used for advocating to clipboard managers.
gdk/gdkcontentprovider.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++
gdk/gdkcontentprovider.h | 3 ++
2 files changed, 51 insertions(+), 0 deletions(-)
---
diff --git a/gdk/gdkcontentprovider.c b/gdk/gdkcontentprovider.c
index 525a4eb..55aa384 100644
--- a/gdk/gdkcontentprovider.c
+++ b/gdk/gdkcontentprovider.c
@@ -34,6 +34,7 @@ struct _GdkContentProviderPrivate
enum {
PROP_0,
PROP_FORMATS,
+ PROP_STORABLE_FORMATS,
N_PROPERTIES
};
@@ -65,6 +66,12 @@ gdk_content_provider_real_ref_formats (GdkContentProvider *provider)
return gdk_content_formats_new (NULL, 0);
}
+static GdkContentFormats *
+gdk_content_provider_real_ref_storable_formats (GdkContentProvider *provider)
+{
+ return gdk_content_provider_ref_formats (provider);
+}
+
static void
gdk_content_provider_real_write_mime_type_async (GdkContentProvider *provider,
const char *mime_type,
@@ -121,6 +128,10 @@ gdk_content_provider_get_property (GObject *gobject,
g_value_take_boxed (value, gdk_content_provider_ref_formats (provider));
break;
+ case PROP_STORABLE_FORMATS:
+ g_value_take_boxed (value, gdk_content_provider_ref_storable_formats (provider));
+ break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
@@ -137,6 +148,7 @@ gdk_content_provider_class_init (GdkContentProviderClass *class)
class->attach_clipboard = gdk_content_provider_real_attach_clipboard;
class->detach_clipboard = gdk_content_provider_real_detach_clipboard;
class->ref_formats = gdk_content_provider_real_ref_formats;
+ class->ref_storable_formats = gdk_content_provider_real_ref_storable_formats;
class->write_mime_type_async = gdk_content_provider_real_write_mime_type_async;
class->write_mime_type_finish = gdk_content_provider_real_write_mime_type_finish;
class->get_value = gdk_content_provider_real_get_value;
@@ -158,6 +170,22 @@ gdk_content_provider_class_init (GdkContentProviderClass *class)
G_PARAM_EXPLICIT_NOTIFY);
/**
+ * GdkContentProvider:storable-formats:
+ *
+ * The subset of formats that clipboard managers should store this provider's data in.
+ *
+ * Since: 3.94
+ */
+ properties[PROP_STORABLE_FORMATS] =
+ g_param_spec_boxed ("storable-formats",
+ "Storable formats",
+ "The formats that data should be stored in",
+ GDK_TYPE_CONTENT_FORMATS,
+ G_PARAM_READABLE |
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_EXPLICIT_NOTIFY);
+
+ /**
* GdkContentProvider:content-changed:
*
* Emitted whenever the content provided by this provider has changed.
@@ -196,6 +224,26 @@ gdk_content_provider_ref_formats (GdkContentProvider *provider)
return GDK_CONTENT_PROVIDER_GET_CLASS (provider)->ref_formats (provider);
}
+/**
+ * gdk_content_provider_ref_storable_formats:
+ * @provider: a #GdkContentProvider
+ *
+ * Gets the formats that the provider suggests other applications to store
+ * the data in.
+ * An example of such an application would be a clipboard manager.
+ *
+ * This can be assumed to be a subset of gdk_content_provider_ref_formats().
+ *
+ * Returns: (transfer full): The storable formats of the provider
+ **/
+GdkContentFormats *
+gdk_content_provider_ref_storable_formats (GdkContentProvider *provider)
+{
+ g_return_val_if_fail (GDK_IS_CONTENT_PROVIDER (provider), NULL);
+
+ return GDK_CONTENT_PROVIDER_GET_CLASS (provider)->ref_storable_formats (provider);
+}
+
void
gdk_content_provider_content_changed (GdkContentProvider *provider)
{
diff --git a/gdk/gdkcontentprovider.h b/gdk/gdkcontentprovider.h
index 90b9eae..1ce1962 100644
--- a/gdk/gdkcontentprovider.h
+++ b/gdk/gdkcontentprovider.h
@@ -58,6 +58,7 @@ struct _GdkContentProviderClass
GdkClipboard *clipboard);
GdkContentFormats * (* ref_formats) (GdkContentProvider *provider);
+ GdkContentFormats * (* ref_storable_formats) (GdkContentProvider *provider);
void (* write_mime_type_async) (GdkContentProvider *provider,
const char *mime_type,
GOutputStream *stream,
@@ -90,6 +91,8 @@ GType gdk_content_provider_get_type (void) G
GDK_AVAILABLE_IN_3_94
GdkContentFormats * gdk_content_provider_ref_formats (GdkContentProvider *provider);
+GDK_AVAILABLE_IN_3_94
+GdkContentFormats * gdk_content_provider_ref_storable_formats (GdkContentProvider *provider);
GDK_AVAILABLE_IN_3_94
void gdk_content_provider_content_changed (GdkContentProvider *provider);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]