From 9a6df8ca298e7bfee9afdff79dac6f58d6b9b247 Mon Sep 17 00:00:00 2001
From: "Daniel M. Capella" <polyzen@archlinux.org>
Date: Fri, 20 Oct 2023 19:55:29 -0400
Subject: [PATCH] gtk: s/2/3/

---
 Makefile.am                                   |  8 ++---
 README                                        |  6 ++--
 TODO                                          |  4 +--
 autogen.rc                                    |  2 +-
 configure.ac                                  | 32 +++++++++----------
 doc/pinentry.texi                             |  4 +--
 efl/pinentry-efl.c                            |  2 +-
 {gtk+-2 => gtk+}/Makefile.am                  |  8 ++---
 .../pinentry-gtk-2.c => gtk+/pinentry-gtk.c   |  6 ++--
 9 files changed, 36 insertions(+), 36 deletions(-)
 rename {gtk+-2 => gtk+}/Makefile.am (86%)
 rename gtk+-2/pinentry-gtk-2.c => gtk+/pinentry-gtk.c (99%)

diff --git a/Makefile.am b/Makefile.am
index bbe6ee3..2961ea8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,10 +46,10 @@ else
 pinentry_emacs =
 endif
 
-if BUILD_PINENTRY_GTK_2
-pinentry_gtk_2 = gtk+-2
+if BUILD_PINENTRY_GTK
+pinentry_gtk = gtk+
 else
-pinentry_gtk_2 =
+pinentry_gtk =
 endif
 
 if BUILD_PINENTRY_GNOME_3
@@ -101,7 +101,7 @@ doc =
 endif
 
 SUBDIRS = m4 secmem pinentry ${pinentry_curses} ${pinentry_tty} \
-	${pinentry_emacs} ${pinentry_gtk_2} ${pinentry_gnome_3} \
+	${pinentry_emacs} ${pinentry_gtk} ${pinentry_gnome_3} \
 	${pinentry_qt} ${pinentry_qt5} ${pinentry_qt4}  ${pinentry_tqt} ${pinentry_w32} \
 	${pinentry_fltk} ${pinentry_efl} ${doc}
 
diff --git a/README b/README
index d946ff3..841fc88 100644
--- a/README
+++ b/README
@@ -10,8 +10,8 @@ be requested explicitly.
 
 GUI		OPTION			 DEPENDENCIES
 --------------------------------------------------------------------------
-GTK+ V2.0	--enable-pinentry-gtk2	 Gimp Toolkit Library, Version 2.0
-					 eg. libgtk-x11-2.0 and libglib-2.0
+GTK+ V3.0	--enable-pinentry-gtk	 Gimp Toolkit Library, Version 3.0
+					 eg. libgtk-3 and libglib-2.0
 GNOME           --enable-pinentry-gnome  GNOME
 Qt		--enable-pinentry-qt	 Qt (> 4.4.0)
 TQt		--enable-pinentry-tqt	 Trinity Qt
@@ -29,7 +29,7 @@ pass --disable-fallback-curses to the configure script as well.
 
 Examples:
 * To only build the GTK+ pinentry with curses support:
-./configure --enable-pinentry-gtk2 --enable-fallback-curses \
+./configure --enable-pinentry-gtk --enable-fallback-curses \
 	--disable-pinentry-curses --disable-pinentry-qt
 
 * To build the Qt pinentry, and the other pinentries if they are
diff --git a/TODO b/TODO
index e287c4c..9513592 100644
--- a/TODO
+++ b/TODO
@@ -14,11 +14,11 @@
 * A heartbeat status message should be sent every few seconds, so that
   the gpg-agent is better able to cope with jammed pinentries.
 
-* The gtk+-2 pinentry needs auditing.
+* The gtk+ pinentry needs auditing.
 
 * Implement the one_button feature in Qt.
 
 * The format of the Assuan protocol description should be changed to
   the one used by GnuPG.
   
-* The SETTITLE command is only implemented for GTK+-2
+* The SETTITLE command is only implemented for GTK+
diff --git a/autogen.rc b/autogen.rc
index 46a5f44..5016277 100644
--- a/autogen.rc
+++ b/autogen.rc
@@ -4,7 +4,7 @@
 
 case "$myhost:$myhostsub" in
   w32:ce)
-    extraoptions="--disable-pinentry-gtk2 --disable-pinentry-qt"
+    extraoptions="--disable-pinentry-gtk --disable-pinentry-qt"
     ;;
   w32:)
     extraoptions=""
diff --git a/configure.ac b/configure.ac
index cb4e43f..4d34431 100644
--- a/configure.ac
+++ b/configure.ac
@@ -431,32 +431,32 @@ fi
 AM_CONDITIONAL(BUILD_PINENTRY_EFL, test "$pinentry_efl" = "yes")
 
 dnl
-dnl Check for GTK+-2 / GNOME3 pinentry programs.
+dnl Check for GTK+-3 / GNOME3 pinentry programs.
 dnl
-AC_ARG_ENABLE(pinentry-gtk2,
-            AS_HELP_STRING([--enable-pinentry-gtk2],[build GTK+-2 pinentry]),
-            pinentry_gtk_2=$enableval, pinentry_gtk_2=maybe)
+AC_ARG_ENABLE(pinentry-gtk,
+            AS_HELP_STRING([--enable-pinentry-gtk],[build GTK+-3 pinentry]),
+            pinentry_gtk=$enableval, pinentry_gtk=maybe)
 
 AC_ARG_ENABLE(pinentry-gnome3,
             AS_HELP_STRING([--enable-pinentry-gnome3],[build GNOME 3 pinentry]),
             pinentry_gnome_3=$enableval, pinentry_gnome_3=maybe)
 
-dnl check if the module gtk+-2.0 exists
-if test "$pinentry_gtk_2" != "no"; then
+dnl check if the module gtk+-3.0 exists
+if test "$pinentry_gtk" != "no"; then
 	PKG_CHECK_MODULES(
-		GTK2,
-		[gtk+-2.0 >= 2.12.0],
+		GTK3,
+		[gtk+-3.0 >= 3.0.0],
 		[
-			test "$pinentry_gtk_2" != "no" && pinentry_gtk_2=yes
+			test "$pinentry_gtk" != "no" && pinentry_gtk=yes
 			test "$pinentry_gnome_3" != "no" && pinentry_gnome_3=yes
 		],
 		[
-			AC_MSG_WARN([pkg-config could not find the module gtk+-2.0])
-			pinentry_gtk_2=no
+			AC_MSG_WARN([pkg-config could not find the module gtk+-3.0])
+			pinentry_gtk=no
 		]
 	)
 fi
