Mercurial > octave-nkf
annotate scripts/miscellaneous/desktop.m @ 19630:0e1f5a750d00
maint: Periodic merge of gui-release to default.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 20 Jan 2015 10:24:46 -0500 |
parents | 0f9c5a15c8fa 446c46af4b42 |
children | 4197fc428c7d |
rev | line source |
---|---|
17294
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
1 ## Copyright (C) 2013 John W. Eaton |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
2 ## |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
3 ## This file is part of Octave. |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
4 ## |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
5 ## Octave is free software; you can redistribute it and/or modify it |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
6 ## under the terms of the GNU General Public License as published by |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
8 ## your option) any later version. |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
9 ## |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
10 ## Octave is distributed in the hope that it will be useful, but |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
13 ## General Public License for more details. |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
14 ## |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
15 ## You should have received a copy of the GNU General Public License |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
16 ## along with Octave; see the file COPYING. If not, see |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
17 ## <http://www.gnu.org/licenses/>. |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
18 |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
19 ## -*- texinfo -*- |
19186
0f9c5a15c8fa
doc: Periodic grammarcheck of documentation.
Rik <rik@octave.org>
parents:
17300
diff
changeset
|
20 ## @deftypefn {Function File} {@var{used} =} desktop ("-inuse") |
17294
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
21 ## Return true if the desktop (GUI) is currently in use. |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
22 ## @seealso{isguirunning} |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
23 ## @end deftypefn |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
24 |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
25 function retval = desktop (arg) |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
26 |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
27 if (nargin == 0) |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
28 if (isguirunning ()) |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
29 return; # desktop() is a NOP when GUI running |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
30 else |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
31 print_usage (); |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
32 endif |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
33 elseif (nargin > 1) |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
34 error ('desktop: only one argument, "-inuse", is allowed'); |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
35 endif |
19627
446c46af4b42
strip trailing whitespace from most source files
John W. Eaton <jwe@octave.org>
parents:
17300
diff
changeset
|
36 |
17294
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
37 switch (tolower (arg)) |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
38 case "-inuse" |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
39 retval = isguirunning (); |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
40 otherwise |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
41 print_usage (); |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
42 endswitch |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
43 |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
44 endfunction |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
45 |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
46 |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
47 ## Test input validation |
17300
d858e02f2a62
desktop.m: Fix failing %!error test.
Rik <rik@octave.org>
parents:
17294
diff
changeset
|
48 %!error <only one argument, "-inuse", is allowed> desktop (1,2) |
17294
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
49 %!error desktop ("-invalid_option") |
5ff843d739fc
Add new desktop.m function to Octave (bug #37330).
Rik <rik@octave.org>
parents:
diff
changeset
|
50 |