projects
/
hildon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2009-03-06 Alberto Garcia <agarcia@igalia.com>
[hildon]
/
src
/
hildon-time-editor.c
diff --git
a/src/hildon-time-editor.c
b/src/hildon-time-editor.c
index
c7fe2f9
..
ff24dd9
100644
(file)
--- a/
src/hildon-time-editor.c
+++ b/
src/hildon-time-editor.c
@@
-3,7
+3,7
@@
*
* Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
*
*
* 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
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@
-34,6
+34,13
@@
* minutes and seconds, and pm/am indicator as well as a button which
* popups a #HildonTimePicker dialog.
*
* minutes and seconds, and pm/am indicator as well as a button which
* popups a #HildonTimePicker dialog.
*
+ * <note>
+ * <para>
+ * #HildonTimeEditor has been deprecated since Hildon 2.2 and should not
+ * be used in newly written code. Use #HildonTimeSelector instead.
+ * </para>
+ * </note>
+ *
* <example>
* <title>HildonTimePicker example</title>
* <programlisting>
* <example>
* <title>HildonTimePicker example</title>
* <programlisting>
@@
-50,23
+57,20
@@
*
*/
*
*/
+#undef HILDON_DISABLE_DEPRECATED
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include "hildon-time-editor.h"
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkframe.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkenums.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <langinfo.h>
#include <libintl.h>
#include <string.h>
#include <time.h>
#include <stdlib.h>
#include <langinfo.h>
#include <libintl.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "hildon-time-editor.h"
#include "hildon-defines.h"
#include "hildon-time-picker.h"
#include "hildon-banner.h"
#include "hildon-defines.h"
#include "hildon-time-picker.h"
#include "hildon-banner.h"
@@
-86,7
+90,7
@@
#define ICON_PRESSED 4
#define ICON_PRESSED 4
-#define ICON_NAME "qgn_widg_timedit"
+#define ICON_NAME "widgets_time_editor"
#define ICON_SIZE "timepicker-size"
#define ICON_SIZE "timepicker-size"
@@
-280,7
+284,7
@@
hildon_time_editor_inserted_text (GtkEditable *editable,
*
* Initializes and returns the type of a hildon time editor.
*
*
* Initializes and returns the type of a hildon time editor.
*
- * @Returns: GType of #HildonTimeEditor
+ * Returns: GType of #HildonTimeEditor
*/
GType G_GNUC_CONST
hildon_time_editor_get_type (void)
*/
GType G_GNUC_CONST
hildon_time_editor_get_type (void)
@@
-366,9
+370,6
@@
hildon_time_editor_class_init (HildonTimeEditorClass *editor_c
object_class->set_property = hildon_time_editor_set_property;
widget_class->size_request = hildon_time_editor_size_request;
widget_class->size_allocate = hildon_time_editor_size_allocate;
object_class->set_property = hildon_time_editor_set_property;
widget_class->size_request = hildon_time_editor_size_request;
widget_class->size_allocate = hildon_time_editor_size_allocate;
-#ifdef MAEMO_GTK
- widget_class->tap_and_hold_setup = hildon_time_editor_tap_and_hold_setup;
-#endif
widget_class->focus = hildon_time_editor_focus;
container_class->forall = hildon_time_editor_forall;
widget_class->focus = hildon_time_editor_focus;
container_class->forall = hildon_time_editor_forall;
@@
-609,6
+610,13
@@
hildon_time_editor_init (HildonTimeEditor *editor)
hildon_time_editor_set_to_current_time (editor);
gtk_widget_pop_composite_child ();
hildon_time_editor_set_to_current_time (editor);
gtk_widget_pop_composite_child ();
+
+#ifdef MAEMO_GTK
+ g_signal_connect (editor, "tap-and-hold-setup",
+ G_CALLBACK (hildon_time_editor_tap_and_hold_setup),
+ NULL);
+#endif
+
}
static void
}
static void
@@
-692,7
+700,7
@@
hildon_time_editor_get_property (GObject *object,
}
}
}
}
-/*
+/**
* hildon_time_editor_new:
*
* This function creates a new time editor.
* hildon_time_editor_new:
*
* This function creates a new time editor.
@@
-747,15
+755,15
@@
hildon_time_editor_get_time_separators (GtkLabel *hm_sep_label,
g_date_set_dmy (&locale_test_date, 1, 2, 1970);
(void) g_date_strftime (buffer, sizeof (buffer), "%X", &locale_test_date);
g_date_set_dmy (&locale_test_date, 1, 2, 1970);
(void) g_date_strftime (buffer, sizeof (buffer), "%X", &locale_test_date);
+ /* Find h-m separator */
+ iter = buffer;
+ while (*iter && g_ascii_isdigit (*iter)) iter++;
+ /* Extract h-m separator*/
+ endp = iter;
+ while (*endp && ! g_ascii_isdigit (*endp)) endp++;
+
if (hm_sep_label != NULL)
{
if (hm_sep_label != NULL)
{
- /* Find h-m separator */
- iter = buffer;
- while (*iter && g_ascii_isdigit (*iter)) iter++;
-
- /* Extract h-m separator*/
- endp = iter;
- while (*endp && ! g_ascii_isdigit (*endp)) endp++;
separator = g_strndup (iter, endp - iter);
gtk_label_set_label (hm_sep_label, separator);
g_free (separator);
separator = g_strndup (iter, endp - iter);
gtk_label_set_label (hm_sep_label, separator);
g_free (separator);
@@
-1198,13
+1206,8
@@
hildon_time_editor_get_time (HildonTimeEditor *editor,
guint *minutes,
guint *seconds)
{
guint *minutes,
guint *seconds)
{
- HildonTimeEditorPrivate *priv;
-
g_return_if_fail (HILDON_IS_TIME_EDITOR (editor));
g_return_if_fail (HILDON_IS_TIME_EDITOR (editor));
- priv = HILDON_TIME_EDITOR_GET_PRIVATE (editor);
- g_assert (priv);
-
ticks_to_time (hildon_time_editor_get_ticks (editor), hours, minutes, seconds);
}
ticks_to_time (hildon_time_editor_get_ticks (editor), hours, minutes, seconds);
}
@@
-1734,9
+1737,11
@@
hildon_time_editor_size_allocate (GtkWidget *widget,
HildonTimeEditorPrivate *priv = HILDON_TIME_EDITOR_GET_PRIVATE (widget);
GtkAllocation alloc;
GtkRequisition req, max_req;
HildonTimeEditorPrivate *priv = HILDON_TIME_EDITOR_GET_PRIVATE (widget);
GtkAllocation alloc;
GtkRequisition req, max_req;
+ gboolean rtl;
g_assert (priv);
g_assert (priv);
+ rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
widget->allocation = *allocation;
gtk_widget_get_child_requisition (widget, &max_req);
widget->allocation = *allocation;
gtk_widget_get_child_requisition (widget, &max_req);
@@
-1746,19
+1751,32
@@
hildon_time_editor_size_allocate (GtkWidget *widget,
alloc.y = allocation->y + MAX (allocation->height - max_req.height, 0) / 2;
/* allocate frame */
alloc.y = allocation->y + MAX (allocation->height - max_req.height, 0) / 2;
/* allocate frame */
- gtk_widget_get_child_requisition (priv->frame, &req);
+ if (rtl)
+ gtk_widget_get_child_requisition (priv->iconbutton, &req);
+ else
+ gtk_widget_get_child_requisition (priv->frame, &req);
alloc.width = req.width;
alloc.height = max_req.height;
alloc.width = req.width;
alloc.height = max_req.height;
- gtk_widget_size_allocate (priv->frame, &alloc);
+ if (rtl)
+ gtk_widget_size_allocate (priv->iconbutton, &alloc);
+ else
+ gtk_widget_size_allocate (priv->frame, &alloc);
/* allocate icon */
if (GTK_WIDGET_VISIBLE (priv->iconbutton)) {
/* allocate icon */
if (GTK_WIDGET_VISIBLE (priv->iconbutton)) {
- gtk_widget_get_child_requisition (priv->iconbutton, &req);
+ if (rtl)
+ gtk_widget_get_child_requisition (priv->frame, &req);
+ else
+ gtk_widget_get_child_requisition (priv->iconbutton, &req);
alloc.x += alloc.width + HILDON_MARGIN_DEFAULT;
alloc.width = req.width;
alloc.x += alloc.width + HILDON_MARGIN_DEFAULT;
alloc.width = req.width;
- gtk_widget_size_allocate (priv->iconbutton, &alloc);
+
+ if (rtl)
+ gtk_widget_size_allocate (priv->frame, &alloc);
+ else
+ gtk_widget_size_allocate (priv->iconbutton, &alloc);
}
/* FIXME: ugly way to move labels up. They just don't seem move up
}
/* FIXME: ugly way to move labels up. They just don't seem move up
@@
-1787,7
+1805,7
@@
hildon_time_editor_focus (GtkWidget *widget,
gboolean retval;
GtkDirectionType effective_direction;
gboolean retval;
GtkDirectionType effective_direction;
- g_assert (HILDON_IS_EDITOR_EDITOR (widget));
+ g_assert (HILDON_IS_TIME_EDITOR (widget));
retval = hildon_private_composite_focus (widget, direction, &effective_direction);
retval = hildon_private_composite_focus (widget, direction, &effective_direction);
@@
-1806,7
+1824,7
@@
hildon_time_editor_entry_keypress (GtkEntry *entry,
{
case GDK_Return:
case GDK_ISO_Enter:
{
case GDK_Return:
case GDK_ISO_Enter:
- hildon_time_editor_icon_clicked (entry, data);
+ hildon_time_editor_icon_clicked (GTK_WIDGET (entry), data);
return TRUE;
default:
return FALSE;
return TRUE;
default:
return FALSE;