inspector: Fix property list styling

We use dropdowns here now, so style them.

Also, avoid the swoosh when switching to the
property list, when everything shrinks.
This commit is contained in:
Matthias Clasen 2020-07-07 02:12:30 -04:00
parent dfc04a590d
commit 4d371b2b16
3 changed files with 25 additions and 5 deletions

View File

@ -35,6 +35,7 @@
.list .cell entry,
.list .cell spinbutton,
.list .cell button,
.list .cell dropdown
.list .cell combobox {
min-height: 24px;
min-width: 0;
@ -42,6 +43,7 @@
.list .cell entry,
.list .cell button,
.list .cell dropdown
.list .cell combobox {
padding: 0 4px;
}

View File

@ -381,12 +381,25 @@ bind_origin_cb (GtkSignalListItemFactory *factory,
gtk_label_set_label (GTK_LABEL (label), origin);
}
static void
setup_value_cb (GtkSignalListItemFactory *factory,
GtkListItem *list_item,
gpointer data)
{
GtkWidget *widget;
widget = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (widget, "cell");
gtk_list_item_set_child (list_item, widget);
}
static void
bind_value_cb (GtkSignalListItemFactory *factory,
GtkListItem *list_item,
gpointer data)
{
GObject *item;
GtkWidget *editor;
GtkWidget *widget;
GObject *object;
const char *name;
@ -396,10 +409,10 @@ bind_value_cb (GtkSignalListItemFactory *factory,
object = prop_holder_get_object (PROP_HOLDER (item));
name = prop_holder_get_name (PROP_HOLDER (item));
widget = gtk_inspector_prop_editor_new (object, name, NULL);
g_signal_connect (widget, "show-object", G_CALLBACK (show_object), data);
gtk_list_item_set_child (list_item, widget);
gtk_widget_add_css_class (widget, "cell");
editor = gtk_inspector_prop_editor_new (object, name, NULL);
g_signal_connect (editor, "show-object", G_CALLBACK (show_object), data);
widget = gtk_list_item_get_child (list_item);
gtk_box_append (GTK_BOX (widget), editor);
}
static void
@ -407,7 +420,10 @@ unbind_value_cb (GtkSignalListItemFactory *factory,
GtkListItem *list_item,
gpointer data)
{
gtk_list_item_set_child (list_item, NULL);
GtkWidget *widget;
widget = gtk_list_item_get_child (list_item);
gtk_box_remove (GTK_BOX (widget), gtk_widget_get_first_child (widget));
}
static void
@ -441,6 +457,7 @@ gtk_inspector_prop_list_class_init (GtkInspectorPropListClass *klass)
gtk_widget_class_bind_template_callback (widget_class, bind_type_cb);
gtk_widget_class_bind_template_callback (widget_class, setup_origin_cb);
gtk_widget_class_bind_template_callback (widget_class, bind_origin_cb);
gtk_widget_class_bind_template_callback (widget_class, setup_value_cb);
gtk_widget_class_bind_template_callback (widget_class, bind_value_cb);
gtk_widget_class_bind_template_callback (widget_class, unbind_value_cb);
}

View File

@ -57,6 +57,7 @@
<property name="expand">1</property>
<property name="factory">
<object class="GtkSignalListItemFactory">
<signal name="setup" handler="setup_value_cb"/>
<signal name="bind" handler="bind_value_cb"/>
<signal name="unbind" handler="unbind_value_cb"/>
</object>