[gtk+] GtkButton: tighten code a bit
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkButton: tighten code a bit
- Date: Fri, 23 May 2014 03:15:33 +0000 (UTC)
commit d769f338f2abbffb98804a852887e73362d436b7
Author: Matthias Clasen <mclasen redhat com>
Date: Thu May 22 22:45:56 2014 -0400
GtkButton: tighten code a bit
Make it so we only use GtkMisc in one place.
gtk/gtkbutton.c | 32 ++++++--------------------------
1 files changed, 6 insertions(+), 26 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index fe15499..239c512 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -684,29 +684,12 @@ maybe_set_alignment (GtkButton *button,
{
GtkButtonPrivate *priv = button->priv;
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- if (GTK_IS_MISC (widget))
- {
- GtkMisc *misc = GTK_MISC (widget);
-
- if (priv->align_set)
- gtk_misc_set_alignment (misc, priv->xalign, priv->yalign);
- }
- else if (GTK_IS_ALIGNMENT (widget))
- {
- GtkAlignment *alignment = GTK_ALIGNMENT (widget);
- gfloat xscale, yscale;
-
- g_object_get (alignment,
- "xscale", &xscale,
- "yscale", &yscale,
- NULL);
+ if (!priv->align_set)
+ return;
- if (priv->align_set)
- gtk_alignment_set (alignment,
- priv->xalign, priv->yalign,
- xscale, yscale);
- }
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ if (GTK_IS_MISC (widget) || GTK_IS_ALIGNMENT (widget))
+ g_object_set (widget, "xalign", priv->xalign, "yalign", priv->yalign, NULL);
G_GNUC_END_IGNORE_DEPRECATIONS
}
@@ -1297,10 +1280,7 @@ gtk_button_construct_child (GtkButton *button)
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
-G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- if (priv->align_set)
- gtk_misc_set_alignment (GTK_MISC (label), priv->xalign, priv->yalign);
-G_GNUC_END_IGNORE_DEPRECATIONS
+ maybe_set_alignment (button, label);
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (button), label);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]