summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-09-07 21:52:34 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-09-07 21:52:34 +0200
commit7fb24accd94284e0e203f60443faab060b938e77 (patch)
tree7ed0390548d4e4a6442a49ab24bf2f53f26d0745
parentfa10ec2fa214d511889319a03d9f172f36c81926 (diff)
show current file name in window title
Submitted by Sydro.
l---------COPYING2
-rw-r--r--ChangeLog1
-rw-r--r--src/flpsed.cxx12
3 files changed, 13 insertions, 2 deletions
diff --git a/COPYING b/COPYING
index bb397a2..f6f4769 120000
--- a/COPYING
+++ b/COPYING
@@ -1 +1 @@
-/usr/pkg/share/automake-1.10/COPYING \ No newline at end of file
+/usr/pkg/share/automake-1.11/COPYING \ No newline at end of file
diff --git a/ChangeLog b/ChangeLog
index 1e1ddcc..d85ea90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ flpsed-0.5.3
* Fix warnings (reported by Kapil Hari Paranjape).
* Fix scroll_to_end() when scroll is higher than the document.
* NEWS -> ChangeLog.
+* Show current file name in the window title (by Sydro).
flpsed-0.5.2
* Add Ctrl-l (last page) and Ctrl-r (previous page) hotkeys. (by Paulo Jnkml)
diff --git a/src/flpsed.cxx b/src/flpsed.cxx
index f568255..2896874 100644
--- a/src/flpsed.cxx
+++ b/src/flpsed.cxx
@@ -34,6 +34,7 @@
PSEditor *psed_p = NULL;
Fl_Scroll *scroll = NULL;
Fl_Hold_Browser *page_sel = NULL;
+Fl_Window *win;
int xev_handler(int ev) {
if (psed_p)
@@ -132,6 +133,11 @@ void open_file(char *file) {
const char *args[5];
pid_t pid;
char *dot = strrchr(file, '.');
+ static const char *title_prefix = "flpsed - ";
+ int title_len = strlen(file) + strlen(title_prefix) + 1;
+ char *title = (char*) malloc(title_len);
+
+ snprintf(title, title_len, "%s%s", title_prefix, file);
if (dot && strcasecmp(dot, ".pdf") == 0) {
// assume pdf and try to import it using pdftops
@@ -153,6 +159,8 @@ void open_file(char *file) {
} else if (WEXITSTATUS(status) != 0) {
fl_message("PDF import failed\n");
}
+
+ win->copy_label(title);
} else {
perror("pexecvp");
}
@@ -160,8 +168,11 @@ void open_file(char *file) {
// assume postscript
psed_p->open_file(file);
psed_p->load();
+ win->copy_label(title);
}
+ free(title);
+
page_sel_fill();
}
@@ -482,7 +493,6 @@ int main(int argc, char** argv) {
char *sep, *tmp, **my_argv;
int c, err, bflag = 0, dflag = 0;
int i, n;
- Fl_Window *win;
Fl_Menu_Bar *m;
struct {char *tag; char *value;} tv[TV_LEN];
int tv_idx = 0, my_argc;