[gnome-control-center] Fix big editable labels
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] Fix big editable labels
- Date: Fri, 31 Aug 2012 19:11:38 +0000 (UTC)
commit 41a79d6a35d18e9293fb6326cfac803d92b61f81
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Aug 31 15:10:45 2012 -0400
Fix big editable labels
The code we used to match the entry and label font size and
weight broke down with the latest CSS improvements in GTK+.
Use a new GtkEntry api for this instead.
The GTK+ requirement has been bumped to 3.5.13.
configure.ac | 2 +-
shell/cc-editable-entry.c | 36 +-----------------------------------
2 files changed, 2 insertions(+), 36 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4cc8619..ca4fa90 100644
--- a/configure.ac
+++ b/configure.ac
@@ -95,7 +95,7 @@ dnl Check that we meet the dependencies
dnl ==============================================
GLIB_REQUIRED_VERSION=2.31.0
-GTK_REQUIRED_VERSION=3.5.8
+GTK_REQUIRED_VERSION=3.5.13
PA_REQUIRED_VERSION=2.0
CANBERRA_REQUIRED_VERSION=0.13
GDKPIXBUF_REQUIRED_VERSION=2.23.0
diff --git a/shell/cc-editable-entry.c b/shell/cc-editable-entry.c
index 297d7eb..28317c0 100644
--- a/shell/cc-editable-entry.c
+++ b/shell/cc-editable-entry.c
@@ -147,38 +147,6 @@ cc_editable_entry_get_selectable (CcEditableEntry *e)
return e->priv->selectable;
}
-static void
-update_entry_font (GtkWidget *widget,
- CcEditableEntry *e)
-{
- CcEditableEntryPrivate *priv = e->priv;
- PangoFontDescription *desc;
- GtkStyleContext *style;
- gint size;
-
- if (!priv->weight_set && !priv->scale_set)
- return;
-
- g_signal_handlers_block_by_func (widget, update_entry_font, e);
-
- gtk_widget_override_font (widget, NULL);
-
- style = gtk_widget_get_style_context (widget);
- desc = pango_font_description_copy
- (gtk_style_context_get_font (style, gtk_widget_get_state_flags (widget)));
-
- if (priv->weight_set)
- pango_font_description_set_weight (desc, priv->weight);
- if (priv->scale_set) {
- size = pango_font_description_get_size (desc);
- pango_font_description_set_size (desc, priv->scale * size);
- }
- gtk_widget_override_font (widget, desc);
-
- pango_font_description_free (desc);
-
- g_signal_handlers_unblock_by_func (widget, update_entry_font, e);
-}
static void
update_fonts (CcEditableEntry *e)
@@ -203,10 +171,9 @@ update_fonts (CcEditableEntry *e)
label = gtk_bin_get_child (GTK_BIN (priv->button));
gtk_label_set_attributes (GTK_LABEL (label), attrs);
+ gtk_entry_set_attributes (priv->entry, attrs);
pango_attr_list_unref (attrs);
-
- update_entry_font ((GtkWidget *)priv->entry, e);
}
void
@@ -526,7 +493,6 @@ cc_editable_entry_init (CcEditableEntry *e)
g_signal_connect (priv->entry, "activate", G_CALLBACK (entry_activated), e);
g_signal_connect (priv->entry, "focus-out-event", G_CALLBACK (entry_focus_out), e);
g_signal_connect (priv->entry, "key-press-event", G_CALLBACK (entry_key_press), e);
- g_signal_connect (priv->entry, "style-updated", G_CALLBACK (update_entry_font), e);
g_signal_connect (gtk_bin_get_child (GTK_BIN (priv->button)), "size-allocate", G_CALLBACK (update_button_padding), e);
gtk_container_add (GTK_CONTAINER (e), (GtkWidget*)priv->notebook);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]