talkatu/talkatu

Update the attachment dialog for GTK4
gtk4
2022-01-16, Gary Kramlich
b6ad374a15c6
Parents d64f9c14a281
Children ca193e4176a8
Update the attachment dialog for GTK4

Testing Done:
Compiled and verified that all warnings/errors were fixed in `talkatuattachmentdialog.c`

Reviewed at https://reviews.imfreedom.org/r/1234/
--- a/talkatu/data/attachmentdialog.ui Sat Jan 15 23:09:20 2022 -0600
+++ b/talkatu/data/attachmentdialog.ui Sun Jan 16 00:10:38 2022 -0600
@@ -19,102 +19,40 @@
-->
<interface>
- <requires lib="gtk+" version="3.18"/>
+ <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="TalkatuAttachmentDialog" parent="GtkDialog">
- <property name="can_focus">False</property>
<property name="border_width">12</property>
- <property name="modal">True</property>
+ <property name="modal">1</property>
<property name="type_hint">dialog</property>
<child>
<placeholder/>
</child>
- <child internal-child="vbox">
+ <child internal-child="content_area">
<object class="GtkBox">
- <property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox">
- <property name="can_focus">False</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="cancel">
- <property name="label" translatable="yes">Cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="upload">
- <property name="label" translatable="yes">Upload</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">True</property>
- <accelerator key="Return" signal="clicked"/>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
<child>
<object class="GtkImage" id="preview">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="pixel_size">256</property>
<property name="icon_name">text-x-generic-template</property>
<property name="icon_size">6</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="filename">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label" translatable="yes">&lt;filename&gt;</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="comment">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
+ <property name="focusable">1</property>
+ <property name="has_focus">1</property>
<property name="placeholder_text" translatable="yes">Comment (optional)</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
</child>
</object>
</child>
@@ -122,5 +60,39 @@
<action-widget response="-6">cancel</action-widget>
<action-widget response="-3">upload</action-widget>
</action-widgets>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="valign">center</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="cancel">
+ <property name="label" translatable="yes">Cancel</property>
+ <property name="focusable">1</property>
+ <property name="receives_default">1</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="upload">
+ <property name="label" translatable="yes">Upload</property>
+ <property name="focusable">1</property>
+ <property name="can_default">True</property>
+ <property name="has_default">1</property>
+ <property name="receives_default">1</property>
+ <accelerator key="Return" signal="clicked"/>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
</template>
</interface>
--- a/talkatu/talkatuattachmentdialog.c Sat Jan 15 23:09:20 2022 -0600
+++ b/talkatu/talkatuattachmentdialog.c Sun Jan 16 00:10:38 2022 -0600
@@ -57,8 +57,7 @@
gchar *filename = NULL;
if(G_IS_ICON(preview)) {
- gtk_image_set_from_gicon(GTK_IMAGE(dialog->preview), preview,
- GTK_ICON_SIZE_DIALOG);
+ gtk_image_set_from_gicon(GTK_IMAGE(dialog->preview), preview);
g_object_unref(G_OBJECT(preview));
}
@@ -77,7 +76,7 @@
const gchar *comment)
{
if(GTK_IS_ENTRY(dialog->comment)) {
- gtk_entry_set_text(GTK_ENTRY(dialog->comment), comment);
+ gtk_editable_set_text(GTK_EDITABLE(dialog->comment), comment);
g_object_notify_by_pspec(G_OBJECT(dialog), properties[PROP_COMMENT]);
}
@@ -228,7 +227,7 @@
g_return_val_if_fail(TALKATU_IS_ATTACHMENT_DIALOG(dialog), "");
if(GTK_IS_ENTRY(dialog->comment)) {
- return gtk_entry_get_text(GTK_ENTRY(dialog->comment));
+ return gtk_editable_get_text(GTK_EDITABLE(dialog->comment));
}
return "";