talkatu/talkatu

Update the link dialog for GTK4
gtk4
2022-01-30, Gary Kramlich
b4f3b89be881
Parents 2d2b2cb17fbc
Children 542c86172f56
Update the link dialog for GTK4

Testing Done:
Compiled and verified that `talkatulinkdialog.c` had no warnings or errors.

Reviewed at https://reviews.imfreedom.org/r/1235/
--- a/talkatu/data/linkdialog.ui Sun Jan 30 04:31:21 2022 -0600
+++ b/talkatu/data/linkdialog.ui Sun Jan 30 05:01:15 2022 -0600
@@ -19,180 +19,74 @@
-->
<interface>
- <requires lib="gtk+" version="3.10"/>
+ <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="TalkatuLinkDialog" parent="GtkDialog">
- <property name="can_focus">False</property>
<property name="title" translatable="yes">Insert Link</property>
- <property name="resizable">False</property>
- <property name="type_hint">dialog</property>
- <child>
- <placeholder/>
- </child>
- <child internal-child="vbox">
+ <property name="resizable">0</property>
+ <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="name">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="insert">
- <property name="label" translatable="yes">Insert</property>
- <property name="name">insert</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>
- </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="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">4</property>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">&lt;span font-size="large" font-weight="bold"&gt;Insert Link&lt;/span&gt;</property>
- <property name="use_markup">True</property>
+ <property name="label" translatable="yes">&lt;span font-size=&quot;large&quot; font-weight=&quot;bold&quot;&gt;Insert Link&lt;/span&gt;</property>
+ <property name="use_markup">1</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label" translatable="yes">Please enter the URL and optional display text you would like to insert.</property>
- <property name="wrap">True</property>
+ <property name="wrap">1</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="url_label">
<property name="name">url_label</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label" translatable="yes">URL:</property>
<property name="xalign">0</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="url">
+ <property name="hexpand">1</property>
<property name="name">url</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="focusable">1</property>
<property name="input_purpose">url</property>
</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">True</property>
- <property name="position">2</property>
- </packing>
</child>
<child>
<object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="spacing">2</property>
<child>
<object class="GtkLabel" id="display_label">
<property name="name">display_label</property>
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="label" translatable="yes">Display Text:</property>
<property name="xalign">0</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkEntry" id="display">
+ <property name="hexpand">1</property>
<property name="name">display</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="focusable">1</property>
</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">True</property>
- <property name="position">3</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
</child>
@@ -200,6 +94,22 @@
<action-widget response="-6">cancel</action-widget>
<action-widget response="-3">insert</action-widget>
</action-widgets>
+ <child type="action">
+ <object class="GtkButton" id="cancel">
+ <property name="label" translatable="yes">Cancel</property>
+ <property name="name">cancel</property>
+ <property name="focusable">1</property>
+ <property name="receives_default">1</property>
+ </object>
+ </child>
+ <child type="action">
+ <object class="GtkButton" id="insert">
+ <property name="label" translatable="yes">Insert</property>
+ <property name="name">insert</property>
+ <property name="focusable">1</property>
+ <property name="receives_default">1</property>
+ </object>
+ </child>
</template>
<object class="GtkSizeGroup">
<widgets>
--- a/talkatu/talkatulinkdialog.c Sun Jan 30 04:31:21 2022 -0600
+++ b/talkatu/talkatulinkdialog.c Sun Jan 30 05:01:15 2022 -0600
@@ -90,7 +90,7 @@
if(GTK_IS_ENTRY(dialog->url)) {
gchar *raw = NULL, *ret = NULL;
- raw = g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog->url)));
+ raw = g_strdup(gtk_editable_get_text(GTK_EDITABLE(dialog->url)));
ret = g_strdup(g_strstrip(raw));
g_free(raw);
@@ -116,7 +116,7 @@
if(GTK_IS_ENTRY(dialog->display)) {
gchar *ret = NULL;
- ret = g_strdup(gtk_entry_get_text(GTK_ENTRY(dialog->display)));
+ ret = g_strdup(gtk_editable_get_text(GTK_EDITABLE(dialog->display)));
return g_strstrip(ret);
}