[geany/geany] 9c2b7d: Remove some more GTK2 occurrences and adjust a few comments

Colomban Wendling git-noreply at xxxxx
Sat May 29 12:20:47 UTC 2021


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Mon, 02 Nov 2020 13:45:44 UTC
Commit:      9c2b7da3f58474285338696bf0617c79bd3ee45c
             https://github.com/geany/geany/commit/9c2b7da3f58474285338696bf0617c79bd3ee45c

Log Message:
-----------
Remove some more GTK2 occurrences and adjust a few comments


Modified Paths:
--------------
    .travis.yml
    HACKING
    doc/plugins.dox
    plugins/splitwindow.c
    scripts/gtk-bundle-from-msys2.sh
    src/geanywraplabel.c
    src/gtkcompat.h
    src/msgwindow.c
    src/plugindata.h
    src/stash.c
    src/ui_utils.c
    src/vte.c

Modified: .travis.yml
3 lines changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -26,9 +26,10 @@ script:
   - NOCONFIGURE=1 ./autogen.sh
   - >
     if [ -n "$MINGW" ]; then
+      unset CC CXX;
       sh ./scripts/cross-build-mingw.sh;
     else
-      CONFIGURE_FLAGS="--enable-gtk2=$GTK2 --enable-binreloc=$BINRELOC";
+      CONFIGURE_FLAGS="--enable-binreloc=$BINRELOC";
       mkdir _build                        &&
       cd _build                           &&
       { ../configure $CONFIGURE_FLAGS || { cat config.log; exit 1; } ; } &&


Modified: HACKING
12 lines changed, 6 insertions(+), 6 deletions(-)
===================================================================
@@ -167,11 +167,11 @@ unmanageable diffs.
 
 GTK versions & API documentation
 --------------------------------
-Geany requires GTK >= 2.24 or GTK 3 (with the --enable-gtk3 configure option)
-and GLib >= 2.32. API symbols from newer GTK/GLib versions should be 
-avoided or made optional to keep the source code building on older systems.
+Geany requires GTK >= 3.0 and GLib >= 2.32. API symbols from newer GTK/GLib
+versions should be avoided or made optional to keep the source code building
+on older systems.
 
-It is recommended to use the 2.24 API documentation of the GTK
+It is recommended to use the 3.0 API documentation of the GTK
 libs (including GLib, GDK and Pango) has the advantages
 that you don't get confused by any newer API additions and you
 don't have to take care about whether you can use them or not.
@@ -196,8 +196,8 @@ Coding
   them down into smaller static functions where possible. This makes code
   much easier to read and maintain.
 * Use GLib types and functions - gint not int, g_free() not free().
-* Your code should build against GLib 2.32 and GTK 2.24. At least for the
-  moment, we want to keep the minimum requirement for GTK at 2.24 (of
+* Your code should build against GLib 2.32 and GTK 3.0. At least for the
+  moment, we want to keep the minimum requirement for GTK at 3.0 (of
   course, you can use the GTK_CHECK_VERSION macro to protect code using
   later versions).
 * Variables should be declared (and initialized) as close as practical


Modified: doc/plugins.dox
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -159,7 +159,7 @@ following.
 First you need to have Geany installed. Then install the development files for GTK
 and its dependencies. The easiest way to do this is to use your distribution's package
 management system, e.g. on Debian and Ubuntu systems you can use
- at code apt-get install libgtk2.0-dev intltool @endcode
+ at code apt-get install libgtk-3-dev intltool @endcode
 This will install all necessary files to be able to compile plugins for Geany. On other
 distributions, the package names and commands to use may differ.
 


Modified: plugins/splitwindow.c
4 lines changed, 0 insertions(+), 4 deletions(-)
===================================================================
@@ -256,7 +256,6 @@ static void on_doc_show_menu(GtkMenuToolButton *button, GtkMenu *menu)
 }
 
 
-#if GTK_CHECK_VERSION(3, 0, 0)
 /* Blocks the ::show-menu signal if the menu's parent toggle button was inactive in the previous run.
  * This is a hack to workaround https://bugzilla.gnome.org/show_bug.cgi?id=769287
  * and should NOT be used for any other version than 3.15.9 to 3.21.4, although the code tries and
@@ -281,7 +280,6 @@ static void show_menu_gtk316_fix(GtkMenuToolButton *button, gpointer data)
 			block_next = TRUE;
 	}
 }
-#endif
 
 
 static GtkWidget *create_toolbar(void)
@@ -302,11 +300,9 @@ static GtkWidget *create_toolbar(void)
 
 	item = gtk_menu_new();
 	gtk_menu_tool_button_set_menu(GTK_MENU_TOOL_BUTTON(tool_item), item);
-#if GTK_CHECK_VERSION (3, 0, 0)
 	/* hack for https://bugzilla.gnome.org/show_bug.cgi?id=769287 */
 	if (! gtk_check_version(3, 15, 9) && gtk_check_version(3, 21, 4+1))
 		g_signal_connect(tool_item, "show-menu", G_CALLBACK(show_menu_gtk316_fix), NULL);
-#endif
 	g_signal_connect(tool_item, "show-menu", G_CALLBACK(on_doc_show_menu), item);
 
 	tool_item = gtk_tool_item_new();


Modified: scripts/gtk-bundle-from-msys2.sh
8 lines changed, 1 insertions(+), 7 deletions(-)
===================================================================
@@ -18,7 +18,6 @@ UNX_UTILS_URL="https://download.geany.org/contrib/UnxUpdates.zip"
 MSYS2_ABI_PATH="/c/msys32"
 
 package_urls=""
-gtk2_dependency_pkgs=""
 gtk3_dependency_pkgs="
 libepoxy
 hicolor-icon-theme
@@ -61,23 +60,19 @@ handle_command_line_options() {
 		"-z"|"--zip")
 			make_zip="yes"
 			;;
-		"-2")
-			gtkv="2"
-			;;
 		"-3")
 			gtkv="3"
 			;;
 		"-n")
 			run_pi=""
 			;;
 		"-h"|"--help")
-			echo "gtk-bundle-from-msys2.sh [-c] [-h] [-n] [-z] [-2 | -3] [CACHEDIR]"
+			echo "gtk-bundle-from-msys2.sh [-c] [-h] [-n] [-z] [-3] [CACHEDIR]"
 			echo "      -c Use pacman cache. Otherwise pacman will download"
 			echo "         archive files"
 			echo "      -h Show this help screen"
 			echo "      -n Do not run post install scripts of the packages"
 			echo "      -z Create a zip afterwards"
-			echo "      -2 Prefer gtk2"
 			echo "      -3 Prefer gtk3"
 			echo "CACHEDIR Directory where to look for cached packages (default: /var/cache/pacman/pkg)"
 			exit 1
