diff options
author | Timm Bäder <mail@baedert.org> | 2019-08-11 08:53:10 +0200 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2019-08-11 09:34:50 +0200 |
commit | 8c88453816eb9f2cc0bb66b95c42894e5bbc16bf (patch) | |
tree | c2405e0bec72b9bf9ed5123b68d18e260cc8c372 | |
parent | 0415574acf637b43efe6597f5e967bcc5d8663e6 (diff) | |
download | gtk+-8c88453816eb9f2cc0bb66b95c42894e5bbc16bf.tar.gz |
cellrenderer: Add accessors for {get,set}_is_expande{r,d}
-rw-r--r-- | gtk/gtkcellarea.c | 8 | ||||
-rw-r--r-- | gtk/gtkcellrenderer.c | 56 | ||||
-rw-r--r-- | gtk/gtkcellrenderer.h | 15 | ||||
-rw-r--r-- | gtk/gtkcellrendererpixbuf.c | 6 |
4 files changed, 77 insertions, 8 deletions
diff --git a/gtk/gtkcellarea.c b/gtk/gtkcellarea.c index 8592db6234..b8945d6544 100644 --- a/gtk/gtkcellarea.c +++ b/gtk/gtkcellarea.c @@ -1212,13 +1212,13 @@ apply_cell_attributes (GtkCellRenderer *renderer, * provided by the view (as these states can vary across views * accessing the same model). */ - g_object_get (renderer, "is-expander", &is_expander, NULL); + is_expander = gtk_cell_renderer_get_is_expander (renderer); if (is_expander != data->is_expander) - g_object_set (renderer, "is-expander", data->is_expander, NULL); + gtk_cell_renderer_set_is_expander (renderer, data->is_expander); - g_object_get (renderer, "is-expanded", &is_expanded, NULL); + is_expanded = gtk_cell_renderer_get_is_expanded (renderer); if (is_expanded != data->is_expanded) - g_object_set (renderer, "is-expanded", data->is_expanded, NULL); + gtk_cell_renderer_set_is_expanded (renderer, data->is_expanded); /* Apply the attributes directly to the renderer */ for (list = info->attributes; list; list = list->next) diff --git a/gtk/gtkcellrenderer.c b/gtk/gtkcellrenderer.c index f4010925c6..13cb6f01ff 100644 --- a/gtk/gtkcellrenderer.c +++ b/gtk/gtkcellrenderer.c @@ -1722,6 +1722,62 @@ gtk_cell_renderer_get_state (GtkCellRenderer *cell, return state; } +void +gtk_cell_renderer_set_is_expander (GtkCellRenderer *cell, + gboolean is_expander) +{ + GtkCellRendererPrivate *priv = gtk_cell_renderer_get_instance_private (cell); + + g_return_if_fail (GTK_IS_CELL_RENDERER (cell)); + + is_expander = !!is_expander; + + if (is_expander != priv->is_expander) + { + priv->is_expander = is_expander; + + g_object_notify (G_OBJECT (cell), "is-expander"); + } +} + +gboolean +gtk_cell_renderer_get_is_expander (GtkCellRenderer *cell) +{ + GtkCellRendererPrivate *priv = gtk_cell_renderer_get_instance_private (cell); + + g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE); + + return priv->is_expander; +} + +void +gtk_cell_renderer_set_is_expanded (GtkCellRenderer *cell, + gboolean is_expanded) +{ + GtkCellRendererPrivate *priv = gtk_cell_renderer_get_instance_private (cell); + + g_return_if_fail (GTK_IS_CELL_RENDERER (cell)); + + is_expanded = !!is_expanded; + + if (is_expanded != priv->is_expanded) + { + priv->is_expanded = is_expanded; + + g_object_notify (G_OBJECT (cell), "is-expanded"); + } +} + +gboolean +gtk_cell_renderer_get_is_expanded (GtkCellRenderer *cell) +{ + GtkCellRendererPrivate *priv = gtk_cell_renderer_get_instance_private (cell); + + g_return_val_if_fail (GTK_IS_CELL_RENDERER (cell), FALSE); + + return priv->is_expanded; +} + /** * gtk_cell_renderer_class_set_accessible_type: * @renderer_class: class to set the accessible type for diff --git a/gtk/gtkcellrenderer.h b/gtk/gtkcellrenderer.h index 815aef265f..cfc68ff79d 100644 --- a/gtk/gtkcellrenderer.h +++ b/gtk/gtkcellrenderer.h @@ -283,6 +283,21 @@ gboolean gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell); GDK_AVAILABLE_IN_ALL gboolean gtk_cell_renderer_is_activatable (GtkCellRenderer *cell); +GDK_AVAILABLE_IN_ALL +void gtk_cell_renderer_set_is_expander (GtkCellRenderer *cell, + gboolean is_expander); +GDK_AVAILABLE_IN_ALL +gboolean gtk_cell_renderer_get_is_expander (GtkCellRenderer *cell); + +GDK_AVAILABLE_IN_ALL +void gtk_cell_renderer_set_is_expanded (GtkCellRenderer *cell, + gboolean is_expander); +GDK_AVAILABLE_IN_ALL +gboolean gtk_cell_renderer_get_is_expanded (GtkCellRenderer *cell); + + + + /* For use by cell renderer implementations only */ GDK_AVAILABLE_IN_ALL void gtk_cell_renderer_stop_editing (GtkCellRenderer *cell, diff --git a/gtk/gtkcellrendererpixbuf.c b/gtk/gtkcellrendererpixbuf.c index 8641fbc2db..e89a5f8ba3 100644 --- a/gtk/gtkcellrendererpixbuf.c +++ b/gtk/gtkcellrendererpixbuf.c @@ -533,12 +533,10 @@ gtk_cell_renderer_pixbuf_snapshot (GtkCellRenderer *cell, gtk_style_context_add_class (context, GTK_STYLE_CLASS_IMAGE); gtk_icon_size_set_style_classes (gtk_style_context_get_node (context), priv->icon_size); - g_object_get (cell, "is-expander", &is_expander, NULL); + is_expander = gtk_cell_renderer_get_is_expander (cell); if (is_expander) { - gboolean is_expanded; - - g_object_get (cell, "is-expanded", &is_expanded, NULL); + gboolean is_expanded = gtk_cell_renderer_get_is_expanded (cell);; if (is_expanded && priv->pixbuf_expander_open != NULL) { |