talkatu/talkatu

Backout the blueprint compiler stuff

14 months ago, Gary Kramlich
7c32cf7372e5
Parents 49b6af8df5de
Children 777ace07ab22
Backout the blueprint compiler stuff

Turns out we just got used to the GTK Builder ui format, so the blueprint
compiler doesn't really do much for us.

This was a backout of `8c78e806f7c7` but then I put bindings in for the toolbar, send button, and edited buttons.

Testing Done:
Built and ran the demo.

Reviewed at https://reviews.imfreedom.org/r/2213/
--- a/demo/data/demo.blp Sun Jan 15 21:28:59 2023 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,255 +0,0 @@
-using Gtk 4.0;
-using Talkatu 0.0;
-
-Talkatu.Buffer buffer_plain {
- changed => talkatu_demo_window_buffer_modified_cb();
-}
-
-Talkatu.WholeBuffer buffer_whole {
- changed => talkatu_demo_window_buffer_modified_cb();
-}
-
-Talkatu.HtmlBuffer buffer_html {
- changed => talkatu_demo_window_buffer_modified_cb();
-}
-
-Talkatu.MarkdownBuffer buffer_markdown {
- changed => talkatu_demo_window_buffer_modified_cb();
-}
-
-menu author_menu {
- section {
- item {
- label: _("Alice");
- action: "win.author-name";
- target: _("Alice");
- }
- item {
- label: _("Bob");
- action: "win.author-name";
- target: _("Bob");
- }
- item {
- label: _("Carol");
- action: "win.author-name";
- target: _("Carol");
- }
- item {
- label: _("David");
- action: "win.author-name";
- target: _("David");
- }
- item {
- label: _("Eve");
- action: "win.author-name";
- target: _("Eve");
- }
- item {
- label: _("Mallory");
- action: "win.author-name";
- target: _("Mallory");
- }
- }
-}
-
-menu author_name_color_menu {
- section {
- item {
- label: _("Black");
- action: "win.author-name-color";
- target: "black";
- }
- item {
- label: _("White");
- action: "win.author-name-color";
- target: "white";
- }
- item {
- label: _("Red");
- action: "win.author-name-color";
- target: "red";
- }
- item {
- label: _("Green");
- action: "win.author-name-color";
- target: "green";
- }
- item {
- label: _("Blue");
- action: "win.author-name-color";
- target: "blue";
- }
- item {
- label: _("Yellow");
- action: "win.author-name-color";
- target: "yellow";
- }
- item {
- label: _("Purple");
- action: "win.author-name-color";
- target: "purple";
- }
- }
-}
-
-template TalkatuDemoWindow : Gtk.ApplicationWindow {
- Gtk.Paned {
- shrink-end-child: false;
- shrink-start-child: false;
- orientation: vertical;
- wide-handle: true;
-
- Gtk.ScrolledWindow {
- vadjustment: Talkatu.AutoScroller auto_scroller{};
-
- Talkatu.History history {
- name: "history";
- }
- }
-
- Gtk.Box {
- orientation: vertical;
-
- Gtk.Box {
- styles ["toolbar"]
-
- can-focus: false;
-
- Gtk.ToggleButton toggle_plain {
- styles ["flat"]
-
- can-focus: false;
- tooltip-text: _("Use a TalkatuBuffer");
- label: _("Plain");
- use-underline: true;
- icon-name: "text-x-generic";
- active: true;
-
- toggled => talkatu_demo_window_buffer_changed_cb();
- }
- Gtk.ToggleButton toggle_whole {
- styles ["flat"]
-
- can-focus: false;
- tooltip-text: _("Use a TalkatuWholeBuffer");
- label: _("Whole");
- use-underline: true;
- icon-name: "ascii";
- group: toggle_plain;
-
- toggled => talkatu_demo_window_buffer_changed_cb();
- }
- Gtk.ToggleButton toggle_html {
- styles ["flat"]
-
- can-focus: false;
- tooltip-text: _("Use a TalkatuHTMLBuffer");
- label: _("HTML");
- use-underline: true;
- icon-name: "text-html";
- group: toggle_plain;
-
- toggled => talkatu_demo_window_buffer_changed_cb();
- }
- Gtk.ToggleButton toggle_markdown {
- styles ["flat"]
-
- can-focus: false;
- tooltip-text: _("Use a TalkatuMarkdownBuffer");
- label: _("Markdown");
- use-underline: true;
- icon-name: "text-x-generic-template";
- group: toggle_plain;
-
- toggled => talkatu_demo_window_buffer_changed_cb();
- }
- Gtk.Separator {
- orientation: vertical;
- }
- Gtk.Button {
- can-focus: false;
- tooltip-text: _("Insert HTML from a file");
- label: _("Insert HTML");
- use-underline: true;
- icon-name: "text-html";
-
- clicked => talkatu_demo_window_insert_html_cb();
- }
- Gtk.Button {
- can-focus: false;
- tooltip-text: _("Insert Markdown from a file");
- label: _("Insert Markdown");
- use-underline: true;
- icon-name: "text-x-generic";
-
- clicked => talkatu_demo_window_insert_markdown_cb();
- }
- Gtk.Separator {
- orientation: vertical;
- }
- Gtk.MenuButton author_button {
- can-focus: false;
- icon-name: "system-users";
- label: _("Author");
- use-underline: true;
- menu-model: author_menu;
- }
- Gtk.MenuButton author_name_color_button {
- can-focus: false;
- icon-name: "color-select-symbolic";
- label: _("Color");
- use-underline: true;
- menu-model: author_name_color_menu;
- }
- Gtk.Separator {
- orientation: vertical;
- }
- Gtk.ToggleButton toggle_toolbar {
- styles ["flat"]
-
- can-focus: false;
- tooltip-text: _("Toggle toolbar visibility");
- label: _("Toolbar");
- use-underline: true;
-
- active: bind editor.show-toolbar sync-create bidirectional;
- }
- Gtk.ToggleButton toggle_send_button {
- styles ["flat"]
-
- can-focus: false;
- tooltip-text: _("Toggle send button visibility");
- label: _("Send Button");
- use-underline: true;
- active: bind editor.show-send-button sync-create bidirectional;
- }
- Gtk.ToggleButton toggle_edited {
- styles ["flat"]
-
- can-focus: false;
- tooltip-text: _("Toggle whether the message is edited");
- label: _("Edited");
- use-underline: true;
- active: bind input.edited sync-create bidirectional;
- }
- }
- Talkatu.Editor editor {
- vexpand: true;
- orientation: vertical;
- show-send-button: false;
-
- [internal-child input]
- Talkatu.Input input {
- author: _("Alice");
- author-name-color: "black";
- buffer: buffer_plain;
- send-binding: return;
-
- open-url => talkatu_demo_window_view_open_url_cb();
- send-message => talkatu_demo_window_view_send_message_cb();
- }
- }
- Talkatu.TypingLabel typing {}
- }
- }
-}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/demo/data/demo.ui Tue Feb 21 21:33:39 2023 -0600
@@ -0,0 +1,315 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Talkatu - GTK widgets for chat applications
+Copyright (C) 2017-2020 Gary Kramlich <grim@reaperworld.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this library; if not, see <https://www.gnu.org/licenses/>.
+
+-->
+<interface>
+ <requires lib="Talkatu" version="0.0"/>
+ <requires lib="gtk" version="4.0"/>
+ <!-- interface-license-type gplv2 -->
+ <!-- interface-name Talkatu -->
+ <!-- interface-description GTK widgets for chat applications -->
+ <!-- interface-copyright Gary Kramlich <grim@reaperworld.com> -->
+ <template class="TalkatuDemoWindow" parent="GtkApplicationWindow">
+ <property name="child">
+ <object class="GtkPaned">
+ <property name="shrink-end-child">0</property>
+ <property name="shrink-start-child">0</property>
+ <property name="orientation">vertical</property>
+ <property name="wide-handle">1</property>
+ <child>
+ <object class="GtkScrolledWindow">
+ <property name="vadjustment">
+ <object class="TalkatuAutoScroller" id="auto_scroller"/>
+ </property>
+ <child>
+ <object class="TalkatuHistory" id="history">
+ <property name="name">history</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkBox">
+ <style>
+ <class name="toolbar"/>
+ </style>
+ <property name="can-focus">0</property>
+ <child>
+ <object class="GtkToggleButton" id="toggle_plain">
+ <style>
+ <class name="flat"/>
+ </style>
+ <property name="can-focus">0</property>
+ <property name="tooltip-text" translatable="yes">Use a TalkatuBuffer</property>
+ <property name="label" translatable="yes">Plain</property>
+ <property name="use-underline">1</property>
+ <property name="icon-name">text-x-generic</property>
+ <property name="active">1</property>
+ <signal name="toggled" handler="talkatu_demo_window_buffer_changed_cb"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="toggle_whole">
+ <style>
+ <class name="flat"/>
+ </style>
+ <property name="can-focus">0</property>
+ <property name="tooltip-text" translatable="yes">Use a TalkatuWholeBuffer</property>
+ <property name="label" translatable="yes">Whole</property>
+ <property name="use-underline">1</property>
+ <property name="icon-name">ascii</property>
+ <property name="group">toggle_plain</property>
+ <signal name="toggled" handler="talkatu_demo_window_buffer_changed_cb"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="toggle_html">
+ <style>
+ <class name="flat"/>
+ </style>
+ <property name="can-focus">0</property>
+ <property name="tooltip-text" translatable="yes">Use a TalkatuHTMLBuffer</property>
+ <property name="label" translatable="yes">HTML</property>
+ <property name="use-underline">1</property>
+ <property name="icon-name">text-html</property>
+ <property name="group">toggle_plain</property>
+ <signal name="toggled" handler="talkatu_demo_window_buffer_changed_cb"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="toggle_markdown">
+ <style>
+ <class name="flat"/>
+ </style>
+ <property name="can-focus">0</property>
+ <property name="tooltip-text" translatable="yes">Use a TalkatuMarkdownBuffer</property>
+ <property name="label" translatable="yes">Markdown</property>
+ <property name="use-underline">1</property>
+ <property name="icon-name">text-x-generic-template</property>
+ <property name="group">toggle_plain</property>
+ <signal name="toggled" handler="talkatu_demo_window_buffer_changed_cb"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparator">
+ <property name="orientation">vertical</property>
+ <property name="can-focus">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton">
+ <property name="can-focus">0</property>
+ <property name="tooltip-text" translatable="yes">Insert HTML from a file</property>
+ <property name="label" translatable="yes">Insert HTML</property>
+ <property name="use-underline">1</property>
+ <property name="icon-name">text-html</property>
+ <signal name="clicked" handler="talkatu_demo_window_insert_html_cb"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton">
+ <property name="can-focus">0</property>
+ <property name="tooltip-text" translatable="yes">Insert Markdown from a file</property>
+ <property name="label" translatable="yes">Insert Markdown</property>
+ <property name="use-underline">1</property>
+ <property name="icon-name">text-x-generic</property>
+ <signal name="clicked" handler="talkatu_demo_window_insert_markdown_cb"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparator">
+ <property name="orientation">vertical</property>
+ <property name="can-focus">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuButton" id="author_button">
+ <property name="can-focus">0</property>
+ <property name="icon-name">system-users</property>
+ <property name="label" translatable="yes">Author</property>
+ <property name="menu-model">author_menu</property>
+ <property name="use-underline">1</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuButton" id="author_name_color_button">
+ <property name="can-focus">0</property>
+ <property name="icon-name">color-select-symbolic</property>
+ <property name="label" translatable="yes">Color</property>
+ <property name="menu-model">author_name_color_menu</property>
+ <property name="use-underline">1</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkSeparator">
+ <property name="orientation">vertical</property>
+ <property name="can-focus">0</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="toggle_toolbar">
+ <style>
+ <class name="flat"/>
+ </style>
+ <property name="can-focus">0</property>
+ <property name="tooltip-text" translatable="yes">Toggle toolbar visibility</property>
+ <property name="label" translatable="yes">Toolbar</property>
+ <property name="use-underline">1</property>
+ <property name="active" bind-source="editor" bind-property="show-toolbar" bind-flags="bidirectional|sync-create"></property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="toggle_send_button">
+ <style>
+ <class name="flat"/>
+ </style>
+ <property name="can-focus">0</property>
+ <property name="tooltip-text" translatable="yes">Toggle send button visibility</property>
+ <property name="label" translatable="yes">Send Button</property>
+ <property name="use-underline">1</property>
+ <property name="active" bind-source="editor" bind-property="show-send-button" bind-flags="bidirectional|sync-create"></property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="toggle_edited">
+ <style>
+ <class name="flat"/>
+ </style>
+ <property name="can-focus">0</property>
+ <property name="tooltip-text" translatable="yes">Toggle whether the message is edited</property>
+ <property name="label" translatable="yes">Edited</property>
+ <property name="use-underline">1</property>
+ <property name="active" bind-source="input" bind-property="edited" bind-flags="bidirectional|sync-create"></property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="TalkatuEditor" id="editor">
+ <property name="vexpand">1</property>
+ <property name="orientation">vertical</property>
+ <child internal-child="input">
+ <object class="TalkatuInput" id="input">
+ <property name="buffer">buffer_plain</property>
+ <property name="author">Alice</property>
+ <property name="author-name-color">black</property>
+ <property name="send-binding">return</property>
+ <signal name="open-url" handler="talkatu_demo_window_view_open_url_cb"/>
+ <signal name="send-message" handler="talkatu_demo_window_view_send_message_cb"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="TalkatuTypingLabel" id="typing"/>
+ </child>
+ </object>
+ </child>
+ </object>
+ </property>
+ </template>
+ <menu id="author_menu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Alice</attribute>
+ <attribute name="action">win.author-name</attribute>
+ <attribute name="target" translatable="yes">Alice</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Bob</attribute>
+ <attribute name="action">win.author-name</attribute>
+ <attribute name="target" translatable="yes">Bob</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Carol</attribute>
+ <attribute name="action">win.author-name</attribute>
+ <attribute name="target" translatable="yes">Carol</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">David</attribute>
+ <attribute name="action">win.author-name</attribute>
+ <attribute name="target" translatable="yes">David</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Eve</attribute>
+ <attribute name="action">win.author-name</attribute>
+ <attribute name="target" translatable="yes">Eve</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Mallory</attribute>
+ <attribute name="action">win.author-name</attribute>
+ <attribute name="target" translatable="yes">Mallory</attribute>
+ </item>
+ </section>
+ </menu>
+ <menu id="author_name_color_menu">
+ <section>
+ <item>
+ <attribute name="label" translatable="yes">Black</attribute>
+ <attribute name="action">win.author-name-color</attribute>
+ <attribute name="target">black</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">White</attribute>
+ <attribute name="action">win.author-name-color</attribute>
+ <attribute name="target">white</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Red</attribute>
+ <attribute name="action">win.author-name-color</attribute>
+ <attribute name="target">red</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Green</attribute>
+ <attribute name="action">win.author-name-color</attribute>
+ <attribute name="target">green</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Blue</attribute>
+ <attribute name="action">win.author-name-color</attribute>
+ <attribute name="target">blue</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Yellow</attribute>
+ <attribute name="action">win.author-name-color</attribute>
+ <attribute name="target">yellow</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Purple</attribute>
+ <attribute name="action">win.author-name-color</attribute>
+ <attribute name="target">purple</attribute>
+ </item>
+ </section>
+ </menu>
+ <object class="TalkatuHtmlBuffer" id="buffer_html">
+ <signal name="changed" handler="talkatu_demo_window_buffer_modified_cb"/>
+ </object>
+ <object class="TalkatuMarkdownBuffer" id="buffer_markdown">
+ <signal name="changed" handler="talkatu_demo_window_buffer_modified_cb"/>
+ </object>
+ <object class="TalkatuBuffer" id="buffer_plain">
+ <signal name="changed" handler="talkatu_demo_window_buffer_modified_cb"/>
+ </object>
+ <object class="TalkatuWholeBuffer" id="buffer_whole">
+ <property name="style">whole</property>
+ <signal name="changed" handler="talkatu_demo_window_buffer_modified_cb"/>
+ </object>
+</interface>
--- a/demo/data/meson.build Sun Jan 15 21:28:59 2023 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-bpfiles = [
- 'demo.blp'
-]
-
-# We need to define our outputs from the custom_target, so we just create a new
-# list based off of the input with the extension changed.
-uifiles = []
-foreach bpfile : bpfiles
- uifiles += bpfile.replace('.blp', '.ui')
-endforeach
-
-blueprints = custom_target('blueprints',
- input: files(bpfiles),
- output: uifiles,
- command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTDIR@', '@CURRENT_SOURCE_DIR@', '@INPUT@'],
- depends: [talkatu, talkatu_gir],
- env: bpenv,
-)
-
-talkatudemo_resources = gnome.compile_resources(
- 'talkatudemoresources',
- 'talkatudemo.gresource.xml',
- c_name: 'talkatudemo',
- source_dir: '.',
- dependencies: [blueprints],
-)
--- a/demo/meson.build Sun Jan 15 21:28:59 2023 -0600
+++ b/demo/meson.build Tue Feb 21 21:33:39 2023 -0600
@@ -7,7 +7,15 @@
'talkatudemowindow.h',
]
-subdir('data')
+###############################################################################
+# Resources
+###############################################################################
+talkatudemo_resources = gnome.compile_resources(
+ 'talkatudemoresources',
+ 'data/talkatudemo.gresource.xml',
+ c_name: 'talkatudemo',
+ source_dir: 'data'
+)
###############################################################################
# Demo program
--- a/meson.build Sun Jan 15 21:28:59 2023 -0600
+++ b/meson.build Tue Feb 21 21:33:39 2023 -0600
@@ -96,7 +96,6 @@
toplevel_inc = include_directories('.')
-bpenv = environment()
doc_targets = []
###############################################################################
--- a/po/POTFILES Sun Jan 15 21:28:59 2023 -0600
+++ b/po/POTFILES Tue Feb 21 21:33:39 2023 -0600
@@ -1,4 +1,4 @@
-demo/data/demo.blp
+demo/data/demo.ui
demo/talkatudemo.c
demo/talkatudemowindow.c
talkatu/data/attachmentdialog.ui
--- a/subprojects/blueprint-compiler.wrap Sun Jan 15 21:28:59 2023 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-[wrap-git]
-directory = blueprint-compiler
-url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git
-revision = main
-depth = 1
-
-[provide]
-program_names = blueprint-compiler
\ No newline at end of file
--- a/talkatu/meson.build Sun Jan 15 21:28:59 2023 -0600
+++ b/talkatu/meson.build Tue Feb 21 21:33:39 2023 -0600
@@ -198,8 +198,6 @@
symbol_prefix : 'talkatu',
)
TALKATU_GENERATED_TARGETS += talkatu_gir
-
- bpenv.append('GI_TYPELIB_PATH', meson.current_build_dir())
endif
###############################################################################