Commit 722abb5c authored by Ell's avatar Ell

libgimpwidgets: init GimpColorHexEntry's text after construction

Initialize GimpColorHexEntry's text (to "000000") in constructed(),
instead of init().  Otherwise, it gets cleared during construction,
so that color entries set initially to black are empty.
parent dccaa5d5
......@@ -58,13 +58,15 @@ enum
};
static gboolean gimp_color_hex_entry_events (GtkWidget *widget,
GdkEvent *event);
static void gimp_color_hex_entry_constructed (GObject *object);
static gboolean gimp_color_hex_entry_matched (GtkEntryCompletion *completion,
GtkTreeModel *model,
GtkTreeIter *iter,
GimpColorHexEntry *entry);
static gboolean gimp_color_hex_entry_events (GtkWidget *widget,
GdkEvent *event);
static gboolean gimp_color_hex_entry_matched (GtkEntryCompletion *completion,
GtkTreeModel *model,
GtkTreeIter *iter,
GimpColorHexEntry *entry);
G_DEFINE_TYPE (GimpColorHexEntry, gimp_color_hex_entry, GTK_TYPE_ENTRY)
......@@ -77,6 +79,8 @@ static guint entry_signals[LAST_SIGNAL] = { 0 };
static void
gimp_color_hex_entry_class_init (GimpColorHexEntryClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
entry_signals[COLOR_CHANGED] =
g_signal_new ("color-changed",
G_TYPE_FROM_CLASS (klass),
......@@ -86,7 +90,9 @@ gimp_color_hex_entry_class_init (GimpColorHexEntryClass *klass)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
klass->color_changed = NULL;
object_class->constructed = gimp_color_hex_entry_constructed;
klass->color_changed = NULL;
}
static void
......@@ -141,8 +147,6 @@ gimp_color_hex_entry_init (GimpColorHexEntry *entry)
gtk_entry_set_completion (GTK_ENTRY (entry), completion);
g_object_unref (completion);
gtk_entry_set_text (GTK_ENTRY (entry), "000000");
g_signal_connect (entry, "focus-out-event",
G_CALLBACK (gimp_color_hex_entry_events),
NULL);
......@@ -155,6 +159,14 @@ gimp_color_hex_entry_init (GimpColorHexEntry *entry)
entry);
}
static void
gimp_color_hex_entry_constructed (GObject *object)
{
G_OBJECT_CLASS (parent_class)->constructed (object);
gtk_entry_set_text (GTK_ENTRY (object), "000000");
}
/**
* gimp_color_hex_entry_new:
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment