Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Herrera <fherrera@onirica.com>2005-03-08 09:58:52 (GMT)
committer Fernando Herrera de las Heras <fherrera@src.gnome.org>2005-03-08 09:58:52 (GMT)
commit09aa3e2b90d20966010f76a7e5459f4581ef3247 (patch)
tree119bdd72c86511372ba005095c85e68e0e07a2f2
parent09b4b9d7e54c3ce7fd621bb1c80301749732caa6 (diff)
add -s option for thumbnail size.
2005-03-08 Fernando Herrera <fherrera@onirica.com> * thumbnailer/evince-thumbnailer.schemas: * thumbnailer/evince-thumbnailer.c: (evince_thumbnail_pngenc_get), (main): add -s option for thumbnail size.
-rw-r--r--ChangeLog6
-rw-r--r--thumbnailer/evince-thumbnailer.c31
-rw-r--r--thumbnailer/evince-thumbnailer.schemas2
3 files changed, 31 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index ca87fa2..d528cc4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-03-08 Fernando Herrera <fherrera@onirica.com>
+
+ * thumbnailer/evince-thumbnailer.schemas:
+ * thumbnailer/evince-thumbnailer.c: (evince_thumbnail_pngenc_get),
+ (main): add -s option for thumbnail size.
+
2005-03-07 Christian Persch <chpe@cvs.gnome.org>
* configure.ac:
diff --git a/thumbnailer/evince-thumbnailer.c b/thumbnailer/evince-thumbnailer.c
index d7db265..6794a69 100644
--- a/thumbnailer/evince-thumbnailer.c
+++ b/thumbnailer/evince-thumbnailer.c
@@ -31,7 +31,7 @@
#define THUMBNAIL_SIZE 128
static gboolean
-evince_thumbnail_pngenc_get (const char *uri, const char *thumbnail)
+evince_thumbnail_pngenc_get (const char *uri, const char *thumbnail, int size)
{
EvDocument *document = NULL;
char *mime_type;
@@ -57,7 +57,7 @@ evince_thumbnail_pngenc_get (const char *uri, const char *thumbnail)
}
pixbuf = ev_document_thumbnails_get_thumbnail
- (EV_DOCUMENT_THUMBNAILS (document), 0, THUMBNAIL_SIZE, FALSE);
+ (EV_DOCUMENT_THUMBNAILS (document), 0, size, FALSE);
if (pixbuf != NULL) {
GdkPixbuf *pdflogo;
@@ -97,19 +97,36 @@ int
main (int argc, char *argv[])
{
int res;
+ char *input, *output;
+ int size;
char *uri;
- if (argc != 3) {
- g_print ("%s: thumbnailer for Nautilus\n", argv[0]);
- g_print ("usage: %s <input-filename> <output-filename>\n", argv[0]);
+ if (argc <= 2 || argc > 5 || strcmp (argv[1], "-h") == 0 ||
+ strcmp (argv[1], "--help") == 0) {
+ g_print ("Usage: %s [-s <size>] <input> <output>\n", argv[0]);
return -1;
}
res = gnome_vfs_init ();
- uri = gnome_vfs_make_uri_from_shell_arg (argv[1]);
+ if (!strcmp (argv[1], "-s")) {
+ input = argv[3];
+ output = argv[4];
+ size = g_strtod (argv[2], NULL);
+ } else {
+ input = argv[1];
+ output = argv[2];
+ size = THUMBNAIL_SIZE;
+ }
+
+ if (size < 40) {
+ g_print ("Size cannot be smaller than 40 pixels\n");
+ return -1;
+ }
+
+ uri = gnome_vfs_make_uri_from_shell_arg (input);
- if (evince_thumbnail_pngenc_get (uri, argv[2])) {
+ if (evince_thumbnail_pngenc_get (uri, output, size)) {
g_free (uri);
return 0;
} else {
diff --git a/thumbnailer/evince-thumbnailer.schemas b/thumbnailer/evince-thumbnailer.schemas
index 2cc5f28..cf82b9d 100644
--- a/thumbnailer/evince-thumbnailer.schemas
+++ b/thumbnailer/evince-thumbnailer.schemas
@@ -19,7 +19,7 @@
<applyto>/desktop/gnome/thumbnailers/application@pdf/command</applyto>
<owner>evince</owner>
<type>string</type>
- <default>evince-thumbnailer %u %o</default>
+ <default>evince-thumbnailer -s %s %u %o</default>
<locale name="C">
<short></short>
<long></long>