[rhythmbox] Add custom css provider



commit fdbcf7078b753ba2c19657880a63b8b376aa9af9
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Tue Apr 16 10:12:37 2013 +0200

    Add custom css provider

 data/ui/Makefile.am            |  3 ++-
 data/ui/style.css              | 10 ++++++++++
 shell/rb-application.c         |  9 +++++++++
 shell/rb-shell.c               |  3 +++
 sources/rb-display-page-tree.c |  1 +
 5 files changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/data/ui/Makefile.am b/data/ui/Makefile.am
index c4727de..cebefea 100644
--- a/data/ui/Makefile.am
+++ b/data/ui/Makefile.am
@@ -30,7 +30,8 @@ GTK_BUILDER_FILES =                                   \
        song-info-multiple.ui                           \
        sync-dialog.ui                                  \
        sync-state.ui                                   \
-       uri-new.ui
+       uri-new.ui                                      \
+       style.css
 
 uidir = $(pkgdatadir)
 ui_DATA = $(GTK_BUILDER_FILES)
diff --git a/data/ui/style.css b/data/ui/style.css
new file mode 100644
index 0000000..30daa39
--- /dev/null
+++ b/data/ui/style.css
@@ -0,0 +1,10 @@
+.sidebar-paned.pane-separator,
+.sidebar-paned.pane-separator:hover {
+       border-width: 0 0 0 1px;
+       border-style: solid;
+       border-color: @borders;
+}
+
+.sidebar-toolbar {
+       border-width: 1px 0 1px 0;
+}
diff --git a/shell/rb-application.c b/shell/rb-application.c
index 5c5941b..ad3b4d7 100644
--- a/shell/rb-application.c
+++ b/shell/rb-application.c
@@ -334,6 +334,7 @@ impl_startup (GApplication *app)
        gboolean shell_shows_app_menu;
        GtkBuilder *builder;
        GMenuModel *menu;
+       GtkCssProvider *provider;
 
        GActionEntry app_actions[] = {
 
@@ -376,6 +377,14 @@ impl_startup (GApplication *app)
        
        g_object_unref (builder);
 
+       /* Use our own css provider */
+       provider = gtk_css_provider_new ();
+       if (gtk_css_provider_load_from_path (provider, rb_file ("style.css"), NULL)) {
+               gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
+                                                         GTK_STYLE_PROVIDER (provider),
+                                                         600);
+       }
+
        rb->priv->shell = RB_SHELL (g_object_new (RB_TYPE_SHELL,
                                    "application", rb,
                                    "autostarted", rb->priv->autostarted,
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index f8dc31a..8cce8ab 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -478,6 +478,7 @@ static void
 construct_widgets (RBShell *shell)
 {
        GtkWindow *win;
+       GtkStyleContext *context;
 
        rb_profile_start ("constructing widgets");
 
@@ -576,6 +577,8 @@ construct_widgets (RBShell *shell)
 
        /* set up sidebars */
        shell->priv->paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
+       context = gtk_widget_get_style_context (shell->priv->paned);
+       gtk_style_context_add_class (context, "sidebar-paned");
        shell->priv->right_paned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
        gtk_widget_show_all (shell->priv->right_paned);
        g_signal_connect_object (G_OBJECT (shell->priv->right_paned),
diff --git a/sources/rb-display-page-tree.c b/sources/rb-display-page-tree.c
index c7fe200..c5466bc 100644
--- a/sources/rb-display-page-tree.c
+++ b/sources/rb-display-page-tree.c
@@ -1037,6 +1037,7 @@ impl_constructed (GObject *object)
        context = gtk_widget_get_style_context (display_page_tree->priv->toolbar);
        gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
        gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
+       gtk_style_context_add_class (context, "sidebar-toolbar");
 
        gtk_grid_attach (GTK_GRID (display_page_tree), display_page_tree->priv->toolbar, 0, 1, 1, 1);
 


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