[gtksourceview/wip/completion-insensitive-style: 2/2] Completion: use the sensitive property for GtkTreeView styling
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/completion-insensitive-style: 2/2] Completion: use the sensitive property for GtkTreeView styling
- Date: Wed, 4 Feb 2015 16:34:27 +0000 (UTC)
commit fb58806743146e04d9a1c24e6882517fc567c74a
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Feb 4 13:22:53 2015 +0100
Completion: use the sensitive property for GtkTreeView styling
It simplifies the code, but Adwaita currently doesn't have the right
style when a completion proposal is selected with :sensitive set to
FALSE (for the accelerator number on the right).
gtksourceview/gtksourcecompletion.c | 18 ++----------------
gtksourceview/gtksourcecompletionmodel.c | 6 +++---
gtksourceview/gtksourcecompletionmodel.h | 2 +-
3 files changed, 6 insertions(+), 20 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index bd71245..d0b5b71 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -1956,8 +1956,6 @@ init_tree_view (GtkSourceCompletion *completion,
GtkTreeSelection *selection;
GtkTreeViewColumn *column;
GtkCellRenderer *cell_renderer;
- GtkStyleContext *style_context;
- GdkRGBA foreground_color;
completion->priv->tree_view_proposals = GTK_TREE_VIEW (gtk_builder_get_object (builder,
"tree_view_proposals"));
@@ -2008,28 +2006,16 @@ init_tree_view (GtkSourceCompletion *completion,
gtk_tree_view_column_set_attributes (column, cell_renderer,
"markup", GTK_SOURCE_COMPLETION_MODEL_COLUMN_MARKUP,
- "foreground-set", GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_HEADER,
+ "sensitive", GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_PROPOSAL,
NULL);
- style_context = gtk_widget_get_style_context (GTK_WIDGET (completion->priv->tree_view_proposals));
-
- gtk_style_context_get_color (style_context,
- GTK_STATE_FLAG_INSENSITIVE,
- &foreground_color);
-
- g_object_set (cell_renderer,
- "foreground-rgba", &foreground_color,
- NULL);
-
/* Accelerators cell renderer */
column = GTK_TREE_VIEW_COLUMN (gtk_builder_get_object (builder, "tree_view_column_accelerator"));
cell_renderer = GTK_CELL_RENDERER (gtk_builder_get_object (builder, "cell_renderer_accelerator"));
- g_object_set (cell_renderer,
- "foreground-rgba", &foreground_color,
- NULL);
+ g_object_set (cell_renderer, "sensitive", FALSE, NULL);
gtk_tree_view_column_set_cell_data_func (column,
cell_renderer,
diff --git a/gtksourceview/gtksourcecompletionmodel.c b/gtksourceview/gtksourcecompletionmodel.c
index 0430a2a..27f900b 100644
--- a/gtksourceview/gtksourcecompletionmodel.c
+++ b/gtksourceview/gtksourcecompletionmodel.c
@@ -520,8 +520,8 @@ tree_model_get_value (GtkTreeModel *tree_model,
}
break;
- case GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_HEADER:
- g_value_set_boolean (value, is_header (proposal_info));
+ case GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_PROPOSAL:
+ g_value_set_boolean (value, !is_header (proposal_info));
break;
default:
@@ -726,7 +726,7 @@ gtk_source_completion_model_init (GtkSourceCompletionModel *self)
self->priv->column_types[GTK_SOURCE_COMPLETION_MODEL_COLUMN_ICON] = GDK_TYPE_PIXBUF;
self->priv->column_types[GTK_SOURCE_COMPLETION_MODEL_COLUMN_PROPOSAL] = G_TYPE_OBJECT;
self->priv->column_types[GTK_SOURCE_COMPLETION_MODEL_COLUMN_PROVIDER] = G_TYPE_OBJECT;
- self->priv->column_types[GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_HEADER] = G_TYPE_BOOLEAN;
+ self->priv->column_types[GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_PROPOSAL] = G_TYPE_BOOLEAN;
self->priv->show_headers = 1;
self->priv->providers = NULL;
diff --git a/gtksourceview/gtksourcecompletionmodel.h b/gtksourceview/gtksourcecompletionmodel.h
index 927051d..5806043 100644
--- a/gtksourceview/gtksourcecompletionmodel.h
+++ b/gtksourceview/gtksourcecompletionmodel.h
@@ -57,7 +57,7 @@ enum
GTK_SOURCE_COMPLETION_MODEL_COLUMN_ICON,
GTK_SOURCE_COMPLETION_MODEL_COLUMN_PROPOSAL,
GTK_SOURCE_COMPLETION_MODEL_COLUMN_PROVIDER,
- GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_HEADER,
+ GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_PROPOSAL, /* not header */
GTK_SOURCE_COMPLETION_MODEL_N_COLUMNS
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]