Require GTK 4.10 and GLib 2.76

Wed, 19 Jul 2023 23:29:37 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Wed, 19 Jul 2023 23:29:37 -0500
changeset 42251
63639da06cbd
parent 42250
c2c0eb8398da
child 42252
d14dbdad20e8

Require GTK 4.10 and GLib 2.76

Due to the deprecations in GTK 4.10 we're moving to it immediately so that we
don't end up having to deal with deprecation warnings forever (again).

Also, we're taking this opportunity to require the last glib minor version as
well as if you have GTK 4.10, you most likely have GLib 2.76 as well.

Testing Done:
Compiled.

Reviewed at https://reviews.imfreedom.org/r/2526/

libpurple/plugins/purple-toast/purple-toast.c file | annotate | diff | comparison | revisions
meson.build file | annotate | diff | comparison | revisions
pidgin/gtknotify.c file | annotate | diff | comparison | revisions
pidgin/gtkwhiteboard.c file | annotate | diff | comparison | revisions
pidgin/gtkxfer.c file | annotate | diff | comparison | revisions
pidgin/pidginabout.c file | annotate | diff | comparison | revisions
pidgin/pidginavatar.c file | annotate | diff | comparison | revisions
--- a/libpurple/plugins/purple-toast/purple-toast.c	Wed Jul 19 23:26:58 2023 -0500
+++ b/libpurple/plugins/purple-toast/purple-toast.c	Wed Jul 19 23:29:37 2023 -0500
@@ -37,11 +37,7 @@
 		application = g_application_get_default();
 
 		if(application == NULL) {
-#if GLIB_CHECK_VERSION(2,74,0)
 			application = g_application_new(NULL, G_APPLICATION_DEFAULT_FLAGS);
-#else
-			application = g_application_new(NULL, G_APPLICATION_FLAGS_NONE);
-#endif
 			g_application_register(application, NULL, NULL);
 		}
 	}
--- a/meson.build	Wed Jul 19 23:26:58 2023 -0500
+++ b/meson.build	Wed Jul 19 23:29:37 2023 -0500
@@ -198,15 +198,15 @@
 #######################################################################
 # Once we require >= 2.74.0, remove the hack in the if(TRUE) block in
 # libpurple/core.c.
-glib = dependency('glib-2.0', version : '>= 2.70.0')
+glib = dependency('glib-2.0', version : '>= 2.76.0')
 gio = dependency('gio-2.0')
 gobject = dependency('gobject-2.0')
 gthread = dependency('gthread-2.0')
 gnome = import('gnome')
 
 add_project_arguments(
-	'-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_70',
-	'-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_70',
+	'-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_76',
+	'-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_76',
 	language : 'c',)
 
 #######################################################################
@@ -228,7 +228,7 @@
 # Check Pidgin dependencies
 #######################################################################
 if get_option('gtkui')
-	gtk = dependency('gtk4', version : '>= 4.6.0')
+	gtk = dependency('gtk4', version : '>= 4.10.0')
 	libadwaita = dependency('libadwaita-1', version : '>= 1.2')
 
 	talkatu_dep = dependency('talkatu',
--- a/pidgin/gtknotify.c	Wed Jul 19 23:26:58 2023 -0500
+++ b/pidgin/gtknotify.c	Wed Jul 19 23:29:37 2023 -0500
@@ -612,14 +612,10 @@
 
 static void *
 pidgin_notify_uri(const char *uri) {
-#if GTK_CHECK_VERSION(4, 10, 0)
 	GtkUriLauncher *launcher = NULL;
 	launcher = gtk_uri_launcher_new(uri);
 	gtk_uri_launcher_launch(launcher, NULL, NULL, NULL, NULL);
 	g_object_unref(launcher);
-#else
-	gtk_show_uri(NULL, uri, GDK_CURRENT_TIME);
-#endif
 
 	return NULL;
 }
--- a/pidgin/gtkwhiteboard.c	Wed Jul 19 23:26:58 2023 -0500
+++ b/pidgin/gtkwhiteboard.c	Wed Jul 19 23:29:37 2023 -0500
@@ -455,7 +455,6 @@
 	gtk_native_dialog_show(GTK_NATIVE_DIALOG(chooser));
 }
 
-#if GTK_CHECK_VERSION(4, 10, 0)
 static void
 notify_color_cb(GObject *obj, G_GNUC_UNUSED GParamSpec *pspec, gpointer data) {
 	PidginWhiteboard *gtkwb = data;
@@ -473,25 +472,6 @@
 	purple_whiteboard_get_brush(wb, &old_size, &old_color);
 	purple_whiteboard_send_brush(wb, old_size, new_color);
 }
