Commit 0994ba7f751a7714e277a3a21069fc2472e72ef6

Jeremy JEANNE 2024-12-17T12:18:39

g_menu_item_new

diff --git a/gtk4/menu_item.c b/gtk4/menu_item.c
new file mode 100644
index 0000000..7ef41e4
--- /dev/null
+++ b/gtk4/menu_item.c
@@ -0,0 +1,26 @@
+/* kc3
+ * Copyright 2022,2023,2024 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#include "menu_item.h"
+
+GMenuItem ** kc3_gtk4_menu_item_new (GMenuItem **dest,
+				     const s_str *label,
+				     const s_str *detailed_action)
+{
+  GMenuItem * tmp;
+  if (! (tmp = g_menu_item_new(label->ptr.pchar,
+			       detailed_action->ptr.pchar)))
+    return NULL;
+  *dest = tmp;
+  return dest;
+}
+
diff --git a/gtk4/menu_item.h b/gtk4/menu_item.h
new file mode 100644
index 0000000..922dd2b
--- /dev/null
+++ b/gtk4/menu_item.h
@@ -0,0 +1,24 @@
+/* kc3
+ * Copyright 2022,2023,2024 kmx.io <contact@kmx.io>
+ *
+ * Permission is hereby granted to use this software granted the above
+ * copyright notice and this permission paragraph are included in all
+ * copies and substantial portions of this software.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+ * PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+ * AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+#ifndef KC3_GTK4_MENU_ITEM_H
+#define KC3_GTK4_MENU_ITEM_H
+
+#include "types.h"
+
+/* Heap-allocation functions, call kc3_gtk4_application_delete
+   after use. */
+GMenuItem ** kc3_gtk4_menu_item_new (GMenuItem **dest,
+				    const s_str *label,
+				    const s_str *detailed_action);
+
+#endif /*  KC3_GTK4_MENU_ITEM_H */