[gtk/wip/otte/listview: 52/67] Add GtkTreeExpander
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/listview: 52/67] Add GtkTreeExpander
- Date: Wed, 16 Oct 2019 20:14:11 +0000 (UTC)
commit b844e5c57fd7b644f5181fcbfad64452ae63e20d
Author: Benjamin Otte <otte redhat com>
Date: Mon Oct 14 04:31:20 2019 +0200
Add GtkTreeExpander
This is a container widget that takes over all the duties of tree
expanding and collapsing.
It has to be a container so it can capture keybindings while focus is
inside the listitem.
So far, this widget does not allow interacting with it, but it shows the
expander arrow in its correct state.
Also, testlistview uses this widget now instead of implementing
expanding itself.
docs/reference/gtk/gtk4-docs.xml | 1 +
docs/reference/gtk/gtk4-sections.txt | 20 ++
gtk/gtk.h | 1 +
gtk/gtktreeexpander.c | 449 +++++++++++++++++++++++++++++++++++
gtk/gtktreeexpander.h | 56 +++++
gtk/meson.build | 2 +
tests/testlistview.c | 34 +--
7 files changed, 534 insertions(+), 29 deletions(-)
---
diff --git a/docs/reference/gtk/gtk4-docs.xml b/docs/reference/gtk/gtk4-docs.xml
index 8cc1aa5739..3ed30e9bcc 100644
--- a/docs/reference/gtk/gtk4-docs.xml
+++ b/docs/reference/gtk/gtk4-docs.xml
@@ -90,6 +90,7 @@
<xi:include href="xml/gtkflowbox.xml" />
<xi:include href="xml/gtklistview.xml" />
<xi:include href="xml/gtkgridview.xml" />
+ <xi:include href="xml/gtktreeexpander.xml" />
<xi:include href="xml/gtkstack.xml" />
<xi:include href="xml/gtkstackswitcher.xml" />
<xi:include href="xml/gtkstacksidebar.xml" />
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 0ca5e29e99..8590719fe6 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -3555,6 +3555,26 @@ gtk_tree_list_model_get_type
gtk_tree_list_row_get_type
</SECTION>
+<SECTION>
+<FILE>gtktreeexpander</FILE>
+<TITLE>GtkTreeExpander</TITLE>
+gtk_tree_expander_new
+gtk_tree_expander_get_child
+gtk_tree_expander_set_child
+gtk_tree_expander_get_item
+gtk_tree_expander_get_list_row
+gtk_tree_expander_set_list_row
+<SUBSECTION Standard>
+GTK_TREE_EXPANDER
+GTK_IS_TREE_EXPANDER
+GTK_TYPE_TREE_EXPANDER
+GTK_TREE_EXPANDER_CLASS
+GTK_IS_TREE_EXPANDER_CLASS
+GTK_TREE_EXPANDER_GET_CLASS
+<SUBSECTION Private>
+gtk_tree_expander_get_type
+</SECTION>
+
<SECTION>
<FILE>gtktreemodel</FILE>
<TITLE>GtkTreeModel</TITLE>
diff --git a/gtk/gtk.h b/gtk/gtk.h
index 9676872c3c..3f69714f41 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -250,6 +250,7 @@
#include <gtk/gtktooltip.h>
#include <gtk/gtktestutils.h>
#include <gtk/gtktreednd.h>
+#include <gtk/gtktreeexpander.h>
#include <gtk/gtktreelistmodel.h>
#include <gtk/gtktreemodel.h>
#include <gtk/gtktreemodelfilter.h>
diff --git a/gtk/gtktreeexpander.c b/gtk/gtktreeexpander.c
new file mode 100644
index 0000000000..868261f8cc
--- /dev/null
+++ b/gtk/gtktreeexpander.c
@@ -0,0 +1,449 @@
+/*
+ * Copyright © 2019 Benjamin Otte
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Benjamin Otte <otte gnome org>
+ */
+
+#include "config.h"
+
+#include "gtktreeexpander.h"
+
+#include "gtkboxlayout.h"
+#include "gtkiconprivate.h"
+#include "gtkintl.h"
+#include "gtktreelistmodel.h"
+
+/**
+ * SECTION:gtktreeexpander
+ * @title: GtkTreeExpander
+ * @short_description: An indenting expander button for use in a tree list
+ * @see_also: #GtkTreeListModel
+ *
+ * GtkTreeExpander is a widget that provides an expander for a list.
+ *
+ * It is typically placed as a bottommost child into a #GtkListView to allow
+ * users to expand and collapse children in a list with a #GtkTreeListModel.
+ * It will provide the common UI elements, gestures and keybindings for this
+ * purpose.
+ *
+ * On top of this, the "listitem.expand", "listitem.collapse" and
+ * "listitem.toggle-expand" actions are provided to allow adding custom UI
+ * for managing expanded state.
+ *
+ * The #GtkTreeListModel must be set to not be passthrough. Then it will provide
+ * #GtkTreeListRow items which can be set via gtk_tree_expander_set_list_row()
+ * on the expander. The expander will then watch that row item automatically.
+ * gtk_tree_expander_set_child() sets the widget that displays the actual row
+ * contents.
+ *
+ * # CSS nodes
+ *
+ * |[<!-- language="plain" -->
+ * treeexpander
+ * ├── [indent]*
+ * ├── [expander]
+ * ╰── <child>
+ * ]|
+ *
+ * GtkTreeExpander has zero or one CSS nodes with the name "expander" that should
+ * display the expander icon. The node will be `:checked` when it is expanded.
+ * If the node is not expandable, an "indent" node will be displayed instead.
+ *
+ * For every level of depth, another "indent" node is prepended.
+ */
+
+struct _GtkTreeExpander
+{
+ GtkWidget parent_instance;
+
+ GtkTreeListRow *list_row;
+ GtkWidget *child;
+
+ GtkWidget *expander;
+ guint notify_handler;
+};
+
+enum
+{
+ PROP_0,
+ PROP_CHILD,
+ PROP_ITEM,
+ PROP_LIST_ROW,
+
+ N_PROPS
+};
+
+G_DEFINE_TYPE (GtkTreeExpander, gtk_tree_expander, GTK_TYPE_WIDGET)
+
+static GParamSpec *properties[N_PROPS] = { NULL, };
+
+static void
+gtk_tree_expander_update_for_list_row (GtkTreeExpander *self)
+{
+ if (self->list_row == NULL)
+ {
+ GtkWidget *child;
+
+ for (child = gtk_widget_get_first_child (GTK_WIDGET (self));
+ child != self->child;
+ child = gtk_widget_get_first_child (GTK_WIDGET (self)))
+ {
+ gtk_widget_unparent (child);
+ }
+ self->expander = NULL;
+ }
+ else
+ {
+ GtkWidget *child;
+ guint i, depth;
+
+ depth = gtk_tree_list_row_get_depth (self->list_row);
+ if (gtk_tree_list_row_is_expandable (self->list_row))
+ {
+ if (self->expander == NULL)
+ {
+ self->expander = gtk_icon_new ("expander");
+ gtk_widget_insert_before (self->expander,
+ GTK_WIDGET (self),
+ self->child);
+ }
+ if (gtk_tree_list_row_get_expanded (self->list_row))
+ gtk_widget_set_state_flags (self->expander, GTK_STATE_FLAG_CHECKED, FALSE);
+ else
+ gtk_widget_unset_state_flags (self->expander, GTK_STATE_FLAG_CHECKED);
+ child = gtk_widget_get_prev_sibling (self->expander);
+ }
+ else
+ {
+ g_clear_pointer (&self->expander, gtk_widget_unparent);
+ depth++;
+ if (self->child)
+ child = gtk_widget_get_prev_sibling (self->child);
+ else
+ child = gtk_widget_get_last_child (GTK_WIDGET (self));
+ }
+
+ for (i = 0; i < depth; i++)
+ {
+ if (child)
+ child = gtk_widget_get_prev_sibling (child);
+ else
+ gtk_widget_insert_after (gtk_icon_new ("indent"), GTK_WIDGET (self), NULL);
+ }
+
+ while (child)
+ {
+ GtkWidget *prev = gtk_widget_get_prev_sibling (child);
+ gtk_widget_unparent (child);
+ child = prev;
+ }
+ }
+}
+
+static void
+gtk_tree_expander_list_row_notify_cb (GtkTreeListRow *list_row,
+ GParamSpec *pspec,
+ GtkTreeExpander *self)
+{
+ if (pspec->name == g_intern_static_string ("expanded"))
+ {
+ if (self->expander)
+ {
+ if (gtk_tree_list_row_get_expanded (list_row))
+ gtk_widget_set_state_flags (self->expander, GTK_STATE_FLAG_CHECKED, FALSE);
+ else
+ gtk_widget_unset_state_flags (self->expander, GTK_STATE_FLAG_CHECKED);
+ }
+ }
+ else if (pspec->name == g_intern_static_string ("item"))
+ {
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ITEM]);
+ }
+ else
+ {
+ /* can this happen other than when destroying the row? */
+ gtk_tree_expander_update_for_list_row (self);
+ }
+}
+
+static void
+gtk_tree_expander_clear_list_row (GtkTreeExpander *self)
+{
+ if (self->list_row == NULL)
+ return;
+
+ g_signal_handler_disconnect (self->list_row, self->notify_handler);
+ g_clear_object (&self->list_row);
+}
+
+static void
+gtk_tree_expander_dispose (GObject *object)
+{
+ GtkTreeExpander *self = GTK_TREE_EXPANDER (object);
+
+ gtk_tree_expander_clear_list_row (self);
+ gtk_tree_expander_update_for_list_row (self);
+
+ g_clear_pointer (&self->child, gtk_widget_unparent);
+
+ g_assert (self->expander == NULL);
+
+ G_OBJECT_CLASS (gtk_tree_expander_parent_class)->dispose (object);
+}
+
+static void
+gtk_tree_expander_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GtkTreeExpander *self = GTK_TREE_EXPANDER (object);
+
+ switch (property_id)
+ {
+ case PROP_CHILD:
+ g_value_set_object (value, self->child);
+ break;
+
+ case PROP_ITEM:
+ g_value_set_object (value, gtk_tree_expander_get_item (self));
+ break;
+
+ case PROP_LIST_ROW:
+ g_value_set_object (value, self->list_row);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_tree_expander_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GtkTreeExpander *self = GTK_TREE_EXPANDER (object);
+
+ switch (property_id)
+ {
+ case PROP_CHILD:
+ gtk_tree_expander_set_child (self, g_value_get_object (value));
+ break;
+
+ case PROP_LIST_ROW:
+ gtk_tree_expander_set_list_row (self, g_value_get_object (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gtk_tree_expander_class_init (GtkTreeExpanderClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->dispose = gtk_tree_expander_dispose;
+ gobject_class->get_property = gtk_tree_expander_get_property;
+ gobject_class->set_property = gtk_tree_expander_set_property;
+
+ /**
+ * GtkTreeExpander:child:
+ *
+ * The child widget with the actual contents
+ */
+ properties[PROP_CHILD] =
+ g_param_spec_object ("child",
+ P_("Child"),
+ P_("The child widget with the actual contents"),
+ GTK_TYPE_WIDGET,
+ G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
+
+ /**
+ * GtkTreeExpander:item:
+ *
+ * The item held by this expander's row
+ */
+ properties[PROP_ITEM] =
+ g_param_spec_object ("item",
+ P_("Item"),
+ P_("The item held by this expander's row"),
+ G_TYPE_OBJECT,
+ G_PARAM_READABLE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
+
+ /**
+ * GtkTreeExpander:list-row:
+ *
+ * The list row to track for expander state
+ */
+ properties[PROP_LIST_ROW] =
+ g_param_spec_object ("list-row",
+ P_("List row"),
+ P_("The list row to track for expander state"),
+ GTK_TYPE_TREE_LIST_ROW,
+ G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (gobject_class, N_PROPS, properties);
+
+ gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BOX_LAYOUT);
+ gtk_widget_class_set_css_name (widget_class, I_("treeexpander"));
+}
+
+static void
+gtk_tree_expander_init (GtkTreeExpander *self)
+{
+}
+
+/**
+ * gtk_tree_expander_new:
+ *
+ * Creates a new #GtkTreeExpander
+ *
+ * Returns: a new #GtkTreeExpander
+ **/
+GtkWidget *
+gtk_tree_expander_new (void)
+{
+ return g_object_new (GTK_TYPE_TREE_EXPANDER,
+ NULL);
+}
+
+/**
+ * gtk_tree_expander_get_child
+ * @self: a #GtkTreeExpander
+ *
+ * Gets the child widget displayed by @self.
+ *
+ * Returns: (nullable) (transfer none): The child displayed by @self
+ **/
+GtkWidget *
+gtk_tree_expander_get_child (GtkTreeExpander *self)
+{
+ g_return_val_if_fail (GTK_IS_TREE_EXPANDER (self), NULL);
+
+ return self->child;
+}
+
+/**
+ * gtk_tree_expander_set_child:
+ * @self: a #GtkTreeExpander widget
+ * @child: (nullable): a #GtkWidget, or %NULL
+ *
+ * Sets the content widget to display.
+ */
+void
+gtk_tree_expander_set_child (GtkTreeExpander *self,
+ GtkWidget *child)
+{
+ g_return_if_fail (GTK_IS_TREE_EXPANDER (self));
+ g_return_if_fail (child == NULL || GTK_IS_WIDGET (child));
+
+ if (self->child == child)
+ return;
+
+ g_clear_pointer (&self->child, gtk_widget_unparent);
+
+ if (child)
+ {
+ self->child = child;
+ gtk_widget_set_parent (child, GTK_WIDGET (self));
+ }
+
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CHILD]);
+}
+
+/**
+ * gtk_tree_expander_get_item
+ * @self: a #GtkTreeExpander
+ *
+ * Forwards the item set on the #GtkTreeListRow that @self is managing.
+ *
+ * This call is essentially equivalent to calling
+ * `gtk_tree_list_row_get_item (gtk_tree_expander_get_list_row (@self))`.
+ *
+ * Returns: (nullable) (transfer none): The item of the row
+ **/
+gpointer
+gtk_tree_expander_get_item (GtkTreeExpander *self)
+{
+ g_return_val_if_fail (GTK_IS_TREE_EXPANDER (self), NULL);
+
+ if (self->list_row == NULL)
+ return NULL;
+
+ return gtk_tree_list_row_get_item (self->list_row);
+}
+
+/**
+ * gtk_tree_expander_get_list_row
+ * @self: a #GtkTreeExpander
+ *
+ * Gets the list row managed by @self.
+ *
+ * Returns: (nullable) (transfer none): The list row displayed by @self
+ **/
+GtkTreeListRow *
+gtk_tree_expander_get_list_row (GtkTreeExpander *self)
+{
+ g_return_val_if_fail (GTK_IS_TREE_EXPANDER (self), NULL);
+
+ return self->list_row;
+}
+
+/**
+ * gtk_tree_expander_set_list_row:
+ * @self: a #GtkTreeExpander widget
+ * @list_row: (nullable): a #GtkTreeListRow, or %NULL
+ *
+ * Sets the tree list row that this expander should manage.
+ */
+void
+gtk_tree_expander_set_list_row (GtkTreeExpander *self,
+ GtkTreeListRow *list_row)
+{
+ g_return_if_fail (GTK_IS_TREE_EXPANDER (self));
+ g_return_if_fail (list_row == NULL || GTK_IS_TREE_LIST_ROW (list_row));
+
+ if (self->list_row == list_row)
+ return;
+
+ g_object_freeze_notify (G_OBJECT (self));
+
+ gtk_tree_expander_clear_list_row (self);
+
+ if (list_row)
+ {
+ self->list_row = g_object_ref (list_row);
+ self->notify_handler = g_signal_connect (list_row,
+ "notify",
+ G_CALLBACK (gtk_tree_expander_list_row_notify_cb),
+ self);
+ }
+
+ gtk_tree_expander_update_for_list_row (self);
+
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LIST_ROW]);
+ g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ITEM]);
+
+ g_object_thaw_notify (G_OBJECT (self));
+}
+
diff --git a/gtk/gtktreeexpander.h b/gtk/gtktreeexpander.h
new file mode 100644
index 0000000000..4ee36405c2
--- /dev/null
+++ b/gtk/gtktreeexpander.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright © 2019 Benjamin Otte
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Authors: Benjamin Otte <otte gnome org>
+ */
+
+#ifndef __GTK_TREE_EXPANDER_H__
+#define __GTK_TREE_EXPANDER_H__
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#include <gtk/gtktreelistmodel.h>
+#include <gtk/gtkwidget.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_TREE_EXPANDER (gtk_tree_expander_get_type ())
+
+GDK_AVAILABLE_IN_ALL
+G_DECLARE_FINAL_TYPE (GtkTreeExpander, gtk_tree_expander, GTK, TREE_EXPANDER, GtkWidget)
+
+GDK_AVAILABLE_IN_ALL
+GtkWidget * gtk_tree_expander_new (void);
+
+GDK_AVAILABLE_IN_ALL
+GtkWidget * gtk_tree_expander_get_child (GtkTreeExpander *self);
+GDK_AVAILABLE_IN_ALL
+void gtk_tree_expander_set_child (GtkTreeExpander *self,
+ GtkWidget *child);
+GDK_AVAILABLE_IN_ALL
+gpointer gtk_tree_expander_get_item (GtkTreeExpander *self);
+GDK_AVAILABLE_IN_ALL
+GtkTreeListRow * gtk_tree_expander_get_list_row (GtkTreeExpander *self);
+GDK_AVAILABLE_IN_ALL
+void gtk_tree_expander_set_list_row (GtkTreeExpander *self,
+ GtkTreeListRow *list_row);
+
+
+G_END_DECLS
+
+#endif /* __GTK_TREE_EXPANDER_H__ */
diff --git a/gtk/meson.build b/gtk/meson.build
index c12427f27d..5dadaaa5af 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -398,6 +398,7 @@ gtk_public_sources = files([
'gtktooltip.c',
'gtktooltipwindow.c',
'gtktreednd.c',
+ 'gtktreeexpander.c',
'gtktreelistmodel.c',
'gtktreemenu.c',
'gtktreemodel.c',
@@ -647,6 +648,7 @@ gtk_public_headers = files([
'gtktoolshell.h',
'gtktooltip.h',
'gtktreednd.h',
+ 'gtktreeexpander.h',
'gtktreelistmodel.h',
'gtktreemodel.h',
'gtktreemodelfilter.h',
diff --git a/tests/testlistview.c b/tests/testlistview.c
index 2b7ef0a470..e89d34e0b8 100644
--- a/tests/testlistview.c
+++ b/tests/testlistview.c
@@ -360,14 +360,12 @@ create_list_model_for_directory (gpointer file)
typedef struct _RowData RowData;
struct _RowData
{
- GtkWidget *depth_box;
GtkWidget *expander;
GtkWidget *icon;
GtkWidget *name;
GCancellable *cancellable;
GtkTreeListRow *current_item;
- GBinding *expander_binding;
};
static void row_data_notify_item (GtkListItem *item,
@@ -385,8 +383,6 @@ row_data_unbind (RowData *data)
g_clear_object (&data->cancellable);
}
- g_binding_unbind (data->expander_binding);
-
g_clear_object (&data->current_item);
}
@@ -459,7 +455,6 @@ row_data_bind (RowData *data,
GtkTreeListRow *item)
{
GFileInfo *info;
- guint depth;
row_data_unbind (data);
@@ -468,11 +463,7 @@ row_data_bind (RowData *data,
data->current_item = g_object_ref (item);
- depth = gtk_tree_list_row_get_depth (item);
- gtk_widget_set_size_request (data->depth_box, 16 * depth, 0);
-
- gtk_widget_set_sensitive (data->expander, gtk_tree_list_row_is_expandable (item));
- data->expander_binding = g_object_bind_property (item, "expanded", data->expander, "active",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
+ gtk_tree_expander_set_list_row (GTK_TREE_EXPANDER (data->expander), item);
info = gtk_tree_list_row_get_item (item);
@@ -516,17 +507,6 @@ row_data_free (gpointer _data)
g_slice_free (RowData, data);
}
-static void
-expander_set_checked_cb (GtkToggleButton *button,
- GParamSpec *pspec,
- GtkWidget *expander)
-{
- if (gtk_toggle_button_get_active (button))
- gtk_widget_set_state_flags (expander, GTK_STATE_FLAG_CHECKED, FALSE);
- else
- gtk_widget_unset_state_flags (expander, GTK_STATE_FLAG_CHECKED);
-}
-
static void
setup_widget (GtkListItem *list_item,
gpointer unused)
@@ -547,15 +527,11 @@ setup_widget (GtkListItem *list_item,
g_object_bind_property (list_item, "position", child, "label", G_BINDING_SYNC_CREATE);
gtk_container_add (GTK_CONTAINER (box), child);
- data->depth_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_container_add (GTK_CONTAINER (box), data->depth_box);
-
- data->expander = g_object_new (GTK_TYPE_TOGGLE_BUTTON, "css-name", "title", NULL);
- gtk_button_set_relief (GTK_BUTTON (data->expander), GTK_RELIEF_NONE);
+ data->expander = gtk_tree_expander_new ();
gtk_container_add (GTK_CONTAINER (box), data->expander);
- child = g_object_new (GTK_TYPE_SPINNER, "css-name", "expander", NULL);
- g_signal_connect (data->expander, "notify::active", G_CALLBACK (expander_set_checked_cb), child);
- gtk_container_add (GTK_CONTAINER (data->expander), child);
+
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
+ gtk_tree_expander_set_child (GTK_TREE_EXPANDER (data->expander), box);
data->icon = gtk_image_new ();
gtk_container_add (GTK_CONTAINER (box), data->icon);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]