talkatu/talkatu

Fix the input in the demo.
gtk4
2022-02-03, Gary Kramlich
1819a3f27516
Parents a315690c201a
Children ec6ee2eb8e8f
Fix the input in the demo.

We had some over zealous can-focus's set to 0 which was the main issue. The
other stuff was just stuff to clean up I found along the way.

Testing Done:
Ran the demo verified I can input text. Sending is still broken but that's another matter entirely...

Reviewed at https://reviews.imfreedom.org/r/1283/
--- a/demo/data/demo.ui Wed Feb 02 03:11:10 2022 -0600
+++ b/demo/data/demo.ui Thu Feb 03 20:20:40 2022 -0600
@@ -26,7 +26,6 @@
<!-- interface-description GTK widgets for chat applications -->
<!-- interface-copyright Gary Kramlich <grim@reaperworld.com> -->
<template class="TalkatuDemoWindow" parent="GtkApplicationWindow">
- <property name="can-focus">0</property>
<property name="child">
<object class="GtkPaned">
<property name="shrink-end-child">0</property>
@@ -35,11 +34,9 @@
<property name="wide-handle">1</property>
<child>
<object class="TalkatuScrolledWindow">
- <property name="can-focus">1</property>
<child>
<object class="TalkatuHistory" id="history">
<property name="name">history</property>
- <property name="can-focus">1</property>
<property name="hexpand-set">True</property>
<property name="vexpand-set">True</property>
</object>
@@ -48,7 +45,6 @@
</child>
<child>
<object class="GtkBox">
- <property name="can-focus">0</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
@@ -208,7 +204,6 @@
<property name="vexpand">1</property>
<property name="orientation">vertical</property>
<property name="visible">True</property>
- <property name="hexpand-set">True</property>
<property name="vexpand-set">True</property>
<child internal-child="toolbar">
<object class="TalkatuToolbar">
@@ -218,10 +213,9 @@
</child>
<child internal-child="input">
<object class="TalkatuInput">
- <property name="hexpand-set">True</property>
- <property name="vexpand-set">True</property>
<property name="buffer">buffer_plain</property>
<property name="author">Alice</property>
+ <property name="send-binding">1</property>
<signal name="open-url" handler="talkatu_demo_window_view_open_url_cb" object="TalkatuDemoWindow" swapped="no"/>
<signal name="send-message" handler="talkatu_demo_window_view_send_message_cb" object="TalkatuDemoWindow" swapped="no"/>
</object>
--- a/talkatu/data/input.ui Wed Feb 02 03:11:10 2022 -0600
+++ b/talkatu/data/input.ui Thu Feb 03 20:20:40 2022 -0600
@@ -32,8 +32,6 @@
</section>
</menu>
<template class="TalkatuInput" parent="TalkatuView">
- <property name="editable">1</property>
- <property name="cursor-visible">1</property>
<property name="extra-menu">model</property>
<signal name="notify::buffer" handler="talkatu_input_buffer_set_cb"/>
</template>
--- a/talkatu/talkatuinput.c Wed Feb 02 03:11:10 2022 -0600
+++ b/talkatu/talkatuinput.c Thu Feb 03 20:20:40 2022 -0600
@@ -67,11 +67,6 @@
TalkatuInputSendBinding send_binding;
- /* this mark is used to keep track of our context for the context menu. It
- * is updated via cursor-moved and button-press callbacks.
- */
- GtkTextMark *context_mark;
-
/* TalkatuMessage properties: content type and contents are derived from
* the widget itself.
*/
@@ -386,17 +381,8 @@
static void
talkatu_input_buffer_set_cb(GObject *view, GParamSpec *pspec, gpointer data) {
- TalkatuInputPrivate *priv = NULL;
TalkatuInput *input = TALKATU_INPUT(view);
GtkTextBuffer *buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(view));
- GtkTextIter start;
-
- priv = talkatu_input_get_instance_private(input);
-
- /* grab our context_mark */
- gtk_text_buffer_get_start_iter(buffer, &start);
- priv->context_mark = gtk_text_buffer_create_mark(buffer, NULL, &start,
- TRUE);
if(TALKATU_IS_BUFFER(buffer)) {
GSimpleActionGroup *ag = NULL;
--- a/talkatu/talkatuview.c Wed Feb 02 03:11:10 2022 -0600
+++ b/talkatu/talkatuview.c Thu Feb 03 20:20:40 2022 -0600
@@ -358,8 +358,5 @@
* Returns: (transfer full): The new #TalkatuView.
*/
GtkWidget *talkatu_view_new_with_buffer(GtkTextBuffer *buffer) {
- return GTK_WIDGET(g_object_new(
- TALKATU_TYPE_VIEW,
- "buffer", buffer,
- NULL));
+ return g_object_new(TALKATU_TYPE_VIEW, "buffer", buffer, NULL);
}
--- a/talkatu/talkatuview.h Wed Feb 02 03:11:10 2022 -0600
+++ b/talkatu/talkatuview.h Thu Feb 03 20:20:40 2022 -0600
@@ -30,8 +30,7 @@
G_BEGIN_DECLS
-#define TALKATU_TYPE_VIEW (talkatu_view_get_type())
-
+#define TALKATU_TYPE_VIEW (talkatu_view_get_type())
G_DECLARE_DERIVABLE_TYPE(TalkatuView, talkatu_view, TALKATU, VIEW, GtkTextView)
struct _TalkatuViewClass {