@@ -199,7 +194,6 @@ cleanup_unnecessary_files() {
 	rm -rf share/glib-2.0/gdb
 	rm -rf share/glib-2.0/gettext
 	rm -rf share/graphite2
-	rm -rf share/gtk-2.0
 	rm -rf share/gtk-3.0
 	rm -rf share/gtk-doc
 	rm -rf share/info


Modified: src/geanywraplabel.c
1 lines changed, 0 insertions(+), 1 deletions(-)
===================================================================
@@ -58,7 +58,6 @@ static void geany_wrap_label_get_preferred_width_for_height (GtkWidget *widget,
 static void geany_wrap_label_get_preferred_height_for_width (GtkWidget *widget,
 		gint width, gint *minimal_height, gint *natural_height);
 static GtkSizeRequestMode geany_wrap_label_get_request_mode(GtkWidget *widget);
-
 static void geany_wrap_label_size_allocate	(GtkWidget *widget, GtkAllocation *alloc);
 static void geany_wrap_label_set_wrap_width	(GtkWidget *widget, gint width);
 static void geany_wrap_label_label_notify	(GObject *object, GParamSpec *pspec, gpointer data);


Modified: src/gtkcompat.h
3 lines changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -20,7 +20,8 @@
 
 /* Compatibility macros to support older GTK+ versions
  * 
- * TODO: This file can be removed once the code is updated to use GTK3 keysyms.
+ * Although this file might not be useful anymore, it might be used by plugins
+ * so it cannot be removed without care.
  */
 
 #ifndef GTK_COMPAT_H


Modified: src/msgwindow.c
10 lines changed, 0 insertions(+), 10 deletions(-)
===================================================================
@@ -120,7 +120,6 @@ void msgwin_set_messages_dir(const gchar *messages_dir)
 
 static void load_color(const gchar *color_name, GdkColor *color)
 {
-#if GTK_CHECK_VERSION(3, 0, 0)
 	GdkRGBA rgba_color;
 	GtkWidgetPath *path = gtk_widget_path_new();
 	GtkStyleContext *ctx = gtk_style_context_new();
@@ -137,15 +136,6 @@ static void load_color(const gchar *color_name, GdkColor *color)
 
 	gtk_widget_path_unref(path);
 	g_object_unref(ctx);
-#else
-	gchar *path = g_strconcat("*.", color_name, NULL);
-
-	GtkSettings *settings = gtk_settings_get_default();
-	GtkStyle *style = gtk_rc_get_style_by_paths(settings, path, NULL, GTK_TYPE_WIDGET);
-	*color = style->fg[GTK_STATE_NORMAL];
-
-	g_free(path);
-#endif
 }
 
 


Modified: src/plugindata.h
6 lines changed, 3 insertions(+), 3 deletions(-)
===================================================================
@@ -60,9 +60,9 @@ G_BEGIN_DECLS
  */
 #define GEANY_API_VERSION 239
 
-
-/* when gtk2 and gtk3 were both supported at the same time this was used
- * to prevent loading gtk2 plugins with gtk3 Geany or vice versa. */
+/* hack to have a different ABI when built with different GTK major versions
+ * because loading plugins linked to a different one leads to crashes.
+ * Only GTK3 is currently supported. */
 #define GEANY_ABI_SHIFT 8
 /** The Application Binary Interface (ABI) version, incremented whenever
  * existing fields in the plugin data types have to be changed or reordered.


Modified: src/stash.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -83,9 +83,9 @@
 #include <stdlib.h> /* only for atoi() */
 
 
+/* GTK3 removed ComboBoxEntry, but we need a value to differentiate combo box with and
+ * without entries, and it must not collide with other GTypes */
 #define TYPE_COMBO_BOX_ENTRY get_combo_box_entry_type()
-
-
 static GType get_combo_box_entry_type(void)
 {
 	static volatile gsize type = 0;


Modified: src/ui_utils.c
1 lines changed, 0 insertions(+), 1 deletions(-)
===================================================================
@@ -2525,7 +2525,6 @@ static void load_css_theme(const gchar *fn, guint priority)
 }
 
 
-// see setup_gtk2_styles() in libmain.c for GTK+ 2-specific theme initialization
 static void init_css_styles(void)
 {
 	gchar *theme_fn;


Modified: src/vte.c
6 lines changed, 2 insertions(+), 4 deletions(-)
===================================================================
@@ -199,7 +199,7 @@ static void rgba_from_color(GdkRGBA *rgba, const GdkColor *color)
 	rgba->alpha = 1.0;
 }
 
-#	define WRAP_RGBA_SETTER(name) \
+#define WRAP_RGBA_SETTER(name) \
 	static void wrap_##name(VteTerminal *terminal, const GdkColor *color) \
 	{ \
 		GdkRGBA rgba; \
@@ -272,11 +272,9 @@ void vte_init(void)
 #ifdef __APPLE__
 			"libvte-2.91.0.dylib", "libvte-2.91.dylib",
 			"libvte2_90.9.dylib", "libvte2_90.dylib",
-#else
+#endif
 			"libvte-2.91.so", "libvte-2.91.so.0",
 			"libvte2_90.so", "libvte2_90.so.9",
-			"libvte.so", "libvte.so.9", "libvte.so.8", "libvte.so.4",
-#endif
 			NULL
 		};
 



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list