[seahorse/refactor: 10/33] Add CSS file and style sidebar properly.



commit 39abb106d87ebf747269c1392d7b8bbf736959c2
Author: Stef Walter <stefw collabora co uk>
Date:   Fri Sep 9 08:38:07 2011 +0200

    Add CSS file and style sidebar properly.

 libseahorse/Makefile.am       |    3 ++-
 libseahorse/seahorse-widget.c |   18 +++++++++++++++---
 libseahorse/seahorse.css      |   12 ++++++++++++
 src/seahorse-sidebar.c        |    5 ++++-
 4 files changed, 33 insertions(+), 5 deletions(-)
---
diff --git a/libseahorse/Makefile.am b/libseahorse/Makefile.am
index 3a1fb32..0909c3b 100644
--- a/libseahorse/Makefile.am
+++ b/libseahorse/Makefile.am
@@ -70,7 +70,8 @@ seahorse-marshal.c: seahorse-marshal.list $(GLIB_GENMARSHAL)
 ui_DATA = \
 	seahorse-prefs.xml \
 	seahorse-add-keyserver.xml \
-	seahorse-progress.xml
+	seahorse-progress.xml \
+	seahorse.css
 
 EXTRA_DIST = $(ui_DATA) \
 	seahorse-marshal.list
diff --git a/libseahorse/seahorse-widget.c b/libseahorse/seahorse-widget.c
index e150551..1fc8e22 100644
--- a/libseahorse/seahorse-widget.c
+++ b/libseahorse/seahorse-widget.c
@@ -145,10 +145,11 @@ seahorse_widget_constructed (GObject *object)
 static void
 class_init (SeahorseWidgetClass *klass)
 {
-	GObjectClass *gobject_class;
-	
+	GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+	GtkCssProvider *css_provider;
+	GError *error = NULL;
+
 	parent_class = g_type_class_peek_parent (klass);
-	gobject_class = G_OBJECT_CLASS (klass);
 
 	gobject_class->constructed = seahorse_widget_constructed;
 	gobject_class->dispose = object_dispose;
@@ -163,6 +164,17 @@ class_init (SeahorseWidgetClass *klass)
 	signals[DESTROY] = g_signal_new ("destroy", SEAHORSE_TYPE_WIDGET,
 	                                 G_SIGNAL_RUN_FIRST, G_STRUCT_OFFSET (SeahorseWidgetClass, destroy),
 	                                 NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+
+	css_provider = gtk_css_provider_new ();
+	if (gtk_css_provider_load_from_path (css_provider, SEAHORSE_UIDIR "seahorse.css", &error)) {
+		gtk_style_context_add_provider_for_screen (gdk_screen_get_default (),
+		                                           GTK_STYLE_PROVIDER (css_provider),
+		                                           GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+	} else {
+		g_warning ("couldn't load %s file: %s", SEAHORSE_UIDIR "seahorse.css", error->message);
+		g_error_free (error);
+	}
+	g_object_unref (css_provider);
 }
 
 /**
diff --git a/libseahorse/seahorse.css b/libseahorse/seahorse.css
new file mode 100644
index 0000000..698dd8f
--- /dev/null
+++ b/libseahorse/seahorse.css
@@ -0,0 +1,12 @@
+.sidebar .frame {
+    border-width: 1 0 0 0;
+    border-style: solid;
+    border-color: shade (@theme_bg_color, 0.66);
+    border-radius: 0;
+}
+
+.pane-separator {
+    border-width: 1 1 0 0;
+    border-style: solid;
+    border-color: shade (@theme_bg_color, 0.66);
+}
\ No newline at end of file
diff --git a/src/seahorse-sidebar.c b/src/seahorse-sidebar.c
index 39555a6..21a3d85 100644
--- a/src/seahorse-sidebar.c
+++ b/src/seahorse-sidebar.c
@@ -392,12 +392,15 @@ seahorse_sidebar_constructed (GObject *obj)
 
 	G_OBJECT_CLASS (seahorse_sidebar_parent_class)->constructed (obj);
 
+	gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (self)),
+	                             GTK_STYLE_CLASS_SIDEBAR);
+
 	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (self),
 	                                GTK_POLICY_NEVER,
 	                                GTK_POLICY_AUTOMATIC);
 	gtk_scrolled_window_set_hadjustment (GTK_SCROLLED_WINDOW (self), NULL);
 	gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (self), NULL);
-	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (self), GTK_SHADOW_IN);
+	gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (self), GTK_SHADOW_NONE);
 	gtk_style_context_set_junction_sides (gtk_widget_get_style_context (GTK_WIDGET (self)),
 	                                      GTK_JUNCTION_RIGHT | GTK_JUNCTION_LEFT);
 



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