X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fhildon-calendar-popup.c;h=990e5efc6550066bbd888159da7aa71fa891b55d;hb=c90de293989134c9cfd1a121e827a5f81f21df7b;hp=5b37f26192faefa9fa4895064e536dd10e38da62;hpb=23c1e07f8e376866ed3cf91b516a631a9f1af037;p=hildon diff --git a/src/hildon-calendar-popup.c b/src/hildon-calendar-popup.c index 5b37f26..990e5ef 100644 --- a/src/hildon-calendar-popup.c +++ b/src/hildon-calendar-popup.c @@ -1,5 +1,5 @@ /* - * This file is part of hildon-libs + * This file is a part of hildon * * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved. * @@ -8,7 +8,7 @@ * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; version 2.1 of - * the License. + * the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -24,16 +24,40 @@ /** * SECTION:hildon-calendar-popup - * @shortdesc: CalendarPopup allows choosing a date from a popup calendar. - * @longdesc: The Calendar popup is a dialog that contains a GtkCalendar - * widget. The pop-up is cancelled by pressing the ESC key. - * - * - * @seealso: #HildonDateEditor, #HildonTimeEditor - * - * HildonCalendarPopup is a dialog which contains a GtkCalendar. It + * @short_description: CalendarPopup allows choosing a date from a popup calendar. + * @see_also: #HildonDateEditor, #HildonTimeEditor + * + * HildonCalendarPopup is a dialog which contains a HildonCalendar. It * also contains arrow buttons for changing the month/year. If an * entered date is invalid, an information message will be shown. + * + * + * HildonCalendarPopup example + * + * ... + * gint y, m, d; + * GtkWidget *parent, *popup; + * + * // get current date into &y, &m, &d... + * + * gtk_widget_get_ancestor (GTK_WIDGET (data), GTK_TYPE_WINDOW); + * popup = hildon_calendar_popup_new (GTK_WINDOW (parent), y, m, d); + * + * result = gtk_dialog_run (GTK_DIALOG (popup)); + * switch (result) + * { + * case GTK_RESPONSE_OK: + * case GTK_RESPONSE_ACCEPT: + * + * hildon_calendar_popup_get_date (HILDON_CALENDAR_POPUP (popup), &y, &m, &d); + * + * // here set the new date + * } + * gtk_widget_destroy(popup); + * ... + * + * + * */ #ifdef HAVE_CONFIG_H @@ -41,8 +65,8 @@ #endif #include "hildon-calendar-popup.h" +#include "hildon-calendar.h" #include -#include #include #include #include @@ -51,7 +75,7 @@ #include "hildon-calendar-popup-private.h" #define _(String)\ - dgettext(PACKAGE, String) + dgettext("hildon-libs", String) static void init_dmy (guint year, @@ -184,11 +208,11 @@ hildon_calendar_popup_set_date (HildonCalendarPopup *cal, init_dmy (year, month, day, &dtmp, &mtmp, &ytmp); /* Remove all visual markers */ - gtk_calendar_clear_marks (GTK_CALENDAR (priv->cal)); + hildon_calendar_clear_marks (HILDON_CALENDAR (priv->cal)); /* Set a new date */ - gtk_calendar_select_month (GTK_CALENDAR (priv->cal), mtmp - 1, ytmp); - gtk_calendar_select_day (GTK_CALENDAR (priv->cal), dtmp); + hildon_calendar_select_month (HILDON_CALENDAR (priv->cal), mtmp - 1, ytmp); + hildon_calendar_select_day (HILDON_CALENDAR (priv->cal), dtmp); } /** @@ -214,7 +238,7 @@ hildon_calendar_popup_get_date (HildonCalendarPopup *cal, priv = HILDON_CALENDAR_POPUP_GET_PRIVATE (cal); g_assert (priv); - gtk_calendar_get_date (GTK_CALENDAR (priv->cal), year, month, day); + hildon_calendar_get_date (HILDON_CALENDAR (priv->cal), year, month, day); if (month != NULL) *month = *month + 1; @@ -242,7 +266,7 @@ hildon_calendar_popup_class_init (HildonCalendarPopupClass *cal_c g_param_spec_uint ("min-year", "Minimum valid year", "Minimum valid year", - 1, 2100, + 1, 10000, 1970, G_PARAM_WRITABLE)); @@ -250,7 +274,7 @@ hildon_calendar_popup_class_init (HildonCalendarPopupClass *cal_c g_param_spec_uint ("max-year", "Maximum valid year", "Maximum valid year", - 1, 2100, + 1, 10000, 2037, G_PARAM_WRITABLE)); @@ -295,23 +319,23 @@ hildon_calendar_popup_init (HildonCalendarPopup *cal) /* set the domain directory for different language */ /* FIXME I can't exactly figure out why is this here... */ if (set_domain) { - (void) bindtextdomain (PACKAGE, LOCALEDIR); + (void) bindtextdomain ("hildon-libs", LOCALEDIR); set_domain = 0; } - priv->cal = gtk_calendar_new (); + priv->cal = hildon_calendar_new (); /* dialog options and packing */ - gtk_calendar_set_display_options (GTK_CALENDAR (priv->cal), - GTK_CALENDAR_SHOW_HEADING | - GTK_CALENDAR_SHOW_DAY_NAMES | - GTK_CALENDAR_SHOW_WEEK_NUMBERS); + hildon_calendar_set_display_options (HILDON_CALENDAR (priv->cal), + HILDON_CALENDAR_SHOW_HEADING | + HILDON_CALENDAR_SHOW_DAY_NAMES | + HILDON_CALENDAR_SHOW_WEEK_NUMBERS); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (cal)->vbox), priv->cal, TRUE, TRUE, 0); gtk_dialog_set_has_separator (GTK_DIALOG (cal), FALSE); - gtk_dialog_add_button (GTK_DIALOG (cal), _("ecdg_bd_calendar_popout_done"), - GTK_RESPONSE_OK); + gtk_dialog_add_button (GTK_DIALOG (cal), _("ecdg_bd_font_dialog_ok"), GTK_RESPONSE_OK); + gtk_dialog_add_button (GTK_DIALOG (cal), _("ecdg_bd_wizard_cancel"), GTK_RESPONSE_CANCEL); gtk_widget_show(priv->cal); /* Connect signals */ @@ -390,10 +414,7 @@ init_dmy (guint year, } /* - * Exits the dialog when "selected_date" signal is emmited. The - * "selected_date" signal is a Hildon addition to GtkCalendar and is - * emitted on button-release. - */ + * Exits the dialog when "selected_date" signal is emmited. */ static void hildon_calendar_selected_date (GtkWidget *self, gpointer cal_popup)