1 ## Copyright (C) 2006 Søren Hauberg
3 ## This program is free software; you can redistribute it and/or modify
4 ## it under the terms of the GNU General Public License as published by
5 ## the Free Software Foundation; either version 2 of the License, or
6 ## (at your option) any later version.
8 ## This program is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ## GNU General Public License for more details.
13 ## You should have received a copy of the GNU General Public License
14 ## along with this program; If not, see <http://www.gnu.org/licenses/>.
17 ## @deftypefn {Function File} @var{d} = zenity_calendar(@var{title}, @var{day}, @var{month}, @var{year})
18 ## Displays a date selection window.
19 ## The variable @var{title} sets the title of the calendar.
20 ## The optional arguments @var{day}, @var{month}, and @var{year} changes
21 ## the standard selected date.
23 ## @seealso{zenity_list, zenity_progress, zenity_entry, zenity_message,
24 ## zenity_text_info, zenity_file_selection, zenity_notification}
27 function d = zenity_calendar(title, day, month, year)
28 [Y, M, D] = datevec(date);
29 if (nargin < 1), title = "Select a date"; endif
30 if (nargin < 2), day = D; endif
31 if (nargin < 3), month = M; endif
32 if (nargin < 4), year = Y; endif
34 cmd = sprintf(['zenity --calendar --title="%s" --text="%s" ', ...
35 '--day=%d --month=%d --year=%d --date-format="%%m/%%d/%%Y"'],
36 title, title, day, month, year);
37 [status, output] = system(cmd);
39 if (length(output) > 0 && output(end) == "\n")
40 output = output(1:end-1);
46 error("zenity_calendar: %s", output);