gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r848 - in gnunet-gtk: . src


From: grothoff
Subject: [GNUnet-SVN] r848 - in gnunet-gtk: . src
Date: Fri, 3 Jun 2005 09:03:44 -0700 (PDT)

Author: grothoff
Date: 2005-06-03 09:03:33 -0700 (Fri, 03 Jun 2005)
New Revision: 848

Modified:
   gnunet-gtk/INSTALL
   gnunet-gtk/TODO
   gnunet-gtk/src/upload.c
Log:
implementing preview serialization

Modified: gnunet-gtk/INSTALL
===================================================================
--- gnunet-gtk/INSTALL  2005-06-03 15:05:41 UTC (rev 847)
+++ gnunet-gtk/INSTALL  2005-06-03 16:03:33 UTC (rev 848)
@@ -1,13 +1,16 @@
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
-Foundation, Inc.
+Installation Instructions
+*************************
 
-   This file is free documentation; the Free Software Foundation gives
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free
+Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
 unlimited permission to copy, distribute and modify it.
 
 Basic Installation
 ==================
 
-   These are generic installation instructions.
+These are generic installation instructions.
 
    The `configure' shell script attempts to guess correct values for
 various system-dependent variables used during compilation.  It uses
@@ -67,9 +70,9 @@
 Compilers and Options
 =====================
 
-   Some systems require unusual options for compilation or linking that
-the `configure' script does not know about.  Run `./configure --help'
-for details on some of the pertinent environment variables.
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about.  Run `./configure --help' for
+details on some of the pertinent environment variables.
 
    You can give `configure' initial values for configuration parameters
 by setting variables in the command line or in the environment.  Here
@@ -82,7 +85,7 @@
 Compiling For Multiple Architectures
 ====================================
 
-   You can compile the package for more than one kind of computer at the
+You can compile the package for more than one kind of computer at the
 same time, by placing the object files for each architecture in their
 own directory.  To do this, you must use a version of `make' that
 supports the `VPATH' variable, such as GNU `make'.  `cd' to the
@@ -99,19 +102,19 @@
 Installation Names
 ==================
 
-   By default, `make install' will install the package's files in
+By default, `make install' will install the package's files in
 `/usr/local/bin', `/usr/local/man', etc.  You can specify an
 installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
+option `--prefix=PREFIX'.
 
    You can specify separate installation prefixes for
 architecture-specific files and architecture-independent files.  If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
+give `configure' the option `--exec-prefix=PREFIX', the package will
+use PREFIX as the prefix for installing programs and libraries.
 Documentation and other data files will still use the regular prefix.
 
    In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
+options like `--bindir=DIR' to specify different values for particular
 kinds of files.  Run `configure --help' for a list of the directories
 you can set and what kinds of files go in them.
 
@@ -122,7 +125,7 @@
 Optional Features
 =================
 
-   Some packages pay attention to `--enable-FEATURE' options to
+Some packages pay attention to `--enable-FEATURE' options to
 `configure', where FEATURE indicates an optional part of the package.
 They may also pay attention to `--with-PACKAGE' options, where PACKAGE
 is something like `gnu-as' or `x' (for the X Window System).  The
@@ -137,11 +140,11 @@
 Specifying the System Type
 ==========================
 
-   There may be some features `configure' cannot figure out
-automatically, but needs to determine by the type of machine the package
-will run on.  Usually, assuming the package is built to be run on the
-_same_ architectures, `configure' can figure that out, but if it prints
-a message saying it cannot guess the machine type, give it the
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
 `--build=TYPE' option.  TYPE can either be a short name for the system
 type, such as `sun4', or a canonical name which has the form:
 
@@ -167,9 +170,9 @@
 Sharing Defaults
 ================
 
-   If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
 `configure' looks for `PREFIX/share/config.site' if it exists, then
 `PREFIX/etc/config.site' if it exists.  Or, you can set the
 `CONFIG_SITE' environment variable to the location of the site script.
@@ -178,7 +181,7 @@
 Defining Variables
 ==================
 
