gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r16865 - in gnunet-gtk: contrib src/fs src/include src/lib


From: gnunet
Subject: [GNUnet-SVN] r16865 - in gnunet-gtk: contrib src/fs src/include src/lib src/peerinfo src/setup
Date: Thu, 15 Sep 2011 15:18:57 +0200

Author: grothoff
Date: 2011-09-15 15:18:57 +0200 (Thu, 15 Sep 2011)
New Revision: 16865

Added:
   gnunet-gtk/contrib/removetrailingwhitespace
Modified:
   gnunet-gtk/src/fs/gnunet-fs-gtk-anonymity_spin_buttons.c
   gnunet-gtk/src/fs/gnunet-fs-gtk-common.c
   gnunet-gtk/src/fs/gnunet-fs-gtk-common.h
   gnunet-gtk/src/fs/gnunet-fs-gtk-download.h
   gnunet-gtk/src/fs/gnunet-fs-gtk-edit_publish_dialog.c
   gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c
   gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.h
   gnunet-gtk/src/fs/gnunet-fs-gtk-main_window_file_publish.c
   gnunet-gtk/src/include/gnunet_gtk.h
   gnunet-gtk/src/lib/eventloop.c
   gnunet-gtk/src/lib/glade.c
   gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk-about.c
   gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk-flags.c
   gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk-flags.h
   gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
   gnunet-gtk/src/setup/gnunet-setup-options.c
   gnunet-gtk/src/setup/gnunet-setup-options.h
   gnunet-gtk/src/setup/gnunet-setup.c
Log:
trying to clean up shutdown

Added: gnunet-gtk/contrib/removetrailingwhitespace
===================================================================
--- gnunet-gtk/contrib/removetrailingwhitespace                         (rev 0)
+++ gnunet-gtk/contrib/removetrailingwhitespace 2011-09-15 13:18:57 UTC (rev 
16865)
@@ -0,0 +1,14 @@
+#!/usr/bin/python
+
+import sys
+import re
+
+for fileName in sys.argv[1:]:
+   f = open(fileName, 'r+')
+   fileString = f.read()
+
+   fileString = re.sub(r'[ ]+\n', r'\n', fileString)
+   fileString = re.sub(r'\r', r'', fileString)
+   f.seek(0)
+   f.write(fileString)
+   f.truncate(len(fileString))


Property changes on: gnunet-gtk/contrib/removetrailingwhitespace
___________________________________________________________________
Added: svn:executable
   + *

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-anonymity_spin_buttons.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-anonymity_spin_buttons.c    2011-09-15 
12:54:56 UTC (rev 16864)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-anonymity_spin_buttons.c    2011-09-15 
13:18:57 UTC (rev 16865)
@@ -47,10 +47,10 @@
     return;
   }
   val = gtk_spin_button_get_value_as_int (spin);
-  if (val == 0) 
+  if (val == 0)
   {
     if ((TRUE == gdk_rgba_parse (&bcolor, "red")) &&
-        (TRUE == gdk_rgba_parse (&fcolor, "black")) )
+        (TRUE == gdk_rgba_parse (&fcolor, "black")))
     {
       gtk_widget_override_background_color (w, GTK_STATE_NORMAL, &bcolor);
       gtk_widget_override_color (w, GTK_STATE_NORMAL, &fcolor);

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-common.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-common.c    2011-09-15 12:54:56 UTC (rev 
16864)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-common.c    2011-09-15 13:18:57 UTC (rev 
16865)
@@ -34,7 +34,7 @@
  *        used in the main libextractor library and yielding
  *        meta data).
  * @param type libextractor-type describing the meta data
- * @param format basic format information about data 
+ * @param format basic format information about data
  * @param data_mime_type mime-type of data (not of the original file);
  *        can be NULL (if mime-type is not known)
  * @param data actual meta-data found

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-common.h
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-common.h    2011-09-15 12:54:56 UTC (rev 
16864)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-common.h    2011-09-15 13:18:57 UTC (rev 
16865)
@@ -87,7 +87,7 @@
  *        used in the main libextractor library and yielding
  *        meta data).
  * @param type libextractor-type describing the meta data
- * @param format basic format information about data 
+ * @param format basic format information about data
  * @param data_mime_type mime-type of data (not of the original file);
  *        can be NULL (if mime-type is not known)
  * @param data actual meta-data found

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-download.h
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-download.h  2011-09-15 12:54:56 UTC (rev 
16864)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-download.h  2011-09-15 13:18:57 UTC (rev 
16865)
@@ -54,7 +54,7 @@
   char *filename;
 
   /**
-   * Row reference (if URI was found by search, or 
+   * Row reference (if URI was found by search, or
    * part of directory, etc.); otherwise NULL (download by URI).
    */
   GtkTreeRowReference *rr;

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-edit_publish_dialog.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-edit_publish_dialog.c       2011-09-15 
12:54:56 UTC (rev 16864)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-edit_publish_dialog.c       2011-09-15 
13:18:57 UTC (rev 16865)
@@ -336,7 +336,7 @@
  *        used in the main libextractor library and yielding
  *        meta data).
  * @param type libextractor-type describing the meta data
