# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1612341306 0 # Node ID b045bb67922dc922254048127c6f9139da7c820b # Parent 0e93b09ed0e137c292ddc2e781c90468646cd1e5 GTK4: Implement resizing of images in the layout manager. Make dw_window_set_style() partially work on menus. diff -r 0e93b09ed0e1 -r b045bb67922d gtk4/dw.c --- a/gtk4/dw.c Wed Feb 03 07:43:18 2021 +0000 +++ b/gtk4/dw.c Wed Feb 03 08:35:06 2021 +0000 @@ -3080,44 +3080,46 @@ { char *file = alloca(strlen(filename) + 6); - if (!file) + if(!file) return; strcpy(file, filename); /* check if we can read from this file (it exists and read permission) */ - if ( access(file, 04 ) != 0 ) + if(access(file, 04) != 0) { /* Try with various extentions */ - for ( i = 0; i < NUM_EXTS; i++ ) + for(i=0; i width || pheight > height) pixbuf = gdk_pixbuf_scale_simple(pixbuf, pwidth > width ? width : pwidth, pheight > height ? height : pheight, GDK_INTERP_BILINEAR); gtk_image_set_from_pixbuf(GTK_IMAGE(image), pixbuf); - } -#endif + g_object_set_data(G_OBJECT(image), "_dw_pixbuf", pixbuf); + } } /* Check if the item to be packed is a special box */ @@ -7740,6 +7744,18 @@ if(style & DW_DT_WORDBREAK) gtk_label_set_wrap(GTK_LABEL(handle), TRUE); } + if(G_IS_MENU_ITEM(handle2) && (mask & (DW_MIS_ENABLED | DW_MIS_DISABLED))) + { + GSimpleAction *action = g_object_get_data(G_OBJECT(handle2), "_dw_action"); + + if((style & DW_MIS_ENABLED) || (style & DW_MIS_DISABLED)) + { + if(style & DW_MIS_ENABLED) + g_simple_action_set_enabled(action, TRUE); + else + g_simple_action_set_enabled(action, FALSE); + } + } /* TODO: Convert to GMenuModel */ #if GTK3 if(GTK_IS_CHECK_MENU_ITEM(handle2) && (mask & (DW_MIS_CHECKED | DW_MIS_UNCHECKED)) @@ -7754,15 +7770,6 @@ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(handle2), check); _dw_ignore_click = 0; } - if((GTK_IS_CHECK_MENU_ITEM(handle2) || GTK_IS_MENU_ITEM(handle2)) && (mask & (DW_MIS_ENABLED | DW_MIS_DISABLED))) - { - _dw_ignore_click = 1; - if ( style & DW_MIS_ENABLED ) - gtk_widget_set_sensitive(handle2, TRUE); - else - gtk_widget_set_sensitive(handle2, FALSE); - _dw_ignore_click = 0; - } #endif }