[nautilus] cluebars: make the label text bold by default



commit b4cc3e46ce09b1f8d4fc535a9b9bb6c3fb273c0a
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon May 21 13:06:37 2012 -0400

    cluebars: make the label text bold by default
    
    Instead of using a custom style class just for that. Also, make the
    behavior of NautilusQueryEditor and NautilusSearchBar mimic the trash
    and x-content bars (i.e. always set the "question" style class).

 src/nautilus-query-editor.c  |    7 ++-----
 src/nautilus-search-bar.c    |   16 ++++++++--------
 src/nautilus-trash-bar.c     |    8 ++++++--
 src/nautilus-x-content-bar.c |    8 ++++++--
 4 files changed, 22 insertions(+), 17 deletions(-)
---
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index 2816823..ecccb8b 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -163,9 +163,6 @@ nautilus_query_editor_draw (GtkWidget *widget,
 
 	context = gtk_widget_get_style_context (widget);
 
-	gtk_style_context_save (context);
-	gtk_style_context_add_class (context, GTK_STYLE_CLASS_INFO);
-
 	gtk_render_background (context, cr, 0, 0,
 			       gtk_widget_get_allocated_width (widget),
 			       gtk_widget_get_allocated_height (widget));
@@ -174,8 +171,6 @@ nautilus_query_editor_draw (GtkWidget *widget,
 			  gtk_widget_get_allocated_width (widget),
 			  gtk_widget_get_allocated_height (widget));
 
-	gtk_style_context_restore (context);
-
 	GTK_WIDGET_CLASS (nautilus_query_editor_parent_class)->draw (widget, cr);
 
 	return FALSE;
@@ -970,6 +965,8 @@ nautilus_query_editor_init (NautilusQueryEditor *editor)
 						       NautilusQueryEditorDetails);
 	editor->details->is_visible = TRUE;
 
+	gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (editor)),
+				     GTK_STYLE_CLASS_QUESTION);
 	gtk_orientable_set_orientation (GTK_ORIENTABLE (editor), GTK_ORIENTATION_VERTICAL);
 
 	editor->details->invisible_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
diff --git a/src/nautilus-search-bar.c b/src/nautilus-search-bar.c
index a34027b..61ae325 100644
--- a/src/nautilus-search-bar.c
+++ b/src/nautilus-search-bar.c
@@ -53,9 +53,6 @@ nautilus_search_bar_draw (GtkWidget *widget,
 
 	context = gtk_widget_get_style_context (widget);
 
-	gtk_style_context_save (context);
-	gtk_style_context_add_class (context, GTK_STYLE_CLASS_INFO);
-
 	gtk_render_background (context, cr, 0, 0,
 			       gtk_widget_get_allocated_width (widget),
 			       gtk_widget_get_allocated_height (widget));
@@ -64,8 +61,6 @@ nautilus_search_bar_draw (GtkWidget *widget,
 			  gtk_widget_get_allocated_width (widget),
 			  gtk_widget_get_allocated_height (widget));
 
-	gtk_style_context_restore (context);
-
 	GTK_WIDGET_CLASS (nautilus_search_bar_parent_class)->draw (widget, cr);
 
 	return FALSE;
@@ -136,19 +131,24 @@ nautilus_search_bar_init (NautilusSearchBar *bar)
 {
 	GtkWidget *label;
 	GtkWidget *align;
+	PangoAttrList *attrs;
 
 	bar->details =
 		G_TYPE_INSTANCE_GET_PRIVATE (bar, NAUTILUS_TYPE_SEARCH_BAR,
 					     NautilusSearchBarDetails);
 
+	gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (bar)),
+				     GTK_STYLE_CLASS_QUESTION);
 	gtk_widget_set_redraw_on_allocate (GTK_WIDGET (bar), TRUE);
 
+	attrs = pango_attr_list_new ();
+	pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
 	label = gtk_label_new (_("Search:"));
-	gtk_style_context_add_class (gtk_widget_get_style_context (label),
-				     "nautilus-cluebar-label");
-	gtk_widget_show (label);
+	gtk_label_set_attributes (GTK_LABEL (label), attrs);
+	pango_attr_list_unref (attrs);
 
 	gtk_box_pack_start (GTK_BOX (bar), label, FALSE, FALSE, 0);
+	gtk_widget_show (label);
 
 	g_object_set (label,
 		      "margin-left", 6,
diff --git a/src/nautilus-trash-bar.c b/src/nautilus-trash-bar.c
index 6f9cd36..0413549 100644
--- a/src/nautilus-trash-bar.c
+++ b/src/nautilus-trash-bar.c
@@ -180,6 +180,7 @@ nautilus_trash_bar_init (NautilusTrashBar *bar)
 {
 	GtkWidget *content_area, *action_area, *w;
 	GtkWidget *label;
+	PangoAttrList *attrs;
 
 	bar->priv = NAUTILUS_TRASH_BAR_GET_PRIVATE (bar);
 	content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (bar));
@@ -188,9 +189,12 @@ nautilus_trash_bar_init (NautilusTrashBar *bar)
 	gtk_orientable_set_orientation (GTK_ORIENTABLE (action_area),
 					GTK_ORIENTATION_HORIZONTAL);
 
+	attrs = pango_attr_list_new ();
+	pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
 	label = gtk_label_new (_("Trash"));
-	gtk_style_context_add_class (gtk_widget_get_style_context (label),
-				     "nautilus-cluebar-label");
+	gtk_label_set_attributes (GTK_LABEL (label), attrs);
+	pango_attr_list_unref (attrs);
+
 	gtk_widget_show (label);
 	gtk_container_add (GTK_CONTAINER (content_area), label);
 
diff --git a/src/nautilus-x-content-bar.c b/src/nautilus-x-content-bar.c
index 290b31c..288fc6d 100644
--- a/src/nautilus-x-content-bar.c
+++ b/src/nautilus-x-content-bar.c
@@ -257,13 +257,17 @@ static void
 nautilus_x_content_bar_init (NautilusXContentBar *bar)
 {
 	GtkWidget *content_area;
+	PangoAttrList *attrs;
 
 	bar->priv = NAUTILUS_X_CONTENT_BAR_GET_PRIVATE (bar);
 	content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (bar));
 
+	attrs = pango_attr_list_new ();
+	pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
 	bar->priv->label = gtk_label_new (NULL);
-	gtk_style_context_add_class (gtk_widget_get_style_context (bar->priv->label),
-				     "nautilus-cluebar-label");
+	gtk_label_set_attributes (GTK_LABEL (bar->priv->label), attrs);
+	pango_attr_list_unref (attrs);
+
 	gtk_label_set_ellipsize (GTK_LABEL (bar->priv->label), PANGO_ELLIPSIZE_END);
 	gtk_container_add (GTK_CONTAINER (content_area), bar->priv->label);
 



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