apply upstream patch from Jonh Wendell to fix g_ptr_array_find types

This commit is contained in:
Karsten Hopp 2017-10-02 16:14:29 +02:00
parent e57626b633
commit 036b9d1b80
3 changed files with 124 additions and 1 deletions

View File

@ -0,0 +1,92 @@
From 8a73d114ca5b4d37a770d0b6b69dd17a366dbcf4 Mon Sep 17 00:00:00 2001
From: Jonh Wendell <jonh.wendell@redhat.com>
Date: Thu, 4 May 2017 11:05:48 -0300
Subject: Use g_ptr_array_find() from GLib
https://bugzilla.gnome.org/show_bug.cgi?id=782161
---
configure.ac | 2 ++
gladeui/glade-signal-model.c | 30 ++++++++++--------------------
2 files changed, 12 insertions(+), 20 deletions(-)
diff --git a/configure.ac b/configure.ac
index ac59f096..db7487ef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,8 +146,10 @@ dnl ================================================================
dnl Check for gtk+
dnl ================================================================
GTK_REQUIRED=3.20.0
+GLIB_REQUIRED=2.53.2
PKG_CHECK_MODULES([GTK],[
gtk+-3.0 >= $GTK_REQUIRED
+ glib-2.0 >= $GLIB_REQUIRED
gmodule-2.0
libxml-2.0 >= 2.4.0
])
diff --git a/gladeui/glade-signal-model.c b/gladeui/glade-signal-model.c
index 2b383e51..4d1a8a40 100644
--- a/gladeui/glade-signal-model.c
+++ b/gladeui/glade-signal-model.c
@@ -64,18 +64,6 @@ G_DEFINE_TYPE_WITH_CODE (GladeSignalModel, glade_signal_model, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE,
gtk_tree_drag_source_iface_init))
-static gint
-g_ptr_array_find (GPtrArray *array, gpointer data)
-{
- gint i;
- for (i = 0; i < array->len; i++)
- {
- if (array->pdata[i] == data)
- return i;
- }
- return -1;
-}
-
static void
glade_signal_model_init (GladeSignalModel *object)
{
@@ -524,13 +512,11 @@ glade_signal_model_get_path (GtkTreeModel *model, GtkTreeIter *iter)
{
if (handlers)
{
- gint handler_index = g_ptr_array_find (handlers, handler);
- if (handler_index == -1) /* dummy handler */
- {
- index1 += handlers->len;
- }
- else
+ guint handler_index;
+ if (g_ptr_array_find (handlers, handler, &handler_index))
index1 += handler_index;
+ else
+ index1 += handlers->len;
}
break;
}
@@ -582,7 +568,8 @@ glade_signal_model_get_value (GtkTreeModel *model,
{
GPtrArray *handlers = g_hash_table_lookup (sig_model->priv->signals,
glade_signal_get_name (signal));
- if (!handlers || !handlers->len || g_ptr_array_find (handlers, signal) == 0)
+ guint index;
+ if (!handlers || !handlers->len || (g_ptr_array_find (handlers, signal, &index) && index == 0))
g_value_set_boolean (value, TRUE);
else
g_value_set_boolean (value, FALSE);
@@ -718,7 +705,10 @@ glade_signal_model_iter_next (GtkTreeModel *model, GtkTreeIter *iter)
}
else if (handlers)
{
- gint new_index = g_ptr_array_find (handlers, handler) + 1;
+ guint new_index = 0;
+ if (g_ptr_array_find (handlers, handler, &new_index))
+ new_index++;
+
if (new_index < handlers->len)
{
glade_signal_model_create_signal_iter (sig_model, widget,
--
2.11.0

23
autoconf.patch Normal file
View File

@ -0,0 +1,23 @@
diff -up glade-3.20.0/configure.ac.p1 glade-3.20.0/configure.ac
--- glade-3.20.0/configure.ac.p1 2017-10-02 15:48:24.243448622 +0200
+++ glade-3.20.0/configure.ac 2017-10-02 15:49:15.858720809 +0200
@@ -79,8 +79,8 @@ AM_CONDITIONAL(GLADE_UNSTABLE, test "x$G
# ================================================================
-GNOME_DEBUG_CHECK
-GNOME_COMPILE_WARNINGS([maximum])
+# GNOME_DEBUG_CHECK
+# GNOME_COMPILE_WARNINGS([maximum])
GNOME_MAINTAINER_MODE_DEFINES
# For the plugins, we don't use the warning flags defined by GNOME_COMPILE_WARNINGS.
diff -up glade-3.20.0/help/Makefile.am.p1 glade-3.20.0/help/Makefile.am
--- glade-3.20.0/help/Makefile.am.p1 2017-10-02 16:07:37.786613104 +0200
+++ glade-3.20.0/help/Makefile.am 2017-10-02 16:07:32.768582631 +0200
@@ -1,4 +1,4 @@
-@YELP_HELP_RULES@
+# @YELP_HELP_RULES@
HELP_ID = glade

View File

@ -1,6 +1,6 @@
Name: glade
Version: 3.20.0
Release: 5%{?dist}
Release: 6%{?dist}
Summary: User Interface Designer for GTK+
# - /usr/bin/glade is GPLv2+
@ -10,6 +10,8 @@ Summary: User Interface Designer for GTK+
License: GPLv2+ and LGPLv2+
URL: http://glade.gnome.org/
Source0: http://ftp.gnome.org/pub/GNOME/sources/glade/3.20/glade-%{version}.tar.xz
Patch0: Use-g_ptr_array_find-from-GLib.patch
Patch1: autoconf.patch
BuildRequires: chrpath
BuildRequires: desktop-file-utils
@ -61,6 +63,8 @@ developing applications that use Glade widget library.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%build
@ -138,6 +142,10 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%doc %{_datadir}/gtk-doc/
%changelog
* Mon Oct 02 2017 Karsten Hopp <karsten@redhat.com> - 3.20.0-6
- apply upstream patch from Jonh Wendell to fix g_ptr_array_find types and make it
build with latest glib2
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.20.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild