[glade] GladeRegistration: add css provider to default screen.



commit 285c1e2684212e891bb2375ad2e5f964dfe4a482
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Fri Jan 29 10:22:18 2016 -0300

    GladeRegistration: add css provider to default screen.

 src/glade-registration.c   |   30 ++++++++++--------------------
 src/glade-registration.css |   26 +++++++++-----------------
 2 files changed, 19 insertions(+), 37 deletions(-)
---
diff --git a/src/glade-registration.c b/src/glade-registration.c
index eb749a9..fb46186 100644
--- a/src/glade-registration.c
+++ b/src/glade-registration.c
@@ -573,17 +573,6 @@ toggle_button_set_sensitive_on_toggle (GtkToggleButton *button, GtkWidget *widge
   gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (button));
 }
 
-static void 
-glade_registration_set_css_provider_forall (GtkWidget *widget, gpointer data)
-{
-  gtk_style_context_add_provider (gtk_widget_get_style_context (widget),
-                                  GTK_STYLE_PROVIDER (data),
-                                  GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-  
-  if (GTK_IS_CONTAINER (widget))
-    gtk_container_forall (GTK_CONTAINER (widget), glade_registration_set_css_provider_forall, data);
-}
-
 static gboolean
 on_viewport_draw (GtkWidget *viewport, cairo_t *cr, GladeRegistration *widget)
 {
@@ -614,8 +603,6 @@ static void
 glade_registration_init (GladeRegistration *registration)
 {
   GladeRegistrationPrivate *priv = glade_registration_get_instance_private (registration);
-  GtkCssProvider *css_provider;
-  GFile *file;
 
   registration->priv = priv;
 
@@ -631,13 +618,6 @@ glade_registration_init (GladeRegistration *registration)
   
   gtk_widget_init_template (GTK_WIDGET (registration));
 
-  /* Apply Custom CSS */
-  css_provider = gtk_css_provider_new ();
-  file = g_file_new_for_uri ("resource:///org/gnome/glade/glade-registration.css");
-  if (gtk_css_provider_load_from_file (css_provider, file, NULL))
-    glade_registration_set_css_provider_forall (GTK_WIDGET (registration), css_provider);
-  g_object_unref (file);
-
   if (GTK_IS_COMBO_BOX_TEXT (priv->version_other))
     {
       GtkComboBoxText *combo = GTK_COMBO_BOX_TEXT (priv->version_other);
@@ -718,6 +698,7 @@ glade_registration_class_init (GladeRegistrationClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+  GtkCssProvider *css_provider;
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/glade/glade-registration.glade");
 
@@ -811,6 +792,15 @@ glade_registration_class_init (GladeRegistrationClass *klass)
                                                          "Skip registration reminder dialog",
                                                          FALSE,
                                                          G_PARAM_READWRITE));
+
+  /* Setup Custom CSS */
+  css_provider = gtk_css_provider_new ();
+  gtk_css_provider_load_from_resource (css_provider, "/org/gnome/glade/glade-registration.css");
+
+  gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
+                                             GTK_STYLE_PROVIDER (css_provider),
+                                             GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ g_object_unref (css_provider);
 }
 
 GtkWidget*
diff --git a/src/glade-registration.css b/src/glade-registration.css
index 8494aa2..d48fa8f 100644
--- a/src/glade-registration.css
+++ b/src/glade-registration.css
@@ -21,40 +21,33 @@
  */
 
 
-GtkFrame {
+GladeRegistration GtkFrame {
   background: none;
 }
 
-GtkScrolledWindow.survey_page {
-  border: 0px;
-  margin: 0px;
-  padding:0px;
-  background-size: 100%;
-}
-
-GtkButtonBox.title,
-GtkFrame.title {
+GladeRegistration GtkButtonBox.title,
+GladeRegistration GtkFrame.title {
   background-color: @theme_selected_bg_color;
   border-radius: 8px;
   padding: 8px;
   box-shadow: 2px 2px 3px gray;
 }
 
-GtkFrame.title > GtkLabel {
+GladeRegistration GtkFrame.title > GtkLabel {
   color: white;
   font-size: 14pt;
   font-weight: bold;
   text-shadow: 1px 1px 2px black;
 }
 
-GtkFrame.survey_question {
+GladeRegistration GtkFrame.survey_question {
   border: 4px solid;
   border-color: @borders;
   border-radius: 16px;
   padding: 8px;
 }
 
-GtkFrame.textbox {
+GladeRegistration GtkFrame.textbox {
   border-radius: 16px;
   color: @theme_bg_color;
   background-color: @theme_fg_color;
@@ -62,14 +55,13 @@ GtkFrame.textbox {
   padding: 8px;
 }
 
-
-GtkLabel.textbox_title {
+GladeRegistration GtkLabel.textbox_title {
   font-size: 10pt;
   font-weight: bold;
 }
 
-GtkLabel.survey_question,
-GtkFrame.survey_question > GtkBox > GtkLabel {
+GladeRegistration GtkLabel.survey_question,
+GladeRegistration GtkFrame.survey_question > GtkBox > GtkLabel {
   font-size: 10pt;
   font-weight: bold;
   padding: 0px 0px 8px 0px;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]