summaryrefslogtreecommitdiff
path: root/gtkdoc/scangobj.py
diff options
context:
space:
mode:
Diffstat (limited to 'gtkdoc/scangobj.py')
-rw-r--r--gtkdoc/scangobj.py93
1 files changed, 87 insertions, 6 deletions
diff --git a/gtkdoc/scangobj.py b/gtkdoc/scangobj.py
index 003c517..bf4e1ea 100644
--- a/gtkdoc/scangobj.py
+++ b/gtkdoc/scangobj.py
@@ -100,6 +100,7 @@ const gchar *hierarchy_filename = "${new_hierarchy_filename}";
const gchar *interfaces_filename = "${new_interfaces_filename}";
const gchar *prerequisites_filename = "${new_prerequisites_filename}";
const gchar *args_filename = "${new_args_filename}";
+const gchar *actions_filename = "${new_actions_filename}";
static void output_signals (void);
static void output_object_signals (FILE *fp,
@@ -125,6 +126,9 @@ static void output_prerequisites (FILE *fp,
static void output_args (void);
static void output_object_args (FILE *fp, GType object_type);
+static void output_actions (void);
+static void output_object_actions (FILE *fp, GType object_type);
+
int
main (${main_func_params})
{
@@ -137,6 +141,7 @@ main (${main_func_params})
output_object_interfaces ();
output_interface_prerequisites ();
output_args ();
+ output_actions ();
return 0;
}
@@ -334,29 +339,37 @@ get_type_name (GType type, gboolean * is_pointer)
switch (type) {
case G_TYPE_NONE:
- case G_TYPE_CHAR:
case G_TYPE_UCHAR:
case G_TYPE_BOOLEAN:
- case G_TYPE_INT:
case G_TYPE_UINT:
case G_TYPE_LONG:
case G_TYPE_ULONG:
- case G_TYPE_FLOAT:
- case G_TYPE_DOUBLE:
case G_TYPE_POINTER:
/* These all have normal C type names so they are OK. */
return type_name;
+ case G_TYPE_CHAR:
+ return "char";
+
+ case G_TYPE_INT:
+ return "int";
+
+ case G_TYPE_FLOAT:
+ return "float";
+
+ case G_TYPE_DOUBLE:
+ return "double";
+
case G_TYPE_STRING:
/* A GtkString is really a gchar*. */
*is_pointer = TRUE;
- return "gchar";
+ return "char";
case G_TYPE_ENUM:
case G_TYPE_FLAGS:
/* We use a gint for both of these. Hopefully a subtype with a decent
name will be registered and used instead, as GTK+ does itself. */
- return "gint";
+ return "int";
case G_TYPE_BOXED:
/* The boxed type shouldn't be used itself, only subtypes. Though we
@@ -566,6 +579,71 @@ output_prerequisites (FILE *fp,
}
static void
+output_actions (void)
+{
+ FILE *fp;
+ gint i;
+
+ fp = fopen (actions_filename, "w");
+ if (fp == NULL) {
+ g_warning ("Couldn't open output file: %s : %s", actions_filename, g_strerror(errno));
+ return;
+ }
+
+ for (i = 0; object_types[i]; i++) {
+ output_object_actions (fp, object_types[i]);
+ }
+
+ fclose (fp);
+}
+
+static void
+output_object_actions (FILE *fp, GType object_type)
+{
+ gpointer class;
+
+ if (!G_TYPE_IS_OBJECT (object_type))
+ return;
+
+ class = g_type_class_peek (object_type);
+ if (!class)
+ return;
+
+#ifdef GTK_IS_WIDGET_CLASS
+#if GTK_CHECK_VERSION(3,96,0)
+ if (GTK_IS_WIDGET_CLASS (class)) {
+ guint i = 0;
+ const char *action_name;
+ GType owner;
+ const GVariantType *parameter_type;
+ const char *property_name;
+ const gchar *object_class_name;
+
+ object_class_name = g_type_name (object_type);
+ while (gtk_widget_class_query_action (GTK_WIDGET_CLASS (class),
+ i,
+ &owner,
+ &action_name,
+ &parameter_type,
+ &property_name)) {
+ i++;
+ if (owner == G_TYPE_FROM_CLASS (class))
+ fprintf (fp, "<ACTION>\\n"
+ "<NAME>%s:::%s</NAME>\\n"
+ "<PARAMETER>%s</PARAMETER>\\n"
+ "<PROPERTY>%s</PROPERTY>\\n"
+ "</ACTION>\\n\\n",
+ object_class_name,
+ action_name,
+ parameter_type ? g_variant_type_peek_string (parameter_type) : "",
+ property_name ? property_name : "");
+ }
+ }
+#endif
+#endif
+}
+
+static void
output_args (void)
{
FILE *fp;
@@ -1225,6 +1303,8 @@ def run(options):
new_prerequisites_filename = base_filename + '.prerequisites.new'
old_args_filename = base_filename + '.args'
new_args_filename = base_filename + '.args.new'
+ old_actions_filename = base_filename + '.actions'
+ new_actions_filename = base_filename + '.actions.new'
# generate a C program to scan the types
@@ -1335,5 +1415,6 @@ def run(options):
common.UpdateFileIfChanged(old_interfaces_filename, new_interfaces_filename, False)
common.UpdateFileIfChanged(old_prerequisites_filename, new_prerequisites_filename, False)
common.UpdateFileIfChanged(old_args_filename, new_args_filename, False)
+ common.UpdateFileIfChanged(old_actions_filename, new_actions_filename, False)
return 0