[gnome-builder] Revert "Stop using deprecated gtk_style_context_get_*color() functions"
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] Revert "Stop using deprecated gtk_style_context_get_*color() functions"
- Date: Sat, 3 Apr 2021 20:01:38 +0000 (UTC)
commit 484f223c86472b2b06555947914fa958b6f41bb0
Author: Christian Hergert <chergert redhat com>
Date: Sat Apr 3 12:57:31 2021 -0700
Revert "Stop using deprecated gtk_style_context_get_*color() functions"
This reverts commit a012c9efd0bda9a46cc3b0a2d5ca702ef87e525d.
src/libide/terminal/ide-terminal-page.c | 9 +++++++--
src/libide/terminal/ide-terminal.c | 9 +++++++--
src/plugins/glade/gbp-glade-page.c | 6 ++++--
src/plugins/ls/gbp-ls-page.c | 8 ++++++--
src/plugins/omni-gutter/gbp-omni-gutter-renderer.c | 10 ++++++++--
5 files changed, 32 insertions(+), 10 deletions(-)
---
diff --git a/src/libide/terminal/ide-terminal-page.c b/src/libide/terminal/ide-terminal-page.c
index e6d0d687d..a4d3b7459 100644
--- a/src/libide/terminal/ide-terminal-page.c
+++ b/src/libide/terminal/ide-terminal-page.c
@@ -297,14 +297,19 @@ static void
style_context_changed (GtkStyleContext *style_context,
IdeTerminalPage *self)
{
+ GtkStateFlags state;
GdkRGBA fg;
GdkRGBA bg;
g_assert (GTK_IS_STYLE_CONTEXT (style_context));
g_assert (IDE_IS_TERMINAL_PAGE (self));
- gtk_style_context_lookup_color (style_context, "theme_text_color", &fg);
- gtk_style_context_lookup_color (style_context, "text_view_bg", &bg);
+ state = gtk_style_context_get_state (style_context);
+
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gtk_style_context_get_color (style_context, state, &fg);
+ gtk_style_context_get_background_color (style_context, state, &bg);
+ G_GNUC_END_IGNORE_DEPRECATIONS;
if (bg.alpha == 0.0)
gdk_rgba_parse (&bg, "#f6f7f8");
diff --git a/src/libide/terminal/ide-terminal.c b/src/libide/terminal/ide-terminal.c
index 817707eb4..175d8d727 100644
--- a/src/libide/terminal/ide-terminal.c
+++ b/src/libide/terminal/ide-terminal.c
@@ -95,14 +95,19 @@ static void
style_context_changed (IdeTerminal *self,
GtkStyleContext *style_context)
{
+ GtkStateFlags state;
GdkRGBA fg;
GdkRGBA bg;
g_assert (GTK_IS_STYLE_CONTEXT (style_context));
g_assert (IDE_IS_TERMINAL (self));
- gtk_style_context_lookup_color (style_context, "theme_text_color", &fg);
- gtk_style_context_lookup_color (style_context, "text_view_bg", &bg);
+ state = gtk_style_context_get_state (style_context);
+
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gtk_style_context_get_color (style_context, state, &fg);
+ gtk_style_context_get_background_color (style_context, state, &bg);
+ G_GNUC_END_IGNORE_DEPRECATIONS;
if (bg.alpha == 0.0)
gdk_rgba_parse (&bg, "#f6f7f8");
diff --git a/src/plugins/glade/gbp-glade-page.c b/src/plugins/glade/gbp-glade-page.c
index 2f5e69783..d60abcd72 100644
--- a/src/plugins/glade/gbp-glade-page.c
+++ b/src/plugins/glade/gbp-glade-page.c
@@ -277,8 +277,10 @@ viewport_style_changed_cb (GbpGladePage *self,
g_assert (GBP_IS_GLADE_PAGE (self));
g_assert (GTK_IS_STYLE_CONTEXT (style_context));
- gtk_style_context_lookup_color (style_context, "theme_fg_color", &fg);
- gtk_style_context_lookup_color (style_context, "theme_base_color", &bg);
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gtk_style_context_get_color (style_context, GTK_STATE_FLAG_NORMAL, &fg);
+ gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_NORMAL, &bg);
+ G_GNUC_END_IGNORE_DEPRECATIONS;
ide_page_set_primary_color_bg (IDE_PAGE (self), &bg);
ide_page_set_primary_color_fg (IDE_PAGE (self), &fg);
diff --git a/src/plugins/ls/gbp-ls-page.c b/src/plugins/ls/gbp-ls-page.c
index 44af4154c..a438eea6a 100644
--- a/src/plugins/ls/gbp-ls-page.c
+++ b/src/plugins/ls/gbp-ls-page.c
@@ -140,6 +140,7 @@ gbp_ls_page_style_updated (GtkWidget *widget)
{
GbpLsPage *self = (GbpLsPage *)widget;
GtkStyleContext *style_context;
+ GtkStateFlags state;
GdkRGBA bg, fg;
g_assert (GBP_IS_LS_PAGE (self));
@@ -148,9 +149,12 @@ gbp_ls_page_style_updated (GtkWidget *widget)
GTK_WIDGET_CLASS (gbp_ls_page_parent_class)->style_updated (widget);
style_context = gtk_widget_get_style_context (GTK_WIDGET (self->tree_view));
+ state = gtk_style_context_get_state (style_context);
- gtk_style_context_lookup_color (style_context, "theme_fg_color", &fg);
- gtk_style_context_lookup_color (style_context, "theme_base_color", &bg);
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gtk_style_context_get_color (style_context, state, &fg);
+ gtk_style_context_get_background_color (style_context, state, &bg);
+ G_GNUC_END_IGNORE_DEPRECATIONS;
ide_page_set_primary_color_bg (IDE_PAGE (self), &bg);
ide_page_set_primary_color_fg (IDE_PAGE (self), &fg);
diff --git a/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
b/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
index 9466c01aa..5bb5d41a3 100644
--- a/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
+++ b/src/plugins/omni-gutter/gbp-omni-gutter-renderer.c
@@ -385,7 +385,9 @@ static void
reload_style_colors (GbpOmniGutterRenderer *self,
GtkSourceStyleScheme *scheme)
{
+ GtkStyleContext *context;
GtkTextView *view;
+ GtkStateFlags state;
GdkRGBA fg;
GdkRGBA bg;
@@ -396,8 +398,12 @@ reload_style_colors (GbpOmniGutterRenderer *self,
if (view == NULL)
return;
- get_style_rgba (scheme, "line-numbers", FOREGROUND, &fg);
- get_style_rgba (scheme, "line-numbers", BACKGROUND, &bg);
+ context = gtk_widget_get_style_context (GTK_WIDGET (view));
+ state = gtk_style_context_get_state (context);
+ gtk_style_context_get_color (context, state, &fg);
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gtk_style_context_get_background_color (context, state, &bg);
+ G_GNUC_END_IGNORE_DEPRECATIONS;
/* Extract common values from style schemes. */
if (!get_style_rgba (scheme, "line-numbers", FOREGROUND, &self->text.fg))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]