[gtk/prop-list: 164/165] inspector: Use a column view for actions



commit b0be50daacaf33eb54846aa98bbbe43f6d356216
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Dec 8 01:09:59 2019 -0500

    inspector: Use a column view for actions
    
    A straight conversion from list box to column view.

 gtk/inspector/action-editor.c |  10 +-
 gtk/inspector/action-holder.c |  61 ++++++++
 gtk/inspector/action-holder.h |  17 ++
 gtk/inspector/actions.c       | 356 ++++++++++++++++++++++++++----------------
 gtk/inspector/actions.ui      | 133 +++++++---------
 gtk/inspector/meson.build     |   3 +-
 6 files changed, 362 insertions(+), 218 deletions(-)
---
diff --git a/gtk/inspector/action-editor.c b/gtk/inspector/action-editor.c
index ef6319cc96..11751c06e7 100644
--- a/gtk/inspector/action-editor.c
+++ b/gtk/inspector/action-editor.c
@@ -97,12 +97,14 @@ variant_editor_new (const GVariantType   *type,
   else if (g_variant_type_equal (type, G_VARIANT_TYPE_STRING))
     {
       editor = gtk_entry_new ();
+      gtk_editable_set_width_chars (GTK_EDITABLE (editor), 10);
       g_signal_connect (editor, "notify::text", G_CALLBACK (variant_editor_changed_cb), d);
     }
   else
     {
       editor = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
       entry = gtk_entry_new ();
+      gtk_editable_set_width_chars (GTK_EDITABLE (entry), 10);
       gtk_container_add (GTK_CONTAINER (editor), entry);
       label = gtk_label_new (g_variant_type_peek_string (type));
       gtk_container_add (GTK_CONTAINER (editor), label);
@@ -291,7 +293,8 @@ constructed (GObject *object)
   row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
   activate = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
   gtk_container_add (GTK_CONTAINER (row), activate);
-  gtk_size_group_add_widget (r->priv->sg, activate);
+  if (r->priv->sg)
+    gtk_size_group_add_widget (r->priv->sg, activate);
 
   r->priv->activate_button = gtk_button_new_with_label (_("Activate"));
   g_signal_connect (r->priv->activate_button, "clicked", G_CALLBACK (activate_action), r);
@@ -314,7 +317,8 @@ constructed (GObject *object)
       r->priv->state_type = g_variant_type_copy (g_variant_get_type (state));
       row = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
       label = gtk_label_new (_("Set State"));
-      gtk_size_group_add_widget (r->priv->sg, label);
+      if (r->priv->sg)
+        gtk_size_group_add_widget (r->priv->sg, label);
       gtk_container_add (GTK_CONTAINER (row), label);
       r->priv->state_entry = variant_editor_new (r->priv->state_type, state_changed, r);
       variant_editor_set_value (r->priv->state_entry, state);
@@ -334,7 +338,7 @@ finalize (GObject *object)
   GtkInspectorActionEditor *r = GTK_INSPECTOR_ACTION_EDITOR (object);
 
   g_free (r->priv->name);
-  g_object_unref (r->priv->sg);
+  g_clear_object (&r->priv->sg);
   if (r->priv->state_type)
     g_variant_type_free (r->priv->state_type);
   g_signal_handlers_disconnect_by_func (r->priv->group, action_enabled_changed_cb, r);
diff --git a/gtk/inspector/action-holder.c b/gtk/inspector/action-holder.c
new file mode 100644
index 0000000000..fafef70c93
--- /dev/null
+++ b/gtk/inspector/action-holder.c
@@ -0,0 +1,61 @@
+
+#include "action-holder.h"
+
+struct _ActionHolder {
+  GObject instance;
+
+  GActionGroup *group;
+  char *name;
+};
+
+G_DEFINE_TYPE (ActionHolder, action_holder, G_TYPE_OBJECT)
+
+static void
+action_holder_init (ActionHolder *holder)
+{
+}
+
+static void
+action_holder_finalize (GObject *object)
+{
+  ActionHolder *holder = ACTION_HOLDER (object);
+
+  g_object_unref (holder->group);
+  g_free (holder->name);
+
+  G_OBJECT_CLASS (action_holder_parent_class)->finalize (object);
+}
+
+static void
+action_holder_class_init (ActionHolderClass *class)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+  object_class->finalize = action_holder_finalize;
+}
+
+ActionHolder *
+action_holder_new (GActionGroup *group,
+                   const char   *name)
+{
+  ActionHolder *holder;
+
+  holder = g_object_new (ACTION_TYPE_HOLDER, NULL);
+
+  holder->group = g_object_ref (group);
+  holder->name = g_strdup (name);
+
+  return holder;
+}
+
+GActionGroup *
+action_holder_get_group (ActionHolder *holder)
+{
+  return holder->group;
+}
+
+const char *
+action_holder_get_name (ActionHolder *holder)
+{
+  return holder->name;
+}
diff --git a/gtk/inspector/action-holder.h b/gtk/inspector/action-holder.h
new file mode 100644
index 0000000000..b18df67c03
--- /dev/null
+++ b/gtk/inspector/action-holder.h
@@ -0,0 +1,17 @@
+
+#ifndef __ACTION_HOLDER_H__
+#define __ACTION_HOLDER_H__
+
+#include <gtk/gtk.h>
+
+#define ACTION_TYPE_HOLDER (action_holder_get_type ())
+
+G_DECLARE_FINAL_TYPE (ActionHolder, action_holder, ACTION, HOLDER, GObject)
+
+ActionHolder * action_holder_new     (GActionGroup *group,
+                                      const char   *name);
+
+GActionGroup *action_holder_get_group (ActionHolder *holder);
+const char   *action_holder_get_name  (ActionHolder *holder);
+
+#endif /* __ACTION_HOLDER_H__ */
diff --git a/gtk/inspector/actions.c b/gtk/inspector/actions.c
index 8a2f51604f..9b39390450 100644
--- a/gtk/inspector/actions.c
+++ b/gtk/inspector/actions.c
@@ -20,6 +20,7 @@
 
 #include "actions.h"
 #include "action-editor.h"
+#include "action-holder.h"
 
 #include "gtkapplication.h"
 #include "gtkapplicationwindow.h"
@@ -37,13 +38,11 @@
 struct _GtkInspectorActionsPrivate
 {
   GtkWidget *list;
-  GtkSizeGroup *name;
-  GtkSizeGroup *enabled;
-  GtkSizeGroup *parameter;
-  GtkSizeGroup *state;
-  GtkSizeGroup *activate;
-  GActionGroup *group;
   GtkWidget *button;
+
+  GActionGroup *group;
+  GListModel *actions;
+  GListModel *sorted;
 };
 
 enum {
@@ -61,101 +60,170 @@ gtk_inspector_actions_init (GtkInspectorActions *sl)
 }
 
 static void
-add_action (GtkInspectorActions *sl,
-            GActionGroup        *group,
-            const gchar         *name)
+action_added_cb (GActionGroup        *group,
+                 const gchar         *action_name,
+                 GtkInspectorActions *sl)
+{
+  ActionHolder *holder = action_holder_new (group, action_name);
+  g_list_store_append (G_LIST_STORE (sl->priv->actions), holder);
+  g_object_unref (holder);
+}
+
+
+static void
+setup_name_cb (GtkSignalListItemFactory *factory,
+               GtkListItem              *list_item)
 {
-  gboolean enabled;
-  const gchar *parameter;
-  GVariant *state;
-  gchar *state_string;
-  GtkWidget *row;
   GtkWidget *label;
-  GtkWidget *box;
-  char *key = g_strdup (name);
-  GtkWidget *editor;
 
+  label = gtk_label_new (NULL);
+  gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+  gtk_list_item_set_child (list_item, label);
+}
+
+static void
+bind_name_cb (GtkSignalListItemFactory *factory,
+              GtkListItem              *list_item)
+{
+  gpointer item;
+  GtkWidget *label;
+
+  item = gtk_list_item_get_item (list_item);
+  label = gtk_list_item_get_child (list_item);
+
+  gtk_label_set_label (GTK_LABEL (label), action_holder_get_name (ACTION_HOLDER (item)));
+}
+
+static void
+setup_enabled_cb (GtkSignalListItemFactory *factory,
+                  GtkListItem              *list_item)
+{
+  GtkWidget *label;
+
+  label = gtk_label_new (NULL);
+  gtk_label_set_xalign (GTK_LABEL (label), 0.5);
+  gtk_list_item_set_child (list_item, label);
+}
+
+static void
+bind_enabled_cb (GtkSignalListItemFactory *factory,
+                 GtkListItem              *list_item)
+{
+  gpointer item;
+  GtkWidget *label;
+  GActionGroup *group;
+  const char *name;
+  gboolean enabled;
+
+  item = gtk_list_item_get_item (list_item);
+  label = gtk_list_item_get_child (list_item);
+
+  group = action_holder_get_group (ACTION_HOLDER (item));
+  name = action_holder_get_name (ACTION_HOLDER (item));
   enabled = g_action_group_get_action_enabled (group, name);
-  parameter = (const gchar *)g_action_group_get_action_parameter_type (group, name);
-  state = g_action_group_get_action_state (group, name);
-  if (state)
-    state_string = g_variant_print (state, FALSE);
-  else
-    state_string = g_strdup ("");
 
-  row = gtk_list_box_row_new ();
-  g_object_set_data_full (G_OBJECT (row), "key", key, g_free);
+  gtk_label_set_label (GTK_LABEL (label), enabled ? "+" : "-");
+}
 
-  gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
-  box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-  gtk_container_add (GTK_CONTAINER (row), box);
+static void
+setup_parameter_cb (GtkSignalListItemFactory *factory,
+                    GtkListItem              *list_item)
+{
+  GtkWidget *label;
 
-  label = gtk_label_new (name);
+  label = gtk_label_new (NULL);
+  gtk_label_set_xalign (GTK_LABEL (label), 0.5);
+  gtk_list_item_set_child (list_item, label);
   gtk_style_context_add_class (gtk_widget_get_style_context (label), "cell");
-  gtk_label_set_xalign (GTK_LABEL (label), 0);
-  gtk_size_group_add_widget (sl->priv->name, label);
-  gtk_container_add (GTK_CONTAINER (box), label);
+}
 
-  label = gtk_label_new (enabled ? "+" : "-");
-  gtk_style_context_add_class (gtk_widget_get_style_context (label), "cell");
-  gtk_label_set_xalign (GTK_LABEL (label), 0);
-  gtk_widget_set_halign (label, GTK_ALIGN_CENTER);
-  gtk_size_group_add_widget (sl->priv->enabled, label);
-  gtk_container_add (GTK_CONTAINER (box), label);
+static void
+bind_parameter_cb (GtkSignalListItemFactory *factory,
+                   GtkListItem              *list_item)
+{
+  gpointer item;
+  GtkWidget *label;
+  GActionGroup *group;
+  const char *name;
+  const char *parameter;
 
-  g_object_set_data (G_OBJECT (row), "enabled", label);
+  item = gtk_list_item_get_item (list_item);
+  label = gtk_list_item_get_child (list_item);
 
-  label = gtk_label_new (parameter);
-  gtk_style_context_add_class (gtk_widget_get_style_context (label), "cell");
-  gtk_label_set_xalign (GTK_LABEL (label), 0);
-  gtk_size_group_add_widget (sl->priv->parameter, label);
-  gtk_container_add (GTK_CONTAINER (box), label);
+  group = action_holder_get_group (ACTION_HOLDER (item));
+  name = action_holder_get_name (ACTION_HOLDER (item));
+  parameter = (const gchar *)g_action_group_get_action_parameter_type (group, name);
+
+  gtk_label_set_label (GTK_LABEL (label), parameter);
+}
+
+static void
+setup_state_cb (GtkSignalListItemFactory *factory,
+                GtkListItem              *list_item)
+{
+  GtkWidget *label;
 
-  label = gtk_label_new (state_string);
-  gtk_label_set_xalign (GTK_LABEL (label), 0);
+  label = gtk_label_new (NULL);
+  gtk_widget_set_margin_start (label, 5);
+  gtk_widget_set_margin_end (label, 5);
+  gtk_label_set_xalign (GTK_LABEL (label), 0.0);
+  gtk_list_item_set_child (list_item, label);
   gtk_style_context_add_class (gtk_widget_get_style_context (label), "cell");
-  gtk_size_group_add_widget (sl->priv->state, label);
-  gtk_container_add (GTK_CONTAINER (box), label);
-  g_object_set_data (G_OBJECT (row), "state", label);
+}
 
-  editor = gtk_inspector_action_editor_new (group, name, sl->priv->activate);
-  gtk_style_context_add_class (gtk_widget_get_style_context (editor), "cell");
-  gtk_container_add (GTK_CONTAINER (box), editor);
-  g_object_set_data (G_OBJECT (row), "editor", editor);
+static void
+bind_state_cb (GtkSignalListItemFactory *factory,
+               GtkListItem              *list_item)
+{
+  gpointer item;
+  GtkWidget *label;
+  GActionGroup *group;
+  const char *name;
+  GVariant *state;
+  char *state_string;
+
+  item = gtk_list_item_get_item (list_item);
+  label = gtk_list_item_get_child (list_item);
+
+  group = action_holder_get_group (ACTION_HOLDER (item));
+  name = action_holder_get_name (ACTION_HOLDER (item));
+  state = g_action_group_get_action_state (group, name);
+  if (state)
+    state_string = g_variant_print (state, FALSE);
+  else
+    state_string = g_strdup ("");
 
-  gtk_container_add (GTK_CONTAINER (sl->priv->list), row);
+  gtk_label_set_label (GTK_LABEL (label), state_string);
 
   g_free (state_string);
+  if (state)
+    g_variant_unref (state);
 }
 
-static GtkWidget *
-find_row (GtkInspectorActions *sl,
-          const char          *action_name)
+static void
+bind_changes_cb (GtkSignalListItemFactory *factory,
+                 GtkListItem              *list_item)
 {
-  GtkWidget *row = NULL;
-  GtkWidget *widget;
+  gpointer item;
+  GActionGroup *group;
+  const char *name;
+  GtkWidget *editor;
 
-  for (widget = gtk_widget_get_first_child (sl->priv->list);
-       widget;
-       widget = gtk_widget_get_next_sibling (widget))
-    {
-      const char *key = g_object_get_data (G_OBJECT (widget), "key");
-      if (g_str_equal (key, action_name))
-        {
-          row = widget;
-          break;
-        }
-    }
+  item = gtk_list_item_get_item (list_item);
 
-  return row;
+  group = action_holder_get_group (ACTION_HOLDER (item));
+  name = action_holder_get_name (ACTION_HOLDER (item));
+
+  editor = gtk_inspector_action_editor_new (group, name, NULL);
+  gtk_style_context_add_class (gtk_widget_get_style_context (editor), "cell");
+  gtk_list_item_set_child (list_item, editor);
 }
 
 static void
-action_added_cb (GActionGroup        *group,
-                 const gchar         *action_name,
-                 GtkInspectorActions *sl)
+unbind_changes_cb (GtkSignalListItemFactory *factory,
+                   GtkListItem              *list_item)
 {
-  add_action (sl, group, action_name);
+  gtk_list_item_set_child (list_item, NULL);
 }
 
 static void
@@ -163,21 +231,37 @@ action_removed_cb (GActionGroup        *group,
                    const gchar         *action_name,
                    GtkInspectorActions *sl)
 {
-  GtkWidget *row;
+  int i;
+
+  for (i = 0; i < g_list_model_get_n_items (sl->priv->actions); i++)
+    {
+      ActionHolder *holder = g_list_model_get_item (sl->priv->actions, i);
+
+      if (group == action_holder_get_group (holder) &&
+          strcmp (action_name, action_holder_get_name (holder)) == 0)
+        g_list_store_remove (G_LIST_STORE (sl->priv->actions), i);
 
-  row = find_row (sl, action_name);
-  if (row)
-    gtk_widget_destroy (row);
+      g_object_unref (holder);
+    }
 }
 
 static void
-set_row_enabled (GtkWidget *row,
-                 gboolean   enabled)
+notify_action_changed (GtkInspectorActions *sl,
+                       GActionGroup        *group,
+                       const char          *action_name)
 {
-  GtkWidget *label;
+  int i;
+
+  for (i = 0; i < g_list_model_get_n_items (sl->priv->actions); i++)
+    {
+      ActionHolder *holder = g_list_model_get_item (sl->priv->actions, i);
 
-  label = GTK_WIDGET (g_object_get_data (G_OBJECT (row), "enabled"));
-  gtk_label_set_label (GTK_LABEL (label), enabled ? "+" : "-" );
+      if (group == action_holder_get_group (holder) &&
+          strcmp (action_name, action_holder_get_name (holder)) == 0)
+        g_list_model_items_changed (sl->priv->actions, i, 1, 1);
+
+      g_object_unref (holder);
+    }
 }
 
 static void
@@ -186,26 +270,7 @@ action_enabled_changed_cb (GActionGroup        *group,
                            gboolean             enabled,
                            GtkInspectorActions *sl)
 {
-  GtkWidget *row;
-
-  row = find_row (sl, action_name);
-  set_row_enabled (row, enabled);
-}
-
-static void
-set_row_state (GtkWidget *row,
-               GVariant  *state)
-{
-  gchar *state_string;
-  GtkWidget *label;
-
-  if (state)
-    state_string = g_variant_print (state, FALSE);
-  else
-    state_string = g_strdup ("");
-  label = GTK_WIDGET (g_object_get_data (G_OBJECT (row), "state"));
-  gtk_label_set_label (GTK_LABEL (label), state_string);
-  g_free (state_string);
+  notify_action_changed (sl, group, action_name);
 }
 
 static void
@@ -214,35 +279,14 @@ action_state_changed_cb (GActionGroup        *group,
                          GVariant            *state,
                          GtkInspectorActions *sl)
 {
-  GtkWidget *row;
-
-  row = find_row (sl, action_name);
-  set_row_state (row, state);
+  notify_action_changed (sl, group, action_name);
 }
 
 static void
 refresh_all (GtkInspectorActions *sl)
 {
-  GtkWidget *widget;
-
-  for (widget = gtk_widget_get_first_child (sl->priv->list);
-       widget;
-       widget = gtk_widget_get_next_sibling (widget))
-    {
-      const char *name = g_object_get_data (G_OBJECT (widget), "key");
-      gboolean enabled;
-      GVariant *state;
-      GtkInspectorActionEditor *r;
-
-      enabled = g_action_group_get_action_enabled (sl->priv->group, name);
-      state = g_action_group_get_action_state (sl->priv->group, name);
-
-      set_row_enabled (widget, enabled);
-      set_row_state (widget, state);
-
-      r = (GtkInspectorActionEditor*)g_object_get_data (G_OBJECT (widget), "editor");
-      gtk_inspector_action_editor_update (r, enabled, state);
-    }
+  guint n = g_list_model_get_n_items (sl->priv->actions);
+  g_list_model_items_changed (sl->priv->actions, 0, n, n);
 }
 
 static void
@@ -279,7 +323,7 @@ add_group (GtkInspectorActions *sl,
 
   names = g_action_group_list_actions (group);
   for (i = 0; names[i]; i++)
-    add_action (sl, group, names[i]);
+    action_added_cb (group, names[i], sl);
   g_strfreev (names);
 
   g_set_object (&sl->priv->group, group);
@@ -301,7 +345,6 @@ gtk_inspector_actions_set_object (GtkInspectorActions *sl,
 {
   GtkWidget *stack;
   GtkStackPage *page;
-  GtkWidget *child;
 
   stack = gtk_widget_get_parent (GTK_WIDGET (sl));
   page = gtk_stack_get_page (GTK_STACK (stack), GTK_WIDGET (sl));
@@ -311,8 +354,7 @@ gtk_inspector_actions_set_object (GtkInspectorActions *sl,
   if (sl->priv->group)
     remove_group (sl, page, sl->priv->group);
 
-  while ((child = gtk_widget_get_first_child (sl->priv->list)))
-    gtk_widget_destroy (child);
+  g_list_store_remove_all (G_LIST_STORE (sl->priv->actions));
 
   if (GTK_IS_APPLICATION (object))
     add_group (sl, page, G_ACTION_GROUP (object));
@@ -366,13 +408,47 @@ set_property (GObject      *object,
     }
 }
 
+static char *
+holder_name (gpointer item)
+{
+  return g_strdup (action_holder_get_name (ACTION_HOLDER (item)));
+}
+
 static void
 constructed (GObject *object)
 {
   GtkInspectorActions *sl = GTK_INSPECTOR_ACTIONS (object);
+  GtkSorter *sorter;
+  GtkExpression *expression;
 
   g_signal_connect_swapped (sl->priv->button, "clicked",
                             G_CALLBACK (refresh_all), sl);
+
+  expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
+                                            0, NULL,
+                                            (GCallback)holder_name,
+                                            NULL, NULL);
+
+  sorter = gtk_string_sorter_new ();
+  gtk_string_sorter_set_expression (GTK_STRING_SORTER (sorter), expression);
+  
+  sl->priv->actions = G_LIST_MODEL (g_list_store_new (ACTION_TYPE_HOLDER));
+  sl->priv->sorted = G_LIST_MODEL (gtk_sort_list_model_new (sl->priv->actions, sorter));
+  gtk_column_view_set_model (GTK_COLUMN_VIEW (sl->priv->list), sl->priv->sorted);
+
+  g_object_unref (sorter);
+  gtk_expression_unref (expression);
+}
+
+static void
+finalize (GObject *object)
+{
+  GtkInspectorActions *sl = GTK_INSPECTOR_ACTIONS (object);
+
+  g_object_unref (sl->priv->actions);
+  g_object_unref (sl->priv->sorted);
+
+  G_OBJECT_CLASS (gtk_inspector_actions_parent_class)->finalize (object);
 }
 
 static void
@@ -381,6 +457,7 @@ gtk_inspector_actions_class_init (GtkInspectorActionsClass *klass)
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
   
+  object_class->finalize = finalize;
   object_class->get_property = get_property;
   object_class->set_property = set_property;
   object_class->constructed = constructed;
@@ -391,11 +468,16 @@ gtk_inspector_actions_class_init (GtkInspectorActionsClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/actions.ui");
   gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorActions, list);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorActions, name);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorActions, enabled);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorActions, parameter);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorActions, state);
