color-widget: don't use a GtkAlignment to center the color editor
We can just use a GtkBox, and set hexpand=TRUE/halign=CENTER to allocate the editor in the middle of the box.
This commit is contained in:
committed by
Matthias Clasen
parent
988cbb6300
commit
6dbb4d6384
@ -31,7 +31,6 @@
|
|||||||
#include "gtkprivate.h"
|
#include "gtkprivate.h"
|
||||||
#include "gtkintl.h"
|
#include "gtkintl.h"
|
||||||
#include "gtksizegroup.h"
|
#include "gtksizegroup.h"
|
||||||
#include "gtkalignment.h"
|
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
@ -435,7 +434,6 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
|
|||||||
{
|
{
|
||||||
GtkWidget *box;
|
GtkWidget *box;
|
||||||
GtkWidget *p;
|
GtkWidget *p;
|
||||||
GtkWidget *alignment;
|
|
||||||
GtkWidget *button;
|
GtkWidget *button;
|
||||||
GtkWidget *label;
|
GtkWidget *label;
|
||||||
gint i;
|
gint i;
|
||||||
@ -502,9 +500,12 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
|
|||||||
g_variant_unref (variant);
|
g_variant_unref (variant);
|
||||||
|
|
||||||
cc->priv->editor = gtk_color_editor_new ();
|
cc->priv->editor = gtk_color_editor_new ();
|
||||||
alignment = gtk_alignment_new (0.5, 0.5, 0, 0);
|
gtk_widget_set_halign (cc->priv->editor, GTK_ALIGN_CENTER);
|
||||||
gtk_container_add (GTK_CONTAINER (cc), alignment);
|
gtk_widget_set_hexpand (cc->priv->editor, TRUE);
|
||||||
gtk_container_add (GTK_CONTAINER (alignment), cc->priv->editor);
|
|
||||||
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||||
|
gtk_container_add (GTK_CONTAINER (cc), box);
|
||||||
|
gtk_container_add (GTK_CONTAINER (box), cc->priv->editor);
|
||||||
|
|
||||||
g_settings_get (cc->priv->settings, "selected-color", "(bdddd)",
|
g_settings_get (cc->priv->settings, "selected-color", "(bdddd)",
|
||||||
&selected,
|
&selected,
|
||||||
@ -521,7 +522,7 @@ gtk_color_chooser_widget_init (GtkColorChooserWidget *cc)
|
|||||||
|
|
||||||
cc->priv->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
cc->priv->size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||||
gtk_size_group_add_widget (cc->priv->size_group, cc->priv->palette);
|
gtk_size_group_add_widget (cc->priv->size_group, cc->priv->palette);
|
||||||
gtk_size_group_add_widget (cc->priv->size_group, alignment);
|
gtk_size_group_add_widget (cc->priv->size_group, box);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GObject implementation {{{1 */
|
/* GObject implementation {{{1 */
|
||||||
|
|||||||
Reference in New Issue
Block a user