Mercurial > dwindows
comparison gtk4/dw.c @ 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 | 761b7a12b079 |
comparison
equal
deleted
inserted
replaced
2859:b5cd3242b5e7 | 2860:9daee9d58956 |
---|---|
1597 | 1597 |
1598 /* Initialize the application subsystem on supported versions... | 1598 /* Initialize the application subsystem on supported versions... |
1599 * we generate an application ID based on the binary name or PID | 1599 * we generate an application ID based on the binary name or PID |
1600 * instead of passing NULL to enable full application support. | 1600 * instead of passing NULL to enable full application support. |
1601 */ | 1601 */ |
1602 #if GLIB_CHECK_VERSION(2,74,0) | |
1603 _DWApp = g_application_new(_dw_app_id, G_APPLICATION_DEFAULT_FLAGS); | |
1604 #else | |
1602 _DWApp = g_application_new(_dw_app_id, G_APPLICATION_FLAGS_NONE); | 1605 _DWApp = g_application_new(_dw_app_id, G_APPLICATION_FLAGS_NONE); |
1606 #endif | |
1603 if(_DWApp && g_application_register(_DWApp, NULL, NULL)) | 1607 if(_DWApp && g_application_register(_DWApp, NULL, NULL)) |
1604 { | 1608 { |
1605 /* Creat our notification handler for any notifications */ | 1609 /* Creat our notification handler for any notifications */ |
1606 GSimpleAction *action = g_simple_action_new("notification", G_VARIANT_TYPE_UINT64); | 1610 GSimpleAction *action = g_simple_action_new("notification", G_VARIANT_TYPE_UINT64); |
1607 | 1611 |
2777 DW_FUNCTION_RETURN(dw_bitmap_new, HWND) | 2781 DW_FUNCTION_RETURN(dw_bitmap_new, HWND) |
2778 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG) | 2782 DW_FUNCTION_RESTORE_PARAM1(cid, ULONG) |
2779 { | 2783 { |
2780 GtkWidget *tmp = gtk_picture_new(); | 2784 GtkWidget *tmp = gtk_picture_new(); |
2781 gtk_picture_set_can_shrink(GTK_PICTURE(tmp), TRUE); | 2785 gtk_picture_set_can_shrink(GTK_PICTURE(tmp), TRUE); |
2786 #if GTK_CHECK_VERSION(4,8,0) | |
2787 gtk_picture_set_content_fit(GTK_PICTURE(tmp), GTK_CONTENT_FIT_CONTAIN); | |
2788 #else | |
2782 gtk_picture_set_keep_aspect_ratio(GTK_PICTURE(tmp), TRUE); | 2789 gtk_picture_set_keep_aspect_ratio(GTK_PICTURE(tmp), TRUE); |
2790 #endif | |
2783 gtk_widget_set_halign(GTK_WIDGET(tmp), GTK_ALIGN_CENTER); | 2791 gtk_widget_set_halign(GTK_WIDGET(tmp), GTK_ALIGN_CENTER); |
2784 gtk_widget_set_valign(GTK_WIDGET(tmp), GTK_ALIGN_CENTER); | 2792 gtk_widget_set_valign(GTK_WIDGET(tmp), GTK_ALIGN_CENTER); |
2785 gtk_widget_show(tmp); | 2793 gtk_widget_show(tmp); |
2786 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(cid)); | 2794 g_object_set_data(G_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(cid)); |
2787 DW_FUNCTION_RETURN_THIS(tmp); | 2795 DW_FUNCTION_RETURN_THIS(tmp); |