diff options
author | Philip Chimento <philip@endlessm.com> | 2015-12-16 00:02:46 -0800 |
---|---|---|
committer | Philip Chimento <philip@endlessm.com> | 2015-12-16 00:02:46 -0800 |
commit | 5498390ba93922ea5977052068e81b42bf53cefc (patch) | |
tree | fcb9d76b7cc6aa6c1518b53e5caaa728571a6156 /endless/eoswindow.c | |
parent | fef6ea4704c375876b844ade88b0a344e1cd9519 (diff) |
Add composite CSS class to EosWindow
If an EosWindow is on a composite TV screen, then add the "composite"
CSS class to it. Also add a constant, EOS_STYLE_CLASS_COMPOSITE. This
allows us to do specific styling for composite.
[endlessm/eos-sdk#3930]
Diffstat (limited to 'endless/eoswindow.c')
-rw-r--r-- | endless/eoswindow.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/endless/eoswindow.c b/endless/eoswindow.c index 75f213d..795d8c0 100644 --- a/endless/eoswindow.c +++ b/endless/eoswindow.c @@ -2,10 +2,7 @@ #include "config.h" #include "string.h" -#include "eoswindow.h" - -#include "eosapplication.h" -#include "eospagemanager.h" +#include "endless.h" #include "eostopbar-private.h" #include <gtk/gtk.h> @@ -633,6 +630,16 @@ eos_window_class_init (EosWindowClass *klass) } static void +update_screen (EosWindow *self) +{ + GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (self)); + if (eos_is_composite_tv_screen (gtk_window_get_screen (GTK_WINDOW (self)))) + gtk_style_context_add_class (context, EOS_STYLE_CLASS_COMPOSITE); + else + gtk_style_context_remove_class (context, EOS_STYLE_CLASS_COMPOSITE); +} + +static void on_credits_clicked (GtkWidget *top_bar, EosWindow *self) { @@ -669,6 +676,8 @@ eos_window_init (EosWindow *self) { EosWindowPrivate *priv = eos_window_get_instance_private (self); + update_screen (self); + priv->top_bar = eos_top_bar_new (); gtk_widget_show_all (priv->top_bar); gtk_window_set_titlebar (GTK_WINDOW (self), priv->top_bar); @@ -730,6 +739,7 @@ eos_window_init (EosWindow *self) g_signal_connect (priv->top_bar, "credits-clicked", G_CALLBACK (on_credits_clicked), self); + g_signal_connect (self, "notify::screen", G_CALLBACK (update_screen), NULL); eos_window_set_page_manager (self, EOS_PAGE_MANAGER (eos_page_manager_new ())); |