/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* * Author : * Damon Chaplin * * Copyright 2000, Ximian, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General Public * License as published by the Free Software Foundation. * * 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ /* * test-dateedit - tests the EDateEdit widget. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #include #include "e-dateedit.h" static void delete_event_cb (GtkWidget *widget, GdkEventAny *event, GtkWidget *app); static void on_get_date_clicked (GtkWidget *button, EDateEdit *dedit); static void on_toggle_24_hour_clicked (GtkWidget *button, EDateEdit *dedit); static void on_changed (EDateEdit *dedit, gchar *name); #if 0 static void on_date_changed (EDateEdit *dedit, gchar *name); static void on_time_changed (EDateEdit *dedit, gchar *name); #endif int main (int argc, char **argv) { GtkWidget *app; EDateEdit *dedit; GtkWidget *table, *button; gnome_program_init ("test-dateedit", "0.0", LIBGNOMEUI_MODULE, argc, argv, NULL); puts ("here"); app = gnome_app_new ("Test", "Test"); gtk_window_set_default_size (GTK_WINDOW (app), 300, 200); gtk_window_set_policy (GTK_WINDOW (app), FALSE, TRUE, TRUE); gtk_container_set_border_width (GTK_CONTAINER (app), 8); g_signal_connect((app), "delete_event", G_CALLBACK (delete_event_cb), app); table = gtk_table_new (3, 3, FALSE); gtk_table_set_row_spacings (GTK_TABLE (table), 4); gtk_table_set_col_spacings (GTK_TABLE (table), 4); gtk_widget_show (table); gnome_app_set_contents (GNOME_APP (app), table); /* EDateEdit 1. */ dedit = E_DATE_EDIT (e_date_edit_new ()); gtk_table_attach (GTK_TABLE (table), (GtkWidget*) dedit, 0, 1, 0, 1, GTK_FILL, GTK_EXPAND, 0, 0); gtk_widget_show ((GtkWidget*) (dedit)); #if 0 g_signal_connect((dedit), "date_changed", G_CALLBACK (on_date_changed), "1"); g_signal_connect((dedit), "time_changed", G_CALLBACK (on_time_changed), "1"); #else g_signal_connect((dedit), "changed", G_CALLBACK (on_changed), "1"); #endif button = gtk_button_new_with_label ("Print Date"); gtk_table_attach (GTK_TABLE (table), button, 1, 2, 0, 1, 0, 0, 0, 0); gtk_widget_show (button); g_signal_connect((button), "clicked", G_CALLBACK (on_get_date_clicked), dedit); /* EDateEdit 2. */ dedit = E_DATE_EDIT (e_date_edit_new ()); gtk_table_attach (GTK_TABLE (table), (GtkWidget*) dedit, 0, 1, 1, 2, GTK_FILL, GTK_EXPAND, 0, 0); gtk_widget_show ((GtkWidget*) (dedit)); e_date_edit_set_week_start_day (dedit, 1); e_date_edit_set_show_week_numbers (dedit, TRUE); e_date_edit_set_use_24_hour_format (dedit, FALSE); e_date_edit_set_time_popup_range (dedit, 8, 18); e_date_edit_set_show_time (dedit, FALSE); #if 0 g_signal_connect((dedit), "date_changed", G_CALLBACK (on_date_changed), "2"); g_signal_connect((dedit), "time_changed", G_CALLBACK (on_time_changed), "2"); #else g_signal_connect((dedit), "changed", G_CALLBACK (on_changed), "2"); #endif button = gtk_button_new_with_label ("Print Date"); gtk_table_attach (GTK_TABLE (table), button, 1, 2, 1, 2, 0, 0, 0, 0); gtk_widget_show (button); g_signal_connect((button), "clicked", G_CALLBACK (on_get_date_clicked), dedit); /* EDateEdit 3. */ dedit = E_DATE_EDIT (e_date_edit_new ()); gtk_table_attach (GTK_TABLE (table), (GtkWidget*) dedit, 0, 1, 2, 3, GTK_FILL, GTK_EXPAND, 0, 0); gtk_widget_show ((GtkWidget*) (dedit)); e_date_edit_set_week_start_day (dedit, 1); e_date_edit_set_show_week_numbers (dedit, TRUE); e_date_edit_set_use_24_hour_format (dedit, FALSE); e_date_edit_set_time_popup_range (dedit, 8, 18); e_date_edit_set_allow_no_date_set (dedit, TRUE); #if 0 g_signal_connect((dedit), "date_changed", G_CALLBACK (on_date_changed), "3"); g_signal_connect((dedit), "time_changed", G_CALLBACK (on_time_changed), "3"); #else g_signal_connect((dedit), "changed", G_CALLBACK (on_changed), "3"); #endif button = gtk_button_new_with_label ("Print Date"); gtk_table_attach (GTK_TABLE (table), button, 1, 2, 2, 3, 0, 0, 0, 0); gtk_widget_show (button); g_signal_connect((button), "clicked", G_CALLBACK (on_get_date_clicked), dedit); button = gtk_button_new_with_label ("Toggle 24-hour"); gtk_table_attach (GTK_TABLE (table), button, 2, 3, 2, 3, 0, 0, 0, 0); gtk_widget_show (button); g_signal_connect((button), "clicked", G_CALLBACK (on_toggle_24_hour_clicked), dedit); gtk_widget_show (app); gtk_main (); return 0; } static void delete_event_cb (GtkWidget *widget, GdkEventAny *event, GtkWidget *app) { gtk_widget_destroy (app); gtk_main_quit (); } static void on_get_date_clicked (GtkWidget *button, EDateEdit *dedit) { time_t t; t = e_date_edit_get_time (dedit); if (t == -1) g_print ("Time: None\n"); else g_print ("Time: %s", ctime (&t)); if (!e_date_edit_date_is_valid (dedit)) g_print (" Date invalid\n"); if (!e_date_edit_time_is_valid (dedit)) g_print (" Time invalid\n"); } static void on_toggle_24_hour_clicked (GtkWidget *button, EDateEdit *dedit) { e_date_edit_set_use_24_hour_format (dedit, !e_date_edit_get_use_24_hour_format (dedit)); } #if 0 static void on_date_changed (EDateEdit *dedit, gchar *name) { gint year, month, day; if (e_date_edit_date_is_valid (dedit)) { if (e_date_edit_get_date (dedit, &year, &month, &day)) { g_print ("Date %s changed to: %i/%i/%i (M/D/Y)\n", name, month, day, year); } else { g_print ("Date %s changed to: None\n", name); } } else { g_print ("Date %s changed to: Not Valid\n", name); } } static void on_time_changed (EDateEdit *dedit, gchar *name) { gint hour, minute; if (e_date_edit_time_is_valid (dedit)) { if (e_date_edit_get_time_of_day (dedit, &hour, &minute)) { g_print ("Time %s changed to: %02i:%02i\n", name, hour, minute); } else { g_print ("Time %s changed to: None\n", name); } } else { g_print ("Time %s changed to: Not Valid\n", name); } } #endif static void on_changed (EDateEdit *dedit, gchar *name) { gint year, month, day, hour, minute; g_print ("Date %s changed ", name); if (e_date_edit_date_is_valid (dedit)) { if (e_date_edit_get_date (dedit, &year, &month, &day)) { g_print ("M/D/Y: %i/%i/%i", month, day, year); } else { g_print ("None"); } } else { g_print ("Date Invalid"); } if (e_date_edit_time_is_valid (dedit)) { if (e_date_edit_get_time_of_day (dedit, &hour, &minute)) { g_print (" %02i:%02i\n", hour, minute); } else { g_print (" None\n"); } } else { g_print (" Time Invalid\n"); } } rakuco2011-11-141-2/+2 * The KDE/FreeBSD team is pleased to announce KDE Software Compilationavilla2011-10-172-4/+11 * - Set DIST_SUBDIR: move dist files to DISTDIR/hunspellsunpoet2011-08-182-2/+3 * - Unify COMMENT and pkg-descrsunpoet2011-08-132-2/+2 * - Pet portlint(1)culot2011-08-092-5/+4 * - Move language prefix to PKGNAMEPREFIXsunpoet2011-07-291-10/+10 * - Fix typosunpoet2011-07-251-1/+1 * Pass matainership to the new office teambapt2011-07-221-1/+1 * Add hebrew hunspell dictionnarybapt2011-07-204-0/+43 * Reset maintainership de jure. In fact KDE 3 has not been maintained by our teammakc2011-07-082-2/+2 * Update KDE Software Compilation ports to 4.6.5makc2011-07-082-2/+22 * The FreeBSD KDE Team is pleased to announce KDE SC 4.6.4. Read fullavilla2011-06-141-2/+2 * Update KDE Software Compilation ports to 4.6.3makc2011-05-171-2/+2 * The FreeBSD KDE Team is pleased to announce April updates for KDEavilla2011-04-071-2/+2 * The FreeBSD KDE Team is pleased to announce KDE SC 4.6.1 and KDE PIMavilla2011-03-252-10/+25 * - Get Rid MD5 supportmiwi2011-03-197-7/+0 * - The KDE FreeBSD team is proud to announce the release of KDE 4.5.5fluffy2011-01-081-2/+2 * KDE FreeBSD team presents KDE SC 4.5.4.makc2010-12-031-2/+2 * KDE FreeBSD team presents KDE SC 4.5.3.makc2010-11-041-3/+2 * KDE FreeBSD team presents KDE SC 4.5.2.makc2010-10-061-3/+3 * Autotools update. Read ports/UPDATING 20100915 for details.ade2010-09-162-4/+2 * KDE FreeBSD team presents KDE SC 4.5.1.makc2010-09-032-41/+8 * Update to 1.1makc2010-08-012-5/+5 * Present KDE SC 4.4.5 for FreeBSD.makc2010-06-301-3/+3 * Present KDE SC 4.4.4 for FreeBSD.makc2010-06-022-3/+6 * Bounce PORTREVISION for gettext-related ports. Have fun, ya'll.ade2010-05-312-2/+2 * - The FreeBSD KDE team is pleased to announce KDE SC 4.4.3 for FreeBSDfluffy2010-05-113-15/+37 * - update to 1.4.1dinoex2010-03-283-2/+3 * Presenting KDE 4.3.5 for FreeBSD. The official release notes for thismiwi2010-02-072-4/+3 * - update to jpeg-8dinoex2010-02-053-2/+3 * - use $SUB_FILES to dynamically adjust pkg-messagepgollucci2010-01-312-1/+3 * For ports maintained by ports@FreeBSD.org, remove names and/ordougb2009-12-211-3/+0 * The FreeBSD KDE is please to announce the release of KDE 4.3.4,miwi2009-12-021-3/+3 * The KDE FreeBSD team is proud to announce the release of KDE 4.3.3miwi2009-11-272-5/+10 * - Remove hebrew/geresh; no longer maintained upstreamtabthorpe2009-10-086-108/+0 * The FreeBSD KDE is please to announce the release of KDE 4.3.1,tabthorpe2009-09-022-4/+4 * These ports need an update to work with the new paragraph embedding levelmarcus2009-08-241-0/+2 * Chase the fribidi shared lib bump.marcus2009-08-231-1/+2 * - Switch SourceForge ports to the new File Release System: categories startin...amdmi32009-08-221-1/+1 * clean upmakc2009-08-081-3/+0 * The KDE FreeBSD team is proud to announce the release of KDE 4.3.0miwi2009-08-053-14/+14 * - bump all port that indirectly depends on libjpeg and have not yet been bump...dinoex2009-07-313-1/+3 * The KDE FreeBSD team is pleased to announce KDE 4.2.4, the last bugfixmiwi2009-06-032-6/+6 * Update KDE ports to 4.2.3makc2009-05-102-3/+8 * The KDE FreeBSD team is proud to announce the release of KDE 4.2.2miwi2009-04-022-4/+4 * Update KDE to 4.2.1.makc2009-03-092-4/+3 * Geresh is a multi lingual text editor, but there are a few featurestabthorpe2009-02-246-0/+105 * The KDE FreeBSD team is proud to announce the release of KDE 4.2.0miwi2009-02-095-330/+157 * Update to 1.0,makc2009-01-253-8/+10 * The KDE FreeBSD team is proud to announce the releasemiwi2008-08-292-6/+6 * Update CONFIGURE_ARGS for how we pass CONFIGURE_TARGET to configure script.rafan2008-08-211-1/+0 * The KDE FreeBSD team is proud to announce the releasemiwi2008-08-184-20/+128 * - Reset maintainer address:pav2008-06-191-1/+1 * Bump portrevision due to upgrade of devel/gettext.edwin2008-06-062-1/+2 * Unbreak by fixing some old code. Fix a typo in pkg-descr.mi2008-05-223-8/+13 * - Remove unneeded dependency from gtk12/gtk20 [1]miwi2008-04-203-13/+11 * Fix distfile location for outdated koffice-l10ns.lofi2007-11-091-1/+1 * Update to KDE 3.5.8lofi2007-10-304-8/+6 * Revert more PORTREVISION accidentslofi2007-07-051-0/+1 * Update to KDE 3.5.7 / KOffice 1.6.3lofi2007-07-045-9/+6 * BROKEN with gcc 4.2kris2007-05-271-1/+7 * - Welcome X.org 7.2 \o/.flz2007-05-206-1/+6 * Update to KDE 3.5.6 / KOffice 1.6.2lofi2007-03-144-6/+10 * Really normalize Aspell dictionaries ports PKGVERSION...thierry2007-02-151-1/+1 * Upgrade to 1.0-0.thierry2007-02-132-4/+4 * Normalize Aspell dictionaries PKGNAMEs.thierry2007-01-141-0/+1 * Update to KDE 3.5.5 / KOffice 1.6.1lofi2006-12-204-6/+122 * KDE 3.5.4 / KOffice 1.5.2lofi2006-09-136-10/+12 * All dictionaries can be installed separately:thierry2006-07-154-7/+17 * Update to KDE 3.5.3lofi2006-06-064-22/+20 * Update to KOffice 1.5.1lofi2006-05-272-4/+4 * Update to KOffice 1.5.0lofi2006-04-293-22/+8 * Update to KDE 3.5.2lofi2006-03-314-128/+22 * Conversion to a single libtool environment.ade2006-02-231-1/+1 * Update to KDE 3.5.1.lofi2006-02-014-8/+18 * SHA256ifyedwin2006-01-224-0/+4 * Update to KDE 3.5.0lofi2006-01-094-74/+82 * - Add SHA256pav2005-11-251-0/+1 * Mass-conversion to the USE_AUTOTOOLS New World Order. The code presentade2005-11-151-1/+1 * Update to 0.101mnag2005-11-072-3/+3 * Update to KDE 3.4.3 / KOffice 1.4.2lofi2005-11-054-6/+34 * Remove all the secondary port of editors/ooodict-allmaho2005-11-012-20/+0 * Fix index build by moving openoffice.org-1.1 ports.maho2005-08-291-1/+1 * Update to KDE 3.4.2 / KOffice 1.4.1lofi2005-08-012-4/+4 * Update to KDE 3.4.1lofi2005-06-264-22/+30 * - Fix categoriespav2005-06-061-0/+1 * - Unbreak and general updatepav2005-06-062-0/+19 * change the libtool version to use from 1.3 to 1.5oliver2005-06-031-1/+1 * Update to KDE 3.4lofi2005-03-214-78/+34 * Add i18nized doc subdirs to kdehier and adjust i18n port plists accordingly.lofi2004-12-232-2/+0 * Fix kde3-i18n ports.lofi2004-12-162-4/+4 * Update to KDE 3.3.2lofi2004-12-148-12/+12 * Update to 0.8arved2004-12-025-30/+12 * - Update maintainer's email addresspav2004-11-152-4/+4 * Update to KDE 3.3.1lofi2004-11-086-7/+35 * As previously announced, remove hebrew/pine due to security problems.linimon2004-10-2326-924/+0 * Update to KDE 3.3lofi2004-08-317-7/+93 * Add slaves ports for Aspell's new dictionaries.thierry2004-08-293-0/+22 * Fix build with gcc 3.4arved2004-08-172-0/+22 * Factor out all but one of the build switches of the KDE main module portslofi2004-08-112-3/+3 * - Add the X_WINDOW_SYSTEM={xorg,xfree86-4,xfree86-3} variable to bsd.port.mk,anholt2004-07-241-1/+1 * Set an expiry date of 2004-08-20 for these BROKEN/IGNORE/FORBIDDENkris2004-06-221-0/+2 * - Update to 0.100pav2004-06-173-60/+64 * Unbreak.thierry2004-06-113-8/+26 * Update to version 3.2.3lofi2004-06-104-4/+24 * Oops. Forgot the language categories.lofi2004-05-072-3/+3 * Update to KDE 3.2.2lofi2004-04-204-36/+4 * Trim whitespace.trevor2004-04-111-52/+52 * Remove category pkg/COMMENT files in favour of a COMMENT variable in thekris2004-04-022-1/+2 * SIZEify (maintainer timeout)trevor2004-03-313-0/+3 * SIZEify.trevor2004-03-181-0/+1 * Update to KDE 3.2.1 / QT 3.3.1lofi2004-03-105-4/+7 * Pine versions before 4.58 contain remotely exploitable vulnerabilities.nectar2004-02-131-0/+2 * Update to version 0.93.linimon2004-02-112-5/+6 * Reset bouncing maintainer addresskris2004-02-081-1/+1 * Update to KDE 3.2.0lofi2004-02-059-22/+81 * Bump PORTREVISION on all ports that depend on gettext to aid with upgrading.marcus2004-02-042-0/+2 * Add USE_GETTEXT and bump PORTREVISION.marcus2004-02-043-6/+6 * Now gettext 0.12.1 is gettext-old.trevor2004-01-243-3/+3 * Mark as broken on recent versions of 5.x due to the gcc3.3 import.linimon2003-12-221-1/+7 * Translation update: fix checksum.will2003-09-222-2/+2 * Upgrade to Qt 3.2.1 / KDE 3.1.4. See x11/kde3/Makefile rev 1.64 for details.will2003-09-182-2/+2 * Update hebrew/culmusedwin2003-09-045-34/+40 * Moved to a C frontend, instead of perl.leeym2003-08-074-34/+13 * Update KDE to the latest official release, KDE 3.1.3lofi2003-07-294-2/+6 * Update to KDE 3.1.2lioux2003-05-206-8/+12 * New port: localized messages and documentation for kofficelioux2003-05-205-0/+71 * upgrade to 0.5ijliao2003-05-095-16/+40 * Repo-move KDE I18N hebrew, hungarian, & vietnamese messages to theirwill2003-04-147-4/+13 * new port: Hebrew Type1 fontsedwin2003-04-146-0/+109 * typo USE_PERL -> USE_PERL5edwin2003-04-051-1/+1 * new port: Hebrew spellchecker and morphology engineedwin2003-04-027-0/+83 * Clear moonlight beckons.ade2003-03-074-2/+2 * De-pkg-comment.knu2003-02-216-3/+3 * Upgrade kde-i18n to 3.1. Note that the following modules did not get awill2003-01-294-36/+256 * 1. Removed comments from pkg-plist files per will's request.alane2002-10-114-4/+2 * Update to 3.0.3. Not much changed here: [1] i18n PKGNAMEs converted towill2002-08-254-8/+6 * 1. Changed the lib depends on gettext to a build depends. This will meanalane2002-08-032-4/+4 * Bump PORTREVISION. KDE is fragile enough in its dependencies; we don'talane2002-08-022-0/+2 * Chase shlib rev of devel/gettextade2002-08-022-2/+2 * Fix MASTER_SITE_SUBDIR.will2002-07-102-2/+2 * Update to 3.0.2 -- full log available in ports/x11/kde3/Makefile,v 1.51.will2002-07-056-12/+10 * Upgrade to KDE 3.0.1. The delay in this upgrade is mainly due to thewill2002-06-166-4/+12 * Please welcome Qt3/KDE3 to our ports tree. This includes work since thewill2002-04-2214-256/+732 * gettext upgrade uber-patch (stage 3)ade2002-04-132-2/+4 * Stage 1 of gettext update.ade2002-03-162-2/+2 * Update to 4.44.2.9pat2002-01-222-4/+5 * Add WWW.demon2001-12-282-0/+4 * Add he2 0.61, an editor for editing (primarily LaTeX) Hebrew files.will2001-12-259-0/+71 * Update to 2.2.2.demon2001-12-136-18/+32 * Update to 4.42.2.9pat2001-12-085-48/+29 * Upgrade to 2.2.1.demon2001-10-2712-52/+46 * Set DIST_SUBDIR=KDEdemon2001-09-114-2/+4 * MAINTAINER -> kde@FreeBSD.orgdemon2001-09-012-2/+2 * Fix installation in a slightly different way.demon2001-08-214-12/+16 * Remove two languages not presented in new version.demon2001-08-202-6/+2 * Forgot to remove debug comment.demon2001-08-162-2/+2 * Upgrade to 2.2.demon2001-08-1610-16/+62 * Remove Ukrainian from BATCH builds.demon2001-07-052-2/+2 * Exclude de, fr, ja, ru, zh_CN, zh_TW from bento's package.demon2001-04-172-2/+2 * Sort languages by name.demon2001-04-132-20/+20 * Examine LINGUAS variable before BATCH.demon2001-04-112-10/+10 * Allow to override MAINTAINER and CATEGORIES (in slave ports).demon2001-04-102-4/+4 * Add the ability to select which languages to install via dialog(1)-baseddemon2001-04-104-0/+174 * Update to 2.1.1demon2001-04-066-26/+4 * Overhaul QT/KDE support:will2001-04-032-4/+4 * New port: localized messages and documentation for KDE2.demon2001-03-0210-0/+76 * This is an updated of the hebrew/pine port to Pine 4.33, with Hebrew supportjeh2001-02-123-5/+5 * Update of the Hebrew version of pine to 4.30-2.09 (with the security bugkevlo2000-11-025-40/+46 * Bump PORTREVISION due to security fix.kris2000-10-301-0/+1 * Add a patch to address the known remote buffer overflow, fromkris2000-10-302-2/+14 * Change PKGDIR from pkg/ to . Also fix places where ${PKGDIR} isasami2000-10-081-1/+1 * Mark all of the pine3/4 ports FORBIDDEN due to remotely exploitablekris2000-09-291-0/+2 * Back out the previous commit. That one has a problem which occurs onknu2000-08-281-5/+1 * PKGNAMEPREFIX cleanup. This should allow chained PKGNAMEPREFIX'es.knu2000-08-271-1/+5 * Move pine in the right place -- addport isn't too intelligent atasami2000-08-101-1/+1 * Add pine with hebrew support.nbm2000-08-0226-0/+916 * According to iso639, 'iw' is used to represent the Hebrew language.nbm2000-08-021-0/+4 * Put the SUBDIR in the right place - addport isn't too intelligent atnbm2000-08-021-2/+1 * Add elmar-fonts, hebrew fonts for use with X.nbm2000-08-027-0/+106