[gtksourceview/wip/completion-fix-deprecation] Completion: don't use gtk_style_context_get_background_color()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/completion-fix-deprecation] Completion: don't use gtk_style_context_get_background_color()
- Date: Wed, 26 Nov 2014 18:20:12 +0000 (UTC)
commit ccf814b364b0de51ca6938f66855ef731148bb8a
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Nov 26 18:26:36 2014 +0100
Completion: don't use gtk_style_context_get_background_color()
Because gtk_style_context_get_background_color() is deprecated.
But it doesn't work:
https://bugzilla.gnome.org/show_bug.cgi?id=740770
gtksourceview/gtksourcecompletion.c | 36 +++--------------------------
gtksourceview/gtksourcecompletionmodel.c | 6 ++--
gtksourceview/gtksourcecompletionmodel.h | 2 +-
3 files changed, 8 insertions(+), 36 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 38b8075..f4b5c3a 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -1956,9 +1956,6 @@ init_tree_view (GtkSourceCompletion *completion,
GtkTreeSelection *selection;
GtkTreeViewColumn *column;
GtkCellRenderer *cell_renderer;
- GtkStyleContext *style_context;
- GdkRGBA background_color;
- GdkRGBA foreground_color;
completion->priv->tree_view_proposals = GTK_TREE_VIEW (gtk_builder_get_object (builder,
"tree_view_proposals"));
@@ -1994,18 +1991,9 @@ init_tree_view (GtkSourceCompletion *completion,
gtk_tree_view_column_set_attributes (column, cell_renderer,
"pixbuf", GTK_SOURCE_COMPLETION_MODEL_COLUMN_ICON,
- "cell-background-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_background_color (style_context,
- GTK_STATE_FLAG_INSENSITIVE,
- &background_color);
-
- g_object_set (cell_renderer,
- "cell-background-rgba", &background_color,
- NULL);
-
g_object_bind_property (completion, "show-icons",
cell_renderer, "visible",
G_BINDING_SYNC_CREATE);
@@ -2019,35 +2007,19 @@ init_tree_view (GtkSourceCompletion *completion,
gtk_tree_view_column_set_attributes (column, cell_renderer,
"markup", GTK_SOURCE_COMPLETION_MODEL_COLUMN_MARKUP,
- "cell-background-set",
GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_HEADER,
- "foreground-set", GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_HEADER,
+ "sensitive", GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_PROPOSAL,
NULL);
- gtk_style_context_get_color (style_context,
- GTK_STATE_FLAG_INSENSITIVE,
- &foreground_color);
-
- g_object_set (cell_renderer,
- "foreground-rgba", &foreground_color,
- "cell-background-rgba", &background_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"));
- gtk_tree_view_column_set_attributes (column,
- cell_renderer,
- "cell-background-set",
GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_HEADER,
+ gtk_tree_view_column_set_attributes (column, cell_renderer,
+ "sensitive", GTK_SOURCE_COMPLETION_MODEL_COLUMN_IS_PROPOSAL,
NULL);
- g_object_set (cell_renderer,
- "foreground-rgba", &foreground_color,
- "cell-background-rgba", &background_color,
- NULL);
-
gtk_tree_view_column_set_cell_data_func (column,
cell_renderer,
(GtkTreeCellDataFunc)render_proposal_accelerator_func,
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..957dec6 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, /* i.e. not a header */
GTK_SOURCE_COMPLETION_MODEL_N_COLUMNS
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]