- * @param format basic format information about data 
+ * @param format basic format information about data
  * @param data_mime_type mime-type of data (not of the original file);
  *        can be NULL (if mime-type is not known)
  * @param data actual meta-data found
@@ -455,7 +455,7 @@
  *        used in the main libextractor library and yielding
  *        meta data).
  * @param type libextractor-type describing the meta data
- * @param format basic format information about data 
+ * @param format basic format information about data
  * @param data_mime_type mime-type of data (not of the original file);
  *        can be NULL (if mime-type is not known)
  * @param data actual meta-data found

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c     2011-09-15 12:54:56 UTC 
(rev 16864)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.c     2011-09-15 13:18:57 UTC 
(rev 16865)
@@ -451,7 +451,7 @@
 
 
 /**
- * Handle the case where an active download lost its 
+ * Handle the case where an active download lost its
  * search parent by moving it to the URI tab.
  */
 static struct DownloadEntry *
@@ -748,8 +748,8 @@
        * - view full meta data (in new window)
        * - copy URI to clipboard
        * - start recursive download
-       * - abort active download (!) 
-       * => need to know download status before creating menu! 
+       * - abort active download (!)
+       * => need to know download status before creating menu!
        */
       menu = GTK_MENU (gtk_menu_new ());
       if (sr->download == NULL)
@@ -977,7 +977,7 @@
  * Stop completed downloads (or those that failed).  Should
  * iterate over the underlying tree store and stop all
  * completed entries.  Furthermore, if the resulting tree
- * store is empty and has no search associated with it, 
+ * store is empty and has no search associated with it,
  * the tab should be closed.
  */
 static void
@@ -1331,7 +1331,7 @@
  * the URI tab first.
  *
  * @param iter set to the new entry
- * @param srp set to search result 
+ * @param srp set to search result
  * @param meta metadata for the new entry
  * @param uri URI for the new entry
  * @return NULL on error, otherwise tree store matching iter
@@ -1493,11 +1493,11 @@
   tm = gtk_tree_row_reference_get_model (sr->rr);
   GNUNET_assert (tm != NULL);
   if (TRUE != gtk_tree_model_get_iter (tm, &iter, tp))
-    {
-      GNUNET_break (0);
-      gtk_tree_path_free (tp);
-      return;
-    }
+  {
+    GNUNET_break (0);
+    gtk_tree_path_free (tp);
+    return;
+  }
   gtk_tree_path_free (tp);
   gtk_tree_model_get (tm, &iter, 0, &meta, 1, &uri, -1);
   if (uri != NULL)
@@ -1621,9 +1621,9 @@
 
 
 /**
- * Notification of FS to a client about the progress of an 
+ * Notification of FS to a client about the progress of an
  * operation.  Callbacks of this type will be used for uploads,
- * downloads and searches.  Some of the arguments depend a bit 
+ * downloads and searches.  Some of the arguments depend a bit
  * in their meaning on the context in which the callback is used.
  *
  * @param cls closure

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.h
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.h     2011-09-15 12:54:56 UTC 
(rev 16864)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-event_handler.h     2011-09-15 13:18:57 UTC 
(rev 16865)
@@ -141,7 +141,7 @@
  * the URI tab first.
  *
  * @param iter set to the new entry
- * @param srp set to search result 
+ * @param srp set to search result
  * @param meta metadata for the new entry
  * @param uri URI for the new entry
  * @return NULL on error, otherwise search tab with the new entry
@@ -175,9 +175,9 @@
 
 
 /**
- * Notification of FS to a client about the progress of an 
+ * Notification of FS to a client about the progress of an
  * operation.  Callbacks of this type will be used for uploads,
- * downloads and searches.  Some of the arguments depend a bit 
+ * downloads and searches.  Some of the arguments depend a bit
  * in their meaning on the context in which the callback is used.
  *
  * @param cls closure

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-main_window_file_publish.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-main_window_file_publish.c  2011-09-15 
12:54:56 UTC (rev 16864)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-main_window_file_publish.c  2011-09-15 
13:18:57 UTC (rev 16865)
@@ -437,7 +437,7 @@
  *        used in the main libextractor library and yielding
  *        meta data).
  * @param type libextractor-type describing the meta data
- * @param format basic format information about data 
+ * @param format basic format information about data
  * @param data_mime_type mime-type of data (not of the original file);
  *        can be NULL (if mime-type is not known)
  * @param data actual meta-data found
@@ -670,7 +670,7 @@
   struct GNUNET_CONTAINER_MetaData *md;
 
   /**
-   * How often does a keyword have to occur to be 
+   * How often does a keyword have to occur to be
    * migrated to the parent?
    */
   unsigned int threshold;
