2008-07-29 Claudio Saavedra <csaavedra@igalia.com>
authorClaudio Saavedra <csaavedra@igalia.com>
Tue, 29 Jul 2008 17:24:09 +0000 (17:24 +0000)
committerClaudio Saavedra <csaavedra@igalia.com>
Tue, 29 Jul 2008 17:24:09 +0000 (17:24 +0000)
* src/Makefile.am: Added HildonDateButton.
* src/hildon-date-button.c: Update includes.
* src/hildon.h: Add hildon-date-button.h

Copied HildonDateButton from sandbox to trunk. Future work on this
widget must take place in trunk.

ChangeLog
src/Makefile.am
src/hildon-date-button.c [new file with mode: 0644]
src/hildon-date-button.h [new file with mode: 0644]
src/hildon.h

index 9e15e49..a972ca0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2008-07-29  Claudio Saavedra  <csaavedra@igalia.com>
 
+       * src/Makefile.am: Added HildonDateButton.
+       * src/hildon-date-button.c: Update includes.
+       * src/hildon.h: Add hildon-date-button.h
+
+       Copied HildonDateButton from sandbox to trunk. Future work on this
+       widget must take place in trunk.
+
+2008-07-29  Claudio Saavedra  <csaavedra@igalia.com>
+
        * src/Makefile.am: Added HildonPickerButton.
        * src/hildon-picker-button.h: Update includes.
        * src/hildon.h: Add hildon-picker-button.h
index a58ffaa..57d8e09 100644 (file)
@@ -41,6 +41,7 @@ libhildon_@API_VERSION_MAJOR@_la_SOURCES              = hildon-private.c                              \
                                                          hildon-touch-picker.c                         \
                                                          hildon-picker-dialog.c                        \
                                                          hildon-picker-button.c                        \
+                                                         hildon-date-button.c                          \
                                                          hildon-helper.c                               \
                                                          hildon-weekday-picker.c                       \
                                                          hildon-number-editor.c                        \
@@ -110,6 +111,7 @@ libhildon_@API_VERSION_MAJOR@_public_headers                = hildon-banner.h                               \
                                                          hildon-touch-picker.h                         \
                                                          hildon-picker-dialog.h                        \
                                                          hildon-picker-button.h                        \
+                                                         hildon-date-button.h                          \
                                                          hildon-volumebar-range.h                      \
                                                          hildon-volumebar.h                            \
                                                          hildon-vvolumebar.h                           \