-   Variables not defined in a site shell script can be set in the
+Variables not defined in a site shell script can be set in the
 environment passed to `configure'.  However, some packages may run
 configure again during the build, and the customized values of these
 variables may be lost.  In order to avoid this problem, you should set
@@ -186,14 +189,18 @@
 
      ./configure CC=/usr/local2/bin/gcc
 
-will cause the specified gcc to be used as the C compiler (unless it is
-overridden in the site shell script).
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).  Here is a another example:
 
+     /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent
+configuration-related scripts to be executed by `/bin/bash'.
+
 `configure' Invocation
 ======================
 
-   `configure' recognizes the following options to control how it
-operates.
+`configure' recognizes the following options to control how it operates.
 
 `--help'
 `-h'

Modified: gnunet-gtk/TODO
===================================================================
--- gnunet-gtk/TODO     2005-06-03 15:05:41 UTC (rev 847)
+++ gnunet-gtk/TODO     2005-06-03 16:03:33 UTC (rev 848)
@@ -1,5 +1,4 @@
 High priority (for 0.7.0pre3):
-* upload: fix preview meta-data encoding
 * debug
 
 Important (for 0.7.0):

Modified: gnunet-gtk/src/upload.c
===================================================================
--- gnunet-gtk/src/upload.c     2005-06-03 15:05:41 UTC (rev 847)
+++ gnunet-gtk/src/upload.c     2005-06-03 16:03:33 UTC (rev 848)
@@ -274,8 +274,13 @@
     gtk_image_set_from_pixbuf(GTK_IMAGE(preview),
                              NULL);
   } else {
-    gtk_image_set_from_file(GTK_IMAGE(preview),
-                           fn);
+    GdkPixbuf * buf;
+
+    buf = gdk_pixbuf_new_from_file(fn,
+                                  NULL);
+    gtk_image_set_from_pixbuf(GTK_IMAGE(preview),
+                             buf);
+    g_object_unref(buf);
     free(fn);
   }
 }
@@ -485,9 +490,9 @@
                                     &thumb);
   ECRS_freeMetaData(meta);
   ECRS_freeUri(keywordURI);
+  preview = glade_xml_get_widget(metaXML,
+                                "previewImage");
   if (ts != 0) {
-    preview = glade_xml_get_widget(metaXML,
-                                  "previewImage");
     loader = gdk_pixbuf_loader_new();
     gdk_pixbuf_loader_write(loader,
                            (const guchar*) thumb,
@@ -498,6 +503,7 @@
                            NULL);    
     gtk_image_set_from_pixbuf(GTK_IMAGE(preview),
                              pixbuf);
+    g_object_unref(pixbuf);
   }
   if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_CANCEL) {
     int doIndex;
@@ -527,7 +533,65 @@
       } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(metamodel),
                                        &iter));
     }
-    /* FIXME: also add preview to meta! */
+    if (GTK_IMAGE_PIXBUF == 
+       gtk_image_get_storage_type(GTK_IMAGE(preview))) {
+      size_t length;
+      char * thumb;
+
+      pixbuf = gtk_image_get_pixbuf(GTK_IMAGE(preview));
+      if (pixbuf != NULL) {
+       thumb = NULL;
+       if (gdk_pixbuf_save_to_buffer(pixbuf,
+                                     &thumb,
+                                     &length,
+                                     "png",
+                                     NULL,
+                                     NULL)) {
+         char * binary;
+         size_t pos;
+         size_t end;
+         size_t wpos;
+         size_t i;
+         unsigned int markers[8]; /* 256 bits */
+         unsigned char marker;
+         
+         /* encode! */
+         binary = MALLOC(2 + length + (length+256) / 254);       
+         pos = 0;
+         wpos = 0;
+         while (pos < length) {
+           /* find unused value between 1 and 255 in
+              the next 254 bytes */
+           end = pos + 254;
+           if (end < pos)
+             break; /* integer overflow! */
+           if (end > length)
+             end = length;
+           memset(markers, 0, sizeof(markers));
+           for (i=pos;i<end;i++)
+             markers[thumb[i]&7] |= 1 << (thumb[i] >> 3);
+           marker = 1;
+           while (markers[marker&7] & (1 << (marker >> 3))) {
+             marker++;
+             GNUNET_ASSERT(marker != 0);
+           }
+         }
+         /* recode */
+         binary[wpos++] = marker;
+         for (i=pos;i<end;i++)
+           binary[wpos++] = thumb[i] == 0 ? marker : thumb[i];
+         pos = end;
+       
+         binary[wpos++] = 0; /* 0-termination! */
+         free(thumb);
+         ECRS_addToMetaData(meta,
+                            EXTRACTOR_THUMBNAIL_DATA,
+                            binary);
+         FREE(binary); 
+       }
+       g_object_unref(pixbuf);
+      }
+    }
     keywords = NULL;
     ksize = 0;
     GROW(keywords,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]