Commit 48a45abf authored by Guido Gunther's avatar Guido Gunther
Browse files

Merge branch 'hight-contrast' into 'master'

shell: Select style sheet for HighContrast theme

Closes #523

See merge request !864
parents ecd423d1 2352778e
Pipeline #69780 passed with stages
in 59 minutes and 24 seconds
......@@ -21,7 +21,9 @@
<file preprocess="xml-stripblanks">ui/system-prompt.ui</file>
<file preprocess="xml-stripblanks">ui/top-panel.ui</file>
<file preprocess="xml-stripblanks">ui/quick-setting.ui</file>
<file compressed="true">style.css</file>
<file compressed="true">stylesheet/adwaita-dark.css</file>
<file compressed="true">stylesheet/adwaita-hc-light.css</file>
<file compressed="true">stylesheet/common.css</file>
<file compressed="true" alias="fake-app.svg">../data/fake-app.svg</file>
</gresource>
<gresource prefix="/sm/puri/phosh/icons/">
......
......@@ -151,6 +151,8 @@ typedef struct
PhoshShellStateFlags shell_state;
char *theme_name;
GtkCssProvider *css_provider;
} PhoshShellPrivate;
......@@ -243,15 +245,38 @@ panels_dispose (PhoshShell *self)
}
/* Select proper style sheet in case of high contrast */
static void
css_setup (PhoshShell *self)
on_gtk_theme_name_changed (PhoshShell *self, GParamSpec *pspec, GtkSettings *settings)
{
const char *style;
g_autofree char *name = NULL;
PhoshShellPrivate *priv = phosh_shell_get_instance_private (self);
g_autoptr (GtkCssProvider) provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/sm/puri/phosh/style.css");
g_object_get (settings, "gtk-theme-name", &name, NULL);
if (g_strcmp0 (priv->theme_name, name) == 0)
return;
priv->theme_name = g_steal_pointer (&name);
g_debug ("GTK theme: %s", priv->theme_name);
if (priv->css_provider) {
gtk_style_context_remove_provider_for_screen(gdk_screen_get_default (),
GTK_STYLE_PROVIDER (priv->css_provider));
}
if (g_strcmp0 (priv->theme_name, "HighContrast") == 0)
style = "/sm/puri/phosh/stylesheet/adwaita-hc-light.css";
else
style = "/sm/puri/phosh/stylesheet/adwaita-dark.css";
gtk_css_provider_load_from_resource (provider, style);
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_set_object (&priv->css_provider, provider);
}
......@@ -355,6 +380,9 @@ phosh_shell_dispose (GObject *object)
phosh_system_prompter_unregister ();
g_clear_object (&priv->session_manager);
g_clear_pointer (&priv->theme_name, g_free);
g_clear_object (&priv->css_provider);
G_OBJECT_CLASS (phosh_shell_parent_class)->dispose (object);
}
......@@ -692,7 +720,6 @@ phosh_shell_constructed (GObject *object)
gtk_icon_theme_add_resource_path (gtk_icon_theme_get_default (),
"/sm/puri/phosh/icons");
css_setup (self);
priv->calls_manager = phosh_calls_manager_new ();
priv->lockscreen_manager = phosh_lockscreen_manager_new (priv->calls_manager);
......@@ -785,6 +812,9 @@ phosh_shell_init (PhoshShell *self)
gtk_settings = gtk_settings_get_default ();
g_object_set (G_OBJECT (gtk_settings), "gtk-application-prefer-dark-theme", TRUE, NULL);
g_signal_connect_swapped (gtk_settings, "notify::gtk-theme-name", G_CALLBACK (on_gtk_theme_name_changed), self);
on_gtk_theme_name_changed (self, NULL, gtk_settings);
priv->shell_state = PHOSH_STATE_NONE;
}
......
/* Adwaita dark them variant */
@define-color phosh_fg_color white;
@define-color phosh_bg_color black;
@define-color phosh_notification_bg_color #282828;
@import url("resource:///sm/puri/phosh/stylesheet/common.css");
/* HighContrast theme variant */
@define-color phosh_fg_color black;
@define-color phosh_bg_color white;
@define-color phosh_notification_bg_color #e0e0e0;
@import url("resource:///sm/puri/phosh/stylesheet/common.css");
.phosh-panel-btn {
border-width: 1px;
border-radius: 0;
}
......@@ -39,27 +39,18 @@ phosh-top-panel .indicators {
* Settings menu
*/
.phosh-settings-menu {
background-color: black;
background-color: @phosh_bg_color;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
}
.phosh-settings-listboxrow {
padding: 0;
}
.phosh-settings-row {
box-shadow: none;
background-color: black;
}
.phosh-settings-menu button.circular:not(:hover):not(:active) {
border: 2px solid @theme_bg_color;
}
.phosh-notification-tray, .phosh-notification-tray list {
border-radius: 6px;
background-color: #282828;
background-color: @phosh_notification_bg_color;
}
.phosh-quick-setting {
......@@ -110,8 +101,8 @@ phosh-activity:focus box {
}
phosh-home, phosh-top-panel {
background: black;
color: white;
background: @phosh_bg_color;
color: @phosh_fg_color;
}
.phosh-activity-close-button {
......@@ -122,7 +113,7 @@ phosh-home, phosh-top-panel {
}
.phosh-overview {
background: black;
background: @phosh_bg_color;
}
.phosh-favorite {
......@@ -154,7 +145,7 @@ phosh-home, phosh-top-panel {
}
phosh-app-grid {
background: black;
background: @phosh_bg_color;
}
phosh-app-grid separator {
......@@ -192,7 +183,7 @@ phosh-app-grid-button image {
* Lock screen
*/
phosh-lockscreen, .phosh-lockshield {
background-color: black;
background-color: @phosh_bg_color;
}
.phosh-lockscreen-clock {
......@@ -229,7 +220,6 @@ keypad > grid > button {
border: 0;
box-shadow: none;
background: 0;
border: 0;
}
keypad > grid > button:active {
......@@ -251,7 +241,6 @@ keypad > grid > button:focus, .text-only-button:focus {
border: 0;
box-shadow: none;
background: rgba(255, 255, 255, 0.3);
border: 0;
}
phosh-lockscreen phosh-media-player {
......@@ -393,7 +382,7 @@ phosh-notification-content:last-child .actions-area button:last-child {
phosh-notification-frame {
border-radius: 6px;
background-color: #282828;
background-color: @phosh_notification_bg_color;
margin: 12px;
}
......@@ -468,7 +457,7 @@ phosh-notification-banner {
* Media player
*/
phosh-media-player {
background: rgb(51,51,51);
background: @phosh_notification_bg_color;
border-radius: 5%;
padding: 9px;
border: 0;
......@@ -483,7 +472,7 @@ phosh-media-player > button {
/* The details button should not look inactive even when disabled */
phosh-media-player box *:disabled {
color: white;
color: @theme_fg_color;
-gtk-icon-effect: none;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment