{"id":399377,"date":"2024-06-29T14:38:45","date_gmt":"2024-06-29T14:38:45","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=399377"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T14:38:45","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=399377","title":{"rendered":"<span>Blueprint: \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f UI \u043d\u0430 Gtk4<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p>\u0420\u0430\u0437\u043c\u0435\u0442\u043a\u0443 \u0434\u043b\u044f Gtk-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0441\u0430\u043c\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430. \u0418\u043b\u0438 \u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u0442\u0438\u043f\u0430 Cambalache, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 ui-\u0444\u0430\u0439\u043b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 XML. <\/p>\n<p>Blueprint \u2014 \u044d\u0442\u043e \u044f\u0437\u044b\u043a \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440, \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 Gtk4. \u0421 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u043d\u0430 <a href=\"https:\/\/jwestman.pages.gitlab.gnome.org\/blueprint-compiler\/\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u043c \u0441\u0430\u0439\u0442\u0435<\/a>. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 ui-\u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0448\u044c \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u043d\u0430 blp-\u0444\u0430\u0439\u043b\u044b \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438. \u041d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0434\u0430\u0442\u044b \u043a\u0430\u0442\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u041f\u0430\u0441\u0445\u0438. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0434\u0430\u0442\u044b \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0413\u0430\u0443\u0441\u0441\u0430. \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Vala \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a Gtk4 \u0438 libadwaita. \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <a href=\"https:\/\/github.com\/kalexal-kaa\/date-of-catholic-easter\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5b3\/220\/b0d\/5b3220b0d81ebad3fb01dc1108e4f4e8.png\" width=\"570\" height=\"348\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5b3\/220\/b0d\/5b3220b0d81ebad3fb01dc1108e4f4e8.png\"\/><\/figure>\n<p>\u0412\u0435\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445 Gtk.Box, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u044b \u043e\u0434\u0438\u043d \u0432 \u0434\u0440\u0443\u0433\u043e\u0439. \u0417\u043d\u0430\u0447\u043e\u043a \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0432 \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u043d\u043e\u043c\u0435\u0440\u0430 \u0433\u043e\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 vala-\u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"vala\"> year.set_icon_from_icon_name (Gtk.EntryIconPosition.SECONDARY, \"edit-clear-symbolic\");         year.icon_press.connect ((pos, event) => {               year.set_text(\"\");               year.grab_focus();         });<\/code><\/pre>\n<p> \u0424\u0430\u0439\u043b \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043d\u0430 XML \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?> &lt;interface>   &lt;requires lib=\"gtk\" version=\"4.0\"\/>   &lt;template class=\"ValaGtkTemplateWindow\" parent=\"AdwApplicationWindow\">     &lt;property name=\"title\">Vala &amp;amp; GTK Template&lt;\/property>     &lt;property name=\"default-height\">300&lt;\/property>     &lt;child>       &lt;object class=\"GtkBox\">         &lt;property name=\"orientation\">1&lt;\/property>         &lt;child>           &lt;object class=\"AdwHeaderBar\">&lt;\/object>         &lt;\/child>         &lt;child>           &lt;object class=\"GtkBox\">             &lt;property name=\"orientation\">1&lt;\/property>             &lt;property name=\"vexpand\">true&lt;\/property>             &lt;property name=\"hexpand\">true&lt;\/property>             &lt;property name=\"margin-top\">6&lt;\/property>             &lt;property name=\"margin-end\">6&lt;\/property>             &lt;property name=\"margin-start\">6&lt;\/property>             &lt;property name=\"margin-bottom\">6&lt;\/property>             &lt;child>               &lt;object class=\"GtkBox\">                 &lt;property name=\"orientation\">0&lt;\/property>                 &lt;property name=\"spacing\">6&lt;\/property>                 &lt;property name=\"hexpand\">true&lt;\/property>                 &lt;child>                   &lt;object class=\"GtkBox\">                     &lt;property name=\"orientation\">1&lt;\/property>                     &lt;property name=\"spacing\">6&lt;\/property>                     &lt;child>                       &lt;object class=\"GtkLabel\">                         &lt;property name=\"label\">year:&lt;\/property>                         &lt;property name=\"xalign\">0&lt;\/property>                       &lt;\/object>                     &lt;\/child>                     &lt;child>                       &lt;object class=\"GtkEntry\" id=\"year\">                         &lt;property name=\"hexpand\">true&lt;\/property>                       &lt;\/object>                     &lt;\/child>                   &lt;\/object>                 &lt;\/child>                 &lt;child>                   &lt;object class=\"GtkButton\" id=\"calculate\">                     &lt;property name=\"label\">CALCULATE&lt;\/property>                   &lt;\/object>                 &lt;\/child>               &lt;\/object>             &lt;\/child>             &lt;child>               &lt;object class=\"GtkLabel\" id=\"result\">                 &lt;property name=\"vexpand\">true&lt;\/property>                 &lt;property name=\"valign\">3&lt;\/property>                 &lt;style>                   &lt;class name=\"title-1\"\/>                 &lt;\/style>               &lt;\/object>             &lt;\/child>           &lt;\/object>         &lt;\/child>       &lt;\/object>     &lt;\/child>   &lt;\/template> &lt;\/interface><\/code><\/pre>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u043b\u044f \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0410 \u0432\u043e\u0442 \u0442\u043e\u0442 \u0436\u0435 \u0444\u0430\u0439\u043b, \u043d\u043e \u0443\u0436\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 Blueprint:<\/p>\n<pre><code class=\"yaml\">using Gtk 4.0; using Adw 1;  template ValaGtkTemplateWindow : Adw.ApplicationWindow {   title: \"Vala &amp; GTK Template\";   default-height: 300;   Box {     orientation: vertical;      Adw.HeaderBar {}      Box {       orientation: vertical;       vexpand: true;       hexpand: true;       margin-top: 6;       margin-end: 6;       margin-start: 6;       margin-bottom: 6;       Box {         orientation: horizontal;         spacing: 6;         hexpand: true;          Box {            orientation: vertical;            spacing: 6;            Label {              label: \"year:\";              xalign: 0;            }            Entry year {               hexpand: true;            }          }          Button calculate {            label: \"CALCULATE\";          }       }       Label result {          vexpand: true;          valign: center;          styles [\"title-1\"]       }     }   } }<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0443\u0436\u0435 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435. \u041f\u0440\u043e\u0449\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u0433\u0434\u0435 \u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d, \u0433\u0434\u0435 \u043e\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0438 \u0433\u0434\u0435 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u041a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u041a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 blueprint-compiler. \u0415\u0435 \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 blp \u0441\u043e\u0437\u0434\u0430\u0442\u044c ui-\u0444\u0430\u0439\u043b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 meson.build \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<pre><code class=\"cmake\">blueprints = custom_target (   'blueprints',   input: files (     'data\/resources\/window.blp',   ),   output: '.',   command: [ find_program ('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@' ] )<\/code><\/pre>\n<p>\u0418 \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0432 \u0442\u043e\u043c \u0436\u0435 \u0444\u0430\u0439\u043b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c:<\/p>\n<pre><code class=\"cmake\">dependencies: blueprints<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u043c. \u0422\u0430\u043c, \u0433\u0434\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u044c \u0434\u043e ui-\u0444\u0430\u0439\u043b\u0430, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0432 window.vala \u0438 gresource.xml, \u043d\u0438\u0447\u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u0415\u0441\u043b\u0438 \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0443 flatpak, \u0442\u043e \u0432 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c:<\/p>\n<pre><code class=\"json\"> {             \"name\": \"blueprint-compiler\",             \"buildsystem\": \"meson\",             \"sources\": [                {                   \"type\": \"git\",                   \"url\": \"https:\/\/gitlab.gnome.org\/jwestman\/blueprint-compiler\",                   \"branch\": \"main\"                }              ]             }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Blueprint \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Workbench \u0438\u043b\u0438 GNOME Builder. \u041e\u0431\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0443 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 blp-\u0444\u0430\u0439\u043b\u043e\u0432, \u0430 Workbench \u0432\u0434\u043e\u0431\u0430\u0432\u043e\u043a \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0434\u0438\u0437\u0430\u0439\u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/729084\/\"> https:\/\/habr.com\/ru\/articles\/729084\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440!<\/p>\n<p>\u0420\u0430\u0437\u043c\u0435\u0442\u043a\u0443 \u0434\u043b\u044f Gtk-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0441\u0430\u043c\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430. \u0418\u043b\u0438 \u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440, \u0442\u0438\u043f\u0430 Cambalache, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 ui-\u0444\u0430\u0439\u043b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 XML. <\/p>\n<p>Blueprint \u2014 \u044d\u0442\u043e \u044f\u0437\u044b\u043a \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440, \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 Gtk4. \u0421 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u043d\u0430 <a href=\"https:\/\/jwestman.pages.gitlab.gnome.org\/blueprint-compiler\/\" rel=\"noopener noreferrer nofollow\">\u044d\u0442\u043e\u043c \u0441\u0430\u0439\u0442\u0435<\/a>. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 ui-\u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0442\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0448\u044c \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u043d\u0430 blp-\u0444\u0430\u0439\u043b\u044b \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438. \u041d\u043e \u043e\u0431 \u044d\u0442\u043e\u043c \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0434\u0430\u0442\u044b \u043a\u0430\u0442\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u041f\u0430\u0441\u0445\u0438. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0435\u0442\u0430 \u0434\u0430\u0442\u044b \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0413\u0430\u0443\u0441\u0441\u0430. \u041d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 Vala \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a Gtk4 \u0438 libadwaita. \u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <a href=\"https:\/\/github.com\/kalexal-kaa\/date-of-catholic-easter\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u0435\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445 Gtk.Box, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043b\u043e\u0436\u0435\u043d\u044b \u043e\u0434\u0438\u043d \u0432 \u0434\u0440\u0443\u0433\u043e\u0439. \u0417\u043d\u0430\u0447\u043e\u043a \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0432 \u043f\u043e\u043b\u0435 \u0434\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u043d\u043e\u043c\u0435\u0440\u0430 \u0433\u043e\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 vala-\u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"vala\"> year.set_icon_from_icon_name (Gtk.EntryIconPosition.SECONDARY, \"edit-clear-symbolic\");         year.icon_press.connect ((pos, event) => {               year.set_text(\"\");               year.grab_focus();         });<\/code><\/pre>\n<p> \u0424\u0430\u0439\u043b \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043d\u0430 XML \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?> &lt;interface>   &lt;requires lib=\"gtk\" version=\"4.0\"\/>   &lt;template class=\"ValaGtkTemplateWindow\" parent=\"AdwApplicationWindow\">     &lt;property name=\"title\">Vala &amp;amp; GTK Template&lt;\/property>     &lt;property name=\"default-height\">300&lt;\/property>     &lt;child>       &lt;object class=\"GtkBox\">         &lt;property name=\"orientation\">1&lt;\/property>         &lt;child>           &lt;object class=\"AdwHeaderBar\">&lt;\/object>         &lt;\/child>         &lt;child>           &lt;object class=\"GtkBox\">             &lt;property name=\"orientation\">1&lt;\/property>             &lt;property name=\"vexpand\">true&lt;\/property>             &lt;property name=\"hexpand\">true&lt;\/property>             &lt;property name=\"margin-top\">6&lt;\/property>             &lt;property name=\"margin-end\">6&lt;\/property>             &lt;property name=\"margin-start\">6&lt;\/property>             &lt;property name=\"margin-bottom\">6&lt;\/property>             &lt;child>               &lt;object class=\"GtkBox\">                 &lt;property name=\"orientation\">0&lt;\/property>                 &lt;property name=\"spacing\">6&lt;\/property>                 &lt;property name=\"hexpand\">true&lt;\/property>                 &lt;child>                   &lt;object class=\"GtkBox\">                     &lt;property name=\"orientation\">1&lt;\/property>                     &lt;property name=\"spacing\">6&lt;\/property>                     &lt;child>                       &lt;object class=\"GtkLabel\">                         &lt;property name=\"label\">year:&lt;\/property>                         &lt;property name=\"xalign\">0&lt;\/property>                       &lt;\/object>                     &lt;\/child>                     &lt;child>                       &lt;object class=\"GtkEntry\" id=\"year\">                         &lt;property name=\"hexpand\">true&lt;\/property>                       &lt;\/object>                     &lt;\/child>                   &lt;\/object>                 &lt;\/child>                 &lt;child>                   &lt;object class=\"GtkButton\" id=\"calculate\">                     &lt;property name=\"label\">CALCULATE&lt;\/property>                   &lt;\/object>                 &lt;\/child>               &lt;\/object>             &lt;\/child>             &lt;child>               &lt;object class=\"GtkLabel\" id=\"result\">                 &lt;property name=\"vexpand\">true&lt;\/property>                 &lt;property name=\"valign\">3&lt;\/property>                 &lt;style>                   &lt;class name=\"title-1\"\/>                 &lt;\/style>               &lt;\/object>             &lt;\/child>           &lt;\/object>         &lt;\/child>       &lt;\/object>     &lt;\/child>   &lt;\/template> &lt;\/interface><\/code><\/pre>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u043b\u044f \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0410 \u0432\u043e\u0442 \u0442\u043e\u0442 \u0436\u0435 \u0444\u0430\u0439\u043b, \u043d\u043e \u0443\u0436\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 Blueprint:<\/p>\n<pre><code class=\"yaml\">using Gtk 4.0; using Adw 1;  template ValaGtkTemplateWindow : Adw.ApplicationWindow {   title: \"Vala &amp; GTK Template\";   default-height: 300;   Box {     orientation: vertical;      Adw.HeaderBar {}      Box {       orientation: vertical;       vexpand: true;       hexpand: true;       margin-top: 6;       margin-end: 6;       margin-start: 6;       margin-bottom: 6;       Box {         orientation: horizontal;         spacing: 6;         hexpand: true;          Box {            orientation: vertical;            spacing: 6;            Label {              label: \"year:\";              xalign: 0;            }            Entry year {               hexpand: true;            }          }          Button calculate {            label: \"CALCULATE\";          }       }       Label result {          vexpand: true;          valign: center;          styles [\"title-1\"]       }     }   } }<\/code><\/pre>\n<p>\u0422\u0430\u043a \u0443\u0436\u0435 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435. \u041f\u0440\u043e\u0449\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u0433\u0434\u0435 \u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d, \u0433\u0434\u0435 \u043e\u043d \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0438 \u0433\u0434\u0435 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f. \u041a\u0430\u043a \u044d\u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u041a \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 blueprint-compiler. \u0415\u0435 \u0437\u0430\u0434\u0430\u0447\u0430 \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 blp \u0441\u043e\u0437\u0434\u0430\u0442\u044c ui-\u0444\u0430\u0439\u043b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u0444\u0430\u0439\u043b\u0435 meson.build \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<pre><code class=\"cmake\">blueprints = custom_target (   'blueprints',   input: files (     'data\/resources\/window.blp',   ),   output: '.',   command: [ find_program ('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@' ] )<\/code><\/pre>\n<p>\u0418 \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0432 \u0442\u043e\u043c \u0436\u0435 \u0444\u0430\u0439\u043b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u044c:<\/p>\n<pre><code class=\"cmake\">dependencies: blueprints<\/code><\/pre>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u043c. \u0422\u0430\u043c, \u0433\u0434\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0442\u044c \u0434\u043e ui-\u0444\u0430\u0439\u043b\u0430, \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438, \u0432 window.vala \u0438 gresource.xml, \u043d\u0438\u0447\u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e. \u0415\u0441\u043b\u0438 \u0432\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0443\u043f\u0430\u043a\u043e\u0432\u043a\u0443 flatpak, \u0442\u043e \u0432 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043c\u043e\u0434\u0443\u043b\u044c:<\/p>\n<pre><code class=\"json\"> {             \"name\": \"blueprint-compiler\",             \"buildsystem\": \"meson\",             \"sources\": [                {                   \"type\": \"git\",                   \"url\": \"https:\/\/gitlab.gnome.org\/jwestman\/blueprint-compiler\",                   \"branch\": \"main\"                }              ]             }<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Blueprint \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Workbench \u0438\u043b\u0438 GNOME Builder. \u041e\u0431\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u043f\u043e\u0434\u0441\u0432\u0435\u0442\u043a\u0443 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 blp-\u0444\u0430\u0439\u043b\u043e\u0432, \u0430 Workbench \u0432\u0434\u043e\u0431\u0430\u0432\u043e\u043a \u0438\u043c\u0435\u0435\u0442 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0434\u0438\u0437\u0430\u0439\u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/729084\/\"> https:\/\/habr.com\/ru\/articles\/729084\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-399377","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/399377","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=399377"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/399377\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=399377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=399377"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=399377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}