talkatu/talkatu

Convert TalkatuToolbar to GTK4
gtk4
2022-01-15, Elliott Sales de Andrade
d64f9c14a281
Parents 45a3c612332c
Children b6ad374a15c6
Convert TalkatuToolbar to GTK4

This is rather straightforward, because it simply involves replacing a toolbar with a box using a 'toolbar' style, and then running conversion on the `.ui` file.

Testing Done:
Compiled only the `talkatutoolbar.c.o` which passed. Also ran the `.ui` file through the GTK4 previewer.

Reviewed at https://reviews.imfreedom.org/r/1233/
--- a/talkatu/data/toolbar.ui Sat Jan 15 20:03:01 2022 -0600
+++ b/talkatu/data/toolbar.ui Sat Jan 15 23:09:20 2022 -0600
@@ -19,189 +19,124 @@
-->
<interface>
- <requires lib="gtk+" version="3.20"/>
+ <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="TalkatuToolbar" parent="GtkToolbar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <template class="TalkatuToolbar" parent="GtkBox">
+ <style>
+ <class name="toolbar"/>
+ </style>
+ <property name="can_focus">0</property>
<child>
- <object class="GtkToggleToolButton" id="format_bold">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkToggleButton" id="format_bold">
+ <property name="can_focus">0</property>
<property name="action_name">talkatu.format-bold</property>
<property name="label" translatable="yes">Bold</property>
<property name="icon_name">format-text-bold</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkToggleToolButton" id="format_italic">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkToggleButton" id="format_italic">
+ <property name="can_focus">0</property>
<property name="action_name">talkatu.format-italic</property>
<property name="label" translatable="yes">Italic</property>
<property name="icon_name">format-text-italic</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkToggleToolButton" id="format_underline">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkToggleButton" id="format_underline">
+ <property name="can_focus">0</property>
<property name="action_name">talkatu.format-underline</property>
<property name="label" translatable="yes">Underline</property>
<property name="icon_name">format-text-underline</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkToggleToolButton" id="format_strikethrough">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkToggleButton" id="format_strikethrough">
+ <property name="can_focus">0</property>
<property name="action_name">talkatu.format-strikethrough</property>
<property name="label" translatable="yes">Strikethrough</property>
<property name="icon_name">format-text-strikethrough</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkSeparatorToolItem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkSeparator">
+ <property name="orientation">vertical</property>
+ <property name="can_focus">0</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkToolButton" id="format_larger">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkButton" id="format_larger">
+ <property name="can_focus">0</property>
<property name="action_name">talkatu.format-grow</property>
<property name="label" translatable="yes">Increase Font Size</property>
<property name="icon_name">zoom-in</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkToolButton" id="format_smaller">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkButton" id="format_smaller">
+ <property name="can_focus">0</property>
<property name="action_name">talkatu.format-shrink</property>
<property name="label" translatable="yes">Decrease Font Size</property>
<property name="icon_name">zoom-out</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkSeparatorToolItem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkSeparator">
+ <property name="orientation">vertical</property>
+ <property name="can_focus">0</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkToolButton" id="format_reset">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkButton" id="format_reset">
+ <property name="can_focus">0</property>
<property name="action_name">talkatu.format-reset</property>
<property name="label" translatable="yes">Clear Formatting</property>
<property name="icon_name">edit-clear</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkSeparatorToolItem">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkSeparator">
+ <property name="orientation">vertical</property>
+ <property name="can_focus">0</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkToggleToolButton" id="insert_link">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkToggleButton" id="insert_link">
+ <property name="can_focus">0</property>
<property name="action_name">talkatu.insert-link</property>
<property name="label" translatable="yes">Insert Link</property>
- <property name="use_underline">True</property>
+ <property name="use_underline">1</property>
<property name="icon_name">insert-link</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkToolButton" id="insert_file">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkButton" id="insert_file">
+ <property name="can_focus">0</property>
<property name="action_name">talkatu.attach-file</property>
<property name="label" translatable="yes">Attach File</property>
<property name="icon_name">insert-object</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkToolButton" id="insert_code">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkButton" id="insert_code">
+ <property name="can_focus">0</property>
<property name="action_name">talkatu.insert-code</property>
<property name="label" translatable="yes">Insert Code</property>
- <property name="use_underline">True</property>
+ <property name="use_underline">1</property>
<property name="icon_name">insert-text</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
<child>
- <object class="GtkToolButton" id="insert_emoji">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
+ <object class="GtkButton" id="insert_emoji">
+ <property name="can_focus">0</property>
<property name="action_name">talkatu.insert-emoji</property>
<property name="label" translatable="yes">Insert Emoji</property>
- <property name="use_underline">True</property>
+ <property name="use_underline">1</property>
<property name="icon_name">face-smile-big</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="homogeneous">True</property>
- </packing>
</child>
</template>
</interface>
--- a/talkatu/talkatutoolbar.c Sat Jan 15 20:03:01 2022 -0600
+++ b/talkatu/talkatutoolbar.c Sat Jan 15 23:09:20 2022 -0600
@@ -28,10 +28,10 @@
* autonomous.
*/
struct _TalkatuToolbar {
- GtkToolbar parent;
+ GtkBox parent;
};
-G_DEFINE_TYPE(TalkatuToolbar, talkatu_toolbar, GTK_TYPE_TOOLBAR)
+G_DEFINE_TYPE(TalkatuToolbar, talkatu_toolbar, GTK_TYPE_BOX)
/******************************************************************************
* GObject Stuff
--- a/talkatu/talkatutoolbar.h Sat Jan 15 20:03:01 2022 -0600
+++ b/talkatu/talkatutoolbar.h Sat Jan 15 23:09:20 2022 -0600
@@ -32,7 +32,7 @@
#define TALKATU_TYPE_TOOLBAR (talkatu_toolbar_get_type())
-G_DECLARE_FINAL_TYPE(TalkatuToolbar, talkatu_toolbar, TALKATU, TOOLBAR, GtkToolbar)
+G_DECLARE_FINAL_TYPE(TalkatuToolbar, talkatu_toolbar, TALKATU, TOOLBAR, GtkBox)
GtkWidget *talkatu_toolbar_new(void);