[gtk+] entry: Only set one of the .left, .right style classes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] entry: Only set one of the .left, .right style classes
- Date: Mon, 26 Oct 2015 19:29:30 +0000 (UTC)
commit ed8641ff26a2f83b5b3dd449d4e20dad34251dee
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Oct 26 15:28:50 2015 -0400
entry: Only set one of the .left, .right style classes
We were not removing the old style class when adding a new one.
gtk/gtkentry.c | 17 ++++-------------
1 files changed, 4 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 75e0131..206b42f 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -3169,25 +3169,16 @@ update_icon_style (GtkWidget *widget,
GtkEntry *entry = GTK_ENTRY (widget);
GtkEntryPrivate *priv = entry->priv;
EntryIconInfo *icon_info = priv->icons[icon_pos];
- const gchar *side;
+ const gchar *sides[2] = { GTK_STYLE_CLASS_LEFT, GTK_STYLE_CLASS_RIGHT };
if (icon_info == NULL)
return;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- {
- side = icon_pos == GTK_ENTRY_ICON_PRIMARY
- ? GTK_STYLE_CLASS_RIGHT
- : GTK_STYLE_CLASS_LEFT;
- }
- else
- {
- side = icon_pos == GTK_ENTRY_ICON_PRIMARY
- ? GTK_STYLE_CLASS_LEFT
- : GTK_STYLE_CLASS_RIGHT;
- }
+ icon_pos = 1 - icon_pos;
- gtk_css_node_add_class (icon_info->css_node, g_quark_from_static_string (side));
+ gtk_css_node_add_class (icon_info->css_node, g_quark_from_static_string (sides[icon_pos]));
+ gtk_css_node_remove_class (icon_info->css_node, g_quark_from_static_string (sides[1 - icon_pos]));
}
static EntryIconInfo*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]