[gtk+/gtk-style-context: 150/490] GtkCssProvider: Add gtk_css_provider_get_default().



commit 534319a34d71538ddca7bdfe6efe1cfe0565f0fb
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Aug 2 16:16:03 2010 +0200

    GtkCssProvider: Add gtk_css_provider_get_default().
    
    This method returns a GtkCssProvider with the default style information
    loaded.

 gtk/gtkcssprovider.c |   75 ++++++++++++++++++++++++++++++++++++++++++++++++++
 gtk/gtkcssprovider.h |    3 ++
 2 files changed, 78 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 5a4d82a..eadefa0 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -1499,5 +1499,80 @@ gtk_css_provider_load_from_file (GtkCssProvider  *css_provider,
   return TRUE;
 }
 
+GtkCssProvider *
+gtk_css_provider_get_default (void)
+{
+  static GtkCssProvider *provider;
+
+  if (G_UNLIKELY (!provider))
+    {
+      const gchar *str =
+        "@fg_color: #000; \n"
+        "@bg_color: #dcdad5; \n"
+        "@text_color: #000; \n"
+        "@base_color: #fff; \n"
+        "@selected_bg_color: #4b6983; \n"
+        "@selected_fg_color: #fff; \n"
+        "@tooltip_bg_color: #eee1b3; \n"
+        "@tooltip_fg_color: #000; \n"
+        "\n"
+        "*, GtkTreeView GtkButton {\n"
+        "  background-color: @bg_color;\n"
+        "  foreground-color: @fg_color;\n"
+        "  text-color: @text_color; \n"
+        "  base-color: @base_color; \n"
+        "}\n"
+        "\n"
+        "*:active {\n"
+        "  background-color: #c4c2bd;\n"
+        "  foreground-color: #000000;\n"
+        "  text-color: #c4c2bd; \n"
+        "  base-color: #9c9a94; \n"
+        "}\n"
+        "\n"
+        "*:prelight {\n"
+        "  background-color: #eeebe7;\n"
+        "  foreground-color: #000000;\n"
+        "  text-color: #eeebe7; \n"
+        "  base-color: #ffffff; \n"
+        "}\n"
+        "\n"
+        "*:selected {\n"
+        "  background-color: #4b6983;\n"
+        "  foreground-color: #ffffff;\n"
+        "  base-color: #4b6983;\n"
+        "  text-color: #ffffff;\n"
+        "}\n"
+        "\n"
+        "*:insensitive {\n"
+        "  background-color: #dcdad5;\n"
+        "  foreground-color: #757575;\n"
+        "}\n"
+        "\n"
+        "GtkTreeView, GtkIconView {\n"
+        "  background-color: #ffffff; \n"
+        "}\n"
+        "\n"
+        "row:nth-child(odd) { \n"
+        "  background-color: shade(#ffffff, 0.93); \n"
+        "}\n"
+        "\n"
+        "tooltip {\n"
+        "  background-color: @tooltip_bg_color; \n"
+        "  foreground-color: @tooltip_fg_color; \n"
+        "}\n"
+        "\n"
+        "GtkToggleButton:prelight {\n"
+        "  text-color: #000; \n"
+        "}\n"
+        "\n";
+
+      provider = gtk_css_provider_new ();
+      gtk_css_provider_load_from_data (provider, str, -1, NULL);
+    }
+
+  return provider;
+}
+
 #define __GTK_CSS_PROVIDER_C__
 #include "gtkaliasdef.c"
diff --git a/gtk/gtkcssprovider.h b/gtk/gtkcssprovider.h
index 62f5a0e..18364ea 100644
--- a/gtk/gtkcssprovider.h
+++ b/gtk/gtkcssprovider.h
@@ -57,6 +57,9 @@ gboolean         gtk_css_provider_load_from_file (GtkCssProvider  *css_provider,
                                                   GFile           *file,
                                                   GError         **error);
 
+GtkCssProvider * gtk_css_provider_get_default (void);
+
+
 G_END_DECLS
 
 #endif /* __GTK_CSS_PROVIDER_H__ */



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