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).
This commit is contained in:
Cosimo Cecchi 2012-05-21 13:06:37 -04:00
parent cb75afacbe
commit b4cc3e46ce
4 changed files with 22 additions and 17 deletions

View file

@ -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);

View file

@ -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,

View file

@ -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);

View file

@ -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);