changeset 2860:9daee9d58956

GTK2/3/4: Handle deprecations in GLIB 2.74 and GTK 4.8.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 23 Nov 2022 02:17:12 +0000
parents b5cd3242b5e7
children ef7a414f9b71
files gtk/dw.c gtk3/dw.c gtk4/dw.c
diffstat 3 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gtk/dw.c	Tue Nov 15 21:41:01 2022 +0000
+++ b/gtk/dw.c	Wed Nov 23 02:17:12 2022 +0000
@@ -2247,7 +2247,11 @@
     * we generate an application ID based on the binary name or PID
     * instead of passing NULL to enable full application support.
     */
+#if GLIB_CHECK_VERSION(2,74,0)
+   _DWApp = g_application_new(_dw_app_id, G_APPLICATION_DEFAULT_FLAGS);
+#else
    _DWApp = g_application_new(_dw_app_id, G_APPLICATION_FLAGS_NONE);
+#endif
    if(g_application_register(_DWApp, NULL, NULL))
    {
 #if GLIB_CHECK_VERSION(2,40,0)
--- a/gtk3/dw.c	Tue Nov 15 21:41:01 2022 +0000
+++ b/gtk3/dw.c	Wed Nov 23 02:17:12 2022 +0000
@@ -2139,7 +2139,11 @@
     * we generate an application ID based on the binary name or PID
     * instead of passing NULL to enable full application support.
     */
+#if GLIB_CHECK_VERSION(2,74,0)
+   _DWApp = g_application_new(_dw_app_id, G_APPLICATION_DEFAULT_FLAGS);
+#else
    _DWApp = g_application_new(_dw_app_id, G_APPLICATION_FLAGS_NONE);
+#endif
    if(_DWApp && g_application_register(_DWApp, NULL, NULL))
    {
 #if GLIB_CHECK_VERSION(2,40,0)
--- a/gtk4/dw.c	Tue Nov 15 21:41:01 2022 +0000
+++ b/gtk4/dw.c	Wed Nov 23 02:17:12 2022 +0000
@@ -1599,7 +1599,11 @@
     * we generate an application ID based on the binary name or PID
     * instead of passing NULL to enable full application support.
     */
+#if GLIB_CHECK_VERSION(2,74,0)
+   _DWApp = g_application_new(_dw_app_id, G_APPLICATION_DEFAULT_FLAGS);
+#else
    _DWApp = g_application_new(_dw_app_id, G_APPLICATION_FLAGS_NONE);
+#endif
    if(_DWApp && g_application_register(_DWApp, NULL, NULL))
    {
       /* Creat our notification handler for any notifications */
@@ -2779,7 +2783,11 @@
 {
    GtkWidget *tmp = gtk_picture_new();
    gtk_picture_set_can_shrink(GTK_PICTURE(tmp), TRUE);
+#if GTK_CHECK_VERSION(4,8,0)
+   gtk_picture_set_content_fit(GTK_PICTURE(tmp), GTK_CONTENT_FIT_CONTAIN);
+#else
    gtk_picture_set_keep_aspect_ratio(GTK_PICTURE(tmp), TRUE);
+#endif
    gtk_widget_set_halign(GTK_WIDGET(tmp), GTK_ALIGN_CENTER);
    gtk_widget_set_valign(GTK_WIDGET(tmp), GTK_ALIGN_CENTER);
    gtk_widget_show(tmp);