[gedit] Include Adwaita theming
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Include Adwaita theming
- Date: Thu, 10 Jul 2014 12:33:22 +0000 (UTC)
commit cec4be8ebabe2bddf901b5c2d7ebe64c71c0b8a6
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jun 13 12:02:07 2014 -0400
Include Adwaita theming
With Adwaita moving into GTK+, the application-specific pieces
of the theme have to live with the applications themselves.
https://bugzilla.gnome.org/show_bug.cgi?id=731624
gedit/gedit-app.c | 54 ++++++++++++++
gedit/gedit.adwaita.css | 178 +++++++++++++++++++++++++++++++++++++++++++++
gedit/gedit.gresource.xml | 1 +
3 files changed, 233 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index 2af769b..1e3c45c 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -439,6 +439,58 @@ get_builder_object_ref (GtkBuilder *builder,
}
static void
+theme_changed (GtkSettings *settings,
+ GParamSpec *pspec,
+ gpointer data)
+{
+ static GtkCssProvider *provider;
+
+ if (pspec == NULL || g_str_equal (pspec->name, "gtk-theme-name"))
+ {
+ gchar *theme;
+ GdkScreen *screen;
+
+ g_object_get (settings, "gtk-theme-name", &theme, NULL);
+ screen = gdk_screen_get_default ();
+
+ if (g_str_equal (theme, "Adwaita"))
+ {
+ if (provider == NULL)
+ {
+ GFile *file;
+
+ provider = gtk_css_provider_new ();
+ file = g_file_new_for_uri
("resource:///org/gnome/gedit/ui/gedit.adwaita.css");
+ gtk_css_provider_load_from_file (provider, file, NULL);
+ g_object_unref (file);
+ }
+
+ gtk_style_context_add_provider_for_screen (screen,
+ GTK_STYLE_PROVIDER (provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ }
+ else if (provider != NULL)
+ {
+ gtk_style_context_remove_provider_for_screen (screen,
+ GTK_STYLE_PROVIDER (provider));
+ g_clear_object (&provider);
+ }
+
+ g_free (theme);
+ }
+}
+
+static void
+setup_theme_extensions (void)
+{
+ GtkSettings *settings;
+
+ settings = gtk_settings_get_default ();
+ g_signal_connect (settings, "notify", G_CALLBACK (theme_changed), NULL);
+ theme_changed (settings, NULL, NULL);
+}
+
+static void
gedit_app_startup (GApplication *application)
{
GeditApp *app = GEDIT_APP (application);
@@ -475,6 +527,8 @@ gedit_app_startup (GApplication *application)
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), icon_dir);
g_free (icon_dir);
+ setup_theme_extensions ();
+
#ifndef ENABLE_GVFS_METADATA
gedit_metadata_manager_init ();
#endif
diff --git a/gedit/gedit.adwaita.css b/gedit/gedit.adwaita.css
new file mode 100644
index 0000000..3bd981a
--- /dev/null
+++ b/gedit/gedit.adwaita.css
@@ -0,0 +1,178 @@
+ define-color gedit_not_found_bg rgb (237, 54, 54);
+ define-color gedit_not_found_fg white;
+
+GeditWindow .pane-separator,
+GeditWindow .pane-separator:hover {
+ border-width: 0 1px 1px 1px;
+ border-style: solid;
+ border-color: @borders;
+ background-color: shade(@theme_bg_color, 0.95);
+ color: @borders;
+}
+
+.gedit-document-panel {
+ background-color: @sidebar_bg;
+}
+
+.gedit-document-panel-group-row,
+.gedit-document-panel-group-row:hover {
+ border-top: 1px solid shade(@sidebar_bg, 0.90);
+ background-color: @sidebar_bg;
+}
+
+.gedit-document-panel-document-row:hover {
+ background-color: shade(@sidebar_bg, 0.95);
+}
+
+.gedit-document-panel-document-row:selected,
+.gedit-document-panel-document-row:selected:hover {
+ background-color: @theme_selected_bg_color;
+}
+
+/* sidepane close button styling (copied from the gtk tab close button) */
+.gedit-document-panel .list-row .button {
+ color: transparent;
+ border-image: none;
+ background-image: none;
+ background-color: transparent;
+ border-radius: 3px;
+ border-style: solid;
+ border-color: transparent;
+ border-width: 1px;
+ padding: 1px;
+ icon-shadow: none;
+}
+
+.gedit-document-panel .prelight-row .button {
+ color: mix(@theme_fg_color, @sidebar_bg, 0.6);
+ border-color: alpha(black, 0.1);
+ transition: all 200ms ease-in;
+}
+
+.gedit-document-panel .list-row .button:hover,
+.gedit-document-panel .prelight-row .button:hover {
+ color: @theme_fg_color;
+ border-color: alpha(black, 0.1);
+ transition: all 200ms ease-in;
+}
+
+.gedit-document-panel .prelight-row .button:active {
+ color: @button_active_text;
+ background-color: alpha(black, 0.08);
+ box-shadow: inset 0 1px alpha(black, 0.05);
+ icon-shadow: 0 1px @button_active_text_shadow;
+
+ border-color: alpha(black, 0.27)
+ alpha(black, 0.13)
+ alpha(black, 0.13)
+ alpha(black, 0.13);
+}
+
+.gedit-document-panel .prelight-row .button:backdrop {
+ color: mix(@theme_unfocused_fg_color, @theme_unfocused_base_color, 0.7);
+ icon-shadow: none;
+}
+
+.gedit-document-panel .prelight-row .button:backdrop:hover {
+ color: @theme_unfocused_fg_color;
+ transition: all 200ms ease-out;
+}
+
+.gedit-document-panel-dragged-row {
+ border: 1px solid @borders;
+ background-color: shade(@sidebar_bg, 0.90);
+ color: @theme_fg_color;
+}
+
+.gedit-document-panel-placeholder-row {
+ border: none;
+ background-color: mix(@sidebar_bg, @theme_selected_bg_color, 0.20);
+ transition: all 200ms ease-in;
+}
+
+GeditStatusbar {
+ border-top: 1px solid @borders;
+}
+
+GeditStatusbar GeditSmallButton,
+GeditStatusMenuButton {
+ text-shadow: none;
+}
+
+GeditStatusbar GeditSmallButton.button:backdrop,
+GeditStatusbar GeditSmallButton.button:backdrop:hover,
+GeditStatusbar GeditSmallButton.button,
+GeditStatusbar GeditSmallButton.button:hover,
+GeditStatusbar GeditSmallButton.button:active,
+GeditStatusbar GeditSmallButton.button:active:hover,
+GeditStatusMenuButton.button:backdrop,
+GeditStatusMenuButton.button:backdrop:hover,
+GeditStatusMenuButton.button,
+GeditStatusMenuButton.button:hover,
+GeditStatusMenuButton.button:active,
+GeditStatusMenuButton.button:active:hover {
+ border-image: none;
+ border-style: solid;
+ border-width: 0 1px;
+ border-radius: 0;
+ padding: 1px 8px 2px 4px;
+}
+
+GeditStatusbar GeditSmallButton.button:hover,
+GeditStatusbar GeditSmallButton.button:active,
+GeditStatusbar GeditSmallButton.button:active:hover,
+GeditStatusMenuButton.button:hover,
+GeditStatusMenuButton.button:active,
+GeditStatusMenuButton.button:active:hover {
+ border-color: @borders;
+}
+
+GeditStatusbar GeditSmallButton.button:active,
+GeditStatusMenuButton.button:active {
+ background-image: linear-gradient(to bottom,
+ @borders,
+ shade(@theme_bg_color, 0.95));
+ background-color: transparent;
+ color: @theme_selected_fg_color;
+ text-shadow: 0 1px @button_text_shadow;
+}
+
+GeditStatusbar GeditSmallButton.button:backdrop,
+GeditStatusbar GeditSmallButton.button:backdrop:hover,
+GeditStatusMenuButton.button:backdrop,
+GeditStatusMenuButton.button:backdrop:hover {
+ border-color: @unfocused_borders;
+}
+
+GeditViewFrame .gedit-search-slider {
+ background-color: @theme_base_color;
+ padding: 6px;
+ border-color: shade (@notebook_tab_gradient_b, 0.80);
+ border-radius: 0 0 3px 3px;
+ border-width: 0 1px 1px 1px;
+ border-style: solid;
+}
+
+GeditViewFrame .gedit-search-slider .not-found {
+ color: @gedit_not_found_fg;
+ background-image: none;
+ background-color: @gedit_not_found_bg;
+}
+
+GeditViewFrame .gedit-search-slider .not-found:selected {
+ background-color: @theme_selected_bg_color;
+ color: @theme_selected_fg_color;
+}
+
+GeditFileBrowserWidget .toolbar {
+ padding: 3px;
+ border-bottom: 1px solid @borders;
+ box-shadow: inset 0 3px alpha(black, 0.03), inset 0 2px alpha(black, 0.03), inset 0 1px alpha(black,
0.03);
+ background-color: shade(@theme_bg_color, 0.95);
+}
+
+.gedit-search-entry-occurrences-tag {
+ color: shade (@theme_unfocused_fg_color, 0.8);
+ margin: 2px;
+ padding: 2px;
+}
diff --git a/gedit/gedit.gresource.xml b/gedit/gedit.gresource.xml
index 7ac35b0..ce6fc2c 100644
--- a/gedit/gedit.gresource.xml
+++ b/gedit/gedit.gresource.xml
@@ -16,5 +16,6 @@
<file preprocess="xml-stripblanks">gedit-window.ui</file>
<file preprocess="xml-stripblanks">gedit-statusbar.ui</file>
<file>gedit-style.css</file>
+ <file>gedit.adwaita.css</file>
</gresource>
</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]