[gtk+/wip/dboles/combobox-cleanup: 34/37] combobox: Reuse code rather than reimplementing it
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/dboles/combobox-cleanup: 34/37] combobox: Reuse code rather than reimplementing it
- Date: Sat, 21 Jan 2017 21:00:59 +0000 (UTC)
commit 36413a8eca48c74a0a2719035ceca1b097930d41
Author: Daniel Boles <dboles src gnome org>
Date: Sat Jan 21 15:11:40 2017 +0000
combobox: Reuse code rather than reimplementing it
We already have cell_layout_is_sensitive() to get whether at least one
cell in a Layout is sensitive, which we need because CellLayout/View
do not implement foreach(). So, since we wrote that, we can use it to
check our CellArea too, instead of doing foreach with a custom callback.
gtk/gtkcombobox.c | 27 ++-------------------------
1 files changed, 2 insertions(+), 25 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 471e419..bb41e5e 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -1466,17 +1466,6 @@ cell_layout_is_sensitive (GtkCellLayout *layout)
}
static gboolean
-cell_is_sensitive (GtkCellRenderer *cell,
- gpointer data)
-{
- gboolean *sensitive = data;
-
- g_object_get (cell, "sensitive", sensitive, NULL);
-
- return *sensitive;
-}
-
-static gboolean
tree_column_row_is_sensitive (GtkComboBox *combo_box,
GtkTreeIter *iter)
{
@@ -1489,20 +1478,8 @@ tree_column_row_is_sensitive (GtkComboBox *combo_box,
return FALSE;
}
- if (priv->area)
- {
- gboolean sensitive;
-
- gtk_cell_area_apply_attributes (priv->area, priv->model, iter, FALSE, FALSE);
-
- sensitive = FALSE;
-
- gtk_cell_area_foreach (priv->area, cell_is_sensitive, &sensitive);
-
- return sensitive;
- }
-
- return TRUE;
+ gtk_cell_area_apply_attributes (priv->area, priv->model, iter, FALSE, FALSE);
+ return cell_layout_is_sensitive (GTK_CELL_LAYOUT (priv->area));
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]