diff --git a/src/hildon-date-button.c b/src/hildon-date-button.c
new file mode 100644 (file)
index 0000000..be09eff
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * This file is a part of hildon
+ *
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser Public License for more details.
+ *
+ */
+
+#include "hildon-date-selector.h"
+#include "hildon-touch-picker.h"
+#include "hildon-picker-button.h"
+#include "hildon-date-button.h"
+
+G_DEFINE_TYPE (HildonDateButton, hildon_date_button, HILDON_TYPE_PICKER_BUTTON)
+
+#if 0
+#define GET_PRIVATE(o)                                                  \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), HILDON_TYPE_DATE_BUTTON, HildonDateButtonPrivate))
+
+typedef struct _HildonDateButtonPrivate HildonDateButtonPrivate;
+
+struct _HildonDateButtonPrivate
+{
+};
+#endif
+
+#if 0
+static void
+hildon_date_button_get_property (GObject * object, guint property_id,
+                                 GValue * value, GParamSpec * pspec)
+{
+  switch (property_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+  }
+}
+
+static void
+hildon_date_button_set_property (GObject * object, guint property_id,
+                                 const GValue * value, GParamSpec * pspec)
+{
+  switch (property_id) {
+  default:
+    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+  }
+}
+#endif
+
+static void
+hildon_date_button_class_init (HildonDateButtonClass * klass)
+{
+#if 0
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+  g_type_class_add_private (klass, sizeof (HildonDateButtonPrivate));
+
+  object_class->get_property = hildon_date_button_get_property;
+  object_class->set_property = hildon_date_button_set_property;
+#endif
+}
+
+static void
+hildon_date_button_init (HildonDateButton * self)
+{
+  GtkWidget *date_selector;
+
+  date_selector = hildon_date_selector_new ();
+
+  hildon_picker_button_set_picker (HILDON_PICKER_BUTTON (self),
+                                   HILDON_TOUCH_PICKER (date_selector));
+}
+
+GtkWidget *
+hildon_date_button_new (HildonButtonFlags flags)
+{
+  return g_object_new (HILDON_TYPE_DATE_BUTTON,
+                       "title", "Date",
+                       "arrangement-flags", flags,
+                       NULL);
+}
+
+void
+hildon_date_button_get_date (HildonDateButton * button,
+                             guint * year, guint * month, guint * day)
+{
+  HildonTouchPicker *picker;
+
+  g_return_if_fail (HILDON_IS_DATE_BUTTON (button));
+
+  picker = hildon_picker_button_get_picker (HILDON_PICKER_BUTTON (button));
+
+  hildon_date_selector_get_date (HILDON_DATE_SELECTOR (picker), year, month, day);
+}
+
+void
+hildon_date_button_set_date (HildonDateButton * button,
+                             guint year, guint month, guint day)
+{
+  HildonTouchPicker *picker;
+  gchar *date;
+
+  g_return_if_fail (HILDON_IS_DATE_BUTTON (button));
+
+  picker = hildon_picker_button_get_picker (HILDON_PICKER_BUTTON (button));
+
+  hildon_date_selector_select_current_date (HILDON_DATE_SELECTOR (picker),
+                                            year, month, day);
+  date = hildon_touch_picker_get_current_text (HILDON_TOUCH_PICKER (picker));
+
+  hildon_button_set_value (HILDON_BUTTON (button), date);
+}
diff --git a/src/hildon-date-button.h b/src/hildon-date-button.h
new file mode 100644 (file)
index 0000000..b8cc255
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * This file is a part of hildon
+ *
+ * Copyright (C) 2008 Nokia Corporation, all rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser Public License for more details.
+ *
+ */
+
+#ifndef _HILDON_DATE_BUTTON
+#define _HILDON_DATE_BUTTON
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define HILDON_TYPE_DATE_BUTTON            hildon_date_button_get_type()
+#define HILDON_DATE_BUTTON(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), HILDON_TYPE_DATE_BUTTON, HildonDateButton))
+#define HILDON_DATE_BUTTON_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), HILDON_TYPE_DATE_BUTTON, HildonDateButtonClass))
+#define HILDON_IS_DATE_BUTTON(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), HILDON_TYPE_DATE_BUTTON))
+#define HILDON_IS_DATE_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), HILDON_TYPE_DATE_BUTTON))
+#define HILDON_DATE_BUTTON_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), HILDON_TYPE_DATE_BUTTON, HildonDateButtonClass))
+
+typedef struct
+{
+  HildonPickerButton parent;
+} HildonDateButton;
+
+typedef struct
+{
+  HildonPickerButtonClass parent_class;
+} HildonDateButtonClass;
+
+GType      hildon_date_button_get_type (void);
+GtkWidget *hildon_date_button_new      (HildonButtonFlags flags);
+
+void hildon_date_button_get_date       (HildonDateButton * button,
+                                        guint * year, guint * month, guint * day);
+void hildon_date_button_set_date       (HildonDateButton * button,
+                                        guint year, guint month, guint day);
+
+G_END_DECLS
+
+#endif /* _HILDON_DATE_BUTTON */
index e452124..ba2c894 100644 (file)
@@ -59,6 +59,7 @@
 #include                                        "hildon-touch-picker.h"
 #include                                        "hildon-picker-dialog.h"
 #include                                        "hildon-picker-button.h"
+#include                                        "hildon-date-button.h"
 #include                                        "hildon-volumebar-range.h"
 #include                                        "hildon-volumebar.h"
 #include                                        "hildon-vvolumebar.h"