aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--widgets/misc/e-dateedit.c17
-rw-r--r--widgets/misc/e-dateedit.h186
2 files changed, 118 insertions, 85 deletions
diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c
index 60b6b42d35..3867676065 100644
--- a/widgets/misc/e-dateedit.c
+++ b/widgets/misc/e-dateedit.c
@@ -2333,17 +2333,19 @@ e_date_edit_set_time_internal (EDateEdit *dedit,
return time_changed;
}
-gboolean e_date_edit_get_twodigit_year_can_future (EDateEdit *dedit)
+gboolean
+e_date_edit_get_twodigit_year_can_future (EDateEdit *dedit)
{
- g_return_val_if_fail (dedit != NULL, FALSE);
+ g_return_val_if_fail (E_IS_DATE_EDIT (dedit), FALSE);
return dedit->priv->twodigit_year_can_future;
}
-void e_date_edit_set_twodigit_year_can_future (EDateEdit *dedit,
- gboolean value)
+void
+e_date_edit_set_twodigit_year_can_future (EDateEdit *dedit,
+ gboolean value)
{
- g_return_if_fail (dedit != NULL);
+ g_return_if_fail (E_IS_DATE_EDIT (dedit));
dedit->priv->twodigit_year_can_future = value;
}
@@ -2375,8 +2377,7 @@ e_date_edit_set_get_time_callback (EDateEdit *dedit,
GtkWidget *
e_date_edit_get_entry (EDateEdit *dedit)
{
- EDateEditPrivate *priv;
- priv = dedit->priv;
+ g_return_val_if_fail (E_IS_DATE_EDIT (dedit), NULL);
- return GTK_WIDGET (priv->date_entry);
+ return GTK_WIDGET (dedit->priv->date_entry);
}
diff --git a/widgets/misc/e-dateedit.h b/widgets/misc/e-dateedit.h
index f490a5f359..4f8bee1b95 100644
--- a/widgets/misc/e-dateedit.h
+++ b/widgets/misc/e-dateedit.h
@@ -38,149 +38,181 @@
* focus to another widget, or you call one of the _get_time/date functions.
*/
-#ifndef __E_DATE_EDIT_H_
-#define __E_DATE_EDIT_H_
+#ifndef E_DATE_EDIT_H
+#define E_DATE_EDIT_H
#include <time.h>
#include <gtk/gtk.h>
-#define E_TYPE_DATE_EDIT (e_date_edit_get_type ())
-#define E_DATE_EDIT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_DATE_EDIT, EDateEdit))
-#define E_DATE_EDIT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_DATE_EDIT, EDateEditClass))
-#define E_IS_DATE_EDIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_DATE_EDIT))
-#define E_IS_DATE_EDIT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_DATE_EDIT))
-
-typedef struct _EDateEdit EDateEdit;
+/* Standard GObject macros */
+#define E_TYPE_DATE_EDIT \
+ (e_date_edit_get_type ())
+#define E_DATE_EDIT(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_DATE_EDIT, EDateEdit))
+#define E_DATE_EDIT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_DATE_EDIT, EDateEditClass))
+#define E_IS_DATE_EDIT(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_DATE_EDIT))
+#define E_IS_DATE_EDIT_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_DATE_EDIT))
+#define E_DATE_EDIT_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_DATE_EDIT, EDateEditClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EDateEdit EDateEdit;
+typedef struct _EDateEditClass EDateEditClass;
typedef struct _EDateEditPrivate EDateEditPrivate;
-typedef struct _EDateEditClass EDateEditClass;
/* The type of the callback function optionally used to get the current time.
*/
-typedef struct tm (*EDateEditGetTimeCallback) (EDateEdit *dedit,
- gpointer data);
+typedef struct tm (*EDateEditGetTimeCallback)
+ (EDateEdit *dedit,
+ gpointer data);
struct _EDateEdit {
GtkHBox hbox;
-
- /*< private >*/
EDateEditPrivate *priv;
};
struct _EDateEditClass {
GtkHBoxClass parent_class;
- void (* changed) (EDateEdit *dedit);
+ /* Signals */
+ void (*changed) (EDateEdit *dedit);
};
-GType e_date_edit_get_type (void);
-GtkWidget * e_date_edit_new (void);
+GType e_date_edit_get_type (void) G_GNUC_CONST;
+GtkWidget * e_date_edit_new (void);
/* Analogous to gtk_editable_set_editable. disable editing, while still
* allowing selection. */
-void e_date_edit_set_editable (EDateEdit *dedit, gboolean editable);
+void e_date_edit_set_editable (EDateEdit *dedit,
+ gboolean editable);
/* Returns TRUE if the last date and time set were valid. The date and time
* are only set when the user hits Return or switches keyboard focus, or
* selects a date or time from the popup. */
-gboolean e_date_edit_date_is_valid (EDateEdit *dedit);
-gboolean e_date_edit_time_is_valid (EDateEdit *dedit);
+gboolean e_date_edit_date_is_valid (EDateEdit *dedit);
+gboolean e_date_edit_time_is_valid (EDateEdit *dedit);
/* Returns TRUE if time was set, FALSE otherwise. */
-gboolean e_date_edit_have_time (EDateEdit *dedit);
+gboolean e_date_edit_have_time (EDateEdit *dedit);
/* Returns the last valid date & time set, or -1 if the date & time was set to
* 'None' and this is permitted via e_date_edit_set_allow_no_date_set. */
-time_t e_date_edit_get_time (EDateEdit *dedit);
-void e_date_edit_set_time (EDateEdit *dedit,
- time_t the_time);
+time_t e_date_edit_get_time (EDateEdit *dedit);
+void e_date_edit_set_time (EDateEdit *dedit,
+ time_t the_time);
/* This returns the last valid date set, without the time. It returns TRUE
* if a date is set, or FALSE if the date is set to 'None' and this is
* permitted via e_date_edit_set_allow_no_date_set. (Month is 1 - 12). */
-gboolean e_date_edit_get_date (EDateEdit *dedit,
- gint *year,
- gint *month,
- gint *day);
-void e_date_edit_set_date (EDateEdit *dedit,
- gint year,
- gint month,
- gint day);
+gboolean e_date_edit_get_date (EDateEdit *dedit,
+ gint *year,
+ gint *month,
+ gint *day);
+void e_date_edit_set_date (EDateEdit *dedit,
+ gint year,
+ gint month,
+ gint day);
/* This returns the last valid time set, without the date. It returns TRUE
* if a time is set, or FALSE if the time is set to 'None' and this is
* permitted via e_date_edit_set_allow_no_date_set. */
-gboolean e_date_edit_get_time_of_day (EDateEdit *dedit,
- gint *hour,
- gint *minute);
+gboolean e_date_edit_get_time_of_day (EDateEdit *dedit,
+ gint *hour,
+ gint *minute);
/* Set the time. Pass -1 as hour to set to empty. */
-void e_date_edit_set_time_of_day (EDateEdit *dedit,
+void e_date_edit_set_time_of_day (EDateEdit *dedit,
gint hour,
gint minute);
-void e_date_edit_set_date_and_time_of_day (EDateEdit *dedit,
- gint year,
- gint month,
- gint day,
- gint hour,
- gint minute);
+void e_date_edit_set_date_and_time_of_day
+ (EDateEdit *dedit,
+ gint year,
+ gint month,
+ gint day,
+ gint hour,
+ gint minute);
/* Whether we show the date field. */
-gboolean e_date_edit_get_show_date (EDateEdit *dedit);
-void e_date_edit_set_show_date (EDateEdit *dedit,
- gboolean show_date);
+gboolean e_date_edit_get_show_date (EDateEdit *dedit);
+void e_date_edit_set_show_date (EDateEdit *dedit,
+ gboolean show_date);
/* Whether we show the time field. */
-gboolean e_date_edit_get_show_time (EDateEdit *dedit);
-void e_date_edit_set_show_time (EDateEdit *dedit,
- gboolean show_time);
+gboolean e_date_edit_get_show_time (EDateEdit *dedit);
+void e_date_edit_set_show_time (EDateEdit *dedit,
+ gboolean show_time);
/* The week start day, used in the date popup. 0 (Mon) to 6 (Sun). */
-gint e_date_edit_get_week_start_day (EDateEdit *dedit);
-void e_date_edit_set_week_start_day (EDateEdit *dedit,
- gint week_start_day);
+gint e_date_edit_get_week_start_day (EDateEdit *dedit);
+void e_date_edit_set_week_start_day (EDateEdit *dedit,
+ gint week_start_day);
/* Whether we show week numbers in the date popup. */
-gboolean e_date_edit_get_show_week_numbers (EDateEdit *dedit);
-void e_date_edit_set_show_week_numbers (EDateEdit *dedit,
- gboolean show_week_numbers);
+gboolean e_date_edit_get_show_week_numbers
+ (EDateEdit *dedit);
+void e_date_edit_set_show_week_numbers
+ (EDateEdit *dedit,
+ gboolean show_week_numbers);
/* Whether we use 24 hour format in the time field & popup. */
-gboolean e_date_edit_get_use_24_hour_format (EDateEdit *dedit);
-void e_date_edit_set_use_24_hour_format (EDateEdit *dedit,
- gboolean use_24_hour_format);
+gboolean e_date_edit_get_use_24_hour_format
+ (EDateEdit *dedit);
+void e_date_edit_set_use_24_hour_format
+ (EDateEdit *dedit,
+ gboolean use_24_hour_format);
/* Whether we allow the date to be set to 'None'. e_date_edit_get_time() will
* return (time_t) -1 in this case. */
-gboolean e_date_edit_get_allow_no_date_set (EDateEdit *dedit);
-void e_date_edit_set_allow_no_date_set (EDateEdit *dedit,
- gboolean allow_no_date_set);
+gboolean e_date_edit_get_allow_no_date_set
+ (EDateEdit *dedit);
+void e_date_edit_set_allow_no_date_set
+ (EDateEdit *dedit,
+ gboolean allow_no_date_set);
/* The range of time to show in the time combo popup. */
-void e_date_edit_get_time_popup_range (EDateEdit *dedit,
- gint *lower_hour,
- gint *upper_hour);
-void e_date_edit_set_time_popup_range (EDateEdit *dedit,
- gint lower_hour,
- gint upper_hour);
+void e_date_edit_get_time_popup_range
+ (EDateEdit *dedit,
+ gint *lower_hour,
+ gint *upper_hour);
+void e_date_edit_set_time_popup_range
+ (EDateEdit *dedit,
+ gint lower_hour,
+ gint upper_hour);
/* Whether the time field is made insensitive rather than hiding it. */
-gboolean e_date_edit_get_make_time_insensitive (EDateEdit *dedit);
-void e_date_edit_set_make_time_insensitive (EDateEdit *dedit,
- gboolean make_insensitive);
+gboolean e_date_edit_get_make_time_insensitive
+ (EDateEdit *dedit);
+void e_date_edit_set_make_time_insensitive
+ (EDateEdit *dedit,
+ gboolean make_insensitive);
/* Whether two-digit years in date could be modified as in future; default is TRUE */
-gboolean e_date_edit_get_twodigit_year_can_future (EDateEdit *dedit);
-void e_date_edit_set_twodigit_year_can_future (EDateEdit *dedit,
- gboolean value);
+gboolean e_date_edit_get_twodigit_year_can_future
+ (EDateEdit *dedit);
+void e_date_edit_set_twodigit_year_can_future
+ (EDateEdit *dedit,
+ gboolean value);
/* Sets a callback to use to get the current time. This is useful if the
* application needs to use its own timezone data rather than rely on the
* Unix timezone. */
-void e_date_edit_set_get_time_callback (EDateEdit *dedit,
+void e_date_edit_set_get_time_callback
+ (EDateEdit *dedit,
EDateEditGetTimeCallback cb,
- gpointer data,
- GDestroyNotify destroy);
+ gpointer data,
+ GDestroyNotify destroy);
+
+GtkWidget * e_date_edit_get_entry (EDateEdit *dedit);
-GtkWidget * e_date_edit_get_entry (EDateEdit *dedit);
+G_END_DECLS
-#endif
+#endif /* E_DATE_EDIT_H */