-  gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorActions, activate);
+  gtk_widget_class_bind_template_callback (widget_class, setup_name_cb);
+  gtk_widget_class_bind_template_callback (widget_class, bind_name_cb);
+  gtk_widget_class_bind_template_callback (widget_class, setup_enabled_cb);
+  gtk_widget_class_bind_template_callback (widget_class, bind_enabled_cb);
+  gtk_widget_class_bind_template_callback (widget_class, setup_parameter_cb);
+  gtk_widget_class_bind_template_callback (widget_class, bind_parameter_cb);
+  gtk_widget_class_bind_template_callback (widget_class, setup_state_cb);
+  gtk_widget_class_bind_template_callback (widget_class, bind_state_cb);
+  gtk_widget_class_bind_template_callback (widget_class, bind_changes_cb);
+  gtk_widget_class_bind_template_callback (widget_class, unbind_changes_cb);
 }
 
 // vim: set et sw=2 ts=2:
diff --git a/gtk/inspector/actions.ui b/gtk/inspector/actions.ui
index 7ec69d18f2..179d98ba17 100644
--- a/gtk/inspector/actions.ui
+++ b/gtk/inspector/actions.ui
@@ -1,97 +1,76 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface domain="gtk40">
-  <object class="GtkListStore" id="model">
-    <columns>
-      <column type="gchararray"/>
-      <column type="gchararray"/>
-      <column type="gboolean"/>
-      <column type="gchararray"/>
-      <column type="gchararray"/>
-      <column type="gpointer"/>
-    </columns>
-  </object>
   <template class="GtkInspectorActions" parent="GtkBox">
     <property name="orientation">vertical</property>
     <style>
       <class name="view"/>
     </style>