@@ -704,7 +704,7 @@
  * Go over the collected meta data from all entries in the
  * directory and push common meta data up one level (by
  * adding it to the returned struct).
- * 
+ *
  * @param adc collection of child meta data
  * @return meta data to moved to parent
  */

Modified: gnunet-gtk/src/include/gnunet_gtk.h
===================================================================
--- gnunet-gtk/src/include/gnunet_gtk.h 2011-09-15 12:54:56 UTC (rev 16864)
+++ gnunet-gtk/src/include/gnunet_gtk.h 2011-09-15 13:18:57 UTC (rev 16865)
@@ -59,7 +59,7 @@
 /**
  * Get the name of the directory where all of our package
  * data is stored ($PREFIX/share/)
- * 
+ *
  * @return name of the data directory
  */
 const char *

Modified: gnunet-gtk/src/lib/eventloop.c
===================================================================
--- gnunet-gtk/src/lib/eventloop.c      2011-09-15 12:54:56 UTC (rev 16864)
+++ gnunet-gtk/src/lib/eventloop.c      2011-09-15 13:18:57 UTC (rev 16865)
@@ -27,11 +27,11 @@
 
 #define DEBUG_EVENTLOOP GNUNET_NO
 
-/** 
+/**
  * Initial size of our poll array cache.
  *
  * TODO: get some statistics, find the maximum number of fds ever
- * polled during normal gnunet-gtk operation, and set this to that number. 
+ * polled during normal gnunet-gtk operation, and set this to that number.
  */
 #define INITIAL_POLL_ARRAY_SIZE 30
 
@@ -178,8 +178,12 @@
 GNUNET_GTK_main_loop_quit (struct GNUNET_GTK_MainLoop *ml)
 {
   g_main_loop_quit (ml->gml);
-  GNUNET_SCHEDULER_cancel (ml->dummy_task);
-  ml->dummy_task = GNUNET_SCHEDULER_NO_TASK;
+  ml->gml = NULL;
+  if (GNUNET_SCHEDULER_NO_TASK != ml->dummy_task)
+  {
+    GNUNET_SCHEDULER_cancel (ml->dummy_task);
+    ml->dummy_task = GNUNET_SCHEDULER_NO_TASK;
+  }
 }
 
 
@@ -546,18 +550,20 @@
 #endif
 
   /* combine with Gtk events */
-  g_main_context_prepare (ml->gmc, &max_priority);
-  while (1)
+  if (NULL != ml->gmc)
   {
-    need_gfds =
-        g_main_context_query (ml->gmc, max_priority, &delay,
-                              &ml->cached_poll_array[fd_counter],
-                              ml->cached_poll_array_size - fd_counter);
-    if (ml->cached_poll_array_size >= need_gfds + fd_counter)
-      break;
-    resize_cached_poll_array (ml, fd_counter + need_gfds);
+    g_main_context_prepare (ml->gmc, &max_priority);
+    while (1)
+    {
+      need_gfds =
+          g_main_context_query (ml->gmc, max_priority, &delay,
+                                &ml->cached_poll_array[fd_counter],
+                                ml->cached_poll_array_size - fd_counter);
+      if (ml->cached_poll_array_size >= need_gfds + fd_counter)
+        break;
+      resize_cached_poll_array (ml, fd_counter + need_gfds);
+    }
   }
