[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet-gtk] branch master updated: clang-format off experi
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet-gtk] branch master updated: clang-format off experiments |
Date: |
Thu, 18 Apr 2019 13:55:03 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet-gtk.
The following commit(s) were added to refs/heads/master by this push:
new 019178b9 clang-format off experiments
019178b9 is described below
commit 019178b9229d2d961f61fea21c804a41d24bc7b0
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Apr 18 13:54:56 2019 +0200
clang-format off experiments
---
.dir-locals.el | 3 +
contrib/Makefile.am | 2 +-
src/namestore/gnunet-namestore-gtk.c | 1501 ++++++++++++++++------------------
3 files changed, 697 insertions(+), 809 deletions(-)
diff --git a/.dir-locals.el b/.dir-locals.el
index 68786381..29999b94 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -1,5 +1,8 @@
;; Per-directory local variables for GNU Emacs 23 and later.
+((c-mode
+ (eval add-hook 'before-save-hook #'clang-format-buffer nil t)))
+
((nil
. ((fill-column . 78)
(tab-width . 4)
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index ae743868..307e6adc 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -1,5 +1,5 @@
# This Makefile.am is in the public domain
- # Process this file with automake to produce Makefile.in
+# Process this file with automake to produce Makefile.in
SUBDIRS = .
diff --git a/src/namestore/gnunet-namestore-gtk.c
b/src/namestore/gnunet-namestore-gtk.c
index 3f87799a..95e82914 100644
--- a/src/namestore/gnunet-namestore-gtk.c
+++ b/src/namestore/gnunet-namestore-gtk.c
@@ -235,7 +235,6 @@ struct OperationContext
* Associated namestore operation.
*/
struct GNUNET_NAMESTORE_QueueEntry *qe;
-
};
@@ -281,7 +280,6 @@ struct MoveOperationContext
* Record to merge.
*/
struct GNUNET_GNSRECORD_Data rd;
-
};
@@ -315,7 +313,6 @@ struct RecordInfo
* Number of records serialized in @e data.
*/
unsigned int rd_count;
-
};
@@ -347,11 +344,9 @@ struct GNS_TopLevelDomain
* Top-level domain as a string, including leading ".".
*/
char *tld;
-
};
-
/**
* Head of DLL of TLDs we map to GNS zones.
*/
@@ -495,8 +490,7 @@ get_object (const char *name)
{
if (NULL == ml)
return NULL;
- return GNUNET_GTK_main_loop_get_object (ml,
- name);
+ return GNUNET_GTK_main_loop_get_object (ml, name);
}
@@ -513,7 +507,7 @@ get_object (const char *name)
static GdkPixbuf *
create_qrcode (unsigned int scale)
{
- QRinput * qri;
+ QRinput *qri;
QRcode *qrc;
char *str;
GdkPixbuf *pb;
@@ -524,36 +518,30 @@ create_qrcode (unsigned int scale)
unsigned int size;
char *upper;
- qri = QRinput_new2 (0,
- QR_ECLEVEL_M);
+ qri = QRinput_new2 (0, QR_ECLEVEL_M);
if (NULL == qri)
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
- "QRinput_new2");
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "QRinput_new2");
return NULL;
}
GNUNET_asprintf (&str,
- "gnunet://gns/%s/%s",
- GNUNET_GNSRECORD_z2s (&pubkey),
- current_pseudonym);
+ "gnunet://gns/%s/%s",
+ GNUNET_GNSRECORD_z2s (&pubkey),
+ current_pseudonym);
upper = GNUNET_strdup (str);
- GNUNET_STRINGS_utf8_toupper (str,
- upper);
+ GNUNET_STRINGS_utf8_toupper (str, upper);
/* first try encoding as uppercase-only alpha-numerical
QR code (much smaller encoding); if that fails, also
try using binary encoding (in case nick contains
special characters). */
- if ( (0 != QRinput_append (qri,
- QR_MODE_AN,
- strlen (upper),
- (unsigned char*) upper)) &&
- (0 != QRinput_append (qri,
- QR_MODE_8,
- strlen (str),
- (unsigned char*) str)) )
- {
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
- "QRinput_append");
+ if ((0 != QRinput_append (qri,
+ QR_MODE_AN,
+ strlen (upper),
+ (unsigned char *) upper)) &&
+ (0 !=
+ QRinput_append (qri, QR_MODE_8, strlen (str), (unsigned char *) str)))
+ {
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "QRinput_append");
GNUNET_free (upper);
GNUNET_free (str);
return NULL;
@@ -563,25 +551,18 @@ create_qrcode (unsigned int scale)
qrc = QRcode_encodeInput (qri);
if (NULL == qrc)
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
- "QRcode_encodeInput");
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "QRcode_encodeInput");
QRinput_free (qri);
return NULL;
}
- /* We use a trick to create a pixbuf in a way that works for both Gtk2 and
Gtk3
- by loading a dummy file from disk; all other methods are not portable to
both
- Gtk2 and Gtk3. */
+ /* We use a trick to create a pixbuf in a way that works for both Gtk2 and
+ Gtk3 by loading a dummy file from disk; all other methods are not portable
+ to both Gtk2 and Gtk3. */
dir = GNUNET_GTK_get_data_dir ();
- GNUNET_asprintf (&fn,
- "%s%s",
- dir,
- "qr_dummy.png");
+ GNUNET_asprintf (&fn, "%s%s", dir, "qr_dummy.png");
size = qrc->width * scale;
size += 8 - (size % 8);
- pb = gdk_pixbuf_new_from_file_at_size (fn,
- size,
- size,
- NULL);
+ pb = gdk_pixbuf_new_from_file_at_size (fn, size, size, NULL);
GNUNET_free (fn);
if (NULL == pb)
{
@@ -591,13 +572,14 @@ create_qrcode (unsigned int scale)
}
pixels = gdk_pixbuf_get_pixels (pb);
n_channels = gdk_pixbuf_get_n_channels (pb);
- for (unsigned int x=0;x<size;x++)
- for (unsigned int y=0;y<size;y++)
+ for (unsigned int x = 0; x < size; x++)
+ for (unsigned int y = 0; y < size; y++)
{
- unsigned int off = (x * qrc->width / size) +
- (y * qrc->width / size) * qrc->width;
+ unsigned int off =
+ (x * qrc->width / size) + (y * qrc->width / size) * qrc->width;
for (int c = 0; c < n_channels; c++)
- pixels[(y * size + x) * n_channels + c] = (0 == (qrc->data[off] & 1)) ?
0xFF : 0;
+ pixels[(y * size + x) * n_channels + c] =
+ (0 == (qrc->data[off] & 1)) ? 0xFF : 0;
}
QRcode_free (qrc);
QRinput_free (qri);
@@ -613,7 +595,7 @@ setup_qrcode ()
{
GdkPixbuf *pb;
GtkImage *image;
- GdkScreen *screen;
+ GdkScreen *screen;
GtkSettings *settings;
gint dpi;
int scale;
@@ -627,10 +609,7 @@ setup_qrcode ()
/* adjust scale to screen resolution */
screen = gtk_widget_get_screen (GTK_WIDGET (image));
settings = gtk_settings_get_for_screen (screen);
- g_object_get (G_OBJECT (settings),
- "gtk-xft-dpi",
- &dpi,
- NULL);
+ g_object_get (G_OBJECT (settings), "gtk-xft-dpi", &dpi, NULL);
if (-1 == dpi)
scale = 2;
else if (dpi >= 122800)
@@ -643,7 +622,7 @@ setup_qrcode ()
if (NULL == pb)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Failed to initialize QR-code pixbuf\n"));
+ _ ("Failed to initialize QR-code pixbuf\n"));
return;
}
gtk_image_set_from_pixbuf (image, pb);
@@ -682,13 +661,10 @@ gnunet_namestore_gtk_qr_save_as_dialog_response_cb
(GtkDialog *dialog,
if (NULL == pb)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Failed to initialize QR-code pixbuf"));
+ _ ("Failed to initialize QR-code pixbuf"));
return;
}
- gdk_pixbuf_save (pb,
- filename,
- "png",
- NULL, NULL);
+ gdk_pixbuf_save (pb, filename, "png", NULL, NULL);
g_free (filename);
g_object_unref (pb);
gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -722,14 +698,10 @@ gnunet_namestore_gtk_qr_saveas_button_clicked_cb
(GtkButton *button,
GNUNET_break (0);
return;
}
- GNUNET_asprintf (&suggestion,
- "%s.png",
- current_pseudonym);
- dialog = GTK_WINDOW (gtk_builder_get_object
- (builder,
- "gnunet_namestore_gtk_qr_save_as_dialog"));
- gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog),
- suggestion);
+ GNUNET_asprintf (&suggestion, "%s.png", current_pseudonym);
+ dialog = GTK_WINDOW (
+ gtk_builder_get_object (builder,
"gnunet_namestore_gtk_qr_save_as_dialog"));
+ gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), suggestion);
GNUNET_free (suggestion);
gtk_window_present (dialog);
}
@@ -746,13 +718,13 @@ gnunet_namestore_gtk_qr_saveas_button_clicked_cb
(GtkButton *button,
*/
static int
check_record_permitted (unsigned int rd_count,
- const struct GNUNET_GNSRECORD_Data *rd,
- gint n_type)
+ const struct GNUNET_GNSRECORD_Data *rd,
+ gint n_type)
{
unsigned int nick;
nick = 0;
- for (unsigned int i=0;i<rd_count;i++)
+ for (unsigned int i = 0; i < rd_count; i++)
{
switch (rd[i].record_type)
{
@@ -795,27 +767,24 @@ check_record_permitted (unsigned int rd_count,
* @param emsg error message if the operation failed
*/
static void
-operation_done_cont (void *cls,
- int32_t success,
- const char *emsg)
+operation_done_cont (void *cls, int32_t success, const char *emsg)
{
struct OperationContext *oc = cls;
GtkWidget *dialog;
oc->qe = NULL;
- GNUNET_CONTAINER_DLL_remove (oc_head,
- oc_tail,
- oc);
+ GNUNET_CONTAINER_DLL_remove (oc_head, oc_tail, oc);
if (GNUNET_SYSERR == success)
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Operation failed: `%s'\n"), emsg);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _ ("Operation failed: `%s'\n"), emsg);
dialog = gtk_message_dialog_new (GTK_WINDOW (main_window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("Operation failed: `%s'\n"),
- emsg);
- g_signal_connect_swapped (dialog, "response",
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _ ("Operation failed: `%s'\n"),
+ emsg);
+ g_signal_connect_swapped (dialog,
+ "response",
G_CALLBACK (gtk_widget_destroy),
dialog);
gtk_widget_show_all (dialog);
@@ -833,9 +802,7 @@ operation_done_cont (void *cls,
* @return #GNUNET_OK (continue to iterate)
*/
static int
-release_ri (void *cls,
- const struct GNUNET_HashCode *key,
- void *value)
+release_ri (void *cls, const struct GNUNET_HashCode *key, void *value)
{
struct RecordInfo *ri = value;
(void) cls;
@@ -844,9 +811,7 @@ release_ri (void *cls,
GNUNET_free_non_null (ri->data);
GNUNET_free (ri->name);
GNUNET_break (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap_remove (n2r,
- key,
- ri));
+ GNUNET_CONTAINER_multihashmap_remove (n2r, key, ri));
GNUNET_free (ri);
return GNUNET_OK;
}
@@ -860,15 +825,16 @@ clear_zone_view ()
{
GNUNET_free_non_null (current_pseudonym);
current_pseudonym = NULL;
- GNUNET_CONTAINER_multihashmap_iterate (n2r,
- &release_ri,
- NULL);
+ GNUNET_CONTAINER_multihashmap_iterate (n2r, &release_ri, NULL);
gtk_widget_hide (GTK_WIDGET (zone_combo_box));
gtk_widget_show (GTK_WIDGET (status_label));
- gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_scrolledwindow")));
+ gtk_widget_hide (
+ GTK_WIDGET (get_object ("gnunet_namestore_gtk_scrolledwindow")));
gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_image")));
- gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_saveas_button")));
- gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_vseparator")));
+ gtk_widget_hide (
+ GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_saveas_button")));
+ gtk_widget_hide (
+ GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_vseparator")));
gtk_tree_store_clear (ts);
}
@@ -880,24 +846,20 @@ clear_zone_view ()
* @param emsg error message to show
*/
static void
-show_error_message (const char *title,
- const char *emsg)
+show_error_message (const char *title, const char *emsg)
{
GtkDialog *dialog;
/* TODO: consider replacing with widget in the main window */
- dialog = GTK_DIALOG(gtk_message_dialog_new (GTK_WINDOW (main_window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- _("%s\n%s\n"),
- title,
- emsg));
- g_signal_connect (dialog,
- "response",
- G_CALLBACK (gtk_widget_destroy),
- NULL);
- gtk_widget_show_all (GTK_WIDGET(dialog));
+ dialog = GTK_DIALOG (gtk_message_dialog_new (GTK_WINDOW (main_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ _ ("%s\n%s\n"),
+ title,
+ emsg));
+ g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
+ gtk_widget_show_all (GTK_WIDGET (dialog));
}
@@ -925,45 +887,38 @@ free_edit_dialog_context (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
*/
static void
merge_with_existing_records (void *cls,
- unsigned int rd_count,
- const struct GNUNET_GNSRECORD_Data *rd)
+ unsigned int rd_count,
+ const struct GNUNET_GNSRECORD_Data *rd)
{
struct MoveOperationContext *moc = cls;
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = moc->edc;
struct GNUNET_GNSRECORD_Data rd_new[rd_count + 1];
struct OperationContext *oc;
- GNUNET_CONTAINER_DLL_remove (moc_head,
- moc_tail,
- moc);
- if (GNUNET_OK !=
- check_record_permitted (rd_count,
- rd,
- edc->record_type))
+ GNUNET_CONTAINER_DLL_remove (moc_head, moc_tail, moc);
+ if (GNUNET_OK != check_record_permitted (rd_count, rd, edc->record_type))
{
- show_error_message (_("Record combination not permitted"),
- _("Given the existing records, adding a new record of
this type is not allowed."));
+ show_error_message (
+ _ ("Record combination not permitted"),
+ _ (
+ "Given the existing records, adding a new record of this type is not
allowed."));
GNUNET_free (moc->data);
GNUNET_free (moc);
free_edit_dialog_context (edc);
return;
}
- memcpy (rd_new,
- rd,
- rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
+ memcpy (rd_new, rd, rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
rd_new[rd_count] = moc->rd;
/* FIXME: sanity-check merge... */
oc = GNUNET_new (struct OperationContext);
- GNUNET_CONTAINER_DLL_insert (oc_head,
- oc_tail,
- oc);
+ GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
oc->qe = GNUNET_NAMESTORE_records_store (namestore,
- &moc->pk,
- edc->name,
- rd_count + 1,
- rd_new,
- &operation_done_cont,
+ &moc->pk,
+ edc->name,
+ rd_count + 1,
+ rd_new,
+ &operation_done_cont,
oc);
GNUNET_free (moc->data);
GNUNET_free (moc);
@@ -990,18 +945,14 @@ handle_records_for_merge (void *cls,
{
struct MoveOperationContext *moc = cls;
- if (0 != strcmp (label,
- moc->edc->name))
+ if (0 != strcmp (label, moc->edc->name))
{
- GNUNET_NAMESTORE_zone_iterator_next (moc->it,
- 1);
+ GNUNET_NAMESTORE_zone_iterator_next (moc->it, 1);
return;
}
GNUNET_NAMESTORE_zone_iteration_stop (moc->it);
moc->it = NULL;
- merge_with_existing_records (moc,
- rd_count,
- rd);
+ merge_with_existing_records (moc, rd_count, rd);
}
@@ -1016,8 +967,8 @@ handle_records_for_merge_error (void *cls)
struct MoveOperationContext *moc = cls;
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = moc->edc;
- show_error_message (_("Failed to communicate with database"),
- _("Check that your peer is configured correctly."));
+ show_error_message (_ ("Failed to communicate with database"),
+ _ ("Check that your peer is configured correctly."));
GNUNET_free (moc->data);
GNUNET_free (moc);
free_edit_dialog_context (edc);
@@ -1048,7 +999,7 @@ handle_records_for_merge_end (void *cls)
*/
static void
edit_dialog_continuation (struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc,
- GtkResponseType ret)
+ GtkResponseType ret)
{
struct RecordInfo *ri = edc->ri;
unsigned int rd_count = (NULL == ri) ? 0 : ri->rd_count;
@@ -1060,8 +1011,7 @@ edit_dialog_continuation (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc,
if (NULL != edc->plugin)
{
- GNUNET_PLUGIN_unload (edc->liblow,
- edc->plugin);
+ GNUNET_PLUGIN_unload (edc->liblow, edc->plugin);
edc->plugin = NULL;
}
if (NULL != edc->liblow)
@@ -1069,27 +1019,25 @@ edit_dialog_continuation (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc,
GNUNET_free (edc->liblow);
edc->liblow = NULL;
}
- if ( (NULL != ri) &&
- (GNUNET_OK !=
- GNUNET_GNSRECORD_records_deserialize (ri->data_size,
- ri->data,
- ri->rd_count,
- rd_old)) )
+ if ((NULL != ri) &&
+ (GNUNET_OK != GNUNET_GNSRECORD_records_deserialize (ri->data_size,
+ ri->data,
+ ri->rd_count,
+ rd_old)))
{
GNUNET_break (0);
free_edit_dialog_context (edc);
return;
}
- if ( (GTK_RESPONSE_CANCEL == ret) ||
- (GTK_RESPONSE_DELETE_EVENT == ret) )
+ if ((GTK_RESPONSE_CANCEL == ret) || (GTK_RESPONSE_DELETE_EVENT == ret))
{
free_edit_dialog_context (edc);
return;
}
- if (GNUNET_OK !=
- GNUNET_GNSRECORD_string_to_value (edc->record_type,
- edc->n_value,
- &data, &data_size))
+ if (GNUNET_OK != GNUNET_GNSRECORD_string_to_value (edc->record_type,
+ edc->n_value,
+ &data,
+ &data_size))
{
GNUNET_break (0);
free_edit_dialog_context (edc);
@@ -1121,15 +1069,14 @@ edit_dialog_continuation (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc,
(rd_count - 1) * sizeof (struct GNUNET_GNSRECORD_Data));
rd_new[edc->off] = rd_old[rd_count - 1];
oc = GNUNET_new (struct OperationContext);
- GNUNET_CONTAINER_DLL_insert (oc_head,
- oc_tail,
- oc);
+ GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
oc->qe = GNUNET_NAMESTORE_records_store (namestore,
- pkey,
+ pkey,
edc->name,
- rd_count - 1,
- rd_new,
- &operation_done_cont, oc);
+ rd_count - 1,
+ rd_new,
+ &operation_done_cont,
+ oc);
}
else
{
@@ -1139,47 +1086,44 @@ edit_dialog_continuation (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc,
break;
case GTK_RESPONSE_OK:
/* update model */
- if (0 == strcmp (edc->new_zone_option,
- current_pseudonym))
+ if (0 == strcmp (edc->new_zone_option, current_pseudonym))
{
if (GNUNET_YES == edc->old_record_in_namestore)
{
- struct GNUNET_GNSRECORD_Data rd_new[rd_count];
+ struct GNUNET_GNSRECORD_Data rd_new[rd_count];
- GNUNET_assert (NULL != ri);
- memcpy (rd_new,
+ GNUNET_assert (NULL != ri);
+ memcpy (rd_new,
rd_old,
rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
- rd_new[edc->off] = rd;
- oc = GNUNET_new (struct OperationContext);
- GNUNET_CONTAINER_DLL_insert (oc_head,
- oc_tail,
- oc);
- oc->qe = GNUNET_NAMESTORE_records_store (namestore,
- pkey,
+ rd_new[edc->off] = rd;
+ oc = GNUNET_new (struct OperationContext);
+ GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
+ oc->qe = GNUNET_NAMESTORE_records_store (namestore,
+ pkey,
edc->name,
- rd_count,
- rd_new,
- &operation_done_cont, oc);
+ rd_count,
+ rd_new,
+ &operation_done_cont,
+ oc);
}
else
{
- struct GNUNET_GNSRECORD_Data rd_new[rd_count + 1];
+ struct GNUNET_GNSRECORD_Data rd_new[rd_count + 1];
- memcpy (rd_new,
+ memcpy (rd_new,
rd_old,
rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
- rd_new[rd_count] = rd;
- oc = GNUNET_new (struct OperationContext);
- GNUNET_CONTAINER_DLL_insert (oc_head,
- oc_tail,
- oc);
- oc->qe = GNUNET_NAMESTORE_records_store (namestore,
- pkey,
+ rd_new[rd_count] = rd;
+ oc = GNUNET_new (struct OperationContext);
+ GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
+ oc->qe = GNUNET_NAMESTORE_records_store (namestore,
+ pkey,
edc->name,
- rd_count + 1,
- rd_new,
- &operation_done_cont, oc);
+ rd_count + 1,
+ rd_new,
+ &operation_done_cont,
+ oc);
}
}
else
@@ -1192,47 +1136,42 @@ edit_dialog_continuation (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc,
GNUNET_assert (NULL != edc->ego);
pk = GNUNET_IDENTITY_ego_get_private_key (edc->ego);
GNUNET_assert (NULL != pk);
- GNUNET_GNSRECORD_query_from_private_key (pk,
- edc->name,
- &query);
+ GNUNET_GNSRECORD_query_from_private_key (pk, edc->name, &query);
moc = GNUNET_new (struct MoveOperationContext);
moc->data = data;
moc->rd = rd;
moc->edc = edc;
moc->pk = *pk;
- GNUNET_CONTAINER_DLL_insert (moc_head,
- moc_tail,
- moc);
- moc->it = GNUNET_NAMESTORE_zone_iteration_start (namestore,
- pk,
-
&handle_records_for_merge_error,
- moc,
-
&handle_records_for_merge,
- moc,
-
&handle_records_for_merge_end,
- moc);
+ GNUNET_CONTAINER_DLL_insert (moc_head, moc_tail, moc);
+ moc->it =
+ GNUNET_NAMESTORE_zone_iteration_start (namestore,
+ pk,
+ &handle_records_for_merge_error,
+ moc,
+ &handle_records_for_merge,
+ moc,
+ &handle_records_for_merge_end,
+ moc);
/* zone changed, remove record from old zone, add to new zone! */
if (GNUNET_YES == edc->old_record_in_namestore)
{
- /* remove item from tree view and namestore */
- struct GNUNET_GNSRECORD_Data rd_new[rd_count - 1];
+ /* remove item from tree view and namestore */
+ struct GNUNET_GNSRECORD_Data rd_new[rd_count - 1];
- GNUNET_assert (NULL != ri);
- memcpy (rd_new,
+ GNUNET_assert (NULL != ri);
+ memcpy (rd_new,
rd_old,
(rd_count - 1) * sizeof (struct GNUNET_GNSRECORD_Data));
- rd_new[edc->off] = rd_old[rd_count - 1];
- oc = GNUNET_new (struct OperationContext);
- GNUNET_CONTAINER_DLL_insert (oc_head,
- oc_tail,
- oc);
- oc->qe = GNUNET_NAMESTORE_records_store (namestore,
- pkey,
+ rd_new[edc->off] = rd_old[rd_count - 1];
+ oc = GNUNET_new (struct OperationContext);
+ GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
+ oc->qe = GNUNET_NAMESTORE_records_store (namestore,
+ pkey,
edc->name,
- rd_count - 1,
- rd_new,
- &operation_done_cont, oc);
-
+ rd_count - 1,
+ rd_new,
+ &operation_done_cont,
+ oc);
}
return;
}
@@ -1254,9 +1193,10 @@ edit_dialog_continuation (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc,
static void
edit_dialog_disable_save (struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
{
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_save_button")),
- FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (
+ gtk_builder_get_object (edc->builder,
+
"edit_dialog_save_button")),
+ FALSE);
}
@@ -1268,9 +1208,10 @@ edit_dialog_disable_save (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
static void
edit_dialog_enable_save (struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
{
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_save_button")),
- TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (
+ gtk_builder_get_object (edc->builder,
+
"edit_dialog_save_button")),
+ TRUE);
}
@@ -1289,16 +1230,12 @@ check_validity (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
const gchar *name;
/* check name */
- entry = GTK_EDITABLE (gtk_builder_get_object (edc->builder,
- "edit_dialog_name_entry"));
+ entry = GTK_EDITABLE (
+ gtk_builder_get_object (edc->builder, "edit_dialog_name_entry"));
name = gtk_editable_get_chars (entry, 0, -1);
- if ( (GNUNET_OK !=
- edc->plugin->validate (edc->plugin->cls,
- edc->builder)) ||
- ( (GNUNET_SYSERR ==
- GNUNET_DNSPARSER_check_label (name)) &&
- (0 != strcmp (name,
- GNUNET_GNS_EMPTY_LABEL_AT))) )
+ if ((GNUNET_OK != edc->plugin->validate (edc->plugin->cls, edc->builder)) ||
+ ((GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (name)) &&
+ (0 != strcmp (name, GNUNET_GNS_EMPTY_LABEL_AT))))
{
edit_dialog_disable_save (edc);
return;
@@ -1319,29 +1256,29 @@ setup_zone (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
GtkComboBox *cb;
gchar *name;
- cb = GTK_COMBO_BOX (gtk_builder_get_object (edc->builder,
- "edit_dialog_zone_combobox"));
+ cb = GTK_COMBO_BOX (
+ gtk_builder_get_object (edc->builder, "edit_dialog_zone_combobox"));
- gtk_combo_box_set_model (cb,
- GTK_TREE_MODEL (edc->zone_liststore));
- GNUNET_assert (gtk_tree_model_get_iter_first (GTK_TREE_MODEL
(edc->zone_liststore),
- &iter));
- do {
+ gtk_combo_box_set_model (cb, GTK_TREE_MODEL (edc->zone_liststore));
+ GNUNET_assert (
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (edc->zone_liststore),
+ &iter));
+ do
+ {
gtk_tree_model_get (GTK_TREE_MODEL (edc->zone_liststore),
&iter,
- ZONE_LS_NAME, &name,
+ ZONE_LS_NAME,
+ &name,
-1);
- if (0 == strcmp (name,
- edc->new_zone_option))
+ if (0 == strcmp (name, edc->new_zone_option))
{
g_free (name);
break;
}
g_free (name);
- } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (edc->zone_liststore),
- &iter));
- gtk_combo_box_set_active_iter (cb,
- &iter);
+ } while (
+ gtk_tree_model_iter_next (GTK_TREE_MODEL (edc->zone_liststore), &iter));
+ gtk_combo_box_set_active_iter (cb, &iter);
}
@@ -1352,7 +1289,8 @@ setup_zone (struct GNUNET_GTK_NAMESTORE_PluginEnvironment
*edc)
* @param edc dialog context
*/
static void
-edit_dialog_setup_common_elements (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
+edit_dialog_setup_common_elements (
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
{
GtkComboBox *cb;
GtkListStore *ls;
@@ -1363,45 +1301,56 @@ edit_dialog_setup_common_elements (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment
struct tm *ymd;
GtkCalendar *cal;
- if (GNUNET_YES !=
- edc->old_record_in_namestore)
+ if (GNUNET_YES != edc->old_record_in_namestore)
{
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_delete_button")));
+ gtk_widget_hide (GTK_WIDGET (
+ gtk_builder_get_object (edc->builder, "edit_dialog_delete_button")));
edit_dialog_disable_save (edc);
}
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (edc->builder,
-
"edit_dialog_name_entry")),
- edc->name);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_options_public_checkbutton")),
- edc->n_public);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_options_shadow_checkbutton")),
- edc->n_is_shadow);
+ gtk_entry_set_text (GTK_ENTRY (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_name_entry")),
+ edc->name);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (
+ edc->builder,
+ "edit_dialog_options_public_checkbutton")),
+ edc->n_public);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (
+ edc->builder,
+ "edit_dialog_options_shadow_checkbutton")),
+ edc->n_is_shadow);
if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us == edc->n_exp_time)
{
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_never_radiobutton")),
- TRUE);
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_calendar")));
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_hbox")));
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_relative_combobox")));
- }
- if ( (edc->n_is_relative) &&
- (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != edc->n_exp_time) )
- {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_relative_radiobutton")),
- TRUE);
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_calendar")));
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_hbox")));
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_never_radiobutton")),
+ TRUE);
+ gtk_widget_hide (GTK_WIDGET (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_absolute_calendar")));
+ gtk_widget_hide (GTK_WIDGET (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_absolute_hbox")));
+ gtk_widget_hide (GTK_WIDGET (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_relative_combobox")));
+ }
+ if ((edc->n_is_relative) &&
+ (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != edc->n_exp_time))
+ {
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_relative_radiobutton")),
+ TRUE);
+ gtk_widget_hide (GTK_WIDGET (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_absolute_calendar")));
+ gtk_widget_hide (GTK_WIDGET (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_absolute_hbox")));
rt.rel_value_us = edc->n_exp_time;
}
else
@@ -1409,25 +1358,30 @@ edit_dialog_setup_common_elements (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment
/* select a sane default */
rt = GNUNET_TIME_UNIT_DAYS;
}
- cb = GTK_COMBO_BOX (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_relative_combobox"));
+ cb = GTK_COMBO_BOX (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_relative_combobox"));
ls = GTK_LIST_STORE (gtk_combo_box_get_model (cb));
- gtk_list_store_insert_with_values (ls, &iter,
- -1 /* position: append */,
- 0, GNUNET_STRINGS_relative_time_to_string
(rt,
-
GNUNET_NO),
- -1);
- gtk_combo_box_set_active_iter (cb,
- &iter);
- if ( (! edc->n_is_relative) &&
- (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us != edc->n_exp_time) )
- {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_absolute_radiobutton")),
- TRUE);
-
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_relative_combobox")));
+ gtk_list_store_insert_with_values (
+ ls,
+ &iter,
+ -1 /* position: append */,
+ 0,
+ GNUNET_STRINGS_relative_time_to_string (rt, GNUNET_NO),
+ -1);
+ gtk_combo_box_set_active_iter (cb, &iter);
+ if ((! edc->n_is_relative) &&
+ (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us != edc->n_exp_time))
+ {
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_absolute_radiobutton")),
+ TRUE);
+
+ gtk_widget_hide (GTK_WIDGET (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_relative_combobox")));
at.abs_value_us = edc->n_exp_time;
}
else
@@ -1437,22 +1391,26 @@ edit_dialog_setup_common_elements (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment
}
tp = (time_t) (at.abs_value_us / 1000000LL); /* convert to seconds */
ymd = gmtime (&tp);
- cal = GTK_CALENDAR (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_calendar"));
- gtk_calendar_select_month (cal,
- ymd->tm_mon,
- ymd->tm_year + 1900);
- gtk_calendar_mark_day (cal,
- ymd->tm_mday);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_absolute_hours_spinbutton")),
- (double) ymd->tm_hour);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_absolute_minutes_spinbutton")),
- (double) ymd->tm_min);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_absolute_seconds_spinbutton")),
- (double) ymd->tm_sec);
+ cal = GTK_CALENDAR (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_absolute_calendar"));
+ gtk_calendar_select_month (cal, ymd->tm_mon, ymd->tm_year + 1900);
+ gtk_calendar_mark_day (cal, ymd->tm_mday);
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (
+ gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_absolute_hours_spinbutton")),
+ (double) ymd->tm_hour);
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (gtk_builder_get_object (
+ edc->builder,
+ "edit_dialog_expiration_absolute_minutes_spinbutton")),
+ (double) ymd->tm_min);
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (gtk_builder_get_object (
+ edc->builder,
+ "edit_dialog_expiration_absolute_seconds_spinbutton")),
+ (double) ymd->tm_sec);
}
@@ -1464,7 +1422,8 @@ edit_dialog_setup_common_elements (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment
* @param edc edit dialog to extract data from
*/
static void
-edit_dialog_putes_common_elements (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
+edit_dialog_putes_common_elements (
+ struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc)
{
const char *rt_s;
struct GNUNET_TIME_Relative rt;
@@ -1475,46 +1434,51 @@ edit_dialog_putes_common_elements (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment
struct GNUNET_IDENTITY_Ego *ego;
/* is public flag */
- edc->n_public = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_options_public_checkbutton")));
+ edc->n_public = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_options_public_checkbutton")));
/* is shadow flag */
- edc->n_is_shadow = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_options_shadow_checkbutton")));
+ edc->n_is_shadow = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_options_shadow_checkbutton")));
/* 'forever' expiration time */
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_never_radiobutton"))))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_never_radiobutton"))))
{
edc->n_exp_time = GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us;
- edc->n_is_relative = TRUE; /* doesn't matter, but make sure it is
well-defined anyway */
+ edc->n_is_relative =
+ TRUE; /* doesn't matter, but make sure it is well-defined anyway */
}
/* 'relative' expiration time */
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_relative_radiobutton"))))
- {
- cb = GTK_COMBO_BOX (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_relative_combobox"));
+ if (
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_relative_radiobutton"))))
+ {
+ cb = GTK_COMBO_BOX (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_relative_combobox"));
tm = gtk_combo_box_get_model (cb);
- if (! gtk_combo_box_get_active_iter (cb,
- &iter))
+ if (! gtk_combo_box_get_active_iter (cb, &iter))
{
GNUNET_break (0);
return;
}
- gtk_tree_model_get (tm, &iter,
- 0, &rt_s,
- -1);
+ gtk_tree_model_get (tm, &iter, 0, &rt_s, -1);
GNUNET_break (GNUNET_YES ==
- GNUNET_STRINGS_fancy_time_to_relative (rt_s,
- &rt));
+ GNUNET_STRINGS_fancy_time_to_relative (rt_s, &rt));
edc->n_exp_time = rt.rel_value_us;
edc->n_is_relative = TRUE;
}
/* 'absolute' expiration time */
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_absolute_radiobutton"))))
+ if (
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_absolute_radiobutton"))))
{
guint year;
guint month;
@@ -1525,46 +1489,49 @@ edit_dialog_putes_common_elements (struct
GNUNET_GTK_NAMESTORE_PluginEnvironment
char fancydate[128];
struct GNUNET_TIME_Absolute atime;
- gtk_calendar_get_date (GTK_CALENDAR (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_calendar")),
- &year, &month, &day);
- hour = gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(edc->builder,
-
"edit_dialog_expiration_absolute_hours_spinbutton")));
- minute = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_minutes_spinbutton")));
- second = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_seconds_spinbutton")));
+ gtk_calendar_get_date (GTK_CALENDAR (gtk_builder_get_object (
+ edc->builder,
+ "edit_dialog_expiration_absolute_calendar")),
+ &year,
+ &month,
+ &day);
+ hour = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (edc->builder,
+
"edit_dialog_expiration_absolute_hours_spinbutton")));
+ minute =
+ gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object (
+ edc->builder,
+ "edit_dialog_expiration_absolute_minutes_spinbutton")));
+ second =
+ gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object (
+ edc->builder,
+ "edit_dialog_expiration_absolute_seconds_spinbutton")));
GNUNET_snprintf (fancydate,
- sizeof (fancydate),
- "%u-%u-%u %u:%u:%u",
- (unsigned int) year,
- (unsigned int) month + 1,
- (unsigned int) day,
- (unsigned int) hour,
- (unsigned int) minute,
- (unsigned int) second);
+ sizeof (fancydate),
+ "%u-%u-%u %u:%u:%u",
+ (unsigned int) year,
+ (unsigned int) month + 1,
+ (unsigned int) day,
+ (unsigned int) hour,
+ (unsigned int) minute,
+ (unsigned int) second);
GNUNET_break (GNUNET_OK ==
- GNUNET_STRINGS_fancy_time_to_absolute (fancydate,
- &atime));
+ GNUNET_STRINGS_fancy_time_to_absolute (fancydate, &atime));
edc->n_exp_time = atime.abs_value_us;
edc->n_is_relative = FALSE;
}
/* extract target zone! */
- cb = GTK_COMBO_BOX (gtk_builder_get_object (edc->builder,
- "edit_dialog_zone_combobox"));
+ cb = GTK_COMBO_BOX (
+ gtk_builder_get_object (edc->builder, "edit_dialog_zone_combobox"));
tm = gtk_combo_box_get_model (cb);
- if (! gtk_combo_box_get_active_iter (cb,
- &iter))
+ if (! gtk_combo_box_get_active_iter (cb, &iter))
{
GNUNET_break (0);
}
else
{
- gtk_tree_model_get (tm, &iter,
- ZONE_LS_NAME, &opt,
- ZONE_LS_EGO, &ego,
- -1);
+ gtk_tree_model_get (tm, &iter, ZONE_LS_NAME, &opt, ZONE_LS_EGO, &ego, -1);
if (NULL == opt)
{
GNUNET_break (0);
@@ -1599,8 +1566,7 @@ edit_dialog_response_cb (GtkDialog *dialog,
{
edit_dialog_putes_common_elements (edc);
g_free (edc->n_value);
- edc->n_value = edc->plugin->store (edc->plugin->cls,
- edc->builder);
+ edc->n_value = edc->plugin->store (edc->plugin->cls, edc->builder);
}
gtk_widget_destroy (GTK_WIDGET (edc->dialog));
g_object_unref (edc->builder);
@@ -1637,10 +1603,9 @@ add_symbols (GtkBuilder *builder,
cb = NULL;
if (NULL != edc->plugin->symbols)
{
- for (unsigned int i=0; NULL != edc->plugin->symbols[i].name; i++)
+ for (unsigned int i = 0; NULL != edc->plugin->symbols[i].name; i++)
{
- if (0 == strcmp (handler_name,
- edc->plugin->symbols[i].name))
+ if (0 == strcmp (handler_name, edc->plugin->symbols[i].name))
{
cb = edc->plugin->symbols[i].cb;
break;
@@ -1651,14 +1616,11 @@ add_symbols (GtkBuilder *builder,
{
GModule *m;
- m = g_module_open (NULL,
- 0);
- if (! g_module_symbol (m,
- handler_name,
- (void **) &cb))
+ m = g_module_open (NULL, 0);
+ if (! g_module_symbol (m, handler_name, (void **) &cb))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to find handler `%s'\n"),
+ _ ("Failed to find handler `%s'\n"),
handler_name);
g_module_close (m);
return;
@@ -1666,26 +1628,13 @@ add_symbols (GtkBuilder *builder,
g_module_close (m);
}
if (NULL != connect_object)
- g_signal_connect_object (object,
- signal_name,
- cb,
- connect_object,
- flags);
+ g_signal_connect_object (object, signal_name, cb, connect_object, flags);
else if (flags & G_CONNECT_SWAPPED)
- g_signal_connect_swapped (object,
- signal_name,
- cb,
- user_data);
+ g_signal_connect_swapped (object, signal_name, cb, user_data);
else if (flags & G_CONNECT_AFTER)
- g_signal_connect_after (object,
- signal_name,
- cb,
- user_data);
+ g_signal_connect_after (object, signal_name, cb, user_data);
else
- g_signal_connect (object,
- signal_name,
- cb,
- user_data);
+ g_signal_connect (object, signal_name, cb, user_data);
}
@@ -1701,9 +1650,9 @@ add_symbols (GtkBuilder *builder,
*/
static void
launch_edit_dialog (gint n_type,
- const char *name,
- struct RecordInfo *ri,
- unsigned int off)
+ const char *name,
+ struct RecordInfo *ri,
+ unsigned int off)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc;
@@ -1713,22 +1662,23 @@ launch_edit_dialog (gint n_type,
return;
}
edc = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginEnvironment);
- if ( (NULL != ri) &&
- (off < ri->rd_count) )
+ if ((NULL != ri) && (off < ri->rd_count))
{
struct GNUNET_GNSRECORD_Data rd_old[ri->rd_count];
GNUNET_break (GNUNET_OK ==
- GNUNET_GNSRECORD_records_deserialize (ri->data_size,
- ri->data,
- ri->rd_count,
- rd_old));
+ GNUNET_GNSRECORD_records_deserialize (ri->data_size,
+ ri->data,
+ ri->rd_count,
+ rd_old));
edc->n_value = GNUNET_GNSRECORD_value_to_string (n_type,
- rd_old[off].data,
- rd_old[off].data_size);
+ rd_old[off].data,
+ rd_old[off].data_size);
edc->n_public = (0 == (rd_old[off].flags & GNUNET_GNSRECORD_RF_PRIVATE));
- edc->n_is_relative = (0 != (rd_old[off].flags &
GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION));
- edc->n_is_shadow = (0 != (rd_old[off].flags &
GNUNET_GNSRECORD_RF_SHADOW_RECORD));
+ edc->n_is_relative =
+ (0 != (rd_old[off].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION));
+ edc->n_is_shadow =
+ (0 != (rd_old[off].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD));
edc->n_exp_time = rd_old[off].expiration_time;
edc->old_record_in_namestore = GNUNET_YES;
}
@@ -1745,50 +1695,45 @@ launch_edit_dialog (gint n_type,
GNUNET_asprintf (&edc->liblow,
"libgnunet_plugin_gtk_namestore_%s",
GNUNET_GNSRECORD_number_to_typename (n_type));
- GNUNET_STRINGS_utf8_tolower (edc->liblow,
- edc->liblow);
+ GNUNET_STRINGS_utf8_tolower (edc->liblow, edc->liblow);
edc->plugin = GNUNET_PLUGIN_load (edc->liblow, edc);
if (NULL == edc->plugin)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to load plugin for record type %d\n"),
+ _ ("Failed to load plugin for record type %d\n"),
(int) n_type);
- edit_dialog_continuation (edc,
- GTK_RESPONSE_CANCEL);
+ edit_dialog_continuation (edc, GTK_RESPONSE_CANCEL);
return;
}
if (0 != edc->plugin->record_type)
edc->record_type = edc->plugin->record_type;
else
edc->record_type = n_type;
- edc->builder = GNUNET_GTK_get_new_builder2
(edc->plugin->dialog_glade_filename,
- edc,
- &add_symbols);
+ edc->builder =
+ GNUNET_GTK_get_new_builder2 (edc->plugin->dialog_glade_filename,
+ edc,
+ &add_symbols);
if (NULL == edc->builder)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to load dialog resource `%s'\n"),
+ _ ("Failed to load dialog resource `%s'\n"),
edc->plugin->dialog_glade_filename);
edit_dialog_continuation (edc, GTK_RESPONSE_CANCEL);
return;
}
- if (GNUNET_YES ==
- edc->old_record_in_namestore)
+ if (GNUNET_YES == edc->old_record_in_namestore)
{
- edc->plugin->load (edc->plugin->cls,
- edc->n_value,
- edc->builder);
+ edc->plugin->load (edc->plugin->cls, edc->n_value, edc->builder);
}
- edc->dialog = GTK_DIALOG (gtk_builder_get_object (edc->builder,
-
edc->plugin->dialog_widget_name));
+ edc->dialog = GTK_DIALOG (
+ gtk_builder_get_object (edc->builder, edc->plugin->dialog_widget_name));
g_signal_connect (edc->dialog,
"response",
G_CALLBACK (&edit_dialog_response_cb),
edc);
edit_dialog_setup_common_elements (edc);
setup_zone (edc);
- gtk_dialog_set_default_response (edc->dialog,
- GTK_RESPONSE_OK);
+ gtk_dialog_set_default_response (edc->dialog, GTK_RESPONSE_OK);
gtk_window_present (GTK_WINDOW (edc->dialog));
}
@@ -1802,25 +1747,23 @@ launch_edit_dialog (gint n_type,
* @return #GNUNET_OK if this is allowed
*/
static int
-check_permissions (struct RecordInfo *ri,
- guint n_type)
+check_permissions (struct RecordInfo *ri, guint n_type)
{
struct GNUNET_GNSRECORD_Data rd[ri->rd_count];
GNUNET_break (GNUNET_OK ==
- GNUNET_GNSRECORD_records_deserialize (ri->data_size,
- ri->data,
- ri->rd_count,
- rd));
- if (GNUNET_OK !=
- check_record_permitted (ri->rd_count,
- rd,
- n_type))
- {
- show_error_message (_("Record combination not permitted"),
- _("Given the existing records, adding a new record of
this type is not allowed.\n"
- "CNAME and PKEY records cannot co-exist with other
records.\n"
- "NS records in GNS can only co-exist with A and AAAA
records.\n"));
+ GNUNET_GNSRECORD_records_deserialize (ri->data_size,
+ ri->data,
+ ri->rd_count,
+ rd));
+ if (GNUNET_OK != check_record_permitted (ri->rd_count, rd, n_type))
+ {
+ show_error_message (
+ _ ("Record combination not permitted"),
+ _ (
+ "Given the existing records, adding a new record of this type is not
allowed.\n"
+ "CNAME and PKEY records cannot co-exist with other records.\n"
+ "NS records in GNS can only co-exist with A and AAAA records.\n"));
return GNUNET_NO;
}
return GNUNET_OK;
@@ -1846,19 +1789,19 @@ gnunet_namestore_gtk_popup_edit_button_activate_cb
(GtkWidget *widget,
struct GNUNET_HashCode name_hash;
sel = gtk_tree_view_get_selection (tv);
- if (! gtk_tree_selection_get_selected (sel,
- NULL,
- &iter))
+ if (! gtk_tree_selection_get_selected (sel, NULL, &iter))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "No row selected\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No row selected\n");
return;
}
- gtk_tree_model_get (tm, &iter,
- GNS_TREESTORE_COL_NAME, &n_name,
- GNS_TREESTORE_COL_RECORD_TYPE, &n_type,
- GNS_TREESTORE_COL_RECORD_OFFSET, &off,
- -1);
+ /* clang-format off */
+ gtk_tree_model_get (tm,
+ &iter,
+ GNS_TREESTORE_COL_NAME, &n_name,
+ GNS_TREESTORE_COL_RECORD_TYPE, &n_type,
+ GNS_TREESTORE_COL_RECORD_OFFSET, &off,
+ -1);
+ /* clang-format off */
if (NULL == n_name)
{
GNUNET_break (0);
@@ -2188,26 +2131,23 @@ gnunet_namestore_gtk_treeview_key_press_event_cb
(GtkWidget *widget,
NULL,
&iter))
return TRUE; /* nothing selected */
- gtk_tree_model_get (tm, &iter,
- GNS_TREESTORE_COL_NOT_DUMMY_ROW, ¬_dummy,
- GNS_TREESTORE_COL_NAME, &name,
- -1);
+ /* clang-format off */
+ gtk_tree_model_get (tm,
+ &iter,
+ GNS_TREESTORE_COL_NOT_DUMMY_ROW, ¬_dummy,
+ GNS_TREESTORE_COL_NAME, &name,
+ -1);
+ /* clang-format on */
if (GNUNET_NO == not_dummy)
{
g_free (name);
return TRUE; /* do not delete the dummy line */
}
- GNUNET_CRYPTO_hash (name,
- strlen (name),
- &name_hash);
- ri = GNUNET_CONTAINER_multihashmap_get (n2r,
- &name_hash);
+ GNUNET_CRYPTO_hash (name, strlen (name), &name_hash);
+ ri = GNUNET_CONTAINER_multihashmap_get (n2r, &name_hash);
GNUNET_assert (NULL != ri);
- if ( (gtk_tree_model_iter_parent (tm,
- &parent,
- &iter)) &&
- (ri->rd_count > 0) )
+ if ((gtk_tree_model_iter_parent (tm, &parent, &iter)) && (ri->rd_count > 0))
{
struct GNUNET_GNSRECORD_Data rd_old[ri->rd_count];
struct GNUNET_GNSRECORD_Data rd_new[ri->rd_count - 1];
@@ -2222,21 +2162,23 @@ gnunet_namestore_gtk_treeview_key_press_event_cb
(GtkWidget *widget,
/* Removing a single record */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Removing single record for name `%s'\n",
- name);
+ "Removing single record for name `%s'\n",
+ name);
GNUNET_break (GNUNET_OK ==
- GNUNET_GNSRECORD_records_deserialize (ri->data_size,
- ri->data,
- ri->rd_count,
- rd_old));
+ GNUNET_GNSRECORD_records_deserialize (ri->data_size,
+ ri->data,
+ ri->rd_count,
+ rd_old));
+ /* clang-format off */
gtk_tree_model_get (tm, &iter,
- GNS_TREESTORE_COL_RECORD_TYPE, &n_type,
- GNS_TREESTORE_COL_IS_PUBLIC, &n_public,
- GNS_TREESTORE_COL_EXP_TIME, &n_exp_time,
- GNS_TREESTORE_COL_EXP_TIME_IS_REL, &n_is_relative,
- GNS_TREESTORE_COL_IS_SHADOW, &n_is_shadow,
- GNS_TREESTORE_COL_VAL_AS_STR, &n_value,
- -1);
+ GNS_TREESTORE_COL_RECORD_TYPE, &n_type,
+ GNS_TREESTORE_COL_IS_PUBLIC, &n_public,
+ GNS_TREESTORE_COL_EXP_TIME, &n_exp_time,
+ GNS_TREESTORE_COL_EXP_TIME_IS_REL, &n_is_relative,
+ GNS_TREESTORE_COL_IS_SHADOW, &n_is_shadow,
+ GNS_TREESTORE_COL_VAL_AS_STR, &n_value,
+ -1);
+ /* clang-format on */
/* valid name */
if (n_public)
rd.flags = GNUNET_GNSRECORD_RF_NONE;
@@ -2248,11 +2190,10 @@ gnunet_namestore_gtk_treeview_key_press_event_cb
(GtkWidget *widget,
rd.flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD;
rd.record_type = n_type;
rd.expiration_time = n_exp_time;
- if (GNUNET_OK !=
- GNUNET_GNSRECORD_string_to_value (n_type,
- n_value,
- (void**) &rd.data,
- &rd.data_size))
+ if (GNUNET_OK != GNUNET_GNSRECORD_string_to_value (n_type,
+ n_value,
+ (void **) &rd.data,
+ &rd.data_size))
{
/* can't remove, value invalid */
GNUNET_assert (0);
@@ -2260,11 +2201,9 @@ gnunet_namestore_gtk_treeview_key_press_event_cb
(GtkWidget *widget,
g_free (name);
return TRUE;
}
- for (off=0;off<ri->rd_count;off++)
- if (GNUNET_YES ==
- GNUNET_GNSRECORD_records_cmp (&rd,
- &rd_old[off]))
- break;
+ for (off = 0; off < ri->rd_count; off++)
+ if (GNUNET_YES == GNUNET_GNSRECORD_records_cmp (&rd, &rd_old[off]))
+ break;
GNUNET_assert (off != ri->rd_count);
memcpy (rd_new,
rd_old,
@@ -2273,11 +2212,12 @@ gnunet_namestore_gtk_treeview_key_press_event_cb
(GtkWidget *widget,
oc = GNUNET_new (struct OperationContext);
GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
oc->qe = GNUNET_NAMESTORE_records_store (namestore,
- pkey,
+ pkey,
name,
- ri->rd_count - 1,
- rd_new,
- &operation_done_cont, oc);
+ ri->rd_count - 1,
+ rd_new,
+ &operation_done_cont,
+ oc);
g_free (n_value);
}
else
@@ -2285,10 +2225,12 @@ gnunet_namestore_gtk_treeview_key_press_event_cb
(GtkWidget *widget,
oc = GNUNET_new (struct OperationContext);
GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
oc->qe = GNUNET_NAMESTORE_records_store (namestore,
- pkey,
+ pkey,
name,
- 0, NULL,
- &operation_done_cont, oc);
+ 0,
+ NULL,
+ &operation_done_cont,
+ oc);
}
g_free (name);
@@ -2312,9 +2254,7 @@ gnunet_namestore_gtk_public_key_copy_button_clicked_cb
(GtkButton *button,
if (NULL == pkey)
return;
cb = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
- gtk_clipboard_set_text (cb,
- GNUNET_GNSRECORD_z2s (&pubkey),
- -1);
+ gtk_clipboard_set_text (cb, GNUNET_GNSRECORD_z2s (&pubkey), -1);
}
@@ -2328,20 +2268,24 @@ static void
zone_sync_proc (void *cls)
{
(void) cls;
- gtk_tree_view_set_model (tv,
- tm);
+ gtk_tree_view_set_model (tv, tm);
#if HAVE_QRENCODE_H
setup_qrcode ();
gtk_widget_show (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_image")));
- gtk_widget_show (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_saveas_button")));
- gtk_widget_show (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_vseparator")));
+ gtk_widget_show (
+ GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_saveas_button")));
+ gtk_widget_show (
+ GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_vseparator")));
#else
gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_image")));
- gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_saveas_button")));
- gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_vseparator")));
+ gtk_widget_hide (
+ GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_saveas_button")));
+ gtk_widget_hide (
+ GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_vseparator")));
#endif
gtk_widget_hide (GTK_WIDGET (status_label));
- gtk_widget_show (GTK_WIDGET (get_object
("gnunet_namestore_gtk_scrolledwindow")));
+ gtk_widget_show (
+ GTK_WIDGET (get_object ("gnunet_namestore_gtk_scrolledwindow")));
gtk_widget_show (GTK_WIDGET (zone_combo_box));
}
@@ -2360,12 +2304,16 @@ zone_iteration_error (void *cls)
#if HAVE_QRENCODE_H
setup_qrcode ();
gtk_widget_hide (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_image")));
- gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_saveas_button")));
- gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_vseparator")));
+ gtk_widget_hide (
+ GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_saveas_button")));
+ gtk_widget_hide (
+ GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_vseparator")));
#else
gtk_widget_show (GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_image")));
- gtk_widget_show (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_saveas_button")));
- gtk_widget_show (GTK_WIDGET (get_object
("gnunet_namestore_gtk_qr_vseparator")));
+ gtk_widget_show (
+ GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_saveas_button")));
+ gtk_widget_show (
+ GTK_WIDGET (get_object ("gnunet_namestore_gtk_qr_vseparator")));
#endif
}
@@ -2384,18 +2332,11 @@ free_ri (struct RecordInfo *ri)
struct GNUNET_HashCode name_hash;
path = gtk_tree_row_reference_get_path (ri->rr);
- GNUNET_assert (gtk_tree_model_get_iter (tm,
- &iter_name,
- path));
+ GNUNET_assert (gtk_tree_model_get_iter (tm, &iter_name, path));
gtk_tree_path_free (path);
- gtk_tree_store_remove (ts,
- &iter_name);
- GNUNET_CRYPTO_hash (ri->name,
- strlen (ri->name),
- &name_hash);
- release_ri (NULL,
- &name_hash,
- ri);
+ gtk_tree_store_remove (ts, &iter_name);
+ GNUNET_CRYPTO_hash (ri->name, strlen (ri->name), &name_hash);
+ release_ri (NULL, &name_hash, ri);
}
@@ -2411,10 +2352,10 @@ free_ri (struct RecordInfo *ri)
*/
static void
zone_iteration_proc (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
- const char *name,
- unsigned int rd_count,
- const struct GNUNET_GNSRECORD_Data *rd)
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
+ const char *name,
+ unsigned int rd_count,
+ const struct GNUNET_GNSRECORD_Data *rd)
{
GtkTreeRowReference *rr;
GtkTreePath *path;
@@ -2434,54 +2375,43 @@ zone_iteration_proc (void *cls,
GtkTreePath *sel_path;
(void) cls;
- if (0 != memcmp (zone_key,
- pkey,
- sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
+ if (0 !=
+ memcmp (zone_key, pkey, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
{
GNUNET_break (0);
return;
- }
- GNUNET_NAMESTORE_zone_monitor_next (zmon,
- 1);
- if ( (GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (name)) &&
- (0 != strcmp (name, GNUNET_GNS_EMPTY_LABEL_AT)) )
+ }
+ GNUNET_NAMESTORE_zone_monitor_next (zmon, 1);
+ if ((GNUNET_SYSERR == GNUNET_DNSPARSER_check_label (name)) &&
+ (0 != strcmp (name, GNUNET_GNS_EMPTY_LABEL_AT)))
{
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Got invalid record name `%s' from namestore\n"),
- name);
+ _ ("Got invalid record name `%s' from namestore\n"),
+ name);
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Zone iteration result `%s', %u records\n",
- name, rd_count);
- GNUNET_CRYPTO_hash (name,
- strlen (name),
- &name_hash);
+ "Zone iteration result `%s', %u records\n",
+ name,
+ rd_count);
+ GNUNET_CRYPTO_hash (name, strlen (name), &name_hash);
sel = gtk_tree_view_get_selection (tv);
- if (gtk_tree_selection_get_selected (sel,
- NULL,
- &sel_iter))
- sel_path = gtk_tree_model_get_path (tm,
- &sel_iter);
+ if (gtk_tree_selection_get_selected (sel, NULL, &sel_iter))
+ sel_path = gtk_tree_model_get_path (tm, &sel_iter);
else
sel_path = NULL;
- ri = GNUNET_CONTAINER_multihashmap_get (n2r,
- &name_hash);
+ ri = GNUNET_CONTAINER_multihashmap_get (n2r, &name_hash);
if (NULL != ri)
{
rr = ri->rr;
path = gtk_tree_row_reference_get_path (rr);
- GNUNET_assert (gtk_tree_model_get_iter (tm,
- &iter_name,
- path));
+ GNUNET_assert (gtk_tree_model_get_iter (tm, &iter_name, path));
gtk_tree_path_free (path);
/* remove all records, we'll re-add those that are left next */
- if (gtk_tree_model_iter_children (tm,
- &iter_record,
- &iter_name))
- while (gtk_tree_store_remove (ts,
- &iter_record)) ;
+ if (gtk_tree_model_iter_children (tm, &iter_record, &iter_name))
+ while (gtk_tree_store_remove (ts, &iter_record))
+ ;
}
else
{
@@ -2490,28 +2420,35 @@ zone_iteration_proc (void *cls,
&iter_name,
NULL,
-1,
- GNS_TREESTORE_COL_NAME, name,
- GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
- GNS_TREESTORE_COL_RECORD_TYPE,
GNUNET_GNSRECORD_TYPE_ANY,
- GNS_TREESTORE_COL_RECORD_TYPE_AS_STR,
_(NEW_RECORD_STR),
- GNS_TREESTORE_COL_IS_RECORD_ROW, TRUE,
- GNS_TREESTORE_COL_NOT_DUMMY_ROW, FALSE,
- GNS_TREESTORE_COL_TYPE_IS_EDITABLE,
TRUE,
- GNS_TREESTORE_COL_RECORD_OFFSET,
UINT_MAX,
+ GNS_TREESTORE_COL_NAME,
+ name,
+ GNS_TREESTORE_COL_NAME_IS_VISIBLE,
+ TRUE,
+ GNS_TREESTORE_COL_RECORD_TYPE,
+ GNUNET_GNSRECORD_TYPE_ANY,
+ GNS_TREESTORE_COL_RECORD_TYPE_AS_STR,
+ _ (NEW_RECORD_STR),
+ GNS_TREESTORE_COL_IS_RECORD_ROW,
+ TRUE,
+ GNS_TREESTORE_COL_NOT_DUMMY_ROW,
+ FALSE,
+ GNS_TREESTORE_COL_TYPE_IS_EDITABLE,
+ TRUE,
+ GNS_TREESTORE_COL_RECORD_OFFSET,
+ UINT_MAX,
-1);
- path = gtk_tree_model_get_path (tm,
- &iter_name);
- rr = gtk_tree_row_reference_new (tm,
- path);
+ path = gtk_tree_model_get_path (tm, &iter_name);
+ rr = gtk_tree_row_reference_new (tm, path);
ri->rr = rr;
ri->name = GNUNET_strdup (name);
gtk_tree_path_free (path);
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_put (n2r,
- &name_hash,
- ri,
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+ GNUNET_CONTAINER_multihashmap_put (
+ n2r,
+ &name_hash,
+ ri,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
}
if (0 == rd_count)
{
@@ -2522,35 +2459,35 @@ zone_iteration_proc (void *cls,
/* update record info serialized version of the records */
GNUNET_free_non_null (ri->data);
ri->rd_count = rd_count;
- ri->data_size = GNUNET_GNSRECORD_records_get_size (rd_count,
- rd);
+ ri->data_size = GNUNET_GNSRECORD_records_get_size (rd_count, rd);
if (0 != ri->data_size)
ri->data = GNUNET_malloc (ri->data_size);
- GNUNET_break (ri->data_size ==
- GNUNET_GNSRECORD_records_serialize (rd_count,
- rd,
- ri->data_size,
- ri->data));
+ GNUNET_break (
+ ri->data_size ==
+ GNUNET_GNSRECORD_records_serialize (rd_count, rd, ri->data_size,
ri->data));
/* Append elements for records in tree view */
- for (unsigned int c = 0; c < rd_count; c ++)
+ for (unsigned int c = 0; c < rd_count; c++)
{
if (GNUNET_GNSRECORD_TYPE_NICK == rd[c].record_type)
continue;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Record %u: type %u flags %u expiration %llu data_size %u\n",
- c,
+ "Record %u: type %u flags %u expiration %llu data_size %u\n",
+ c,
rd[c].record_type,
rd[c].flags,
- (unsigned long long) rd[c].expiration_time,
- (unsigned int) rd[c].data_size);
+ (unsigned long long) rd[c].expiration_time,
+ (unsigned int) rd[c].data_size);
/* Set public toggle */
- is_public = ((rd[c].flags & GNUNET_GNSRECORD_RF_PRIVATE) !=
GNUNET_GNSRECORD_RF_PRIVATE);
+ is_public = ((rd[c].flags & GNUNET_GNSRECORD_RF_PRIVATE) !=
+ GNUNET_GNSRECORD_RF_PRIVATE);
/* Set shadow toggle */
- is_shadow = ((rd[c].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD) ==
GNUNET_GNSRECORD_RF_SHADOW_RECORD);
+ is_shadow = ((rd[c].flags & GNUNET_GNSRECORD_RF_SHADOW_RECORD) ==
+ GNUNET_GNSRECORD_RF_SHADOW_RECORD);
/* Expiration time */
- time_is_relative = (0 != (rd[c].flags &
GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION));
+ time_is_relative =
+ (0 != (rd[c].flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION));
if (time_is_relative)
{
@@ -2576,38 +2513,49 @@ zone_iteration_proc (void *cls,
GNUNET_asprintf (&val, "%s", EXPIRE_INVALID_STRING);
if (NULL != GNUNET_GNSRECORD_number_to_typename (rd[c].record_type))
- type_str = strdup (GNUNET_GNSRECORD_number_to_typename
(rd[c].record_type));
+ type_str =
+ strdup (GNUNET_GNSRECORD_number_to_typename (rd[c].record_type));
else
- GNUNET_asprintf (&type_str,
- "%s",
- EXPIRE_INVALID_STRING);
- if ( (0 == strcmp (name,
- GNUNET_GNS_EMPTY_LABEL_AT)) &&
- (GNUNET_GNSRECORD_TYPE_NICK == rd[c].record_type) &&
- (NULL == current_pseudonym) )
+ GNUNET_asprintf (&type_str, "%s", EXPIRE_INVALID_STRING);
+ if ((0 == strcmp (name, GNUNET_GNS_EMPTY_LABEL_AT)) &&
+ (GNUNET_GNSRECORD_TYPE_NICK == rd[c].record_type) &&
+ (NULL == current_pseudonym))
{
#if HAVE_QRENCODE_H
setup_qrcode ();
#endif
}
gtk_tree_store_insert_with_values (ts,
- &iter_record ,
+ &iter_record,
&iter_name,
-1,
- GNS_TREESTORE_COL_NAME, name,
- GNS_TREESTORE_COL_NAME_IS_VISIBLE, FALSE,
- GNS_TREESTORE_COL_RECORD_TYPE,
rd[c].record_type,
- GNS_TREESTORE_COL_RECORD_TYPE_AS_STR,
type_str,
- GNS_TREESTORE_COL_IS_PUBLIC, is_public,
- GNS_TREESTORE_COL_IS_SHADOW, is_shadow,
- GNS_TREESTORE_COL_EXP_TIME, exp_t,
- GNS_TREESTORE_COL_EXP_TIME_AS_STR, exp,
- GNS_TREESTORE_COL_EXP_TIME_IS_REL,
time_is_relative,
- GNS_TREESTORE_COL_VAL_AS_STR, val,
- GNS_TREESTORE_COL_IS_RECORD_ROW, TRUE,
- GNS_TREESTORE_COL_NOT_DUMMY_ROW, TRUE,
- GNS_TREESTORE_COL_RECORD_OFFSET, (guint)
c,
- -1);
+ GNS_TREESTORE_COL_NAME,
+ name,
+ GNS_TREESTORE_COL_NAME_IS_VISIBLE,
+ FALSE,
+ GNS_TREESTORE_COL_RECORD_TYPE,
+ rd[c].record_type,
+ GNS_TREESTORE_COL_RECORD_TYPE_AS_STR,
+ type_str,
+ GNS_TREESTORE_COL_IS_PUBLIC,
+ is_public,
+ GNS_TREESTORE_COL_IS_SHADOW,
+ is_shadow,
+ GNS_TREESTORE_COL_EXP_TIME,
+ exp_t,
+ GNS_TREESTORE_COL_EXP_TIME_AS_STR,
+ exp,
+ GNS_TREESTORE_COL_EXP_TIME_IS_REL,
+ time_is_relative,
+ GNS_TREESTORE_COL_VAL_AS_STR,
+ val,
+ GNS_TREESTORE_COL_IS_RECORD_ROW,
+ TRUE,
+ GNS_TREESTORE_COL_NOT_DUMMY_ROW,
+ TRUE,
+ GNS_TREESTORE_COL_RECORD_OFFSET,
+ (guint) c,
+ -1);
GNUNET_free (type_str);
GNUNET_free (val);
}
@@ -2627,8 +2575,7 @@ zone_iteration_proc (void *cls,
* @param ego ego handle
*/
static void
-load_zone (const char *name,
- struct GNUNET_IDENTITY_Ego *ego)
+load_zone (const char *name, struct GNUNET_IDENTITY_Ego *ego)
{
char *label;
GtkTreeIter toplevel;
@@ -2642,33 +2589,39 @@ load_zone (const char *name,
}
GNUNET_free_non_null (current_pseudonym);
current_pseudonym = NULL;
- gtk_tree_view_set_model (tv,
- NULL);
+ gtk_tree_view_set_model (tv, NULL);
if (NULL == name)
return; /* empty zone */
current_pseudonym = GNUNET_strdup (name);
pkey = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
*pkey = *GNUNET_IDENTITY_ego_get_private_key (ego);
- GNUNET_CRYPTO_ecdsa_key_get_public (pkey,
- &pubkey);
- label = g_markup_printf_escaped ("<b>%s</b>",
- GNUNET_GNSRECORD_z2s (&pubkey));
- gtk_label_set_markup (GTK_LABEL (get_object
("gnunet_namestore_gtk_zone_label")),
- label);
+ GNUNET_CRYPTO_ecdsa_key_get_public (pkey, &pubkey);
+ label = g_markup_printf_escaped ("<b>%s</b>", GNUNET_GNSRECORD_z2s
(&pubkey));
+ gtk_label_set_markup (GTK_LABEL (
+ get_object ("gnunet_namestore_gtk_zone_label")),
+ label);
g_free (label);
/* Append a top level row and leave it empty */
gtk_tree_store_insert_with_values (ts,
&toplevel,
NULL,
-1,
- GNS_TREESTORE_COL_NAME, _(NEW_NAME_STR),
- GNS_TREESTORE_COL_NAME_IS_VISIBLE, TRUE,
- GNS_TREESTORE_COL_RECORD_TYPE,
GNUNET_DNSPARSER_TYPE_A,
- GNS_TREESTORE_COL_IS_RECORD_ROW, FALSE,
- GNS_TREESTORE_COL_NOT_DUMMY_ROW, FALSE,
- GNS_TREESTORE_COL_TYPE_IS_EDITABLE, FALSE,
- GNS_TREESTORE_COL_NAME_IS_EDITABLE, TRUE,
- GNS_TREESTORE_COL_RECORD_OFFSET, UINT_MAX,
+ GNS_TREESTORE_COL_NAME,
+ _ (NEW_NAME_STR),
+ GNS_TREESTORE_COL_NAME_IS_VISIBLE,
+ TRUE,
+ GNS_TREESTORE_COL_RECORD_TYPE,
+ GNUNET_DNSPARSER_TYPE_A,
+ GNS_TREESTORE_COL_IS_RECORD_ROW,
+ FALSE,
+ GNS_TREESTORE_COL_NOT_DUMMY_ROW,
+ FALSE,
+ GNS_TREESTORE_COL_TYPE_IS_EDITABLE,
+ FALSE,
+ GNS_TREESTORE_COL_NAME_IS_EDITABLE,
+ TRUE,
+ GNS_TREESTORE_COL_RECORD_OFFSET,
+ UINT_MAX,
-1);
/* Load zone from namestore! */
#if HAVE_QRENCODE_H
@@ -2680,12 +2633,11 @@ load_zone (const char *name,
GNUNET_YES,
&zone_iteration_error,
NULL,
- &zone_iteration_proc,
+ &zone_iteration_proc,
NULL,
- &zone_sync_proc,
- NULL);
- GNUNET_NAMESTORE_zone_monitor_next (zmon,
- NAMESTORE_MONITOR_WINDOW_SIZE - 1);
+ &zone_sync_proc,
+ NULL);
+ GNUNET_NAMESTORE_zone_monitor_next (zmon, NAMESTORE_MONITOR_WINDOW_SIZE - 1);
}
@@ -2703,32 +2655,29 @@ fresh_label (const char *label)
GtkTreeIter iter;
struct GNS_TopLevelDomain *tld;
- if ( (NULL == label) ||
- (0 == strlen (label)) )
- return _("Name must not be empty\n");
- if (GNUNET_OK !=
- GNUNET_DNSPARSER_check_label (label))
- return _("Name is not a syntactically valid DNS label\n");
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (zone_liststore),
- &iter))
+ if ((NULL == label) || (0 == strlen (label)))
+ return _ ("Name must not be empty\n");
+ if (GNUNET_OK != GNUNET_DNSPARSER_check_label (label))
+ return _ ("Name is not a syntactically valid DNS label\n");
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (zone_liststore), &iter))
{
- do {
+ do
+ {
char *name;
gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore),
&iter,
- ZONE_LS_NAME, &name,
+ ZONE_LS_NAME,
+ &name,
-1);
- if (0 == strcasecmp (name,
- label))
- return _("Name already exists in the list\n");
- } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (zone_liststore),
- &iter));
+ if (0 == strcasecmp (name, label))
+ return _ ("Name already exists in the list\n");
+ } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (zone_liststore),
&iter));
}
for (tld = tld_head; NULL != tld; tld = tld->next)
- if (0 == strcasecmp (tld->tld,
- label))
- return _("Name is assigned in the configuration file (see [GNS]
section)\n");
+ if (0 == strcasecmp (tld->tld, label))
+ return _ (
+ "Name is assigned in the configuration file (see [GNS] section)\n");
return NULL;
}
@@ -2741,17 +2690,14 @@ fresh_label (const char *label)
* @param emsg error message, used in status bar
*/
static void
-iop_cont (void *cls,
- const char *emsg)
+iop_cont (void *cls, const char *emsg)
{
GtkEntry *entry;
iop = NULL;
entry = GTK_ENTRY (get_object ("gnunet_namestore_gtk_zone_entry"));
- gtk_widget_set_sensitive (main_window,
- TRUE);
- gtk_label_set_markup (status_label,
- emsg);
+ gtk_widget_set_sensitive (main_window, TRUE);
+ gtk_label_set_markup (status_label, emsg);
gtk_entry_grab_focus_without_selecting (entry);
}
@@ -2775,24 +2721,25 @@ cleanup_task (void *cls)
}
GNUNET_GTK_main_loop_quit (ml);
gtk_widget_show (GTK_WIDGET (status_label));
- gtk_widget_hide (GTK_WIDGET (get_object
("gnunet_namestore_gtk_scrolledwindow")));
+ gtk_widget_hide (
+ GTK_WIDGET (get_object ("gnunet_namestore_gtk_scrolledwindow")));
while (NULL != (oc = oc_head))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("A pending namestore operation was not transmitted to the
namestore.\n"));
- GNUNET_CONTAINER_DLL_remove (oc_head,
- oc_tail,
- oc);
+ GNUNET_log (
+ GNUNET_ERROR_TYPE_ERROR,
+ _ (
+ "A pending namestore operation was not transmitted to the
namestore.\n"));
+ GNUNET_CONTAINER_DLL_remove (oc_head, oc_tail, oc);
GNUNET_NAMESTORE_cancel (oc->qe);
GNUNET_free (oc);
}
while (NULL != (moc = moc_head))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("A pending namestore operation was not transmitted to the
namestore.\n"));
- GNUNET_CONTAINER_DLL_remove (moc_head,
- moc_tail,
- moc);
+ GNUNET_log (
+ GNUNET_ERROR_TYPE_ERROR,
+ _ (
+ "A pending namestore operation was not transmitted to the
namestore.\n"));
+ GNUNET_CONTAINER_DLL_remove (moc_head, moc_tail, moc);
if (NULL != moc->it)
GNUNET_NAMESTORE_zone_iteration_stop (moc->it);
free_edit_dialog_context (moc->edc);
@@ -2832,18 +2779,14 @@ cleanup_task (void *cls)
}
if (NULL != n2r)
{
- GNUNET_CONTAINER_multihashmap_iterate (n2r,
- &release_ri,
- NULL);
+ GNUNET_CONTAINER_multihashmap_iterate (n2r, &release_ri, NULL);
GNUNET_CONTAINER_multihashmap_destroy (n2r);
n2r = NULL;
}
GNUNET_assert (NULL == zmon);
while (NULL != (tld = tld_head))
{
- GNUNET_CONTAINER_DLL_remove (tld_head,
- tld_tail,
- tld);
+ GNUNET_CONTAINER_DLL_remove (tld_head, tld_tail, tld);
GNUNET_free (tld->tld);
GNUNET_free (tld);
}
@@ -2854,8 +2797,7 @@ cleanup_task (void *cls)
* Callback invoked if the application is supposed to exit.
*/
void
-gnunet_namestore_gtk_quit_cb (GObject * object,
- gpointer user_data)
+gnunet_namestore_gtk_quit_cb (GObject *object, gpointer user_data)
{
GNUNET_SCHEDULER_shutdown ();
}
@@ -2875,11 +2817,8 @@ update_nick_record (const char *new_name)
unsigned int rd_count;
struct OperationContext *oc;
- GNUNET_CRYPTO_hash ("+",
- 1,
- &hc);
- ri = GNUNET_CONTAINER_multihashmap_get (n2r,
- &hc);
+ GNUNET_CRYPTO_hash ("+", 1, &hc);
+ ri = GNUNET_CONTAINER_multihashmap_get (n2r, &hc);
if (NULL == ri)
rd_count = 0;
else
@@ -2898,16 +2837,13 @@ update_nick_record (const char *new_name)
ri->data,
rd_count,
rd_old));
- memcpy (rd_new,
- rd_old,
- sizeof (struct GNUNET_GNSRECORD_Data) * rd_count);
- for (off=0;off<rd_count;off++)
+ memcpy (rd_new, rd_old, sizeof (struct GNUNET_GNSRECORD_Data) * rd_count);
+ for (off = 0; off < rd_count; off++)
if (GNUNET_GNSRECORD_TYPE_NICK == rd_new[off].record_type)
break;
if (off == rd_count)
total++;
- if ( (NULL == new_name) ||
- (0 == strlen (new_name)) )
+ if ((NULL == new_name) || (0 == strlen (new_name)))
{
rd_new[off] = rd_new[rd_count - 1];
total--;
@@ -2916,14 +2852,13 @@ update_nick_record (const char *new_name)
{
rd_new[off].record_type = GNUNET_GNSRECORD_TYPE_NICK;
rd_new[off].expiration_time = nick_expiration_time.rel_value_us;
- rd_new[off].flags = GNUNET_GNSRECORD_RF_PRIVATE |
GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
+ rd_new[off].flags =
+ GNUNET_GNSRECORD_RF_PRIVATE | GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
rd_new[off].data_size = strlen (new_name) + 1;
rd_new[off].data = new_name;
}
oc = GNUNET_new (struct OperationContext);
- GNUNET_CONTAINER_DLL_insert (oc_head,
- oc_tail,
- oc);
+ GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
oc->qe = GNUNET_NAMESTORE_records_store (namestore,
pkey,
GNUNET_GNS_EMPTY_LABEL_AT,
@@ -2950,28 +2885,19 @@ handle_zone_entry_edit ()
entry = GTK_ENTRY (get_object ("gnunet_namestore_gtk_zone_entry"));
if (NULL == current_pseudonym)
{
- gtk_entry_set_text (entry,
- "");
+ gtk_entry_set_text (entry, "");
return;
}
new_name = gtk_entry_get_text (entry);
if (NULL != (emsg = fresh_label (new_name)))
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "%s",
- emsg);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "%s", emsg);
gtk_widget_error_bell (GTK_WIDGET (entry));
- gtk_entry_set_icon_from_icon_name (entry,
- GTK_ENTRY_ICON_PRIMARY,
- "error");
- gtk_entry_set_icon_tooltip_text (entry,
- GTK_ENTRY_ICON_PRIMARY,
- emsg);
+ gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_PRIMARY, "error");
+ gtk_entry_set_icon_tooltip_text (entry, GTK_ENTRY_ICON_PRIMARY, emsg);
return;
}
- gtk_entry_set_icon_from_icon_name (entry,
- GTK_ENTRY_ICON_PRIMARY,
- NULL);
+ gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_PRIMARY, NULL);
update_nick_record (new_name);
#if HAVE_QRENCODE_H
@@ -2979,12 +2905,11 @@ handle_zone_entry_edit ()
#endif
gtk_list_store_set (GTK_LIST_STORE (zone_liststore),
&zone_iter,
- ZONE_LS_NAME, new_name,
+ ZONE_LS_NAME,
+ new_name,
-1);
- gtk_label_set_markup (status_label,
- _("Renaming zone"));
- gtk_widget_set_sensitive (main_window,
- FALSE);
+ gtk_label_set_markup (status_label, _ ("Renaming zone"));
+ gtk_widget_set_sensitive (main_window, FALSE);
GNUNET_assert (NULL == iop);
iop = GNUNET_IDENTITY_rename (identity,
current_pseudonym,
@@ -3004,7 +2929,7 @@ handle_zone_entry_edit ()
*/
void
gnunet_namestore_gtk_zone_combobox_changed_cb (GtkComboBox *widget,
- gpointer user_data)
+ gpointer user_data)
{
GtkTreeIter iter;
struct GNUNET_IDENTITY_Ego *ego;
@@ -3012,26 +2937,25 @@ gnunet_namestore_gtk_zone_combobox_changed_cb
(GtkComboBox *widget,
GtkEntry *entry;
(void) user_data;
- if (! gtk_combo_box_get_active_iter (zone_combo_box,
- &iter))
+ if (! gtk_combo_box_get_active_iter (zone_combo_box, &iter))
{
handle_zone_entry_edit ();
return;
}
zone_iter = iter;
entry = GTK_ENTRY (get_object ("gnunet_namestore_gtk_zone_entry"));
- gtk_entry_set_icon_from_icon_name (entry,
- GTK_ENTRY_ICON_PRIMARY,
- NULL);
+ gtk_entry_set_icon_from_icon_name (entry, GTK_ENTRY_ICON_PRIMARY, NULL);
+ /* clang-format off */
gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore),
&iter,
ZONE_LS_NAME, &name,
ZONE_LS_EGO, &ego,
-1);
- gtk_widget_set_sensitive (GTK_WIDGET (get_object
("gnunet_namestore_gtk_zone_del_button")),
+ /* clang-format on */
+ gtk_widget_set_sensitive (GTK_WIDGET (get_object (
+ "gnunet_namestore_gtk_zone_del_button")),
TRUE);
- load_zone (name,
- ego);
+ load_zone (name, ego);
}
@@ -3076,14 +3000,10 @@ identity_cb (void *cls,
GtkTreeIter iter;
GtkTreePath *path;
- if ( (NULL == ego) &&
- (NULL == name) &&
- (NULL == ctx) )
+ if ((NULL == ego) && (NULL == name) && (NULL == ctx))
{
/* end of initial iteration, trigger loading selected zone */
- gnunet_namestore_gtk_zone_combobox_changed_cb
- (zone_combo_box,
- ml);
+ gnunet_namestore_gtk_zone_combobox_changed_cb (zone_combo_box, ml);
return;
}
rr = *ctx;
@@ -3091,30 +3011,27 @@ identity_cb (void *cls,
{
/* new identity, add to list */
GNUNET_assert (NULL != name);
+ /* clang-format off */
gtk_list_store_insert_with_values (zone_liststore,
&iter, 0,
ZONE_LS_NAME, name,
ZONE_LS_EGO, ego,
-1);
- gtk_combo_box_set_active_iter
- (zone_combo_box,
- &iter);
- gtk_widget_set_sensitive (GTK_WIDGET (zone_combo_box),
- TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (get_object
("gnunet_namestore_gtk_zone_entry")),
+ /* clang-format on */
+ gtk_combo_box_set_active_iter (zone_combo_box, &iter);
+ gtk_widget_set_sensitive (GTK_WIDGET (zone_combo_box), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (
+ get_object
("gnunet_namestore_gtk_zone_entry")),
TRUE);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (zone_liststore),
- &iter);
- rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (zone_liststore),
- path);
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (zone_liststore), &iter);
+ rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (zone_liststore), path);
*ctx = rr;
gtk_tree_path_free (path);
return;
}
path = gtk_tree_row_reference_get_path (rr);
- GNUNET_break (gtk_tree_model_get_iter (GTK_TREE_MODEL (zone_liststore),
- &iter,
- path));
+ GNUNET_break (
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (zone_liststore), &iter, path));
gtk_tree_path_free (path);
if (NULL == name)
{
@@ -3123,24 +3040,21 @@ identity_cb (void *cls,
/* identity was removed, remove from list */
GNUNET_free_non_null (current_pseudonym);
current_pseudonym = NULL;
- gtk_list_store_remove (zone_liststore,
- &iter);
- if (! gtk_combo_box_get_active_iter (zone_combo_box,
- &act_iter))
+ gtk_list_store_remove (zone_liststore, &iter);
+ if (! gtk_combo_box_get_active_iter (zone_combo_box, &act_iter))
{
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (zone_liststore),
&act_iter))
{
/* make sure combo box remains selected if possible */
- gtk_combo_box_set_active (zone_combo_box,
- 0);
+ gtk_combo_box_set_active (zone_combo_box, 0);
}
else
{
/* make combo box insensitive if nothing can be selected */
- gtk_widget_set_sensitive (GTK_WIDGET (zone_combo_box),
- FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (get_object
("gnunet_namestore_gtk_zone_entry")),
+ gtk_widget_set_sensitive (GTK_WIDGET (zone_combo_box), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (get_object (
+ "gnunet_namestore_gtk_zone_entry")),
FALSE);
clear_zone_view ();
}
@@ -3148,10 +3062,7 @@ identity_cb (void *cls,
return;
}
/* identity was renamed, rename in model */
- gtk_list_store_set (zone_liststore,
- &iter,
- ZONE_LS_NAME, name,
- -1);
+ gtk_list_store_set (zone_liststore, &iter, ZONE_LS_NAME, name, -1);
}
@@ -3165,7 +3076,7 @@ identity_cb (void *cls,
*/
void
gnunet_namestore_gtk_zone_add_button_clicked_cb (GtkButton *button,
- gpointer user_data)
+ gpointer user_data)
{
const char *label;
GtkEntry *entry;
@@ -3173,16 +3084,10 @@ gnunet_namestore_gtk_zone_add_button_clicked_cb
(GtkButton *button,
(void) user_data;
entry = GTK_ENTRY (get_object ("gnunet_namestore_gtk_zone_add_entry"));
label = gtk_entry_get_text (entry);
- gtk_label_set_markup (status_label,
- _("Creating zone"));
- gtk_widget_set_sensitive (main_window,
- FALSE);
- iop = GNUNET_IDENTITY_create (identity,
- label,
- &iop_cont,
- NULL);
- gtk_entry_set_text (entry,
- "");
+ gtk_label_set_markup (status_label, _ ("Creating zone"));
+ gtk_widget_set_sensitive (main_window, FALSE);
+ iop = GNUNET_IDENTITY_create (identity, label, &iop_cont, NULL);
+ gtk_entry_set_text (entry, "");
}
@@ -3195,9 +3100,7 @@ gnunet_namestore_gtk_zone_add_button_clicked_cb
(GtkButton *button,
* @return #GNUNET_OK (continue to iterate)
*/
static int
-delete_records (void *cls,
- const struct GNUNET_HashCode *key,
- void *value)
+delete_records (void *cls, const struct GNUNET_HashCode *key, void *value)
{
struct RecordInfo *ri = value;
struct OperationContext *oc;
@@ -3205,9 +3108,7 @@ delete_records (void *cls,
if (0 != ri->rd_count)
{
oc = GNUNET_new (struct OperationContext);
- GNUNET_CONTAINER_DLL_insert (oc_head,
- oc_tail,
- oc);
+ GNUNET_CONTAINER_DLL_insert (oc_head, oc_tail, oc);
oc->qe = GNUNET_NAMESTORE_records_store (namestore,
pkey,
ri->name,
@@ -3230,25 +3131,20 @@ delete_records (void *cls,
*/
void
gnunet_namestore_gtk_zone_del_button_clicked_cb (GtkButton *button,
- gpointer user_data)
+ gpointer user_data)
{
char *pseu;
(void) user_data;
pseu = current_pseudonym;
current_pseudonym = NULL;
- GNUNET_CONTAINER_multihashmap_iterate (n2r,
- &delete_records,
- NULL);
+ GNUNET_CONTAINER_multihashmap_iterate (n2r, &delete_records, NULL);
gtk_tree_store_clear (ts);
- gtk_widget_set_sensitive (GTK_WIDGET (get_object
("gnunet_namestore_gtk_zone_del_button")),
+ gtk_widget_set_sensitive (GTK_WIDGET (get_object (
+ "gnunet_namestore_gtk_zone_del_button")),
FALSE);
- gtk_widget_set_sensitive (main_window,
- FALSE);
- iop = GNUNET_IDENTITY_delete (identity,
- pseu,
- &iop_cont,
- NULL);
+ gtk_widget_set_sensitive (main_window, FALSE);
+ iop = GNUNET_IDENTITY_delete (identity, pseu, &iop_cont, NULL);
GNUNET_free (pseu);
}
@@ -3263,13 +3159,14 @@ gnunet_namestore_gtk_zone_del_button_clicked_cb
(GtkButton *button,
*/
void
gnunet_namestore_gtk_zone_add_entry_changed_cb (GtkEditable *editable,
- gpointer user_data)
+ gpointer user_data)
{
const char *label;
(void) user_data;
label = gtk_entry_get_text (GTK_ENTRY (editable));
- gtk_widget_set_sensitive (GTK_WIDGET (get_object
("gnunet_namestore_gtk_zone_add_button")),
+ gtk_widget_set_sensitive (GTK_WIDGET (get_object (
+ "gnunet_namestore_gtk_zone_add_button")),
NULL == fresh_label (label));
}
@@ -3294,23 +3191,19 @@ read_service_conf (void *cls,
if (option[0] != '.')
return;
if (GNUNET_OK !=
- GNUNET_STRINGS_string_to_data (value,
- strlen (value),
- &pk,
- sizeof (pk)))
+ GNUNET_STRINGS_string_to_data (value, strlen (value), &pk, sizeof (pk)))
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
section,
option,
- _("Properly base32-encoded public key
required"));
+ _ (
+ "Properly base32-encoded public key
required"));
return;
}
tld = GNUNET_new (struct GNS_TopLevelDomain);
tld->tld = GNUNET_strdup (&option[1]);
tld->pkey = pk;
- GNUNET_CONTAINER_DLL_insert (tld_head,
- tld_tail,
- tld);
+ GNUNET_CONTAINER_DLL_insert (tld_head, tld_tail, tld);
}
@@ -3330,11 +3223,10 @@ run (void *cls)
"gns",
&read_service_conf,
NULL);
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_time (cfg,
- "gnunet-namestore-gtk",
- "NICK_EXPIRATION",
- &nick_expiration_time))
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg,
+ "gnunet-namestore-gtk",
+ "NICK_EXPIRATION",
+ &nick_expiration_time))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"gnunet-namestore-gtk",
@@ -3342,9 +3234,7 @@ run (void *cls)
GNUNET_SCHEDULER_shutdown ();
return;
}
- if (GNUNET_OK !=
- GNUNET_GTK_main_loop_build_window (ml,
- NULL))
+ if (GNUNET_OK != GNUNET_GTK_main_loop_build_window (ml, NULL))
{
GNUNET_SCHEDULER_shutdown ();
return;
@@ -3353,34 +3243,29 @@ run (void *cls)
GNUNET_GTK_setup_nls ();
main_window = GTK_WIDGET (get_object ("gnunet_namestore_gtk_dialog"));
- main_window = GNUNET_GTK_plug_me ("GNUNET_NAMESTORE_GTK_PLUG",
- main_window);
+ main_window = GNUNET_GTK_plug_me ("GNUNET_NAMESTORE_GTK_PLUG", main_window);
status_label = GTK_LABEL (get_object ("gnunet_namestore_gtk_status_label"));
- zone_combo_box = GTK_COMBO_BOX (get_object
("gnunet_namestore_gtk_zone_combobox"));
+ zone_combo_box =
+ GTK_COMBO_BOX (get_object ("gnunet_namestore_gtk_zone_combobox"));
namestore = GNUNET_NAMESTORE_connect (cfg);
if (NULL == namestore)
{
- label = g_markup_printf_escaped (_("<b><big>Failed to connect to
namestore</b></big>"));
- gtk_label_set_markup (status_label,
- label);
+ label = g_markup_printf_escaped (
+ _ ("<b><big>Failed to connect to namestore</b></big>"));
+ gtk_label_set_markup (status_label, label);
g_free (label);
- GNUNET_SCHEDULER_add_shutdown (&cleanup_task,
- NULL);
+ GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL);
return;
}
ts = GTK_TREE_STORE (get_object ("gnunet_namestore_gtk_treestore"));
tv = GTK_TREE_VIEW (get_object ("gnunet_namestore_gtk_treeview"));
zone_liststore = GTK_LIST_STORE (get_object ("zone_liststore"));
tm = GTK_TREE_MODEL (ts);
- n2r = GNUNET_CONTAINER_multihashmap_create (128,
- GNUNET_NO);
- identity = GNUNET_IDENTITY_connect (cfg,
- &identity_cb,
- NULL);
+ n2r = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
+ identity = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL);
gtk_widget_show (main_window);
gtk_window_present (GTK_WINDOW (main_window));
- GNUNET_SCHEDULER_add_shutdown (&cleanup_task,
- NULL);
+ GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL);
}
@@ -3394,14 +3279,14 @@ run (void *cls)
int
main (int argc, char *const *argv)
{
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
+ struct GNUNET_GETOPT_CommandLineOption options[] =
{GNUNET_GETOPT_OPTION_END};
int ret;
if (GNUNET_OK ==
GNUNET_GTK_main_loop_start ("gnunet-namestore-gtk",
- "gnunet-namestore-gtk", argc, argv,
+ "gnunet-namestore-gtk",
+ argc,
+ argv,
options,
"gnunet_namestore_gtk_main_window.glade",
&run))
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet-gtk] branch master updated: clang-format off experiments,
gnunet <=