gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r29230 - in gnunet-gtk/src: fs setup


From: gnunet
Subject: [GNUnet-SVN] r29230 - in gnunet-gtk/src: fs setup
Date: Thu, 12 Sep 2013 14:37:45 +0200

Author: grothoff
Date: 2013-09-12 14:37:45 +0200 (Thu, 12 Sep 2013)
New Revision: 29230

Modified:
   gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c
   gnunet-gtk/src/setup/gnunet-setup-gns.c
Log:
-minor bugfixes

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c    2013-09-12 10:09:21 UTC 
(rev 29229)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_publish-dialog.c    2013-09-12 12:37:45 UTC 
(rev 29230)
@@ -775,7 +775,7 @@
  * Generates an update id from a new id.
  *
  * @param new_text new id for which to generate update id.
- * @return new update id (free with g_free ()).
+ * @return new update id (free with g_free()).
  */
 static gchar *
 generate_update_id (const gchar *new_text)
@@ -806,6 +806,7 @@
   return new_update_id;
 }
 
+
 /**
  * Checks whether existing update id was generated or not.
  * Generates an update id from the previous id, then checks if
@@ -819,11 +820,14 @@
  *         FALSE otherwise
  */
 static gboolean
-update_id_is_autofilled (const gchar *existing_update_id, gchar *previous_id)
+update_id_is_autofilled (const gchar *existing_update_id, 
+                        const gchar *previous_id)
 {
   gboolean result;
+  gchar *gen_update_id;
+
   result = TRUE;
-  gchar *gen_update_id = generate_update_id (previous_id);
+  gen_update_id = generate_update_id (previous_id);
   if (0 != strcmp (gen_update_id, existing_update_id))
     result = FALSE;
   g_free (gen_update_id);
@@ -848,13 +852,17 @@
   new_update_id = NULL;
   existing_update_id = gtk_entry_get_text (GTK_ENTRY (ctx->update_id_entry));
 
-  if (((NULL == ctx->previous_id) && ('\0' == existing_update_id[0]))
-      || update_id_is_autofilled (existing_update_id, ctx->previous_id))
+  if ( ( (NULL == ctx->previous_id) && 
+        ('\0' == existing_update_id[0]) ) || 
+       ( (NULL != ctx->previous_id) &&
+        update_id_is_autofilled (existing_update_id, 
+                                 ctx->previous_id) ) )
     new_update_id = generate_update_id (new_text);
-  if (new_update_id)
+  if (NULL != new_update_id)
+  {
     gtk_entry_set_text (GTK_ENTRY (ctx->update_id_entry), new_update_id);
-  g_free (new_update_id);
-
+    g_free (new_update_id);
+  }
   g_free (ctx->previous_id);
   ctx->previous_id = g_strdup (new_text);
 }
@@ -866,17 +874,16 @@
  * Updates execute/cancel buttons sensitivity.
  *
  * @param widget the entry that was changed
- * @param user_data context
+ * @param user_data our `struct MainPublishingDialogContext`
  */
 void
-GNUNET_GTK_master_publish_dialog_identifier_entry_changed_cb (
-    GtkWidget *widget, gpointer user_data)
+GNUNET_GTK_master_publish_dialog_identifier_entry_changed_cb (GtkWidget 
*widget, 
+                                                             gpointer 
user_data)
 {
   struct MainPublishingDialogContext *ctx = user_data;
   const gchar *new_text;
 
   new_text = gtk_entry_get_text (GTK_ENTRY (widget));
-
   if (NULL == new_text)
     return;
   maybe_change_update_id (ctx, new_text);

Modified: gnunet-gtk/src/setup/gnunet-setup-gns.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-gns.c     2013-09-12 10:09:21 UTC (rev 
29229)
+++ gnunet-gtk/src/setup/gnunet-setup-gns.c     2013-09-12 12:37:45 UTC (rev 
29230)
@@ -1641,17 +1641,20 @@
        break;
     if (off == rd_count)
       total++;
-    rd_new[off].record_type = GNUNET_NAMESTORE_TYPE_PSEU;
-    rd_new[off].expiration_time = UINT64_MAX;
-    rd_new[off].flags = GNUNET_NAMESTORE_RF_NONE;
-    rd_new[off].data_size = strlen (pseu) + 1;
-    rd_new[off].data = pseu;
     if ( (NULL == pseu) ||
         (0 == strlen (pseu)) )    
     {
       rd_new[off] = rd_new[rd_count - 1];
       total--;
     } 
+    else
+    {
+      rd_new[off].record_type = GNUNET_NAMESTORE_TYPE_PSEU;
+      rd_new[off].expiration_time = UINT64_MAX;
+      rd_new[off].flags = GNUNET_NAMESTORE_RF_NONE;
+      rd_new[off].data_size = strlen (pseu) + 1;
+      rd_new[off].data = pseu;
+    }
     oc = GNUNET_new (struct OperationContext);
     GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
     oc->qe = GNUNET_NAMESTORE_records_store (namestore, 




reply via email to

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