Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nccf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
702
Provoz
nccf
Commits
e96cc36d
Commit
e96cc36d
authored
9 years ago
by
piyo
Browse files
Options
Downloads
Patches
Plain Diff
Confirm quit action with a cancellable dialog.
parent
682add5e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
Makefile.am
+2
-0
2 additions, 0 deletions
Makefile.am
src/browser.c
+1
-1
1 addition, 1 deletion
src/browser.c
src/global.h
+2
-0
2 additions, 0 deletions
src/global.h
src/main.c
+2
-0
2 additions, 0 deletions
src/main.c
src/quit.c
+55
-0
55 additions, 0 deletions
src/quit.c
src/quit.h
+37
-0
37 additions, 0 deletions
src/quit.h
with
99 additions
and
1 deletion
Makefile.am
+
2
−
0
View file @
e96cc36d
...
...
@@ -13,6 +13,7 @@ ncdu_SOURCES=\
src/exclude.c
\
src/help.c
\
src/shell.c
\
src/quit.c
\
src/main.c
\
src/path.c
\
src/util.c
...
...
@@ -28,6 +29,7 @@ noinst_HEADERS=\
src/global.h
\
src/help.h
\
src/shell.h
\
src/quit.h
\
src/path.h
\
src/util.h
...
...
This diff is collapsed.
Click to expand it.
src/browser.c
+
1
−
1
View file @
e96cc36d
...
...
@@ -397,7 +397,7 @@ int browse_key(int ch) {
if
(
info_show
)
info_show
=
0
;
else
return
1
;
quit_init
()
;
break
;
case
'g'
:
if
(
++
graph
>
3
)
...
...
This diff is collapsed.
Click to expand it.
src/global.h
+
2
−
0
View file @
e96cc36d
...
...
@@ -56,6 +56,7 @@
#define ST_DEL 2
#define ST_HELP 3
#define ST_SHELL 4
#define ST_QUIT 5
/* structure representing a file or directory */
...
...
@@ -104,5 +105,6 @@ int input_handle(int);
#include
"path.h"
#include
"util.h"
#include
"shell.h"
#include
"quit.h"
#endif
This diff is collapsed.
Click to expand it.
src/main.c
+
2
−
0
View file @
e96cc36d
...
...
@@ -54,6 +54,7 @@ static void screen_draw() {
case
ST_HELP
:
help_draw
();
break
;
case
ST_SHELL
:
shell_draw
();
break
;
case
ST_DEL
:
delete_draw
();
break
;
case
ST_QUIT
:
quit_draw
();
break
;
}
}
...
...
@@ -97,6 +98,7 @@ int input_handle(int wait) {
case
ST_BROWSE
:
return
browse_key
(
ch
);
case
ST_HELP
:
return
help_key
(
ch
);
case
ST_DEL
:
return
delete_key
(
ch
);
case
ST_QUIT
:
return
quit_key
(
ch
);
}
screen_draw
();
}
...
...
This diff is collapsed.
Click to expand it.
src/quit.c
0 → 100644
+
55
−
0
View file @
e96cc36d
/* ncdu - NCurses Disk Usage
Copyright (c) 2015 Yoran Heling
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include
"global.h"
#include
<ncurses.h>
/* extern? */
int
page
,
start
;
int
quit_key
(
int
ch
)
{
switch
(
ch
)
{
case
'y'
:
case
'Y'
:
return
1
;
break
;
default:
pstate
=
ST_BROWSE
;
}
return
0
;
}
void
quit_draw
()
{
browse_draw
();
nccreate
(
4
,
30
,
"ncdu confirm quit"
);
ncaddstr
(
2
,
2
,
"Really quit? (y/N)"
);
}
void
quit_init
()
{
page
=
1
;
start
=
0
;
pstate
=
ST_QUIT
;
}
This diff is collapsed.
Click to expand it.
src/quit.h
0 → 100644
+
37
−
0
View file @
e96cc36d
/* ncdu - NCurses Disk Usage
Copyright (c) 2015 Yoran Heling
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef _quit_h
#define _quit_h
#include
"global.h"
int
quit_key
(
int
);
void
quit_draw
(
void
);
void
quit_init
(
void
);
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment