X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fhildon-date-editor.c;h=8bd4732bf57bba96e5f4ef3fbb9c7fb6866c1f92;hb=f60ca25dba6c9f1cd98e80c4b0747a22907d8bf4;hp=f74596f0ebf98dfdef6336d32fa9c286570980dc;hpb=f6b850075bb8b0488555f64c93976a86a9e0d457;p=hildon
diff --git a/src/hildon-date-editor.c b/src/hildon-date-editor.c
index f74596f..8bd4732 100644
--- a/src/hildon-date-editor.c
+++ b/src/hildon-date-editor.c
@@ -1,4 +1,5 @@
-/*
+/* vim:set sw=4 expandtab cino=(0:
+ *
* This file is a part of hildon
*
* Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
@@ -34,11 +35,22 @@
*
*
*
- * gint y, m, d;
+ * guint y, m, d;
+ * GtkDialog *dialog;
+ * GtkWidget *date_editor;
*
+ * dialog = GTK_DIALOG (gtk_dialog_new ());
* date_editor = hildon_date_editor_new ();
*
- * hildon_date_editor_get_date(date_editor, &y, &m, &d);
+ * gtk_box_pack_start (GTK_BOX (dialog->vbox), gtk_label_new ("Choose a date"), FALSE, FALSE, 10);
+ * gtk_box_pack_start (GTK_BOX (dialog->vbox), date_editor, FALSE, FALSE, 10);
+ * gtk_dialog_add_button (dialog, "Close", GTK_RESPONSE_CANCEL);
+ *
+ * gtk_widget_show_all (GTK_WIDGET (dialog));
+ * gtk_dialog_run (dialog);
+ *
+ * hildon_date_editor_get_date (HILDON_DATE_EDITOR (date_editor), &y, &m, &d);
+ * g_debug ("Date: %u-%u-%u", y, m, d);
*
*
*
@@ -49,24 +61,22 @@
#include
#endif
-#include "hildon-date-editor.h"
-#include
-#include
-#include
-#include
#include
#include
#include
#include
+#include
+#include
+
+#include "hildon-date-editor.h"
#include "hildon-calendar-popup.h"
#include "hildon-defines.h"
-#include "hildon-private.h"
#include "hildon-marshalers.h"
#include "hildon-enum-types.h"
#include "hildon-time-editor.h"
#include "hildon-banner.h"
-#include
#include "hildon-date-editor-private.h"
+#include "hildon-private.h"
#define _(string) dgettext("hildon-libs", string)
@@ -1277,6 +1287,7 @@ hildon_date_editor_size_allocate (GtkWidget *widget,
GtkRequisition req;
GtkRequisition max_req;
GList *iter;
+ gboolean rtl;
g_assert (GTK_IS_WIDGET (widget));
g_assert (allocation != NULL);
@@ -1284,6 +1295,7 @@ hildon_date_editor_size_allocate (GtkWidget *widget,
ed = HILDON_DATE_EDITOR (widget);
priv = HILDON_DATE_EDITOR_GET_PRIVATE (ed);
+ rtl = (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL);
widget->allocation = *allocation;
gtk_widget_get_child_requisition (widget, &max_req);
@@ -1296,24 +1308,35 @@ hildon_date_editor_size_allocate (GtkWidget *widget,
f_alloc.x = img_alloc.x = allocation->x +
MAX (allocation->width - max_req.width, 0) / 2;
- /* allocate frame */
- if (GTK_WIDGET_VISIBLE (priv->frame)) {
+ /* calculate allocations */
+ if (GTK_WIDGET_VISIBLE (widget)) {
+ /* allocate frame */
gtk_widget_get_child_requisition (priv->frame, &req);
f_alloc.width = req.width;
f_alloc.height = max_req.height;
- gtk_widget_size_allocate (priv->frame, &f_alloc);
- }
- /* allocate icon */
- if (GTK_WIDGET_VISIBLE (priv->d_button_image)) {
+ /* allocate icon */
gtk_widget_get_child_requisition (priv->d_button_image,
&req);
img_alloc.x += f_alloc.width + HILDON_MARGIN_DEFAULT;
img_alloc.width = req.width;
img_alloc.height = max_req.height;
- gtk_widget_size_allocate (priv->d_button_image, &img_alloc);
+
+ if (rtl)
+ {
+ img_alloc.x = f_alloc.x;
+ f_alloc.x += img_alloc.width + HILDON_MARGIN_DEFAULT;
+ }
+
+ if (GTK_WIDGET_VISIBLE (priv->d_button_image)) {
+ gtk_widget_size_allocate (priv->d_button_image, &img_alloc);
+ }
+
+ if (GTK_WIDGET_VISIBLE (priv->frame)) {
+ gtk_widget_size_allocate (priv->frame, &f_alloc);
+ }
}
/* FIXME: We really should not alloc delimeters by hand (since they