gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r25181 - gnunet-gtk/src/setup


From: gnunet
Subject: [GNUnet-SVN] r25181 - gnunet-gtk/src/setup
Date: Mon, 3 Dec 2012 09:37:51 +0100

Author: grothoff
Date: 2012-12-03 09:37:51 +0100 (Mon, 03 Dec 2012)
New Revision: 25181

Modified:
   gnunet-gtk/src/setup/gnunet-setup-gns.c
Log:
-clean up pseudonym management code

Modified: gnunet-gtk/src/setup/gnunet-setup-gns.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-gns.c     2012-12-03 08:37:05 UTC (rev 
25180)
+++ gnunet-gtk/src/setup/gnunet-setup-gns.c     2012-12-03 08:37:51 UTC (rev 
25181)
@@ -194,10 +194,6 @@
    */
   struct GNUNET_CRYPTO_RsaKeyGenerationContext *rkgc;
 
-  /**
-   * Name of the zone (pseudonym).  FIXME: rename...
-   */
-  char *label;
 };
 
 
@@ -387,12 +383,6 @@
 static char *current_pseudonym;
 
 /**
- * Pointer to 'short', 'private' or empty string (for master zone),
- * depending on which zone we are editing right now.
- */
-static const char *current_zone_name;
-
-/**
  * Pointer to name of the configuration option that gives the
  * zone key for the zone we are editing right now.  
  */
@@ -608,11 +598,9 @@
  * @param zonename name of the option in the configuration file
  *        with the name of the file with the private key of the
  *        zone to load
- * @param default_pseu default pseudonym to use
  */
 static void
-load_zone (const char *zonename,
-          const char *default_pseu);
+load_zone (const char *zonename);
 
 
 /**
@@ -625,8 +613,7 @@
 static void
 resync_db ()
 {
-  load_zone (current_zone_option,
-            current_zone_name);
+  load_zone (current_zone_option);
 }
 
 
@@ -830,7 +817,7 @@
     return;
   }
   if ( (0 == strcmp (name, ROOT_STR)) &&
-       (0 == strcmp (current_zone_name, "")) )
+       (0 == strcmp (current_zone_option, "ZONEKEY")) )
   {
     /* We have to append PSEU RECORD, this is the 'master' zone */
     append_pseu = GNUNET_YES;
