summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDennis Real <github@tildepipe.org>2012-02-26 19:08:22 +0100
committerDennis Real <github@tildepipe.org>2012-02-26 19:08:22 +0100
commitfc651e5eb5a7cce4f2df97eb8aee3d9ad34f9717 (patch)
treed920a9d3c789dc9856871fdc24e73990426075dd /src
parent458c5cfd464c84048c7e9027f6ef803d261742e3 (diff)
parent54deb9b8e21354a1670c179a7d8bd09e4e391026 (diff)
Merge remote branch 'upstream/master'
Conflicts: src/exif.c
Diffstat (limited to 'src')
-rw-r--r--src/exif.c2
-rw-r--r--src/feh.h1
-rw-r--r--src/list.c10
-rw-r--r--src/slideshow.c25
4 files changed, 27 insertions, 11 deletions
diff --git a/src/exif.c b/src/exif.c
index 19b75f4..dcf2a88 100644
--- a/src/exif.c
+++ b/src/exif.c
@@ -230,7 +230,7 @@ void exif_get_info(ExifData * ed, char *buffer, unsigned int maxsize)
exif_get_mnote_tag(ed, 132, buffer + strlen(buffer), maxsize - strlen(buffer));
/* Digital Vari-Program */
exif_get_mnote_tag(ed, 171, buffer + strlen(buffer), maxsize - strlen(buffer));
-
+
}
}
diff --git a/src/feh.h b/src/feh.h
index 6719963..996de84 100644
--- a/src/feh.h
+++ b/src/feh.h
@@ -137,6 +137,7 @@ void init_keyevents(void);
void init_buttonbindings(void);
void feh_event_handle_keypress(XEvent * ev);
void feh_action_run(feh_file * file, char *action);
+char *format_size(int size);
char *feh_printf(char *str, feh_file * file);
void im_weprintf(winwidget w, char *fmt, ...);
void feh_draw_zoom(winwidget w);
diff --git a/src/list.c b/src/list.c
index e052c05..3317da7 100644
--- a/src/list.c
+++ b/src/list.c
@@ -37,7 +37,7 @@ void init_list_mode(void)
mode = "list";
if (!opt.customlist)
- fputs("NUM\tFORMAT\tWIDTH\tHEIGHT\tPIXELS\tSIZE(bytes)\tALPHA\tFILENAME\n",
+ fputs("NUM\tFORMAT\tWIDTH\tHEIGHT\tPIXELS\tSIZE\tALPHA\tFILENAME\n",
stdout);
for (l = filelist; l; l = l->next) {
@@ -45,10 +45,12 @@ void init_list_mode(void)
if (opt.customlist)
printf("%s\n", feh_printf(opt.customlist, file));
else
- printf("%d\t%s\t%d\t%d\t%d\t%d\t\t%c\t%s\n", ++j,
+ printf("%d\t%s\t%d\t%d\t%s", ++j,
file->info->format, file->info->width,
- file->info->height, file->info->pixels,
- file->info->size,
+ file->info->height,
+ format_size(file->info->pixels));
+ printf("\t%s\t%c\t%s\n",
+ format_size(file->info->size),
file->info->has_alpha ? 'X' : '-', file->filename);
feh_action_run(file, opt.actions[0]);
diff --git a/src/slideshow.c b/src/slideshow.c
index 189357d..a65d95e 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -404,6 +404,19 @@ char *shell_escape(char *input)
return ret;
}
+char *format_size(int size)
+{
+ static char ret[5];
+ char units[] = {' ', 'k', 'M', 'G', 'T'};
+ unsigned char postfix = 0;
+ while (size >= 1000) {
+ size /= 1000;
+ postfix++;
+ }
+ snprintf(ret, 5, "%3d%c", size, units[postfix]);
+ return ret;
+}
+
char *feh_printf(char *str, feh_file * file)
{
char *c;
@@ -452,9 +465,7 @@ char *feh_printf(char *str, feh_file * file)
break;
case 'S':
if (file && (file->info || !feh_file_info_load(file, NULL))) {
- snprintf(buf, sizeof(buf),
- "%.2fkB", ((double)file->info->size / 1000));
- strcat(ret, buf);
+ strcat(ret, format_size(file->info->size));
}
break;
case 'p':
@@ -463,14 +474,16 @@ char *feh_printf(char *str, feh_file * file)
strcat(ret, buf);
}
break;
+ case 'P':
+ if (file && (file->info || !feh_file_info_load(file, NULL))) {
+ strcat(ret, format_size(file->info->pixels));
+ }
+ break;
case 't':
if (file && (file->info || !feh_file_info_load(file, NULL))) {
strcat(ret, file->info->format);
}
break;
- case 'P':
- strcat(ret, PACKAGE);
- break;
case 'v':
strcat(ret, VERSION);
break;