Accepting request 584660 from GNOME:Factory
Scripted push of project GNOME:Next (forwarded request 583493 from dimstar) OBS-URL: https://build.opensuse.org/request/show/584660 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gtk4?expand=0&rev=11
This commit is contained in:
commit
115a2a7f78
10
gtk4.changes
10
gtk4.changes
@ -1,3 +1,13 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 28 16:32:28 UTC 2018 - dimstar@opensuse.org
|
||||
|
||||
- Modernize spec-file by calling spec-cleaner
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Feb 28 10:18:07 UTC 2018 - dimstar@opensuse.org
|
||||
|
||||
- Add gtkmm.patch: Allow binding GdkContentFormatsBuilder.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Dec 29 00:02:59 UTC 2017 - jengelh@inai.de
|
||||
|
||||
|
60
gtk4.spec
60
gtk4.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package gtk4
|
||||
#
|
||||
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2010 Dominique Leuenebrger, Amsterdam, Netherlands
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
@ -20,19 +20,19 @@
|
||||
# When updating the binary version, do not forget to also update baselibs.conf
|
||||
%define gtk_binary_version 4.0.0
|
||||
%define _name gtk+
|
||||
|
||||
Name: gtk4
|
||||
Version: 3.93.0
|
||||
Release: 0
|
||||
Summary: The GTK+ toolkit library (version 4)
|
||||
License: LGPL-2.1+
|
||||
License: LGPL-2.1-or-later
|
||||
Group: Development/Libraries/X11
|
||||
Url: http://www.gtk.org/
|
||||
URL: http://www.gtk.org/
|
||||
Source: http://download.gnome.org/sources/gtk+/3.93/%{_name}-%{version}.tar.xz
|
||||
Source2: settings.ini
|
||||
Source3: macros.gtk4
|
||||
Source98: gtk4-rpmlintrc
|
||||
Source99: baselibs.conf
|
||||
Patch0: gtkmm.patch
|
||||
BuildRequires: cups-devel >= 1.2
|
||||
BuildRequires: docbook-xsl-stylesheets
|
||||
BuildRequires: fdupes
|
||||
@ -41,9 +41,7 @@ BuildRequires: gettext-tools >= 0.19.7
|
||||
BuildRequires: gtk-doc
|
||||
BuildRequires: hicolor-icon-theme
|
||||
BuildRequires: meson >= 0.42.1
|
||||
%if !0%{?is_opensuse}
|
||||
BuildRequires: translation-update-upstream
|
||||
%endif
|
||||
BuildRequires: pkgconfig
|
||||
BuildRequires: vulkan-devel
|
||||
BuildRequires: xsltproc
|
||||
BuildRequires: pkgconfig(atk) >= 2.15.1
|
||||
@ -80,7 +78,9 @@ BuildRequires: pkgconfig(xi)
|
||||
BuildRequires: pkgconfig(xinerama)
|
||||
BuildRequires: pkgconfig(xkbcommon)
|
||||
BuildRequires: pkgconfig(xrandr) >= 1.2.99
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%if !0%{?is_opensuse}
|
||||
BuildRequires: translation-update-upstream
|
||||
%endif
|
||||
|
||||
%description
|
||||
GTK+ is a multi-platform toolkit for creating graphical user interfaces.
|
||||
@ -90,19 +90,17 @@ ranging from small one-off projects to complete application suites.
|
||||
%package -n libgtk-4-0
|
||||
Summary: The GTK+ toolkit library (version 4)
|
||||
Group: System/Libraries
|
||||
Requires(post): %{name}-tools
|
||||
# gtk4-data is currently not being built, might be an upstream oversight though
|
||||
Requires: %{name}-data >= %{version}
|
||||
Obsoletes: %{name}-data < %{version}
|
||||
Provides: %{name}-data = %{version}
|
||||
Requires: %{name}-schema >= %{version}
|
||||
# Require Adwaita Icon Theme: It's GTKs icon set, that's guaranteed to be there
|
||||
Requires: adwaita-icon-theme
|
||||
# While hicolor is not a Requires strictly speaking, we put it as
|
||||
# such instead of as a Recommends because many applications just
|
||||
# assume it's there and we need to have a low-level package to
|
||||
# bring it in.
|
||||
Requires: hicolor-icon-theme
|
||||
# Require Adwaita Icon Theme: It's GTKs icon set, that's guaranteed to be there
|
||||
Requires: adwaita-icon-theme
|
||||
Requires(post): %{name}-tools
|
||||
# gtk+ can work without branding/translations. Built in defaults will be used then.
|
||||
Recommends: %{name}-branding
|
||||
# it's nice to have input modules for various locales installed by default
|
||||
@ -113,6 +111,8 @@ Recommends: %{name}-immodule-tigrigna = %{version}
|
||||
Recommends: %{name}-immodule-vietnamese = %{version}
|
||||
Recommends: %{name}-lang
|
||||
Recommends: gvfs
|
||||
Obsoletes: %{name}-data < %{version}
|
||||
Provides: %{name}-data = %{version}
|
||||
# Provide %%{name} to make the lang and immodules packages installable
|
||||
Provides: %{name} = %{version}
|
||||
|
||||
@ -277,10 +277,10 @@ ranging from small one-off projects to complete application suites.
|
||||
%package schema
|
||||
Summary: Config schema for the GTK+ toolkit library v4
|
||||
Group: System/Libraries
|
||||
BuildArch: noarch
|
||||
# The schema is shared between gtk3 and gtk4 - gtk4 wins
|
||||
Provides: gtk3-schema = %{version}
|
||||
Obsoletes: gtk3-schema < %{version}
|
||||
BuildArch: noarch
|
||||
%glib2_gsettings_schema_requires
|
||||
|
||||
%description schema
|
||||
@ -292,9 +292,9 @@ ranging from small one-off projects to complete application suites.
|
||||
Summary: Upstream theme configuration for the GTK+ toolkit library v4
|
||||
Group: System/Libraries
|
||||
Requires: libgtk-4-0 = %{version}
|
||||
Provides: %{name}-branding = %{version}
|
||||
Conflicts: otherproviders(%{name}-branding)
|
||||
Supplements: packageand(libgtk-4-0:branding-upstream)
|
||||
Conflicts: %{name}-branding
|
||||
Provides: %{name}-branding = %{version}
|
||||
BuildArch: noarch
|
||||
#BRAND: Provides /usr/share/gtk-4.0/settings.ini, to define default theme and icon
|
||||
#BRAND: theme.
|
||||
@ -334,10 +334,11 @@ Obsoletes: gettext-its-gtk3 < %{version}
|
||||
%description -n gettext-its-%{name}
|
||||
This package enhances gettext with an International Tag Set for GTK+ 4
|
||||
|
||||
|
||||
%lang_package
|
||||
|
||||
%prep
|
||||
%setup -qn %{_name}-%{version}
|
||||
%setup -q -n %{_name}-%{version}
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
%meson \
|
||||
@ -361,7 +362,7 @@ This package enhances gettext with an International Tag Set for GTK+ 4
|
||||
|
||||
%find_lang gtk40
|
||||
%find_lang gtk40-properties
|
||||
install -m 644 -D %{S:2} %{buildroot}%{_datadir}/gtk-4.0/settings.ini
|
||||
install -m 644 -D %{SOURCE2} %{buildroot}%{_datadir}/gtk-4.0/settings.ini
|
||||
touch %{buildroot}%{_libdir}/gtk-4.0/%{gtk_binary_version}/immodules.cache
|
||||
# create modules directory that should have been created during the build
|
||||
test ! -d %{buildroot}%{_libdir}/gtk-4.0/modules
|
||||
@ -371,7 +372,7 @@ test ! -d %{buildroot}%{_libdir}/gtk-4.0/%{gtk_binary_version}/theming-engines
|
||||
mkdir %{buildroot}%{_libdir}/gtk-4.0/%{gtk_binary_version}/theming-engines
|
||||
# Install rpm macros
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/rpm
|
||||
cp %{S:3} %{buildroot}%{_sysconfdir}/rpm
|
||||
cp %{SOURCE3} %{buildroot}%{_sysconfdir}/rpm
|
||||
%fdupes %{buildroot}%{_datadir}
|
||||
%fdupes %{buildroot}%{_libdir}
|
||||
|
||||
@ -439,7 +440,6 @@ fi
|
||||
%endif
|
||||
|
||||
%postun -n libgtk-4-0 -p /sbin/ldconfig
|
||||
|
||||
%postun immodule-amharic
|
||||
%{_gtk_query_immodules_update_cache}
|
||||
|
||||
@ -465,8 +465,8 @@ fi
|
||||
%{_gtk_query_immodules_update_cache}
|
||||
|
||||
%files -n libgtk-4-0
|
||||
%defattr(-, root, root)
|
||||
%doc AUTHORS COPYING NEWS
|
||||
%license COPYING
|
||||
%doc AUTHORS NEWS
|
||||
%dir %{_sysconfdir}/gtk-4.0
|
||||
%dir %{_libdir}/gtk-4.0
|
||||
%dir %{_libdir}/gtk-4.0/%{gtk_binary_version}
|
||||
@ -485,49 +485,39 @@ fi
|
||||
%{_libdir}/libgtk-4.so.*
|
||||
|
||||
%files -n typelib-1_0-Gtk-4_0
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/girepository-1.0/Gdk-4.0.typelib
|
||||
%{_libdir}/girepository-1.0/GdkX11-4.0.typelib
|
||||
%{_libdir}/girepository-1.0/Gsk-4.0.typelib
|
||||
%{_libdir}/girepository-1.0/Gtk-4.0.typelib
|
||||
|
||||
%files immodule-amharic
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/gtk-4.0/%{gtk_binary_version}/immodules/im-am-et.so
|
||||
|
||||
%files immodule-broadway
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/gtk-4.0/%{gtk_binary_version}/immodules/im-broadway.so
|
||||
|
||||
%files immodule-inuktitut
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/gtk-4.0/%{gtk_binary_version}/immodules/im-inuktitut.so
|
||||
|
||||
%files immodule-multipress
|
||||
%defattr(-,root,root)
|
||||
%doc modules/input/README.multipress
|
||||
%{_libdir}/gtk-4.0/%{gtk_binary_version}/immodules/im-multipress.so
|
||||
%config %{_sysconfdir}/gtk-4.0/im-multipress.conf
|
||||
|
||||
%files immodule-thai
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/gtk-4.0/%{gtk_binary_version}/immodules/im-thai.so
|
||||
|
||||
%files immodules-tigrigna
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/gtk-4.0/%{gtk_binary_version}/immodules/im-ti-er.so
|
||||
%{_libdir}/gtk-4.0/%{gtk_binary_version}/immodules/im-ti-et.so
|
||||
|
||||
%files immodule-vietnamese
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/gtk-4.0/%{gtk_binary_version}/immodules/im-viqr.so
|
||||
|
||||
%files immodule-xim
|
||||
%defattr(-,root,root)
|
||||
%{_libdir}/gtk-4.0/%{gtk_binary_version}/immodules/im-xim.so
|
||||
|
||||
%files tools
|
||||
%defattr(-,root,root)
|
||||
%{_bindir}/gtk4-broadwayd
|
||||
%{_bindir}/gtk4-icon-browser
|
||||
%{_bindir}/gtk4-builder-tool
|
||||
@ -552,7 +542,6 @@ fi
|
||||
#{_datadir}/themes/Emacs/
|
||||
|
||||
%files schema
|
||||
%defattr(-,root,root)
|
||||
%{_datadir}/glib-2.0/schemas/org.gtk.Demo.gschema.xml
|
||||
%{_datadir}/glib-2.0/schemas/org.gtk.Settings.ColorChooser.gschema.xml
|
||||
%{_datadir}/glib-2.0/schemas/org.gtk.Settings.Debug.gschema.xml
|
||||
@ -560,11 +549,9 @@ fi
|
||||
%{_datadir}/glib-2.0/schemas/org.gtk.Settings.FileChooser.gschema.xml
|
||||
|
||||
%files branding-upstream
|
||||
%defattr(-,root,root)
|
||||
%{_datadir}/gtk-4.0/settings.ini
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root)
|
||||
%doc CONTRIBUTING.md NEWS.pre-1-0 README.commits
|
||||
%doc %{_datadir}/gtk-doc/html/gdk4/
|
||||
%doc %{_datadir}/gtk-doc/html/gsk4/
|
||||
@ -594,7 +581,6 @@ fi
|
||||
%{_sysconfdir}/rpm/macros.gtk4
|
||||
|
||||
%files -n gettext-its-%{name}
|
||||
%defattr(-,root,root)
|
||||
%dir %{_datadir}/gettext/
|
||||
%dir %{_datadir}/gettext/its/
|
||||
%{_datadir}/gettext/its/gtkbuilder.its
|
||||
|
423
gtkmm.patch
Normal file
423
gtkmm.patch
Normal file
@ -0,0 +1,423 @@
|
||||
From 2cbe094b919442471b54685a0fef0d6f83ce44b3 Mon Sep 17 00:00:00 2001
|
||||
From: Emmanuele Bassi <ebassi@gnome.org>
|
||||
Date: Thu, 1 Feb 2018 17:43:15 +0100
|
||||
Subject: [PATCH] Allow binding GdkContentFormatsBuilder
|
||||
|
||||
GdkContentFormatsBuilder is currently not introspectable, as it does not
|
||||
have a GType. We can turn it into a boxed type, but we need to implement
|
||||
memory management for it.
|
||||
|
||||
The current gdk_content_formats_builder_free() function returns a newly
|
||||
constructed value, so we cannot use it as a GBoxedFreeFunc; additionally
|
||||
copying a GdkContentFormatsBuilder contents would make it a bit odd, as
|
||||
you could get multiple identical GdkContentFormats out of the copies.
|
||||
|
||||
A simple approach is to model the GdkContentFormatsBuilder API to follow
|
||||
the GBytes one: use reference counting for memory management, and have
|
||||
a function to release a reference, return a GdkContentFormats, and reset
|
||||
the GdkContentFormatsBuilder state.
|
||||
|
||||
For language bindings, we can provide a get_formats() function that
|
||||
returns the GdkContentFormats instance and resets the builder instance,
|
||||
leaving the reference count untouched.
|
||||
|
||||
For C convenience we can keep gdk_content_formats_builder_free(), and
|
||||
make it a wrapper around gdk_content_formats_builder_get_formats(), with
|
||||
the guarantee that it'll free the builder instance regardless of its
|
||||
current reference count.
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=793097
|
||||
https://blogs.gnome.org/otte/2018/02/03/builders/
|
||||
---
|
||||
docs/reference/gdk/gdk4-sections.txt | 7 ++++++-
|
||||
gdk/gdkclipboard.c | 2 +-
|
||||
gdk/gdkcontentdeserializer.c | 4 ++--
|
||||
gdk/gdkcontentformats.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------
|
||||
gdk/gdkcontentformats.h | 15 +++++++++++++--
|
||||
gdk/gdkcontentproviderimpl.c | 2 +-
|
||||
gdk/gdkcontentserializer.c | 4 ++--
|
||||
gdk/wayland/gdkprimary-wayland.c | 4 ++--
|
||||
gdk/wayland/gdkselection-wayland.c | 2 +-
|
||||
gdk/win32/gdkdnd-win32.c | 2 +-
|
||||
gdk/x11/gdkclipboard-x11.c | 2 +-
|
||||
gtk/gtkselection.c | 6 +++---
|
||||
12 files changed, 138 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
|
||||
index d492279..cf58129 100644
|
||||
--- a/docs/reference/gdk/gdk4-sections.txt
|
||||
+++ b/docs/reference/gdk/gdk4-sections.txt
|
||||
@@ -438,11 +438,16 @@ gdk_content_formats_union_deserialize_mime_types
|
||||
<SUBSECTION>
|
||||
GdkContentFormatsBuilder
|
||||
gdk_content_formats_builder_new
|
||||
-gdk_content_formats_builder_free
|
||||
+gdk_content_formats_builder_free_to_formats
|
||||
gdk_content_formats_builder_add_formats
|
||||
gdk_content_formats_builder_add_gtype
|
||||
gdk_content_formats_builder_add_mime_type
|
||||
|
||||
+<SUBSECTION>
|
||||
+gdk_content_formats_builder_ref
|
||||
+gdk_content_formats_builder_unref
|
||||
+gdk_content_formats_builder_to_formats
|
||||
+
|
||||
<SUBSECTION Private>
|
||||
GDK_TYPE_FILE_LIST
|
||||
gdk_file_list_get_type
|
||||
diff --git a/gdk/gdkclipboard.c b/gdk/gdkclipboard.c
|
||||
index ee9d8e9..df82147 100644
|
||||
--- a/gdk/gdkclipboard.c
|
||||
+++ b/gdk/gdkclipboard.c
|
||||
@@ -820,7 +820,7 @@ gdk_clipboard_read_value_internal (GdkClipboard *clipboard,
|
||||
|
||||
builder = gdk_content_formats_builder_new ();
|
||||
gdk_content_formats_builder_add_gtype (builder, type);
|
||||
- formats = gdk_content_formats_builder_free (builder);
|
||||
+ formats = gdk_content_formats_builder_free_to_formats (builder);
|
||||
formats = gdk_content_formats_union_deserialize_mime_types (formats);
|
||||
|
||||
gdk_clipboard_read_internal (clipboard,
|
||||
diff --git a/gdk/gdkcontentdeserializer.c b/gdk/gdkcontentdeserializer.c
|
||||
index c9df08d..b0df54c 100644
|
||||
--- a/gdk/gdkcontentdeserializer.c
|
||||
+++ b/gdk/gdkcontentdeserializer.c
|
||||
@@ -458,7 +458,7 @@ gdk_content_formats_union_deserialize_gtypes (GdkContentFormats *formats)
|
||||
|
||||
gdk_content_formats_unref (formats);
|
||||
|
||||
- return gdk_content_formats_builder_free (builder);
|
||||
+ return gdk_content_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -493,7 +493,7 @@ gdk_content_formats_union_deserialize_mime_types (GdkContentFormats *formats)
|
||||
|
||||
gdk_content_formats_unref (formats);
|
||||
|
||||
- return gdk_content_formats_builder_free (builder);
|
||||
+ return gdk_content_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/gdk/gdkcontentformats.c b/gdk/gdkcontentformats.c
|
||||
index 04bd064..cd3293f 100644
|
||||
--- a/gdk/gdkcontentformats.c
|
||||
+++ b/gdk/gdkcontentformats.c
|
||||
@@ -307,7 +307,7 @@ gdk_content_formats_union (GdkContentFormats *first,
|
||||
gdk_content_formats_unref (first);
|
||||
gdk_content_formats_builder_add_formats (builder, second);
|
||||
|
||||
- return gdk_content_formats_builder_free (builder);
|
||||
+ return gdk_content_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -510,12 +510,22 @@ gdk_content_formats_get_mime_types (GdkContentFormats *formats,
|
||||
|
||||
struct _GdkContentFormatsBuilder
|
||||
{
|
||||
+ int ref_count;
|
||||
+
|
||||
+ /* (element-type GType) */
|
||||
GSList *gtypes;
|
||||
gsize n_gtypes;
|
||||
+
|
||||
+ /* (element-type utf8) (interned) */
|
||||
GSList *mime_types;
|
||||
gsize n_mime_types;
|
||||
};
|
||||
|
||||
+G_DEFINE_BOXED_TYPE (GdkContentFormatsBuilder,
|
||||
+ gdk_content_formats_builder,
|
||||
+ gdk_content_formats_builder_ref,
|
||||
+ gdk_content_formats_builder_unref)
|
||||
+
|
||||
/**
|
||||
* gdk_content_formats_builder_new:
|
||||
*
|
||||
@@ -528,19 +538,106 @@ struct _GdkContentFormatsBuilder
|
||||
GdkContentFormatsBuilder *
|
||||
gdk_content_formats_builder_new (void)
|
||||
{
|
||||
- return g_slice_new0 (GdkContentFormatsBuilder);
|
||||
+ GdkContentFormatsBuilder *builder;
|
||||
+
|
||||
+ builder = g_slice_new0 (GdkContentFormatsBuilder);
|
||||
+ builder->ref_count = 1;
|
||||
+
|
||||
+ return builder;
|
||||
}
|
||||
|
||||
/**
|
||||
- * gdk_content_formats_builder_free:
|
||||
+ * gdk_content_formats_builder_ref:
|
||||
* @builder: a #GdkContentFormatsBuilder
|
||||
*
|
||||
- * Frees @builder and creates a new #GdkContentFormats from it.
|
||||
+ * Acquires a reference on the given @builder.
|
||||
*
|
||||
- * Returns: a new #GdkContentFormats with all the formats added to @builder
|
||||
- **/
|
||||
+ * This function is intended primarily for bindings. #GdkContentFormatsBuilder objects
|
||||
+ * should not be kept around.
|
||||
+ *
|
||||
+ * Returns: (transfer none): the given #GdkContentFormatsBuilder with
|
||||
+ * its reference count increased
|
||||
+ */
|
||||
+GdkContentFormatsBuilder *
|
||||
+gdk_content_formats_builder_ref (GdkContentFormatsBuilder *builder)
|
||||
+{
|
||||
+ g_return_val_if_fail (builder != NULL, NULL);
|
||||
+ g_return_val_if_fail (builder->ref_count > 0, NULL);
|
||||
+
|
||||
+ builder->ref_count += 1;
|
||||
+
|
||||
+ return builder;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+gdk_content_formats_builder_clear (GdkContentFormatsBuilder *builder)
|
||||
+{
|
||||
+ g_clear_pointer (&builder->gtypes, g_slist_free);
|
||||
+ g_clear_pointer (&builder->mime_types, g_slist_free);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * gdk_content_formats_builder_unref:
|
||||
+ * @builder: a #GdkContentFormatsBuilder
|
||||
+ *
|
||||
+ * Releases a reference on the given @builder.
|
||||
+ */
|
||||
+void
|
||||
+gdk_content_formats_builder_unref (GdkContentFormatsBuilder *builder)
|
||||
+{
|
||||
+ g_return_if_fail (builder != NULL);
|
||||
+ g_return_if_fail (builder->ref_count > 0);
|
||||
+
|
||||
+ builder->ref_count -= 1;
|
||||
+
|
||||
+ if (builder->ref_count > 0)
|
||||
+ return;
|
||||
+
|
||||
+ gdk_content_formats_builder_clear (builder);
|
||||
+ g_slice_free (GdkContentFormatsBuilder, builder);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * gdk_content_formats_builder_free_to_formats: (skip)
|
||||
+ * @builder: a #GdkContentFormatsBuilder
|
||||
+ *
|
||||
+ * Creates a new #GdkContentFormats from the current state of the
|
||||
+ * given @builder, and frees the @builder instance.
|
||||
+ *
|
||||
+ * Returns: (transfer full): the newly created #GdkContentFormats
|
||||
+ * with all the formats added to @builder
|
||||
+ */
|
||||
+GdkContentFormats *
|
||||
+gdk_content_formats_builder_free_to_formats (GdkContentFormatsBuilder *builder)
|
||||
+{
|
||||
+ GdkContentFormats *res;
|
||||
+
|
||||
+ g_return_val_if_fail (builder != NULL, NULL);
|
||||
+
|
||||
+ res = gdk_content_formats_builder_to_formats (builder);
|
||||
+
|
||||
+ gdk_content_formats_builder_unref (builder);
|
||||
+
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * gdk_content_formats_builder_to_formats:
|
||||
+ * @builder: a #GdkContentFormatsBuilder
|
||||
+ *
|
||||
+ * Creates a new #GdkContentFormats from the given @builder.
|
||||
+ *
|
||||
+ * The given #GdkContentFormatsBuilder is reset once this function returns;
|
||||
+ * you cannot call this function multiple times on the same @builder instance.
|
||||
+ *
|
||||
+ * This function is intended primarily for bindings. C code should use
|
||||
+ * gdk_content_formats_builder_free_to_formats().
|
||||
+ *
|
||||
+ * Returns: (transfer full): the newly created #GdkContentFormats
|
||||
+ * with all the formats added to @builder
|
||||
+ */
|
||||
GdkContentFormats *
|
||||
-gdk_content_formats_builder_free (GdkContentFormatsBuilder *builder)
|
||||
+gdk_content_formats_builder_to_formats (GdkContentFormatsBuilder *builder)
|
||||
{
|
||||
GdkContentFormats *result;
|
||||
GType *gtypes;
|
||||
@@ -567,9 +664,7 @@ gdk_content_formats_builder_free (GdkContentFormatsBuilder *builder)
|
||||
result = gdk_content_formats_new_take (gtypes, builder->n_gtypes,
|
||||
mime_types, builder->n_mime_types);
|
||||
|
||||
- g_slist_free (builder->gtypes);
|
||||
- g_slist_free (builder->mime_types);
|
||||
- g_slice_free (GdkContentFormatsBuilder, builder);
|
||||
+ gdk_content_formats_builder_clear (builder);
|
||||
|
||||
return result;
|
||||
}
|
||||
diff --git a/gdk/gdkcontentformats.h b/gdk/gdkcontentformats.h
|
||||
index 58bbb10..a383434 100644
|
||||
--- a/gdk/gdkcontentformats.h
|
||||
+++ b/gdk/gdkcontentformats.h
|
||||
@@ -77,12 +77,23 @@ GDK_AVAILABLE_IN_3_94
|
||||
gboolean gdk_content_formats_contain_mime_type (const GdkContentFormats *formats,
|
||||
const char *mime_type);
|
||||
|
||||
+#define GDK_TYPE_CONTENT_FORMATS_BUILDER (gdk_content_formats_builder_get_type ())
|
||||
+
|
||||
typedef struct _GdkContentFormatsBuilder GdkContentFormatsBuilder;
|
||||
|
||||
GDK_AVAILABLE_IN_3_94
|
||||
-GdkContentFormatsBuilder*gdk_content_formats_builder_new (void);
|
||||
+GType gdk_content_formats_builder_get_type (void) G_GNUC_CONST;
|
||||
+
|
||||
+GDK_AVAILABLE_IN_3_94
|
||||
+GdkContentFormatsBuilder *gdk_content_formats_builder_new (void);
|
||||
+GDK_AVAILABLE_IN_3_94
|
||||
+GdkContentFormatsBuilder *gdk_content_formats_builder_ref (GdkContentFormatsBuilder *builder);
|
||||
+GDK_AVAILABLE_IN_3_94
|
||||
+void gdk_content_formats_builder_unref (GdkContentFormatsBuilder *builder);
|
||||
+GDK_AVAILABLE_IN_3_94
|
||||
+GdkContentFormats * gdk_content_formats_builder_free_to_formats (GdkContentFormatsBuilder *builder) G_GNUC_WARN_UNUSED_RESULT;
|
||||
GDK_AVAILABLE_IN_3_94
|
||||
-GdkContentFormats * gdk_content_formats_builder_free (GdkContentFormatsBuilder *builder) G_GNUC_WARN_UNUSED_RESULT;
|
||||
+GdkContentFormats * gdk_content_formats_builder_to_formats (GdkContentFormatsBuilder *builder) G_GNUC_WARN_UNUSED_RESULT;
|
||||
GDK_AVAILABLE_IN_3_94
|
||||
void gdk_content_formats_builder_add_formats (GdkContentFormatsBuilder *builder,
|
||||
const GdkContentFormats *formats);
|
||||
diff --git a/gdk/gdkcontentproviderimpl.c b/gdk/gdkcontentproviderimpl.c
|
||||
index 9ae14e0..e7b70c2 100644
|
||||
--- a/gdk/gdkcontentproviderimpl.c
|
||||
+++ b/gdk/gdkcontentproviderimpl.c
|
||||
@@ -168,7 +168,7 @@ gdk_content_provider_bytes_ref_formats (GdkContentProvider *provider)
|
||||
|
||||
builder = gdk_content_formats_builder_new ();
|
||||
gdk_content_formats_builder_add_mime_type (builder, content->mime_type);
|
||||
- return gdk_content_formats_builder_free (builder);
|
||||
+ return gdk_content_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/gdk/gdkcontentserializer.c b/gdk/gdkcontentserializer.c
|
||||
index 843c613..92cbb2d 100644
|
||||
--- a/gdk/gdkcontentserializer.c
|
||||
+++ b/gdk/gdkcontentserializer.c
|
||||
@@ -461,7 +461,7 @@ gdk_content_formats_union_serialize_gtypes (GdkContentFormats *formats)
|
||||
|
||||
gdk_content_formats_unref (formats);
|
||||
|
||||
- return gdk_content_formats_builder_free (builder);
|
||||
+ return gdk_content_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -496,7 +496,7 @@ gdk_content_formats_union_serialize_mime_types (GdkContentFormats *formats)
|
||||
|
||||
gdk_content_formats_unref (formats);
|
||||
|
||||
- return gdk_content_formats_builder_free (builder);
|
||||
+ return gdk_content_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/gdk/wayland/gdkprimary-wayland.c b/gdk/wayland/gdkprimary-wayland.c
|
||||
index 89f02e6..62a6941 100644
|
||||
--- a/gdk/wayland/gdkprimary-wayland.c
|
||||
+++ b/gdk/wayland/gdkprimary-wayland.c
|
||||
@@ -58,7 +58,7 @@ gdk_wayland_primary_discard_pending (GdkWaylandPrimary *cb)
|
||||
{
|
||||
if (cb->pending_builder)
|
||||
{
|
||||
- GdkContentFormats *ignore = gdk_content_formats_builder_free (cb->pending_builder);
|
||||
+ GdkContentFormats *ignore = gdk_content_formats_builder_free_to_formats (cb->pending_builder);
|
||||
gdk_content_formats_unref (ignore);
|
||||
cb->pending_builder = NULL;
|
||||
}
|
||||
@@ -178,7 +178,7 @@ primary_selection_selection (void *data,
|
||||
return;
|
||||
}
|
||||
|
||||
- formats = gdk_content_formats_builder_free (cb->pending_builder);
|
||||
+ formats = gdk_content_formats_builder_free_to_formats (cb->pending_builder);
|
||||
cb->pending_builder = NULL;
|
||||
cb->pending = NULL;
|
||||
|
||||
diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c
|
||||
index 0db6bad..9f7826e 100644
|
||||
--- a/gdk/wayland/gdkselection-wayland.c
|
||||
+++ b/gdk/wayland/gdkselection-wayland.c
|
||||
@@ -124,7 +124,7 @@ data_offer_offer (void *data,
|
||||
gdk_content_formats_builder_add_formats (builder, info->targets);
|
||||
gdk_content_formats_builder_add_mime_type (builder, type);
|
||||
gdk_content_formats_unref (info->targets);
|
||||
- info->targets = gdk_content_formats_builder_free (builder);
|
||||
+ info->targets = gdk_content_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
static inline GdkDragAction
|
||||
diff --git a/gdk/win32/gdkdnd-win32.c b/gdk/win32/gdkdnd-win32.c
|
||||
index 190386c..1d844a8 100644
|
||||
--- a/gdk/win32/gdkdnd-win32.c
|
||||
+++ b/gdk/win32/gdkdnd-win32.c
|
||||
@@ -552,7 +552,7 @@ query_targets (LPDATAOBJECT pDataObj,
|
||||
for (p = g_list_reverse (result); p; p = p->next)
|
||||
gdk_content_formats_builder_add_mime_type (builder, (const gchar *) p->data);
|
||||
|
||||
- result_formats = gdk_content_formats_builder_free (builder);
|
||||
+ result_formats = gdk_content_formats_builder_free_to_formats (builder);
|
||||
g_list_free (result);
|
||||
|
||||
return result_formats;
|
||||
diff --git a/gdk/x11/gdkclipboard-x11.c b/gdk/x11/gdkclipboard-x11.c
|
||||
index 02a0b4e..c7b3780 100644
|
||||
--- a/gdk/x11/gdkclipboard-x11.c
|
||||
+++ b/gdk/x11/gdkclipboard-x11.c
|
||||
@@ -243,7 +243,7 @@ gdk_x11_clipboard_formats_from_atoms (GdkDisplay *display,
|
||||
}
|
||||
}
|
||||
|
||||
- return gdk_content_formats_builder_free (builder);
|
||||
+ return gdk_content_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
static void
|
||||
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
|
||||
index 66dbd02..5dc56a7 100644
|
||||
--- a/gtk/gtkselection.c
|
||||
+++ b/gtk/gtkselection.c
|
||||
@@ -176,7 +176,7 @@ gtk_content_formats_add_text_targets (GdkContentFormats *list)
|
||||
gdk_content_formats_builder_add_mime_type (builder, text_plain_locale_atom);
|
||||
gdk_content_formats_builder_add_mime_type (builder, text_plain_atom);
|
||||
|
||||
- return gdk_content_formats_builder_free (builder);
|
||||
+ return gdk_content_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,7 +243,7 @@ gtk_content_formats_add_image_targets (GdkContentFormats *list,
|
||||
|
||||
g_slist_free (formats);
|
||||
|
||||
- return gdk_content_formats_builder_free (builder);
|
||||
+ return gdk_content_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -270,7 +270,7 @@ gtk_content_formats_add_uri_targets (GdkContentFormats *list)
|
||||
|
||||
gdk_content_formats_builder_add_mime_type (builder, text_uri_list_atom);
|
||||
|
||||
- return gdk_content_formats_builder_free (builder);
|
||||
+ return gdk_content_formats_builder_free_to_formats (builder);
|
||||
}
|
||||
|
||||
/**
|
||||
--
|
||||
libgit2 0.26.0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user