@@ -1742,7 +1729,7 @@
                pseu);
     gdk_beep ();
     gtk_entry_set_text (GTK_ENTRY (editable),
-                       current_pseudonym);
+                       pseu);
     return;
   }
   if ( (pseu != NULL) && 
@@ -1849,17 +1836,13 @@
   GNUNET_assert (NULL != zc_ctx);
   if ((NULL == zone_key) && (NULL == name))
   {
-    GNUNET_CRYPTO_short_hash_to_enc(&zc_ctx->zone, &shenc);
+    GNUNET_CRYPTO_short_hash_to_enc (&zc_ctx->zone, &shenc);
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                "Zone `%s 'iteration done\n",
                &shenc);
     pseu_entry = GTK_ENTRY((GNUNET_SETUP_get_object 
("GNUNET_setup_gns_pseu_entry")));
-    if (NULL == zc_ctx->label)
-      zc_ctx->label = GNUNET_strdup (gettext (""));
-    gtk_entry_set_text (pseu_entry, zc_ctx->label);
-    gtk_widget_show (GTK_WIDGET (pseu_entry));
-    GNUNET_free_non_null (current_pseudonym);
-    current_pseudonym = zc_ctx->label;
+    if (0 == strcmp (current_zone_option, "ZONEKEY"))    
+      gtk_widget_show (GTK_WIDGET (GNUNET_SETUP_get_object 
("GNUNET_setup_gns_pseu_hbox")));    
     GNUNET_setup_gns_pseu_entry_changed_cb (GTK_EDITABLE (pseu_entry),
                                            NULL);
     GNUNET_CONTAINER_DLL_remove (zc_head,
@@ -1945,8 +1928,8 @@
     if ( (0 == strcmp (name, ROOT_STR)) && 
         (GNUNET_NAMESTORE_TYPE_PSEU == rd[c].record_type) )
     {
-      GNUNET_free_non_null (zc_ctx->label);
-      zc_ctx->label = strdup (val);
+      pseu_entry = GTK_ENTRY((GNUNET_SETUP_get_object 
("GNUNET_setup_gns_pseu_entry")));
+      gtk_entry_set_text (pseu_entry, val);
     }
     else
     {
@@ -1997,7 +1980,6 @@
     GNUNET_CONTAINER_DLL_remove (zc_head,
                                 zc_tail,
                                 zc_ctx);
-    GNUNET_free_non_null (zc_ctx->label);
     GNUNET_free (zc_ctx);
     show_error_message (_("Failed to load zone"),
                        gettext(emsg));
@@ -2047,7 +2029,6 @@
     GNUNET_CRYPTO_rsa_key_create_stop (zc_ctx->rkgc);
   if (NULL != zc_ctx->it)
     GNUNET_NAMESTORE_zone_iteration_stop (zc_ctx->it);
-  GNUNET_free_non_null (zc_ctx->label);
   GNUNET_CONTAINER_DLL_remove (zc_head,
                               zc_tail,
                               zc_ctx);
@@ -2061,11 +2042,9 @@
  * @param zonename name of the option in the configuration file
  *        with the name of the file with the private key of the
  *        zone to load
- * @param default_pseu default pseudonym to use
  */
 static void
-load_zone (const char *zonename,
-          const char *default_pseu)
+load_zone (const char *zonename)
 {
   char *keyfile;
   struct ZoneIteration_Context *zc_ctx;
@@ -2073,14 +2052,13 @@
 
   /* clear previous zone */
   current_zone_option = zonename;
-  current_zone_name = default_pseu;
   gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object 
("GNUNET_setup_gns_zone_selection_hbuttonbox")));
   gtk_widget_show (GTK_WIDGET (GNUNET_SETUP_get_object 
("GNUNET_setup_gns_status_label")));
   gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object 
("GNUNET_setup_gns_main_scrolledwindow")));
   gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object 
("GNUNET_setup_gns_qr_image")));
   gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object 
("GNUNET_setup_gns_qr_saveas_button")));
   gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object 
("GNUNET_setup_gns_qr_vseparator")));
-  gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object 
("GNUNET_setup_gns_pseu_entry")));
+  gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object 
("GNUNET_setup_gns_pseu_hbox")));
   gtk_tree_store_clear (ts);
 
   /* setup crypto keys */
@@ -2105,7 +2083,6 @@
   GNUNET_CONTAINER_DLL_insert (zc_head,
                               zc_tail,
                               zc_ctx);
-  zc_ctx->label = GNUNET_strdup (default_pseu);
   zc_ctx->rkgc = GNUNET_CRYPTO_rsa_key_create_start (keyfile,
                                                     &zone_key_loaded_callback,
                                                     zc_ctx);
@@ -2125,7 +2102,7 @@
                                                                gpointer 
user_data)
 {
   if (gtk_toggle_button_get_active (togglebutton))
-    load_zone ("SHORTEN_ZONEKEY", _("short"));
+    load_zone ("SHORTEN_ZONEKEY");
 }
 
 
@@ -2141,7 +2118,7 @@
                                                                gpointer 
user_data)
 {
   if (gtk_toggle_button_get_active (togglebutton))
-    load_zone ("PRIVATE_ZONEKEY", _("private"));
+    load_zone ("PRIVATE_ZONEKEY");
 }
 
 
@@ -2157,7 +2134,7 @@
                                                               gpointer 
user_data)
 {
   if (gtk_toggle_button_get_active (togglebutton))
-    load_zone ("ZONEKEY", "");
+    load_zone ("ZONEKEY");
 }
 
 
@@ -2183,7 +2160,7 @@
   ts = GTK_TREE_STORE (GNUNET_SETUP_get_object ("GNUNET_setup_gns_treestore"));
   tv = GTK_TREE_VIEW (GNUNET_SETUP_get_object 
("GNUNET_setup_gns_main_treeview"));
   tm = GTK_TREE_MODEL(ts);  
-  load_zone ("ZONEKEY", "");
+  load_zone ("ZONEKEY");
 }
 
 




reply via email to

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