-
   if (timeout.rel_value != GNUNET_TIME_UNIT_FOREVER_REL.rel_value)
   {
     if (delay >= 0)
@@ -597,12 +603,14 @@
    * from within a task (currently we're not in a task, but in a select() 
call, remember)
    * Startup reason is used to pass the scheduler sanity check.
    */
-  if (TRUE ==
-      g_main_context_check (ml->gmc, max_priority,
-                            &ml->cached_poll_array[fd_counter], need_gfds))
-    GNUNET_SCHEDULER_add_continuation (&dispatch_gtk_task, ml,
-                                       GNUNET_SCHEDULER_REASON_STARTUP);
-
+  if (NULL != ml->gmc)
+  {
+    if (TRUE ==
+        g_main_context_check (ml->gmc, max_priority,
+                              &ml->cached_poll_array[fd_counter], need_gfds))
+      GNUNET_SCHEDULER_add_continuation (&dispatch_gtk_task, ml,
+                                         GNUNET_SCHEDULER_REASON_STARTUP);
+  }
   /* Now map back GNUnet scheduler events ... */
 #if !WINDOWS
   if (NULL != rfds)

Modified: gnunet-gtk/src/lib/glade.c
===================================================================
--- gnunet-gtk/src/lib/glade.c  2011-09-15 12:54:56 UTC (rev 16864)
+++ gnunet-gtk/src/lib/glade.c  2011-09-15 13:18:57 UTC (rev 16865)
@@ -44,7 +44,7 @@
 /**
  * Get the name of the directory where all of our package
  * data is stored ($PREFIX/share/)
- * 
+ *
  * @return name of the data directory
  */
 const char *

Modified: gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk-about.c
===================================================================
--- gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk-about.c 2011-09-15 12:54:56 UTC 
(rev 16864)
+++ gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk-about.c 2011-09-15 13:18:57 UTC 
(rev 16865)
@@ -32,7 +32,8 @@
  * This displays an about window
  */
 void
-GNUNET_PEERINFO_GTK_main_menu_help_about_activate_cb (GtkWidget * dummy, 
gpointer data)
+GNUNET_PEERINFO_GTK_main_menu_help_about_activate_cb (GtkWidget * dummy,
+                                                      gpointer data)
 {
   GNUNET_GTK_display_about ("gnunet_peerinfo_gtk_about_dialog.glade",
                             "GNUNET_PEERINFO_GTK_about_dialog");

Modified: gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk-flags.c
===================================================================
--- gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk-flags.c 2011-09-15 12:54:56 UTC 
(rev 16864)
+++ gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk-flags.c 2011-09-15 13:18:57 UTC 
(rev 16865)
@@ -81,10 +81,8 @@
 
   if (NULL == cc)
     return NULL;
-  if ((0 == strcasecmp (cc, "edu")) ||
-      (0 == strcasecmp (cc, "com")) ||
-      (0 == strcasecmp (cc, "net")) ||
-      (0 == strcasecmp (cc, "org")) ||
+  if ((0 == strcasecmp (cc, "edu")) || (0 == strcasecmp (cc, "com")) ||
+      (0 == strcasecmp (cc, "net")) || (0 == strcasecmp (cc, "org")) ||
       (0 == strcasecmp (cc, "gov")) || (0 == strcasecmp (cc, "mil")))
     cc = "us";
   if (0 == strcasecmp (cc, "uk"))
@@ -93,51 +91,43 @@
     return NULL;
   pos = flags_head;
   while (pos != NULL)
-    {
-      if (0 == strcmp (pos->cc, cc))
-       return pos->flag;
-      pos = pos->next;
-    }
+  {
+    if (0 == strcmp (pos->cc, cc))
+      return pos->flag;
+    pos = pos->next;
+  }
   mcc = GNUNET_strdup (cc);
   for (i = 0; i < strlen (mcc); i++)
     mcc[i] = tolower (mcc[i]);
   dir = GNUNET_GTK_installation_get_path (GNUNET_OS_IPK_DATADIR);
-  GNUNET_asprintf (&fn,
-                  "%sgnunet-gtk%sflags%s%s.png",
-                  dir,
-                  DIR_SEPARATOR_STR,
-                  DIR_SEPARATOR_STR,
-                  mcc);
+  GNUNET_asprintf (&fn, "%sgnunet-gtk%sflags%s%s.png", dir, DIR_SEPARATOR_STR,
+                   DIR_SEPARATOR_STR, mcc);
   GNUNET_free (dir);
   flagBuf = gdk_pixbuf_new_from_file (fn, NULL);
   pos = GNUNET_malloc (sizeof (struct Flag));
   pos->cc = mcc;
   pos->flag = flagBuf;
-  GNUNET_CONTAINER_DLL_insert (flags_head,
-                              flags_tail,
-                              pos);
+  GNUNET_CONTAINER_DLL_insert (flags_head, flags_tail, pos);
   return flagBuf;
 }
 
 
 /**
  * Deallocate all cached flags.
- */ 
+ */
 void
 GNUNET_PEERINFO_GTK_flags_shutdown ()
 {
   struct Flag *flag;
 
   while (NULL != (flag = flags_head))
-    {
-      GNUNET_CONTAINER_DLL_remove (flags_head,
-                                  flags_tail,
-                                  flag);
-      if (flag->flag != NULL)
-        g_object_unref (flag->flag);
-      GNUNET_free (flag->cc);
-      GNUNET_free (flag);
-    }
+  {
+    GNUNET_CONTAINER_DLL_remove (flags_head, flags_tail, flag);
+    if (flag->flag != NULL)
+      g_object_unref (flag->flag);
+    GNUNET_free (flag->cc);
+    GNUNET_free (flag);
+  }
 }
 
 

Modified: gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk-flags.h
===================================================================
--- gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk-flags.h 2011-09-15 12:54:56 UTC 
(rev 16864)
+++ gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk-flags.h 2011-09-15 13:18:57 UTC 
(rev 16865)
@@ -42,7 +42,7 @@
 
 /**
  * Deallocate all cached flags.
- */ 
+ */
 void
 GNUNET_PEERINFO_GTK_flags_shutdown (void);
 

Modified: gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c
===================================================================
--- gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c       2011-09-15 12:54:56 UTC 
(rev 16864)
+++ gnunet-gtk/src/peerinfo/gnunet-peerinfo-gtk.c       2011-09-15 13:18:57 UTC 
(rev 16865)
@@ -54,7 +54,7 @@
    * Total number of addresses found.
    */
   guint palc_counter;
-  
+
 };
 
 
@@ -108,7 +108,7 @@
 
 
 /**
- * Function called on each entry in the 'peer2info' map 
+ * Function called on each entry in the 'peer2info' map
  * to free the associated path.
  *
  * @param cls unused
@@ -117,19 +117,17 @@
  * @return GNUNET_OK (continue to iterate)
  */
 static int
-free_paths (void *cls,
-           const GNUNET_HashCode *key,
-           void *value)
+free_paths (void *cls, const GNUNET_HashCode * key, void *value)
 {
   struct PeerInfo *info = value;
 
   if (NULL != info->palc)
-    {
-      GNUNET_TRANSPORT_peer_address_lookup_cancel (info->palc);
-      info->palc = NULL;
-      GNUNET_free (info->palc_accumulator);
-      info->palc_accumulator = NULL;
-    }
+  {
+    GNUNET_TRANSPORT_peer_address_lookup_cancel (info->palc);
+    info->palc = NULL;
+    GNUNET_free (info->palc_accumulator);
+    info->palc_accumulator = NULL;
+  }
   gtk_tree_row_reference_free (info->rr);
   GNUNET_free (info);
   return GNUNET_OK;
@@ -143,8 +141,7 @@
  * @param tc scheduler context, unused
  */
 static void
-shutdown_task (void *cls, 
-              const struct GNUNET_SCHEDULER_TaskContext *tc)
+shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   GNUNET_PEERINFO_notify_cancel (pnc);
   pnc = NULL;
@@ -153,9 +150,7 @@
     GNUNET_CORE_disconnect (core);
     core = NULL;
   }
-  GNUNET_CONTAINER_multihashmap_iterate (peer2info,
-                                        &free_paths,
-                                        NULL);
+  GNUNET_CONTAINER_multihashmap_iterate (peer2info, &free_paths, NULL);
   GNUNET_CONTAINER_multihashmap_destroy (peer2info);
   peer2info = NULL;
   GNUNET_PEERINFO_GTK_flags_shutdown ();
@@ -169,8 +164,7 @@
  * @param address NULL on error, otherwise 0-terminated printable UTF-8 string
  */
 static void
-peer_address_cb (void *cls,
-                const char *address)
+peer_address_cb (void *cls, const char *address)
 {
   struct PeerInfo *info = cls;
   char *tmp;
@@ -183,41 +177,34 @@
   char *country;
 
   if (NULL == address)
+  {
+    /* last address, store information in model */
+    country = NULL;
+    colon = strstr (info->palc_accumulator, ":");
+    if (NULL != colon)
     {
-      /* last address, store information in model */
-      country = NULL;      
-      colon = strstr (info->palc_accumulator, ":");
-      if (NULL != colon)
-       {
-         for (dot = colon - 1; dot != info->palc_accumulator; dot--)
-           if ('.' == *dot)
-             break;
-         if ('.' == *dot)
-           country = GNUNET_strndup (&dot[1], (colon - dot) - 1);
-       }
-      ls = GTK_LIST_STORE (get_object ("GNUNET_PEERINFO_GTK_list_store"));
-      tm = GTK_TREE_MODEL (ls);
-      path = gtk_tree_row_reference_get_path (info->rr);
-      GNUNET_assert (NULL != path);
-      GNUNET_assert (TRUE ==
-                    gtk_tree_model_get_iter (tm, &iter, path));
-      gtk_tree_path_free (path);
-      gtk_list_store_set (ls, &iter, 
-                         1, info->palc_counter,
-                         2, country,
-                         3, GNUNET_PEERINFO_GTK_get_flag (country),
-                         6, &info->palc_accumulator[1],
-                         -1);      
-      GNUNET_free_non_null (country);
-      info->palc = NULL;
-      GNUNET_free (info->palc_accumulator);
-      info->palc_accumulator = NULL;
-      return;
+      for (dot = colon - 1; dot != info->palc_accumulator; dot--)
+        if ('.' == *dot)
+          break;
+      if ('.' == *dot)
+        country = GNUNET_strndup (&dot[1], (colon - dot) - 1);
     }
-  GNUNET_asprintf (&tmp,
-                  "%s|%s",
-                  info->palc_accumulator,
-                  address);
+    ls = GTK_LIST_STORE (get_object ("GNUNET_PEERINFO_GTK_list_store"));
+    tm = GTK_TREE_MODEL (ls);
+    path = gtk_tree_row_reference_get_path (info->rr);
+    GNUNET_assert (NULL != path);
+    GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, &iter, path));
+    gtk_tree_path_free (path);
+    gtk_list_store_set (ls, &iter, 1, info->palc_counter, 2, country, 3,
+                        GNUNET_PEERINFO_GTK_get_flag (country), 6,
+                        &info->palc_accumulator[1], -1);
+    GNUNET_free_non_null (country);
+    info->palc = NULL;
+    GNUNET_free (info->palc_accumulator);
+    info->palc_accumulator = NULL;
+    return;
+  }
+  GNUNET_asprintf (&tmp, "%s|%s", info->palc_accumulator, address);
   GNUNET_free (info->palc_accumulator);
   info->palc_accumulator = tmp;
   info->palc_counter++;
