Commit f0925bf0175acf1092a79b6b631e3d8424afc5c2

Jeremy JEANNE 2024-12-11T02:12:34

gtk set window title

diff --git a/gtk4/types.h b/gtk4/types.h
index 6e32ec0..628537e 100644
--- a/gtk4/types.h
+++ b/gtk4/types.h
@@ -14,5 +14,6 @@
 #define KC3_GTK4_TYPES_H
 
 #include <gtk/gtk.h>
+#include <libkc3/types.h>
 
 #endif /* KC3_GTK4_TYPES_H */
diff --git a/gtk4/window.c b/gtk4/window.c
index 373e4dd..6496fd1 100644
--- a/gtk4/window.c
+++ b/gtk4/window.c
@@ -12,19 +12,25 @@
  */
 #include "window.h"
 
-void kc3_gtk4_window_destroy (GtkWindow **ptr)
+void kc3_gtk4_window_destroy (GtkWindow **window)
 {
-  gtk_window_destroy(*ptr);
+  gtk_window_destroy(*window);
 }
 
-GtkWidget ** kc3_gtk4_window_new (GtkWidget **ptr)
+GtkWidget ** kc3_gtk4_window_new (GtkWidget **window)
 {
-  if (! (*ptr = gtk_window_new()))
+  if (! (*window = gtk_window_new()))
     return NULL;
-  return ptr;
+  return window;
 }
 
-void kc3_gtk4_window_present (GtkWindow **ptr)
+void kc3_gtk4_window_present (GtkWindow **window)
 {
-  gtk_window_present(*ptr);
+  gtk_window_present(*window);
 }
+
+void kc3_gtk4_window_set_title (GtkWindow **window, const s_str *title)
+{
+  gtk_window_set_title(*window, title->ptr.pchar);
+}
+
diff --git a/gtk4/window.h b/gtk4/window.h
index 17fe550..6151eb5 100644
--- a/gtk4/window.h
+++ b/gtk4/window.h
@@ -17,10 +17,11 @@
 
 /* Heap-allocation functions, call kc3_gtk4_window_destroy
    after use. */
-void         kc3_gtk4_window_destroy (GtkWindow **ptr);
-GtkWidget ** kc3_gtk4_window_new (GtkWidget **ptr);
+void         kc3_gtk4_window_destroy (GtkWindow **window);
+GtkWidget ** kc3_gtk4_window_new (GtkWidget **window);
 
 /* Operators. */
-void kc3_gtk4_window_present (GtkWindow **ptr);
+void kc3_gtk4_window_present (GtkWindow **window);
+void kc3_gtk4_window_set_title (GtkWindow **window, const s_str *title);
 
 #endif /* KC3_GTK4_WINDOW_H */
diff --git a/lib/kc3/0.1/gtk4/window.kc3 b/lib/kc3/0.1/gtk4/window.kc3
index 88f9f9f..2967453 100644
--- a/lib/kc3/0.1/gtk4/window.kc3
+++ b/lib/kc3/0.1/gtk4/window.kc3
@@ -9,4 +9,6 @@ defmodule Gtk4.Window do
 
   def present = cfn Void "kc3_gtk4_window_present" (Ptr)
 
+  def set_title = cfn Void "kc3_gtk4_window_set_title" (Ptr, Str)
+
 end