-AM_CONDITIONAL(BUILD_PINENTRY_GTK_2, test "$pinentry_gtk_2" = "yes")
+AM_CONDITIONAL(BUILD_PINENTRY_GTK, test "$pinentry_gtk" = "yes")
 
 if test "$pinentry_gnome_3" != "no"; then
 	PKG_CHECK_MODULES(
@@ -719,8 +719,8 @@ AM_CONDITIONAL(BUILD_PINENTRY_FLTK, test "$pinentry_fltk" = "yes")
 # Please change the order only after verifying that the preferred
 # pinentry really is better (more feature-complete and more secure).
 
-if test "$pinentry_gtk_2" = "yes"; then
-  PINENTRY_DEFAULT=pinentry-gtk-2
+if test "$pinentry_gtk" = "yes"; then
+  PINENTRY_DEFAULT=pinentry-gtk
 else
   if test "$pinentry_qt" = "yes"; then
     PINENTRY_DEFAULT=pinentry-qt
@@ -835,7 +835,7 @@ curses/Makefile
 tty/Makefile
 efl/Makefile
 emacs/Makefile
-gtk+-2/Makefile
+gtk+/Makefile
 gnome3/Makefile
 qt/Makefile
 qt/icons/Makefile
@@ -860,7 +860,7 @@ AC_MSG_NOTICE([
 	TTY Pinentry .....: $pinentry_tty
 	Emacs Pinentry ...: $pinentry_emacs
 	EFL Pinentry .....: $pinentry_efl
-	GTK+-2 Pinentry ..: $pinentry_gtk_2
+	GTK+-3 Pinentry ..: $pinentry_gtk
 	GNOME 3 Pinentry .: $pinentry_gnome_3
 	Qt5 Pinentry .....: $pinentry_qt
 	Qt4 Pinentry .....: $pinentry_qt4
diff --git a/doc/pinentry.texi b/doc/pinentry.texi
index 1172890..29d6c61 100644
--- a/doc/pinentry.texi
+++ b/doc/pinentry.texi
@@ -214,7 +214,7 @@ options using Assuan protocol options.
 @chapter Front Ends
 
 There are several different flavors of @pinentry{}.  Concretely, there
-are Gtk+2, Qt@tie{}4/5/6, TQt, EFL, FLTK, Gnome@tie{}3, Emacs, curses and
+are Gtk+3, Qt@tie{}4/5/6, TQt, EFL, FLTK, Gnome@tie{}3, Emacs, curses and
 tty variants.  These different implementations provide higher levels
 of integration with a specific environment.  For instance, the
 Gnome@tie{}3 @pinentry{} uses Gnome@tie{}3 widgets to display the
@@ -255,7 +255,7 @@ running, the generic @pinentry{} backend checks if a
 @pinentry{}-enabled Emacs should be used.  Specifically, it looks to
 see if the @code{INSIDE_EMACS} variable is set and then attempts to
 establish a connection to the specified address.  If this is the case,
-then instead of, e.g., @code{pinentry-gtk2} displaying a Gtk+2
+then instead of, e.g., @code{pinentry-gtk} displaying a Gtk+3
 pinentry, it interacts with the Emacs session.  This functionality can
 be explicitly disabled by passing @code{--disable-inside-emacs} to
 @code{configure} when building @pinentry{}.
diff --git a/efl/pinentry-efl.c b/efl/pinentry-efl.c
index 58796ba..25c494d 100644
--- a/efl/pinentry-efl.c
+++ b/efl/pinentry-efl.c
@@ -2,7 +2,7 @@
    Copyright (C) 2017 Obsidian-Studios, Inc.
      Author William L. Thomson Jr. <wlt@o-sinc.com>
 
-   Based on pinentry-gtk2.c
+   Based on pinentry-gtk.c
    Copyright (C) 1999 Robert Bihlmeyer <robbe@orcus.priv.at>
    Copyright (C) 2001, 2002, 2007, 2015 g10 Code GmbH
    Copyright (C) 2004 by Albrecht Dreß <albrecht.dress@arcor.de>
diff --git a/gtk+-2/Makefile.am b/gtk+/Makefile.am
similarity index 86%
rename from gtk+-2/Makefile.am
rename to gtk+/Makefile.am
index 0523b0b..b578ae8 100644
--- a/gtk+-2/Makefile.am
+++ b/gtk+/Makefile.am
@@ -19,7 +19,7 @@
 
 ## Process this file with automake to produce Makefile.in
 
-bin_PROGRAMS = pinentry-gtk-2
+bin_PROGRAMS = pinentry-gtk
 
 if FALLBACK_CURSES
 ncurses_include = $(NCURSES_INCLUDE)
@@ -29,9 +29,9 @@ ncurses_include =
 libcurses =
 endif
 
-AM_CPPFLAGS = $(COMMON_CFLAGS) $(GTK2_CFLAGS) $(ncurses_include) \
+AM_CPPFLAGS = $(COMMON_CFLAGS) $(GTK3_CFLAGS) $(ncurses_include) \
 	-I$(top_srcdir)/secmem -I$(top_srcdir)/pinentry
 LDADD = ../pinentry/libpinentry.a ../secmem/libsecmem.a \
-	$(COMMON_LIBS) $(GTK2_LIBS) $(libcurses)
+	$(COMMON_LIBS) $(GTK3_LIBS) $(libcurses)
 
-pinentry_gtk_2_SOURCES = pinentry-gtk-2.c
+pinentry_gtk_SOURCES = pinentry-gtk.c
diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+/pinentry-gtk.c
similarity index 99%
rename from gtk+-2/pinentry-gtk-2.c
rename to gtk+/pinentry-gtk.c
index 32112ae..19dfecb 100644
--- a/gtk+-2/pinentry-gtk-2.c
+++ b/gtk+/pinentry-gtk.c
@@ -1,9 +1,9 @@
-/* pinentry-gtk-2.c
+/* pinentry-gtk.c
  * Copyright (C) 1999 Robert Bihlmeyer <robbe@orcus.priv.at>
  * Copyright (C) 2001, 2002, 2007, 2015 g10 Code GmbH
  * Copyright (C) 2004 by Albrecht Dreß <albrecht.dress@arcor.de>
  *
- * pinentry-gtk-2 is a pinentry application for the Gtk+-2 widget set.
+ * pinentry-gtk is a pinentry application for the Gtk+-3 widget set.
  * It tries to follow the Gnome Human Interface Guide as close as
  * possible.
  *
@@ -54,7 +54,7 @@
 #endif
 
 
-#define PGMNAME "pinentry-gtk2"
+#define PGMNAME "pinentry-gtk"
 
 #ifndef VERSION
 #  define VERSION
-- 
2.42.0

