diff --git a/gtk4/entry.c b/gtk4/entry.c
index 2cff3ac..de6a5fb 100644
--- a/gtk4/entry.c
+++ b/gtk4/entry.c
@@ -40,3 +40,14 @@ s_str * kc3_gtk4_entry_get_text (GtkEntry **entry, s_str *dest)
}
return str_init_1_alloc(dest, s);
}
+
+void kc3_gtk4_entry_set_text (GtkEntry **entry, s_str *text)
+{
+ GtkEntryBuffer *buffer;
+ if (! (buffer = gtk_entry_get_buffer(GTK_ENTRY(*entry)))) {
+ err_puts("kc3_gtk4_entry_set_text: gtk_entry_get_buffer");
+ assert(! "kc3_gtk4_entry_set_text: gtk_entry_get_buffer");
+ return;
+ }
+ gtk_entry_buffer_set_text(buffer, text->ptr.pchar, text->size);
+}
diff --git a/gtk4/entry.h b/gtk4/entry.h
index 3b84c29..7f8a2ff 100644
--- a/gtk4/entry.h
+++ b/gtk4/entry.h
@@ -19,5 +19,7 @@
GtkWidget ** kc3_gtk4_entry_new (GtkWidget **dest);
/* Operators. */
+s_str * kc3_gtk4_entry_get_text (GtkEntry **entry, s_str *dest);
+void kc3_gtk4_entry_set_text (GtkEntry **entry, s_str *text);
#endif /* KC3_GTK4_ENTRY_H */
diff --git a/kmsg/kmsg.kc3 b/kmsg/kmsg.kc3
index 3a75cab..b0bba28 100755
--- a/kmsg/kmsg.kc3
+++ b/kmsg/kmsg.kc3
@@ -20,7 +20,7 @@ defmodule Kmsg do
require Gtk4.Window
require List
- def connect = fn (action, void) {
+ def on_connect = fn (action, void) {
puts("Kmsg.connect")
window = Gtk4.Window.new()
Gtk4.Window.set_title(window, "Kmsg: Connect")
@@ -58,24 +58,24 @@ defmodule Kmsg do
Gtk4.ListBox.append(channels, label)
label
})
- Gtk4.ScrolledWindow.set_child(scrolled_window1, list_box1)
+ Gtk4.ScrolledWindow.set_child(scrolled_window1, channels)
Gtk4.Paned.set_start_child(paned, scrolled_window1)
Gtk4.Paned.set_resize_start_child(paned, true)
Gtk4.Paned.set_shrink_start_child(paned, false)
box1 = Gtk4.Box.new(:vertical, 0)
scrolled_window2 = Gtk4.ScrolledWindow.new()
- list_box2 = Gtk4.ListBox.new()
- Gtk4.Widget.set_vexpand(list_box2, true)
+ list_box = Gtk4.ListBox.new()
+ Gtk4.Widget.set_vexpand(list_box, true)
labels2 = List.map(List.count(200), fn (x) {
label = Gtk4.Label.new("<b>thodg</b>: Message <i>with <b>markup</b></i> !")
Gtk4.Label.set_use_markup(label, true)
Gtk4.Widget.set_halign(label, :start)
- Gtk4.ListBox.append(list_box2, label)
+ Gtk4.ListBox.append(list_box, label)
label
})
Gtk4.Paned.set_resize_end_child(paned, false)
Gtk4.Paned.set_shrink_end_child(paned, false)
- Gtk4.ScrolledWindow.set_child(scrolled_window2, list_box2)
+ Gtk4.ScrolledWindow.set_child(scrolled_window2, list_box)
Gtk4.Box.append(box1, scrolled_window2)
box2 = Gtk4.Box.new(:horizontal, 0)
Gtk4.Box.append(box1, box2)
@@ -89,7 +89,7 @@ defmodule Kmsg do
%{window: window, text_view: text_view})
Gtk4.Box.append(box2, button)
Gtk4.Paned.set_position(paned, 240);
- connect_action = Gtk4.SimpleAction.new("connect", Kmsg.connect, void)
+ connect_action = Gtk4.SimpleAction.new("connect", Kmsg.on_connect, void)
Gtk4.ActionMap.add_action(app, connect_action)
Gtk4.Application.set_accel_for_action(app, "app.connect", "<Control>N");
menu = Gtk4.Menu.new()
diff --git a/lib/kc3/0.1/gtk4/entry.kc3 b/lib/kc3/0.1/gtk4/entry.kc3
index cc71189..3032a0a 100644
--- a/lib/kc3/0.1/gtk4/entry.kc3
+++ b/lib/kc3/0.1/gtk4/entry.kc3
@@ -2,4 +2,8 @@ defmodule Gtk4.Entry do
def new = cfn Ptr "kc3_gtk4_entry_new" (Result)
+ def get_text = cfn Str "kc3_gtk4_entry_get_text" (Ptr, Result)
+
+ def set_text = cfn Void "kc3_gtk4_entry_set_text" (Ptr, Str)
+
end
diff --git a/lib/kc3/0.1/gtk4/text_view.kc3 b/lib/kc3/0.1/gtk4/text_view.kc3
index fc96eef..5d80659 100644
--- a/lib/kc3/0.1/gtk4/text_view.kc3
+++ b/lib/kc3/0.1/gtk4/text_view.kc3
@@ -7,4 +7,6 @@ defmodule Gtk4.TextView do
def get_text = cfn Str "kc3_gtk4_text_view_get_text" (Ptr, Result)
+ def set_text = cfn Void "kc3_gtk4_text_view_set_text" (Ptr, Str)
+
end