Commit b5dab96b authored by Matthias Clasen's avatar Matthias Clasen

Make GtkEntryBuffer::max-length and int property

This avoid a behaviour change in a corner case and should not make
any difference.
parent b29fb1e6
......@@ -70,7 +70,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
struct _GtkEntryBufferPrivate
{
guint max_length;
gint max_length;
/* Only valid if this class is not derived */
gchar *normal_text;
......@@ -288,7 +288,7 @@ gtk_entry_buffer_set_property (GObject *obj,
gtk_entry_buffer_set_text (buffer, g_value_get_string (value), -1);
break;
case PROP_MAX_LENGTH:
gtk_entry_buffer_set_max_length (buffer, g_value_get_uint (value));
gtk_entry_buffer_set_max_length (buffer, g_value_get_int (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
......@@ -313,7 +313,7 @@ gtk_entry_buffer_get_property (GObject *obj,
g_value_set_uint (value, gtk_entry_buffer_get_length (buffer));
break;
case PROP_MAX_LENGTH:
g_value_set_uint (value, gtk_entry_buffer_get_max_length (buffer));
g_value_set_int (value, gtk_entry_buffer_get_max_length (buffer));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
......@@ -568,12 +568,11 @@ gtk_entry_buffer_set_text (GtkEntryBuffer *buffer,
**/
void
gtk_entry_buffer_set_max_length (GtkEntryBuffer *buffer,
guint max_length)
gint max_length)
{
g_return_if_fail (GTK_IS_ENTRY_BUFFER (buffer));
if (max_length > GTK_ENTRY_BUFFER_MAX_SIZE)
max_length = GTK_ENTRY_BUFFER_MAX_SIZE;
max_length = CLAMP (max_length, 0, GTK_ENTRY_BUFFER_MAX_SIZE);
if (max_length > 0 && gtk_entry_buffer_get_length (buffer) > max_length)
gtk_entry_buffer_delete_text (buffer, max_length, -1);
......@@ -593,8 +592,8 @@ gtk_entry_buffer_set_max_length (GtkEntryBuffer *buffer,
* in #GtkEntryBuffer, or 0 if there is no maximum.
*
* Since: 2.18
**/
guint
*/
gint
gtk_entry_buffer_get_max_length (GtkEntryBuffer *buffer)
{
g_return_val_if_fail (GTK_IS_ENTRY_BUFFER (buffer), 0);
......
......@@ -106,9 +106,9 @@ void gtk_entry_buffer_set_text (GtkEntryBuffe
gint n_chars);
void gtk_entry_buffer_set_max_length (GtkEntryBuffer *buffer,
guint max_length);
gint max_length);
guint gtk_entry_buffer_get_max_length (GtkEntryBuffer *buffer);
gint gtk_entry_buffer_get_max_length (GtkEntryBuffer *buffer);
guint gtk_entry_buffer_insert_text (GtkEntryBuffer *buffer,
guint position,
......
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