*
* Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
*
- * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
+ * Contact: Rodrigo Novo <rodrigo.novo@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* There are two buttons to scroll the value in number field.
* Manual input is also possible.
*
+ * <note>
+ * <para>
+ * #HildonNumberEditor has been deprecated since Hildon 2.2
+ * See <link linkend="hildon-migrating-number-widgets">Migrating Number Widgets</link>
+ * section to know how to migrate this deprecated widget.
+ * </para>
+ * </note>
+ *
* <example>
* <title>HildonNumberEditor example</title>
* <programlisting>
* </example>
*/
+#undef HILDON_DISABLE_DEPRECATED
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include "hildon-number-editor.h"
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+#include <libintl.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "hildon-number-editor.h"
#include "hildon-marshalers.h"
-#include "hildon-private.h"
#include "hildon-defines.h"
#include "hildon-enum-types.h"
#include "hildon-banner.h"
-#include <libintl.h>
#include "hildon-number-editor-private.h"
+#include "hildon-private.h"
#define _(String) dgettext("hildon-libs", String)
GtkAllocation *allocation);
static gboolean
+hildon_number_editor_focus (GtkWidget *widget,
+ GtkDirectionType direction);
+
+static gboolean
hildon_number_editor_entry_keypress (GtkWidget *widget,
GdkEventKey *event,
gpointer data);
widget_class->size_request = hildon_number_editor_size_request;
widget_class->size_allocate = hildon_number_editor_size_allocate;
- widget_class->focus = hildon_private_composite_focus;
+ widget_class->focus = hildon_number_editor_focus;
editor_class->range_error = hildon_number_editor_range_error;
hildon_number_editor_real_set_value (HildonNumberEditorPrivate *priv,
gint value)
{
- /* FIXME: That looks REALLY bad */
- gchar buffer[32];
+ gchar *buffer;
/* Update text in entry to new value */
- g_snprintf (buffer, sizeof (buffer), "%d", value);
+ buffer = g_strdup_printf ("%d", value);
gtk_entry_set_text (GTK_ENTRY (priv->num_entry), buffer);
+ g_free (buffer);
}
static gboolean
priv = HILDON_NUMBER_EDITOR_GET_PRIVATE (editor);
settings = gtk_settings_get_default ();
g_object_get (settings, "gtk-timeout-repeat", &timeout, NULL);
- timeout *= 5;
+ timeout *= 8;
priv->button_event_id = g_timeout_add (timeout,
(GSourceFunc) do_mouse_timeout,
}
static gboolean
+hildon_number_editor_focus (GtkWidget *widget,
+ GtkDirectionType direction)
+{
+ gboolean retval;
+ GtkDirectionType effective_direction;
+
+ g_assert (HILDON_IS_NUMBER_EDITOR (widget));
+
+ retval = hildon_private_composite_focus (widget, direction, &effective_direction);
+
+ if (retval == TRUE)
+ return GTK_WIDGET_CLASS (parent_class)->focus (widget, effective_direction);
+ else
+ return FALSE;
+}
+
+static gboolean
hildon_number_editor_entry_focusout (GtkWidget *widget,
GdkEventFocus *event,
gpointer data)