[almanah/tagsupport] Better unfocused window colors for the tags area



commit 5ebee0904832c7fbe492ecfa1ef1488eb5e1161c
Author: Ãlvaro PeÃa <alvaropg gmail com>
Date:   Wed Feb 13 13:15:22 2013 +0100

    Better unfocused window colors for the tags area

 data/almanah.css              |   15 ++++++++++++++-
 src/widgets/entry-tags-area.c |   15 +++++++--------
 2 files changed, 21 insertions(+), 9 deletions(-)
---
diff --git a/data/almanah.css b/data/almanah.css
index fdf05ef..f1204ec 100644
--- a/data/almanah.css
+++ b/data/almanah.css
@@ -28,10 +28,14 @@ AlmanahMainWindow GtkToolbar {
     border-bottom-width: 1px;
 }
 
-AlmanahEntryTagsArea * {
+AlmanahEntryTagsArea {
     background-color: #fff;
 }
 
+AlmanahEntryTagsArea:backdrop {
+    background-color: @theme_unfocused_base_color;
+}
+
 .almanah-mw-main-content GtkScrolledWindow {
     border-style: solid;
     border-radius: 0px;
@@ -40,6 +44,10 @@ AlmanahEntryTagsArea * {
     background-color: #fff;
 }
 
+.almanah-mw-main-content GtkScrolledWindow:backdrop {
+    background-color: @theme_unfocused_base_color;
+}
+
 AlmanahTagEntry {
    color: #aaa;
    font-size: 8;
@@ -51,8 +59,13 @@ AlmanahTagEntry {
    box-shadow: none;
    background-color: #fff;
    background-image: none;
+   transition: none;
 }
 
 AlmanahTagEntry:focused {
    color: @theme_text_color;
 }
+
+AlmanahTagEntry:backdrop {
+    background-color: @theme_unfocused_base_color;
+}
diff --git a/src/widgets/entry-tags-area.c b/src/widgets/entry-tags-area.c
index 875e075..a51170a 100644
--- a/src/widgets/entry-tags-area.c
+++ b/src/widgets/entry-tags-area.c
@@ -181,6 +181,7 @@ almanah_entry_tags_area_load_tags (AlmanahEntryTagsArea *self)
 static void
 almanah_entry_tags_area_update (AlmanahEntryTagsArea *self)
 {
+	/* Update the tags area removing all tag widgets first */
 	gtk_container_foreach (GTK_CONTAINER (self), (GtkCallback) entry_tags_area_remove_foreach_cb, self);
 }
 
@@ -188,18 +189,15 @@ static gint
 almanah_entry_tags_area_draw (GtkWidget *widget, cairo_t *cr)
 {
 	gint width, height;
+	GtkStyleContext *context;
 
-	/* All GtkContainer objects don't draw anything, so just draw the background using cairo here */
+	/* All GtkContainer objects don't draw anything, so just draw the background using current style */
 
+	context = gtk_widget_get_style_context (widget);
 	width = gtk_widget_get_allocated_width (widget);
 	height = gtk_widget_get_allocated_height (widget);
 
-	/* Draw the background with white.
-	 * @TODO: use the widget default background color, so this color can be moved to the CSS
-	 */
-	cairo_set_source_rgb (cr, 1, 1, 1);
-	cairo_rectangle (cr, 0, 0, width, height);
-	cairo_fill (cr);
+	gtk_render_background (context, cr, 0, 0, width, height);
 
 	return GTK_WIDGET_CLASS (almanah_entry_tags_area_parent_class)->draw (widget, cr);
 }
@@ -238,12 +236,13 @@ tag_entry_activate_cb (GtkEntry *entry, AlmanahEntryTagsArea *self)
 void
 entry_tags_area_remove_foreach_cb (GtkWidget *tag_widget, AlmanahEntryTagsArea *self)
 {
+	/* Remove all the tag widget */
 	if (ALMANAH_IS_TAG (tag_widget)) {
 		gtk_widget_destroy (tag_widget);
 		self->priv->tags_number--;
 	}
 
-	/* Show the tags for the entry */
+	/* Show the tags for the entry when no remains tag widgets */
 	if (self->priv->tags_number == 0) {
 		almanah_entry_tags_area_load_tags (self);
 	}


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