-#else
-static void
-color_selected(GtkColorButton *button, PidginWhiteboard *gtkwb)
-{
-	GdkRGBA color;
-	PurpleWhiteboard *wb = gtkwb->wb;
-	int old_size, old_color;
-	int new_color;
-
-	gtk_color_chooser_get_rgba(GTK_COLOR_CHOOSER(button), &color);
-
-	new_color = (unsigned int)(color.red * 255) << 16;
-	new_color |= (unsigned int)(color.green * 255) << 8;
-	new_color |= (unsigned int)(color.blue * 255);
-
-	purple_whiteboard_get_brush(wb, &old_size, &old_color);
-	purple_whiteboard_send_brush(wb, old_size, new_color);
-}
-#endif
 
 static void
 pidgin_whiteboard_create(PurpleWhiteboard *wb)
@@ -535,13 +515,8 @@
 	                            gtkwb->width, gtkwb->height);
 
 	pidgin_whiteboard_rgb24_to_rgba(gtkwb->brush_color, &color);
-#if GTK_CHECK_VERSION(4, 10, 0)
 	gtk_color_dialog_button_set_rgba(GTK_COLOR_DIALOG_BUTTON(gtkwb->color_button),
 	                                 &color);
-#else
-	gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(gtkwb->color_button),
-	                           &color);
-#endif
 
 	/* Make all this (window) visible */
 	gtk_widget_set_visible(GTK_WIDGET(gtkwb), TRUE);
@@ -576,15 +551,9 @@
 pidgin_whiteboard_init(PidginWhiteboard *self) {
 	gtk_widget_init_template(GTK_WIDGET(self));
 
-#if GTK_CHECK_VERSION(4, 10, 0)
 	self->color_button = gtk_color_dialog_button_new(gtk_color_dialog_new());
 	g_signal_connect(self->color_button, "notify::rgba",
 	                 G_CALLBACK(notify_color_cb), self);
-#else
-	self->color_button = gtk_color_button_new();
-	g_signal_connect(self->color_button, "color-set",
-	                 G_CALLBACK(color_selected), self);
-#endif
 	gtk_box_append(self->toolbar, GTK_WIDGET(self->color_button));
 }
 
--- a/pidgin/gtkxfer.c	Wed Jul 19 23:26:58 2023 -0500
+++ b/pidgin/gtkxfer.c	Wed Jul 19 23:29:37 2023 -0500
@@ -434,20 +434,14 @@
 static void
 open_button_cb(G_GNUC_UNUSED GtkButton *button, PidginXferDialog *dialog)
 {
-#if GTK_CHECK_VERSION(4, 10, 0)
 	GtkUriLauncher *launcher = NULL;
-#endif
 	gchar *uri = NULL;
 
 	uri = g_strdup_printf("file://%s",
 	                      purple_xfer_get_local_filename(dialog->selected_xfer));
-#if GTK_CHECK_VERSION(4, 10, 0)
 	launcher = gtk_uri_launcher_new(uri);
 	gtk_uri_launcher_launch(launcher, GTK_WINDOW(dialog), NULL, NULL, NULL);
 	g_object_unref(launcher);
-#else
-	gtk_show_uri(GTK_WINDOW(dialog), uri, GDK_CURRENT_TIME);
-#endif
 	g_free(uri);
 }
 
--- a/pidgin/pidginabout.c	Wed Jul 19 23:26:58 2023 -0500
+++ b/pidgin/pidginabout.c	Wed Jul 19 23:29:37 2023 -0500
@@ -589,14 +589,10 @@
 pidgin_about_dialog_open_url_cb(G_GNUC_UNUSED TalkatuView *view,
                                 const char *url, gpointer data)
 {
-#if GTK_CHECK_VERSION(4, 10, 0)
 	GtkUriLauncher *launcher = NULL;
 	launcher = gtk_uri_launcher_new(url);
 	gtk_uri_launcher_launch(launcher, GTK_WINDOW(data), NULL, NULL, NULL);
 	g_object_unref(launcher);
-#else
-	gtk_show_uri(GTK_WINDOW(data), url, GDK_CURRENT_TIME);
-#endif
 }
 
 static void
--- a/pidgin/pidginavatar.c	Wed Jul 19 23:26:58 2023 -0500
+++ b/pidgin/pidginavatar.c	Wed Jul 19 23:29:37 2023 -0500
@@ -468,10 +468,9 @@
 
 	gtk_widget_init_template(GTK_WIDGET(avatar));
 
-#if GTK_CHECK_VERSION(4,8,0)
 	gtk_picture_set_content_fit(GTK_PICTURE(avatar->icon),
 	                            GTK_CONTENT_FIT_SCALE_DOWN);
-#endif
+
 	/* Now setup our actions. */
 	group = g_simple_action_group_new();
 	g_action_map_add_action_entries(G_ACTION_MAP(group), actions,

mercurial