[gnome-builder/wip/plugins] terminal: make terminal foreground and background match theme styling
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/plugins] terminal: make terminal foreground and background match theme styling
- Date: Wed, 10 Jun 2015 00:58:06 +0000 (UTC)
commit 3a61844de862c2c2a0bc387b02762092e80d4a63
Author: Christian Hergert <christian hergert me>
Date: Tue Jun 9 17:57:34 2015 -0700
terminal: make terminal foreground and background match theme styling
data/theme/Adwaita-dark.css | 6 ++++++
data/theme/Adwaita.css | 6 ++++++
plugins/terminal/gb-terminal-view.c | 33 +++++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/data/theme/Adwaita-dark.css b/data/theme/Adwaita-dark.css
index 6a274f3..fa19973 100644
--- a/data/theme/Adwaita-dark.css
+++ b/data/theme/Adwaita-dark.css
@@ -21,3 +21,9 @@ RgGraph {
background-image: repeating-linear-gradient(0deg, #32383a, #32383a 1px, transparent 1px, transparent 8px),
repeating-linear-gradient(-90deg, #32383a, #32383a 1px, transparent 1px, transparent
8px);
}
+
+
+GbTerminalView {
+ background-color: #2e3436;
+ color: #babdb6;
+}
diff --git a/data/theme/Adwaita.css b/data/theme/Adwaita.css
index 19e7e4a..0d2557e 100644
--- a/data/theme/Adwaita.css
+++ b/data/theme/Adwaita.css
@@ -27,3 +27,9 @@ RgGraph {
background-image: repeating-linear-gradient(0deg, #f0f1f2, #f0f1f2 1px, transparent 1px, transparent 8px),
repeating-linear-gradient(-90deg, #f0f1f2, #f0f1f2 1px, transparent 1px, transparent
8px);
}
+
+
+GbTerminalView {
+ background-color: #f6f7f8;
+ color: #4d4e53;
+}
diff --git a/plugins/terminal/gb-terminal-view.c b/plugins/terminal/gb-terminal-view.c
index 0cce4ce..f602ea1 100644
--- a/plugins/terminal/gb-terminal-view.c
+++ b/plugins/terminal/gb-terminal-view.c
@@ -249,6 +249,30 @@ window_title_changed_cb (VteTerminal *terminal,
}
static void
+style_context_changed (GtkStyleContext *style_context,
+ GbTerminalView *self)
+{
+ GdkRGBA fg;
+ GdkRGBA bg;
+
+ g_assert (GTK_IS_STYLE_CONTEXT (style_context));
+ g_assert (GB_IS_TERMINAL_VIEW (self));
+
+ gtk_style_context_get_color (style_context, GTK_STATE_FLAG_NORMAL, &fg);
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
+ gtk_style_context_get_background_color (style_context, GTK_STATE_FLAG_NORMAL, &bg);
+ G_GNUC_END_IGNORE_DEPRECATIONS;
+
+ if (bg.alpha == 0.0)
+ {
+ gdk_rgba_parse (&bg, "#f6f7f8");
+ }
+
+ vte_terminal_set_color_foreground (self->terminal, &fg);
+ vte_terminal_set_color_background (self->terminal, &bg);
+}
+
+static void
gb_terminal_grab_focus (GtkWidget *widget)
{
GbTerminalView *self = (GbTerminalView *)widget;
@@ -280,6 +304,7 @@ gb_terminal_view_class_init (GbTerminalViewClass *klass)
static void
gb_terminal_view_init (GbTerminalView *self)
{
+ GtkStyleContext *style_context;
GQuark quark;
guint signal_id;
@@ -321,4 +346,12 @@ gb_terminal_view_init (GbTerminalView *self)
self,
0);
}
+
+ style_context = gtk_widget_get_style_context (GTK_WIDGET (self));
+ g_signal_connect_object (style_context,
+ "changed",
+ G_CALLBACK (style_context_changed),
+ self,
+ 0);
+ style_context_changed (style_context, self);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]