gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r27341 - gnunet-gtk/src/fs


From: gnunet
Subject: [GNUnet-SVN] r27341 - gnunet-gtk/src/fs
Date: Thu, 30 May 2013 20:34:35 +0200

Author: grothoff
Date: 2013-05-30 20:34:35 +0200 (Thu, 30 May 2013)
New Revision: 27341

Modified:
   gnunet-gtk/src/fs/gnunet-fs-gtk.c
   gnunet-gtk/src/fs/gnunet-fs-gtk.h
   gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
Log:
-fixes, including grabbing FS handle as soon as possible

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk.c   2013-05-30 18:33:38 UTC (rev 27340)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk.c   2013-05-30 18:34:35 UTC (rev 27341)
@@ -101,6 +101,19 @@
 
 
 /**
+ * Remember FS handle if we don't have one yet.
+ *
+ * @param fsh file sharing handle to use
+ */
+void
+GNUNET_FS_GTK_set_fs_handle (struct GNUNET_FS_Handle *fsh)
+{
+  if (NULL == fs)
+    fs = fsh;
+}
+
+
+/**
  * Get our configuration.
  *
  * @return configuration handle

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk.h
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk.h   2013-05-30 18:33:38 UTC (rev 27340)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk.h   2013-05-30 18:34:35 UTC (rev 27341)
@@ -215,6 +215,14 @@
 
 
 /**
+ * Remember FS handle if we don't have one yet.
+ *
+ * @param fsh file sharing handle to use
+ */
+void
+GNUNET_FS_GTK_set_fs_handle (struct GNUNET_FS_Handle *fsh);
+
+/**
  * Get an object from the main window.
  *
  * @param name name of the object

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c     2013-05-30 18:33:38 UTC 
(rev 27340)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c     2013-05-30 18:34:35 UTC 
(rev 27341)
@@ -978,23 +978,33 @@
   void *cls;
 };
 
-/* Metadata callback. Checks metadata item for being an SKS URI,
+
+/**
+ * Metadata callback. Checks metadata item for being an SKS URI,
  * invokes the callback if so.
+ *
+ * @return GNUNET_OK if we did not invoke the callback, otherwise
+ *         whatever the callback returned
  */
 static int
-check_for_embedded_sks (void *cls, const char *plugin_name, enum 
EXTRACTOR_MetaType type,
-              enum EXTRACTOR_MetaFormat format, const char *data_mime_type,
-              const char *data, size_t data_size)
+check_for_embedded_sks (void *cls, 
+                       const char *plugin_name, 
+                       enum EXTRACTOR_MetaType type,
+                       enum EXTRACTOR_MetaFormat format,
+                       const char *data_mime_type,
+                       const char *data, size_t data_size)
 {
   struct sks_scanner_callback_context *ctx = cls;
   int result;
 
+  result = GNUNET_OK;
   if ((EXTRACTOR_METATYPE_URI == type) &&
       (EXTRACTOR_METAFORMAT_UTF8 == format) &&
       (data_mime_type && (0 == strcmp ("text/plain", data_mime_type))))
   {
     struct GNUNET_FS_Uri *sks_uri;
     char *emsg;
+
     emsg = NULL;
     sks_uri = GNUNET_FS_uri_parse (data, &emsg);
     if (NULL != sks_uri)
@@ -1018,16 +1028,23 @@
   return result;
 }
 
-/* Search metadata for SKS URIs, invoke the callback for each one. */
+
+/**
+ * Search metadata for SKS URIs, invoke the callback for each one. 
+ */
 static void
-find_embedded_sks (const struct GNUNET_CONTAINER_MetaData *meta, 
embedded_sks_callback cb, void *cls)
+find_embedded_sks (const struct GNUNET_CONTAINER_MetaData *meta, 
+                  embedded_sks_callback cb, void *cls)
 {
   struct sks_scanner_callback_context ctx;
+
   ctx.cb = cb;
   ctx.cls = cls;
-  GNUNET_CONTAINER_meta_data_iterate (meta, check_for_embedded_sks, &ctx);
+  GNUNET_CONTAINER_meta_data_iterate (meta, 
+                                     &check_for_embedded_sks, &ctx);
 }
 
+
 struct sks_population_context
 {
   GtkMenu *menu;
@@ -2143,11 +2160,16 @@
   gtk_tree_path_free (tp);
 }
 
+
 static int
-see_if_there_are_any_sks_uris (void *cls, const struct GNUNET_FS_Uri *sks_uri,
-    const char *sks_uri_string, struct GNUNET_FS_PseudonymIdentifier *nsid)
+see_if_there_are_any_sks_uris (void *cls,
+                              const struct GNUNET_FS_Uri *sks_uri,
+                              const char *sks_uri_string, 
+                              struct GNUNET_FS_PseudonymIdentifier *nsid)
 {
-  * ((gboolean *) cls) = TRUE;
+  gboolean *gb = cls;
+
+  *gb = TRUE;
   return GNUNET_SYSERR;
 }
 
@@ -2231,7 +2253,9 @@
   desc = GNUNET_FS_GTK_get_description_from_metadata (meta, &desc_is_a_dup);
   pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta);
 
-  find_embedded_sks (meta, see_if_there_are_any_sks_uris, 
&show_ns_association);
+  find_embedded_sks (meta, 
+                    &see_if_there_are_any_sks_uris,
+                    &show_ns_association);
 
   sr = GNUNET_new (struct SearchResult);
   sr->result = result;
@@ -3695,7 +3719,8 @@
                              const struct GNUNET_FS_ProgressInfo *info)
 {
   void *ret;
-
+  
+  GNUNET_FS_GTK_set_fs_handle (info->fsh);
   switch (info->status)
   {
   case GNUNET_FS_STATUS_PUBLISH_START:




reply via email to

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