Commit f941f7b1 authored by Matthias Clasen's avatar Matthias Clasen

Fix keynav issue in menu mode

Skipping insensitive and separator rows was broken in menu mode.
https://bugzilla.gnome.org/show_bug.cgi?id=639845
parent d0ba16a3
...@@ -104,7 +104,6 @@ struct _GtkComboBoxPrivate ...@@ -104,7 +104,6 @@ struct _GtkComboBoxPrivate
GtkTreeRowReference *active_row; GtkTreeRowReference *active_row;
GtkWidget *tree_view; GtkWidget *tree_view;
GtkTreeViewColumn *column;
GtkWidget *cell_view; GtkWidget *cell_view;
GtkWidget *cell_view_frame; GtkWidget *cell_view_frame;
...@@ -129,7 +128,8 @@ struct _GtkComboBoxPrivate ...@@ -129,7 +128,8 @@ struct _GtkComboBoxPrivate
guint resize_idle_id; guint resize_idle_id;
/* For "has-entry" specific behavior we track /* For "has-entry" specific behavior we track
* an automated cell renderer and text column */ * an automated cell renderer and text column
*/
gint text_column; gint text_column;
GtkCellRenderer *text_renderer; GtkCellRenderer *text_renderer;
...@@ -1961,12 +1961,12 @@ gtk_combo_box_list_position (GtkComboBox *combo_box, ...@@ -1961,12 +1961,12 @@ gtk_combo_box_list_position (GtkComboBox *combo_box,
} }
static gboolean static gboolean
cell_view_is_sensitive (GtkCellView *cell_view) cell_layout_is_sensitive (GtkCellLayout *layout)
{ {
GList *cells, *list; GList *cells, *list;
gboolean sensitive; gboolean sensitive;
cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (cell_view)); cells = gtk_cell_layout_get_cells (layout);
sensitive = FALSE; sensitive = FALSE;
for (list = cells; list; list = list->next) for (list = cells; list; list = list->next)
...@@ -1981,16 +1981,22 @@ cell_view_is_sensitive (GtkCellView *cell_view) ...@@ -1981,16 +1981,22 @@ cell_view_is_sensitive (GtkCellView *cell_view)
return sensitive; return sensitive;
} }
static gboolean
cell_is_sensitive (GtkCellRenderer *cell,
gpointer data)
{
gboolean *sensitive = data;
g_object_get (cell, "sensitive", sensitive, NULL);
return *sensitive;
}
static gboolean static gboolean
tree_column_row_is_sensitive (GtkComboBox *combo_box, tree_column_row_is_sensitive (GtkComboBox *combo_box,
GtkTreeIter *iter) GtkTreeIter *iter)
{ {
GtkComboBoxPrivate *priv = combo_box->priv; GtkComboBoxPrivate *priv = combo_box->priv;
GList *cells, *list;
gboolean sensitive;
if (!priv->column)
return TRUE;
if (priv->row_separator_func) if (priv->row_separator_func)
{ {
...@@ -1999,23 +2005,20 @@ tree_column_row_is_sensitive (GtkComboBox *combo_box, ...@@ -1999,23 +2005,20 @@ tree_column_row_is_sensitive (GtkComboBox *combo_box,
return FALSE; return FALSE;
} }
gtk_tree_view_column_cell_set_cell_data (priv->column, if (priv->area)
priv->model, {
iter, FALSE, FALSE); gboolean sensitive;
cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (priv->column)); gtk_cell_area_apply_attributes (priv->area, priv->model, iter, FALSE, FALSE);
sensitive = FALSE; sensitive = FALSE;
for (list = cells; list; list = list->next)
{
g_object_get (list->data, "sensitive", &sensitive, NULL);
if (sensitive) gtk_cell_area_foreach (priv->area, cell_is_sensitive, &sensitive);
break;
return sensitive;
} }
g_list_free (cells);
return sensitive; return TRUE;
} }
static void static void
...@@ -2049,7 +2052,7 @@ update_menu_sensitivity (GtkComboBox *combo_box, ...@@ -2049,7 +2052,7 @@ update_menu_sensitivity (GtkComboBox *combo_box,
} }
else else
{ {
sensitive = cell_view_is_sensitive (GTK_CELL_VIEW (cell_view)); sensitive = cell_layout_is_sensitive (GTK_CELL_LAYOUT (cell_view));
if (menu != priv->popup_widget && child == children) if (menu != priv->popup_widget && child == children)
{ {
...@@ -3048,8 +3051,6 @@ gtk_combo_box_menu_destroy (GtkComboBox *combo_box) ...@@ -3048,8 +3051,6 @@ gtk_combo_box_menu_destroy (GtkComboBox *combo_box)
priv->arrow = NULL; priv->arrow = NULL;
priv->separator = NULL; priv->separator = NULL;
priv->column = NULL;
/* changing the popup window will unref the menu and the children */ /* changing the popup window will unref the menu and the children */
} }
...@@ -3325,8 +3326,8 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box) ...@@ -3325,8 +3326,8 @@ gtk_combo_box_list_setup (GtkComboBox *combo_box)
if (priv->model) if (priv->model)
gtk_tree_view_set_model (GTK_TREE_VIEW (priv->tree_view), priv->model); gtk_tree_view_set_model (GTK_TREE_VIEW (priv->tree_view), priv->model);
priv->column = gtk_tree_view_column_new_with_area (priv->area); gtk_tree_view_append_column (GTK_TREE_VIEW (priv->tree_view),
gtk_tree_view_append_column (GTK_TREE_VIEW (priv->tree_view), priv->column); gtk_tree_view_column_new_with_area (priv->area));
if (gtk_tree_row_reference_valid (priv->active_row)) if (gtk_tree_row_reference_valid (priv->active_row))
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment