Fix #136614 in a better way:
Wed Mar 10 01:49:27 2004 Matthias Clasen <maclas@gmx.de> Fix #136614 in a better way: * gtk/gtkoptionmenu.c (gtk_option_menu_init): Undo the last change. * gtk/gtkbutton.c (struct _GtkButtonPrivate): Add a flag, align_set. * gtk/gtkbutton.c (gtk_button_init): Initialize align_set to 0. * gtk/gtkbutton.c (maybe_set_alignment): Rework to only set the alignment if priv->align_set is set. * gtk/gtkbutton.c (gtk_button_set_alignment): Set align_set to 1.
This commit is contained in:
committed by
Matthias Clasen
parent
83130a7a73
commit
8f52057bbc
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
Wed Mar 10 01:49:27 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
Fix #136614 in a better way:
|
||||||
|
|
||||||
|
* gtk/gtkoptionmenu.c (gtk_option_menu_init): Undo the last change.
|
||||||
|
* gtk/gtkbutton.c (struct _GtkButtonPrivate): Add a flag, align_set.
|
||||||
|
* gtk/gtkbutton.c (gtk_button_init): Initialize align_set to 0.
|
||||||
|
* gtk/gtkbutton.c (maybe_set_alignment): Rework to only set the
|
||||||
|
alignment if priv->align_set is set.
|
||||||
|
* gtk/gtkbutton.c (gtk_button_set_alignment): Set align_set to 1.
|
||||||
|
|
||||||
Wed Mar 10 01:21:05 2004 Matthias Clasen <maclas@gmx.de>
|
Wed Mar 10 01:21:05 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Place
|
* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Place
|
||||||
|
|||||||
@ -1,3 +1,14 @@
|
|||||||
|
Wed Mar 10 01:49:27 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
Fix #136614 in a better way:
|
||||||
|
|
||||||
|
* gtk/gtkoptionmenu.c (gtk_option_menu_init): Undo the last change.
|
||||||
|
* gtk/gtkbutton.c (struct _GtkButtonPrivate): Add a flag, align_set.
|
||||||
|
* gtk/gtkbutton.c (gtk_button_init): Initialize align_set to 0.
|
||||||
|
* gtk/gtkbutton.c (maybe_set_alignment): Rework to only set the
|
||||||
|
alignment if priv->align_set is set.
|
||||||
|
* gtk/gtkbutton.c (gtk_button_set_alignment): Set align_set to 1.
|
||||||
|
|
||||||
Wed Mar 10 01:21:05 2004 Matthias Clasen <maclas@gmx.de>
|
Wed Mar 10 01:21:05 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Place
|
* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Place
|
||||||
|
|||||||
@ -1,3 +1,14 @@
|
|||||||
|
Wed Mar 10 01:49:27 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
Fix #136614 in a better way:
|
||||||
|
|
||||||
|
* gtk/gtkoptionmenu.c (gtk_option_menu_init): Undo the last change.
|
||||||
|
* gtk/gtkbutton.c (struct _GtkButtonPrivate): Add a flag, align_set.
|
||||||
|
* gtk/gtkbutton.c (gtk_button_init): Initialize align_set to 0.
|
||||||
|
* gtk/gtkbutton.c (maybe_set_alignment): Rework to only set the
|
||||||
|
alignment if priv->align_set is set.
|
||||||
|
* gtk/gtkbutton.c (gtk_button_set_alignment): Set align_set to 1.
|
||||||
|
|
||||||
Wed Mar 10 01:21:05 2004 Matthias Clasen <maclas@gmx.de>
|
Wed Mar 10 01:21:05 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Place
|
* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Place
|
||||||
|
|||||||
@ -1,3 +1,14 @@
|
|||||||
|
Wed Mar 10 01:49:27 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
Fix #136614 in a better way:
|
||||||
|
|
||||||
|
* gtk/gtkoptionmenu.c (gtk_option_menu_init): Undo the last change.
|
||||||
|
* gtk/gtkbutton.c (struct _GtkButtonPrivate): Add a flag, align_set.
|
||||||
|
* gtk/gtkbutton.c (gtk_button_init): Initialize align_set to 0.
|
||||||
|
* gtk/gtkbutton.c (maybe_set_alignment): Rework to only set the
|
||||||
|
alignment if priv->align_set is set.
|
||||||
|
* gtk/gtkbutton.c (gtk_button_set_alignment): Set align_set to 1.
|
||||||
|
|
||||||
Wed Mar 10 01:21:05 2004 Matthias Clasen <maclas@gmx.de>
|
Wed Mar 10 01:21:05 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Place
|
* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Place
|
||||||
|
|||||||
@ -1,3 +1,14 @@
|
|||||||
|
Wed Mar 10 01:49:27 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
Fix #136614 in a better way:
|
||||||
|
|
||||||
|
* gtk/gtkoptionmenu.c (gtk_option_menu_init): Undo the last change.
|
||||||
|
* gtk/gtkbutton.c (struct _GtkButtonPrivate): Add a flag, align_set.
|
||||||
|
* gtk/gtkbutton.c (gtk_button_init): Initialize align_set to 0.
|
||||||
|
* gtk/gtkbutton.c (maybe_set_alignment): Rework to only set the
|
||||||
|
alignment if priv->align_set is set.
|
||||||
|
* gtk/gtkbutton.c (gtk_button_set_alignment): Set align_set to 1.
|
||||||
|
|
||||||
Wed Mar 10 01:21:05 2004 Matthias Clasen <maclas@gmx.de>
|
Wed Mar 10 01:21:05 2004 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Place
|
* gtk/gtkcombobox.c (gtk_combo_box_menu_position_below): Place
|
||||||
|
|||||||
@ -78,6 +78,7 @@ struct _GtkButtonPrivate
|
|||||||
GtkSettings *settings;
|
GtkSettings *settings;
|
||||||
guint show_image_connection;
|
guint show_image_connection;
|
||||||
GtkWidget *image;
|
GtkWidget *image;
|
||||||
|
guint align_set : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gtk_button_class_init (GtkButtonClass *klass);
|
static void gtk_button_class_init (GtkButtonClass *klass);
|
||||||
@ -404,6 +405,7 @@ gtk_button_init (GtkButton *button)
|
|||||||
|
|
||||||
priv->xalign = 0.5;
|
priv->xalign = 0.5;
|
||||||
priv->yalign = 0.5;
|
priv->yalign = 0.5;
|
||||||
|
priv->align_set = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -452,19 +454,25 @@ gtk_button_child_type (GtkContainer *container)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
maybe_set_alignment (GtkWidget *widget,
|
maybe_set_alignment (GtkButton *button,
|
||||||
gfloat xalign,
|
GtkWidget *widget)
|
||||||
gfloat yalign)
|
|
||||||
{
|
{
|
||||||
|
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
|
||||||
|
|
||||||
if (GTK_IS_MISC (widget))
|
if (GTK_IS_MISC (widget))
|
||||||
{
|
{
|
||||||
GtkMisc *misc = GTK_MISC (widget);
|
GtkMisc *misc = GTK_MISC (widget);
|
||||||
gtk_misc_set_alignment (misc, xalign, yalign);
|
|
||||||
|
if (priv->align_set)
|
||||||
|
gtk_misc_set_alignment (misc, priv->xalign, priv->yalign);
|
||||||
}
|
}
|
||||||
else if (GTK_IS_ALIGNMENT (widget))
|
else if (GTK_IS_ALIGNMENT (widget))
|
||||||
{
|
{
|
||||||
GtkAlignment *alignment = GTK_ALIGNMENT (widget);
|
GtkAlignment *alignment = GTK_ALIGNMENT (widget);
|
||||||
gtk_alignment_set (alignment, xalign, yalign, alignment->xscale, alignment->yscale);
|
|
||||||
|
if (priv->align_set)
|
||||||
|
gtk_alignment_set (alignment, priv->xalign, priv->yalign,
|
||||||
|
alignment->xscale, alignment->yscale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -472,10 +480,8 @@ static void
|
|||||||
gtk_button_add (GtkContainer *container,
|
gtk_button_add (GtkContainer *container,
|
||||||
GtkWidget *widget)
|
GtkWidget *widget)
|
||||||
{
|
{
|
||||||
GtkButton *button = GTK_BUTTON (container);
|
maybe_set_alignment (GTK_BUTTON (container), widget);
|
||||||
GtkButtonPrivate *priv = GTK_BUTTON_GET_PRIVATE (button);
|
|
||||||
|
|
||||||
maybe_set_alignment (widget, priv->xalign, priv->yalign);
|
|
||||||
GTK_CONTAINER_CLASS (parent_class)->add (container, widget);
|
GTK_CONTAINER_CLASS (parent_class)->add (container, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -608,7 +614,10 @@ gtk_button_construct_child (GtkButton *button)
|
|||||||
NULL);
|
NULL);
|
||||||
hbox = gtk_hbox_new (FALSE, 2);
|
hbox = gtk_hbox_new (FALSE, 2);
|
||||||
|
|
||||||
|
if (priv->align_set)
|
||||||
align = gtk_alignment_new (priv->xalign, priv->yalign, 0.0, 0.0);
|
align = gtk_alignment_new (priv->xalign, priv->yalign, 0.0, 0.0);
|
||||||
|
else
|
||||||
|
align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||||
|
|
||||||
gtk_box_pack_start (GTK_BOX (hbox), priv->image, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (hbox), priv->image, FALSE, FALSE, 0);
|
||||||
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||||
@ -628,6 +637,7 @@ gtk_button_construct_child (GtkButton *button)
|
|||||||
else
|
else
|
||||||
label = gtk_label_new (button->label_text);
|
label = gtk_label_new (button->label_text);
|
||||||
|
|
||||||
|
if (priv->align_set)
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), priv->xalign, priv->yalign);
|
gtk_misc_set_alignment (GTK_MISC (label), priv->xalign, priv->yalign);
|
||||||
|
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
@ -1465,8 +1475,9 @@ gtk_button_set_alignment (GtkButton *button,
|
|||||||
|
|
||||||
priv->xalign = xalign;
|
priv->xalign = xalign;
|
||||||
priv->yalign = yalign;
|
priv->yalign = yalign;
|
||||||
|
priv->align_set = 1;
|
||||||
|
|
||||||
maybe_set_alignment (GTK_BIN (button)->child, xalign, yalign);
|
maybe_set_alignment (button, GTK_BIN (button)->child);
|
||||||
|
|
||||||
g_object_freeze_notify (G_OBJECT (button));
|
g_object_freeze_notify (G_OBJECT (button));
|
||||||
g_object_notify (G_OBJECT (button), "xalign");
|
g_object_notify (G_OBJECT (button), "xalign");
|
||||||
|
|||||||
@ -225,12 +225,6 @@ gtk_option_menu_init (GtkOptionMenu *option_menu)
|
|||||||
option_menu->menu_item = NULL;
|
option_menu->menu_item = NULL;
|
||||||
option_menu->width = 0;
|
option_menu->width = 0;
|
||||||
option_menu->height = 0;
|
option_menu->height = 0;
|
||||||
/*
|
|
||||||
* Avoid centering the label that is reparented from the menuitem.
|
|
||||||
* Since gobject doesn't support overriding default values of
|
|
||||||
* properties in a convenient way yet, we simply set the value here.
|
|
||||||
*/
|
|
||||||
gtk_button_set_alignment (GTK_BUTTON (option_menu), 0.0, 0.5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget*
|
GtkWidget*
|
||||||
|
|||||||
Reference in New Issue
Block a user