diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-12 12:37:45 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-12 12:37:45 +0000 |
commit | 294a1283b32dcdecb2a518e9f5e4444d70c22c2c (patch) | |
tree | a3df4aa3e5bdf3f2b5b1f7d341579763b7bce151 | |
parent | 244d5d97c9745a3b5398485b5666a50ce69ad16f (diff) | |
download | gnunet-gtk-294a1283b32dcdecb2a518e9f5e4444d70c22c2c.tar.gz gnunet-gtk-294a1283b32dcdecb2a518e9f5e4444d70c22c2c.zip |
-minor bugfixes
-rw-r--r-- | src/fs/gnunet-fs-gtk_publish-dialog.c | 31 | ||||
-rw-r--r-- | src/setup/gnunet-setup-gns.c | 13 |
2 files changed, 27 insertions, 17 deletions
diff --git a/src/fs/gnunet-fs-gtk_publish-dialog.c b/src/fs/gnunet-fs-gtk_publish-dialog.c index 045ff3b8..aa25440a 100644 --- a/src/fs/gnunet-fs-gtk_publish-dialog.c +++ b/src/fs/gnunet-fs-gtk_publish-dialog.c | |||
@@ -775,7 +775,7 @@ GNUNET_GTK_master_publish_dialog_updateable_checkbox_toggled_cb ( | |||
775 | * Generates an update id from a new id. | 775 | * Generates an update id from a new id. |
776 | * | 776 | * |
777 | * @param new_text new id for which to generate update id. | 777 | * @param new_text new id for which to generate update id. |
778 | * @return new update id (free with g_free ()). | 778 | * @return new update id (free with g_free()). |
779 | */ | 779 | */ |
780 | static gchar * | 780 | static gchar * |
781 | generate_update_id (const gchar *new_text) | 781 | generate_update_id (const gchar *new_text) |
@@ -806,6 +806,7 @@ generate_update_id (const gchar *new_text) | |||
806 | return new_update_id; | 806 | return new_update_id; |
807 | } | 807 | } |
808 | 808 | ||
809 | |||
809 | /** | 810 | /** |
810 | * Checks whether existing update id was generated or not. | 811 | * Checks whether existing update id was generated or not. |
811 | * Generates an update id from the previous id, then checks if | 812 | * Generates an update id from the previous id, then checks if |
@@ -819,11 +820,14 @@ generate_update_id (const gchar *new_text) | |||
819 | * FALSE otherwise | 820 | * FALSE otherwise |
820 | */ | 821 | */ |
821 | static gboolean | 822 | static gboolean |
822 | update_id_is_autofilled (const gchar *existing_update_id, gchar *previous_id) | 823 | update_id_is_autofilled (const gchar *existing_update_id, |
824 | const gchar *previous_id) | ||
823 | { | 825 | { |
824 | gboolean result; | 826 | gboolean result; |
827 | gchar *gen_update_id; | ||
828 | |||
825 | result = TRUE; | 829 | result = TRUE; |
826 | gchar *gen_update_id = generate_update_id (previous_id); | 830 | gen_update_id = generate_update_id (previous_id); |
827 | if (0 != strcmp (gen_update_id, existing_update_id)) | 831 | if (0 != strcmp (gen_update_id, existing_update_id)) |
828 | result = FALSE; | 832 | result = FALSE; |
829 | g_free (gen_update_id); | 833 | g_free (gen_update_id); |
@@ -848,13 +852,17 @@ maybe_change_update_id (struct MainPublishingDialogContext *ctx, | |||
848 | new_update_id = NULL; | 852 | new_update_id = NULL; |
849 | existing_update_id = gtk_entry_get_text (GTK_ENTRY (ctx->update_id_entry)); | 853 | existing_update_id = gtk_entry_get_text (GTK_ENTRY (ctx->update_id_entry)); |
850 | 854 | ||
851 | if (((NULL == ctx->previous_id) && ('\0' == existing_update_id[0])) | 855 | if ( ( (NULL == ctx->previous_id) && |
852 | || update_id_is_autofilled (existing_update_id, ctx->previous_id)) | 856 | ('\0' == existing_update_id[0]) ) || |
857 | ( (NULL != ctx->previous_id) && | ||
858 | update_id_is_autofilled (existing_update_id, | ||
859 | ctx->previous_id) ) ) | ||
853 | new_update_id = generate_update_id (new_text); | 860 | new_update_id = generate_update_id (new_text); |
854 | if (new_update_id) | 861 | if (NULL != new_update_id) |
862 | { | ||
855 | gtk_entry_set_text (GTK_ENTRY (ctx->update_id_entry), new_update_id); | 863 | gtk_entry_set_text (GTK_ENTRY (ctx->update_id_entry), new_update_id); |
856 | g_free (new_update_id); | 864 | g_free (new_update_id); |
857 | 865 | } | |
858 | g_free (ctx->previous_id); | 866 | g_free (ctx->previous_id); |
859 | ctx->previous_id = g_strdup (new_text); | 867 | ctx->previous_id = g_strdup (new_text); |
860 | } | 868 | } |
@@ -866,17 +874,16 @@ maybe_change_update_id (struct MainPublishingDialogContext *ctx, | |||
866 | * Updates execute/cancel buttons sensitivity. | 874 | * Updates execute/cancel buttons sensitivity. |
867 | * | 875 | * |
868 | * @param widget the entry that was changed | 876 | * @param widget the entry that was changed |
869 | * @param user_data context | 877 | * @param user_data our `struct MainPublishingDialogContext` |
870 | */ | 878 | */ |
871 | void | 879 | void |
872 | GNUNET_GTK_master_publish_dialog_identifier_entry_changed_cb ( | 880 | GNUNET_GTK_master_publish_dialog_identifier_entry_changed_cb (GtkWidget *widget, |
873 | GtkWidget *widget, gpointer user_data) | 881 | gpointer user_data) |
874 | { | 882 | { |
875 | struct MainPublishingDialogContext *ctx = user_data; | 883 | struct MainPublishingDialogContext *ctx = user_data; |
876 | const gchar *new_text; | 884 | const gchar *new_text; |
877 | 885 | ||
878 | new_text = gtk_entry_get_text (GTK_ENTRY (widget)); | 886 | new_text = gtk_entry_get_text (GTK_ENTRY (widget)); |
879 | |||
880 | if (NULL == new_text) | 887 | if (NULL == new_text) |
881 | return; | 888 | return; |
882 | maybe_change_update_id (ctx, new_text); | 889 | maybe_change_update_id (ctx, new_text); |
diff --git a/src/setup/gnunet-setup-gns.c b/src/setup/gnunet-setup-gns.c index e96e8973..ad028be1 100644 --- a/src/setup/gnunet-setup-gns.c +++ b/src/setup/gnunet-setup-gns.c | |||
@@ -1641,17 +1641,20 @@ GNUNET_setup_gns_pseu_entry_changed_cb (GtkEditable *editable, | |||
1641 | break; | 1641 | break; |
1642 | if (off == rd_count) | 1642 | if (off == rd_count) |
1643 | total++; | 1643 | total++; |
1644 | rd_new[off].record_type = GNUNET_NAMESTORE_TYPE_PSEU; | ||
1645 | rd_new[off].expiration_time = UINT64_MAX; | ||
1646 | rd_new[off].flags = GNUNET_NAMESTORE_RF_NONE; | ||
1647 | rd_new[off].data_size = strlen (pseu) + 1; | ||
1648 | rd_new[off].data = pseu; | ||
1649 | if ( (NULL == pseu) || | 1644 | if ( (NULL == pseu) || |
1650 | (0 == strlen (pseu)) ) | 1645 | (0 == strlen (pseu)) ) |
1651 | { | 1646 | { |
1652 | rd_new[off] = rd_new[rd_count - 1]; | 1647 | rd_new[off] = rd_new[rd_count - 1]; |
1653 | total--; | 1648 | total--; |
1654 | } | 1649 | } |
1650 | else | ||
1651 | { | ||
1652 | rd_new[off].record_type = GNUNET_NAMESTORE_TYPE_PSEU; | ||
1653 | rd_new[off].expiration_time = UINT64_MAX; | ||
1654 | rd_new[off].flags = GNUNET_NAMESTORE_RF_NONE; | ||
1655 | rd_new[off].data_size = strlen (pseu) + 1; | ||
1656 | rd_new[off].data = pseu; | ||
1657 | } | ||
1655 | oc = GNUNET_new (struct OperationContext); | 1658 | oc = GNUNET_new (struct OperationContext); |
1656 | GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc); | 1659 | GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc); |
1657 | oc->qe = GNUNET_NAMESTORE_records_store (namestore, | 1660 | oc->qe = GNUNET_NAMESTORE_records_store (namestore, |