@@ -233,10 +220,9 @@
  * @param err_msg NULL if successful, otherwise contains error message
  */
 static void
-peerinfo_processor (void *cls,
-                   const struct GNUNET_PeerIdentity *peer,
-                   const struct GNUNET_HELLO_Message *hello,
-                   const char *err_msg)
+peerinfo_processor (void *cls, const struct GNUNET_PeerIdentity *peer,
+                    const struct GNUNET_HELLO_Message *hello,
+                    const char *err_msg)
 {
   GtkListStore *ls;
   GtkTreeModel *tm;
@@ -248,48 +234,43 @@
 
   ls = GTK_LIST_STORE (get_object ("GNUNET_PEERINFO_GTK_list_store"));
   if (NULL == ls)
-    {
-      GNUNET_break (0);
-      return;
-    }
+  {
+    GNUNET_break (0);
+    return;
+  }
   tm = GTK_TREE_MODEL (ls);
-  info = GNUNET_CONTAINER_multihashmap_get (peer2info,
-                                           &peer->hashPubKey);
+  info = GNUNET_CONTAINER_multihashmap_get (peer2info, &peer->hashPubKey);
   if (NULL == info)
-    {
-      GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc);  
-      npid = (char *) &enc;
-      npid[4] = '\0';
-      gtk_list_store_append (ls, &iter);
-      gtk_list_store_set (ls, &iter, 
-                         0, npid, 
-                         1, 0 /* number of known addresses */ ,
-                         2, "" /* country name */ ,
-                         3, NULL /* country flag */ ,
-                         4, (guint64) 0 /* bandwidth-in */ ,
-                         5, (guint64) 0 /* bandwidth-out */ ,
-                         6, "" /* addresses as strings */,
-                         -1);
-      path = gtk_tree_model_get_path (tm, &iter);
-      info = GNUNET_malloc (sizeof (struct PeerInfo));     
-      info->rr = gtk_tree_row_reference_new (tm, path);
-      GNUNET_assert (NULL != info->rr);
-      gtk_tree_path_free (path);
-      GNUNET_CONTAINER_multihashmap_put (peer2info,
-                                        &peer->hashPubKey,
-                                        info,
-                                        
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
-    }
+  {
+    GNUNET_CRYPTO_hash_to_enc (&peer->hashPubKey, &enc);
+    npid = (char *) &enc;
+    npid[4] = '\0';
+    gtk_list_store_append (ls, &iter);
+    gtk_list_store_set (ls, &iter, 0, npid, 1,
+                        0 /* number of known addresses */ ,
+                        2, "" /* country name */ ,
+                        3, NULL /* country flag */ ,
+                        4, (guint64) 0 /* bandwidth-in */ ,
+                        5, (guint64) 0 /* bandwidth-out */ ,
+                        6, "" /* addresses as strings */ ,
+                        -1);
+    path = gtk_tree_model_get_path (tm, &iter);
+    info = GNUNET_malloc (sizeof (struct PeerInfo));
+    info->rr = gtk_tree_row_reference_new (tm, path);
+    GNUNET_assert (NULL != info->rr);
+    gtk_tree_path_free (path);
+    GNUNET_CONTAINER_multihashmap_put (peer2info, &peer->hashPubKey, info,
+                                       
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+  }
   if (NULL == info->palc)
-    {
-      info->palc_accumulator = GNUNET_strdup ("|");
-      info->palc_counter = 0;
-      info->palc = GNUNET_TRANSPORT_peer_address_lookup (get_configuration(),
-                                                        peer,
-                                                        
GNUNET_TIME_UNIT_MINUTES,
-                                                        &peer_address_cb,
-                                                        info);      
-    }
+  {
+    info->palc_accumulator = GNUNET_strdup ("|");
+    info->palc_counter = 0;
+    info->palc =
+        GNUNET_TRANSPORT_peer_address_lookup (get_configuration (), peer,
+                                              GNUNET_TIME_UNIT_MINUTES,
+                                              &peer_address_cb, info);
+  }
 
 }
 
@@ -306,17 +287,13 @@
  * @param my_identity ID of this peer, NULL if we failed
  * @param publicKey public key of this peer, NULL if we failed
  */
-static void 
-init_cb (void *cls,
-        struct GNUNET_CORE_Handle * server,
-        const struct GNUNET_PeerIdentity *
-        my_identity,
-        const struct
-        GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded
-        * publicKey)
+static void
+init_cb (void *cls, struct GNUNET_CORE_Handle *server,
+         const struct GNUNET_PeerIdentity *my_identity,
+         const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *publicKey)
 {
   /* FIXME: should probably do something to my 'own' entry
-     in the peerinfo list to make it stand out */
+   * in the peerinfo list to make it stand out */
 }
 
 
@@ -331,35 +308,30 @@
  * @param bandwidth_out available amount of outbound bandwidth
  * @param atsi performance data for the connection
  */
-static void 
-status_cb (void *cls,
-          const struct GNUNET_PeerIdentity * peer,
-          struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-          struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-          struct GNUNET_TIME_Absolute timeout,
-          const struct GNUNET_TRANSPORT_ATS_Information* atsi)
+static void
+status_cb (void *cls, const struct GNUNET_PeerIdentity *peer,
+           struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
+           struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
+           struct GNUNET_TIME_Absolute timeout,
+           const struct GNUNET_TRANSPORT_ATS_Information *atsi)
 {
   struct PeerInfo *info;
   GtkListStore *ls;
   GtkTreeModel *tm;
   GtkTreeIter iter;
   GtkTreePath *path;
- 
-  info = GNUNET_CONTAINER_multihashmap_get (peer2info,
-                                           &peer->hashPubKey);
+
+  info = GNUNET_CONTAINER_multihashmap_get (peer2info, &peer->hashPubKey);
   if (NULL == info)
-    return; /* should rarely happen... */
+    return;                     /* should rarely happen... */
   ls = GTK_LIST_STORE (get_object ("GNUNET_PEERINFO_GTK_list_store"));
   tm = GTK_TREE_MODEL (ls);
   path = gtk_tree_row_reference_get_path (info->rr);
   GNUNET_assert (NULL != path);
-  GNUNET_assert (TRUE ==
-                gtk_tree_model_get_iter (tm, &iter, path));
+  GNUNET_assert (TRUE == gtk_tree_model_get_iter (tm, &iter, path));
   gtk_tree_path_free (path);
-  gtk_list_store_set (ls, &iter, 
-                     4, (guint64) ntohl (bandwidth_in.value__),
-                     5, (guint64) ntohl (bandwidth_out.value__),
-                     -1);      
+  gtk_list_store_set (ls, &iter, 4, (guint64) ntohl (bandwidth_in.value__), 5,
+                      (guint64) ntohl (bandwidth_out.value__), -1);
 }
 
 
@@ -383,30 +355,26 @@
 run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   GtkWidget *main_window;
+
   ml = cls;
 
   GNUNET_GTK_set_icon_search_path ();
   GNUNET_GTK_setup_nls ();
   peer2info = GNUNET_CONTAINER_multihashmap_create (256);
-  pnc = GNUNET_PEERINFO_notify (get_configuration(), 
-                               &peerinfo_processor, NULL);
+  pnc =
+      GNUNET_PEERINFO_notify (get_configuration (), &peerinfo_processor, NULL);
   if (pnc == NULL)
   {
-    fprintf (stderr, _("Failed to initialize communication with peerinfo 
service!\n"));
+    fprintf (stderr,
+             _("Failed to initialize communication with peerinfo service!\n"));
     exit (1);
   }
-  core = GNUNET_CORE_connect (get_configuration(),
-                             1, NULL,
-                             &init_cb,
-                             NULL, NULL,
-                             &status_cb,
-                             NULL, GNUNET_NO,
-                             NULL, GNUNET_NO,
-                             NULL);
+  core =
+      GNUNET_CORE_connect (get_configuration (), 1, NULL, &init_cb, NULL, NULL,
+                           &status_cb, NULL, GNUNET_NO, NULL, GNUNET_NO, NULL);
 
   /* setup main window */
-  main_window =
-      GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window"));
+  main_window = GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window"));
   gtk_window_maximize (GTK_WINDOW (main_window));
   GNUNET_GTK_tray_icon_create (GTK_WINDOW (main_window),
                                "gnunet-gtk" /* FIXME: different icon? */ ,
@@ -433,10 +401,10 @@
 
   if (GNUNET_OK !=
       GNUNET_GTK_main_loop_start ("gnunet-peerinfo-gtk",
-                                 "GTK GUI for inspecting GNUnet Peers",
-                                 argc,
+                                  "GTK GUI for inspecting GNUnet Peers", argc,
                                   argv, options,
-                                  "gnunet_peerinfo_gtk_main_window.glade", 
&run))
+                                  "gnunet_peerinfo_gtk_main_window.glade",
+                                  &run))
     return 1;
   return 0;
 }

Modified: gnunet-gtk/src/setup/gnunet-setup-options.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-options.c 2011-09-15 12:54:56 UTC (rev 
16864)
+++ gnunet-gtk/src/setup/gnunet-setup-options.c 2011-09-15 13:18:57 UTC (rev 
16865)
@@ -471,8 +471,8 @@
 
 /**
  * The GtkCellRenderer has emmited the 'edited' signal.
- * 
  *
+ *
  * @param cls closure (unused)
  * @param section section with the value (NULL)
  * @param option option name (NULL)
@@ -664,7 +664,7 @@
 /**
  * Function called for each section in the configuration.
  * Gather existing ttl, section names and altnames.
- * 
+ *
  * @param cls 'struct DnsInfo**' to create
  * @param section name of a section in the configuration
  */
@@ -696,7 +696,7 @@
 /**
  * Function called for each section in the configuration.
  * Removes those ending in '.gnunet.'.
- * 
+ *
  * @param cls unused
  * @param section name of a section in the configuration
  */
@@ -711,7 +711,7 @@
 
 
 /**
- * Given the list store and the data in it, update the 
+ * Given the list store and the data in it, update the
  * configuration file accordingly.
  *
  * @param tm model to use

Modified: gnunet-gtk/src/setup/gnunet-setup-options.h
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-options.h 2011-09-15 12:54:56 UTC (rev 
16864)
+++ gnunet-gtk/src/setup/gnunet-setup-options.h 2011-09-15 13:18:57 UTC (rev 
16865)
@@ -50,7 +50,7 @@
 /**
  * Modify the configuration to contain the right value for
  * the option based on the state of the widget.
- * 
+ *
  * @param cls closure
  * @param section section with the value
  * @param option option name

Modified: gnunet-gtk/src/setup/gnunet-setup.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup.c 2011-09-15 12:54:56 UTC (rev 16864)
+++ gnunet-gtk/src/setup/gnunet-setup.c 2011-09-15 13:18:57 UTC (rev 16865)
@@ -93,7 +93,7 @@
 
 
 /**
- * Change the visibility of widgets according to the 
+ * Change the visibility of widgets according to the
  * value and visibility specification given.
  *
  * @param os option specification
@@ -265,15 +265,17 @@
     }
     i++;
   }
-
 }
 
 
 /**
- * Callback invoked if the application is supposed to exit.
+ * Actual main method that sets up the configuration window.
+ *
+ * @param cls the main loop handle
+ * @param tc scheduler context
  */
-void
-GNUNET_SETUP_quit_cb (GObject * object, gpointer user_data)
+static void
+cleanup_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_CONFIGURATION_Handle *cfgDefault;
 
@@ -295,6 +297,17 @@
 
 
 /**
+ * Callback invoked if the application is supposed to exit.
+ */
+void
+GNUNET_SETUP_quit_cb (GObject * object, gpointer user_data)
+{
+  GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,
+                                      &cleanup_task, NULL);
+}
+
+
+/**
  * Actual main method that sets up the configuration window.
  *
  * @param cls the main loop handle
@@ -303,9 +316,9 @@
 static void
 run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
-  ml = cls;
   GtkWidget *main_window;
 
+  ml = cls;
   cfg = GNUNET_CONFIGURATION_create ();
   (void) GNUNET_CONFIGURATION_load (cfg, cfgName);
   main_window = GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_dialog"));




reply via email to

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