-    <child>
-      <object class="GtkBox">
-        <style>
-          <class name="header"/>
-        </style>
-        <child>
-          <object class="GtkLabel" id="name_heading">
-            <property name="label" translatable="yes">Name</property>
-            <property name="xalign">0</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkLabel" id="enabled_heading">
-            <property name="label" translatable="yes">Enabled</property>
-            <property name="xalign">0</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkLabel" id="parameter_heading">
-            <property name="label" translatable="yes">Parameter Type</property>
-            <property name="xalign">0</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkLabel" id="state_heading">
-            <property name="label" translatable="yes">State</property>
-            <property name="xalign">0</property>
-          </object>
-        </child>
-        <child>
-          <object class="GtkLabel" id="changes_heading">
-            <property name="label" translatable="yes"></property>
-            <property name="xalign">0</property>
-          </object>
-        </child>
-      </object>
-    </child>
     <child>
       <object class="GtkScrolledWindow">
         <property name="expand">1</property>
-        <property name="hscrollbar-policy">never</property>
         <child>
-          <object class="GtkListBox" id="list">
+          <object class="GtkColumnView" id="list">
             <style>
               <class name="list"/>
             </style>
-            <property name="selection-mode">none</property>
+            <child>
+              <object class="GtkColumnViewColumn" id="name">
+                <property name="title" translatable="yes">Name</property>
+                <property name="factory">
+                  <object class="GtkSignalListItemFactory">
+                    <signal name="setup" handler="setup_name_cb"/>
+                    <signal name="bind" handler="bind_name_cb"/>
+                  </object>
+                </property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkColumnViewColumn" id="enabled">
+                <property name="title" translatable="yes">Enabled</property>
+                <property name="factory">
+                  <object class="GtkSignalListItemFactory">
+                    <signal name="setup" handler="setup_enabled_cb"/>
+                    <signal name="bind" handler="bind_enabled_cb"/>
+                  </object>
+                </property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkColumnViewColumn" id="parameter">
+                <property name="title" translatable="yes">Parameter Type</property>
+                <property name="factory">
+                  <object class="GtkSignalListItemFactory">
+                    <signal name="setup" handler="setup_parameter_cb"/>
+                    <signal name="bind" handler="bind_parameter_cb"/>
+                  </object>
+                </property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkColumnViewColumn" id="state">
+                <property name="title" translatable="yes">State</property>
+                <property name="factory">
+                  <object class="GtkSignalListItemFactory">
+                    <signal name="setup" handler="setup_state_cb"/>
+                    <signal name="bind" handler="bind_state_cb"/>
+                  </object>
+                </property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkColumnViewColumn" id="changes">
+                <property name="title"></property>
+                <property name="factory">
+                  <object class="GtkSignalListItemFactory">
+                    <signal name="bind" handler="bind_changes_cb"/>
+                    <signal name="unbind" handler="unbind_changes_cb"/>
+                  </object>
+                </property>
+              </object>
+            </child>
           </object>
         </child>
       </object>
     </child>
   </template>
-  <object class="GtkSizeGroup" id="name">
-    <property name="mode">horizontal</property>
-    <widgets>
-      <widget name="name_heading"/>
-    </widgets>
-  </object>
-  <object class="GtkSizeGroup" id="enabled">
-    <property name="mode">horizontal</property>
-    <widgets>
-      <widget name="enabled_heading"/>
-    </widgets>
-  </object>
-  <object class="GtkSizeGroup" id="parameter">
-    <property name="mode">horizontal</property>
-    <widgets>
-      <widget name="parameter_heading"/>
-    </widgets>
-  </object>
-  <object class="GtkSizeGroup" id="state">
-    <property name="mode">horizontal</property>
-    <widgets>
-      <widget name="state_heading"/>
-    </widgets>
-  </object>
-  <object class="GtkSizeGroup" id="activate">
-    <property name="mode">horizontal</property>
-  </object>
 </interface>
diff --git a/gtk/inspector/meson.build b/gtk/inspector/meson.build
index ea5d77c09e..f4b9f89cb6 100644
--- a/gtk/inspector/meson.build
+++ b/gtk/inspector/meson.build
@@ -36,5 +36,6 @@ inspector_sources = files(
   'visual.c',
   'window.c',
   'prop-holder.c',
-  'resource-holder.c'
+  'resource-holder.c',
+  'action-holder.c'
 )


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]