[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet-gtk] branch master updated: clang-format all C code
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet-gtk] branch master updated: clang-format all C code. Add symlink of clang-format to bootstrap. |
Date: |
Wed, 15 May 2019 17:52:01 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnunet-gtk.
The following commit(s) were added to refs/heads/master by this push:
new 51cf7682 clang-format all C code. Add symlink of clang-format to
bootstrap.
51cf7682 is described below
commit 51cf7682ce12732f75365e2766f481132b3baaee
Author: ng0 <address@hidden>
AuthorDate: Wed May 15 15:51:29 2019 +0000
clang-format all C code. Add symlink of clang-format to bootstrap.
---
.gitignore | 1 +
bootstrap | 3 +
src/conversation/gnunet-conversation-gtk.c | 48 +-
src/conversation/gnunet-conversation-gtk.h | 6 +-
src/conversation/gnunet-conversation-gtk_about.c | 2 +-
.../gnunet-conversation-gtk_contacts.c | 130 +-
src/conversation/gnunet-conversation-gtk_egos.c | 79 +-
.../gnunet-conversation-gtk_get_label.c | 84 +-
.../gnunet-conversation-gtk_get_label.h | 3 +-
src/conversation/gnunet-conversation-gtk_history.c | 20 +-
src/conversation/gnunet-conversation-gtk_import.c | 154 +-
src/conversation/gnunet-conversation-gtk_import.h | 6 +-
src/conversation/gnunet-conversation-gtk_log.c | 28 +-
src/conversation/gnunet-conversation-gtk_log.h | 6 +-
src/conversation/gnunet-conversation-gtk_phone.c | 473 ++--
.../gnunet-conversation-gtk_visibility.c | 17 +-
src/conversation/gnunet-conversation-gtk_zones.c | 64 +-
src/conversation/gnunet-conversation-gtk_zones.h | 2 +-
src/fs/gnunet-fs-gtk.c | 428 ++--
src/fs/gnunet-fs-gtk.h | 80 +-
src/fs/gnunet-fs-gtk_about.c | 2 +-
src/fs/gnunet-fs-gtk_anonymity-widgets.c | 16 +-
src/fs/gnunet-fs-gtk_anonymity-widgets.h | 3 +-
src/fs/gnunet-fs-gtk_common.c | 145 +-
src/fs/gnunet-fs-gtk_common.h | 33 +-
src/fs/gnunet-fs-gtk_download-save-as.c | 105 +-
src/fs/gnunet-fs-gtk_download-save-as.h | 1 -
src/fs/gnunet-fs-gtk_event-handler.c | 1760 ++++++++-------
src/fs/gnunet-fs-gtk_event-handler.h | 15 +-
src/fs/gnunet-fs-gtk_main-window-connection.c | 16 +-
...net-fs-gtk_main-window-meta-data-context-menu.c | 47 +-
src/fs/gnunet-fs-gtk_main-window-search.c | 269 ++-
src/fs/gnunet-fs-gtk_main-window-view-toggles.c | 26 +-
src/fs/gnunet-fs-gtk_open-directory.c | 49 +-
src/fs/gnunet-fs-gtk_open-uri.c | 83 +-
src/fs/gnunet-fs-gtk_open-uri.h | 3 +-
src/fs/gnunet-fs-gtk_publish-dialog.c | 2344 ++++++++++++--------
src/fs/gnunet-fs-gtk_publish-edit-dialog.c | 649 +++---
src/fs/gnunet-fs-gtk_publish-edit-dialog.h | 4 +-
src/fs/gnunet-fs-gtk_unindex.c | 245 +-
src/fs/gnunet-fs-gtk_unindex.h | 15 +-
src/fs/metatypes.c | 407 ++--
src/include/gnunet_gtk.h | 19 +-
src/include/gnunet_gtk_namestore_plugin.h | 14 +-
src/lib/about.c | 24 +-
src/lib/animations.c | 64 +-
src/lib/eventloop.c | 190 +-
src/lib/glade.c | 43 +-
src/lib/misc.c | 23 +-
src/lib/nls.c | 19 +-
src/lib/os_installation.c | 27 +-
src/lib/trayicon.c | 39 +-
src/namestore/gnunet-namestore-gtk_edit.c | 46 +-
src/namestore/plugin_gtk_namestore_a.c | 38 +-
src/namestore/plugin_gtk_namestore_aaaa.c | 33 +-
src/namestore/plugin_gtk_namestore_box.c | 89 +-
src/namestore/plugin_gtk_namestore_cname.c | 40 +-
src/namestore/plugin_gtk_namestore_gns2dns.c | 63 +-
src/namestore/plugin_gtk_namestore_leho.c | 40 +-
src/namestore/plugin_gtk_namestore_mx.c | 63 +-
src/namestore/plugin_gtk_namestore_phone.c | 63 +-
src/namestore/plugin_gtk_namestore_pkey.c | 45 +-
src/namestore/plugin_gtk_namestore_ptr.c | 37 +-
src/namestore/plugin_gtk_namestore_soa.c | 134 +-
src/namestore/plugin_gtk_namestore_srv.c | 141 +-
src/namestore/plugin_gtk_namestore_template.c | 20 +-
src/namestore/plugin_gtk_namestore_tlsa.c | 548 ++---
src/namestore/plugin_gtk_namestore_txt.c | 30 +-
src/namestore/plugin_gtk_namestore_vpn.c | 83 +-
src/peerinfo/gnunet-peerinfo-gtk-about.c | 2 +-
src/peerinfo/gnunet-peerinfo-gtk-flags.c | 3 +-
src/peerinfo/gnunet-peerinfo-gtk-flags.h | 1 -
src/peerinfo/gnunet-peerinfo-gtk.c | 601 ++---
src/setup/gnunet-setup-datacache-config.c | 16 +-
src/setup/gnunet-setup-datacache-plugins.c | 12 +-
src/setup/gnunet-setup-datastore-config.c | 10 +-
src/setup/gnunet-setup-datastore-plugins.c | 9 +-
src/setup/gnunet-setup-exit-services.c | 252 ++-
src/setup/gnunet-setup-exit-services.h | 60 +-
src/setup/gnunet-setup-hostlist-editing.c | 37 +-
src/setup/gnunet-setup-hostlist-server.c | 27 +-
src/setup/gnunet-setup-namestore-config.c | 2 +-
src/setup/gnunet-setup-namestore-plugins.c | 11 +-
src/setup/gnunet-setup-options.c | 1861 ++++++++--------
src/setup/gnunet-setup-options.h | 24 +-
src/setup/gnunet-setup-transport-plugins.c | 27 +-
src/setup/gnunet-setup-transport-test.c | 49 +-
src/setup/gnunet-setup-transport-udp.c | 1 -
src/setup/gnunet-setup.c | 198 +-
src/setup/gnunet-setup.h | 12 +-
src/statistics/functions.c | 341 +--
src/statistics/functions.h | 4 +-
src/statistics/gnunet-statistics-gtk-about.c | 2 +-
src/statistics/gnunet-statistics-gtk.c | 129 +-
src/statistics/gtk_statistics.c | 173 +-
src/statistics/gtk_statistics.h | 37 +-
src/statistics/gtk_statistics_demo.c | 28 +-
src/statistics/statistics.c | 178 +-
98 files changed, 7204 insertions(+), 6749 deletions(-)
diff --git a/.gitignore b/.gitignore
index ca7ed81c..9d89a5eb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,3 +41,4 @@ gnunet-setup.desktop
gnunet_gtk_config.h
gnunet_gtk_config.h.in
build-aux/
+.clang-format
diff --git a/bootstrap b/bootstrap
index d9209e00..52219cd0 100755
--- a/bootstrap
+++ b/bootstrap
@@ -3,6 +3,9 @@
echo "Removing folder 'libltdl'..."
rm -rf libltdl
+# Install clang format symlink (if possible)
+ln -s contrib/clang-format .clang-format 2> /dev/null
+
echo "checking for libtoolize / libtool... "
# This is more portable than `which' but comes with
diff --git a/src/conversation/gnunet-conversation-gtk.c
b/src/conversation/gnunet-conversation-gtk.c
index ca8912a7..6bd08e35 100644
--- a/src/conversation/gnunet-conversation-gtk.c
+++ b/src/conversation/gnunet-conversation-gtk.c
@@ -107,8 +107,7 @@ shutdown_task (void *cls)
* @param user_data unused
*/
void
-gnunet_conversation_gtk_quit_cb (GObject *object,
- gpointer user_data)
+gnunet_conversation_gtk_quit_cb (GObject *object, gpointer user_data)
{
GNUNET_SCHEDULER_shutdown ();
}
@@ -130,23 +129,19 @@ run (void *cls)
return;
cfg = GNUNET_CONFIGURATION_dup (GNUNET_GTK_main_loop_get_configuration (ml));
if (0 != line)
- GNUNET_CONFIGURATION_set_value_number (cfg,
- "CONVERSATION",
- "LINE",
- line);
+ GNUNET_CONFIGURATION_set_value_number (cfg, "CONVERSATION", "LINE", line);
GNUNET_GTK_set_icon_search_path ();
GNUNET_GTK_setup_nls ();
/* setup main window */
- main_window = GTK_WIDGET (GCG_get_main_window_object
- ("gnunet_conversation_gtk_main_window"));
- main_window = GNUNET_GTK_plug_me ("GNUNET_CONVERSATION_GTK_PLUG",
- main_window);
+ main_window = GTK_WIDGET (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_main_window"));
+ main_window =
+ GNUNET_GTK_plug_me ("GNUNET_CONVERSATION_GTK_PLUG", main_window);
gtk_window_maximize (GTK_WINDOW (main_window));
/* make GUI visible */
gtk_widget_show (main_window);
gtk_window_present (GTK_WINDOW (main_window));
- GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
- NULL);
+ GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
GCG_HISTORY_init ();
GCG_ZONES_init (ego_name);
GCG_EGOS_init (ego_name);
@@ -171,25 +166,26 @@ run (void *cls)
int
main (int argc, char *const *argv)
{
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_option_uint ('p',
- "phone",
- "LINE",
- gettext_noop ("sets the LINE to use for the
phone"),
- &line),
- GNUNET_GETOPT_option_string ('e',
- "ego",
- "EGO",
- gettext_noop ("select ego to use"),
- &ego_name),
- GNUNET_GETOPT_OPTION_END
- };
+ struct GNUNET_GETOPT_CommandLineOption options[] =
+ {GNUNET_GETOPT_option_uint ('p',
+ "phone",
+ "LINE",
+ gettext_noop (
+ "sets the LINE to use for the phone"),
+ &line),
+ GNUNET_GETOPT_option_string ('e',
+ "ego",
+ "EGO",
+ gettext_noop ("select ego to use"),
+ &ego_name),
+ GNUNET_GETOPT_OPTION_END};
int ret;
if (GNUNET_OK !=
GNUNET_GTK_main_loop_start ("gnunet-conversation-gtk",
"GTK GUI for conversation",
- argc, argv,
+ argc,
+ argv,
options,
"gnunet_conversation_gtk_main_window.glade",
&run))
diff --git a/src/conversation/gnunet-conversation-gtk.h
b/src/conversation/gnunet-conversation-gtk.h
index c0c80ffa..b45d938c 100644
--- a/src/conversation/gnunet-conversation-gtk.h
+++ b/src/conversation/gnunet-conversation-gtk.h
@@ -65,8 +65,7 @@ GCG_get_main_window_object (const char *name);
* @param ... arguments for the format string
*/
void
-GCG_update_status (const gchar *message,
- ...);
+GCG_update_status (const gchar *message, ...);
/**
@@ -76,7 +75,6 @@ GCG_update_status (const gchar *message,
* @param ... arguments for the format string
*/
void
-GCG_log (const char *message,
- ...);
+GCG_log (const char *message, ...);
#endif
diff --git a/src/conversation/gnunet-conversation-gtk_about.c
b/src/conversation/gnunet-conversation-gtk_about.c
index f71fb49b..3a379aeb 100644
--- a/src/conversation/gnunet-conversation-gtk_about.c
+++ b/src/conversation/gnunet-conversation-gtk_about.c
@@ -31,7 +31,7 @@
* This displays an about window
*/
void
-gnunet_conversation_gtk_about_imagemenuitem_activate_cb (GtkWidget * dummy,
+gnunet_conversation_gtk_about_imagemenuitem_activate_cb (GtkWidget *dummy,
gpointer data)
{
GNUNET_GTK_display_about ("gnunet_conversation_gtk_about_window.glade");
diff --git a/src/conversation/gnunet-conversation-gtk_contacts.c
b/src/conversation/gnunet-conversation-gtk_contacts.c
index e131847b..3b157297 100644
--- a/src/conversation/gnunet-conversation-gtk_contacts.c
+++ b/src/conversation/gnunet-conversation-gtk_contacts.c
@@ -101,10 +101,11 @@ static GtkWidget *b_paste;
* @param user_data builder context (unused)
*/
void
-gnunet_conversation_gtk_contact_list_treeview_row_activated_cb (GtkTreeView
*tree_view,
- GtkTreePath
*path,
-
GtkTreeViewColumn *column,
- gpointer
user_data)
+gnunet_conversation_gtk_contact_list_treeview_row_activated_cb (
+ GtkTreeView *tree_view,
+ GtkTreePath *path,
+ GtkTreeViewColumn *column,
+ gpointer user_data)
{
char *address;
gchar *type;
@@ -114,38 +115,31 @@
gnunet_conversation_gtk_contact_list_treeview_row_activated_cb (GtkTreeView *tr
const char *tld;
GNUNET_assert (NULL != GCG_ZONES_get_selected_zone (&tld));
- if (! gtk_tree_model_get_iter (contacts_treemodel,
- &iter,
- path))
+ if (! gtk_tree_model_get_iter (contacts_treemodel, &iter, path))
{
GNUNET_break (0);
return;
}
gtk_tree_model_get (contacts_treemodel,
&iter,
- CONTACTS_LS_NAME, &name,
- CONTACTS_LS_TYPE, &type,
+ CONTACTS_LS_NAME,
+ &name,
+ CONTACTS_LS_TYPE,
+ &type,
-1);
if (0 == strcmp (type, "PKEY"))
{
- GNUNET_asprintf (&address,
- "phone.%s.%s",
- name,
- tld);
+ GNUNET_asprintf (&address, "phone.%s.%s", name, tld);
}
else
{
- GNUNET_asprintf (&address,
- "%s.%s",
- name,
- tld);
+ GNUNET_asprintf (&address, "%s.%s", name, tld);
}
g_free (name);
g_free (type);
- address_entry = GTK_ENTRY (GCG_get_main_window_object
- ("gnunet_conversation_gtk_address_entry"));
- gtk_entry_set_text (address_entry,
- address);
+ address_entry = GTK_ENTRY (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_address_entry"));
+ gtk_entry_set_text (address_entry, address);
GNUNET_free (address);
}
@@ -175,8 +169,7 @@ display_record (void *cls,
gboolean is_public;
char *value;
- GNUNET_NAMESTORE_zone_monitor_next (zone_mon,
- 1);
+ GNUNET_NAMESTORE_zone_monitor_next (zone_mon, 1);
do_display = FALSE;
value = NULL;
for (unsigned int i = 0; i < rd_len; i++)
@@ -207,8 +200,8 @@ display_record (void *cls,
rd[i].data_size);
if (NULL == value)
{
- GNUNET_break (0);
- return;
+ GNUNET_break (0);
+ return;
}
is_public = (0 == (rd[i].flags & GNUNET_GNSRECORD_RF_PRIVATE));
break;
@@ -222,23 +215,21 @@ display_record (void *cls,
/* check if exists, if so, update or remove */
update = FALSE;
- if (gtk_tree_model_get_iter_first (contacts_treemodel,
- &iter))
+ if (gtk_tree_model_get_iter_first (contacts_treemodel, &iter))
{
do
{
gtk_tree_model_get (contacts_treemodel,
&iter,
- CONTACTS_LS_NAME, &lname,
+ CONTACTS_LS_NAME,
+ &lname,
-1);
- if (0 == strcmp (lname,
- rname))
+ if (0 == strcmp (lname, rname))
{
if (! do_display)
{
/* remove */
- gtk_list_store_remove (contacts_liststore,
- &iter);
+ gtk_list_store_remove (contacts_liststore, &iter);
g_free (lname);
GNUNET_free_non_null (value);
return;
@@ -248,9 +239,7 @@ display_record (void *cls,
break;
}
g_free (lname);
- }
- while (gtk_tree_model_iter_next (contacts_treemodel,
- &iter));
+ } while (gtk_tree_model_iter_next (contacts_treemodel, &iter));
}
/* insert new record */
@@ -260,15 +249,19 @@ display_record (void *cls,
return;
}
if (! update)
- gtk_list_store_append (contacts_liststore,
- &iter);
+ gtk_list_store_append (contacts_liststore, &iter);
gtk_list_store_set (contacts_liststore,
&iter,
- CONTACTS_LS_NAME, rname,
- CONTACTS_LS_TYPE, type,
- CONTACTS_LS_VALUE, value,
- CONTACTS_LS_IS_PUBLIC, is_public,
- CONTACTS_LS_IS_EDITABLE, FALSE /* FIXME: editing to be
implemented */,
+ CONTACTS_LS_NAME,
+ rname,
+ CONTACTS_LS_TYPE,
+ type,
+ CONTACTS_LS_VALUE,
+ value,
+ CONTACTS_LS_IS_PUBLIC,
+ is_public,
+ CONTACTS_LS_IS_EDITABLE,
+ FALSE /* FIXME: editing to be implemented */,
-1);
GNUNET_free (value);
}
@@ -359,9 +352,7 @@ gnunet_conversation_gtk_contacts_zone_combobox_changed_cb
(GtkComboBox *widget,
* @param data NULL
*/
static void
-handle_paste_data (GtkClipboard *clipboard,
- const gchar *text,
- gpointer data)
+handle_paste_data (GtkClipboard *clipboard, const gchar *text, gpointer data)
{
char *name;
char *slash;
@@ -369,35 +360,27 @@ handle_paste_data (GtkClipboard *clipboard,
if (NULL == text)
return; /* clipboard empty */
- if (0 != strncasecmp ("gnunet://gns/",
- text,
- strlen ("gnunet://gns/")))
+ if (0 != strncasecmp ("gnunet://gns/", text, strlen ("gnunet://gns/")))
{
- GCG_log (_("Invalid URI `%s'\n"),
- text);
+ GCG_log (_ ("Invalid URI `%s'\n"), text);
return;
}
name = GNUNET_strdup (&text[strlen ("gnunet://gns/")]);
slash = strchr (name, '/');
- if ( (NULL != slash) &&
- ('\0' != slash[1]) )
+ if ((NULL != slash) && ('\0' != slash[1]))
{
*slash = '\0';
label = &slash[1];
- if (GNUNET_OK !=
- GNUNET_DNSPARSER_check_label (label))
+ if (GNUNET_OK != GNUNET_DNSPARSER_check_label (label))
{
- GCG_log (_("Invalid label `%s' in URI `%s'\n"),
- label,
- text);
+ GCG_log (_ ("Invalid label `%s' in URI `%s'\n"), label, text);
GNUNET_free (name);
return;
}
else
{
/* got a label already, try to use it */
- GSC_get_label_for_name (name,
- label);
+ GSC_get_label_for_name (name, label);
GNUNET_free (name);
return;
}
@@ -405,8 +388,7 @@ handle_paste_data (GtkClipboard *clipboard,
if (NULL != slash)
*slash = '\0';
/* don't have a label yet, need to prompt! */
- GSC_get_label_for_name (name,
- NULL);
+ GSC_get_label_for_name (name, NULL);
GNUNET_free (name);
}
@@ -420,14 +402,12 @@ handle_paste_data (GtkClipboard *clipboard,
*/
void
gnunet_conversation_gtk_contacts_paste_button_clicked_cb (GtkButton *button,
- gpointer user_data)
+ gpointer user_data)
{
GtkClipboard *cb;
cb = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
- gtk_clipboard_request_text (cb,
- &handle_paste_data,
- NULL);
+ gtk_clipboard_request_text (cb, &handle_paste_data, NULL);
}
@@ -437,21 +417,17 @@ gnunet_conversation_gtk_contacts_paste_button_clicked_cb
(GtkButton *button,
void
GCG_CONTACTS_init ()
{
- contacts_treeview
- = GTK_WIDGET (GCG_get_main_window_object
- ("gnunet_conversation_gtk_contact_list_treeview"));
-#if GTK_CHECK_VERSION(3,10,0)
+ contacts_treeview = GTK_WIDGET (GCG_get_main_window_object (
+ "gnunet_conversation_gtk_contact_list_treeview"));
+#if GTK_CHECK_VERSION(3, 10, 0)
gtk_tree_view_set_activate_on_single_click (GTK_TREE_VIEW
(contacts_treeview),
TRUE);
#endif
- contacts_liststore
- = GTK_LIST_STORE (GCG_get_main_window_object
- ("gnunet_conversation_gtk_contacts_liststore"));
- contacts_treemodel
- = GTK_TREE_MODEL (contacts_liststore);
- b_paste = GTK_WIDGET (GCG_get_main_window_object
- ("gnunet_conversation_gtk_contacts_paste_button"));
-
+ contacts_liststore = GTK_LIST_STORE (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_contacts_liststore"));
+ contacts_treemodel = GTK_TREE_MODEL (contacts_liststore);
+ b_paste = GTK_WIDGET (GCG_get_main_window_object (
+ "gnunet_conversation_gtk_contacts_paste_button"));
}
diff --git a/src/conversation/gnunet-conversation-gtk_egos.c
b/src/conversation/gnunet-conversation-gtk_egos.c
index 716d7cdf..08801ced 100644
--- a/src/conversation/gnunet-conversation-gtk_egos.c
+++ b/src/conversation/gnunet-conversation-gtk_egos.c
@@ -74,14 +74,14 @@ GCG_EGOS_get_selected_ego ()
GtkTreeIter iter;
GtkComboBox *cb;
- cb = GTK_COMBO_BOX (GCG_get_main_window_object
- ("gnunet_conversation_gtk_ego_combobox"));
- if (! gtk_combo_box_get_active_iter (cb,
- &iter))
+ cb = GTK_COMBO_BOX (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_ego_combobox"));
+ if (! gtk_combo_box_get_active_iter (cb, &iter))
return NULL;
gtk_tree_model_get (GTK_TREE_MODEL (ego_liststore),
&iter,
- EGO_LS_EGO, &ego,
+ EGO_LS_EGO,
+ &ego,
-1);
return ego;
}
@@ -118,51 +118,43 @@ identity_cb (void *cls,
/* new identity */
GNUNET_assert (NULL != name);
gtk_list_store_insert_with_values (ego_liststore,
- &iter, -1,
- EGO_LS_NAME, name,
- EGO_LS_EGO, ego,
+ &iter,
+ -1,
+ EGO_LS_NAME,
+ name,
+ EGO_LS_EGO,
+ ego,
-1);
- cb = GTK_COMBO_BOX (GCG_get_main_window_object
- ("gnunet_conversation_gtk_ego_combobox"));
- if ( (! gtk_combo_box_get_active_iter (cb,
- &iter2)) &&
- ( (NULL == default_ego) ||
- (0 == strcmp (name,
- default_ego))) )
+ cb = GTK_COMBO_BOX (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_ego_combobox"));
+ if ((! gtk_combo_box_get_active_iter (cb, &iter2)) &&
+ ((NULL == default_ego) || (0 == strcmp (name, default_ego))))
{
/* found the ego that we were supposed to use by default, select
it! */
- gtk_combo_box_set_active_iter (cb,
- &iter);
+ gtk_combo_box_set_active_iter (cb, &iter);
}
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (ego_liststore),
- &iter);
- rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ego_liststore),
- path);
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (ego_liststore), &iter);
+ rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ego_liststore), path);
gtk_tree_path_free (path);
*ctx = rr;
return;
}
/* existing ego, locate and execute rename/delete */
path = gtk_tree_row_reference_get_path (rr);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ego_liststore),
- &iter,
- path));
+ GNUNET_assert (
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (ego_liststore), &iter, path));
gtk_tree_path_free (path);
if (NULL == name)
{
/* deletion operation */
gtk_tree_row_reference_free (rr);
*ctx = NULL;
- gtk_list_store_remove (ego_liststore,
- &iter);
+ gtk_list_store_remove (ego_liststore, &iter);
return;
}
/* rename operation */
- gtk_list_store_set (ego_liststore,
- &iter,
- EGO_LS_NAME, &name,
- -1);
+ gtk_list_store_set (ego_liststore, &iter, EGO_LS_NAME, &name, -1);
}
@@ -175,7 +167,7 @@ identity_cb (void *cls,
*/
void
gnunet_conversation_gtk_ego_copy_button_clicked_cb (GtkButton *button,
- gpointer user_data)
+ gpointer user_data)
{
struct GNUNET_IDENTITY_Ego *ego;
const gchar *label;
@@ -185,21 +177,15 @@ gnunet_conversation_gtk_ego_copy_button_clicked_cb
(GtkButton *button,
char *uri;
GtkClipboard *cb;
- label = gtk_entry_get_text (GTK_ENTRY
- (GCG_get_main_window_object
- ("gnunet_conversation_gtk_ego_label_entry")));
- GNUNET_break ( (NULL != label) &&
- (0 != strlen (label)) );
+ label = gtk_entry_get_text (GTK_ENTRY (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_ego_label_entry")));
+ GNUNET_break ((NULL != label) && (0 != strlen (label)));
ego = GCG_EGOS_get_selected_ego ();
GNUNET_break (NULL != ego);
priv = GNUNET_IDENTITY_ego_get_private_key (ego);
- GNUNET_CRYPTO_ecdsa_key_get_public (priv,
- &pub);
+ GNUNET_CRYPTO_ecdsa_key_get_public (priv, &pub);
zkey = GNUNET_GNSRECORD_pkey_to_zkey (&pub);
- GNUNET_asprintf (&uri,
- "gnunet://gns/%s.%s/",
- label,
- zkey);
+ GNUNET_asprintf (&uri, "gnunet://gns/%s.%s/", label, zkey);
cb = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
gtk_clipboard_set_text (cb, uri, -1);
gtk_clipboard_store (cb);
@@ -217,12 +203,9 @@ GCG_EGOS_init (const char *ego_name)
{
if (NULL != ego_name)
default_ego = GNUNET_strdup (ego_name);
- ego_liststore
- = GTK_LIST_STORE (GCG_get_main_window_object
- ("gnunet_conversation_gtk_ego_liststore"));
- id = GNUNET_IDENTITY_connect (GCG_get_configuration (),
- &identity_cb,
- NULL);
+ ego_liststore = GTK_LIST_STORE (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_ego_liststore"));
+ id = GNUNET_IDENTITY_connect (GCG_get_configuration (), &identity_cb, NULL);
}
diff --git a/src/conversation/gnunet-conversation-gtk_get_label.c
b/src/conversation/gnunet-conversation-gtk_get_label.c
index 54d0ea66..37daad42 100644
--- a/src/conversation/gnunet-conversation-gtk_get_label.c
+++ b/src/conversation/gnunet-conversation-gtk_get_label.c
@@ -51,7 +51,7 @@ static void
handle_error (void *cls)
{
qe = NULL;
- GCG_log (_("Error communicating with namestore!\n"));
+ GCG_log (_ ("Error communicating with namestore!\n"));
}
@@ -77,13 +77,12 @@ handle_existing_records (void *cls,
qe = NULL;
if (0 != rd_count)
{
- GCG_log (_("Label `%s' in use\n"),
- label);
+ GCG_log (_ ("Label `%s' in use\n"), label);
return;
}
- b_add = GTK_WIDGET (gtk_builder_get_object
- (builder,
-
"gnunet_conversation_gtk_enter_label_dialog_add_button"));
+ b_add = GTK_WIDGET (gtk_builder_get_object (
+ builder,
+ "gnunet_conversation_gtk_enter_label_dialog_add_button"));
gtk_widget_set_sensitive (b_add, TRUE);
}
@@ -113,19 +112,17 @@ gnunet_conversation_gtk_enter_label_entry_changed_cb
(GtkEditable *editable,
GNUNET_NAMESTORE_cancel (qe);
qe = NULL;
}
- label_entry = GTK_ENTRY (gtk_builder_get_object
- (builder,
+ label_entry = GTK_ENTRY (
+ gtk_builder_get_object (builder,
("gnunet_conversation_gtk_enter_label_entry")));
label = gtk_entry_get_text (label_entry);
- b_add = GTK_WIDGET (gtk_builder_get_object
- (builder,
-
"gnunet_conversation_gtk_enter_label_dialog_add_button"));
+ b_add = GTK_WIDGET (gtk_builder_get_object (
+ builder,
+ "gnunet_conversation_gtk_enter_label_dialog_add_button"));
gtk_widget_set_sensitive (b_add, FALSE);
- if (GNUNET_OK !=
- GNUNET_DNSPARSER_check_label (label))
+ if (GNUNET_OK != GNUNET_DNSPARSER_check_label (label))
{
- GCG_log (_("Invalid label `%s'\n"),
- label);
+ GCG_log (_ ("Invalid label `%s'\n"), label);
return;
}
ego = GCG_ZONES_get_selected_zone (&tld);
@@ -150,24 +147,25 @@ gnunet_conversation_gtk_enter_label_entry_changed_cb
(GtkEditable *editable,
* @param user_data our builder
*/
void
-gnunet_conversation_gtk_enter_label_dialog_add_button_clicked_cb (GtkButton
*button,
- gpointer
*user_data)
+gnunet_conversation_gtk_enter_label_dialog_add_button_clicked_cb (
+ GtkButton *button,
+ gpointer *user_data)
{
GtkBuilder *builder = GTK_BUILDER (user_data);
GtkWidget *dialog;
const gchar *label;
GtkEntry *label_entry;
- label_entry = GTK_ENTRY (gtk_builder_get_object
- (builder,
+ label_entry = GTK_ENTRY (
+ gtk_builder_get_object (builder,
("gnunet_conversation_gtk_enter_label_entry")));
label = gtk_entry_get_text (label_entry);
GSC_add_contact (label, target);
GNUNET_free (target);
target = NULL;
- dialog = GTK_WIDGET (gtk_builder_get_object
- (builder,
- "gnunet_conversation_gtk_enter_label_window"));
+ dialog = GTK_WIDGET (
+ gtk_builder_get_object (builder,
+ "gnunet_conversation_gtk_enter_label_window"));
gtk_widget_destroy (GTK_WIDGET (dialog));
g_object_unref (G_OBJECT (builder));
}
@@ -181,15 +179,16 @@
gnunet_conversation_gtk_enter_label_dialog_add_button_clicked_cb (GtkButton *but
* @param user_data our builder
*/
void
-gnunet_conversation_gtk_enter_label_dialog_cancel_button_clicked_cb (GtkButton
*button,
- gpointer
*user_data)
+gnunet_conversation_gtk_enter_label_dialog_cancel_button_clicked_cb (
+ GtkButton *button,
+ gpointer *user_data)
{
GtkBuilder *builder = GTK_BUILDER (user_data);
GtkWidget *dialog;
- dialog = GTK_WIDGET (gtk_builder_get_object
- (builder,
- "gnunet_conversation_gtk_enter_label_window"));
+ dialog = GTK_WIDGET (
+ gtk_builder_get_object (builder,
+ "gnunet_conversation_gtk_enter_label_window"));
GNUNET_free (target);
target = NULL;
gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -228,8 +227,7 @@ gnunet_conversation_gtk_enter_label_window_delete_event_cb
(GtkWidget *widget,
* @param label suggested label (user can change)
*/
void
-GSC_get_label_for_name (const char *name,
- const char *label)
+GSC_get_label_for_name (const char *name, const char *label)
{
GtkBuilder *builder;
GtkWidget *dialog;
@@ -246,22 +244,20 @@ GSC_get_label_for_name (const char *name,
return;
}
target = GNUNET_strdup (name);
- label_entry = GTK_ENTRY (gtk_builder_get_object
- (builder,
+ label_entry = GTK_ENTRY (
+ gtk_builder_get_object (builder,
("gnunet_conversation_gtk_enter_label_entry")));
- gtk_entry_set_text (label_entry,
- label);
- dialog = GTK_WIDGET (gtk_builder_get_object
- (builder,
- "gnunet_conversation_gtk_enter_label_window"));
+ gtk_entry_set_text (label_entry, label);
+ dialog = GTK_WIDGET (
+ gtk_builder_get_object (builder,
+ "gnunet_conversation_gtk_enter_label_window"));
/* just pick ANY widget from the main window here... */
- address_entry = GTK_WIDGET (GCG_get_main_window_object
- ("gnunet_conversation_gtk_address_entry"));
+ address_entry = GTK_WIDGET (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_address_entry"));
toplevel = gtk_widget_get_toplevel (address_entry);
if (GTK_IS_WINDOW (toplevel))
- gtk_window_set_transient_for (GTK_WINDOW (dialog),
- GTK_WINDOW (toplevel));
+ gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel));
gtk_widget_show (dialog);
}
@@ -280,12 +276,10 @@ gnunet_conversation_gtk_add_contact_button_clicked_cb
(GtkButton *button,
{
GtkEntry *address_entry;
- address_entry = GTK_ENTRY (GCG_get_main_window_object
- ("gnunet_conversation_gtk_address_entry"));
- GSC_get_label_for_name (gtk_entry_get_text (address_entry),
- "");
+ address_entry = GTK_ENTRY (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_address_entry"));
+ GSC_get_label_for_name (gtk_entry_get_text (address_entry), "");
}
-
/* end of gnunet-conversation-gtk_use_current.c */
diff --git a/src/conversation/gnunet-conversation-gtk_get_label.h
b/src/conversation/gnunet-conversation-gtk_get_label.h
index af948755..332e48ce 100644
--- a/src/conversation/gnunet-conversation-gtk_get_label.h
+++ b/src/conversation/gnunet-conversation-gtk_get_label.h
@@ -36,8 +36,7 @@
* @param label suggested label (user can change)
*/
void
-GSC_get_label_for_name (const char *name,
- const char *label);
+GSC_get_label_for_name (const char *name, const char *label);
#endif
diff --git a/src/conversation/gnunet-conversation-gtk_history.c
b/src/conversation/gnunet-conversation-gtk_history.c
index 13e202c4..b8baff90 100644
--- a/src/conversation/gnunet-conversation-gtk_history.c
+++ b/src/conversation/gnunet-conversation-gtk_history.c
@@ -130,11 +130,16 @@ GCG_HISTORY_add (enum GCG_HISTORY_Type type,
gtk_list_store_insert_with_values (history_liststore,
&iter,
-1,
- HISTORY_LS_TIME, ts,
- HISTORY_LS_EVENT, event,
- HISTORY_LS_CONTACT, contact_name,
- HISTORY_LS_NUMBER, call_number,
- HISTORY_LS_TIME_ORDER, (guint64)
now.abs_value_us,
+ HISTORY_LS_TIME,
+ ts,
+ HISTORY_LS_EVENT,
+ event,
+ HISTORY_LS_CONTACT,
+ contact_name,
+ HISTORY_LS_NUMBER,
+ call_number,
+ HISTORY_LS_TIME_ORDER,
+ (guint64) now.abs_value_us,
-1);
}
@@ -145,9 +150,8 @@ GCG_HISTORY_add (enum GCG_HISTORY_Type type,
void
GCG_HISTORY_init ()
{
- history_liststore =
- GTK_LIST_STORE (GCG_get_main_window_object
- ("gnunet_conversation_gtk_history_liststore"));
+ history_liststore = GTK_LIST_STORE (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_history_liststore"));
}
/* end of gnunet-conversation-gtk_history.c */
diff --git a/src/conversation/gnunet-conversation-gtk_import.c
b/src/conversation/gnunet-conversation-gtk_import.c
index ff9336fd..20bb8bd1 100644
--- a/src/conversation/gnunet-conversation-gtk_import.c
+++ b/src/conversation/gnunet-conversation-gtk_import.c
@@ -105,13 +105,11 @@ static int private_record;
* @param emsg NULL on success, otherwise an error message
*/
static void
-add_contact_continuation (void *cls,
- int32_t success,
- const char *emsg)
+add_contact_continuation (void *cls, int32_t success, const char *emsg)
{
if (GNUNET_YES != success)
- GCG_log (_("Adding contact failed: %s\n"),
- (GNUNET_NO == success) ? _("record exists") : emsg);
+ GCG_log (_ ("Adding contact failed: %s\n"),
+ (GNUNET_NO == success) ? _ ("record exists") : emsg);
add_contact_qe = NULL;
}
@@ -123,8 +121,7 @@ add_contact_continuation (void *cls,
* @param address public key of the contact
*/
void
-GSC_add_contact (const gchar *name,
- const gchar *address)
+GSC_add_contact (const gchar *name, const gchar *address)
{
struct GNUNET_GNSRECORD_Data rd;
struct GNUNET_CRYPTO_EcdsaPublicKey rvalue;
@@ -136,31 +133,24 @@ GSC_add_contact (const gchar *name,
char cname[256];
const char *tld;
- if (GNUNET_OK !=
- GNUNET_DNSPARSER_check_name (address))
+ if (GNUNET_OK != GNUNET_DNSPARSER_check_name (address))
{
- GCG_log (_("Domain name `%s' invalid\n"),
- address);
+ GCG_log (_ ("Domain name `%s' invalid\n"), address);
return;
}
if (NULL != add_contact_qe)
{
- GCG_log (_("Adding contact failed: %s\n"),
- _("previous operation still pending"));
+ GCG_log (_ ("Adding contact failed: %s\n"),
+ _ ("previous operation still pending"));
return;
}
/* if we got a .zkey address, we create a PKEY record,
otherwise a CNAME record */
- if ( (GNUNET_OK ==
- GNUNET_GNSRECORD_zkey_to_pkey (address,
- &rvalue)) ||
- ( (0 == strncasecmp (address,
- "phone.",
- strlen ("phone.")) ) &&
- (GNUNET_OK ==
- GNUNET_GNSRECORD_zkey_to_pkey (&address[strlen ("phone.")],
- &rvalue)) ) )
+ if ((GNUNET_OK == GNUNET_GNSRECORD_zkey_to_pkey (address, &rvalue)) ||
+ ((0 == strncasecmp (address, "phone.", strlen ("phone."))) &&
+ (GNUNET_OK ==
+ GNUNET_GNSRECORD_zkey_to_pkey (&address[strlen ("phone.")], &rvalue))))
{
type = GNUNET_GNSRECORD_TYPE_PKEY;
value = &rvalue;
@@ -169,14 +159,13 @@ GSC_add_contact (const gchar *name,
else
{
value_size = 0;
- if (GNUNET_OK !=
- GNUNET_DNSPARSER_builder_add_name (cname,
- sizeof (cname),
- &value_size,
- address))
+ if (GNUNET_OK != GNUNET_DNSPARSER_builder_add_name (cname,
+ sizeof (cname),
+ &value_size,
+ address))
{
GNUNET_break (0);
- GCG_log (_("Failed to create CNAME record for domain name `%s'\n"),
+ GCG_log (_ ("Failed to create CNAME record for domain name `%s'\n"),
address);
return;
}
@@ -186,19 +175,18 @@ GSC_add_contact (const gchar *name,
rd.data = value;
rd.data_size = value_size;
rd.record_type = type;
- rd.flags
- = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION
- | GNUNET_GNSRECORD_RF_PRIVATE;
- rd.expiration_time
- = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
+ rd.flags =
+ GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE;
+ rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
ego = GCG_ZONES_get_selected_zone (&tld);
zkey = GNUNET_IDENTITY_ego_get_private_key (ego);
- add_contact_qe
- = GNUNET_NAMESTORE_records_store (ns,
- zkey,
- name,
- 1, &rd,
- &add_contact_continuation, NULL);
+ add_contact_qe = GNUNET_NAMESTORE_records_store (ns,
+ zkey,
+ name,
+ 1,
+ &rd,
+ &add_contact_continuation,
+ NULL);
}
@@ -213,15 +201,12 @@ GSC_add_contact (const gchar *name,
* @param emsg NULL on success, otherwise an error message
*/
static void
-add_phone_continuation (void *cls,
- int32_t success,
- const char *emsg)
+add_phone_continuation (void *cls, int32_t success, const char *emsg)
{
add_phone_qe = NULL;
if (GNUNET_SYSERR == success)
{
- GCG_log (_("Failed to publish my PHONE record: %s\n"),
- emsg);
+ GCG_log (_ ("Failed to publish my PHONE record: %s\n"), emsg);
GNUNET_free (phone_label);
phone_label = NULL;
}
@@ -238,11 +223,12 @@ add_phone_continuation (void *cls,
* @param rd array of records with data to store
*/
static void
-add_phone_handle_existing_records (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey
*zone,
- const char *label,
- unsigned int rd_count,
- const struct GNUNET_GNSRECORD_Data *rd)
+add_phone_handle_existing_records (
+ void *cls,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+ const char *label,
+ unsigned int rd_count,
+ const struct GNUNET_GNSRECORD_Data *rd)
{
struct GNUNET_GNSRECORD_Data rd_new[rd_count + 1];
@@ -266,7 +252,7 @@ static void
handle_add_error (void *cls)
{
add_phone_qe = NULL;
- GCG_log (_("Error communicating with namestore!\n"));
+ GCG_log (_ ("Error communicating with namestore!\n"));
GNUNET_free (phone_label);
phone_label = NULL;
}
@@ -287,13 +273,14 @@ add_phone ()
zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego);
if (0 == strlen (phone_label))
return;
- add_phone_qe = GNUNET_NAMESTORE_records_lookup (ns,
- &zone_pkey,
- phone_label,
- &handle_add_error,
- NULL,
-
&add_phone_handle_existing_records,
- NULL);
+ add_phone_qe =
+ GNUNET_NAMESTORE_records_lookup (ns,
+ &zone_pkey,
+ phone_label,
+ &handle_add_error,
+ NULL,
+ &add_phone_handle_existing_records,
+ NULL);
}
@@ -304,8 +291,7 @@ add_phone ()
* @param rd record data to publish
*/
void
-GSC_add_phone (const gchar *label,
- const struct GNUNET_GNSRECORD_Data *rd)
+GSC_add_phone (const gchar *label, const struct GNUNET_GNSRECORD_Data *rd)
{
if (NULL != add_phone_qe)
{
@@ -374,14 +360,11 @@ finish_shutdown ()
* @param emsg NULL on success, otherwise an error message
*/
static void
-remove_phone_continuation (void *cls,
- int32_t success,
- const char *emsg)
+remove_phone_continuation (void *cls, int32_t success, const char *emsg)
{
remove_phone_qe = NULL;
if (GNUNET_SYSERR == success)
- GCG_log (_("Failed to remove PHONE record: %s\n"),
- emsg);
+ GCG_log (_ ("Failed to remove PHONE record: %s\n"), emsg);
if (GNUNET_YES == add_waiting)
add_phone ();
if (GNUNET_YES == in_shutdown)
@@ -400,11 +383,12 @@ remove_phone_continuation (void *cls,
* @param rd array of records with data to store
*/
static void
-remove_phone_handle_existing_records (void *cls,
- const struct
GNUNET_CRYPTO_EcdsaPrivateKey *zone,
- const char *label,
- unsigned int rd_count,
- const struct GNUNET_GNSRECORD_Data *rd)
+remove_phone_handle_existing_records (
+ void *cls,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+ const char *label,
+ unsigned int rd_count,
+ const struct GNUNET_GNSRECORD_Data *rd)
{
struct GNUNET_GNSRECORD_Data rd_left[rd_count];
unsigned int i;
@@ -412,7 +396,7 @@ remove_phone_handle_existing_records (void *cls,
remove_phone_qe = NULL;
j = 0;
- for (i=0;i<rd_count;i++)
+ for (i = 0; i < rd_count; i++)
{
if (GNUNET_GNSRECORD_TYPE_PHONE == rd[i].record_type)
continue;
@@ -421,7 +405,8 @@ remove_phone_handle_existing_records (void *cls,
remove_phone_qe = GNUNET_NAMESTORE_records_store (ns,
zone,
label,
- j, rd_left,
+ j,
+ rd_left,
&remove_phone_continuation,
NULL);
}
@@ -434,7 +419,7 @@ static void
handle_remove_error (void *cls)
{
remove_phone_qe = NULL;
- GCG_log (_("Error communicating with namestore!\n"));
+ GCG_log (_ ("Error communicating with namestore!\n"));
if (GNUNET_YES == in_shutdown)
finish_shutdown ();
}
@@ -451,19 +436,19 @@ GSC_remove_phone ()
GNUNET_assert (NULL == remove_phone_qe);
if (0 == strlen (phone_label))
return;
- remove_phone_qe = GNUNET_NAMESTORE_records_lookup (ns,
- &zone_pkey,
- phone_label,
- &handle_remove_error,
- NULL,
-
&remove_phone_handle_existing_records,
- NULL);
+ remove_phone_qe =
+ GNUNET_NAMESTORE_records_lookup (ns,
+ &zone_pkey,
+ phone_label,
+ &handle_remove_error,
+ NULL,
+ &remove_phone_handle_existing_records,
+ NULL);
GNUNET_free (phone_label);
phone_label = NULL;
}
-
/**
* Obtain namestore handle.
*
@@ -489,11 +474,10 @@ GCG_IMPORT_init ()
private_record = GNUNET_CONFIGURATION_get_value_yesno (cfg,
"CONVERSATION",
"RECORD_IS_PRIVATE");
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_time (cfg,
- "CONVERSATION",
- "RECORD_EXPIRATION",
- &expiration_time))
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg,
+ "CONVERSATION",
+ "RECORD_EXPIRATION",
+ &expiration_time))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"CONVERSATION",
diff --git a/src/conversation/gnunet-conversation-gtk_import.h
b/src/conversation/gnunet-conversation-gtk_import.h
index 79777889..ff96368d 100644
--- a/src/conversation/gnunet-conversation-gtk_import.h
+++ b/src/conversation/gnunet-conversation-gtk_import.h
@@ -36,8 +36,7 @@
* @param address
*/
void
-GSC_add_contact (const gchar *name,
- const gchar *address);
+GSC_add_contact (const gchar *name, const gchar *address);
/**
@@ -47,8 +46,7 @@ GSC_add_contact (const gchar *name,
* @param rd record data to publish
*/
void
-GSC_add_phone (const gchar *label,
- const struct GNUNET_GNSRECORD_Data *rd);
+GSC_add_phone (const gchar *label, const struct GNUNET_GNSRECORD_Data *rd);
/**
diff --git a/src/conversation/gnunet-conversation-gtk_log.c
b/src/conversation/gnunet-conversation-gtk_log.c
index 168049aa..f847fcea 100644
--- a/src/conversation/gnunet-conversation-gtk_log.c
+++ b/src/conversation/gnunet-conversation-gtk_log.c
@@ -36,8 +36,7 @@
* @param ... arguments for the format string
*/
void
-GCG_log (const char *message,
- ...)
+GCG_log (const char *message, ...)
{
GtkTextBuffer *logbuff;
GtkTextView *log_view;
@@ -45,21 +44,16 @@ GCG_log (const char *message,
gchar *fmsg;
va_list ap;
- log_view = GTK_TEXT_VIEW (GCG_get_main_window_object
- ("gnunet_conversation_gtk_log"));
+ log_view =
+ GTK_TEXT_VIEW (GCG_get_main_window_object ("gnunet_conversation_gtk_log"));
if (NULL == log_view)
return;
logbuff = GTK_TEXT_BUFFER (gtk_text_view_get_buffer (log_view));
va_start (ap, message);
- fmsg = g_strdup_vprintf (message,
- ap);
+ fmsg = g_strdup_vprintf (message, ap);
va_end (ap);
- gtk_text_buffer_get_start_iter (logbuff,
- &iter);
- gtk_text_buffer_insert (logbuff,
- &iter,
- fmsg,
- -1);
+ gtk_text_buffer_get_start_iter (logbuff, &iter);
+ gtk_text_buffer_insert (logbuff, &iter, fmsg, -1);
g_free (fmsg);
}
@@ -71,21 +65,19 @@ GCG_log (const char *message,
* @param ... arguments for the format string
*/
void
-GCG_update_status_bar (const gchar *message,
- ...)
+GCG_update_status_bar (const gchar *message, ...)
{
GtkStatusbar *status_bar;
guint status_bar_context;
gchar *buff;
va_list ap;
- status_bar = GTK_STATUSBAR (GCG_get_main_window_object
- ("gnunet_conversation_gtk_statusbar"));
+ status_bar = GTK_STATUSBAR (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_statusbar"));
status_bar_context = gtk_statusbar_get_context_id (status_bar,
"blaat"); // blaat!?
va_start (ap, message);
- buff = g_strdup_vprintf (message,
- ap);
+ buff = g_strdup_vprintf (message, ap);
va_end (ap);
gtk_statusbar_push (GTK_STATUSBAR (status_bar),
GPOINTER_TO_INT (status_bar_context),
diff --git a/src/conversation/gnunet-conversation-gtk_log.h
b/src/conversation/gnunet-conversation-gtk_log.h
index e3e3dc7c..74e72af9 100644
--- a/src/conversation/gnunet-conversation-gtk_log.h
+++ b/src/conversation/gnunet-conversation-gtk_log.h
@@ -46,8 +46,7 @@
* @param ... arguments for the format string
*/
void
-GCG_update_status_bar (const gchar *message,
- ...);
+GCG_update_status_bar (const gchar *message, ...);
/**
@@ -57,8 +56,7 @@ GCG_update_status_bar (const gchar *message,
* @param ... arguments for the format string
*/
void
-GCG_log (const char *message,
- ...);
+GCG_log (const char *message, ...);
/**
diff --git a/src/conversation/gnunet-conversation-gtk_phone.c
b/src/conversation/gnunet-conversation-gtk_phone.c
index 49f15893..d3097cd1 100644
--- a/src/conversation/gnunet-conversation-gtk_phone.c
+++ b/src/conversation/gnunet-conversation-gtk_phone.c
@@ -226,7 +226,6 @@ struct IncomingCall
* State for this call.
*/
enum InCallState state;
-
};
@@ -260,7 +259,6 @@ struct OutgoingCall
* State for this call.
*/
enum OutCallState state;
-
};
@@ -369,17 +367,17 @@ in_call_state_to_string (enum InCallState is)
switch (is)
{
case IN_STATE_NONE:
- return _("none");
+ return _ ("none");
case IN_STATE_RINGING:
- return _("ringing");
+ return _ ("ringing");
case IN_STATE_CONNECTED:
- return _("connected");
+ return _ ("connected");
case IN_STATE_SUSPENDED_LOCAL:
- return _("suspended");
+ return _ ("suspended");
case IN_STATE_SUSPENDED_REMOTE:
- return _("on hold");
+ return _ ("on hold");
case IN_STATE_SUSPENDED_BOTH:
- return _("suspended and on hold");
+ return _ ("suspended and on hold");
}
return NULL;
}
@@ -397,19 +395,19 @@ out_call_state_to_string (enum OutCallState os)
switch (os)
{
case OUT_STATE_NONE:
- return _("none");
+ return _ ("none");
case OUT_STATE_RESOLVING:
- return _("resolving");
+ return _ ("resolving");
case OUT_STATE_RINGING:
- return _("calling");
+ return _ ("calling");
case OUT_STATE_CONNECTED:
- return _("connected");
+ return _ ("connected");
case OUT_STATE_SUSPENDED_LOCAL:
- return _("suspended");
+ return _ ("suspended");
case OUT_STATE_SUSPENDED_REMOTE:
- return _("on hold");
+ return _ ("on hold");
case OUT_STATE_SUSPENDED_BOTH:
- return _("suspended and on hold");
+ return _ ("suspended and on hold");
}
return NULL;
}
@@ -463,33 +461,28 @@ destroy_out (struct OutgoingCall *oc)
static void
do_status ()
{
- if ( (NULL == active_in) &&
- (NULL == active_out) &&
- (0 != in_ring_counter) )
+ if ((NULL == active_in) && (NULL == active_out) && (0 != in_ring_counter))
{
- GCG_update_status_bar (_("The phone is ringing (%u calls waiting)"),
+ GCG_update_status_bar (_ ("The phone is ringing (%u calls waiting)"),
in_ring_counter);
return;
}
- if ( (NULL == active_in) &&
- (NULL == active_out) )
+ if ((NULL == active_in) && (NULL == active_out))
{
if (NULL != phone)
{
- GCG_update_status_bar ("%s",
- _("We are listening for incoming calls"));
+ GCG_update_status_bar ("%s", _ ("We are listening for incoming calls"));
}
else
{
if (NULL == GCG_EGOS_get_selected_ego ())
{
- GCG_update_status_bar ("%s",
- _("No ego selected, phone is down."));
+ GCG_update_status_bar ("%s", _ ("No ego selected, phone is down."));
}
else
{
GCG_update_status_bar ("%s",
- _("Failed to setup phone (internal error)"));
+ _ ("Failed to setup phone (internal error)"));
}
}
return;
@@ -505,14 +498,14 @@ do_status ()
GNUNET_break (0);
break;
case IN_STATE_CONNECTED:
- GCG_update_status_bar (_("In a conversation with `%s'."),
+ GCG_update_status_bar (_ ("In a conversation with `%s'."),
active_in->caller_id_str);
break;
case IN_STATE_SUSPENDED_LOCAL:
GNUNET_break (0);
break;
case IN_STATE_SUSPENDED_REMOTE:
- GCG_update_status_bar (_("On hold in a conversation with `%s'."),
+ GCG_update_status_bar (_ ("On hold in a conversation with `%s'."),
active_in->caller_id_str);
break;
case IN_STATE_SUSPENDED_BOTH:
@@ -529,22 +522,20 @@ do_status ()
GNUNET_break (0);
break;
case OUT_STATE_RESOLVING:
- GCG_update_status_bar (_("Resolving `%s'."),
- active_out->caller_id_str);
+ GCG_update_status_bar (_ ("Resolving `%s'."), active_out->caller_id_str);
break;
case OUT_STATE_RINGING:
- GCG_update_status_bar (_("Calling `%s'."),
- active_out->caller_id_str);
+ GCG_update_status_bar (_ ("Calling `%s'."), active_out->caller_id_str);
break;
case OUT_STATE_CONNECTED:
- GCG_update_status_bar (_("In a conversation with `%s'."),
+ GCG_update_status_bar (_ ("In a conversation with `%s'."),
active_out->caller_id_str);
break;
case OUT_STATE_SUSPENDED_LOCAL:
GNUNET_break (0);
break;
case OUT_STATE_SUSPENDED_REMOTE:
- GCG_update_status_bar (_("On hold in a conversation with `%s'."),
+ GCG_update_status_bar (_ ("On hold in a conversation with `%s'."),
active_out->caller_id_str);
break;
case OUT_STATE_SUSPENDED_BOTH:
@@ -595,9 +586,7 @@ update_call_buttons (GtkTreeSelection *sel)
gint out_state;
gboolean in_call;
- if (! gtk_tree_selection_get_selected (sel,
- &model,
- &iter))
+ if (! gtk_tree_selection_get_selected (sel, &model, &iter))
{
/* nothing selected, disable buttons */
gtk_widget_set_sensitive (b_add_contact, FALSE);
@@ -608,12 +597,16 @@ update_call_buttons (GtkTreeSelection *sel)
}
in_call = (NULL != active_in) || (NULL != active_out);
gtk_tree_model_get (model,
- &iter,
- GCG_PHONE_LS_TYPE, &type,
- GCG_PHONE_LS_OUT_CALL_STATE, &out_state,
- GCG_PHONE_LS_IN_CALL_STATE, &in_state,
- GCG_PHONE_LS_INCOMING_CALL, &ic,
- -1);
+ &iter,
+ GCG_PHONE_LS_TYPE,
+ &type,
+ GCG_PHONE_LS_OUT_CALL_STATE,
+ &out_state,
+ GCG_PHONE_LS_IN_CALL_STATE,
+ &in_state,
+ GCG_PHONE_LS_INCOMING_CALL,
+ &ic,
+ -1);
switch ((enum TypeOfConversation) type)
{
case CALL_IN:
@@ -709,8 +702,9 @@ update_call_buttons (GtkTreeSelection *sel)
* @param user_data builder context (unused)
*/
void
-gnunet_conversation_gtk_active_calls_treeview_selection_changed_cb
(GtkTreeSelection *sel,
- gpointer
user_data)
+gnunet_conversation_gtk_active_calls_treeview_selection_changed_cb (
+ GtkTreeSelection *sel,
+ gpointer user_data)
{
update_call_buttons (sel);
}
@@ -723,18 +717,16 @@
gnunet_conversation_gtk_active_calls_treeview_selection_changed_cb (GtkTreeSele
static void
update_gui ()
{
- if ( (NULL != active_in) ||
- (NULL != active_out) )
+ if ((NULL != active_in) || (NULL != active_out))
{
/* in a call, show hangup/suspend buttons */
gtk_widget_show (b_suspend);
gtk_widget_show (b_hangup);
gtk_widget_hide (b_call);
gtk_widget_set_sensitive (b_hangup, TRUE);
- if ( (NULL != active_in) ||
- ( (NULL != active_out) &&
- (OUT_STATE_RESOLVING != active_out->state) &&
- (OUT_STATE_RINGING != active_out->state) ) )
+ if ((NULL != active_in) ||
+ ((NULL != active_out) && (OUT_STATE_RESOLVING != active_out->state) &&
+ (OUT_STATE_RINGING != active_out->state)))
gtk_widget_set_sensitive (b_suspend, TRUE);
else
gtk_widget_set_sensitive (b_suspend, FALSE);
@@ -763,23 +755,20 @@ update_gui ()
* @param state new state of the call
*/
static void
-set_outgoing_call_state (struct OutgoingCall *oc,
- enum OutCallState state)
+set_outgoing_call_state (struct OutgoingCall *oc, enum OutCallState state)
{
GtkTreePath *path;
GtkTreeIter iter;
oc->state = state;
path = gtk_tree_row_reference_get_path (oc->rr);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (active_liststore),
- &iter,
- path));
+ GNUNET_assert (
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (active_liststore), &iter, path));
gtk_tree_path_free (path);
switch (state)
{
case OUT_STATE_NONE:
- gtk_list_store_remove (active_liststore,
- &iter);
+ gtk_list_store_remove (active_liststore, &iter);
return;
case OUT_STATE_RESOLVING:
break;
@@ -796,8 +785,10 @@ set_outgoing_call_state (struct OutgoingCall *oc,
}
gtk_list_store_set (active_liststore,
&iter,
- GCG_PHONE_LS_OUT_CALL_STATE, state,
- GCG_PHONE_LS_STATE_NAME, out_call_state_to_string
(state),
+ GCG_PHONE_LS_OUT_CALL_STATE,
+ state,
+ GCG_PHONE_LS_STATE_NAME,
+ out_call_state_to_string (state),
-1);
update_call_buttons (gtk_tree_view_get_selection (active_treeview));
}
@@ -810,23 +801,20 @@ set_outgoing_call_state (struct OutgoingCall *oc,
* @param state new state of the call
*/
static void
-set_incoming_call_state (struct IncomingCall *ic,
- enum InCallState state)
+set_incoming_call_state (struct IncomingCall *ic, enum InCallState state)
{
GtkTreePath *path;
GtkTreeIter iter;
ic->state = state;
path = gtk_tree_row_reference_get_path (ic->rr);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (active_liststore),
- &iter,
- path));
+ GNUNET_assert (
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (active_liststore), &iter, path));
gtk_tree_path_free (path);
switch (state)
{
case IN_STATE_NONE:
- gtk_list_store_remove (active_liststore,
- &iter);
+ gtk_list_store_remove (active_liststore, &iter);
return;
case IN_STATE_RINGING:
break;
@@ -841,8 +829,10 @@ set_incoming_call_state (struct IncomingCall *ic,
}
gtk_list_store_set (active_liststore,
&iter,
- GCG_PHONE_LS_IN_CALL_STATE, state,
- GCG_PHONE_LS_STATE_NAME, in_call_state_to_string (state),
+ GCG_PHONE_LS_IN_CALL_STATE,
+ state,
+ GCG_PHONE_LS_STATE_NAME,
+ in_call_state_to_string (state),
-1);
update_call_buttons (gtk_tree_view_get_selection (active_treeview));
}
@@ -881,7 +871,7 @@ handle_reverse_error (void *cls)
struct IncomingCall *ic = cls;
ic->qe = NULL;
- GCG_log (_("Error communicating with namestore!\n"));
+ GCG_log (_ ("Error communicating with namestore!\n"));
}
@@ -914,31 +904,39 @@ phone_event_handler (void *cls,
ic->caller = caller;
ic->state = IN_STATE_RINGING;
ic->caller_id = *caller_id;
- ic->caller_id_str = GNUNET_strdup (GNUNET_GNSRECORD_pkey_to_zkey
(caller_id));
+ ic->caller_id_str =
+ GNUNET_strdup (GNUNET_GNSRECORD_pkey_to_zkey (caller_id));
my_zone = GCG_ZONES_get_selected_zone (&tld);
- ic->qe = GNUNET_NAMESTORE_zone_to_name (GCG_IMPORT_get_namestore (),
-
GNUNET_IDENTITY_ego_get_private_key (my_zone),
- &ic->caller_id,
- &handle_reverse_error,
- ic,
- &handle_reverse_lookup_result,
- ic);
+ ic->qe =
+ GNUNET_NAMESTORE_zone_to_name (GCG_IMPORT_get_namestore (),
+ GNUNET_IDENTITY_ego_get_private_key (
+ my_zone),
+ &ic->caller_id,
+ &handle_reverse_error,
+ ic,
+ &handle_reverse_lookup_result,
+ ic);
ic->caller_num = caller_num_gen++;
gtk_list_store_insert_with_values (active_liststore,
&iter,
-1,
- GCG_PHONE_LS_REMOTE_USER_NAME,
ic->caller_id_str,
- GCG_PHONE_LS_INCOMING_CALL, ic,
- GCG_PHONE_LS_NUMBER, ic->caller_num,
- GCG_PHONE_LS_IN_CALL_STATE, ic->state,
- GCG_PHONE_LS_STATE_NAME,
in_call_state_to_string (ic->state),
- GCG_PHONE_LS_TYPE, CALL_IN,
+ GCG_PHONE_LS_REMOTE_USER_NAME,
+ ic->caller_id_str,
+ GCG_PHONE_LS_INCOMING_CALL,
+ ic,
+ GCG_PHONE_LS_NUMBER,
+ ic->caller_num,
+ GCG_PHONE_LS_IN_CALL_STATE,
+ ic->state,
+ GCG_PHONE_LS_STATE_NAME,
+ in_call_state_to_string (ic->state),
+ GCG_PHONE_LS_TYPE,
+ CALL_IN,
-1);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (active_liststore),
- &iter);
- ic->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (active_liststore),
- path);
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (active_liststore), &iter);
+ ic->rr =
+ gtk_tree_row_reference_new (GTK_TREE_MODEL (active_liststore), path);
gtk_tree_path_free (path);
GCG_HISTORY_add (GCG_HISTORY_TYPE_INCOMING_CALL,
ic->caller_id_str,
@@ -947,17 +945,17 @@ phone_event_handler (void *cls,
case GNUNET_CONVERSATION_EC_PHONE_HUNG_UP:
GNUNET_break (in_ring_counter > 0);
in_ring_counter--;
- valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (active_liststore),
- &iter);
+ valid =
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (active_liststore), &iter);
GNUNET_break (valid);
while (valid)
{
gtk_tree_model_get (GTK_TREE_MODEL (active_liststore),
&iter,
- GCG_PHONE_LS_INCOMING_CALL, &ic,
+ GCG_PHONE_LS_INCOMING_CALL,
+ &ic,
-1);
- if ( (NULL != ic) &&
- (caller == ic->caller) )
+ if ((NULL != ic) && (caller == ic->caller))
{
if (ic == active_in)
{
@@ -977,14 +975,13 @@ phone_event_handler (void *cls,
ic->caller_id_str,
ic->caller_num);
}
- set_incoming_call_state (ic,
- IN_STATE_NONE);
+ set_incoming_call_state (ic, IN_STATE_NONE);
ic->caller = NULL;
destroy_in (ic);
break;
}
- valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (active_liststore),
- &iter);
+ valid =
+ gtk_tree_model_iter_next (GTK_TREE_MODEL (active_liststore), &iter);
}
GNUNET_break (valid);
break;
@@ -1000,8 +997,7 @@ phone_event_handler (void *cls,
* @param code type of the event issued by the caller
*/
static void
-caller_event_handler (void *cls,
- enum GNUNET_CONVERSATION_CallerEventCode code)
+caller_event_handler (void *cls, enum GNUNET_CONVERSATION_CallerEventCode code)
{
struct IncomingCall *ic = cls;
enum InCallState is;
@@ -1039,8 +1035,7 @@ caller_event_handler (void *cls,
GNUNET_assert (0);
break;
}
- set_incoming_call_state (ic,
- is);
+ set_incoming_call_state (ic, is);
break;
case GNUNET_CONVERSATION_EC_CALLER_RESUME:
GCG_HISTORY_add (GCG_HISTORY_TYPE_RESUMED_REMOTE,
@@ -1068,11 +1063,10 @@ caller_event_handler (void *cls,
is = IN_STATE_SUSPENDED_LOCAL;
break;
}
- set_incoming_call_state (ic,
- is);
+ set_incoming_call_state (ic, is);
break;
}
- do_status();
+ do_status ();
}
@@ -1091,26 +1085,20 @@ gnunet_conversation_gtk_accept_button_clicked_cb
(GtkButton *button,
GtkTreeIter iter;
GtkTreeModel *model;
- if ( (NULL != active_in) ||
- (NULL != active_out) )
+ if ((NULL != active_in) || (NULL != active_out))
{
/* accept button should not have been sensitive! */
GNUNET_break (0);
return;
}
sel = gtk_tree_view_get_selection (active_treeview);
- if (! gtk_tree_selection_get_selected (sel,
- &model,
- &iter))
+ if (! gtk_tree_selection_get_selected (sel, &model, &iter))
{
/* accept button should not have been sensitive! */
GNUNET_break (0);
return;
}
- gtk_tree_model_get (model,
- &iter,
- GCG_PHONE_LS_INCOMING_CALL, &ic,
- -1);
+ gtk_tree_model_get (model, &iter, GCG_PHONE_LS_INCOMING_CALL, &ic, -1);
if (NULL == ic)
{
/* accept button should not have been sensitive! */
@@ -1118,16 +1106,16 @@ gnunet_conversation_gtk_accept_button_clicked_cb
(GtkButton *button,
return;
}
active_in = ic;
- set_incoming_call_state (ic,
- IN_STATE_CONNECTED);
+ set_incoming_call_state (ic, IN_STATE_CONNECTED);
GNUNET_CONVERSATION_caller_pick_up (ic->caller,
- &caller_event_handler, ic,
- speaker, mic);
+ &caller_event_handler,
+ ic,
+ speaker,
+ mic);
GCG_HISTORY_add (GCG_HISTORY_TYPE_INCOMING_ACCEPTED,
ic->caller_id_str,
ic->caller_num);
- gtk_entry_set_text (address_entry,
- ic->caller_id_str);
+ gtk_entry_set_text (address_entry, ic->caller_id_str);
update_gui ();
}
@@ -1149,19 +1137,19 @@ gnunet_conversation_gtk_refuse_button_clicked_cb
(GtkButton *button,
GtkTreeModel *model;
sel = gtk_tree_view_get_selection (active_treeview);
- if (! gtk_tree_selection_get_selected (sel,
- &model,
- &iter))
+ if (! gtk_tree_selection_get_selected (sel, &model, &iter))
{
/* reject button should not have been sensitive! */
GNUNET_break (0);
return;
}
gtk_tree_model_get (model,
- &iter,
- GCG_PHONE_LS_INCOMING_CALL, &ic,
- GCG_PHONE_LS_OUTGOING_CALL, &oc,
- -1);
+ &iter,
+ GCG_PHONE_LS_INCOMING_CALL,
+ &ic,
+ GCG_PHONE_LS_OUTGOING_CALL,
+ &oc,
+ -1);
if (NULL != ic)
{
if (active_in == ic)
@@ -1173,10 +1161,9 @@ gnunet_conversation_gtk_refuse_button_clicked_cb
(GtkButton *button,
GNUNET_break (in_ring_counter > 0);
in_ring_counter--;
GCG_HISTORY_add (GCG_HISTORY_TYPE_INCOMING_REJECTED,
- ic->caller_id_str,
+ ic->caller_id_str,
ic->caller_num);
- set_incoming_call_state (ic,
- IN_STATE_NONE);
+ set_incoming_call_state (ic, IN_STATE_NONE);
destroy_in (ic);
do_status ();
return;
@@ -1191,10 +1178,9 @@ gnunet_conversation_gtk_refuse_button_clicked_cb
(GtkButton *button,
return;
}
GCG_HISTORY_add (GCG_HISTORY_TYPE_HANGUP,
- oc->caller_id_str,
+ oc->caller_id_str,
oc->caller_num);
- set_outgoing_call_state (oc,
- OUT_STATE_NONE);
+ set_outgoing_call_state (oc, OUT_STATE_NONE);
destroy_out (oc);
do_status ();
return;
@@ -1220,55 +1206,48 @@ gnunet_conversation_gtk_resume_button_clicked_cb
(GtkButton *button,
GtkTreeIter iter;
GtkTreeModel *model;
- if ( (NULL != active_in) ||
- (NULL != active_out) )
+ if ((NULL != active_in) || (NULL != active_out))
{
/* resume button should have been inactive */
- GNUNET_break(0);
+ GNUNET_break (0);
return;
}
sel = gtk_tree_view_get_selection (active_treeview);
- if (! gtk_tree_selection_get_selected (sel,
- &model,
- &iter))
+ if (! gtk_tree_selection_get_selected (sel, &model, &iter))
{
/* resume button should not have been sensitive! */
GNUNET_break (0);
return;
}
gtk_tree_model_get (model,
- &iter,
- GCG_PHONE_LS_INCOMING_CALL, &ic,
- GCG_PHONE_LS_OUTGOING_CALL, &oc,
- -1);
+ &iter,
+ GCG_PHONE_LS_INCOMING_CALL,
+ &ic,
+ GCG_PHONE_LS_OUTGOING_CALL,
+ &oc,
+ -1);
if (NULL != ic)
{
active_in = ic;
- set_incoming_call_state (ic,
- IN_STATE_CONNECTED);
- GNUNET_CONVERSATION_caller_resume (ic->caller,
- speaker, mic);
+ set_incoming_call_state (ic, IN_STATE_CONNECTED);
+ GNUNET_CONVERSATION_caller_resume (ic->caller, speaker, mic);
GCG_HISTORY_add (GCG_HISTORY_TYPE_RESUMED_LOCAL,
ic->caller_id_str,
ic->caller_num);
- gtk_entry_set_text (address_entry,
- ic->caller_id_str);
+ gtk_entry_set_text (address_entry, ic->caller_id_str);
update_gui ();
return;
}
if (NULL != oc)
{
active_out = oc;
- GNUNET_CONVERSATION_call_resume (oc->call,
- speaker, mic);
- set_outgoing_call_state (oc,
- OUT_STATE_CONNECTED);
+ GNUNET_CONVERSATION_call_resume (oc->call, speaker, mic);
+ set_outgoing_call_state (oc, OUT_STATE_CONNECTED);
GCG_HISTORY_add (GCG_HISTORY_TYPE_RESUMED_LOCAL,
oc->caller_id_str,
oc->caller_num);
- gtk_entry_set_text (address_entry,
- active_out->caller_id_str);
+ gtk_entry_set_text (address_entry, active_out->caller_id_str);
update_gui ();
return;
}
@@ -1290,10 +1269,9 @@ gnunet_conversation_gtk_suspend_button_clicked_cb
(GtkButton *button,
enum OutCallState os;
enum InCallState is;
- if ( (NULL != active_in) &&
- (NULL != active_out) )
+ if ((NULL != active_in) && (NULL != active_out))
{
- GNUNET_break(0);
+ GNUNET_break (0);
return;
}
if (NULL != active_out)
@@ -1327,8 +1305,7 @@ gnunet_conversation_gtk_suspend_button_clicked_cb
(GtkButton *button,
break;
}
GNUNET_CONVERSATION_call_suspend (active_out->call);
- set_outgoing_call_state (active_out,
- os);
+ set_outgoing_call_state (active_out, os);
active_out = NULL;
update_gui ();
return;
@@ -1361,8 +1338,7 @@ gnunet_conversation_gtk_suspend_button_clicked_cb
(GtkButton *button,
GNUNET_assert (0);
break;
}
- set_incoming_call_state (active_in,
- is);
+ set_incoming_call_state (active_in, is);
active_in = NULL;
update_gui ();
return;
@@ -1381,10 +1357,9 @@ void
gnunet_conversation_gtk_hangup_button_clicked_cb (GtkButton *button,
gpointer user_data)
{
- if ( (NULL == active_in) &&
- (NULL == active_out) )
+ if ((NULL == active_in) && (NULL == active_out))
{
- GNUNET_break(0);
+ GNUNET_break (0);
return;
}
if (NULL != active_out)
@@ -1393,8 +1368,7 @@ gnunet_conversation_gtk_hangup_button_clicked_cb
(GtkButton *button,
GCG_HISTORY_add (GCG_HISTORY_TYPE_HANGUP,
active_out->caller_id_str,
active_out->caller_num);
- set_outgoing_call_state (active_out,
- OUT_STATE_NONE);
+ set_outgoing_call_state (active_out, OUT_STATE_NONE);
destroy_out (active_out);
active_out = NULL;
update_gui ();
@@ -1406,8 +1380,7 @@ gnunet_conversation_gtk_hangup_button_clicked_cb
(GtkButton *button,
GCG_HISTORY_add (GCG_HISTORY_TYPE_HANGUP,
active_in->caller_id_str,
active_in->caller_num);
- set_incoming_call_state (active_in,
- IN_STATE_NONE);
+ set_incoming_call_state (active_in, IN_STATE_NONE);
destroy_in (active_in);
active_in = NULL;
update_gui ();
@@ -1424,8 +1397,7 @@ gnunet_conversation_gtk_hangup_button_clicked_cb
(GtkButton *button,
* @param code type of the event on the call
*/
static void
-call_event_handler (void *cls,
- enum GNUNET_CONVERSATION_CallEventCode code)
+call_event_handler (void *cls, enum GNUNET_CONVERSATION_CallEventCode code)
{
struct OutgoingCall *oc = cls;
enum OutCallState os;
@@ -1438,8 +1410,7 @@ call_event_handler (void *cls,
oc->caller_num);
GNUNET_break (OUT_STATE_RESOLVING == oc->state);
GNUNET_break (active_out == oc);
- set_outgoing_call_state (oc,
- OUT_STATE_RINGING);
+ set_outgoing_call_state (oc, OUT_STATE_RINGING);
do_status ();
break;
case GNUNET_CONVERSATION_EC_CALL_PICKED_UP:
@@ -1458,8 +1429,7 @@ call_event_handler (void *cls,
oc->caller_num);
GNUNET_break (OUT_STATE_RESOLVING == oc->state);
GNUNET_break (active_out == oc);
- set_outgoing_call_state (oc,
- OUT_STATE_NONE);
+ set_outgoing_call_state (oc, OUT_STATE_NONE);
oc->call = NULL;
destroy_out (oc);
active_out = NULL;
@@ -1576,9 +1546,7 @@ gnunet_conversation_gtk_call_button_clicked_cb (GtkButton
*button,
arg = gtk_entry_get_text (address_entry);
caller_id = GCG_EGOS_get_selected_ego ();
- if ( (NULL == caller_id) ||
- (NULL != active_out) ||
- (NULL != active_in) )
+ if ((NULL == caller_id) || (NULL != active_out) || (NULL != active_in))
{
GNUNET_break (0);
return;
@@ -1590,14 +1558,13 @@ gnunet_conversation_gtk_call_button_clicked_cb
(GtkButton *button,
GCG_HISTORY_add (GCG_HISTORY_TYPE_OUTGOING_CALL,
oc->caller_id_str,
oc->caller_num);
- oc->call =
- GNUNET_CONVERSATION_call_start (GCG_get_configuration (),
- caller_id,
- arg,
- speaker,
- mic,
- &call_event_handler,
- oc);
+ oc->call = GNUNET_CONVERSATION_call_start (GCG_get_configuration (),
+ caller_id,
+ arg,
+ speaker,
+ mic,
+ &call_event_handler,
+ oc);
if (NULL == oc->call)
{
GCG_HISTORY_add (GCG_HISTORY_TYPE_FAILED,
@@ -1610,20 +1577,26 @@ gnunet_conversation_gtk_call_button_clicked_cb
(GtkButton *button,
gtk_list_store_insert_with_values (active_liststore,
&iter,
-1,
- GCG_PHONE_LS_REMOTE_USER_NAME,
oc->caller_id_str,
- GCG_PHONE_LS_INCOMING_CALL, NULL,
- GCG_PHONE_LS_NUMBER, oc->caller_num,
- GCG_PHONE_LS_IN_CALL_STATE, IN_STATE_NONE,
- GCG_PHONE_LS_TYPE, CALL_OUT,
- GCG_PHONE_LS_OUTGOING_CALL, oc,
- GCG_PHONE_LS_OUT_CALL_STATE, oc->state,
- GCG_PHONE_LS_STATE_NAME,
out_call_state_to_string (oc->state),
+ GCG_PHONE_LS_REMOTE_USER_NAME,
+ oc->caller_id_str,
+ GCG_PHONE_LS_INCOMING_CALL,
+ NULL,
+ GCG_PHONE_LS_NUMBER,
+ oc->caller_num,
+ GCG_PHONE_LS_IN_CALL_STATE,
+ IN_STATE_NONE,
+ GCG_PHONE_LS_TYPE,
+ CALL_OUT,
+ GCG_PHONE_LS_OUTGOING_CALL,
+ oc,
+ GCG_PHONE_LS_OUT_CALL_STATE,
+ oc->state,
+ GCG_PHONE_LS_STATE_NAME,
+ out_call_state_to_string (oc->state),
-1);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (active_liststore),
- &iter);
- oc->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (active_liststore),
- path);
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (active_liststore), &iter);
+ oc->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (active_liststore),
path);
gtk_tree_path_free (path);
update_gui ();
}
@@ -1654,12 +1627,9 @@ update_copy_sensitivity ()
struct GNUNET_IDENTITY_Ego *ego;
ego = GCG_EGOS_get_selected_ego ();
- label = gtk_entry_get_text (GTK_ENTRY
- (GCG_get_main_window_object
- ("gnunet_conversation_gtk_ego_label_entry")));
- if ( (NULL == ego) ||
- (NULL == label) ||
- (0 == strlen (label)) )
+ label = gtk_entry_get_text (GTK_ENTRY (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_ego_label_entry")));
+ if ((NULL == ego) || (NULL == label) || (0 == strlen (label)))
gtk_widget_set_sensitive (b_copy, FALSE);
else
gtk_widget_set_sensitive (b_copy, TRUE);
@@ -1681,17 +1651,14 @@ update_phone_record ()
GSC_remove_phone ();
return;
}
- label = gtk_entry_get_text (GTK_ENTRY
- (GCG_get_main_window_object
- ("gnunet_conversation_gtk_ego_label_entry")));
- if ( (NULL == label) ||
- (0 == strlen (label)) )
+ label = gtk_entry_get_text (GTK_ENTRY (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_ego_label_entry")));
+ if ((NULL == label) || (0 == strlen (label)))
{
GSC_remove_phone ();
return;
}
- GNUNET_CONVERSATION_phone_get_record (phone,
- &rd);
+ GNUNET_CONVERSATION_phone_get_record (phone, &rd);
GSC_add_phone (label, &rd);
}
@@ -1712,20 +1679,15 @@
gnunet_conversation_gtk_ego_label_entry_preedit_changed_cb (GtkEntry *entry,
{
GtkComboBoxText *cbt;
- if (GNUNET_OK !=
- GNUNET_DNSPARSER_check_label (preedit))
+ if (GNUNET_OK != GNUNET_DNSPARSER_check_label (preedit))
{
- GCG_log (_("Invalid label `%s'\n"),
- preedit);
- gdk_display_beep (gdk_display_get_default());
+ GCG_log (_ ("Invalid label `%s'\n"), preedit);
+ gdk_display_beep (gdk_display_get_default ());
return;
}
- cbt = GTK_COMBO_BOX_TEXT (GCG_get_main_window_object
-
("gnunet_conversation_gtk_ego_label_comboboxtext"));
- gtk_combo_box_text_insert (cbt,
- -1,
- NULL,
- preedit);
+ cbt = GTK_COMBO_BOX_TEXT (GCG_get_main_window_object (
+ "gnunet_conversation_gtk_ego_label_comboboxtext"));
+ gtk_combo_box_text_insert (cbt, -1, NULL, preedit);
update_copy_sensitivity ();
update_phone_record ();
}
@@ -1775,24 +1737,21 @@ gnunet_conversation_gtk_ego_combobox_changed_cb
(GtkComboBox *widget,
return;
}
cfg = GCG_get_configuration ();
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_number (cfg,
- "CONVERSATION",
- "LINE",
- &line))
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg,
+ "CONVERSATION",
+ "LINE",
+ &line))
{
- GCG_log (_("No phone line specified in configuration!\n"));
+ GCG_log (_ ("No phone line specified in configuration!\n"));
do_status ();
check_call_sensitivity ();
return;
}
- GCG_log (_("Initializing phone on line %llu\n"),
- line);
- phone =
- GNUNET_CONVERSATION_phone_create (cfg,
- caller_id,
- &phone_event_handler,
- NULL);
+ GCG_log (_ ("Initializing phone on line %llu\n"), line);
+ phone = GNUNET_CONVERSATION_phone_create (cfg,
+ caller_id,
+ &phone_event_handler,
+ NULL);
if (NULL == phone)
{
check_call_sensitivity ();
@@ -1817,30 +1776,28 @@ GCG_PHONE_init ()
cfg = GCG_get_configuration ();
speaker = GNUNET_SPEAKER_create_from_hardware (cfg);
mic = GNUNET_MICROPHONE_create_from_hardware (cfg);
- b_add_contact = GTK_WIDGET (GCG_get_main_window_object
- ("gnunet_conversation_gtk_add_contact_button"));
- b_accept = GTK_WIDGET (GCG_get_main_window_object
- ("gnunet_conversation_gtk_accept_button"));
- b_refuse = GTK_WIDGET (GCG_get_main_window_object
- ("gnunet_conversation_gtk_refuse_button"));
- b_suspend = GTK_WIDGET (GCG_get_main_window_object
- ("gnunet_conversation_gtk_suspend_button"));
- b_resume = GTK_WIDGET (GCG_get_main_window_object
- ("gnunet_conversation_gtk_resume_button"));
- b_call = GTK_WIDGET (GCG_get_main_window_object
- ("gnunet_conversation_gtk_call_button"));
- b_hangup = GTK_WIDGET (GCG_get_main_window_object
- ("gnunet_conversation_gtk_hangup_button"));
- b_copy = GTK_WIDGET (GCG_get_main_window_object
- ("gnunet_conversation_gtk_ego_copy_button"));
- address_entry = GTK_ENTRY (GCG_get_main_window_object
- ("gnunet_conversation_gtk_address_entry"));
- active_liststore =
- GTK_LIST_STORE (GCG_get_main_window_object
- ("gnunet_conversation_gtk_active_calls_liststore"));
- active_treeview =
- GTK_TREE_VIEW (GCG_get_main_window_object
- ("gnunet_conversation_gtk_active_calls_treeview"));
+ b_add_contact = GTK_WIDGET (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_add_contact_button"));
+ b_accept = GTK_WIDGET (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_accept_button"));
+ b_refuse = GTK_WIDGET (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_refuse_button"));
+ b_suspend = GTK_WIDGET (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_suspend_button"));
+ b_resume = GTK_WIDGET (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_resume_button"));
+ b_call = GTK_WIDGET (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_call_button"));
+ b_hangup = GTK_WIDGET (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_hangup_button"));
+ b_copy = GTK_WIDGET (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_ego_copy_button"));
+ address_entry = GTK_ENTRY (
+ GCG_get_main_window_object ("gnunet_conversation_gtk_address_entry"));
+ active_liststore = GTK_LIST_STORE (GCG_get_main_window_object (
+ "gnunet_conversation_gtk_active_calls_liststore"));
+ active_treeview = GTK_TREE_VIEW (GCG_get_main_window_object (
+ "gnunet_conversation_gtk_active_calls_treeview"));
do_status ();
}
diff --git a/src/conversation/gnunet-conversation-gtk_visibility.c
b/src/conversation/gnunet-conversation-gtk_visibility.c
index 4be9691d..35f5ab15 100644
--- a/src/conversation/gnunet-conversation-gtk_visibility.c
+++ b/src/conversation/gnunet-conversation-gtk_visibility.c
@@ -34,8 +34,7 @@
* @param toggle_menu name of menu entry
*/
static void
-toggle_view (const char *toggled_widget,
- const char *toggle_menu)
+toggle_view (const char *toggled_widget, const char *toggle_menu)
{
GtkCheckMenuItem *mi;
GtkWidget *widget;
@@ -56,7 +55,7 @@ toggle_view (const char *toggled_widget,
* @param data main window builder (unused)
*/
void
-gnunet_conversation_gtk_view_log_checkmenuitem_toggled_cb (GtkWidget * dummy,
+gnunet_conversation_gtk_view_log_checkmenuitem_toggled_cb (GtkWidget *dummy,
gpointer data)
{
toggle_view ("gnunet_conversation_gtk_log_frame",
@@ -71,7 +70,7 @@ gnunet_conversation_gtk_view_log_checkmenuitem_toggled_cb
(GtkWidget * dummy,
* @param data main window builder (unused)
*/
void
-gnunet_conversation_gtk_view_history_checkmenuitem_toggled_cb (GtkWidget *
dummy,
+gnunet_conversation_gtk_view_history_checkmenuitem_toggled_cb (GtkWidget
*dummy,
gpointer data)
{
toggle_view ("gnunet_conversation_gtk_history_frame",
@@ -86,8 +85,9 @@ gnunet_conversation_gtk_view_history_checkmenuitem_toggled_cb
(GtkWidget * dummy
* @param data main window builder (unused)
*/
void
-gnunet_conversation_gtk_view_caller_id_checkmenuitem_toggled_cb (GtkWidget *
dummy,
- gpointer data)
+gnunet_conversation_gtk_view_caller_id_checkmenuitem_toggled_cb (
+ GtkWidget *dummy,
+ gpointer data)
{
toggle_view ("gnunet_conversation_gtk_caller_identity_frame",
"gnunet_conversation_gtk_view_caller_id_checkmenuitem");
@@ -101,8 +101,9 @@
gnunet_conversation_gtk_view_caller_id_checkmenuitem_toggled_cb (GtkWidget * dum
* @param data main window builder (unused)
*/
void
-gnunet_conversation_gtk_view_address_book_checkmenuitem_toggled_cb (GtkWidget
*dummy,
- gpointer data)
+gnunet_conversation_gtk_view_address_book_checkmenuitem_toggled_cb (
+ GtkWidget *dummy,
+ gpointer data)
{
toggle_view ("gnunet_conversation_gtk_addressbook_frame",
"gnunet_conversation_gtk_view_address_book_checkmenuitem");
diff --git a/src/conversation/gnunet-conversation-gtk_zones.c
b/src/conversation/gnunet-conversation-gtk_zones.c
index bfb8d2e6..c0aecc2a 100644
--- a/src/conversation/gnunet-conversation-gtk_zones.c
+++ b/src/conversation/gnunet-conversation-gtk_zones.c
@@ -76,18 +76,19 @@ GCG_ZONES_get_selected_zone (const char **name)
GtkTreeIter iter;
GtkComboBox *cb;
- cb = GTK_COMBO_BOX (GCG_get_main_window_object
- ("gnunet_conversation_gtk_contacts_zone_combobox"));
- if (! gtk_combo_box_get_active_iter (cb,
- &iter))
+ cb = GTK_COMBO_BOX (GCG_get_main_window_object (
+ "gnunet_conversation_gtk_contacts_zone_combobox"));
+ if (! gtk_combo_box_get_active_iter (cb, &iter))
{
*name = NULL;
return NULL;
}
gtk_tree_model_get (GTK_TREE_MODEL (zone_liststore),
&iter,
- ZONE_LS_EGO, &ego,
- ZONE_LS_NAME, name,
+ ZONE_LS_EGO,
+ &ego,
+ ZONE_LS_NAME,
+ name,
-1);
return ego;
}
@@ -124,51 +125,43 @@ identity_cb (void *cls,
/* new identity */
GNUNET_assert (NULL != name);
gtk_list_store_insert_with_values (zone_liststore,
- &iter, -1,
- ZONE_LS_NAME, name,
- ZONE_LS_EGO, ego,
+ &iter,
+ -1,
+ ZONE_LS_NAME,
+ name,
+ ZONE_LS_EGO,
+ ego,
-1);
- cb = GTK_COMBO_BOX (GCG_get_main_window_object
- ("gnunet_conversation_gtk_contacts_zone_combobox"));
- if ( (! gtk_combo_box_get_active_iter (cb,
- &iter2)) &&
- ( (NULL == default_ego) ||
- (0 == strcmp (name,
- default_ego)) ) )
+ cb = GTK_COMBO_BOX (GCG_get_main_window_object (
+ "gnunet_conversation_gtk_contacts_zone_combobox"));
+ if ((! gtk_combo_box_get_active_iter (cb, &iter2)) &&
+ ((NULL == default_ego) || (0 == strcmp (name, default_ego))))
{
/* found an ego (or the ego) that we were supposed to use by
default, select it! */
- gtk_combo_box_set_active_iter (cb,
- &iter);
+ gtk_combo_box_set_active_iter (cb, &iter);
}
- 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);
gtk_tree_path_free (path);
*ctx = rr;
return;
}
/* existing ego, locate and execute rename/delete */
path = gtk_tree_row_reference_get_path (rr);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (zone_liststore),
- &iter,
- path));
+ GNUNET_assert (
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (zone_liststore), &iter, path));
gtk_tree_path_free (path);
if (NULL == name)
{
/* deletion operation */
gtk_tree_row_reference_free (rr);
*ctx = NULL;
- gtk_list_store_remove (zone_liststore,
- &iter);
+ gtk_list_store_remove (zone_liststore, &iter);
return;
}
/* rename operation */
- gtk_list_store_set (zone_liststore,
- &iter,
- ZONE_LS_NAME, &name,
- -1);
+ gtk_list_store_set (zone_liststore, &iter, ZONE_LS_NAME, &name, -1);
}
@@ -182,12 +175,9 @@ GCG_ZONES_init (const char *ego_name)
{
if (NULL != ego_name)
default_ego = GNUNET_strdup (ego_name);
- zone_liststore
- = GTK_LIST_STORE (GCG_get_main_window_object
- ("gnunet_conversation_gtk_contacts_zone_liststore"));
- id = GNUNET_IDENTITY_connect (GCG_get_configuration (),
- &identity_cb,
- NULL);
+ zone_liststore = GTK_LIST_STORE (GCG_get_main_window_object (
+ "gnunet_conversation_gtk_contacts_zone_liststore"));
+ id = GNUNET_IDENTITY_connect (GCG_get_configuration (), &identity_cb, NULL);
}
diff --git a/src/conversation/gnunet-conversation-gtk_zones.h
b/src/conversation/gnunet-conversation-gtk_zones.h
index a9f5dd15..b5bc9bcc 100644
--- a/src/conversation/gnunet-conversation-gtk_zones.h
+++ b/src/conversation/gnunet-conversation-gtk_zones.h
@@ -53,6 +53,6 @@ GCG_ZONES_init (const char *ego_name);
* Shutdown the contact list
*/
void
-GCG_ZONES_shutdown(void);
+GCG_ZONES_shutdown (void);
#endif
diff --git a/src/fs/gnunet-fs-gtk.c b/src/fs/gnunet-fs-gtk.c
index 24bfdbe5..76e4154a 100644
--- a/src/fs/gnunet-fs-gtk.c
+++ b/src/fs/gnunet-fs-gtk.c
@@ -147,7 +147,8 @@ GNUNET_FS_GTK_get_main_window_object (const char *name)
GtkTreeModel *
GNUNET_FS_GTK_get_anonymity_level_list_store ()
{
- return GTK_TREE_MODEL (GNUNET_FS_GTK_get_main_window_object
("anonymity_level_liststore"));
+ return GTK_TREE_MODEL (
+ GNUNET_FS_GTK_get_main_window_object ("anonymity_level_liststore"));
}
@@ -170,35 +171,48 @@ main_window_save_position (GtkWidget *main_window)
struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_CONFIGURATION_Handle *cfgDefault;
- cfg = (struct GNUNET_CONFIGURATION_Handle *)
GNUNET_GTK_main_loop_get_configuration (ml);
+ cfg = (struct GNUNET_CONFIGURATION_Handle *)
+ GNUNET_GTK_main_loop_get_configuration (ml);
main_window_gdk = gtk_widget_get_window (main_window);
maximized = GNUNET_YES;
if (NULL != main_window_gdk)
{
window_state = gdk_window_get_state (main_window_gdk);
- if (!(window_state & GDK_WINDOW_STATE_MAXIMIZED))
+ if (! (window_state & GDK_WINDOW_STATE_MAXIMIZED))
maximized = GNUNET_NO;
}
gtk_window_get_position (GTK_WINDOW (main_window), &window_x, &window_y);
gtk_window_get_size (GTK_WINDOW (main_window), &window_width,
&window_height);
- GNUNET_CONFIGURATION_set_value_number (cfg, "gnunet-fs-gtk",
- "MAIN_WINDOW_X", window_x);
- GNUNET_CONFIGURATION_set_value_number (cfg, "gnunet-fs-gtk",
- "MAIN_WINDOW_Y", window_y);
- GNUNET_CONFIGURATION_set_value_number (cfg, "gnunet-fs-gtk",
- "MAIN_WINDOW_WIDTH", window_width);
- GNUNET_CONFIGURATION_set_value_number (cfg, "gnunet-fs-gtk",
- "MAIN_WINDOW_HEIGHT", window_height);
- GNUNET_CONFIGURATION_set_value_string (cfg, "gnunet-fs-gtk",
- "MAIN_WINDOW_MAXIMIZED",
- (maximized == GNUNET_YES) ? "YES" :
"NO");
+ GNUNET_CONFIGURATION_set_value_number (cfg,
+ "gnunet-fs-gtk",
+ "MAIN_WINDOW_X",
+ window_x);
+ GNUNET_CONFIGURATION_set_value_number (cfg,
+ "gnunet-fs-gtk",
+ "MAIN_WINDOW_Y",
+ window_y);
+ GNUNET_CONFIGURATION_set_value_number (cfg,
+ "gnunet-fs-gtk",
+ "MAIN_WINDOW_WIDTH",
+ window_width);
+ GNUNET_CONFIGURATION_set_value_number (cfg,
+ "gnunet-fs-gtk",
+ "MAIN_WINDOW_HEIGHT",
+ window_height);
+ GNUNET_CONFIGURATION_set_value_string (cfg,
+ "gnunet-fs-gtk",
+ "MAIN_WINDOW_MAXIMIZED",
+ (maximized == GNUNET_YES) ? "YES"
+ : "NO");
cfgDefault = GNUNET_CONFIGURATION_create ();
(void) GNUNET_CONFIGURATION_load (cfgDefault, NULL); /* load defaults only */
- GNUNET_CONFIGURATION_write_diffs (cfgDefault, cfg,
- GNUNET_GTK_main_loop_get_configuration_file
(ml));
+ GNUNET_CONFIGURATION_write_diffs (cfgDefault,
+ cfg,
+
GNUNET_GTK_main_loop_get_configuration_file (
+ ml));
GNUNET_CONFIGURATION_destroy (cfgDefault);
}
@@ -213,8 +227,8 @@ main_window_save_position (GtkWidget *main_window)
*/
gboolean
GNUNET_GTK_main_window_configure_event_cb (GtkWidget *main_window,
- GdkEventConfigure *event,
- gpointer user_data)
+ GdkEventConfigure *event,
+ gpointer user_data)
{
struct GNUNET_GTK_MainWindowContext *main_context = user_data;
@@ -239,9 +253,7 @@ shutdown_task (void *cls)
{
GNUNET_FS_probe_stop (sr->probe);
sr->probe = NULL;
- GNUNET_CONTAINER_DLL_remove (pl_head,
- pl_tail,
- sr);
+ GNUNET_CONTAINER_DLL_remove (pl_head, pl_tail, sr);
}
if (NULL != fs)
{
@@ -303,8 +315,7 @@ shutdown_task (void *cls)
* @param user_data global builder instance, unused
*/
void
-GNUNET_FS_GTK_menu_quit_activate_cb (GtkMenuItem *object,
- gpointer user_data)
+GNUNET_FS_GTK_menu_quit_activate_cb (GtkMenuItem *object, gpointer user_data)
{
GNUNET_SCHEDULER_shutdown ();
}
@@ -319,8 +330,8 @@ GNUNET_FS_GTK_menu_quit_activate_cb (GtkMenuItem *object,
*/
void
GNUNET_FS_GTK_delete_event_cb (GtkWidget *object,
- GdkEvent *event,
- gpointer user_data)
+ GdkEvent *event,
+ gpointer user_data)
{
/* GNUNET_FS_GTK_delete_event_cb will eventually be called if we shut down
* the scheduler, because shutting it down will make GTK delete the main
@@ -342,9 +353,7 @@ GNUNET_FS_GTK_delete_event_cb (GtkWidget *object,
* @param data NULL
*/
static void
-process_paste (GtkClipboard *cb,
- const gchar *text,
- gpointer data)
+process_paste (GtkClipboard *cb, const gchar *text, gpointer data)
{
struct GNUNET_FS_Uri *kskuri;
char *emsg;
@@ -375,15 +384,14 @@ process_paste (GtkClipboard *cb,
* TRUE if there is now a pop-up menu
*/
gboolean
-GNUNET_FS_GTK_main_window_button_press_event (GtkWidget * widget,
- GdkEvent * event,
- gpointer user_data)
+GNUNET_FS_GTK_main_window_button_press_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
{
GdkEventButton *event_button = (GdkEventButton *) event;
GtkClipboard *cb;
- if ( (GDK_BUTTON_PRESS != event->type) ||
- (2 != event_button->button) )
+ if ((GDK_BUTTON_PRESS != event->type) || (2 != event_button->button))
return FALSE;
cb = gtk_clipboard_get (gdk_atom_intern ("PRIMARY", FALSE));
gtk_clipboard_request_text (cb, &process_paste, NULL);
@@ -405,10 +413,10 @@ GNUNET_FS_GTK_main_window_button_press_event (GtkWidget *
widget,
*/
static UniqueResponse
unique_app_message_cb (UniqueApp *app,
- gint command,
- UniqueMessageData *message_data,
- guint time_,
- gpointer user_data)
+ gint command,
+ UniqueMessageData *message_data,
+ guint time_,
+ gpointer user_data)
{
struct GNUNET_GTK_MainWindowContext *main_context = user_data;
@@ -418,46 +426,44 @@ unique_app_message_cb (UniqueApp *app,
time_);
switch (command)
+ {
+ case UNIQUE_NEW:
+ /* this is unexpected... */
+ GNUNET_break (0);
+ break;
+ case UNIQUE_OPEN: {
+ gchar **uris;
+ gint n_uris;
+ gint i;
+
+ uris = unique_message_data_get_uris (message_data);
+ n_uris = g_strv_length (uris);
+ for (i = 0; i < n_uris; i++)
{
- case UNIQUE_NEW:
- /* this is unexpected... */
- GNUNET_break (0);
- break;
- case UNIQUE_OPEN:
- {
- gchar **uris;
- gint n_uris;
- gint i;
-
- uris = unique_message_data_get_uris (message_data);
- n_uris = g_strv_length (uris);
- for (i = 0; i < n_uris; i++)
- {
- if (GNUNET_OK !=
- GNUNET_FS_GTK_handle_uri_string (uris[i],
- 1 /* anonymity level */))
- return UNIQUE_RESPONSE_PASSTHROUGH;
- }
- g_strfreev (uris);
- }
- break;
- case UNIQUE_ACTIVATE:
- break;
- default:
- break;
+ if (GNUNET_OK !=
+ GNUNET_FS_GTK_handle_uri_string (uris[i], 1 /* anonymity level */))
+ return UNIQUE_RESPONSE_PASSTHROUGH;
}
+ g_strfreev (uris);
+ }
+ break;
+ case UNIQUE_ACTIVATE:
+ break;
+ default:
+ break;
+ }
return UNIQUE_RESPONSE_OK;
}
#endif
static char *
-format_service_list (unsigned int count, const char *const*list)
+format_service_list (unsigned int count, const char *const *list)
{
size_t len = 0;
int i;
- const char *header = _("GNUnet node appears to be on.");
- const char *listheader = _("Currently running services:\n");
+ const char *header = _ ("GNUnet node appears to be on.");
+ const char *listheader = _ ("Currently running services:\n");
char *result;
char *p;
int r;
@@ -506,9 +512,9 @@ format_service_list (unsigned int count, const char
*const*list)
static void
service_list_callback (void *cls,
- enum GNUNET_ARM_RequestStatus rs,
- unsigned int count,
- const char *const*list)
+ enum GNUNET_ARM_RequestStatus rs,
+ unsigned int count,
+ const char *const *list)
{
char *service_list;
@@ -521,8 +527,7 @@ service_list_callback (void *cls,
static void
-arm_connection_state_change (void *cls,
- int connected)
+arm_connection_state_change (void *cls, int connected)
{
char *service_list;
@@ -531,27 +536,27 @@ arm_connection_state_change (void *cls,
service_list = format_service_list (0, NULL);
GNUNET_FS_GTK_update_connection_indicator (cls, TRUE, service_list);
GNUNET_free_non_null (service_list);
- GNUNET_ARM_request_service_list (arm,
- &service_list_callback, cls);
+ GNUNET_ARM_request_service_list (arm, &service_list_callback, cls);
}
else
- GNUNET_FS_GTK_update_connection_indicator (cls, FALSE,
- _("Can't connect to the Automatic Restart Manager service."));
+ GNUNET_FS_GTK_update_connection_indicator (
+ cls,
+ FALSE,
+ _ ("Can't connect to the Automatic Restart Manager service."));
}
static void
service_status_change (void *cls,
- const char *service,
- enum GNUNET_ARM_ServiceStatus status)
+ const char *service,
+ enum GNUNET_ARM_ServiceStatus status)
{
/* Very crude, we can probably do better.
* Maybe keep a list of running services, and modify it in response
* to service status changes, then update the indicator,
* without requesting a list from ARM every goddamned time?
*/
- GNUNET_ARM_request_service_list (arm,
- &service_list_callback, cls);
+ GNUNET_ARM_request_service_list (arm, &service_list_callback, cls);
}
@@ -560,16 +565,19 @@ monitor_zone_error (void *cls)
{
GtkListStore *ls;
- ls = GTK_LIST_STORE (GNUNET_FS_GTK_get_main_window_object
("namespace_label_liststore"));
+ ls = GTK_LIST_STORE (
+ GNUNET_FS_GTK_get_main_window_object ("namespace_label_liststore"));
gtk_list_store_clear (ls);
- gtk_widget_hide (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object
("main_window_search_namespace_combobox")));
+ gtk_widget_hide (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object (
+ "main_window_search_namespace_combobox")));
}
static void
monitor_zone_sync (void *cls)
{
- gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object
("main_window_search_namespace_combobox")));
+ gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object (
+ "main_window_search_namespace_combobox")));
}
@@ -587,10 +595,10 @@ monitor_zone_sync (void *cls)
*/
static void
monitor_zone_records (void *cls,
- const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
- const char *label,
- unsigned int rd_count,
- const struct GNUNET_GNSRECORD_Data *rd)
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
+ const char *label,
+ unsigned int rd_count,
+ const struct GNUNET_GNSRECORD_Data *rd)
{
GtkListStore *ls;
GtkTreeModel *tm;
@@ -598,39 +606,30 @@ monitor_zone_records (void *cls,
gchar *id;
gchar *label_gnu;
- GNUNET_NAMESTORE_zone_monitor_next (main_context.zm,
- 1);
- ls = GTK_LIST_STORE (GNUNET_FS_GTK_get_main_window_object
("namespace_label_liststore"));
- label_gnu = g_strdup_printf ("%s.%s",
- label,
- "gnu");
+ GNUNET_NAMESTORE_zone_monitor_next (main_context.zm, 1);
+ ls = GTK_LIST_STORE (
+ GNUNET_FS_GTK_get_main_window_object ("namespace_label_liststore"));
+ label_gnu = g_strdup_printf ("%s.%s", label, "gnu");
if (0 == rd_count)
{
tm = GTK_TREE_MODEL (ls);
if (gtk_tree_model_get_iter_first (tm, &iter))
do
- {
- gtk_tree_model_get (tm, &iter,
- 0, &id,
- -1);
- if (0 == strcmp (id, label_gnu))
- {
- GNUNET_assert (gtk_list_store_remove (ls, &iter));
- g_free (id);
- g_free (label_gnu);
- return;
- }
- g_free (id);
- }
- while (gtk_tree_model_iter_next (tm, &iter));
+ {
+ gtk_tree_model_get (tm, &iter, 0, &id, -1);
+ if (0 == strcmp (id, label_gnu))
+ {
+ GNUNET_assert (gtk_list_store_remove (ls, &iter));
+ g_free (id);
+ g_free (label_gnu);
+ return;
+ }
+ g_free (id);
+ } while (gtk_tree_model_iter_next (tm, &iter));
GNUNET_break (0);
return;
}
- gtk_list_store_insert_with_values (ls,
- &iter,
- -1,
- 0, label_gnu,
- -1);
+ gtk_list_store_insert_with_values (ls, &iter, -1, 0, label_gnu, -1);
g_free (label_gnu);
}
@@ -649,31 +648,35 @@ monitor_zone_records (void *cls,
*/
static void
handle_sks_zone_identity (void *cls,
- struct GNUNET_IDENTITY_Ego *ego,
- void **ctx,
- const char *name)
+ struct GNUNET_IDENTITY_Ego *ego,
+ void **ctx,
+ const char *name)
{
main_context.id_op = NULL;
if (NULL == ego)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("No default ego specified for `fs-sks` service, will not
enable namespace search.\n"));
+ GNUNET_log (
+ GNUNET_ERROR_TYPE_WARNING,
+ _ (
+ "No default ego specified for `fs-sks` service, will not enable
namespace search.\n"));
return;
}
main_context.sks_zone = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
*main_context.sks_zone = *GNUNET_IDENTITY_ego_get_private_key (ego);
- gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object
("main_window_search_namespace_label")));
- gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object
("main_window_search_namespace_combobox")));
+ gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object (
+ "main_window_search_namespace_label")));
+ gtk_widget_show (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object (
+ "main_window_search_namespace_combobox")));
main_context.zm = GNUNET_NAMESTORE_zone_monitor_start (main_context.cfg,
- main_context.sks_zone,
+ main_context.sks_zone,
GNUNET_YES,
&monitor_zone_error,
NULL,
- &monitor_zone_records,
- NULL,
+ &monitor_zone_records,
+ NULL,
&monitor_zone_sync,
- NULL);
+ NULL);
}
@@ -700,36 +703,68 @@ run (void *cls)
return;
main_context.builder = GNUNET_GTK_main_loop_get_builder (ml);
main_context.cfg = GNUNET_GTK_main_loop_get_configuration (ml);
- main_context.search_ns_treestore = GTK_TREE_STORE
(GNUNET_FS_GTK_get_main_window_object
("main_window_search_namespace_treestore"));
- main_context.main_window = GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_main_window"));
- main_context.main_window = GNUNET_GTK_plug_me ("GNUNET_FS_GTK_PLUG",
- main_context.main_window);
- main_context.ns_selector_treeview = GTK_TREE_VIEW
(GNUNET_FS_GTK_get_main_window_object ("namespace_selector_treeview"));
- main_context.ns_selector_window = GTK_WIDGET
(GNUNET_FS_GTK_get_main_window_object ("namespace_selector_window"));
- main_context.ns_dropdown_button = GTK_TOGGLE_BUTTON
(GNUNET_FS_GTK_get_main_window_object
("main_window_search_namespace_dropdown_button"));
- main_context.search_ns_label = GTK_LABEL
(GNUNET_FS_GTK_get_main_window_object
("main_window_search_selected_namespace_label"));
-
- main_context.search_entry = GTK_ENTRY (GNUNET_FS_GTK_get_main_window_object
("main_window_search_entry"));
-
- downloads_treestore = GTK_TREE_STORE (GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_file_sharing_downloads_tree_store"));
- main_context.anonymity_combo = GTK_COMBO_BOX
(GNUNET_FS_GTK_get_main_window_object
("main_window_search_anonymity_combobox"));
- main_context.anonymity_level_liststore = GTK_LIST_STORE
(GNUNET_FS_GTK_get_main_window_object ("anonymity_level_liststore"));
-
- main_context.preview_image = GTK_IMAGE (GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_main_window_preview_image"));
- main_context.md_liststore = GTK_LIST_STORE
(GNUNET_FS_GTK_get_main_window_object ("GNUNET_GTK_meta_data_list_store"));
- main_context.md_treeview = GTK_TREE_VIEW
(GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_main_window_metadata_treeview"));
+ main_context.search_ns_treestore =
+ GTK_TREE_STORE (GNUNET_FS_GTK_get_main_window_object (
+ "main_window_search_namespace_treestore"));
+ main_context.main_window = GTK_WIDGET (
+ GNUNET_FS_GTK_get_main_window_object ("GNUNET_GTK_main_window"));
+ main_context.main_window =
+ GNUNET_GTK_plug_me ("GNUNET_FS_GTK_PLUG", main_context.main_window);
+ main_context.ns_selector_treeview = GTK_TREE_VIEW (
+ GNUNET_FS_GTK_get_main_window_object ("namespace_selector_treeview"));
+ main_context.ns_selector_window = GTK_WIDGET (
+ GNUNET_FS_GTK_get_main_window_object ("namespace_selector_window"));
+ main_context.ns_dropdown_button =
+ GTK_TOGGLE_BUTTON (GNUNET_FS_GTK_get_main_window_object (
+ "main_window_search_namespace_dropdown_button"));
+ main_context.search_ns_label =
+ GTK_LABEL (GNUNET_FS_GTK_get_main_window_object (
+ "main_window_search_selected_namespace_label"));
+
+ main_context.search_entry = GTK_ENTRY (
+ GNUNET_FS_GTK_get_main_window_object ("main_window_search_entry"));
+
+ downloads_treestore = GTK_TREE_STORE (GNUNET_FS_GTK_get_main_window_object (
+ "GNUNET_GTK_file_sharing_downloads_tree_store"));
+ main_context.anonymity_combo =
+ GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object (
+ "main_window_search_anonymity_combobox"));
+ main_context.anonymity_level_liststore = GTK_LIST_STORE (
+ GNUNET_FS_GTK_get_main_window_object ("anonymity_level_liststore"));
+
+ main_context.preview_image = GTK_IMAGE (GNUNET_FS_GTK_get_main_window_object
(
+ "GNUNET_GTK_main_window_preview_image"));
+ main_context.md_liststore = GTK_LIST_STORE (
+ GNUNET_FS_GTK_get_main_window_object ("GNUNET_GTK_meta_data_list_store"));
+ main_context.md_treeview =
+ GTK_TREE_VIEW (GNUNET_FS_GTK_get_main_window_object (
+ "GNUNET_GTK_main_window_metadata_treeview"));
main_context.ns_discovery_handle = NULL;
- main_context.download_location_chooser = GTK_FILE_CHOOSER
(GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_search_frame_download_location_chooser"));
- main_context.download_name_entry = GTK_ENTRY
(GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_search_frame_download_filename_entry"));
- main_context.download_anonymity_combo = GTK_COMBO_BOX
(GNUNET_FS_GTK_get_main_window_object
("main_window_download_anonymity_combobox"));
- main_context.download_recursive_checkbutton = GTK_CHECK_BUTTON
(GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_search_frame_download_recursive_checkbox"));
- main_context.download_download_button = GTK_BUTTON
(GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_search_frame_download_download_button"));
- main_context.download_panel = GTK_BOX (GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_search_frame_download_vbox"));
-
- main_context.notebook = GTK_NOTEBOOK (GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_main_window_notebook"));
-
- main_context.connection_indicator = GTK_IMAGE
(GNUNET_FS_GTK_get_main_window_object
("GNUNET_FS_GTK_main_window_connection_indicator"));
+ main_context.download_location_chooser =
+ GTK_FILE_CHOOSER (GNUNET_FS_GTK_get_main_window_object (
+ "GNUNET_GTK_search_frame_download_location_chooser"));
+ main_context.download_name_entry =
+ GTK_ENTRY (GNUNET_FS_GTK_get_main_window_object (
+ "GNUNET_GTK_search_frame_download_filename_entry"));
+ main_context.download_anonymity_combo =
+ GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object (
+ "main_window_download_anonymity_combobox"));
+ main_context.download_recursive_checkbutton =
+ GTK_CHECK_BUTTON (GNUNET_FS_GTK_get_main_window_object (
+ "GNUNET_GTK_search_frame_download_recursive_checkbox"));
+ main_context.download_download_button =
+ GTK_BUTTON (GNUNET_FS_GTK_get_main_window_object (
+ "GNUNET_GTK_search_frame_download_download_button"));
+ main_context.download_panel = GTK_BOX (GNUNET_FS_GTK_get_main_window_object (
+ "GNUNET_GTK_search_frame_download_vbox"));
+
+ main_context.notebook = GTK_NOTEBOOK (
+ GNUNET_FS_GTK_get_main_window_object ("GNUNET_GTK_main_window_notebook"));
+
+ main_context.connection_indicator =
+ GTK_IMAGE (GNUNET_FS_GTK_get_main_window_object (
+ "GNUNET_FS_GTK_main_window_connection_indicator"));
GNUNET_GTK_set_icon_search_path ();
GNUNET_GTK_setup_nls ();
@@ -743,22 +778,32 @@ run (void *cls)
/* setup main window */
maximized = GNUNET_CONFIGURATION_get_value_yesno (main_context.cfg,
- "gnunet-fs-gtk",
+ "gnunet-fs-gtk",
"MAIN_WINDOW_MAXIMIZED");
if (GNUNET_SYSERR == maximized)
maximized = GNUNET_YES;
- if ( (GNUNET_NO == maximized) &&
- (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (main_context.cfg,
"gnunet-fs-gtk",
- "MAIN_WINDOW_X",
&window_x)) &&
- (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (main_context.cfg,
"gnunet-fs-gtk",
- "MAIN_WINDOW_Y",
&window_y)) &&
- (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (main_context.cfg,
"gnunet-fs-gtk",
-
"MAIN_WINDOW_WIDTH", &window_width)) &&
- (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (main_context.cfg,
"gnunet-fs-gtk",
-
"MAIN_WINDOW_HEIGHT", &window_height)) )
+ if ((GNUNET_NO == maximized) &&
+ (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (main_context.cfg,
+ "gnunet-fs-gtk",
+ "MAIN_WINDOW_X",
+ &window_x)) &&
+ (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (main_context.cfg,
+ "gnunet-fs-gtk",
+ "MAIN_WINDOW_Y",
+ &window_y)) &&
+ (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (main_context.cfg,
+ "gnunet-fs-gtk",
+ "MAIN_WINDOW_WIDTH",
+ &window_width)) &&
+ (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (main_context.cfg,
+ "gnunet-fs-gtk",
+
"MAIN_WINDOW_HEIGHT",
+ &window_height)))
{
gtk_window_move (GTK_WINDOW (main_context.main_window), window_x,
window_y);
- gtk_window_resize (GTK_WINDOW (main_context.main_window), window_width,
window_height);
+ gtk_window_resize (GTK_WINDOW (main_context.main_window),
+ window_width,
+ window_height);
}
else
{
@@ -769,7 +814,8 @@ run (void *cls)
/* Allow multiple selection in metadata view; */
/* FIXME-GTK3: this can be done within (modern versions of) glade
(However, this needs GTK >= 3.2, we currently target 3.0) */
- gtk_tree_selection_set_mode (gtk_tree_view_get_selection
(main_context.md_treeview),
+ gtk_tree_selection_set_mode (gtk_tree_view_get_selection (
+ main_context.md_treeview),
GTK_SELECTION_MULTIPLE);
/* FIXME: should these '1's be here? Maybe better to put them into
@@ -789,9 +835,11 @@ run (void *cls)
req_parallel = DEFAULT_MAX_PARALLEL_REQUESTS;
/* initialize file-sharing */
- fs = GNUNET_FS_start (main_context.cfg, "gnunet-fs-gtk",
- &GNUNET_GTK_fs_event_handler, NULL,
- GNUNET_FS_FLAGS_PERSISTENCE | GNUNET_FS_FLAGS_DO_PROBES,
+ fs = GNUNET_FS_start (main_context.cfg,
+ "gnunet-fs-gtk",
+ &GNUNET_GTK_fs_event_handler,
+ NULL,
+ GNUNET_FS_FLAGS_PERSISTENCE |
GNUNET_FS_FLAGS_DO_PROBES,
GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM,
(unsigned int) dl_parallel,
GNUNET_FS_OPTIONS_REQUEST_PARALLELISM,
@@ -809,15 +857,18 @@ run (void *cls)
&service_status_change,
&main_context);
main_context.gns = GNUNET_GNS_connect (main_context.cfg);
- main_context.identity = GNUNET_IDENTITY_connect (main_context.cfg, NULL,
NULL);
+ main_context.identity =
+ GNUNET_IDENTITY_connect (main_context.cfg, NULL, NULL);
main_context.id_op = GNUNET_IDENTITY_get (main_context.identity,
- "fs-sks",
- &handle_sks_zone_identity,
- NULL);
+ "fs-sks",
+ &handle_sks_zone_identity,
+ NULL);
#if HAVE_LIBUNIQUE
unique_app_watch_window (unique_app, GTK_WINDOW (main_context.main_window));
- g_signal_connect (unique_app, "message-received",
- G_CALLBACK (unique_app_message_cb), &main_context);
+ g_signal_connect (unique_app,
+ "message-received",
+ G_CALLBACK (unique_app_message_cb),
+ &main_context);
#endif
/* make GUI visible */
gtk_widget_show (main_context.main_window);
@@ -831,14 +882,11 @@ run (void *cls)
GNUNET_GTK_main_loop_get_args (ml, &argc, &argv);
for (i = 0; i < argc; i++)
- {
- if (GNUNET_OK !=
- GNUNET_FS_GTK_handle_uri_string (argv[i],
- 1 /* anonymity level */))
- fprintf (stderr,
- "Invalid URI `%s'\n",
- argv[i]);
- }
+ {
+ if (GNUNET_OK !=
+ GNUNET_FS_GTK_handle_uri_string (argv[i], 1 /* anonymity level */))
+ fprintf (stderr, "Invalid URI `%s'\n", argv[i]);
+ }
}
GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
}
@@ -848,8 +896,7 @@ int
main (int argc, char **argv)
{
static struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
+ GNUNET_GETOPT_OPTION_END};
#if HAVE_LIBUNIQUE
int arge;
@@ -859,20 +906,16 @@ main (int argc, char **argv)
{
UniqueResponse response;
- arge = GNUNET_GETOPT_run ("gnunet-fs-gtk",
- options,
- argc, argv);
+ arge = GNUNET_GETOPT_run ("gnunet-fs-gtk", options, argc, argv);
response = unique_app_send_message (unique_app, UNIQUE_ACTIVATE, NULL);
while (arge < argc)
{
UniqueMessageData *msg;
msg = unique_message_data_new ();
- unique_message_data_set_text (msg, argv[arge], strlen (argv[arge])+1);
+ unique_message_data_set_text (msg, argv[arge], strlen (argv[arge]) + 1);
if (UNIQUE_RESPONSE_OK == response)
- response = unique_app_send_message (unique_app,
- UNIQUE_OPEN,
- msg);
+ response = unique_app_send_message (unique_app, UNIQUE_OPEN, msg);
unique_message_data_free (msg);
arge++;
}
@@ -884,11 +927,12 @@ main (int argc, char **argv)
#endif
if (GNUNET_OK !=
GNUNET_GTK_main_loop_start ("gnunet-fs-gtk",
- "GTK GUI for GNUnet",
- argc, argv,
- options,
+ "GTK GUI for GNUnet",
+ argc,
+ argv,
+ options,
"gnunet_fs_gtk_main_window.glade",
- &run))
+ &run))
{
#if HAVE_LIBUNIQUE
g_object_unref (unique_app);
diff --git a/src/fs/gnunet-fs-gtk.h b/src/fs/gnunet-fs-gtk.h
index c8464aa8..e968efc7 100644
--- a/src/fs/gnunet-fs-gtk.h
+++ b/src/fs/gnunet-fs-gtk.h
@@ -65,13 +65,12 @@ struct SearchLookup
/**
* Task to trigger timeout.
*/
- struct GNUNET_SCHEDULER_Task * timeout_task;
+ struct GNUNET_SCHEDULER_Task *timeout_task;
/**
* Desired anonymity level.
*/
guint anonymity_level;
-
};
@@ -140,7 +139,6 @@ struct PseuLookupContext
* Nickname we're saving under.
*/
char *nick;
-
};
@@ -256,7 +254,6 @@ struct GNUNET_GTK_MainWindowContext
* Our zone for SKS operations. Can be NULL.
*/
struct GNUNET_CRYPTO_EcdsaPrivateKey *sks_zone;
-
};
@@ -264,86 +261,86 @@ struct GNUNET_GTK_MainWindowContext
* Columns in the search namespace model.
*/
enum GNUNET_GTK_FS_MAIN_WINDOW_SearchNamespaceModelColumns
- {
- /**
+{
+ /**
* A gchararray.
*/
- GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME = 0,
+ GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_NAME = 0,
- /**
+ /**
* A gpointer.
*/
- GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY = 1,
+ GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_KEY = 1,
- /**
+ /**
* A gchararray.
*/
- GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_ROOT = 2,
+ GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_ROOT = 2,
- /**
+ /**
* A gchararray.
*/
- GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_TOOLTIP = 3,
- };
+ GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_NAMESPACE_MC_TOOLTIP = 3,
+};
/**
* Columns in the meta data model.
*/
enum GNUNET_GTK_FS_MAIN_WINDOW_MetaDataModelColumns
- {
- /**
+{
+ /**
* A guint.
*/
- GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE = 0,
+ GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE = 0,
- /**
+ /**
* A guint.
*/
- GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_FORMAT = 1,
+ GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_FORMAT = 1,
- /**
+ /**
* A gchararray.
*/
- GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE_STRING = 2,
+ GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE_STRING = 2,
- /**
+ /**
* A gchararray.
*/
- GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_VALUE = 3,
- };
+ GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_VALUE = 3,
+};
/**
* Columns in the search mime model.
*/
enum GNUNET_GTK_FS_MAIN_WINDOW_SearchMimeModelColumns
- {
- /**
+{
+ /**
* A gchararray.
*/
- GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_MIME = 0,
+ GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_MIME = 0,
- /**
+ /**
* A gchararray.
*/
- GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_TYPE = 1,
+ GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_TYPE = 1,
- /**
+ /**
* A gchararray.
*/
- GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_EXTENSION = 2,
+ GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_EXTENSION = 2,
- /**
+ /**
* A gchararray.
*/
- GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_LOSSYNESS = 3,
+ GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_LOSSYNESS = 3,
- /**
+ /**
* A gchararray.
*/
- GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_FREEDOM = 4,
- };
+ GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_FREEDOM = 4,
+};
/**
* Get main context.
@@ -404,8 +401,9 @@ GNUNET_FS_GTK_get_main_window_object (const char *name);
* @return TRUE on success, FALSE on error
*/
gboolean
-GNUNET_GTK_get_selected_anonymity_level (GtkBuilder * builder,
- gchar * combo_name, guint * p_level);
+GNUNET_GTK_get_selected_anonymity_level (GtkBuilder *builder,
+ gchar *combo_name,
+ guint *p_level);
/**
@@ -416,7 +414,8 @@ GNUNET_GTK_get_selected_anonymity_level (GtkBuilder *
builder,
* @return TRUE on success, FALSE on error
*/
gboolean
-GNUNET_GTK_get_selected_anonymity_combo_level (GtkComboBox *combo, guint
*p_level);
+GNUNET_GTK_get_selected_anonymity_combo_level (GtkComboBox *combo,
+ guint *p_level);
/**
@@ -429,7 +428,8 @@ GNUNET_GTK_get_selected_anonymity_combo_level (GtkComboBox
*combo, guint *p_leve
* @return TRUE on success, FALSE on error (no item with such level)
*/
gboolean
-GNUNET_GTK_select_anonymity_level (GtkBuilder * builder, gchar * combo_name,
+GNUNET_GTK_select_anonymity_level (GtkBuilder *builder,
+ gchar *combo_name,
guint sel_level);
diff --git a/src/fs/gnunet-fs-gtk_about.c b/src/fs/gnunet-fs-gtk_about.c
index 51f6e6fe..917b713d 100644
--- a/src/fs/gnunet-fs-gtk_about.c
+++ b/src/fs/gnunet-fs-gtk_about.c
@@ -35,7 +35,7 @@
* @param data global builder, unused
*/
void
-GNUNET_GTK_main_menu_help_about_activate_cb (GtkWidget * dummy, gpointer data)
+GNUNET_GTK_main_menu_help_about_activate_cb (GtkWidget *dummy, gpointer data)
{
GNUNET_GTK_display_about ("gnunet_fs_gtk_about_window.glade");
}
diff --git a/src/fs/gnunet-fs-gtk_anonymity-widgets.c
b/src/fs/gnunet-fs-gtk_anonymity-widgets.c
index 4d53bf52..7b870323 100644
--- a/src/fs/gnunet-fs-gtk_anonymity-widgets.c
+++ b/src/fs/gnunet-fs-gtk_anonymity-widgets.c
@@ -37,7 +37,7 @@
* @param data the builder's closure, unused
*/
void
-GNUNET_GTK_anonymity_spin_button_value_changed_cb (GtkWidget * w, gpointer
data)
+GNUNET_GTK_anonymity_spin_button_value_changed_cb (GtkWidget *w, gpointer data)
{
#ifdef GdkRBGA
GtkSpinButton *spin;
@@ -83,13 +83,14 @@ GNUNET_GTK_anonymity_spin_button_value_changed_cb
(GtkWidget * w, gpointer data)
* @return TRUE on success, FALSE on failure
*/
gboolean
-GNUNET_GTK_select_anonymity_level (GtkBuilder * builder, gchar * combo_name,
+GNUNET_GTK_select_anonymity_level (GtkBuilder *builder,
+ gchar *combo_name,
guint sel_level)
{
GtkComboBox *combo;
combo = GTK_COMBO_BOX (gtk_builder_get_object (builder, combo_name));
- if (!combo)
+ if (! combo)
return FALSE;
return GNUNET_GTK_select_anonymity_combo_level (combo, sel_level);
}
@@ -110,13 +111,14 @@ GNUNET_GTK_select_anonymity_combo_level (GtkComboBox
*combo, guint sel_level)
guint level;
model = gtk_combo_box_get_model (combo);
- if (!model)
+ if (! model)
return FALSE;
if (! gtk_tree_model_get_iter_first (model, &iter))
return FALSE;
do
{
- gtk_tree_model_get (model, &iter,
+ gtk_tree_model_get (model,
+ &iter,
GNUNET_GTK_ANONYMITY_LEVEL_MC_LEVEL,
&level,
-1);
@@ -125,11 +127,9 @@ GNUNET_GTK_select_anonymity_combo_level (GtkComboBox
*combo, guint sel_level)
gtk_combo_box_set_active_iter (combo, &iter);
return TRUE;
}
- }
- while (gtk_tree_model_iter_next (model, &iter));
+ } while (gtk_tree_model_iter_next (model, &iter));
return FALSE;
}
-
/* end of gnunet-fs-gtk-anonymtiy_spin_buttons.c */
diff --git a/src/fs/gnunet-fs-gtk_anonymity-widgets.h
b/src/fs/gnunet-fs-gtk_anonymity-widgets.h
index 46fc3077..53122446 100644
--- a/src/fs/gnunet-fs-gtk_anonymity-widgets.h
+++ b/src/fs/gnunet-fs-gtk_anonymity-widgets.h
@@ -38,7 +38,8 @@
* @return TRUE on success, FALSE on failure
*/
gboolean
-GNUNET_GTK_select_anonymity_level (GtkBuilder * builder, gchar * combo_name,
+GNUNET_GTK_select_anonymity_level (GtkBuilder *builder,
+ gchar *combo_name,
guint sel_level);
diff --git a/src/fs/gnunet-fs-gtk_common.c b/src/fs/gnunet-fs-gtk_common.c
index 6ae17e1e..743456e9 100644
--- a/src/fs/gnunet-fs-gtk_common.c
+++ b/src/fs/gnunet-fs-gtk_common.c
@@ -44,7 +44,8 @@
*/
char *
GNUNET_FS_GTK_dubious_meta_to_utf8 (enum EXTRACTOR_MetaFormat format,
- const char *data, size_t data_len)
+ const char *data,
+ size_t data_len)
{
switch (format)
{
@@ -52,10 +53,12 @@ GNUNET_FS_GTK_dubious_meta_to_utf8 (enum
EXTRACTOR_MetaFormat format,
/* data must not contain NULLs (hence the -1) */
if (g_utf8_validate (data, data_len - 1, NULL))
return GNUNET_strdup (data);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("Failed to validate supposedly utf-8 string `%s' of length
%u, assuming it to be a C string\n"),
- data,
- (unsigned int) data_len);
+ GNUNET_log (
+ GNUNET_ERROR_TYPE_INFO,
+ _ (
+ "Failed to validate supposedly utf-8 string `%s' of length %u,
assuming it to be a C string\n"),
+ data,
+ (unsigned int) data_len);
format = EXTRACTOR_METAFORMAT_C_STRING;
/* fall-through */
case EXTRACTOR_METAFORMAT_C_STRING:
@@ -95,11 +98,13 @@ GNUNET_FS_GTK_dubious_meta_to_utf8 (enum
EXTRACTOR_MetaFormat format,
* @return 0 to continue (always)
*/
int
-GNUNET_FS_GTK_add_meta_data_to_list_store (void *cls, const char *plugin_name,
+GNUNET_FS_GTK_add_meta_data_to_list_store (void *cls,
+ const char *plugin_name,
enum EXTRACTOR_MetaType type,
enum EXTRACTOR_MetaFormat format,
const char *data_mime_type,
- const char *data, size_t data_len)
+ const char *data,
+ size_t data_len)
{
GtkListStore *ls = GTK_LIST_STORE (cls);
char *data_to_insert;
@@ -107,18 +112,21 @@ GNUNET_FS_GTK_add_meta_data_to_list_store (void *cls,
const char *plugin_name,
data_to_insert = GNUNET_FS_GTK_dubious_meta_to_utf8 (format, data, data_len);
if (NULL == data_to_insert)
return 0;
- gtk_list_store_insert_with_values (ls, NULL, G_MAXINT,
-
GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE,
- type,
-
GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_FORMAT,
- format,
+ gtk_list_store_insert_with_values (
+ ls,
+ NULL,
+ G_MAXINT,
+ GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE,
+ type,
+ GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_FORMAT,
+ format,
#if HAVE_EXTRACTOR
-
GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE_STRING,
- EXTRACTOR_metatype_to_string (type),
+ GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE_STRING,
+ EXTRACTOR_metatype_to_string (type),
#endif
-
GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_VALUE,
- data_to_insert,
- -1);
+ GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_VALUE,
+ data_to_insert,
+ -1);
GNUNET_free (data_to_insert);
return 0;
}
@@ -131,8 +139,8 @@ GNUNET_FS_GTK_add_meta_data_to_list_store (void *cls, const
char *plugin_name,
* @return NULL on error, otherwise the embedded thumbnail
*/
GdkPixbuf *
-GNUNET_FS_GTK_get_thumbnail_from_meta_data (const struct
- GNUNET_CONTAINER_MetaData *meta)
+GNUNET_FS_GTK_get_thumbnail_from_meta_data (
+ const struct GNUNET_CONTAINER_MetaData *meta)
{
GdkPixbuf *pixbuf;
GdkPixbufLoader *loader;
@@ -175,7 +183,8 @@ GNUNET_FS_GTK_mmap_and_scan (const char *filename,
void *ddata;
int ret;
- if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fsize, GNUNET_YES,
GNUNET_YES))
+ if (GNUNET_OK !=
+ GNUNET_DISK_file_size (filename, &fsize, GNUNET_YES, GNUNET_YES))
{
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -185,24 +194,31 @@ GNUNET_FS_GTK_mmap_and_scan (const char *filename,
/* empty file, cannot be a directory */
return GNUNET_SYSERR;
}
- if (NULL == (fh = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ,
- GNUNET_DISK_PERM_NONE)))
+ if (NULL == (fh = GNUNET_DISK_file_open (filename,
+ GNUNET_DISK_OPEN_READ,
+ GNUNET_DISK_PERM_NONE)))
{
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "open", filename);
return GNUNET_SYSERR;
}
- if (NULL == (ddata = GNUNET_DISK_file_map (fh, &mh,
GNUNET_DISK_MAP_TYPE_READ, (size_t) fsize)))
+ if (NULL == (ddata = GNUNET_DISK_file_map (fh,
+ &mh,
+ GNUNET_DISK_MAP_TYPE_READ,
+ (size_t) fsize)))
{
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "mmap", filename);
GNUNET_break (GNUNET_OK == GNUNET_DISK_file_close (fh));
return GNUNET_SYSERR;
}
- if (GNUNET_SYSERR ==
- GNUNET_FS_directory_list_contents ((size_t) fsize, ddata, 0, dep,
- dep_cls))
+ if (GNUNET_SYSERR == GNUNET_FS_directory_list_contents ((size_t) fsize,
+ ddata,
+ 0,
+ dep,
+ dep_cls))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Selected file `%s' is not a GNUnet directory!\n"),
filename);
+ _ ("Selected file `%s' is not a GNUnet directory!\n"),
+ filename);
ret = GNUNET_SYSERR;
}
else
@@ -225,38 +241,39 @@ GNUNET_FS_GTK_mmap_and_scan (const char *filename,
* @return description of the result in utf-8, never NULL
*/
char *
-GNUNET_FS_GTK_get_description_from_metadata (const struct
GNUNET_CONTAINER_MetaData *meta,
- int *is_a_dup)
+GNUNET_FS_GTK_get_description_from_metadata (
+ const struct GNUNET_CONTAINER_MetaData *meta,
+ int *is_a_dup)
{
char *desc;
char *utf8_desc;
- desc =
- GNUNET_CONTAINER_meta_data_get_first_by_types (meta,
-
EXTRACTOR_METATYPE_PACKAGE_NAME,
- EXTRACTOR_METATYPE_TITLE,
-
EXTRACTOR_METATYPE_BOOK_TITLE,
-
EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
-
EXTRACTOR_METATYPE_FILENAME,
-
EXTRACTOR_METATYPE_DESCRIPTION,
- EXTRACTOR_METATYPE_ALBUM,
-
EXTRACTOR_METATYPE_COMMENT,
-
EXTRACTOR_METATYPE_SUBJECT,
-
EXTRACTOR_METATYPE_KEYWORDS,
- -1);
+ desc = GNUNET_CONTAINER_meta_data_get_first_by_types (
+ meta,
+ EXTRACTOR_METATYPE_PACKAGE_NAME,
+ EXTRACTOR_METATYPE_TITLE,
+ EXTRACTOR_METATYPE_BOOK_TITLE,
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+ EXTRACTOR_METATYPE_FILENAME,
+ EXTRACTOR_METATYPE_DESCRIPTION,
+ EXTRACTOR_METATYPE_ALBUM,
+ EXTRACTOR_METATYPE_COMMENT,
+ EXTRACTOR_METATYPE_SUBJECT,
+ EXTRACTOR_METATYPE_KEYWORDS,
+ -1);
if (desc == NULL)
{
*is_a_dup = GNUNET_YES;
- return GNUNET_strdup (_("no description supplied"));
+ return GNUNET_strdup (_ ("no description supplied"));
}
- utf8_desc =
- GNUNET_FS_GTK_dubious_meta_to_utf8 (EXTRACTOR_METAFORMAT_UTF8, desc,
- strlen (desc) + 1);
+ utf8_desc = GNUNET_FS_GTK_dubious_meta_to_utf8 (EXTRACTOR_METAFORMAT_UTF8,
+ desc,
+ strlen (desc) + 1);
GNUNET_free (desc);
if (utf8_desc == NULL)
{
*is_a_dup = GNUNET_YES;
- return GNUNET_strdup (_("no description supplied"));
+ return GNUNET_strdup (_ ("no description supplied"));
}
*is_a_dup = GNUNET_NO;
return utf8_desc;
@@ -272,7 +289,7 @@ GNUNET_FS_GTK_get_description_from_metadata (const struct
GNUNET_CONTAINER_MetaD
*/
void
GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri,
- guint anonymity_level)
+ guint anonymity_level)
{
GtkEntry *query_entry;
GtkComboBox *ns_cb;
@@ -290,14 +307,15 @@ GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri,
GNUNET_FS_GTK_open_download_as_dialog (de);
return;
}
- query_entry = GTK_ENTRY (GNUNET_FS_GTK_get_main_window_object
("main_window_search_entry"));
- ns_cb = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object
("main_window_search_namespace_combobox"));
+ query_entry = GTK_ENTRY (
+ GNUNET_FS_GTK_get_main_window_object ("main_window_search_entry"));
+ ns_cb = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object (
+ "main_window_search_namespace_combobox"));
ns_entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (ns_cb)));
if (GNUNET_FS_uri_test_sks (uri))
{
/* select the namespace */
- if (GNUNET_OK !=
- GNUNET_FS_uri_sks_get_namespace (uri, &want))
+ if (GNUNET_OK != GNUNET_FS_uri_sks_get_namespace (uri, &want))
{
GNUNET_break (0);
return;
@@ -306,16 +324,14 @@ GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri,
const char *ns_zkey;
ns_zkey = GNUNET_GNSRECORD_pkey_to_zkey (&want);
- gtk_entry_set_text (ns_entry,
- ns_zkey);
+ gtk_entry_set_text (ns_entry, ns_zkey);
}
/* set search entry to the namespace identifier */
{
char *query_string;
query_string = GNUNET_FS_uri_sks_get_content_id (uri);
- gtk_entry_set_text (query_entry,
- query_string);
+ gtk_entry_set_text (query_entry, query_string);
GNUNET_free (query_string);
}
return;
@@ -329,8 +345,7 @@ GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri,
char *query_string;
query_string = GNUNET_FS_uri_ksk_to_string_fancy (uri);
- gtk_entry_set_text (query_entry,
- query_string);
+ gtk_entry_set_text (query_entry, query_string);
GNUNET_free (query_string);
}
return;
@@ -347,8 +362,7 @@ GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri,
* @return #GNUNET_OK if iter was filled, #GNUNET_SYSERR otherwise
*/
int
-GNUNET_GTK_get_iter_from_reference (GtkTreeRowReference *rr,
- GtkTreeIter *iter)
+GNUNET_GTK_get_iter_from_reference (GtkTreeRowReference *rr, GtkTreeIter *iter)
{
int result = GNUNET_SYSERR;
if (rr != NULL)
@@ -361,8 +375,7 @@ GNUNET_GTK_get_iter_from_reference (GtkTreeRowReference *rr,
model = gtk_tree_row_reference_get_model (rr);
if (path != NULL && model != NULL)
{
- if (gtk_tree_model_get_iter (model,
- iter, path))
+ if (gtk_tree_model_get_iter (model, iter, path))
result = GNUNET_OK;
gtk_tree_path_free (path);
}
@@ -415,9 +428,9 @@ GNUNET_GTK_get_reference_from_iter (GtkTreeModel *model,
GtkTreeIter *iter)
*/
gboolean
GNUNET_GTK_tree_model_get_next_flat_iter (GtkTreeModel *model,
- GtkTreeIter *iter,
- gboolean allow_children,
- GtkTreeIter *next_iter)
+ GtkTreeIter *iter,
+ gboolean allow_children,
+ GtkTreeIter *next_iter)
{
GtkTreeIter current_iter = *iter;
while (TRUE)
@@ -439,7 +452,7 @@ GNUNET_GTK_tree_model_get_next_flat_iter (GtkTreeModel
*model,
}
}
allow_children = FALSE;
- if (!gtk_tree_model_iter_parent (model, &tmp_iter, ¤t_iter))
+ if (! gtk_tree_model_iter_parent (model, &tmp_iter, ¤t_iter))
return FALSE;
current_iter = tmp_iter;
}
diff --git a/src/fs/gnunet-fs-gtk_common.h b/src/fs/gnunet-fs-gtk_common.h
index 64d04341..0665e8dc 100644
--- a/src/fs/gnunet-fs-gtk_common.h
+++ b/src/fs/gnunet-fs-gtk_common.h
@@ -40,8 +40,8 @@
* @return NULL on error, otherwise the embedded thumbnail
*/
GdkPixbuf *
-GNUNET_FS_GTK_get_thumbnail_from_meta_data (const struct
- GNUNET_CONTAINER_MetaData *meta);
+GNUNET_FS_GTK_get_thumbnail_from_meta_data (
+ const struct GNUNET_CONTAINER_MetaData *meta);
/**
@@ -76,11 +76,13 @@ GNUNET_FS_GTK_mmap_and_scan (const char *filename,
* @return 0 to continue (always)
*/
int
-GNUNET_FS_GTK_add_meta_data_to_list_store (void *cls, const char *plugin_name,
+GNUNET_FS_GTK_add_meta_data_to_list_store (void *cls,
+ const char *plugin_name,
enum EXTRACTOR_MetaType type,
enum EXTRACTOR_MetaFormat format,
const char *data_mime_type,
- const char *data, size_t data_len);
+ const char *data,
+ size_t data_len);
/**
@@ -98,8 +100,8 @@ GNUNET_FS_GTK_add_meta_data_to_list_store (void *cls, const
char *plugin_name,
*/
char *
GNUNET_FS_GTK_dubious_meta_to_utf8 (enum EXTRACTOR_MetaFormat format,
- const char *data, size_t data_len);
-
+ const char *data,
+ size_t data_len);
/**
@@ -112,8 +114,9 @@ GNUNET_FS_GTK_dubious_meta_to_utf8 (enum
EXTRACTOR_MetaFormat format,
* @return description of the result in utf-8, never NULL
*/
char *
-GNUNET_FS_GTK_get_description_from_metadata (const struct
GNUNET_CONTAINER_MetaData *meta,
- int *is_a_dup);
+GNUNET_FS_GTK_get_description_from_metadata (
+ const struct GNUNET_CONTAINER_MetaData *meta,
+ int *is_a_dup);
/**
@@ -125,7 +128,7 @@ GNUNET_FS_GTK_get_description_from_metadata (const struct
GNUNET_CONTAINER_MetaD
*/
void
GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri,
- guint anonymity_level);
+ guint anonymity_level);
/**
@@ -136,8 +139,7 @@ GNUNET_FS_GTK_handle_uri (const struct GNUNET_FS_Uri *uri,
* @return #GNUNET_OK if iter was filled, #GNUNET_SYSERR otherwise
*/
int
-GNUNET_GTK_get_iter_from_reference (GtkTreeRowReference *rr,
- GtkTreeIter *iter);
+GNUNET_GTK_get_iter_from_reference (GtkTreeRowReference *rr, GtkTreeIter
*iter);
/**
@@ -148,8 +150,7 @@ GNUNET_GTK_get_iter_from_reference (GtkTreeRowReference *rr,
* @return newly created reference or NULL in case of error
*/
GtkTreeRowReference *
-GNUNET_GTK_get_reference_from_iter (GtkTreeModel *model,
- GtkTreeIter *iter);
+GNUNET_GTK_get_reference_from_iter (GtkTreeModel *model, GtkTreeIter *iter);
/**
@@ -171,9 +172,9 @@ GNUNET_GTK_get_reference_from_iter (GtkTreeModel *model,
*/
gboolean
GNUNET_GTK_tree_model_get_next_flat_iter (GtkTreeModel *model,
- GtkTreeIter *iter,
- gboolean allow_children,
- GtkTreeIter *next_iter);
+ GtkTreeIter *iter,
+ gboolean allow_children,
+ GtkTreeIter *next_iter);
#endif
diff --git a/src/fs/gnunet-fs-gtk_download-save-as.c
b/src/fs/gnunet-fs-gtk_download-save-as.c
index 5d17d4dd..b9da6609 100644
--- a/src/fs/gnunet-fs-gtk_download-save-as.c
+++ b/src/fs/gnunet-fs-gtk_download-save-as.c
@@ -79,7 +79,9 @@ clean_up_download_as_context (struct DownloadAsDialogContext
*dlc)
if (NULL != dlc->dirname)
{
if (0 != RMDIR (dlc->dirname))
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "rmdir",
dlc->dirname);
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
+ "rmdir",
+ dlc->dirname);
GNUNET_free (dlc->dirname);
}
GNUNET_free (dlc);
@@ -109,13 +111,14 @@ GNUNET_FS_GTK_free_download_entry (struct DownloadEntry
*de)
if (NULL != de->rr)
{
path = gtk_tree_row_reference_get_path (de->rr);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL
(downloads_treestore),
- &iter, path));
+ GNUNET_assert (
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (downloads_treestore),
+ &iter,
+ path));
gtk_tree_path_free (path);
gtk_tree_row_reference_free (de->rr);
de->rr = NULL;
- gtk_tree_store_remove (downloads_treestore,
- &iter);
+ gtk_tree_store_remove (downloads_treestore, &iter);
}
GNUNET_free (de);
}
@@ -130,7 +133,8 @@ GNUNET_FS_GTK_free_download_entry (struct DownloadEntry *de)
* @return always FALSE (destroy the window)
*/
gboolean
-GNUNET_GTK_save_as_dialog_delete_event_cb (GtkWidget * widget, GdkEvent *
event,
+GNUNET_GTK_save_as_dialog_delete_event_cb (GtkWidget *widget,
+ GdkEvent *event,
gpointer user_data)
{
struct DownloadAsDialogContext *dlc = user_data;
@@ -150,8 +154,8 @@ GNUNET_GTK_save_as_dialog_delete_event_cb (GtkWidget *
widget, GdkEvent * event,
* @param user_data the 'structDownloadAsDialogContext' of the dialog
*/
void
-GNUNET_GTK_save_as_dialog_response_cb (GtkDialog * dialog,
- gint response_id,
+GNUNET_GTK_save_as_dialog_response_cb (GtkDialog *dialog,
+ gint response_id,
gpointer user_data)
{
struct DownloadAsDialogContext *dlc = user_data;
@@ -168,20 +172,19 @@ GNUNET_GTK_save_as_dialog_response_cb (GtkDialog * dialog,
}
GNUNET_free_non_null (de->filename);
de->filename =
- GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER
(dlc->dialog));
- cb = GTK_TOGGLE_BUTTON (gtk_builder_get_object
- (dlc->builder,
"GNUNET_GTK_save_as_recursive_check_button"));
+ GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (dlc->dialog));
+ cb = GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (dlc->builder,
+ "GNUNET_GTK_save_as_recursive_check_button"));
if (dlc->download_directly)
{
de->is_recursive =
- (TRUE ==
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cb))) ? GNUNET_YES :
- GNUNET_NO;
- de->anonymity =
- (uint32_t) gtk_spin_button_get_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (dlc->builder,
-
"GNUNET_GTK_save_as_dialog_anonymity_spin_button")));
+ (TRUE == gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (cb)))
+ ? GNUNET_YES
+ : GNUNET_NO;
+ de->anonymity = (uint32_t) gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (dlc->builder,
+
"GNUNET_GTK_save_as_dialog_anonymity_spin_button")));
}
gtk_widget_destroy (GTK_WIDGET (dialog));
if (dlc->download_directly)
@@ -220,8 +223,7 @@ open_saveas_dialog (struct DownloadEntry *de, int
download_directly)
dlc->de = de;
dlc->download_directly = download_directly;
dlc->builder =
- GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_download_as_dialog.glade",
- dlc);
+ GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_download_as_dialog.glade", dlc);
if (NULL == dlc->builder)
{
GNUNET_break (0);
@@ -229,20 +231,22 @@ open_saveas_dialog (struct DownloadEntry *de, int
download_directly)
GNUNET_free (dlc);
return;
}
- dlc->dialog = GTK_WIDGET (gtk_builder_get_object
- (dlc->builder, "GNUNET_GTK_save_as_dialog"));
+ dlc->dialog = GTK_WIDGET (
+ gtk_builder_get_object (dlc->builder, "GNUNET_GTK_save_as_dialog"));
/* Enable recursive button for directories and
set recursive 'default' value based on what the 'dc' tells us */
- cb = GTK_WIDGET (gtk_builder_get_object
- (dlc->builder,
"GNUNET_GTK_save_as_recursive_check_button"));
- hb = GTK_WIDGET (gtk_builder_get_object (dlc->builder,
"GNUNET_GTK_save_as_dialog_options_hbox"));
+ cb = GTK_WIDGET (
+ gtk_builder_get_object (dlc->builder,
+ "GNUNET_GTK_save_as_recursive_check_button"));
+ hb = GTK_WIDGET (
+ gtk_builder_get_object (dlc->builder,
+ "GNUNET_GTK_save_as_dialog_options_hbox"));
if (download_directly)
{
if (GNUNET_YES == de->is_directory)
gtk_widget_set_sensitive (cb, TRUE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb),
- de->is_recursive);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (cb), de->is_recursive);
gtk_widget_show (hb);
}
else
@@ -267,20 +271,21 @@ open_saveas_dialog (struct DownloadEntry *de, int
download_directly)
{
if (GNUNET_OK != GNUNET_DISK_directory_create (dirname))
{
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "mkdir", dirname);
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "mkdir", dirname);
}
else
{
- dlc->dirname = dirname;
+ dlc->dirname = dirname;
}
}
- gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dlc->dialog),
dirname);
- gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dlc->dialog),
basename);
+ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dlc->dialog),
+ dirname);
+ gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dlc->dialog),
+ basename);
if (NULL == dlc->dirname)
GNUNET_free (dirname);
}
- gtk_dialog_set_default_response (GTK_DIALOG (dlc->dialog),
- GTK_RESPONSE_OK);
+ gtk_dialog_set_default_response (GTK_DIALOG (dlc->dialog), GTK_RESPONSE_OK);
gtk_window_present (GTK_WINDOW (dlc->dialog));
}
@@ -340,26 +345,30 @@ GNUNET_FS_GTK_download_context_start_download (struct
DownloadEntry *de)
{
GNUNET_break (NULL !=
GNUNET_FS_download_start_from_search (fs,
- de->sr->result,
+ de->sr->result,
de->filename,
- NULL /* tempname */ ,
- 0 /* offset */ ,
+ NULL /* tempname */,
+ 0 /* offset */,
len,
- de->anonymity, opt,
+ de->anonymity,
+ opt,
de));
}
else
{
- GNUNET_break (NULL !=
- GNUNET_FS_download_start (fs,
- de->uri,
- NULL /* meta data */,
- de->filename, NULL /* tempname */ ,
- 0 /* offset */ ,
- len,
- de->anonymity, opt,
- de,
- (NULL != de->pde) ? de->pde->dc :
NULL));
+ GNUNET_break (
+ NULL !=
+ GNUNET_FS_download_start (fs,
+ de->uri,
+ NULL /* meta data */,
+ de->filename,
+ NULL /* tempname */,
+ 0 /* offset */,
+ len,
+ de->anonymity,
+ opt,
+ de,
+ (NULL != de->pde) ? de->pde->dc : NULL));
}
}
diff --git a/src/fs/gnunet-fs-gtk_download-save-as.h
b/src/fs/gnunet-fs-gtk_download-save-as.h
index 57d1523b..58abd636 100644
--- a/src/fs/gnunet-fs-gtk_download-save-as.h
+++ b/src/fs/gnunet-fs-gtk_download-save-as.h
@@ -75,5 +75,4 @@ void
GNUNET_FS_GTK_free_download_entry (struct DownloadEntry *de);
-
#endif
diff --git a/src/fs/gnunet-fs-gtk_event-handler.c
b/src/fs/gnunet-fs-gtk_event-handler.c
index ff481140..14b8fee8 100644
--- a/src/fs/gnunet-fs-gtk_event-handler.c
+++ b/src/fs/gnunet-fs-gtk_event-handler.c
@@ -35,150 +35,150 @@
* Columns in the file sharing result model.
*/
enum SEARCH_TAB_ModelColumns
- {
- /**
+{
+ /**
* A gpointer.
*/
- SEARCH_TAB_MC_METADATA = 0,
+ SEARCH_TAB_MC_METADATA = 0,
- /**
+ /**
* A gpointer.
*/
- SEARCH_TAB_MC_URI = 1,
+ SEARCH_TAB_MC_URI = 1,
- /**
+ /**
* A guint64.
*/
- SEARCH_TAB_MC_FILESIZE = 2,
+ SEARCH_TAB_MC_FILESIZE = 2,
- /**
+ /**
* A GdkPixbuf.
*/
- SEARCH_TAB_MC_PREVIEW = 3,
+ SEARCH_TAB_MC_PREVIEW = 3,
- /**
+ /**
* A guint.
*/
- SEARCH_TAB_MC_PERCENT_PROGRESS = 4,
+ SEARCH_TAB_MC_PERCENT_PROGRESS = 4,
- /**
+ /**
* A guint.
*/
- SEARCH_TAB_MC_PERCENT_AVAILABILITY = 5,
+ SEARCH_TAB_MC_PERCENT_AVAILABILITY = 5,
- /**
+ /**
* A gchararray.
*/
- SEARCH_TAB_MC_FILENAME = 6,
+ SEARCH_TAB_MC_FILENAME = 6,
- /**
+ /**
* A gchararray.
*/
- SEARCH_TAB_MC_URI_AS_STRING = 7,
+ SEARCH_TAB_MC_URI_AS_STRING = 7,
- /**
+ /**
* A gchararray.
*/
- SEARCH_TAB_MC_STATUS_COLOUR = 8,
+ SEARCH_TAB_MC_STATUS_COLOUR = 8,
- /**
+ /**
* A gpointer.
*/
- SEARCH_TAB_MC_SEARCH_RESULT = 9,
+ SEARCH_TAB_MC_SEARCH_RESULT = 9,
- /**
+ /**
* A gchararray.
*/
- SEARCH_TAB_MC_MIMETYPE = 10,
+ SEARCH_TAB_MC_MIMETYPE = 10,
- /**
+ /**
* A guint.
*/
- SEARCH_TAB_MC_APPLICABILITY_RANK = 11,
+ SEARCH_TAB_MC_APPLICABILITY_RANK = 11,
- /**
+ /**
* A guint.
*/
- SEARCH_TAB_MC_AVAILABILITY_CERTAINTY = 12,
+ SEARCH_TAB_MC_AVAILABILITY_CERTAINTY = 12,
- /**
+ /**
* A gint.
*/
- SEARCH_TAB_MC_AVAILABILITY_RANK = 13,
+ SEARCH_TAB_MC_AVAILABILITY_RANK = 13,
- /**
+ /**
* A guint64.
*/
- SEARCH_TAB_MC_COMPLETED = 14,
+ SEARCH_TAB_MC_COMPLETED = 14,
- /**
+ /**
* A gchararray.
*/
- SEARCH_TAB_MC_DOWNLOADED_FILENAME = 15,
+ SEARCH_TAB_MC_DOWNLOADED_FILENAME = 15,
- /**
+ /**
* A gint.
*/
- SEARCH_TAB_MC_DOWNLOADED_ANONYMITY = 16,
+ SEARCH_TAB_MC_DOWNLOADED_ANONYMITY = 16,
- /**
+ /**
* A GdkPixbuf.
*/
- SEARCH_TAB_MC_STATUS_ICON = 17,
+ SEARCH_TAB_MC_STATUS_ICON = 17,
- /**
+ /**
* A guint.
*/
- SEARCH_TAB_MC_UNKNOWN_AVAILABILITY = 18,
+ SEARCH_TAB_MC_UNKNOWN_AVAILABILITY = 18,
- /**
+ /**
* A gboolean.
*/
- SEARCH_TAB_MC_SHOW_NS_ASSOCIATION = 19
+ SEARCH_TAB_MC_SHOW_NS_ASSOCIATION = 19
- };
+};
/**
* Columns in the publish frame model.
*/
enum PUBLISH_TAB_ModelColumns
- {
- /**
+{
+ /**
* A gchararray.
*/
- PUBLISH_TAB_MC_FILENAME = 0,
+ PUBLISH_TAB_MC_FILENAME = 0,
- /**
+ /**
* A gchararray.
*/
- PUBLISH_TAB_MC_FILESIZE = 1,
+ PUBLISH_TAB_MC_FILESIZE = 1,
- /**
+ /**
* A gchararray.
*/
- PUBLISH_TAB_MC_BGCOLOUR = 2,
+ PUBLISH_TAB_MC_BGCOLOUR = 2,
- /**
+ /**
* A guint.
*/
- PUBLISH_TAB_MC_PROGRESS = 3,
+ PUBLISH_TAB_MC_PROGRESS = 3,
- /**
+ /**
* A gpointer.
*/
- PUBLISH_TAB_MC_ENT = 4,
+ PUBLISH_TAB_MC_ENT = 4,
- /**
+ /**
* A gchararray.
*/
- PUBLISH_TAB_MC_RESULT_STRING = 5,
+ PUBLISH_TAB_MC_RESULT_STRING = 5,
- /**
+ /**
* A GdkPixbuf.
*/
- PUBLISH_TAB_MC_STATUS_ICON = 6
- };
+ PUBLISH_TAB_MC_STATUS_ICON = 6
+};
/**
@@ -355,9 +355,7 @@ load_animation (const char *basename)
char *fn;
dd = GNUNET_GTK_get_data_dir ();
- GNUNET_asprintf (&fn,
- "%s%s.gif",
- dd, basename);
+ GNUNET_asprintf (&fn, "%s%s.gif", dd, basename);
ac = GNUNET_GTK_animation_context_create (fn);
GNUNET_free (fn);
return ac;
@@ -404,12 +402,15 @@ get_default_download_directory (char *buffer, size_t size)
cfg = GNUNET_FS_GTK_get_configuration ();
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg,
"gnunet-fs-gtk",
-
"DEFAULT_DOWNLOAD_DIRECTORY",
- &dirname))
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_filename (cfg,
+ "gnunet-fs-gtk",
+ "DEFAULT_DOWNLOAD_DIRECTORY",
+ &dirname))
return NULL;
- if (GNUNET_YES != GNUNET_DISK_directory_test ((const char *) dirname,
GNUNET_YES))
+ if (GNUNET_YES !=
+ GNUNET_DISK_directory_test ((const char *) dirname, GNUNET_YES))
{
GNUNET_free (dirname);
return NULL;
@@ -443,20 +444,23 @@ get_default_download_directory (char *buffer, size_t size)
*/
static void
build_relative_name (GtkTreeModel *tm,
- GtkTreeIter *iter,
- int *finished_chain,
- gchar **root_directory,
- gchar **relative_directory,
- int *anonymity)
+ GtkTreeIter *iter,
+ int *finished_chain,
+ gchar **root_directory,
+ gchar **relative_directory,
+ int *anonymity)
{
char *filename;
int downloaded_anonymity;
GtkTreeIter parent;
- gtk_tree_model_get (tm, iter,
- SEARCH_TAB_MC_DOWNLOADED_FILENAME, &filename,
- SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, &downloaded_anonymity,
- -1);
+ gtk_tree_model_get (tm,
+ iter,
+ SEARCH_TAB_MC_DOWNLOADED_FILENAME,
+ &filename,
+ SEARCH_TAB_MC_DOWNLOADED_ANONYMITY,
+ &downloaded_anonymity,
+ -1);
if (! gtk_tree_model_iter_parent (tm, &parent, iter))
{
@@ -479,7 +483,7 @@ build_relative_name (GtkTreeModel *tm,
/* If no download directory is known, try working directory */
if (NULL == tmp)
tmp = g_strdup (getcwd (buf, sizeof (buf)));
- *root_directory = g_strdup (tmp);
+ *root_directory = g_strdup (tmp);
}
else
{
@@ -498,7 +502,12 @@ build_relative_name (GtkTreeModel *tm,
}
else
{
- build_relative_name (tm, &parent, NULL, root_directory,
relative_directory, anonymity);
+ build_relative_name (tm,
+ &parent,
+ NULL,
+ root_directory,
+ relative_directory,
+ anonymity);
/* We now know the root directory parent stems from,
* and parent's name (without .gnd) relative to the root directory.
* Now we need to check that root + reldir = directory
@@ -507,7 +516,8 @@ build_relative_name (GtkTreeModel *tm,
if (NULL != filename)
{
gchar *our_dirname = g_path_get_dirname (filename);
- gchar *our_expected_dirname = g_build_filename (*root_directory,
*relative_directory, NULL);
+ gchar *our_expected_dirname =
+ g_build_filename (*root_directory, *relative_directory, NULL);
gchar *bname = g_path_get_basename (filename);
int chain_ok;
char *dot_gnd;
@@ -527,7 +537,7 @@ build_relative_name (GtkTreeModel *tm,
dot_gnd = strrchr (bname, '.');
if (NULL != dot_gnd && strcmp (dot_gnd, ".gnd") == 0)
*dot_gnd = '\0';
- if (!chain_ok)
+ if (! chain_ok)
{
/* User decided to download one of the directories into
* a different place - respect that decision, pick that
@@ -541,7 +551,8 @@ build_relative_name (GtkTreeModel *tm,
else
{
/* Continue the chain from the same root directory */
- gchar *new_relative_directory = g_build_filename (*relative_directory,
bname, NULL);
+ gchar *new_relative_directory =
+ g_build_filename (*relative_directory, bname, NULL);
g_free (*relative_directory);
*relative_directory = new_relative_directory;
}
@@ -573,9 +584,9 @@ build_relative_name (GtkTreeModel *tm,
*/
static char *
get_suggested_filename_anonymity2 (GtkTreeModel *tm,
- GtkTreeIter *iter,
+ GtkTreeIter *iter,
char **download_directory,
- int *anonymity)
+ int *anonymity)
{
char *result;
char *downloaddir;
@@ -590,11 +601,14 @@ get_suggested_filename_anonymity2 (GtkTreeModel *tm,
downloaddir = NULL;
relname = NULL;
finished_chain = GNUNET_NO;
- build_relative_name (tm, iter, &finished_chain, &downloaddir, &relname,
&downloaded_anonymity);
+ build_relative_name (tm,
+ iter,
+ &finished_chain,
+ &downloaddir,
+ &relname,
+ &downloaded_anonymity);
- gtk_tree_model_get (tm, iter,
- SEARCH_TAB_MC_METADATA, &meta,
- -1);
+ gtk_tree_model_get (tm, iter, SEARCH_TAB_MC_METADATA, &meta, -1);
filename = GNUNET_FS_meta_data_suggest_filename (meta);
/* Don't trust metadata */
@@ -604,7 +618,8 @@ get_suggested_filename_anonymity2 (GtkTreeModel *tm,
if (NULL != tmp)
{
tmplen = strlen (tmp);
- if ((1 == tmplen && '.' == tmp[0]) || (2 <= tmplen && '.' == tmp[0] && '.'
== tmp[1]))
+ if ((1 == tmplen && '.' == tmp[0]) ||
+ (2 <= tmplen && '.' == tmp[0] && '.' == tmp[1]))
tmp = NULL;
else if ((1 == tmplen && ('/' == tmp[0] || '\\' == tmp[0])) || 0 == tmplen)
tmp = NULL;
@@ -614,14 +629,19 @@ get_suggested_filename_anonymity2 (GtkTreeModel *tm,
/* now, if we have a directory, replace trailing '/' with ".gnd" */
if (GNUNET_YES == GNUNET_FS_meta_data_test_for_directory (meta))
{
- if ((tmp[tmplen-1] == '/') || (tmp[tmplen-1] == '\\'))
- tmp[tmplen-1] = '\0';
+ if ((tmp[tmplen - 1] == '/') || (tmp[tmplen - 1] == '\\'))
+ tmp[tmplen - 1] = '\0';
if (relname)
{
if (finished_chain)
GNUNET_asprintf (&result, "%s%s", relname, GNUNET_FS_DIRECTORY_EXT);
else
- GNUNET_asprintf (&result, "%s%s%s%s", relname, DIR_SEPARATOR_STR,
tmp, GNUNET_FS_DIRECTORY_EXT);
+ GNUNET_asprintf (&result,
+ "%s%s%s%s",
+ relname,
+ DIR_SEPARATOR_STR,
+ tmp,
+ GNUNET_FS_DIRECTORY_EXT);
}
else
GNUNET_asprintf (&result, "%s%s", tmp, GNUNET_FS_DIRECTORY_EXT);
@@ -669,7 +689,6 @@ struct SearchListPopupContext
* Search result at the respective row.
*/
struct SearchResult *sr;
-
};
@@ -680,8 +699,7 @@ struct SearchListPopupContext
* @param user_data the 'struct SearchListPopupContext' of the menu
*/
static void
-search_list_popup_selection_done (GtkMenuShell *menushell,
- gpointer user_data)
+search_list_popup_selection_done (GtkMenuShell *menushell, gpointer user_data)
{
struct SearchListPopupContext *spc = user_data;
@@ -700,7 +718,7 @@ search_list_popup_selection_done (GtkMenuShell *menushell,
*/
void
GNUNET_FS_GTK_search_treeview_cursor_changed (GtkTreeView *tv,
- gpointer user_data);
+ gpointer user_data);
/**
@@ -724,30 +742,31 @@ setup_download_list_entry (struct DownloadEntry *de,
if (NULL == pde)
{
/* top level */
- gtk_tree_store_insert (downloads_treestore,
- &download_iter,
- NULL,
- G_MAXINT);
+ gtk_tree_store_insert (downloads_treestore, &download_iter, NULL,
G_MAXINT);
}
else
{
/* below parent */
path = gtk_tree_row_reference_get_path (pde->rr);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL
(downloads_treestore),
- &download_piter, path));
+ GNUNET_assert (
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (downloads_treestore),
+ &download_piter,
+ path));
gtk_tree_path_free (path);
gtk_tree_store_insert (downloads_treestore,
&download_iter,
&download_piter,
G_MAXINT);
}
- gtk_tree_store_set (downloads_treestore, &download_iter,
- SEARCH_TAB_MC_SEARCH_RESULT, sr,
+ gtk_tree_store_set (downloads_treestore,
+ &download_iter,
+ SEARCH_TAB_MC_SEARCH_RESULT,
+ sr,
-1);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (downloads_treestore),
&download_iter);
- de->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (downloads_treestore),
- path);
+ de->rr =
+ gtk_tree_row_reference_new (GTK_TREE_MODEL (downloads_treestore), path);
gtk_tree_path_free (path);
}
@@ -759,14 +778,13 @@ setup_download_list_entry (struct DownloadEntry *de,
* @param[out] iter set to the respective position in the #downloads_treestore
*/
static void
-get_download_list_entry (struct DownloadEntry *de,
- GtkTreeIter *iter)
+get_download_list_entry (struct DownloadEntry *de, GtkTreeIter *iter)
{
GtkTreePath *path;
path = gtk_tree_row_reference_get_path (de->rr);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (downloads_treestore),
- iter, path));
+ GNUNET_assert (
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (downloads_treestore), iter,
path));
gtk_tree_path_free (path);
}
@@ -797,33 +815,32 @@ start_download2 (int save_as, int download_directly)
gboolean recursive;
GtkTreeIter next_item;
- tv = GTK_TREE_VIEW (gtk_builder_get_object (st->builder,
"_search_result_frame"));
+ tv = GTK_TREE_VIEW (
+ gtk_builder_get_object (st->builder, "_search_result_frame"));
sel = gtk_tree_view_get_selection (tv);
- if (!gtk_tree_selection_get_selected (sel, &model, &iter))
+ if (! gtk_tree_selection_get_selected (sel, &model, &iter))
return;
- gtk_tree_model_get (model, &iter,
- SEARCH_TAB_MC_SEARCH_RESULT, &sr,
- -1);
+ gtk_tree_model_get (model, &iter, SEARCH_TAB_MC_SEARCH_RESULT, &sr, -1);
if (NULL == sr)
{
GNUNET_break (0);
return;
}
GNUNET_assert (NULL != sr->uri);
- if (GNUNET_FS_uri_test_ksk (sr->uri) ||
- GNUNET_FS_uri_test_sks (sr->uri))
+ if (GNUNET_FS_uri_test_ksk (sr->uri) || GNUNET_FS_uri_test_sks (sr->uri))
{
GNUNET_FS_GTK_handle_uri (sr->uri, 1);
return;
}
- if (!((NULL == sr->download) && (NULL != sr->uri) &&
- ((GNUNET_FS_uri_test_chk (sr->uri) ||
- GNUNET_FS_uri_test_loc (sr->uri)))))
+ if (! ((NULL == sr->download) && (NULL != sr->uri) &&
+ ((GNUNET_FS_uri_test_chk (sr->uri) ||
+ GNUNET_FS_uri_test_loc (sr->uri)))))
return;
path = gtk_tree_model_get_path (model, &iter);
- recursive = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(mctx->download_recursive_checkbutton));
+ recursive = gtk_toggle_button_get_active (
+ GTK_TOGGLE_BUTTON (mctx->download_recursive_checkbutton));
filename = gtk_entry_get_text (mctx->download_name_entry);
downloaddir = gtk_file_chooser_get_filename
(mctx->download_location_chooser);
@@ -832,9 +849,11 @@ start_download2 (int save_as, int download_directly)
if (gtk_tree_model_iter_parent (model, &parent_iter, &iter))
{
struct SearchResult *psr = NULL;
- gtk_tree_model_get (model, &parent_iter,
- SEARCH_TAB_MC_SEARCH_RESULT, &psr,
- -1);
+ gtk_tree_model_get (model,
+ &parent_iter,
+ SEARCH_TAB_MC_SEARCH_RESULT,
+ &psr,
+ -1);
if (psr)
de->pde = psr->download;
}
@@ -849,7 +868,10 @@ start_download2 (int save_as, int download_directly)
filename);
de->sr = sr;
sr->download = de;
- if (GNUNET_GTK_get_selected_anonymity_combo_level
(mctx->download_anonymity_combo, &anonymity))
+ if (
+ GNUNET_GTK_get_selected_anonymity_combo_level (mctx
+
->download_anonymity_combo,
+ &anonymity))
de->anonymity = anonymity;
else
de->anonymity = 1;
@@ -866,9 +888,10 @@ start_download2 (int save_as, int download_directly)
gtk_tree_path_free (path);
g_free (downloaddir);
- if (!save_as)
+ if (! save_as)
{
- if (GNUNET_GTK_tree_model_get_next_flat_iter (model, &iter,
+ if (GNUNET_GTK_tree_model_get_next_flat_iter (model,
+ &iter,
! recursive,
&next_item))
gtk_tree_selection_select_iter (sel, &next_item);
@@ -886,8 +909,8 @@ start_download2 (int save_as, int download_directly)
*/
static void
start_download_ctx_menu_helper (struct SearchListPopupContext *spc,
- int is_recursive,
- int save_as)
+ int is_recursive,
+ int save_as)
{
start_download2 (save_as, GNUNET_YES);
}
@@ -904,10 +927,10 @@ start_download_ctx_menu_helper (struct
SearchListPopupContext *spc,
* @param user_data the 'struct SearchTab' that was activated
*/
void
-GNUNET_FS_GTK_search_treeview_row_activated (GtkTreeView * tree_view,
- GtkTreePath * path,
- GtkTreeViewColumn * column,
- gpointer user_data)
+GNUNET_FS_GTK_search_treeview_row_activated (GtkTreeView *tree_view,
+ GtkTreePath *path,
+ GtkTreeViewColumn *column,
+ gpointer user_data)
{
start_download2 (GNUNET_NO, GNUNET_NO);
}
@@ -921,7 +944,7 @@ GNUNET_FS_GTK_search_treeview_row_activated (GtkTreeView *
tree_view,
*/
void
GNUNET_GTK_search_frame_download_download_button_clicked_cb (GtkButton *button,
- gpointer user_data)
+ gpointer
user_data)
{
start_download2 (GNUNET_NO, GNUNET_NO);
}
@@ -935,8 +958,9 @@ GNUNET_GTK_search_frame_download_download_button_clicked_cb
(GtkButton *button,
* @param user_data the main window context
*/
void
-GNUNET_GTK_search_frame_download_filename_change_button_clicked_cb (GtkButton
*button,
- gpointer
user_data)
+GNUNET_GTK_search_frame_download_filename_change_button_clicked_cb (
+ GtkButton *button,
+ gpointer user_data)
{
start_download2 (GNUNET_YES, GNUNET_NO);
}
@@ -977,8 +1001,7 @@ handle_uri_from_ctx_menu (GtkMenuItem *item, gpointer
user_data)
uris = GNUNET_FS_uri_to_string (uri);
if (NULL == uris)
return;
- GNUNET_break (GNUNET_OK ==
- GNUNET_FS_GTK_handle_uri_string (uris, 1));
+ GNUNET_break (GNUNET_OK == GNUNET_FS_GTK_handle_uri_string (uris, 1));
GNUNET_free (uris);
/* GObject will clean up the URI */
}
@@ -1045,12 +1068,14 @@ abort_download_ctx_menu (GtkMenuItem *item, gpointer
user_data)
GNUNET_FS_download_stop (de->dc, GNUNET_YES);
if (NULL != spc->tab)
{
- tv = GTK_TREE_VIEW (gtk_builder_get_object (spc->tab->builder,
"_search_result_frame"));
+ tv = GTK_TREE_VIEW (
+ gtk_builder_get_object (spc->tab->builder, "_search_result_frame"));
GNUNET_FS_GTK_search_treeview_cursor_changed (tv, spc->tab);
}
else
{
- tv = GTK_TREE_VIEW (GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_download_frame"));
+ tv = GTK_TREE_VIEW (
+ GNUNET_FS_GTK_get_main_window_object ("GNUNET_GTK_download_frame"));
GNUNET_FS_GTK_download_frame_treeview_cursor_changed_cb (tv, NULL);
}
}
@@ -1076,11 +1101,11 @@ copy_search_uri_to_clipboard_ctx_menu (GtkMenuItem
*item, gpointer user_data)
path = gtk_tree_row_reference_get_path (spc->rr);
if (NULL != spc->tab)
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (spc->tab->builder,
- "_search_result_frame"));
+ tv = GTK_TREE_VIEW (
+ gtk_builder_get_object (spc->tab->builder, "_search_result_frame"));
else
- tv = GTK_TREE_VIEW (GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_download_frame"));
+ tv = GTK_TREE_VIEW (
+ GNUNET_FS_GTK_get_main_window_object ("GNUNET_GTK_download_frame"));
tm = gtk_tree_view_get_model (tv);
if (! gtk_tree_model_get_iter (tm, &iter, path))
{
@@ -1088,9 +1113,7 @@ copy_search_uri_to_clipboard_ctx_menu (GtkMenuItem *item,
gpointer user_data)
gtk_tree_path_free (path);
return;
}
- gtk_tree_model_get (tm, &iter,
- SEARCH_TAB_MC_URI, &uri,
- -1);
+ gtk_tree_model_get (tm, &iter, SEARCH_TAB_MC_URI, &uri, -1);
gtk_tree_path_free (path);
if (uri == NULL)
{
@@ -1110,8 +1133,7 @@ copy_search_uri_to_clipboard_ctx_menu (GtkMenuItem *item,
gpointer user_data)
*
* @return 0 to continue iteration, 1 to abort
*/
-typedef int (*EmbeddedUriCallback) (void *cls,
- const struct GNUNET_FS_Uri *uri);
+typedef int (*EmbeddedUriCallback) (void *cls, const struct GNUNET_FS_Uri
*uri);
/**
@@ -1147,11 +1169,12 @@ struct UriScannerCallbackContext
*/
static int
check_for_embedded_uri (void *cls,
- const char *plugin_name,
- enum EXTRACTOR_MetaType type,
- enum EXTRACTOR_MetaFormat format,
- const char *data_mime_type,
- const char *data, size_t data_size)
+ const char *plugin_name,
+ enum EXTRACTOR_MetaType type,
+ enum EXTRACTOR_MetaFormat format,
+ const char *data_mime_type,
+ const char *data,
+ size_t data_size)
{
struct UriScannerCallbackContext *ctx = cls;
int result;
@@ -1159,21 +1182,19 @@ check_for_embedded_uri (void *cls,
struct GNUNET_FS_Uri *uri;
if ((EXTRACTOR_METATYPE_URI != type) ||
- (EXTRACTOR_METAFORMAT_UTF8 != format) ||
- (NULL == data_mime_type) ||
- (0 != strcmp ("text/plain", data_mime_type)) ||
- (0 == data_size) ||
- ('\0' != data[data_size - 1]) )
+ (EXTRACTOR_METAFORMAT_UTF8 != format) || (NULL == data_mime_type) ||
+ (0 != strcmp ("text/plain", data_mime_type)) || (0 == data_size) ||
+ ('\0' != data[data_size - 1]))
return 0;
emsg = NULL;
uri = GNUNET_FS_uri_parse (data, &emsg);
if (NULL == uri)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Failed to parse URI `%.*s': %s\n"),
- (int) data_size,
- data,
- emsg);
+ _ ("Failed to parse URI `%.*s': %s\n"),
+ (int) data_size,
+ data,
+ emsg);
GNUNET_free_non_null (emsg);
return 0;
}
@@ -1192,14 +1213,14 @@ check_for_embedded_uri (void *cls,
*/
static void
find_embedded_uris (const struct GNUNET_CONTAINER_MetaData *meta,
- EmbeddedUriCallback cb, void *cls)
+ EmbeddedUriCallback cb,
+ void *cls)
{
struct UriScannerCallbackContext ctx;
ctx.cb = cb;
ctx.cls = cls;
- GNUNET_CONTAINER_meta_data_iterate (meta,
- &check_for_embedded_uri, &ctx);
+ GNUNET_CONTAINER_meta_data_iterate (meta, &check_for_embedded_uri, &ctx);
}
@@ -1217,7 +1238,6 @@ struct UriPopulationContext
* Counter used to limit the number of entries we add.
*/
int counter;
-
};
@@ -1231,8 +1251,7 @@ struct UriPopulationContext
* 1 if we have reached the limit
*/
static int
-populate_popup_with_uri_items (void *cls,
- const struct GNUNET_FS_Uri *uri)
+populate_popup_with_uri_items (void *cls, const struct GNUNET_FS_Uri *uri)
{
struct UriPopulationContext *ctx = cls;
GtkWidget *child;
@@ -1245,23 +1264,18 @@ populate_popup_with_uri_items (void *cls,
ctx->counter++;
uris = GNUNET_FS_uri_to_string (uri);
- GNUNET_asprintf (&labels,
- _("URI #%d: %s"),
- ctx->counter,
- uris);
+ GNUNET_asprintf (&labels, _ ("URI #%d: %s"), ctx->counter, uris);
GNUNET_free (uris);
label = gtk_accel_label_new (labels);
GNUNET_free (labels);
- box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL,
- 2);
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2);
child = gtk_menu_item_new ();
- ns_association_icon = gtk_image_new_from_icon_name
("gnunet-fs-gtk-ns-association",
- GTK_ICON_SIZE_MENU);
- gtk_container_add (GTK_CONTAINER (box),
- ns_association_icon);
-#if GTK_CHECK_VERSION(3,16,0)
- gtk_label_set_xalign (GTK_LABEL (label),
- 0.0);
+ ns_association_icon =
+ gtk_image_new_from_icon_name ("gnunet-fs-gtk-ns-association",
+ GTK_ICON_SIZE_MENU);
+ gtk_container_add (GTK_CONTAINER (box), ns_association_icon);
+#if GTK_CHECK_VERSION(3, 16, 0)
+ gtk_label_set_xalign (GTK_LABEL (label), 0.0);
#endif
accel_group = gtk_accel_group_new ();
gtk_widget_add_accelerator (child,
@@ -1270,23 +1284,18 @@ populate_popup_with_uri_items (void *cls,
GDK_KEY_m,
GDK_CONTROL_MASK,
GTK_ACCEL_VISIBLE);
- gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (label),
- child);
- gtk_box_pack_end (GTK_BOX (box),
- label,
- TRUE,
- TRUE,
- 0);
- gtk_container_add (GTK_CONTAINER (child),
- box);
+ gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (label), child);
+ gtk_box_pack_end (GTK_BOX (box), label, TRUE, TRUE, 0);
+ gtk_container_add (GTK_CONTAINER (child), box);
g_object_set_data_full (G_OBJECT (child),
- "fs-uri",
- GNUNET_FS_uri_dup (uri),
- (GDestroyNotify) &GNUNET_FS_uri_destroy);
- g_signal_connect (child, "activate",
- G_CALLBACK (handle_uri_from_ctx_menu),
- NULL);
+ "fs-uri",
+ GNUNET_FS_uri_dup (uri),
+ (GDestroyNotify) &GNUNET_FS_uri_destroy);
+ g_signal_connect (child,
+ "activate",
+ G_CALLBACK (handle_uri_from_ctx_menu),
+ NULL);
gtk_widget_show (child);
gtk_menu_shell_append (GTK_MENU_SHELL (ctx->menu), child);
@@ -1323,9 +1332,7 @@ search_list_get_popup (GtkTreeModel *tm,
path = gtk_tree_model_get_path (tm, iter);
spc->rr = gtk_tree_row_reference_new (tm, path);
gtk_tree_path_free (path);
- gtk_tree_model_get (tm, iter,
- SEARCH_TAB_MC_SEARCH_RESULT, &sr,
- -1);
+ gtk_tree_model_get (tm, iter, SEARCH_TAB_MC_SEARCH_RESULT, &sr, -1);
if (NULL == sr)
{
GNUNET_break (0);
@@ -1336,39 +1343,43 @@ search_list_get_popup (GtkTreeModel *tm,
spc->sr = sr;
menu = GTK_MENU (gtk_menu_new ());
- if ( (NULL == sr->download) &&
- (NULL != sr->uri) &&
- ( (GNUNET_FS_uri_test_chk (sr->uri) ||
- GNUNET_FS_uri_test_loc (sr->uri))) )
+ if ((NULL == sr->download) && (NULL != sr->uri) &&
+ ((GNUNET_FS_uri_test_chk (sr->uri) || GNUNET_FS_uri_test_loc (sr->uri))))
{
/* only display download menus if there is a URI */
- child = gtk_menu_item_new_with_label (_("_Download"));
- g_signal_connect (child, "activate",
- G_CALLBACK (start_download_ctx_menu), spc);
- gtk_label_set_use_underline (GTK_LABEL
- (gtk_bin_get_child (GTK_BIN (child))),
- TRUE);
+ child = gtk_menu_item_new_with_label (_ ("_Download"));
+ g_signal_connect (child,
+ "activate",
+ G_CALLBACK (start_download_ctx_menu),
+ spc);
+ gtk_label_set_use_underline (GTK_LABEL (
+ gtk_bin_get_child (GTK_BIN (child))),
+ TRUE);
gtk_widget_show (child);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
if (is_directory == GNUNET_YES)
{
- child = gtk_menu_item_new_with_label (_("Download _recursively"));
- g_signal_connect (child, "activate",
- G_CALLBACK (start_download_recursively_ctx_menu), spc);
- gtk_label_set_use_underline (GTK_LABEL
- (gtk_bin_get_child (GTK_BIN (child))),
- TRUE);
+ child = gtk_menu_item_new_with_label (_ ("Download _recursively"));
+ g_signal_connect (child,
+ "activate",
+ G_CALLBACK (start_download_recursively_ctx_menu),
+ spc);
+ gtk_label_set_use_underline (GTK_LABEL (
+ gtk_bin_get_child (GTK_BIN (child))),
+ TRUE);
gtk_widget_show (child);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
}
- child = gtk_menu_item_new_with_label (_("Download _as..."));
- g_signal_connect (child, "activate",
- G_CALLBACK (download_as_ctx_menu), spc);
- gtk_label_set_use_underline (GTK_LABEL
- (gtk_bin_get_child (GTK_BIN (child))),
- TRUE);
+ child = gtk_menu_item_new_with_label (_ ("Download _as..."));
+ g_signal_connect (child,
+ "activate",
+ G_CALLBACK (download_as_ctx_menu),
+ spc);
+ gtk_label_set_use_underline (GTK_LABEL (
+ gtk_bin_get_child (GTK_BIN (child))),
+ TRUE);
gtk_widget_show (child);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
}
@@ -1381,9 +1392,7 @@ search_list_get_popup (GtkTreeModel *tm,
/* check for embedded URIs */
uri_pop_ctx.counter = 0;
uri_pop_ctx.menu = menu;
- find_embedded_uris (sr->meta,
- &populate_popup_with_uri_items,
- &uri_pop_ctx);
+ find_embedded_uris (sr->meta, &populate_popup_with_uri_items, &uri_pop_ctx);
if (0 < uri_pop_ctx.counter)
{
/* Insert another separator */
@@ -1392,30 +1401,36 @@ search_list_get_popup (GtkTreeModel *tm,
gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
}
- if ( (NULL != sr->download) &&
- (GNUNET_YES != sr->download->is_done) )
+ if ((NULL != sr->download) && (GNUNET_YES != sr->download->is_done))
{
- child = gtk_menu_item_new_with_label (_("_Abort download"));
- g_signal_connect (child, "activate",
- G_CALLBACK (abort_download_ctx_menu), spc);
- gtk_label_set_use_underline (GTK_LABEL
- (gtk_bin_get_child (GTK_BIN (child))),
+ child = gtk_menu_item_new_with_label (_ ("_Abort download"));
+ g_signal_connect (child,
+ "activate",
+ G_CALLBACK (abort_download_ctx_menu),
+ spc);
+ gtk_label_set_use_underline (GTK_LABEL (
+ gtk_bin_get_child (GTK_BIN (child))),
TRUE);
gtk_widget_show (child);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
}
if (NULL != sr->uri)
{
- child = gtk_menu_item_new_with_label (_("_Copy URI to Clipboard"));
- g_signal_connect (child, "activate",
- G_CALLBACK (copy_search_uri_to_clipboard_ctx_menu), spc);
- gtk_label_set_use_underline (GTK_LABEL
- (gtk_bin_get_child (GTK_BIN (child))), TRUE);
+ child = gtk_menu_item_new_with_label (_ ("_Copy URI to Clipboard"));
+ g_signal_connect (child,
+ "activate",
+ G_CALLBACK (copy_search_uri_to_clipboard_ctx_menu),
+ spc);
+ gtk_label_set_use_underline (GTK_LABEL (
+ gtk_bin_get_child (GTK_BIN (child))),
+ TRUE);
gtk_widget_show (child);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
}
- g_signal_connect (menu, "selection-done",
- G_CALLBACK (search_list_popup_selection_done), spc);
+ g_signal_connect (menu,
+ "selection-done",
+ G_CALLBACK (search_list_popup_selection_done),
+ spc);
return menu;
}
@@ -1429,8 +1444,7 @@ search_list_get_popup (GtkTreeModel *tm,
* TRUE if there is now a pop-up menu
*/
gboolean
-GNUNET_FS_GTK_search_treeview_popup_menu (GtkWidget *widget,
- gpointer user_data)
+GNUNET_FS_GTK_search_treeview_popup_menu (GtkWidget *widget, gpointer
user_data)
{
GtkTreeView *tv = GTK_TREE_VIEW (widget);
struct SearchTab *tab = user_data;
@@ -1465,9 +1479,9 @@ GNUNET_FS_GTK_search_treeview_popup_menu (GtkWidget
*widget,
* TRUE to stop the propagation
*/
gboolean
-GNUNET_FS_GTK_search_treeview_button_press_event (GtkWidget * widget,
- GdkEvent * event,
- gpointer user_data)
+GNUNET_FS_GTK_search_treeview_button_press_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
{
GtkTreeView *tv = GTK_TREE_VIEW (widget);
GdkEventButton *event_button = (GdkEventButton *) event;
@@ -1477,24 +1491,24 @@ GNUNET_FS_GTK_search_treeview_button_press_event
(GtkWidget * widget,
GtkTreeIter iter;
GtkMenu *menu;
- if ( (GDK_BUTTON_PRESS != event->type) ||
- (3 != event_button->button) )
+ if ((GDK_BUTTON_PRESS != event->type) || (3 != event_button->button))
return FALSE; /* not a right-click */
if (! gtk_tree_view_get_path_at_pos (tv,
- event_button->x, event_button->y,
- &path, NULL, NULL, NULL))
+ event_button->x,
+ event_button->y,
+ &path,
+ NULL,
+ NULL,
+ NULL))
return FALSE; /* click outside of area with values, ignore */
tm = gtk_tree_view_get_model (tv);
if (! gtk_tree_model_get_iter (tm, &iter, path))
return FALSE; /* not sure how we got a path but no iter... */
gtk_tree_path_free (path);
- menu = search_list_get_popup (tm,
- tab,
- &iter);
+ menu = search_list_get_popup (tm, tab, &iter);
if (NULL == menu)
return FALSE;
- gtk_menu_popup_at_pointer (menu,
- event);
+ gtk_menu_popup_at_pointer (menu, event);
return FALSE;
}
@@ -1510,8 +1524,8 @@ GNUNET_FS_GTK_search_treeview_button_press_event
(GtkWidget * widget,
* TRUE to stop the propagation
*/
gboolean
-GNUNET_GTK_download_frame_button_press_event_cb (GtkWidget * widget,
- GdkEvent * event,
+GNUNET_GTK_download_frame_button_press_event_cb (GtkWidget *widget,
+ GdkEvent *event,
gpointer user_data)
{
GtkTreeView *tv = GTK_TREE_VIEW (widget);
@@ -1521,24 +1535,24 @@ GNUNET_GTK_download_frame_button_press_event_cb
(GtkWidget * widget,
GtkTreeIter iter;
GtkMenu *menu;
- if ( (GDK_BUTTON_PRESS != event->type) ||
- (3 != event_button->button) )
+ if ((GDK_BUTTON_PRESS != event->type) || (3 != event_button->button))
return FALSE; /* not a right-click */
if (! gtk_tree_view_get_path_at_pos (tv,
- event_button->x, event_button->y,
- &path, NULL, NULL, NULL))
+ event_button->x,
+ event_button->y,
+ &path,
+ NULL,
+ NULL,
+ NULL))
return FALSE; /* click outside of area with values, ignore */
tm = gtk_tree_view_get_model (tv);
if (! gtk_tree_model_get_iter (tm, &iter, path))
return FALSE; /* not sure how we got a path but no iter... */
gtk_tree_path_free (path);
- menu = search_list_get_popup (tm,
- NULL,
- &iter);
+ menu = search_list_get_popup (tm, NULL, &iter);
if (NULL == menu)
return FALSE;
- gtk_menu_popup_at_pointer (menu,
- event);
+ gtk_menu_popup_at_pointer (menu, event);
return FALSE;
}
@@ -1557,11 +1571,17 @@ update_search_label (struct SearchTab *tab)
while (tab->parent != NULL)
tab = tab->parent->tab;
if (tab->num_results > 0)
- GNUNET_asprintf (&label_text, "%.*s%s (%u)", 20, tab->query_txt,
+ GNUNET_asprintf (&label_text,
+ "%.*s%s (%u)",
+ 20,
+ tab->query_txt,
strlen (tab->query_txt) > 20 ? "..." : "",
tab->num_results);
else
- GNUNET_asprintf (&label_text, "%.*s%s", 20, tab->query_txt,
+ GNUNET_asprintf (&label_text,
+ "%.*s%s",
+ 20,
+ tab->query_txt,
strlen (tab->query_txt) > 20 ? "..." : "");
gtk_label_set_text (tab->label, label_text);
gtk_widget_set_tooltip_text (GTK_WIDGET (tab->label), tab->query_txt);
@@ -1600,40 +1620,34 @@ close_search_tab (struct SearchTab *tab)
for (i = gtk_notebook_get_n_pages (mctx->notebook) - 1; i >= 0; i--)
if (tab->frame == gtk_notebook_get_nth_page (mctx->notebook, i))
index = i;
- if (gtk_tree_model_iter_children (GTK_TREE_MODEL (tab->ts),
- &iter,
- NULL))
+ if (gtk_tree_model_iter_children (GTK_TREE_MODEL (tab->ts), &iter, NULL))
+ {
+ do
{
- do
- {
- struct SearchResult *sr;
-
- gtk_tree_model_get (GTK_TREE_MODEL (tab->ts),
- &iter,
- SEARCH_TAB_MC_SEARCH_RESULT, &sr,
- -1);
- if (NULL != sr)
- sr->tab = NULL;
- }
- while (gtk_tree_model_iter_next (GTK_TREE_MODEL (tab->ts),
- &iter));
- }
- gtk_notebook_remove_page (mctx->notebook,
- index);
+ struct SearchResult *sr;
+
+ gtk_tree_model_get (GTK_TREE_MODEL (tab->ts),
+ &iter,
+ SEARCH_TAB_MC_SEARCH_RESULT,
+ &sr,
+ -1);
+ if (NULL != sr)
+ sr->tab = NULL;
+ } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (tab->ts), &iter));
+ }
+ gtk_notebook_remove_page (mctx->notebook, index);
g_object_unref (tab->builder);
GNUNET_free (tab->query_txt);
- GNUNET_CONTAINER_DLL_remove (search_tab_head,
- search_tab_tail,
- tab);
+ GNUNET_CONTAINER_DLL_remove (search_tab_head, search_tab_tail, tab);
if (tab == uri_tab)
uri_tab = NULL;
if (NULL != tab->atv)
GNUNET_GTK_animation_tree_view_unregister (tab->atv);
GNUNET_free (tab);
- if ( (NULL == search_tab_head) &&
- (NULL == uri_tab) )
+ if ((NULL == search_tab_head) && (NULL == uri_tab))
{
- struct GNUNET_GTK_MainWindowContext *mctx = GNUNET_FS_GTK_get_main_context
();
+ struct GNUNET_GTK_MainWindowContext *mctx =
+ GNUNET_FS_GTK_get_main_context ();
GNUNET_GTK_animation_context_destroy (animation_downloading);
animation_downloading = NULL;
GNUNET_GTK_animation_context_destroy (animation_downloaded);
@@ -1674,10 +1688,11 @@ GNUNET_FS_GTK_close_uri_tab_ ()
static void
download_lost_parent (struct DownloadEntry *de)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Download %p lost search parent; removing from search result %p
list.\n",
- de,
- de->sr);
+ GNUNET_log (
+ GNUNET_ERROR_TYPE_DEBUG,
+ "Download %p lost search parent; removing from search result %p list.\n",
+ de,
+ de->sr);
if (NULL != de->sr->rr)
{
gtk_tree_row_reference_free (de->sr->rr);
@@ -1696,37 +1711,34 @@ download_lost_parent (struct DownloadEntry *de)
* @param iter parent of the subtree to check
*/
static void
-remove_results_in_subtree (GtkTreeModel *tm,
- GtkTreeIter *iter)
+remove_results_in_subtree (GtkTreeModel *tm, GtkTreeIter *iter)
{
GtkTreeIter child;
struct SearchResult *sr;
- if (gtk_tree_model_iter_children (tm,
- &child,
- iter))
+ if (gtk_tree_model_iter_children (tm, &child, iter))
{
do
{
- gtk_tree_model_get (tm, &child,
- SEARCH_TAB_MC_SEARCH_RESULT, &sr,
- -1);
+ gtk_tree_model_get (tm, &child, SEARCH_TAB_MC_SEARCH_RESULT, &sr, -1);
remove_results_in_subtree (tm, &child);
gtk_tree_row_reference_free (sr->rr);
sr->rr = NULL;
if (NULL != sr->probe)
{
- GNUNET_FS_probe_stop (sr->probe);
+ GNUNET_FS_probe_stop (sr->probe);
sr->probe = NULL;
- GNUNET_CONTAINER_DLL_remove (pl_head,
- pl_tail,
- sr);
+ GNUNET_CONTAINER_DLL_remove (pl_head, pl_tail, sr);
}
/* get ready for removal of the tree */
- gtk_tree_store_set (GTK_TREE_STORE (tm), &child,
- SEARCH_TAB_MC_METADATA, NULL,
- SEARCH_TAB_MC_URI, NULL,
- SEARCH_TAB_MC_SEARCH_RESULT, NULL,
+ gtk_tree_store_set (GTK_TREE_STORE (tm),
+ &child,
+ SEARCH_TAB_MC_METADATA,
+ NULL,
+ SEARCH_TAB_MC_URI,
+ NULL,
+ SEARCH_TAB_MC_SEARCH_RESULT,
+ NULL,
-1);
if (NULL != sr->download)
{
@@ -1745,8 +1757,7 @@ remove_results_in_subtree (GtkTreeModel *tm,
sr->meta = NULL;
}
GNUNET_free (sr);
- }
- while (gtk_tree_model_iter_next (tm, &child));
+ } while (gtk_tree_model_iter_next (tm, &child));
}
}
@@ -1766,17 +1777,15 @@ free_search_result (struct SearchResult *sr)
GtkTreeModel *tm;
GtkTreeIter iter;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Freeing a search result SR=%p\n",
- sr);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Freeing a search result SR=%p\n", sr);
if (NULL == sr)
{
GNUNET_break (0);
return;
}
- if ( (NULL != sr->rr) &&
- (NULL != (tm = gtk_tree_row_reference_get_model (sr->rr))) &&
- (NULL != (tp = gtk_tree_row_reference_get_path (sr->rr))) )
+ if ((NULL != sr->rr) &&
+ (NULL != (tm = gtk_tree_row_reference_get_model (sr->rr))) &&
+ (NULL != (tp = gtk_tree_row_reference_get_path (sr->rr))))
{
if (! gtk_tree_model_get_iter (tm, &iter, tp))
{
@@ -1787,24 +1796,24 @@ free_search_result (struct SearchResult *sr)
/* get ready for later removal of the tree */
gtk_tree_store_set (GTK_TREE_STORE (tm),
&iter,
- SEARCH_TAB_MC_METADATA, NULL,
- SEARCH_TAB_MC_URI, NULL,
- SEARCH_TAB_MC_SEARCH_RESULT, NULL,
+ SEARCH_TAB_MC_METADATA,
+ NULL,
+ SEARCH_TAB_MC_URI,
+ NULL,
+ SEARCH_TAB_MC_SEARCH_RESULT,
+ NULL,
-1);
gtk_tree_path_free (tp);
gtk_tree_row_reference_free (sr->rr);
sr->rr = NULL;
remove_results_in_subtree (tm, &iter);
- GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (tm),
- &iter);
+ GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (tm), &iter);
}
if (NULL != sr->probe)
{
GNUNET_FS_probe_stop (sr->probe);
sr->probe = NULL;
- GNUNET_CONTAINER_DLL_remove (pl_head,
- pl_tail,
- sr);
+ GNUNET_CONTAINER_DLL_remove (pl_head, pl_tail, sr);
}
if (NULL != sr->download)
{
@@ -1835,7 +1844,7 @@ free_search_result (struct SearchResult *sr)
*/
void
GNUNET_FS_GTK_search_treeview_cursor_changed (GtkTreeView *tv,
- gpointer user_data)
+ gpointer user_data)
{
GtkTreeSelection *sel;
GtkTreeModel *model;
@@ -1858,20 +1867,22 @@ GNUNET_FS_GTK_search_treeview_cursor_changed
(GtkTreeView *tv,
return;
}
pixbuf = NULL;
- gtk_tree_model_get (model, &iter,
- SEARCH_TAB_MC_PREVIEW, &pixbuf,
- SEARCH_TAB_MC_SEARCH_RESULT, &sr,
+ gtk_tree_model_get (model,
+ &iter,
+ SEARCH_TAB_MC_PREVIEW,
+ &pixbuf,
+ SEARCH_TAB_MC_SEARCH_RESULT,
+ &sr,
-1);
if (NULL == sr)
return;
selpath = gtk_tree_model_get_path (model, &iter);
- if ( (NULL == current_selected_search_result) ||
- (0 != gtk_tree_path_compare (selpath, current_selected_search_result)) )
+ if ((NULL == current_selected_search_result) ||
+ (0 != gtk_tree_path_compare (selpath, current_selected_search_result)))
{
- if ( (NULL == sr->download) &&
- (NULL != sr->uri) &&
- ( (GNUNET_FS_uri_test_chk (sr->uri) ||
- GNUNET_FS_uri_test_loc (sr->uri)) ) )
+ if ((NULL == sr->download) && (NULL != sr->uri) &&
+ ((GNUNET_FS_uri_test_chk (sr->uri) ||
+ GNUNET_FS_uri_test_loc (sr->uri))))
{
char *download_directory;
char *filename;
@@ -1881,21 +1892,29 @@ GNUNET_FS_GTK_search_treeview_cursor_changed
(GtkTreeView *tv,
/* Calculate suggested filename */
anonymity = -1;
download_directory = NULL;
- filename = get_suggested_filename_anonymity2 (model, &iter,
+ filename = get_suggested_filename_anonymity2 (model,
+ &iter,
&download_directory,
&anonymity);
is_directory = GNUNET_FS_meta_data_test_for_directory (sr->meta);
- gtk_widget_set_sensitive (GTK_WIDGET
(mctx->download_recursive_checkbutton), is_directory);
+ gtk_widget_set_sensitive (GTK_WIDGET (
+ mctx->download_recursive_checkbutton),
+ is_directory);
/* TODO: make this configurable */
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
(mctx->download_recursive_checkbutton), is_directory == GNUNET_YES);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (
+ mctx->download_recursive_checkbutton),
+ is_directory == GNUNET_YES);
/* TODO: make this configurable */
- GNUNET_GTK_select_anonymity_combo_level (mctx->download_anonymity_combo,
anonymity >= 0 ? anonymity : 1);
+ GNUNET_GTK_select_anonymity_combo_level (mctx->download_anonymity_combo,
+ anonymity >= 0 ? anonymity : 1);
- gtk_entry_set_text (mctx->download_name_entry, filename != NULL ?
filename : NULL);
- gtk_file_chooser_set_current_folder (mctx->download_location_chooser,
download_directory);
+ gtk_entry_set_text (mctx->download_name_entry,
+ filename != NULL ? filename : NULL);
+ gtk_file_chooser_set_current_folder (mctx->download_location_chooser,
+ download_directory);
gtk_widget_show_all (GTK_WIDGET (mctx->download_panel));
GNUNET_free_non_null (filename);
@@ -1934,8 +1953,7 @@ GNUNET_FS_GTK_search_treeview_cursor_changed (GtkTreeView
*tv,
* @param data main window context
*/
void
-GNUNET_GTK_main_window_notebook_switch_page_cb (GtkWidget * dummy,
- gpointer data)
+GNUNET_GTK_main_window_notebook_switch_page_cb (GtkWidget *dummy, gpointer
data)
{
gint page;
GtkWidget *w;
@@ -1951,8 +1969,8 @@ GNUNET_GTK_main_window_notebook_switch_page_cb (GtkWidget
* dummy,
if (tab->frame != w)
continue;
current_search_tab = tab;
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (tab->builder, "_search_result_frame"));
+ tv = GTK_TREE_VIEW (
+ gtk_builder_get_object (tab->builder, "_search_result_frame"));
GNUNET_FS_GTK_search_treeview_cursor_changed (tv, tab);
return;
}
@@ -2001,7 +2019,8 @@ GNUNET_FS_GTK_search_result_close_button_clicked
(GtkButton *button,
* @param user_data the 'struct SearchTab' of the tab to pause
*/
void
-GNUNET_FS_GTK_search_result_pause_button_clicked (GtkButton *button, gpointer
user_data)
+GNUNET_FS_GTK_search_result_pause_button_clicked (GtkButton *button,
+ gpointer user_data)
{
struct SearchTab *tab = user_data;
@@ -2023,7 +2042,8 @@ GNUNET_FS_GTK_search_result_pause_button_clicked
(GtkButton *button, gpointer us
* @param user_data the 'struct SearchTab' of the tab to resume
*/
void
-GNUNET_FS_GTK_search_result_play_button_clicked (GtkButton * button, gpointer
user_data)
+GNUNET_FS_GTK_search_result_play_button_clicked (GtkButton *button,
+ gpointer user_data)
{
struct SearchTab *tab = user_data;
@@ -2046,38 +2066,30 @@ GNUNET_FS_GTK_search_result_play_button_clicked
(GtkButton * button, gpointer us
* @return #GNUNET_YES if there are no active downloads left in the subtree
*/
static int
-stop_downloads_in_subtree (GtkTreeModel *tm,
- GtkTreeIter *iter)
+stop_downloads_in_subtree (GtkTreeModel *tm, GtkTreeIter *iter)
{
GtkTreeIter child;
struct SearchResult *sr;
int ret;
ret = GNUNET_YES;
- if (gtk_tree_model_iter_children (tm,
- &child,
- iter))
+ if (gtk_tree_model_iter_children (tm, &child, iter))
{
do
{
- gtk_tree_model_get (tm, &child,
- SEARCH_TAB_MC_SEARCH_RESULT, &sr,
- -1);
+ gtk_tree_model_get (tm, &child, SEARCH_TAB_MC_SEARCH_RESULT, &sr, -1);
if (NULL == sr)
continue;
- if ( (NULL != sr->download) &&
- (GNUNET_YES == sr->download->is_done) )
+ if ((NULL != sr->download) && (GNUNET_YES == sr->download->is_done))
{
- /* got a finished download, stop it */
- GNUNET_FS_download_stop (sr->download->dc, GNUNET_YES);
+ /* got a finished download, stop it */
+ GNUNET_FS_download_stop (sr->download->dc, GNUNET_YES);
}
- if ( (NULL != sr->download) ||
- (NULL != sr->result) )
- ret = GNUNET_NO;
+ if ((NULL != sr->download) || (NULL != sr->result))
+ ret = GNUNET_NO;
if (GNUNET_YES != stop_downloads_in_subtree (tm, &child))
- ret = GNUNET_NO;
- }
- while (gtk_tree_model_iter_next (tm, &child));
+ ret = GNUNET_NO;
+ } while (gtk_tree_model_iter_next (tm, &child));
}
return ret;
}
@@ -2093,7 +2105,7 @@ stop_downloads_in_subtree (GtkTreeModel *tm,
* @param user_data
*/
void
-GNUNET_FS_GTK_downloads_clear_button_clicked (GtkButton * button,
+GNUNET_FS_GTK_downloads_clear_button_clicked (GtkButton *button,
gpointer user_data)
{
struct SearchResult *sr;
@@ -2105,28 +2117,21 @@ GNUNET_FS_GTK_downloads_clear_button_clicked (GtkButton
* button,
return;
do
{
- gtk_tree_model_get (tm, &iter,
- SEARCH_TAB_MC_SEARCH_RESULT, &sr,
- -1);
+ gtk_tree_model_get (tm, &iter, SEARCH_TAB_MC_SEARCH_RESULT, &sr, -1);
if (NULL == sr)
{
GNUNET_break (0);
continue;
}
- if ( (NULL != sr->download) &&
- (GNUNET_YES == sr->download->is_done) )
+ if ((NULL != sr->download) && (GNUNET_YES == sr->download->is_done))
{
/* got a finished download, stop it */
- GNUNET_FS_download_stop (sr->download->dc,
- GNUNET_YES);
- if (! gtk_tree_model_get_iter_first (tm,
- &iter))
- return;
+ GNUNET_FS_download_stop (sr->download->dc, GNUNET_YES);
+ if (! gtk_tree_model_get_iter_first (tm, &iter))
+ return;
}
- if ( (NULL == sr->download) &&
- (NULL == sr->result) &&
- (GNUNET_YES == stop_downloads_in_subtree (tm,
- &iter)) )
+ if ((NULL == sr->download) && (NULL == sr->result) &&
+ (GNUNET_YES == stop_downloads_in_subtree (tm, &iter)))
{
/* no active download and no associated FS-API search result;
so this must be some left-over entry from an opened
@@ -2134,10 +2139,9 @@ GNUNET_FS_GTK_downloads_clear_button_clicked (GtkButton
* button,
free_search_result (sr);
/* the above call clobbered our 'iter', restart from the beginning... */
if (! gtk_tree_model_get_iter_first (tm, &iter))
- return;
+ return;
}
- }
- while (gtk_tree_model_iter_next (tm, &iter));
+ } while (gtk_tree_model_iter_next (tm, &iter));
}
@@ -2149,10 +2153,9 @@ GNUNET_FS_GTK_downloads_clear_button_clicked (GtkButton
* button,
* @param emsg the error message
*/
static void
-handle_search_error (struct SearchTab *tab,
- const char *emsg)
+handle_search_error (struct SearchTab *tab, const char *emsg)
{
- gtk_label_set_text (tab->label, _("Error!"));
+ gtk_label_set_text (tab->label, _ ("Error!"));
gtk_widget_set_tooltip_text (GTK_WIDGET (tab->label), emsg);
}
@@ -2168,11 +2171,11 @@ static char *
get_mimetype_from_metadata (const struct GNUNET_CONTAINER_MetaData *meta)
{
return GNUNET_CONTAINER_meta_data_get_first_by_types (meta,
-
EXTRACTOR_METATYPE_MIMETYPE,
+
EXTRACTOR_METATYPE_MIMETYPE,
#if HAVE_EXTRACTOR_H
-
EXTRACTOR_METATYPE_FORMAT,
+
EXTRACTOR_METATYPE_FORMAT,
#endif
- -1);
+ -1);
}
@@ -2191,9 +2194,9 @@ static void
update_search_result (struct SearchResult *sr,
const struct GNUNET_CONTAINER_MetaData *meta,
uint32_t applicability_rank,
- int32_t availability_rank,
+ int32_t availability_rank,
uint32_t availability_certainty,
- struct GNUNET_TIME_Relative probe_time)
+ struct GNUNET_TIME_Relative probe_time)
{
GtkTreeIter iter;
GtkTreeView *tv;
@@ -2231,33 +2234,61 @@ update_search_result (struct SearchResult *sr,
}
sr->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
if (availability_certainty > 0)
- percent_avail = 50 + (gint) (availability_rank * 50.0 /
availability_certainty);
+ percent_avail =
+ 50 + (gint) (availability_rank * 50.0 / availability_certainty);
else
percent_avail = 50;
- gtk_tree_store_set (ts, &iter,
- SEARCH_TAB_MC_METADATA, sr->meta,
- SEARCH_TAB_MC_PREVIEW, pixbuf,
- SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint)
percent_avail,
- SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, (0 ==
availability_certainty) ? (gint) (probe_time.rel_value_us /
GNUNET_FS_PROBE_UPDATE_FREQUENCY.rel_value_us) : -1,
- SEARCH_TAB_MC_FILENAME, desc,
- SEARCH_TAB_MC_MIMETYPE, mime,
- SEARCH_TAB_MC_APPLICABILITY_RANK, (guint)
applicability_rank,
- SEARCH_TAB_MC_AVAILABILITY_CERTAINTY, (guint)
availability_certainty,
- SEARCH_TAB_MC_AVAILABILITY_RANK, (gint)
availability_rank,
+ gtk_tree_store_set (ts,
+ &iter,
+ SEARCH_TAB_MC_METADATA,
+ sr->meta,
+ SEARCH_TAB_MC_PREVIEW,
+ pixbuf,
+ SEARCH_TAB_MC_PERCENT_AVAILABILITY,
+ (guint) percent_avail,
+ SEARCH_TAB_MC_UNKNOWN_AVAILABILITY,
+ (0 == availability_certainty)
+ ? (gint) (probe_time.rel_value_us /
+
GNUNET_FS_PROBE_UPDATE_FREQUENCY.rel_value_us)
+ : -1,
+ SEARCH_TAB_MC_FILENAME,
+ desc,
+ SEARCH_TAB_MC_MIMETYPE,
+ mime,
+ SEARCH_TAB_MC_APPLICABILITY_RANK,
+ (guint) applicability_rank,
+ SEARCH_TAB_MC_AVAILABILITY_CERTAINTY,
+ (guint) availability_certainty,
+ SEARCH_TAB_MC_AVAILABILITY_RANK,
+ (gint) availability_rank,
-1);
if (NULL != sr->download)
{
get_download_list_entry (sr->download, &iter);
- gtk_tree_store_set (downloads_treestore, &iter,
- SEARCH_TAB_MC_METADATA, sr->meta,
- SEARCH_TAB_MC_PREVIEW, pixbuf,
- SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint)
percent_avail,
- SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, (0 ==
availability_certainty) ? (gint) (probe_time.rel_value_us /
GNUNET_FS_PROBE_UPDATE_FREQUENCY.rel_value_us) : -1,
- SEARCH_TAB_MC_FILENAME, desc,
- SEARCH_TAB_MC_MIMETYPE, mime,
- SEARCH_TAB_MC_APPLICABILITY_RANK, (guint)
applicability_rank,
- SEARCH_TAB_MC_AVAILABILITY_CERTAINTY, (guint)
availability_certainty,
- SEARCH_TAB_MC_AVAILABILITY_RANK, (gint)
availability_rank,
+ gtk_tree_store_set (downloads_treestore,
+ &iter,
+ SEARCH_TAB_MC_METADATA,
+ sr->meta,
+ SEARCH_TAB_MC_PREVIEW,
+ pixbuf,
+ SEARCH_TAB_MC_PERCENT_AVAILABILITY,
+ (guint) percent_avail,
+ SEARCH_TAB_MC_UNKNOWN_AVAILABILITY,
+ (0 == availability_certainty)
+ ? (gint) (
+ probe_time.rel_value_us /
+ GNUNET_FS_PROBE_UPDATE_FREQUENCY.rel_value_us)
+ : -1,
+ SEARCH_TAB_MC_FILENAME,
+ desc,
+ SEARCH_TAB_MC_MIMETYPE,
+ mime,
+ SEARCH_TAB_MC_APPLICABILITY_RANK,
+ (guint) applicability_rank,
+ SEARCH_TAB_MC_AVAILABILITY_CERTAINTY,
+ (guint) availability_certainty,
+ SEARCH_TAB_MC_AVAILABILITY_RANK,
+ (gint) availability_rank,
-1);
}
@@ -2272,7 +2303,8 @@ update_search_result (struct SearchResult *sr,
GtkTreeSelection *sel;
GtkTreeModel *model;
GtkTreeIter iter;
- tv = GTK_TREE_VIEW (gtk_builder_get_object (sr->tab->builder,
"_search_result_frame"));
+ tv = GTK_TREE_VIEW (
+ gtk_builder_get_object (sr->tab->builder, "_search_result_frame"));
sel = gtk_tree_view_get_selection (tv);
if (gtk_tree_selection_get_selected (sel, &model, &iter))
{
@@ -2294,8 +2326,7 @@ update_search_result (struct SearchResult *sr,
* @return 1 (abort iteration)
*/
static int
-see_if_there_are_any_uris (void *cls,
- const struct GNUNET_FS_Uri *sks_uri)
+see_if_there_are_any_uris (void *cls, const struct GNUNET_FS_Uri *sks_uri)
{
gboolean *gb = cls;
@@ -2325,7 +2356,7 @@ see_if_there_are_any_uris (void *cls,
*/
struct SearchResult *
GNUNET_GTK_add_search_result (struct SearchTab *tab,
- uint32_t anonymity,
+ uint32_t anonymity,
GtkTreeRowReference *parent_rr,
const struct GNUNET_FS_Uri *uri,
const struct GNUNET_CONTAINER_MetaData *meta,
@@ -2356,12 +2387,11 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab,
fsize = 0;
status_colour = "gray";
mime = GNUNET_strdup (GNUNET_FS_DIRECTORY_MIME);
- uris = GNUNET_strdup (_("no URI"));
+ uris = GNUNET_strdup (_ ("no URI"));
}
else
{
- if ( (GNUNET_FS_uri_test_loc (uri)) ||
- (GNUNET_FS_uri_test_chk (uri)) )
+ if ((GNUNET_FS_uri_test_loc (uri)) || (GNUNET_FS_uri_test_chk (uri)))
{
fsize = GNUNET_FS_uri_chk_get_file_size (uri);
mime = get_mimetype_from_metadata (meta);
@@ -2377,27 +2407,21 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab,
}
desc = GNUNET_FS_GTK_get_description_from_metadata (meta, &desc_is_a_dup);
pixbuf = GNUNET_FS_GTK_get_thumbnail_from_meta_data (meta);
- find_embedded_uris (meta,
- &see_if_there_are_any_uris,
- &show_uri_association);
+ find_embedded_uris (meta, &see_if_there_are_any_uris, &show_uri_association);
sr = GNUNET_new (struct SearchResult);
sr->result = result;
if (NULL == result)
{
sr->probe = GNUNET_FS_probe (GNUNET_FS_GTK_get_fs_handle (),
- uri,
- meta,
- sr,
- anonymity);
- GNUNET_CONTAINER_DLL_insert (pl_head,
- pl_tail,
- sr);
+ uri,
+ meta,
+ sr,
+ anonymity);
+ GNUNET_CONTAINER_DLL_insert (pl_head, pl_tail, sr);
}
sr->tab = tab;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Allocated a search result SR=%p\n",
- sr);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Allocated a search result SR=%p\n",
sr);
if (NULL != parent_rr)
{
/* get piter from parent */
@@ -2427,26 +2451,48 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab,
}
sr->uri = (uri == NULL) ? NULL : GNUNET_FS_uri_dup (uri);
sr->meta = GNUNET_CONTAINER_meta_data_duplicate (meta);
- gtk_tree_store_insert_with_values (ts, &iter, pitr, G_MAXINT,
- SEARCH_TAB_MC_METADATA, sr->meta,
- SEARCH_TAB_MC_URI, sr->uri,
- SEARCH_TAB_MC_FILESIZE, fsize,
- SEARCH_TAB_MC_PREVIEW, pixbuf,
- SEARCH_TAB_MC_PERCENT_PROGRESS, 0,
- SEARCH_TAB_MC_PERCENT_AVAILABILITY, (0 ==
fsize) ? 100 : 50,
- SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, (0 ==
fsize) ? -1 : 0,
- SEARCH_TAB_MC_FILENAME, desc,
- SEARCH_TAB_MC_URI_AS_STRING, uris,
- SEARCH_TAB_MC_STATUS_COLOUR,
status_colour,
- SEARCH_TAB_MC_SEARCH_RESULT, sr,
- SEARCH_TAB_MC_MIMETYPE, mime,
- SEARCH_TAB_MC_APPLICABILITY_RANK,
applicability_rank,
- SEARCH_TAB_MC_AVAILABILITY_CERTAINTY, 0,
- SEARCH_TAB_MC_AVAILABILITY_RANK, 0,
- SEARCH_TAB_MC_COMPLETED, (guint64) 0,
- SEARCH_TAB_MC_DOWNLOADED_FILENAME, NULL,
- SEARCH_TAB_MC_DOWNLOADED_ANONYMITY,
(guint) -1,
- SEARCH_TAB_MC_SHOW_NS_ASSOCIATION,
show_uri_association,
+ gtk_tree_store_insert_with_values (ts,
+ &iter,
+ pitr,
+ G_MAXINT,
+ SEARCH_TAB_MC_METADATA,
+ sr->meta,
+ SEARCH_TAB_MC_URI,
+ sr->uri,
+ SEARCH_TAB_MC_FILESIZE,
+ fsize,
+ SEARCH_TAB_MC_PREVIEW,
+ pixbuf,
+ SEARCH_TAB_MC_PERCENT_PROGRESS,
+ 0,
+ SEARCH_TAB_MC_PERCENT_AVAILABILITY,
+ (0 == fsize) ? 100 : 50,
+ SEARCH_TAB_MC_UNKNOWN_AVAILABILITY,
+ (0 == fsize) ? -1 : 0,
+ SEARCH_TAB_MC_FILENAME,
+ desc,
+ SEARCH_TAB_MC_URI_AS_STRING,
+ uris,
+ SEARCH_TAB_MC_STATUS_COLOUR,
+ status_colour,
+ SEARCH_TAB_MC_SEARCH_RESULT,
+ sr,
+ SEARCH_TAB_MC_MIMETYPE,
+ mime,
+ SEARCH_TAB_MC_APPLICABILITY_RANK,
+ applicability_rank,
+ SEARCH_TAB_MC_AVAILABILITY_CERTAINTY,
+ 0,
+ SEARCH_TAB_MC_AVAILABILITY_RANK,
+ 0,
+ SEARCH_TAB_MC_COMPLETED,
+ (guint64) 0,
+ SEARCH_TAB_MC_DOWNLOADED_FILENAME,
+ NULL,
+ SEARCH_TAB_MC_DOWNLOADED_ANONYMITY,
+ (guint) -1,
+ SEARCH_TAB_MC_SHOW_NS_ASSOCIATION,
+ show_uri_association,
-1);
if (NULL != pixbuf)
g_object_unref (pixbuf);
@@ -2483,7 +2529,9 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab,
* @param filename new filename
*/
void
-GNUNET_FS_GTK_set_item_downloaded_name (GtkTreeStore *ts, GtkTreeRowReference
*rr, gchar *filename)
+GNUNET_FS_GTK_set_item_downloaded_name (GtkTreeStore *ts,
+ GtkTreeRowReference *rr,
+ gchar *filename)
{
struct GNUNET_GTK_MainWindowContext *mctx = GNUNET_FS_GTK_get_main_context
();
GtkTreeIter iter;
@@ -2541,11 +2589,13 @@ GNUNET_FS_GTK_set_item_downloaded_name (GtkTreeStore
*ts, GtkTreeRowReference *r
while (relname[0] == '/' || relname[0] == '\\')
relname++;
gtk_entry_set_text (mctx->download_name_entry, relname);
- gtk_file_chooser_set_current_folder
(mctx->download_location_chooser, dirname);
+ gtk_file_chooser_set_current_folder (mctx->download_location_chooser,
+ dirname);
break;
}
current = dirname;
- } while (dirname[0] != '.'); /* FIXME: Check that this condition is
correct */
+ } while (dirname[0] !=
+ '.'); /* FIXME: Check that this condition is correct */
g_free (dirname);
}
gtk_tree_path_free (path);
@@ -2572,8 +2622,8 @@ GNUNET_FS_GTK_set_item_downloaded_name (GtkTreeStore *ts,
GtkTreeRowReference *r
*/
static struct SearchResult *
process_search_result (struct SearchTab *tab,
- uint32_t anonymity,
- struct SearchResult *parent,
+ uint32_t anonymity,
+ struct SearchResult *parent,
const struct GNUNET_FS_Uri *uri,
const struct GNUNET_CONTAINER_MetaData *meta,
struct GNUNET_FS_SearchResult *result,
@@ -2582,10 +2632,12 @@ process_search_result (struct SearchTab *tab,
struct SearchResult *sr;
sr = GNUNET_GTK_add_search_result (tab,
- anonymity,
+ anonymity,
(parent != NULL) ? parent->rr : NULL,
- uri,
- meta, result, applicability_rank);
+ uri,
+ meta,
+ result,
+ applicability_rank);
update_search_label (tab);
GNUNET_break (NULL != sr);
return sr;
@@ -2601,7 +2653,7 @@ process_search_result (struct SearchTab *tab,
*/
static struct SearchTab *
setup_search_tab (struct GNUNET_FS_SearchContext *sc,
- const struct GNUNET_FS_Uri *query)
+ const struct GNUNET_FS_Uri *query)
{
struct SearchTab *tab;
GtkWindow *sf;
@@ -2634,53 +2686,51 @@ setup_search_tab (struct GNUNET_FS_SearchContext *sc,
else
tab->query_txt = GNUNET_FS_uri_to_string (query);
}
- tab->builder = GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_search_tab.glade",
- tab);
- tab->ts =
- GTK_TREE_STORE (gtk_builder_get_object
- (tab->builder,
- "GNUNET_GTK_file_sharing_result_tree_store"));
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (tab->builder, "_search_result_frame"));
- anim_col = GTK_TREE_VIEW_COLUMN (gtk_builder_get_object
- (tab->builder,
"search_result_status_pixbuf_column"));
- tab->atv = GNUNET_GTK_animation_tree_view_register (tv,
- anim_col);
+ tab->builder =
+ GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_search_tab.glade", tab);
+ tab->ts = GTK_TREE_STORE (
+ gtk_builder_get_object (tab->builder,
+ "GNUNET_GTK_file_sharing_result_tree_store"));
+ tv = GTK_TREE_VIEW (
+ gtk_builder_get_object (tab->builder, "_search_result_frame"));
+ anim_col = GTK_TREE_VIEW_COLUMN (
+ gtk_builder_get_object (tab->builder,
+ "search_result_status_pixbuf_column"));
+ tab->atv = GNUNET_GTK_animation_tree_view_register (tv, anim_col);
/* load frame */
- sf = GTK_WINDOW (gtk_builder_get_object
- (tab->builder, "_search_result_frame_window"));
+ sf = GTK_WINDOW (
+ gtk_builder_get_object (tab->builder, "_search_result_frame_window"));
tab->frame = gtk_bin_get_child (GTK_BIN (sf));
g_object_ref (tab->frame);
gtk_container_remove (GTK_CONTAINER (sf), tab->frame);
gtk_widget_destroy (GTK_WIDGET (sf));
/* load tab_label */
- sf = GTK_WINDOW (gtk_builder_get_object
- (tab->builder, "_search_result_label_window"));
+ sf = GTK_WINDOW (
+ gtk_builder_get_object (tab->builder, "_search_result_label_window"));
tab->tab_label = gtk_bin_get_child (GTK_BIN (sf));
g_object_ref (tab->tab_label);
gtk_container_remove (GTK_CONTAINER (sf), tab->tab_label);
gtk_widget_destroy (GTK_WIDGET (sf));
/* get refs to widgets */
- tab->label =
- GTK_LABEL (gtk_builder_get_object
- (tab->builder, "_search_result_label_window_label"));
- tab->close_button =
- GTK_WIDGET (gtk_builder_get_object
- (tab->builder, "_search_result_label_close_button"));
- tab->play_button =
- GTK_WIDGET (gtk_builder_get_object
- (tab->builder, "_search_result_label_play_button"));
- tab->pause_button =
- GTK_WIDGET (gtk_builder_get_object
- (tab->builder, "_search_result_label_pause_button"));
+ tab->label = GTK_LABEL (
+ gtk_builder_get_object (tab->builder,
"_search_result_label_window_label"));
+ tab->close_button = GTK_WIDGET (
+ gtk_builder_get_object (tab->builder,
"_search_result_label_close_button"));
+ tab->play_button = GTK_WIDGET (
+ gtk_builder_get_object (tab->builder, "_search_result_label_play_button"));
+ tab->pause_button = GTK_WIDGET (
+ gtk_builder_get_object (tab->builder,
"_search_result_label_pause_button"));
/* patch text */
update_search_label (tab);
/* make visible */
pages = gtk_notebook_get_n_pages (mctx->notebook);
- gtk_notebook_insert_page (mctx->notebook, tab->frame, tab->tab_label, pages
- 1);
+ gtk_notebook_insert_page (mctx->notebook,
+ tab->frame,
+ tab->tab_label,
+ pages - 1);
gtk_notebook_set_current_page (mctx->notebook, pages - 1);
gtk_widget_show (GTK_WIDGET (mctx->notebook));
return tab;
@@ -2743,7 +2793,7 @@ setup_inner_search (struct GNUNET_FS_SearchContext *sc,
*/
struct SearchResult *
GNUNET_GTK_add_to_uri_tab (uint32_t anonymity,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_CONTAINER_MetaData *meta,
const struct GNUNET_FS_Uri *uri)
{
struct GNUNET_GTK_MainWindowContext *mctx = GNUNET_FS_GTK_get_main_context
();
@@ -2763,16 +2813,18 @@ GNUNET_GTK_add_to_uri_tab (uint32_t anonymity,
break;
}
return GNUNET_GTK_add_search_result (uri_tab,
- anonymity,
- NULL, uri, meta, NULL, 0);
+ anonymity,
+ NULL,
+ uri,
+ meta,
+ NULL,
+ 0);
}
-
/* ***************** Download event handling ****************** */
-
/**
* Change the (background) color of the given download entry.
*
@@ -2780,8 +2832,7 @@ GNUNET_GTK_add_to_uri_tab (uint32_t anonymity,
* @param color name of the color to use
*/
static void
-change_download_color (struct DownloadEntry *de,
- const char *color)
+change_download_color (struct DownloadEntry *de, const char *color)
{
GtkTreeIter iter;
GtkTreePath *path;
@@ -2789,34 +2840,28 @@ change_download_color (struct DownloadEntry *de,
struct SearchTab *tab;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Changing download DE=%p color to %s\n",
- de,
+ "Changing download DE=%p color to %s\n",
+ de,
color);
deep = de;
while (NULL != deep->pde)
deep = deep->pde;
tab = NULL;
- if ( (NULL != deep->sr) &&
- (NULL != (tab = deep->sr->tab)) )
+ if ((NULL != deep->sr) && (NULL != (tab = deep->sr->tab)))
{
path = gtk_tree_row_reference_get_path (de->sr->rr);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (tab->ts),
- &iter,
- path));
+ GNUNET_assert (
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (tab->ts), &iter, path));
gtk_tree_path_free (path);
- gtk_tree_store_set (tab->ts,
- &iter,
- SEARCH_TAB_MC_STATUS_COLOUR, color,
- -1);
+ gtk_tree_store_set (tab->ts, &iter, SEARCH_TAB_MC_STATUS_COLOUR, color,
-1);
}
/* do the same update to the downloads tree store */
- get_download_list_entry (de,
- &iter);
+ get_download_list_entry (de, &iter);
gtk_tree_store_set (downloads_treestore,
&iter,
- SEARCH_TAB_MC_STATUS_COLOUR, color,
+ SEARCH_TAB_MC_STATUS_COLOUR,
+ color,
-1);
-
}
@@ -2827,8 +2872,7 @@ change_download_color (struct DownloadEntry *de,
* @param icon status icon to display
*/
static void
-change_download_status_icon (struct DownloadEntry *de,
- GdkPixbuf *icon)
+change_download_status_icon (struct DownloadEntry *de, GdkPixbuf *icon)
{
GtkTreeIter iter;
GtkTreePath *path;
@@ -2839,24 +2883,20 @@ change_download_status_icon (struct DownloadEntry *de,
while (NULL != deep->pde)
deep = deep->pde;
tab = NULL;
- if ( (NULL != deep->sr) &&
- (NULL != (tab = deep->sr->tab)) )
+ if ((NULL != deep->sr) && (NULL != (tab = deep->sr->tab)))
{
path = gtk_tree_row_reference_get_path (de->sr->rr);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (tab->ts),
- &iter,
- path));
+ GNUNET_assert (
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (tab->ts), &iter, path));
gtk_tree_path_free (path);
- gtk_tree_store_set (tab->ts,
- &iter,
- SEARCH_TAB_MC_STATUS_ICON, icon,
- -1);
+ gtk_tree_store_set (tab->ts, &iter, SEARCH_TAB_MC_STATUS_ICON, icon, -1);
}
/* do the same update to the downloads tree store */
get_download_list_entry (de, &iter);
gtk_tree_store_set (downloads_treestore,
&iter,
- SEARCH_TAB_MC_STATUS_ICON, icon,
+ SEARCH_TAB_MC_STATUS_ICON,
+ icon,
-1);
}
@@ -2906,7 +2946,6 @@ struct AddDirectoryEntryContext
* and we're calling during a 'PROGRESS' event.
*/
int check_duplicates;
-
};
@@ -2934,7 +2973,8 @@ struct AddDirectoryEntryContext
* @param data data available for the file (@a length bytes)
*/
static void
-add_directory_entry (void *cls, const char *filename,
+add_directory_entry (void *cls,
+ const char *filename,
const struct GNUNET_FS_Uri *uri,
const struct GNUNET_CONTAINER_MetaData *meta,
size_t length,
@@ -2948,8 +2988,8 @@ add_directory_entry (void *cls, const char *filename,
struct GNUNET_FS_Uri *xuri;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Adding directory entry `%s'\n",
- filename);
+ "Adding directory entry `%s'\n",
+ filename);
if (NULL == uri)
{
/* directory meta data itself */
@@ -2972,21 +3012,18 @@ add_directory_entry (void *cls, const char *filename,
{
do
{
- gtk_tree_model_get (tm, &iter,
- SEARCH_TAB_MC_URI, &xuri,
- -1);
+ gtk_tree_model_get (tm, &iter, SEARCH_TAB_MC_URI, &xuri, -1);
if (GNUNET_YES == GNUNET_FS_uri_test_equal (xuri, uri))
- return; /* already present */
- }
- while (gtk_tree_model_iter_next (tm,
- &iter));
+ return; /* already present */
+ } while (gtk_tree_model_iter_next (tm, &iter));
}
}
GNUNET_GTK_add_search_result (ade->tab,
- ade->anonymity,
- ade->prr,
- uri,
- meta, NULL,
+ ade->anonymity,
+ ade->prr,
+ uri,
+ meta,
+ NULL,
0);
}
@@ -3007,8 +3044,8 @@ add_directory_entry (void *cls, const char *filename,
*/
static void
mark_download_progress (struct DownloadEntry *de,
- const char *filename,
- uint64_t size,
+ const char *filename,
+ uint64_t size,
uint64_t completed,
const void *block_data,
uint64_t offset,
@@ -3022,8 +3059,8 @@ mark_download_progress (struct DownloadEntry *de,
struct SearchTab *tab;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Marking download progress for DE=%p, %llu/%llu, address@hidden
depth=%u\n",
- de,
+ "Marking download progress for DE=%p, %llu/%llu, address@hidden
depth=%u\n",
+ de,
(unsigned long long) completed,
(unsigned long long) size,
(unsigned long long) block_size,
@@ -3033,13 +3070,11 @@ mark_download_progress (struct DownloadEntry *de,
while (NULL != deep->pde)
deep = deep->pde;
tab = NULL;
- if ( (NULL != deep->sr) &&
- (NULL != (tab = deep->sr->tab)) )
+ if ((NULL != deep->sr) && (NULL != (tab = deep->sr->tab)))
{
path = gtk_tree_row_reference_get_path (de->sr->rr);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (tab->ts),
- &iter,
- path));
+ GNUNET_assert (
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (tab->ts), &iter, path));
gtk_tree_path_free (path);
/* FIXME-DESIGN: should we replace the 'availability' with
'progress' once the download has started and re-use the
@@ -3047,25 +3082,28 @@ mark_download_progress (struct DownloadEntry *de,
a custom CellRenderer... */
gtk_tree_store_set (tab->ts,
&iter,
- SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) ((size > 0) ?
(100 * completed / size) : 100),
- SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, (completed ? -1 :
0),
- SEARCH_TAB_MC_COMPLETED, completed,
+ SEARCH_TAB_MC_PERCENT_PROGRESS,
+ (guint) ((size > 0) ? (100 * completed / size) : 100),
+ SEARCH_TAB_MC_UNKNOWN_AVAILABILITY,
+ (completed ? -1 : 0),
+ SEARCH_TAB_MC_COMPLETED,
+ completed,
-1);
}
- get_download_list_entry (de,
- &diter);
+ get_download_list_entry (de, &diter);
gtk_tree_store_set (downloads_treestore,
&diter,
- SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) ((size > 0) ?
(100 * completed / size) : 100),
- SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, (completed ? -1 : 0),
- SEARCH_TAB_MC_COMPLETED, completed,
+ SEARCH_TAB_MC_PERCENT_PROGRESS,
+ (guint) ((size > 0) ? (100 * completed / size) : 100),
+ SEARCH_TAB_MC_UNKNOWN_AVAILABILITY,
+ (completed ? -1 : 0),
+ SEARCH_TAB_MC_COMPLETED,
+ completed,
-1);
if (completed < size)
{
/* partial completion, consider looking at the block */
- if ( (depth == 0) &&
- (block_size > 0) &&
- (GNUNET_YES == de->is_directory) )
+ if ((depth == 0) && (block_size > 0) && (GNUNET_YES == de->is_directory))
{
/* got a data block of a directory, list its contents */
struct AddDirectoryEntryContext ade;
@@ -3075,31 +3113,28 @@ mark_download_progress (struct DownloadEntry *de,
ade.check_duplicates = GNUNET_NO;
ade.anonymity = de->anonymity;
if (GNUNET_SYSERR ==
- GNUNET_FS_directory_list_contents ((size_t) block_size,
+ GNUNET_FS_directory_list_contents ((size_t) block_size,
block_data,
- offset,
+ offset,
&add_directory_entry,
&ade))
{
- /* Mime type was wrong, this is not a directory, update model! */
- de->is_directory = GNUNET_SYSERR;
+ /* Mime type was wrong, this is not a directory, update model! */
+ de->is_directory = GNUNET_SYSERR;
if (NULL != tab)
- gtk_tree_store_set (tab->ts,
- &iter,
- SEARCH_TAB_MC_MIMETYPE, "",
- -1);
+ gtk_tree_store_set (tab->ts, &iter, SEARCH_TAB_MC_MIMETYPE, "", -1);
gtk_tree_store_set (downloads_treestore,
&diter,
- SEARCH_TAB_MC_MIMETYPE, "",
- -1);
+ SEARCH_TAB_MC_MIMETYPE,
+ "",
+ -1);
}
}
}
else
{
/* full completion, look at the entire file */
- if ( (GNUNET_YES == de->is_directory) &&
- (filename != NULL) )
+ if ((GNUNET_YES == de->is_directory) && (filename != NULL))
{
struct AddDirectoryEntryContext ade;
@@ -3109,10 +3144,8 @@ mark_download_progress (struct DownloadEntry *de,
ade.prr = de->sr->rr;
ade.check_duplicates = GNUNET_YES;
if (GNUNET_OK !=
- GNUNET_FS_GTK_mmap_and_scan (filename,
- &add_directory_entry,
- &ade))
- de->is_directory = GNUNET_NO;
+ GNUNET_FS_GTK_mmap_and_scan (filename, &add_directory_entry, &ade))
+ de->is_directory = GNUNET_NO;
}
}
}
@@ -3126,8 +3159,7 @@ mark_download_progress (struct DownloadEntry *de,
* @param emsg error message to display
*/
static void
-mark_download_error (struct DownloadEntry *de,
- const char *emsg)
+mark_download_error (struct DownloadEntry *de, const char *emsg)
{
GtkTreeIter iter;
GtkTreePath *path;
@@ -3142,26 +3174,32 @@ mark_download_error (struct DownloadEntry *de,
while (NULL != deep->pde)
deep = deep->pde;
tab = NULL;
- if ( (NULL != deep->sr) &&
- (NULL != (tab = deep->sr->tab)) )
+ if ((NULL != deep->sr) && (NULL != (tab = deep->sr->tab)))
{
path = gtk_tree_row_reference_get_path (de->sr->rr);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (tab->ts),
- &iter,
- path));
+ GNUNET_assert (
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (tab->ts), &iter, path));
gtk_tree_path_free (path);
gtk_tree_store_set (tab->ts,
&iter,
- SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) 0,
- SEARCH_TAB_MC_URI_AS_STRING, emsg,
- SEARCH_TAB_MC_STATUS_ICON,
GNUNET_GTK_animation_context_get_pixbuf (animation_error),
+ SEARCH_TAB_MC_PERCENT_PROGRESS,
+ (guint) 0,
+ SEARCH_TAB_MC_URI_AS_STRING,
+ emsg,
+ SEARCH_TAB_MC_STATUS_ICON,
+ GNUNET_GTK_animation_context_get_pixbuf (
+ animation_error),
-1);
}
get_download_list_entry (de, &iter);
- gtk_tree_store_set (downloads_treestore, &iter,
- SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) 0,
- SEARCH_TAB_MC_URI_AS_STRING, emsg,
- SEARCH_TAB_MC_STATUS_ICON,
GNUNET_GTK_animation_context_get_pixbuf (animation_error),
+ gtk_tree_store_set (downloads_treestore,
+ &iter,
+ SEARCH_TAB_MC_PERCENT_PROGRESS,
+ (guint) 0,
+ SEARCH_TAB_MC_URI_AS_STRING,
+ emsg,
+ SEARCH_TAB_MC_STATUS_ICON,
+ GNUNET_GTK_animation_context_get_pixbuf
(animation_error),
-1);
}
@@ -3174,8 +3212,7 @@ mark_download_error (struct DownloadEntry *de,
* @param size overall size of the file
*/
static void
-mark_download_completed (struct DownloadEntry *de,
- uint64_t size)
+mark_download_completed (struct DownloadEntry *de, uint64_t size)
{
GtkTreeIter iter;
GtkTreePath *path;
@@ -3189,30 +3226,37 @@ mark_download_completed (struct DownloadEntry *de,
while (NULL != deep->pde)
deep = deep->pde;
tab = NULL;
- if ( (NULL != deep->sr) &&
- (NULL != (tab = deep->sr->tab)) )
+ if ((NULL != deep->sr) && (NULL != (tab = deep->sr->tab)))
{
path = gtk_tree_row_reference_get_path (de->sr->rr);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (tab->ts),
- &iter,
- path));
+ GNUNET_assert (
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (tab->ts), &iter, path));
gtk_tree_path_free (path);
gtk_tree_store_set (tab->ts,
&iter,
- SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) 100,
- SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint) 100,
- SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, -1,
- SEARCH_TAB_MC_STATUS_ICON,
GNUNET_GTK_animation_context_get_pixbuf (animation_downloaded),
+ SEARCH_TAB_MC_PERCENT_PROGRESS,
+ (guint) 100,
+ SEARCH_TAB_MC_PERCENT_AVAILABILITY,
+ (guint) 100,
+ SEARCH_TAB_MC_UNKNOWN_AVAILABILITY,
+ -1,
+ SEARCH_TAB_MC_STATUS_ICON,
+ GNUNET_GTK_animation_context_get_pixbuf (
+ animation_downloaded),
-1);
}
- get_download_list_entry (de,
- &iter);
+ get_download_list_entry (de, &iter);
gtk_tree_store_set (downloads_treestore,
&iter,
- SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) 100,
- SEARCH_TAB_MC_PERCENT_AVAILABILITY, (guint) 100,
- SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, -1,
- SEARCH_TAB_MC_STATUS_ICON,
GNUNET_GTK_animation_context_get_pixbuf (animation_downloaded),
+ SEARCH_TAB_MC_PERCENT_PROGRESS,
+ (guint) 100,
+ SEARCH_TAB_MC_PERCENT_AVAILABILITY,
+ (guint) 100,
+ SEARCH_TAB_MC_UNKNOWN_AVAILABILITY,
+ -1,
+ SEARCH_TAB_MC_STATUS_ICON,
+ GNUNET_GTK_animation_context_get_pixbuf (
+ animation_downloaded),
-1);
}
@@ -3236,8 +3280,8 @@ static struct DownloadEntry *
setup_download (struct DownloadEntry *de,
struct DownloadEntry *pde,
struct SearchResult *sr,
- uint32_t anonymity,
- struct GNUNET_FS_DownloadContext *dc,
+ uint32_t anonymity,
+ struct GNUNET_FS_DownloadContext *dc,
const struct GNUNET_FS_Uri *uri,
const char *filename,
const struct GNUNET_CONTAINER_MetaData *meta,
@@ -3249,15 +3293,16 @@ setup_download (struct DownloadEntry *de,
GtkTreeModel *tm;
struct DownloadEntry *deep;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Setting up download, initially DE=%p, PDE=%p for %p & %p into
%llu/%llu `%s'\n",
- de,
- pde,
- sr,
- dc,
- (unsigned long long) completed,
- (unsigned long long) size,
- filename);
+ GNUNET_log (
+ GNUNET_ERROR_TYPE_DEBUG,
+ "Setting up download, initially DE=%p, PDE=%p for %p & %p into %llu/%llu
`%s'\n",
+ de,
+ pde,
+ sr,
+ dc,
+ (unsigned long long) completed,
+ (unsigned long long) size,
+ filename);
GNUNET_assert (NULL != uri);
if (NULL == de)
{
@@ -3288,9 +3333,7 @@ setup_download (struct DownloadEntry *de,
deep = de;
while (NULL != deep->pde)
deep = deep->pde;
- if ( (NULL == de->sr) &&
- (NULL != pde) &&
- (NULL != deep->sr->tab) )
+ if ((NULL == de->sr) && (NULL != pde) && (NULL != deep->sr->tab))
{
/* child download, find appropriate search result from parent! */
GtkTreePath *path;
@@ -3301,8 +3344,8 @@ setup_download (struct DownloadEntry *de,
tm = GTK_TREE_MODEL (deep->sr->tab->ts);
path = gtk_tree_row_reference_get_path (pde->sr->rr);
- if ( (! gtk_tree_model_get_iter (tm, &iter, path)) ||
- (! gtk_tree_model_iter_children (tm, &child, &iter)) )
+ if ((! gtk_tree_model_get_iter (tm, &iter, path)) ||
+ (! gtk_tree_model_iter_children (tm, &child, &iter)))
{
GNUNET_break (0);
}
@@ -3310,24 +3353,25 @@ setup_download (struct DownloadEntry *de,
{
do
{
- gtk_tree_model_get (tm, &child,
- SEARCH_TAB_MC_URI, &uri,
- SEARCH_TAB_MC_SEARCH_RESULT, &de->sr,
+ gtk_tree_model_get (tm,
+ &child,
+ SEARCH_TAB_MC_URI,
+ &uri,
+ SEARCH_TAB_MC_SEARCH_RESULT,
+ &de->sr,
-1);
- if (GNUNET_YES == GNUNET_FS_uri_test_equal (de->uri,
- uri))
- break;
- de->sr = NULL;
- }
- while (gtk_tree_model_iter_next (tm, &child));
+ if (GNUNET_YES == GNUNET_FS_uri_test_equal (de->uri, uri))
+ break;
+ de->sr = NULL;
+ } while (gtk_tree_model_iter_next (tm, &child));
if (NULL == de->sr)
{
- /* child not found, what's going on!? */
- GNUNET_break (0);
+ /* child not found, what's going on!? */
+ GNUNET_break (0);
}
else
{
- de->sr->download = de;
+ de->sr->download = de;
}
}
gtk_tree_path_free (path);
@@ -3337,22 +3381,15 @@ setup_download (struct DownloadEntry *de,
/* Stand-alone download with no 'row'/search result affiliated
with the download so far; create a fresh entry for this
download */
- de->sr = GNUNET_GTK_add_search_result (NULL,
- anonymity,
- NULL,
- uri,
- meta,
- NULL, 0);
+ de->sr =
+ GNUNET_GTK_add_search_result (NULL, anonymity, NULL, uri, meta, NULL, 0);
GNUNET_FS_probe_stop (de->sr->probe);
de->sr->probe = NULL;
- GNUNET_CONTAINER_DLL_remove (pl_head,
- pl_tail,
- de->sr);
+ GNUNET_CONTAINER_DLL_remove (pl_head, pl_tail, de->sr);
de->sr->download = de;
path = gtk_tree_row_reference_get_path (de->sr->rr);
tm = gtk_tree_row_reference_get_model (de->sr->rr);
- if (! gtk_tree_model_get_iter (tm,
- &iter, path))
+ if (! gtk_tree_model_get_iter (tm, &iter, path))
{
GNUNET_break (0);
gtk_tree_path_free (path);
@@ -3363,7 +3400,7 @@ setup_download (struct DownloadEntry *de,
{
struct GNUNET_CONTAINER_MetaData *meta;
- /* get metadata from existing tab, might have a mime type */
+ /* get metadata from existing tab, might have a mime type */
path = gtk_tree_row_reference_get_path (de->sr->rr);
tm = gtk_tree_row_reference_get_model (de->sr->rr);
if (! gtk_tree_model_get_iter (tm, &iter, path))
@@ -3372,47 +3409,65 @@ setup_download (struct DownloadEntry *de,
gtk_tree_path_free (path);
return de;
}
- gtk_tree_model_get (tm, &iter,
- SEARCH_TAB_MC_METADATA, &meta,
- -1);
+ gtk_tree_model_get (tm, &iter, SEARCH_TAB_MC_METADATA, &meta, -1);
de->is_directory = GNUNET_FS_meta_data_test_for_directory (meta);
}
if (NULL == de->rr)
setup_download_list_entry (de, pde, de->sr);
gtk_tree_path_free (path);
- gtk_tree_store_set (GTK_TREE_STORE (tm), &iter,
- SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) ((size > 0) ?
(100 * completed / size) : 100),
- SEARCH_TAB_MC_FILENAME, filename,
- SEARCH_TAB_MC_STATUS_COLOUR, "blue",
- SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, -1,
- SEARCH_TAB_MC_SEARCH_RESULT, de->sr,
- SEARCH_TAB_MC_COMPLETED, (guint64) completed,
- SEARCH_TAB_MC_DOWNLOADED_FILENAME, de->filename,
- SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, de->anonymity,
- SEARCH_TAB_MC_STATUS_ICON,
GNUNET_GTK_animation_context_get_pixbuf (animation_download_stalled),
+ gtk_tree_store_set (GTK_TREE_STORE (tm),
+ &iter,
+ SEARCH_TAB_MC_PERCENT_PROGRESS,
+ (guint) ((size > 0) ? (100 * completed / size) : 100),
+ SEARCH_TAB_MC_FILENAME,
+ filename,
+ SEARCH_TAB_MC_STATUS_COLOUR,
+ "blue",
+ SEARCH_TAB_MC_UNKNOWN_AVAILABILITY,
+ -1,
+ SEARCH_TAB_MC_SEARCH_RESULT,
+ de->sr,
+ SEARCH_TAB_MC_COMPLETED,
+ (guint64) completed,
+ SEARCH_TAB_MC_DOWNLOADED_FILENAME,
+ de->filename,
+ SEARCH_TAB_MC_DOWNLOADED_ANONYMITY,
+ de->anonymity,
+ SEARCH_TAB_MC_STATUS_ICON,
+ GNUNET_GTK_animation_context_get_pixbuf (
+ animation_download_stalled),
-1);
/* also update downloads tab */
get_download_list_entry (de, &iter);
- gtk_tree_store_set (downloads_treestore, &iter,
- SEARCH_TAB_MC_PERCENT_PROGRESS, (guint) ((size > 0) ?
(100 * completed / size) : 100),
- SEARCH_TAB_MC_FILENAME, filename,
- SEARCH_TAB_MC_STATUS_COLOUR, "blue",
- SEARCH_TAB_MC_SEARCH_RESULT, de->sr,
- SEARCH_TAB_MC_UNKNOWN_AVAILABILITY, -1,
- SEARCH_TAB_MC_COMPLETED, (guint64) completed,
- SEARCH_TAB_MC_DOWNLOADED_FILENAME, de->filename,
- SEARCH_TAB_MC_DOWNLOADED_ANONYMITY, de->anonymity,
- SEARCH_TAB_MC_STATUS_ICON,
GNUNET_GTK_animation_context_get_pixbuf (animation_download_stalled),
+ gtk_tree_store_set (downloads_treestore,
+ &iter,
+ SEARCH_TAB_MC_PERCENT_PROGRESS,
+ (guint) ((size > 0) ? (100 * completed / size) : 100),
+ SEARCH_TAB_MC_FILENAME,
+ filename,
+ SEARCH_TAB_MC_STATUS_COLOUR,
+ "blue",
+ SEARCH_TAB_MC_SEARCH_RESULT,
+ de->sr,
+ SEARCH_TAB_MC_UNKNOWN_AVAILABILITY,
+ -1,
+ SEARCH_TAB_MC_COMPLETED,
+ (guint64) completed,
+ SEARCH_TAB_MC_DOWNLOADED_FILENAME,
+ de->filename,
+ SEARCH_TAB_MC_DOWNLOADED_ANONYMITY,
+ de->anonymity,
+ SEARCH_TAB_MC_STATUS_ICON,
+ GNUNET_GTK_animation_context_get_pixbuf (
+ animation_download_stalled),
-1);
return de;
}
-
/* ***************** Publish event handling ****************** */
-
/**
* Change the (background) color of the given publish entry.
*
@@ -3420,15 +3475,15 @@ setup_download (struct DownloadEntry *de,
* @param color name of the color to use
*/
static void
-change_publish_color (struct PublishEntry *pe,
- const char *color)
+change_publish_color (struct PublishEntry *pe, const char *color)
{
GtkTreeIter iter;
GtkTreePath *path;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Changing publish PE=%p color to %s\n",
- pe, color);
+ "Changing publish PE=%p color to %s\n",
+ pe,
+ color);
path = gtk_tree_row_reference_get_path (pe->rr);
if (! gtk_tree_model_get_iter (GTK_TREE_MODEL (pe->tab->ts), &iter, path))
{
@@ -3437,9 +3492,7 @@ change_publish_color (struct PublishEntry *pe,
return;
}
gtk_tree_path_free (path);
- gtk_tree_store_set (pe->tab->ts, &iter,
- PUBLISH_TAB_MC_BGCOLOUR, color,
- -1);
+ gtk_tree_store_set (pe->tab->ts, &iter, PUBLISH_TAB_MC_BGCOLOUR, color, -1);
}
@@ -3452,7 +3505,8 @@ change_publish_color (struct PublishEntry *pe,
* @param completed number of bytes we have completed
*/
static void
-mark_publish_progress (struct PublishEntry *pe, uint64_t size,
+mark_publish_progress (struct PublishEntry *pe,
+ uint64_t size,
uint64_t completed)
{
GtkTreeIter iter;
@@ -3466,8 +3520,10 @@ mark_publish_progress (struct PublishEntry *pe, uint64_t
size,
return;
}
gtk_tree_path_free (path);
- gtk_tree_store_set (pe->tab->ts, &iter,
- PUBLISH_TAB_MC_PROGRESS, (guint) ((size > 0) ? (100 *
completed / size) : 100),
+ gtk_tree_store_set (pe->tab->ts,
+ &iter,
+ PUBLISH_TAB_MC_PROGRESS,
+ (guint) ((size > 0) ? (100 * completed / size) : 100),
-1);
}
@@ -3497,10 +3553,15 @@ handle_publish_completed (struct PublishEntry *pe,
gtk_tree_path_free (path);
pe->uri = GNUNET_FS_uri_dup (uri);
uris = GNUNET_FS_uri_to_string (uri);
- gtk_tree_store_set (pe->tab->ts, &iter,
- PUBLISH_TAB_MC_RESULT_STRING, uris,
- PUBLISH_TAB_MC_PROGRESS, 100,
- PUBLISH_TAB_MC_STATUS_ICON,
GNUNET_GTK_animation_context_get_pixbuf (animation_published),
+ gtk_tree_store_set (pe->tab->ts,
+ &iter,
+ PUBLISH_TAB_MC_RESULT_STRING,
+ uris,
+ PUBLISH_TAB_MC_PROGRESS,
+ 100,
+ PUBLISH_TAB_MC_STATUS_ICON,
+ GNUNET_GTK_animation_context_get_pixbuf (
+ animation_published),
-1);
GNUNET_free (uris);
change_publish_color (pe, "green");
@@ -3515,8 +3576,7 @@ handle_publish_completed (struct PublishEntry *pe,
* @param emsg the error message
*/
static void
-handle_publish_error (struct PublishEntry *pe,
- const char *emsg)
+handle_publish_error (struct PublishEntry *pe, const char *emsg)
{
GtkTreeIter iter;
GtkTreePath *path;
@@ -3531,10 +3591,14 @@ handle_publish_error (struct PublishEntry *pe,
gtk_tree_path_free (path);
if (NULL == animation_error)
animation_error = load_animation ("error");
- gtk_tree_store_set (pe->tab->ts, &iter,
- PUBLISH_TAB_MC_RESULT_STRING, emsg,
- PUBLISH_TAB_MC_PROGRESS, 100,
- PUBLISH_TAB_MC_STATUS_ICON,
GNUNET_GTK_animation_context_get_pixbuf (animation_error),
+ gtk_tree_store_set (pe->tab->ts,
+ &iter,
+ PUBLISH_TAB_MC_RESULT_STRING,
+ emsg,
+ PUBLISH_TAB_MC_PROGRESS,
+ 100,
+ PUBLISH_TAB_MC_STATUS_ICON,
+ GNUNET_GTK_animation_context_get_pixbuf
(animation_error),
-1);
change_publish_color (pe, "red");
}
@@ -3594,8 +3658,7 @@ handle_publish_stop (struct PublishEntry *pe)
GNUNET_break (0);
return;
}
- (void) gtk_tree_store_remove (pe->tab->ts,
- &iter);
+ (void) gtk_tree_store_remove (pe->tab->ts, &iter);
gtk_tree_path_free (path);
gtk_tree_row_reference_free (pe->rr);
if (NULL != pe->uri)
@@ -3603,7 +3666,9 @@ handle_publish_stop (struct PublishEntry *pe)
GNUNET_FS_uri_destroy (pe->uri);
pe->uri = NULL;
}
- if (! gtk_tree_model_iter_children (GTK_TREE_MODEL (pe->tab->ts), &iter,
NULL))
+ if (! gtk_tree_model_iter_children (GTK_TREE_MODEL (pe->tab->ts),
+ &iter,
+ NULL))
delete_publish_tab ();
GNUNET_free (pe);
}
@@ -3617,8 +3682,8 @@ handle_publish_stop (struct PublishEntry *pe)
* @param user_data the 'struct PublishTab' that is being closed
*/
void
-GNUNET_FS_GTK_publish_label_close_button_clicked (GtkButton * button,
- gpointer user_data)
+GNUNET_FS_GTK_publish_label_close_button_clicked (GtkButton *button,
+ gpointer user_data)
{
struct PublishTab *tab = user_data;
struct PublishEntry *pe;
@@ -3630,9 +3695,7 @@ GNUNET_FS_GTK_publish_label_close_button_clicked
(GtkButton * button,
tm = GTK_TREE_MODEL (publish_tab->ts);
while (gtk_tree_model_iter_children (tm, &iter, NULL))
{
- gtk_tree_model_get (tm, &iter,
- PUBLISH_TAB_MC_ENT, &pe,
- -1);
+ gtk_tree_model_get (tm, &iter, PUBLISH_TAB_MC_ENT, &pe, -1);
GNUNET_FS_publish_stop (pe->pc);
}
clear_metadata_display ();
@@ -3651,8 +3714,10 @@ GNUNET_FS_GTK_publish_label_close_button_clicked
(GtkButton * button,
* @return the publishing entry that will represent this operation
*/
static struct PublishEntry *
-setup_publish (struct GNUNET_FS_PublishContext *pc, const char *fn,
- uint64_t fsize, struct PublishEntry *parent)
+setup_publish (struct GNUNET_FS_PublishContext *pc,
+ const char *fn,
+ uint64_t fsize,
+ struct PublishEntry *parent)
{
struct PublishEntry *ent;
GtkTreeIter *pitrptr;
@@ -3672,37 +3737,36 @@ setup_publish (struct GNUNET_FS_PublishContext *pc,
const char *fn,
publish_tab = GNUNET_new (struct PublishTab);
publish_tab->builder =
GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_tab.glade",
- publish_tab);
- df = GTK_WINDOW (gtk_builder_get_object
- (publish_tab->builder, "_publish_frame_window"));
+ publish_tab);
+ df = GTK_WINDOW (
+ gtk_builder_get_object (publish_tab->builder, "_publish_frame_window"));
publish_tab->frame = gtk_bin_get_child (GTK_BIN (df));
g_object_ref (publish_tab->frame);
gtk_container_remove (GTK_CONTAINER (df), publish_tab->frame);
gtk_widget_destroy (GTK_WIDGET (df));
/* load tab_label */
- df = GTK_WINDOW (gtk_builder_get_object
- (publish_tab->builder, "_publish_label_window"));
+ df = GTK_WINDOW (
+ gtk_builder_get_object (publish_tab->builder, "_publish_label_window"));
tab_label = gtk_bin_get_child (GTK_BIN (df));
g_object_ref (tab_label);
gtk_container_remove (GTK_CONTAINER (df), tab_label);
gtk_widget_destroy (GTK_WIDGET (df));
- tv = GTK_TREE_VIEW (gtk_builder_get_object
- (publish_tab->builder, "_publish_tree_view"));
- anim_col = GTK_TREE_VIEW_COLUMN (gtk_builder_get_object
- (publish_tab->builder, "_publish_animated_icon"));
- if ( (NULL != tv) && (NULL != anim_col) )
- publish_tab->atv = GNUNET_GTK_animation_tree_view_register (tv,
- anim_col);
+ tv = GTK_TREE_VIEW (
+ gtk_builder_get_object (publish_tab->builder, "_publish_tree_view"));
+ anim_col = GTK_TREE_VIEW_COLUMN (
+ gtk_builder_get_object (publish_tab->builder, "_publish_animated_icon"));
+ if ((NULL != tv) && (NULL != anim_col))
+ publish_tab->atv = GNUNET_GTK_animation_tree_view_register (tv,
anim_col);
/* make visible */
gtk_notebook_insert_page (mctx->notebook, publish_tab->frame, tab_label,
0);
gtk_widget_show (GTK_WIDGET (mctx->notebook));
gtk_notebook_set_current_page (mctx->notebook, 0);
publish_tab->ts =
- GTK_TREE_STORE (gtk_builder_get_object
- (publish_tab->builder, "_publish_frame_tree_store"));
+ GTK_TREE_STORE (gtk_builder_get_object (publish_tab->builder,
+ "_publish_frame_tree_store"));
}
/* decide where to insert in the tab */
@@ -3714,9 +3778,9 @@ setup_publish (struct GNUNET_FS_PublishContext *pc, const
char *fn,
{
/* create new iter from parent */
path = gtk_tree_row_reference_get_path (parent->rr);
- if (TRUE !=
- gtk_tree_model_get_iter (GTK_TREE_MODEL (publish_tab->ts), &piter,
- path))
+ if (TRUE != gtk_tree_model_get_iter (GTK_TREE_MODEL (publish_tab->ts),
+ &piter,
+ path))
{
GNUNET_break (0);
return NULL;
@@ -3734,13 +3798,23 @@ setup_publish (struct GNUNET_FS_PublishContext *pc,
const char *fn,
ent->tab = publish_tab;
ent->pc = pc;
size_fancy = GNUNET_STRINGS_byte_size_fancy (fsize);
- gtk_tree_store_insert_with_values (publish_tab->ts, &iter, pitrptr, G_MAXINT,
- PUBLISH_TAB_MC_FILENAME, fn,
- PUBLISH_TAB_MC_FILESIZE, size_fancy,
- PUBLISH_TAB_MC_BGCOLOUR, "white",
- PUBLISH_TAB_MC_PROGRESS, (guint) 0,
- PUBLISH_TAB_MC_ENT, ent,
- PUBLISH_TAB_MC_STATUS_ICON,
GNUNET_GTK_animation_context_get_pixbuf (animation_publishing),
+ gtk_tree_store_insert_with_values (publish_tab->ts,
+ &iter,
+ pitrptr,
+ G_MAXINT,
+ PUBLISH_TAB_MC_FILENAME,
+ fn,
+ PUBLISH_TAB_MC_FILESIZE,
+ size_fancy,
+ PUBLISH_TAB_MC_BGCOLOUR,
+ "white",
+ PUBLISH_TAB_MC_PROGRESS,
+ (guint) 0,
+ PUBLISH_TAB_MC_ENT,
+ ent,
+ PUBLISH_TAB_MC_STATUS_ICON,
+ GNUNET_GTK_animation_context_get_pixbuf (
+ animation_publishing),
-1);
GNUNET_free (size_fancy);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (publish_tab->ts), &iter);
@@ -3750,7 +3824,6 @@ setup_publish (struct GNUNET_FS_PublishContext *pc, const
char *fn,
}
-
/**
* Context for the publish list popup menu.
*/
@@ -3770,7 +3843,6 @@ struct PublishListPopupContext
* Publishing entry at the respective row.
*/
struct PublishEntry *pe;
-
};
@@ -3781,8 +3853,7 @@ struct PublishListPopupContext
* @param user_data the 'struct PublishListPopupContext' of the menu
*/
static void
-publish_list_popup_selection_done (GtkMenuShell *menushell,
- gpointer user_data)
+publish_list_popup_selection_done (GtkMenuShell *menushell, gpointer user_data)
{
struct PublishListPopupContext *ppc = user_data;
@@ -3859,12 +3930,8 @@ publish_list_get_popup (GtkTreeModel *tm,
struct PublishEntry *pe;
struct PublishListPopupContext *ppc;
- gtk_tree_model_get (tm, iter,
- PUBLISH_TAB_MC_ENT, &pe,
- -1);
- if ( (NULL == pe->uri) &&
- ( (NULL == pe->pc) ||
- (GNUNET_NO == pe->is_top) ) )
+ gtk_tree_model_get (tm, iter, PUBLISH_TAB_MC_ENT, &pe, -1);
+ if ((NULL == pe->uri) && ((NULL == pe->pc) || (GNUNET_NO == pe->is_top)))
{
/* no actions available, refuse to pop up */
return NULL;
@@ -3879,27 +3946,34 @@ publish_list_get_popup (GtkTreeModel *tm,
menu = GTK_MENU (gtk_menu_new ());
if (NULL != pe->uri)
{
- child = gtk_menu_item_new_with_label (_("_Copy URI to Clipboard"));
- g_signal_connect (child, "activate",
- G_CALLBACK (copy_publish_uri_to_clipboard_ctx_menu), ppc);
- gtk_label_set_use_underline (GTK_LABEL
- (gtk_bin_get_child (GTK_BIN (child))), TRUE);
+ child = gtk_menu_item_new_with_label (_ ("_Copy URI to Clipboard"));
+ g_signal_connect (child,
+ "activate",
+ G_CALLBACK (copy_publish_uri_to_clipboard_ctx_menu),
+ ppc);
+ gtk_label_set_use_underline (GTK_LABEL (
+ gtk_bin_get_child (GTK_BIN (child))),
+ TRUE);
gtk_widget_show (child);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
}
else if (NULL != pe->pc)
{
- child = gtk_menu_item_new_with_label (_("_Abort publishing"));
- g_signal_connect (child, "activate",
- G_CALLBACK (abort_publish_ctx_menu), ppc);
- gtk_label_set_use_underline (GTK_LABEL
- (gtk_bin_get_child (GTK_BIN (child))),
+ child = gtk_menu_item_new_with_label (_ ("_Abort publishing"));
+ g_signal_connect (child,
+ "activate",
+ G_CALLBACK (abort_publish_ctx_menu),
+ ppc);
+ gtk_label_set_use_underline (GTK_LABEL (
+ gtk_bin_get_child (GTK_BIN (child))),
TRUE);
gtk_widget_show (child);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), child);
}
- g_signal_connect (menu, "selection-done",
- G_CALLBACK (publish_list_popup_selection_done), ppc);
+ g_signal_connect (menu,
+ "selection-done",
+ G_CALLBACK (publish_list_popup_selection_done),
+ ppc);
return menu;
}
@@ -3914,7 +3988,7 @@ publish_list_get_popup (GtkTreeModel *tm,
*/
gboolean
GNUNET_FS_GTK_publish_treeview_popup_menu (GtkWidget *widget,
- gpointer user_data)
+ gpointer user_data)
{
GtkTreeView *tv = GTK_TREE_VIEW (widget);
struct PublishTab *tab = user_data;
@@ -3949,9 +4023,9 @@ GNUNET_FS_GTK_publish_treeview_popup_menu (GtkWidget
*widget,
* TRUE to stop the event propagation.
*/
gboolean
-GNUNET_FS_GTK_publish_treeview_button_press_event (GtkWidget * widget,
- GdkEvent * event,
- gpointer user_data)
+GNUNET_FS_GTK_publish_treeview_button_press_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
{
GtkTreeView *tv = GTK_TREE_VIEW (widget);
GdkEventButton *event_button = (GdkEventButton *) event;
@@ -3961,33 +4035,31 @@ GNUNET_FS_GTK_publish_treeview_button_press_event
(GtkWidget * widget,
GtkTreeIter iter;
GtkMenu *menu;
- if ( (GDK_BUTTON_PRESS != event->type) ||
- (3 != event_button->button) )
+ if ((GDK_BUTTON_PRESS != event->type) || (3 != event_button->button))
return FALSE; /* not a right-click */
if (! gtk_tree_view_get_path_at_pos (tv,
- event_button->x, event_button->y,
- &path, NULL, NULL, NULL))
+ event_button->x,
+ event_button->y,
+ &path,
+ NULL,
+ NULL,
+ NULL))
return FALSE; /* click outside of area with values, ignore */
tm = gtk_tree_view_get_model (tv);
if (! gtk_tree_model_get_iter (tm, &iter, path))
return FALSE; /* not sure how we got a path but no iter... */
gtk_tree_path_free (path);
- menu = publish_list_get_popup (tm,
- tab,
- &iter);
+ menu = publish_list_get_popup (tm, tab, &iter);
if (NULL == menu)
return FALSE;
- gtk_menu_popup_at_pointer (menu,
- event);
+ gtk_menu_popup_at_pointer (menu, event);
return FALSE; /* propagate further, to focus on the item (for example) */
}
-
/* ***************** Master event handler ****************** */
-
/**
* Notification of FS to a client about the progress of an
* operation. Callbacks of this type will be used for uploads,
@@ -4009,30 +4081,30 @@ GNUNET_GTK_fs_event_handler (void *cls,
{
void *ret;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Got FS event %d\n",
- info->status);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got FS event %d\n", info->status);
GNUNET_FS_GTK_set_fs_handle (info->fsh);
switch (info->status)
{
case GNUNET_FS_STATUS_PUBLISH_START:
- return setup_publish (info->value.publish.pc, info->value.publish.filename,
- info->value.publish.size, info->value.publish.pctx);
+ return setup_publish (info->value.publish.pc,
+ info->value.publish.filename,
+ info->value.publish.size,
+ info->value.publish.pctx);
case GNUNET_FS_STATUS_PUBLISH_RESUME:
- ret =
- setup_publish (info->value.publish.pc, info->value.publish.filename,
- info->value.publish.size, info->value.publish.pctx);
+ ret = setup_publish (info->value.publish.pc,
+ info->value.publish.filename,
+ info->value.publish.size,
+ info->value.publish.pctx);
if (NULL == ret)
return ret;
if (NULL != info->value.publish.specifics.resume.message)
{
- handle_publish_error (ret,
- info->value.publish.specifics.resume.message);
+ handle_publish_error (ret, info->value.publish.specifics.resume.message);
}
else if (NULL != info->value.publish.specifics.resume.chk_uri)
{
handle_publish_completed (ret,
- info->value.publish.specifics.resume.chk_uri);
+ info->value.publish.specifics.resume.chk_uri);
}
return ret;
case GNUNET_FS_STATUS_PUBLISH_SUSPEND:
@@ -4040,72 +4112,72 @@ GNUNET_GTK_fs_event_handler (void *cls,
return NULL;
case GNUNET_FS_STATUS_PUBLISH_PROGRESS:
mark_publish_progress (info->value.publish.cctx,
- info->value.publish.size,
- info->value.publish.completed);
+ info->value.publish.size,
+ info->value.publish.completed);
return info->value.publish.cctx;
case GNUNET_FS_STATUS_PUBLISH_PROGRESS_DIRECTORY:
mark_publish_progress (info->value.publish.cctx,
-
info->value.publish.specifics.progress_directory.total,
-
info->value.publish.specifics.progress_directory.completed);
+ info->value.publish.specifics.progress_directory
+ .total,
+ info->value.publish.specifics.progress_directory
+ .completed);
return info->value.publish.cctx;
case GNUNET_FS_STATUS_PUBLISH_ERROR:
handle_publish_error (info->value.publish.cctx,
- info->value.publish.specifics.error.message);
+ info->value.publish.specifics.error.message);
return info->value.publish.cctx;
case GNUNET_FS_STATUS_PUBLISH_COMPLETED:
handle_publish_completed (info->value.publish.cctx,
- info->value.publish.specifics.completed.chk_uri);
+ info->value.publish.specifics.completed.chk_uri);
return info->value.publish.cctx;
case GNUNET_FS_STATUS_PUBLISH_STOPPED:
handle_publish_stop (info->value.publish.cctx);
return NULL;
case GNUNET_FS_STATUS_DOWNLOAD_START:
- return setup_download (info->value.download.cctx,
info->value.download.pctx,
+ return setup_download (info->value.download.cctx,
+ info->value.download.pctx,
info->value.download.sctx,
- info->value.download.anonymity,
- info->value.download.dc,
+ info->value.download.anonymity,
+ info->value.download.dc,
info->value.download.uri,
info->value.download.filename,
info->value.download.specifics.start.meta,
info->value.download.size,
info->value.download.completed);
case GNUNET_FS_STATUS_DOWNLOAD_RESUME:
- ret =
- setup_download (info->value.download.cctx, info->value.download.pctx,
- info->value.download.sctx,
- info->value.download.anonymity,
- info->value.download.dc,
- info->value.download.uri,
info->value.download.filename,
- info->value.download.specifics.resume.meta,
- info->value.download.size,
- info->value.download.completed);
+ ret = setup_download (info->value.download.cctx,
+ info->value.download.pctx,
+ info->value.download.sctx,
+ info->value.download.anonymity,
+ info->value.download.dc,
+ info->value.download.uri,
+ info->value.download.filename,
+ info->value.download.specifics.resume.meta,
+ info->value.download.size,
+ info->value.download.completed);
if (NULL != info->value.download.specifics.resume.message)
- mark_download_error (ret,
- info->value.download.specifics.resume.message);
+ mark_download_error (ret, info->value.download.specifics.resume.message);
return ret;
case GNUNET_FS_STATUS_DOWNLOAD_SUSPEND:
stop_download (info->value.download.cctx);
return NULL;
case GNUNET_FS_STATUS_DOWNLOAD_PROGRESS:
mark_download_progress (info->value.download.cctx,
- info->value.download.filename,
- info->value.download.size,
- info->value.download.completed,
- info->value.download.specifics.progress.data,
- info->value.download.specifics.progress.
- offset,
- info->value.download.specifics.progress.
- data_len,
- info->value.download.specifics.progress.
- depth);
+ info->value.download.filename,
+ info->value.download.size,
+ info->value.download.completed,
+ info->value.download.specifics.progress.data,
+ info->value.download.specifics.progress.offset,
+ info->value.download.specifics.progress.data_len,
+ info->value.download.specifics.progress.depth);
return info->value.download.cctx;
case GNUNET_FS_STATUS_DOWNLOAD_ERROR:
mark_download_error (info->value.download.cctx,
- info->value.download.specifics.error.message);
+ info->value.download.specifics.error.message);
return info->value.download.cctx;
case GNUNET_FS_STATUS_DOWNLOAD_COMPLETED:
mark_download_completed (info->value.download.cctx,
- info->value.download.size);
+ info->value.download.size);
return info->value.download.cctx;
case GNUNET_FS_STATUS_DOWNLOAD_STOPPED:
stop_download (info->value.download.cctx);
@@ -4113,12 +4185,14 @@ GNUNET_GTK_fs_event_handler (void *cls,
case GNUNET_FS_STATUS_DOWNLOAD_ACTIVE:
change_download_color (info->value.download.cctx, "yellow");
change_download_status_icon (info->value.download.cctx,
- GNUNET_GTK_animation_context_get_pixbuf
(animation_downloading));
+ GNUNET_GTK_animation_context_get_pixbuf (
+ animation_downloading));
return info->value.download.cctx;
case GNUNET_FS_STATUS_DOWNLOAD_INACTIVE:
change_download_color (info->value.download.cctx, "blue");
change_download_status_icon (info->value.download.cctx,
- GNUNET_GTK_animation_context_get_pixbuf
(animation_download_stalled));
+ GNUNET_GTK_animation_context_get_pixbuf (
+ animation_download_stalled));
return info->value.download.cctx;
case GNUNET_FS_STATUS_DOWNLOAD_LOST_PARENT:
download_lost_parent (info->value.download.cctx);
@@ -4131,30 +4205,27 @@ GNUNET_GTK_fs_event_handler (void *cls,
case GNUNET_FS_STATUS_SEARCH_RESUME:
ret = setup_search_tab (info->value.search.sc, info->value.search.query);
if (info->value.search.specifics.resume.message)
- handle_search_error (ret,
- info->value.search.specifics.resume.message);
+ handle_search_error (ret, info->value.search.specifics.resume.message);
return ret;
case GNUNET_FS_STATUS_SEARCH_RESUME_RESULT:
ret =
- process_search_result (info->value.search.cctx,
- info->value.search.anonymity,
- info->value.search.pctx,
- info->value.search.specifics.resume_result.uri,
- info->value.search.specifics.resume_result.meta,
- info->value.search.specifics.resume_result.
- result,
- info->value.search.specifics.resume_result.
- applicability_rank);
+ process_search_result (info->value.search.cctx,
+ info->value.search.anonymity,
+ info->value.search.pctx,
+ info->value.search.specifics.resume_result.uri,
+ info->value.search.specifics.resume_result.meta,
+ info->value.search.specifics.resume_result.result,
+ info->value.search.specifics.resume_result
+ .applicability_rank);
update_search_result (ret,
- info->value.search.specifics.resume_result.
- meta,
- info->value.search.specifics.resume_result.
- applicability_rank,
- info->value.search.specifics.resume_result.
- availability_rank,
- info->value.search.specifics.resume_result.
- availability_certainty,
- GNUNET_TIME_UNIT_ZERO);
+ info->value.search.specifics.resume_result.meta,
+ info->value.search.specifics.resume_result
+ .applicability_rank,
+ info->value.search.specifics.resume_result
+ .availability_rank,
+ info->value.search.specifics.resume_result
+ .availability_certainty,
+ GNUNET_TIME_UNIT_ZERO);
GNUNET_break (NULL != ret);
return ret;
case GNUNET_FS_STATUS_SEARCH_SUSPEND:
@@ -4162,31 +4233,30 @@ GNUNET_GTK_fs_event_handler (void *cls,
return NULL;
case GNUNET_FS_STATUS_SEARCH_RESULT:
return process_search_result (info->value.search.cctx,
- info->value.search.anonymity,
+ info->value.search.anonymity,
info->value.search.pctx,
info->value.search.specifics.result.uri,
info->value.search.specifics.result.meta,
info->value.search.specifics.result.result,
- info->value.search.specifics.result.
- applicability_rank);
+ info->value.search.specifics.result
+ .applicability_rank);
case GNUNET_FS_STATUS_SEARCH_RESULT_NAMESPACE:
GNUNET_break (0);
break;
case GNUNET_FS_STATUS_SEARCH_UPDATE:
update_search_result (info->value.search.specifics.update.cctx,
- info->value.search.specifics.update.meta,
- info->value.search.specifics.update.
- applicability_rank,
- info->value.search.specifics.update.
- availability_rank,
- info->value.search.specifics.update.
- availability_certainty,
- info->value.search.specifics.update.
- current_probe_time);
+ info->value.search.specifics.update.meta,
+ info->value.search.specifics.update
+ .applicability_rank,
+
info->value.search.specifics.update.availability_rank,
+ info->value.search.specifics.update
+ .availability_certainty,
+ info->value.search.specifics.update
+ .current_probe_time);
return info->value.search.specifics.update.cctx;
case GNUNET_FS_STATUS_SEARCH_ERROR:
handle_search_error (info->value.search.cctx,
- info->value.search.specifics.error.message);
+ info->value.search.specifics.error.message);
return info->value.search.cctx;
case GNUNET_FS_STATUS_SEARCH_PAUSED:
return info->value.search.cctx;
@@ -4205,10 +4275,11 @@ GNUNET_GTK_fs_event_handler (void *cls,
return info->value.unindex.cctx;
case GNUNET_FS_STATUS_UNINDEX_RESUME:
return GNUNET_FS_GTK_unindex_handle_resume_ (info->value.unindex.uc,
- info->value.unindex.filename,
- info->value.unindex.size,
- info->value.unindex.completed,
-
info->value.unindex.specifics.resume.message);
+ info->value.unindex.filename,
+ info->value.unindex.size,
+ info->value.unindex.completed,
+ info->value.unindex.specifics
+ .resume.message);
case GNUNET_FS_STATUS_UNINDEX_SUSPEND:
GNUNET_FS_GTK_unindex_handle_stop_ (info->value.unindex.cctx);
return NULL;
@@ -4224,7 +4295,8 @@ GNUNET_GTK_fs_event_handler (void *cls,
case GNUNET_FS_STATUS_UNINDEX_ERROR:
if (NULL != info->value.unindex.cctx)
GNUNET_FS_GTK_unindex_handle_error_ (info->value.unindex.cctx,
-
info->value.unindex.specifics.error.message);
+ info->value.unindex.specifics.error
+ .message);
else
GNUNET_FS_unindex_stop (info->value.unindex.uc);
return info->value.unindex.cctx;
diff --git a/src/fs/gnunet-fs-gtk_event-handler.h
b/src/fs/gnunet-fs-gtk_event-handler.h
index 749ae174..66f34b2c 100644
--- a/src/fs/gnunet-fs-gtk_event-handler.h
+++ b/src/fs/gnunet-fs-gtk_event-handler.h
@@ -116,7 +116,6 @@ struct SearchTab
* Number of results we got for this search.
*/
unsigned int num_results;
-
};
@@ -263,7 +262,6 @@ extern struct SearchResult *pl_tail;
extern GtkTreeStore *downloads_treestore;
-
/**
* Setup a new top-level entry in the URI/orphan tab. If necessary, create
* the URI tab first.
@@ -275,7 +273,7 @@ extern GtkTreeStore *downloads_treestore;
*/
struct SearchResult *
GNUNET_GTK_add_to_uri_tab (uint32_t anonymity,
- const struct GNUNET_CONTAINER_MetaData *meta,
+ const struct GNUNET_CONTAINER_MetaData *meta,
const struct GNUNET_FS_Uri *uri);
@@ -298,7 +296,7 @@ GNUNET_GTK_add_to_uri_tab (uint32_t anonymity,
*/
struct SearchResult *
GNUNET_GTK_add_search_result (struct SearchTab *tab,
- uint32_t anonymity,
+ uint32_t anonymity,
GtkTreeRowReference *parent_rr,
const struct GNUNET_FS_Uri *uri,
const struct GNUNET_CONTAINER_MetaData *meta,
@@ -307,7 +305,9 @@ GNUNET_GTK_add_search_result (struct SearchTab *tab,
void
-GNUNET_FS_GTK_set_item_downloaded_name (GtkTreeStore *ts, GtkTreeRowReference
*rr, gchar *filename);
+GNUNET_FS_GTK_set_item_downloaded_name (GtkTreeStore *ts,
+ GtkTreeRowReference *rr,
+ gchar *filename);
/**
* Notification of FS to a client about the progress of an
@@ -345,8 +345,9 @@ GNUNET_FS_GTK_close_uri_tab_ ();
*/
void
GNUNET_FS_GTK_update_connection_indicator (
- struct GNUNET_GTK_MainWindowContext *main_ctx,
- gboolean connected, const gchar *tooltip);
+ struct GNUNET_GTK_MainWindowContext *main_ctx,
+ gboolean connected,
+ const gchar *tooltip);
#endif
diff --git a/src/fs/gnunet-fs-gtk_main-window-connection.c
b/src/fs/gnunet-fs-gtk_main-window-connection.c
index 41cdfb1b..6afe56cc 100644
--- a/src/fs/gnunet-fs-gtk_main-window-connection.c
+++ b/src/fs/gnunet-fs-gtk_main-window-connection.c
@@ -34,15 +34,17 @@
* @param tooltip new tooltip text
*/
void
-GNUNET_FS_GTK_update_connection_indicator (struct GNUNET_GTK_MainWindowContext
*main_ctx,
- gboolean connected,
- const gchar *tooltip)
+GNUNET_FS_GTK_update_connection_indicator (
+ struct GNUNET_GTK_MainWindowContext *main_ctx,
+ gboolean connected,
+ const gchar *tooltip)
{
gtk_image_set_from_icon_name (main_ctx->connection_indicator,
- connected ? "network-transmit-receive" :
"network-offline",
+ connected ? "network-transmit-receive"
+ : "network-offline",
GTK_ICON_SIZE_BUTTON);
gtk_widget_set_tooltip_text (GTK_WIDGET (main_ctx->connection_indicator),
- tooltip);
+ tooltip);
}
/**
@@ -64,7 +66,9 @@ run_armview (struct GNUNET_GTK_MainWindowContext *main_ctx)
*/
gboolean
GNUNET_FS_GTK_main_window_connection_indicator_button_press_event_cb (
- GtkWidget *widget, GdkEvent *event, gpointer user_data)
+ GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
{
run_armview (user_data);
return FALSE;
diff --git a/src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c
b/src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c
index 88a72335..f5e27148 100644
--- a/src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c
+++ b/src/fs/gnunet-fs-gtk_main-window-meta-data-context-menu.c
@@ -29,7 +29,6 @@
#include <string.h>
-
/**
* Helper function of GNUNET_GTK_FS_metadata_copy_selection_activated
* which copies the (selected) entries from the tree view to the
@@ -41,14 +40,17 @@
* @param user_data 'GList**' where we should store the types and values found
*/
static void
-copy_metadata_to_clipboard (GtkTreeModel * model, GtkTreePath * path,
- GtkTreeIter * iter, gpointer user_data)
+copy_metadata_to_clipboard (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer user_data)
{
GList **l = user_data;
gchar *type;
gchar *value;
- gtk_tree_model_get (model, iter,
+ gtk_tree_model_get (model,
+ iter,
GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_TYPE_STRING,
&type,
GNUNET_GTK_FS_MAIN_WINDOW_META_DATA_MC_META_VALUE,
@@ -66,8 +68,8 @@ copy_metadata_to_clipboard (GtkTreeModel * model, GtkTreePath
* path,
* @param user_data the GtkBuilder of the main window
*/
void
-GNUNET_GTK_FS_metadata_copy_selection_activated (GtkMenuItem * menuitem,
- gpointer user_data)
+GNUNET_GTK_FS_metadata_copy_selection_activated (GtkMenuItem *menuitem,
+ gpointer user_data)
{
struct GNUNET_GTK_MainWindowContext *main_ctx = user_data;
GtkTreeView *tree;
@@ -83,7 +85,8 @@ GNUNET_GTK_FS_metadata_copy_selection_activated (GtkMenuItem
* menuitem,
tree = main_ctx->md_treeview;
pairs = NULL;
gtk_tree_selection_selected_foreach (gtk_tree_view_get_selection (tree),
- ©_metadata_to_clipboard, &pairs);
+ ©_metadata_to_clipboard,
+ &pairs);
if (NULL == pairs)
return; /* nothing selected */
total_len = 0;
@@ -93,12 +96,12 @@ GNUNET_GTK_FS_metadata_copy_selection_activated
(GtkMenuItem * menuitem,
type = pos;
value = pos->next;
GNUNET_assert (NULL != value);
- total_len +=
- strlen ((gchar *) type->data) + strlen ((gchar *) value->data) +
- 2 /* ": " */ + ((NULL != value->next) ? 1 : 0) /* "\n" */ ;
+ total_len += strlen ((gchar *) type->data) +
+ strlen ((gchar *) value->data) + 2 /* ": " */ +
+ ((NULL != value->next) ? 1 : 0) /* "\n" */;
}
GNUNET_assert (total_len > 0);
- total_len++; /* "\0" */
+ total_len++; /* "\0" */
s = g_new0 (gchar, total_len);
if (NULL == s)
{
@@ -135,24 +138,23 @@ GNUNET_GTK_FS_metadata_copy_selection_activated
(GtkMenuItem * menuitem,
* @param user_data the gtk builder of the main window
*/
gboolean
-GNUNET_GTK_main_window_metadata_treeview_button_press_event_cb (GtkWidget *
widget,
- GdkEvent *
event,
- gpointer
user_data)
+GNUNET_GTK_main_window_metadata_treeview_button_press_event_cb (
+ GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
{
struct GNUNET_GTK_MainWindowContext *main_ctx = user_data;
GdkEventButton *event_button = (GdkEventButton *) event;
GtkMenu *menu;
/* Ignore double-clicks and triple-clicks */
- if ( (event_button->button != 3) ||
- (event_button->type != GDK_BUTTON_PRESS) )
+ if ((event_button->button != 3) || (event_button->type != GDK_BUTTON_PRESS))
return FALSE;
- menu = GTK_MENU (gtk_builder_get_object (main_ctx->builder,
- "metadata_popup_menu"));
+ menu = GTK_MENU (
+ gtk_builder_get_object (main_ctx->builder, "metadata_popup_menu"));
if (NULL == menu)
return FALSE;
- gtk_menu_popup_at_pointer (menu,
- event);
+ gtk_menu_popup_at_pointer (menu, event);
return FALSE;
}
@@ -166,13 +168,14 @@
GNUNET_GTK_main_window_metadata_treeview_button_press_event_cb (GtkWidget * widg
* @return TRUE we did it
*/
gboolean
-GNUNET_GTK_main_window_metadata_treeview_popup_menu_cb (GtkWidget * widget,
+GNUNET_GTK_main_window_metadata_treeview_popup_menu_cb (GtkWidget *widget,
gpointer user_data)
{
struct GNUNET_GTK_MainWindowContext *main_ctx = user_data;
GtkMenu *menu;
- menu = GTK_MENU (gtk_builder_get_object (main_ctx->builder,
"metadata_popup_menu"));
+ menu = GTK_MENU (
+ gtk_builder_get_object (main_ctx->builder, "metadata_popup_menu"));
if (NULL == menu)
return FALSE;
gtk_menu_popup_at_widget (menu,
diff --git a/src/fs/gnunet-fs-gtk_main-window-search.c
b/src/fs/gnunet-fs-gtk_main-window-search.c
index e2970743..b79150fd 100644
--- a/src/fs/gnunet-fs-gtk_main-window-search.c
+++ b/src/fs/gnunet-fs-gtk_main-window-search.c
@@ -32,7 +32,8 @@
/**
* How long until we decide a SKS namespace GNS lookup has failed?
*/
-#define LOOKUP_TIMEOUT GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MINUTES, 2)
+#define LOOKUP_TIMEOUT \
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 2)
/**
@@ -41,11 +42,9 @@
static void
beep ()
{
- gdk_display_beep
- (gdk_screen_get_display
- (gdk_window_get_screen
- (gtk_widget_get_parent_window
- (GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_main_window"))))));
+ gdk_display_beep (gdk_screen_get_display (
+ gdk_window_get_screen (gtk_widget_get_parent_window (GTK_WIDGET (
+ GNUNET_FS_GTK_get_main_window_object ("GNUNET_GTK_main_window"))))));
}
@@ -56,12 +55,13 @@ beep ()
* @param anonymity_level degree of anonymity to apply for the search
*/
static void
-search_for_uri (struct GNUNET_FS_Uri *uri,
- guint anonymity_level)
+search_for_uri (struct GNUNET_FS_Uri *uri, guint anonymity_level)
{
GNUNET_FS_search_start (GNUNET_FS_GTK_get_fs_handle (),
- uri, anonymity_level,
- GNUNET_FS_SEARCH_OPTION_NONE, NULL);
+ uri,
+ anonymity_level,
+ GNUNET_FS_SEARCH_OPTION_NONE,
+ NULL);
GNUNET_FS_uri_destroy (uri);
}
@@ -74,11 +74,10 @@ search_for_uri (struct GNUNET_FS_Uri *uri,
void
abort_search_lookup (struct SearchLookup *sl)
{
- struct GNUNET_GTK_MainWindowContext *main_ctx =
GNUNET_FS_GTK_get_main_context ();
+ struct GNUNET_GTK_MainWindowContext *main_ctx =
+ GNUNET_FS_GTK_get_main_context ();
- GNUNET_CONTAINER_DLL_remove (main_ctx->sl_head,
- main_ctx->sl_tail,
- sl);
+ GNUNET_CONTAINER_DLL_remove (main_ctx->sl_head, main_ctx->sl_tail, sl);
if (NULL != sl->timeout_task)
{
GNUNET_SCHEDULER_cancel (sl->timeout_task);
@@ -107,7 +106,7 @@ timeout_search_lookup (void *cls)
sl->timeout_task = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to resolve namespace in time\n"));
+ _ ("Failed to resolve namespace in time\n"));
abort_search_lookup (sl);
}
@@ -122,15 +121,15 @@ timeout_search_lookup (void *cls)
*/
static void
handle_gns_result (void *cls,
- uint32_t rd_count,
- const struct GNUNET_GNSRECORD_Data *rd)
+ uint32_t rd_count,
+ const struct GNUNET_GNSRECORD_Data *rd)
{
struct SearchLookup *sl = cls;
unsigned int i;
struct GNUNET_FS_Uri *uri;
sl->gns = NULL;
- for (i=0;i<rd_count;i++)
+ for (i = 0; i < rd_count; i++)
{
if (GNUNET_GNSRECORD_TYPE_PKEY != rd[i].record_type)
continue;
@@ -145,7 +144,7 @@ handle_gns_result (void *cls,
return;
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to resolve namespace in time\n"));
+ _ ("Failed to resolve namespace in time\n"));
abort_search_lookup (sl);
}
@@ -168,8 +167,10 @@ start_search (struct GNUNET_GTK_MainWindowContext
*main_ctx)
char *emsg;
/* get anonymity level */
- if (!GNUNET_GTK_get_selected_anonymity_level
- (main_ctx->builder, "main_window_search_anonymity_combobox",
&anonymity_level))
+ if (! GNUNET_GTK_get_selected_anonymity_level (
+ main_ctx->builder,
+ "main_window_search_anonymity_combobox",
+ &anonymity_level))
{
GNUNET_break (0);
return;
@@ -181,18 +182,18 @@ start_search (struct GNUNET_GTK_MainWindowContext
*main_ctx)
GtkTreeModel *mime_model;
GtkTreeIter iter;
- mime_combo = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object
- ("main_window_search_mime_combobox"));
+ mime_combo = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object (
+ "main_window_search_mime_combobox"));
mime_model = gtk_combo_box_get_model (mime_combo);
mime_keyword = NULL;
- if ( (NULL != mime_model) &&
- gtk_combo_box_get_active_iter (mime_combo, &iter))
- gtk_tree_model_get (mime_model, &iter,
+ if ((NULL != mime_model) &&
+ gtk_combo_box_get_active_iter (mime_combo, &iter))
+ gtk_tree_model_get (mime_model,
+ &iter,
GNUNET_GTK_FS_MAIN_WINDOW_SEARCH_MIME_MC_MIME,
&mime_keyword,
-1);
- if ( (NULL != mime_keyword) &&
- (0 == strcmp (mime_keyword, " ")) )
+ if ((NULL != mime_keyword) && (0 == strcmp (mime_keyword, " ")))
{
g_free (mime_keyword);
mime_keyword = NULL;
@@ -201,13 +202,12 @@ start_search (struct GNUNET_GTK_MainWindowContext
*main_ctx)
{
GtkComboBox *namespace_box;
- namespace_box = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object
("main_window_search_namespace_combobox"));
- nsid = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN
(namespace_box))));
- if ( (NULL != nsid) &&
- ( (0 == strcasecmp (nsid,
- "<none>")) ||
- (0 == strcasecmp (nsid,
- _("<none>"))) ) )
+ namespace_box = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object (
+ "main_window_search_namespace_combobox"));
+ nsid = gtk_entry_get_text (
+ GTK_ENTRY (gtk_bin_get_child (GTK_BIN (namespace_box))));
+ if ((NULL != nsid) && ((0 == strcasecmp (nsid, "<none>")) ||
+ (0 == strcasecmp (nsid, _ ("<none>")))))
nsid = NULL;
}
@@ -218,9 +218,7 @@ start_search (struct GNUNET_GTK_MainWindowContext *main_ctx)
entry_keywords = gtk_entry_get_text (main_ctx->search_entry);
if (NULL != mime_keyword)
{
- keywords = g_strdup_printf ("%s +%s",
- entry_keywords,
- mime_keyword);
+ keywords = g_strdup_printf ("%s +%s", entry_keywords, mime_keyword);
g_free (mime_keyword);
}
else
@@ -230,26 +228,22 @@ start_search (struct GNUNET_GTK_MainWindowContext
*main_ctx)
}
/* build KSK/SKS URI */
- if ( (NULL != nsid) &&
- (0 < strlen (nsid)) )
+ if ((NULL != nsid) && (0 < strlen (nsid)))
{
sl = GNUNET_new (struct SearchLookup);
sl->keywords = keywords;
sl->anonymity_level = anonymity_level;
- sl->timeout_task = GNUNET_SCHEDULER_add_delayed (LOOKUP_TIMEOUT,
- &timeout_search_lookup,
sl);
- GNUNET_CRYPTO_ecdsa_key_get_public (main_ctx->sks_zone,
- &pub_sks_zone);
+ sl->timeout_task =
+ GNUNET_SCHEDULER_add_delayed (LOOKUP_TIMEOUT, &timeout_search_lookup,
sl);
+ GNUNET_CRYPTO_ecdsa_key_get_public (main_ctx->sks_zone, &pub_sks_zone);
sl->gns = GNUNET_GNS_lookup (main_ctx->gns,
- nsid,
- &pub_sks_zone,
- GNUNET_GNSRECORD_TYPE_PKEY,
- GNUNET_NO,
- &handle_gns_result,
- sl);
- GNUNET_CONTAINER_DLL_insert (main_ctx->sl_head,
- main_ctx->sl_tail,
- sl);
+ nsid,
+ &pub_sks_zone,
+ GNUNET_GNSRECORD_TYPE_PKEY,
+ GNUNET_NO,
+ &handle_gns_result,
+ sl);
+ GNUNET_CONTAINER_DLL_insert (main_ctx->sl_head, main_ctx->sl_tail, sl);
return;
}
@@ -258,8 +252,9 @@ start_search (struct GNUNET_GTK_MainWindowContext *main_ctx)
if (NULL == uri)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Invalid keyword string `%s': %s"),
- keywords, emsg);
+ _ ("Invalid keyword string `%s': %s"),
+ keywords,
+ emsg);
g_free (keywords);
GNUNET_free_non_null (emsg);
return;
@@ -276,8 +271,7 @@ start_search (struct GNUNET_GTK_MainWindowContext *main_ctx)
* @param user_data the main window context builder
*/
void
-main_window_search_button_clicked_cb (GtkButton * button,
- gpointer user_data)
+main_window_search_button_clicked_cb (GtkButton *button, gpointer user_data)
{
struct GNUNET_GTK_MainWindowContext *main_ctx = user_data;
@@ -295,8 +289,8 @@ main_window_search_button_clicked_cb (GtkButton * button,
* @return FALSE if this was not ENTER, TRUE if it was
*/
gboolean
-main_window_search_entry_key_press_event_cb (GtkWidget * widget,
- GdkEventKey * event,
+main_window_search_entry_key_press_event_cb (GtkWidget *widget,
+ GdkEventKey *event,
gpointer user_data)
{
struct GNUNET_GTK_MainWindowContext *main_ctx = user_data;
@@ -363,11 +357,8 @@ abort_pseu_lookup (struct PseuLookupContext *lctx)
{
struct GNUNET_GTK_MainWindowContext *main_ctx = lctx->main_ctx;
- GNUNET_CONTAINER_DLL_remove (main_ctx->lctx_head,
- main_ctx->lctx_tail,
- lctx);
- (void) GNUNET_SCHEDULER_add_now (&end_pseu_lookup,
- lctx);
+ GNUNET_CONTAINER_DLL_remove (main_ctx->lctx_head, main_ctx->lctx_tail, lctx);
+ (void) GNUNET_SCHEDULER_add_now (&end_pseu_lookup, lctx);
}
@@ -382,9 +373,7 @@ abort_pseu_lookup (struct PseuLookupContext *lctx)
* @param emsg NULL on success, otherwise an error message
*/
static void
-store_continuation (void *cls,
- int32_t success,
- const char *emsg)
+store_continuation (void *cls, int32_t success, const char *emsg)
{
struct PseuLookupContext *lctx = cls;
@@ -392,8 +381,8 @@ store_continuation (void *cls,
if (NULL != emsg)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to save record: %s\n"),
- emsg);
+ _ ("Failed to save record: %s\n"),
+ emsg);
beep ();
}
abort_pseu_lookup (lctx);
@@ -407,8 +396,7 @@ store_continuation (void *cls,
* @param nick nickname to store the namespace under
*/
static void
-save_pseudonym_with_nick (struct PseuLookupContext *lctx,
- const char *nick)
+save_pseudonym_with_nick (struct PseuLookupContext *lctx, const char *nick)
{
struct GNUNET_GNSRECORD_Data rd;
struct GNUNET_GTK_MainWindowContext *main_ctx;
@@ -416,14 +404,12 @@ save_pseudonym_with_nick (struct PseuLookupContext *lctx,
GNUNET_break (NULL == lctx->nick);
lctx->nick = GNUNET_strdup (nick);
/* again, show progress indicator, this should be fast though... */
- lctx->progress_dialog_builder
- = GNUNET_GTK_get_new_builder
- ("gnunet_fs_gtk_pseu_progress_dialog.glade",
- lctx);
- lctx->progress_dialog
- = GTK_WIDGET (gtk_builder_get_object
- (lctx->progress_dialog_builder,
- "GNUNET_FS_GTK_pseu_progress_dialog"));
+ lctx->progress_dialog_builder =
+ GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_pseu_progress_dialog.glade",
+ lctx);
+ lctx->progress_dialog =
+ GTK_WIDGET (gtk_builder_get_object (lctx->progress_dialog_builder,
+ "GNUNET_FS_GTK_pseu_progress_dialog"));
/* show the window */
gtk_window_present (GTK_WINDOW (lctx->progress_dialog));
memset (&rd, 0, sizeof (rd));
@@ -436,10 +422,12 @@ save_pseudonym_with_nick (struct PseuLookupContext *lctx,
lctx->namestore = GNUNET_NAMESTORE_connect (main_ctx->cfg);
GNUNET_assert (NULL != lctx->namestore);
lctx->qe = GNUNET_NAMESTORE_records_store (lctx->namestore,
- main_ctx->sks_zone,
- nick,
- 1, &rd,
- &store_continuation, lctx);
+ main_ctx->sks_zone,
+ nick,
+ 1,
+ &rd,
+ &store_continuation,
+ lctx);
}
@@ -452,19 +440,18 @@ save_pseudonym_with_nick (struct PseuLookupContext *lctx,
* @param user_data the `struct PseuLookupContext`
*/
void
-GNUNET_GTK_enter_nick_window_execute_button_clicked_cb (GtkButton * button,
- gpointer user_data)
+GNUNET_GTK_enter_nick_window_execute_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
{
struct PseuLookupContext *lctx = user_data;
GtkEntry *entry;
const char *nick;
- entry = GTK_ENTRY (gtk_builder_get_object
- (lctx->nick_dialog_builder,
- "GNUNET_GTK_enter_nick_window_nick_entry"));
+ entry = GTK_ENTRY (
+ gtk_builder_get_object (lctx->nick_dialog_builder,
+ "GNUNET_GTK_enter_nick_window_nick_entry"));
nick = gtk_entry_get_text (entry);
- if ( (NULL == nick) ||
- (0 == strlen (nick) ))
+ if ((NULL == nick) || (0 == strlen (nick)))
{
GNUNET_break (0);
abort_pseu_lookup (lctx);
@@ -486,17 +473,21 @@ GNUNET_GTK_enter_nick_window_execute_button_clicked_cb
(GtkButton * button,
*/
void
GNUNET_GTK_enter_nick_window_nick_entry_changed_cb (GtkWidget *widget,
- gpointer user_data)
+ gpointer user_data)
{
struct PseuLookupContext *lctx = user_data;
const gchar *new_text;
- GtkButton * button;
+ GtkButton *button;
new_text = gtk_entry_get_text (GTK_ENTRY (widget));
- button = GTK_BUTTON (gtk_builder_get_object (lctx->nick_dialog_builder,
-
"GNUNET_GTK_enter_nick_window_execute_button"));
+ button = GTK_BUTTON (
+ gtk_builder_get_object (lctx->nick_dialog_builder,
+ "GNUNET_GTK_enter_nick_window_execute_button"));
gtk_widget_set_sensitive (GTK_WIDGET (button),
- (GNUNET_OK == GNUNET_DNSPARSER_check_label
(new_text)) ? TRUE : FALSE);
+ (GNUNET_OK ==
+ GNUNET_DNSPARSER_check_label (new_text))
+ ? TRUE
+ : FALSE);
}
@@ -508,8 +499,8 @@ GNUNET_GTK_enter_nick_window_nick_entry_changed_cb
(GtkWidget *widget,
* @param user_data the `struct PseuLookupContext`
*/
void
-GNUNET_GTK_enter_nick_window_cancel_button_clicked_cb (GtkButton * button,
- gpointer user_data)
+GNUNET_GTK_enter_nick_window_cancel_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
{
struct PseuLookupContext *lctx = user_data;
@@ -527,10 +518,11 @@ static void
ask_for_nickname (struct PseuLookupContext *lctx)
{
/* setup the dialog and get the widgets we need most */
- lctx->nick_dialog_builder = GNUNET_GTK_get_new_builder
("gnunet_fs_gtk_enter_nick_dialog.glade",
- lctx);
- lctx->nick_dialog = GTK_WIDGET (gtk_builder_get_object
(lctx->nick_dialog_builder,
-
"GNUNET_GTK_enter_nick_window"));
+ lctx->nick_dialog_builder =
+ GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_enter_nick_dialog.glade", lctx);
+ lctx->nick_dialog =
+ GTK_WIDGET (gtk_builder_get_object (lctx->nick_dialog_builder,
+ "GNUNET_GTK_enter_nick_window"));
/* show the window */
gtk_window_present (GTK_WINDOW (lctx->nick_dialog));
}
@@ -548,8 +540,8 @@ ask_for_nickname (struct PseuLookupContext *lctx)
*/
static void
lookup_finished (void *cls,
- uint32_t rd_count,
- const struct GNUNET_GNSRECORD_Data *rd)
+ uint32_t rd_count,
+ const struct GNUNET_GNSRECORD_Data *rd)
{
struct PseuLookupContext *lctx = cls;
unsigned int i;
@@ -563,18 +555,17 @@ lookup_finished (void *cls,
lctx->progress_dialog_builder = NULL;
lctx->progress_dialog = NULL;
}
- for (i=0;i<rd_count;i++)
+ for (i = 0; i < rd_count; i++)
{
if (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type)
{
nick = rd[i].data;
if ('\0' != nick[rd[i].data_size - 1])
{
- GNUNET_break (0);
- continue;
+ GNUNET_break (0);
+ continue;
}
- save_pseudonym_with_nick (lctx,
- nick);
+ save_pseudonym_with_nick (lctx, nick);
return;
}
}
@@ -592,7 +583,7 @@ lookup_finished (void *cls,
*/
void
GNUNET_FS_GTK_pseu_progress_dialog_cancel_button_clicked_cb (GtkButton *button,
- gpointer user_data)
+ gpointer
user_data)
{
struct PseuLookupContext *lctx = user_data;
@@ -620,8 +611,8 @@ GNUNET_FS_GTK_pseu_progress_dialog_cancel_button_clicked_cb
(GtkButton *button,
*/
gboolean
GNUNET_GTK_enter_nick_window_delete_event_cb (GtkWidget *widget,
- GdkEvent * event,
- void *cls)
+ GdkEvent *event,
+ void *cls)
{
/* Don't allow GTK to kill the window, user must click execute or cancel */
beep ();
@@ -639,8 +630,8 @@ GNUNET_GTK_enter_nick_window_delete_event_cb (GtkWidget
*widget,
*/
gboolean
GNUNET_FS_GTK_pseu_progress_dialog_delete_event_cb (GtkWidget *widget,
- GdkEvent * event,
- void *cls)
+ GdkEvent *event,
+ void *cls)
{
/* Don't allow GTK to kill the window, until the search is finished */
beep ();
@@ -656,8 +647,7 @@ GNUNET_FS_GTK_pseu_progress_dialog_delete_event_cb
(GtkWidget *widget,
* @param user_data the main window context builder
*/
void
-GNUNET_FS_GTK_save_button_clicked_cb (GtkButton * button,
- gpointer user_data)
+GNUNET_FS_GTK_save_button_clicked_cb (GtkButton *button, gpointer user_data)
{
struct GNUNET_GTK_MainWindowContext *main_ctx = user_data;
GtkComboBox *widget;
@@ -673,14 +663,16 @@ GNUNET_FS_GTK_save_button_clicked_cb (GtkButton * button,
return;
}
/* get anonymity level */
- if (!GNUNET_GTK_get_selected_anonymity_level
- (main_ctx->builder, "main_window_search_anonymity_combobox",
&anonymity_level))
+ if (! GNUNET_GTK_get_selected_anonymity_level (
+ main_ctx->builder,
+ "main_window_search_anonymity_combobox",
+ &anonymity_level))
{
GNUNET_break (0);
return;
}
- widget = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object
- ("main_window_search_namespace_combobox"));
+ widget = GTK_COMBO_BOX (GNUNET_FS_GTK_get_main_window_object (
+ "main_window_search_namespace_combobox"));
text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (widget))));
ret = GNUNET_GNSRECORD_zkey_to_pkey (text, &pkey);
if (GNUNET_OK != ret)
@@ -691,26 +683,26 @@ GNUNET_FS_GTK_save_button_clicked_cb (GtkButton * button,
lctx = GNUNET_new (struct PseuLookupContext);
lctx->pkey = pkey;
lctx->main_ctx = main_ctx;
- GNUNET_CONTAINER_DLL_insert (main_ctx->lctx_head,
- main_ctx->lctx_tail,
- lctx);
+ GNUNET_CONTAINER_DLL_insert (main_ctx->lctx_head, main_ctx->lctx_tail, lctx);
if (0 == anonymity_level)
{
/* setup the dialog and get the widgets we need most */
- lctx->progress_dialog_builder = GNUNET_GTK_get_new_builder
("gnunet_fs_gtk_pseu_progress_dialog.glade",
- lctx);
- lctx->progress_dialog = GTK_WIDGET (gtk_builder_get_object
(lctx->progress_dialog_builder,
-
"GNUNET_FS_GTK_pseu_progress_dialog"));
+ lctx->progress_dialog_builder =
+ GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_pseu_progress_dialog.glade",
+ lctx);
+ lctx->progress_dialog = GTK_WIDGET (
+ gtk_builder_get_object (lctx->progress_dialog_builder,
+ "GNUNET_FS_GTK_pseu_progress_dialog"));
/* show the window */
gtk_window_present (GTK_WINDOW (lctx->progress_dialog));
lctx->lr = GNUNET_GNS_lookup (main_ctx->gns,
- GNUNET_GNS_EMPTY_LABEL_AT,
- &pkey,
- GNUNET_GNSRECORD_TYPE_NICK,
- GNUNET_NO,
- &lookup_finished,
- lctx);
+ GNUNET_GNS_EMPTY_LABEL_AT,
+ &pkey,
+ GNUNET_GNSRECORD_TYPE_NICK,
+ GNUNET_NO,
+ &lookup_finished,
+ lctx);
}
else
{
@@ -719,8 +711,7 @@ GNUNET_FS_GTK_save_button_clicked_cb (GtkButton * button,
ask_for_nickname (lctx);
}
/* do not allow save again just yet */
- gtk_widget_set_sensitive (GTK_WIDGET (button),
- FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);
}
@@ -733,7 +724,7 @@ GNUNET_FS_GTK_save_button_clicked_cb (GtkButton * button,
*/
void
main_window_search_namespace_combobox_changed_cb (GtkComboBox *widget,
- gpointer user_data)
+ gpointer user_data)
{
GtkButton *button;
const gchar *text;
@@ -742,12 +733,12 @@ main_window_search_namespace_combobox_changed_cb
(GtkComboBox *widget,
text = gtk_entry_get_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (widget))));
ret = GNUNET_GNSRECORD_zkey_to_pkey (text, &pkey);
- button = GTK_BUTTON (GNUNET_FS_GTK_get_main_window_object
- ("GNUNET_FS_GTK_save_button"));
+ button = GTK_BUTTON (
+ GNUNET_FS_GTK_get_main_window_object ("GNUNET_FS_GTK_save_button"));
gtk_widget_set_visible (GTK_WIDGET (button),
- (GNUNET_OK == ret) ? TRUE : FALSE);
+ (GNUNET_OK == ret) ? TRUE : FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (button),
- (GNUNET_OK == ret) ? TRUE : FALSE);
+ (GNUNET_OK == ret) ? TRUE : FALSE);
}
diff --git a/src/fs/gnunet-fs-gtk_main-window-view-toggles.c
b/src/fs/gnunet-fs-gtk_main-window-view-toggles.c
index c2073480..3db0a1e3 100644
--- a/src/fs/gnunet-fs-gtk_main-window-view-toggles.c
+++ b/src/fs/gnunet-fs-gtk_main-window-view-toggles.c
@@ -35,8 +35,7 @@
* @param toggle_menu name of menu entry
*/
static void
-toggle_view (const char *toggled_widget,
- const char *toggle_menu)
+toggle_view (const char *toggled_widget, const char *toggle_menu)
{
GtkCheckMenuItem *mi;
GtkWidget *widget;
@@ -61,11 +60,14 @@ check_extras ()
GtkCheckMenuItem *m2;
GtkWidget *wbox;
- m1 = GTK_CHECK_MENU_ITEM (GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_main_menu_view_metadata"));
- m2 = GTK_CHECK_MENU_ITEM (GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_main_menu_view_preview"));
- wbox = GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_main_window_extras_vbox"));
- if ( (gtk_check_menu_item_get_active (m1)) ||
- (gtk_check_menu_item_get_active (m2)) )
+ m1 = GTK_CHECK_MENU_ITEM (GNUNET_FS_GTK_get_main_window_object (
+ "GNUNET_GTK_main_menu_view_metadata"));
+ m2 = GTK_CHECK_MENU_ITEM (
+ GNUNET_FS_GTK_get_main_window_object
("GNUNET_GTK_main_menu_view_preview"));
+ wbox = GTK_WIDGET (GNUNET_FS_GTK_get_main_window_object (
+ "GNUNET_GTK_main_window_extras_vbox"));
+ if ((gtk_check_menu_item_get_active (m1)) ||
+ (gtk_check_menu_item_get_active (m2)))
gtk_widget_show (wbox);
else
gtk_widget_hide (wbox);
@@ -79,8 +81,7 @@ check_extras ()
* @param data main window builder (unused)
*/
void
-GNUNET_GTK_main_menu_view_preview_toggled_cb (GtkWidget * dummy,
- gpointer data)
+GNUNET_GTK_main_menu_view_preview_toggled_cb (GtkWidget *dummy, gpointer data)
{
toggle_view ("GNUNET_GTK_main_window_preview_image",
"GNUNET_GTK_main_menu_view_preview");
@@ -95,13 +96,11 @@ GNUNET_GTK_main_menu_view_preview_toggled_cb (GtkWidget *
dummy,
* @param data main window builder (unused)
*/
void
-GNUNET_GTK_main_menu_view_metadata_toggled_cb (GtkWidget * dummy,
- gpointer data)
+GNUNET_GTK_main_menu_view_metadata_toggled_cb (GtkWidget *dummy, gpointer data)
{
toggle_view ("GNUNET_GTK_main_window_metadata_treeview",
"GNUNET_GTK_main_menu_view_metadata");
check_extras ();
-
}
@@ -112,8 +111,7 @@ GNUNET_GTK_main_menu_view_metadata_toggled_cb (GtkWidget *
dummy,
* @param data main window builder (unused)
*/
void
-GNUNET_GTK_main_menu_view_search_toggled_cb (GtkWidget * dummy,
- gpointer data)
+GNUNET_GTK_main_menu_view_search_toggled_cb (GtkWidget *dummy, gpointer data)
{
toggle_view ("main_window_search_hbox",
"GNUNET_GTK_main_menu_search_preview");
diff --git a/src/fs/gnunet-fs-gtk_open-directory.c
b/src/fs/gnunet-fs-gtk_open-directory.c
index 3c8d1f37..a83477ec 100644
--- a/src/fs/gnunet-fs-gtk_open-directory.c
+++ b/src/fs/gnunet-fs-gtk_open-directory.c
@@ -45,7 +45,6 @@ struct AddChildContext
* Anonymity level to use for probes in the directory.
*/
uint32_t anonymity;
-
};
@@ -66,8 +65,11 @@ struct AddChildContext
* @param data data available for the file (@a length bytes)
*/
static void
-add_child (void *cls, const char *filename, const struct GNUNET_FS_Uri *uri,
- const struct GNUNET_CONTAINER_MetaData *meta, size_t length,
+add_child (void *cls,
+ const char *filename,
+ const struct GNUNET_FS_Uri *uri,
+ const struct GNUNET_CONTAINER_MetaData *meta,
+ size_t length,
const void *data)
{
struct AddChildContext *acc = cls;
@@ -78,13 +80,14 @@ add_child (void *cls, const char *filename, const struct
GNUNET_FS_Uri *uri,
struct GNUNET_CONTAINER_MetaData *dmeta;
dmeta = GNUNET_CONTAINER_meta_data_duplicate (meta);
- GNUNET_CONTAINER_meta_data_insert (dmeta, "<user>",
+ GNUNET_CONTAINER_meta_data_insert (dmeta,
+ "<user>",
EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
- EXTRACTOR_METAFORMAT_UTF8, "text/plain",
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain",
acc->filename,
strlen (acc->filename) + 1);
- acc->sr = GNUNET_GTK_add_to_uri_tab (acc->anonymity,
- dmeta, NULL);
+ acc->sr = GNUNET_GTK_add_to_uri_tab (acc->anonymity, dmeta, NULL);
GNUNET_CONTAINER_meta_data_destroy (dmeta);
return;
}
@@ -93,12 +96,13 @@ add_child (void *cls, const char *filename, const struct
GNUNET_FS_Uri *uri,
GNUNET_break (0);
return;
}
- GNUNET_assert (NULL !=
- GNUNET_GTK_add_search_result (acc->sr->tab,
- acc->anonymity,
- acc->sr->rr,
- uri,
- meta, NULL, 0));
+ GNUNET_assert (NULL != GNUNET_GTK_add_search_result (acc->sr->tab,
+ acc->anonymity,
+ acc->sr->rr,
+ uri,
+ meta,
+ NULL,
+ 0));
}
@@ -124,12 +128,14 @@ GNUNET_GTK_open_directory_dialog_response_cb (GtkDialog
*dialog,
g_object_unref (G_OBJECT (builder));
return;
}
- filename = GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER
(dialog));
+ filename =
+ GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
g_object_unref (G_OBJECT (builder));
acc.filename = filename;
acc.sr = NULL;
- acc.anonymity = 1; // FIXME, might want to add this to dialog to allow user
to set it.
+ acc.anonymity =
+ 1; // FIXME, might want to add this to dialog to allow user to set it.
GNUNET_FS_GTK_mmap_and_scan (filename, &add_child, &acc);
GNUNET_free (filename);
}
@@ -143,7 +149,7 @@ GNUNET_GTK_open_directory_dialog_response_cb (GtkDialog
*dialog,
* @param data the main dialog builder, unused
*/
void
-GNUNET_GTK_main_menu_file_open_gnunet_directory_activate_cb (GtkWidget * dummy,
+GNUNET_GTK_main_menu_file_open_gnunet_directory_activate_cb (GtkWidget *dummy,
gpointer data)
{
GtkWidget *ad;
@@ -152,16 +158,17 @@
GNUNET_GTK_main_menu_file_open_gnunet_directory_activate_cb (GtkWidget * dummy,
GtkFileFilter *ff;
builder =
- GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_open_directory_dialog.glade",
NULL);
+ GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_open_directory_dialog.glade",
+ NULL);
if (NULL == builder)
{
GNUNET_break (0);
return;
}
- ad = GTK_WIDGET (gtk_builder_get_object
- (builder, "GNUNET_GTK_open_directory_dialog"));
- ff = GTK_FILE_FILTER (gtk_builder_get_object
- (builder, "gnunet_directory_filter"));
+ ad = GTK_WIDGET (
+ gtk_builder_get_object (builder, "GNUNET_GTK_open_directory_dialog"));
+ ff = GTK_FILE_FILTER (
+ gtk_builder_get_object (builder, "gnunet_directory_filter"));
/* FIXME-FEATURE: some day, write a custom file filter for
gnunet-directories... */
gtk_file_filter_add_pattern (ff, "*" GNUNET_FS_DIRECTORY_EXT);
diff --git a/src/fs/gnunet-fs-gtk_open-uri.c b/src/fs/gnunet-fs-gtk_open-uri.c
index 87ca0ee1..63b0105c 100644
--- a/src/fs/gnunet-fs-gtk_open-uri.c
+++ b/src/fs/gnunet-fs-gtk_open-uri.c
@@ -42,8 +42,7 @@
* parse the URI
*/
int
-GNUNET_FS_GTK_handle_uri_string (const char *uris,
- guint anonymity_level)
+GNUNET_FS_GTK_handle_uri_string (const char *uris, guint anonymity_level)
{
struct GNUNET_FS_Uri *uri;
char *perr;
@@ -66,7 +65,7 @@ GNUNET_FS_GTK_handle_uri_string (const char *uris,
* @param user_data the `GtkBuilder` of the URI dialog
*/
void
-GNUNET_GTK_open_url_dialog_execute_button_clicked_cb (GtkButton * button,
+GNUNET_GTK_open_url_dialog_execute_button_clicked_cb (GtkButton *button,
gpointer user_data)
{
GtkBuilder *builder = GTK_BUILDER (user_data);
@@ -78,17 +77,18 @@ GNUNET_GTK_open_url_dialog_execute_button_clicked_cb
(GtkButton * button,
char *uris;
dialog =
- GTK_WIDGET (gtk_builder_get_object
- (builder, "GNUNET_GTK_open_url_window"));
- tb = GTK_TEXT_BUFFER (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_open_url_dialog_url_textview_buffer"));
+ GTK_WIDGET (gtk_builder_get_object (builder,
"GNUNET_GTK_open_url_window"));
+ tb = GTK_TEXT_BUFFER (
+ gtk_builder_get_object (builder,
+ "GNUNET_GTK_open_url_dialog_url_textview_buffer"));
gtk_text_buffer_get_iter_at_offset (tb, &ti_start, 0);
gtk_text_buffer_get_iter_at_offset (tb, &ti_end, -1);
uris = gtk_text_buffer_get_text (tb, &ti_start, &ti_end, FALSE);
- if (!GNUNET_GTK_get_selected_anonymity_level
- (builder, "GNUNET_GTK_open_url_dialog_anonymity_combobox",
&anonymity_level))
+ if (! GNUNET_GTK_get_selected_anonymity_level (
+ builder,
+ "GNUNET_GTK_open_url_dialog_anonymity_combobox",
+ &anonymity_level))
{
GNUNET_break (0);
gtk_widget_destroy (dialog);
@@ -96,7 +96,7 @@ GNUNET_GTK_open_url_dialog_execute_button_clicked_cb
(GtkButton * button,
return;
}
GNUNET_break (GNUNET_OK ==
- GNUNET_FS_GTK_handle_uri_string (uris, anonymity_level));
+ GNUNET_FS_GTK_handle_uri_string (uris, anonymity_level));
g_free (uris);
gtk_widget_destroy (dialog);
g_object_unref (G_OBJECT (builder));
@@ -110,15 +110,14 @@ GNUNET_GTK_open_url_dialog_execute_button_clicked_cb
(GtkButton * button,
* @param user_data the 'GtkBuilder' of the URI dialog
*/
void
-GNUNET_GTK_open_url_dialog_cancel_button_clicked_cb (GtkButton * button,
+GNUNET_GTK_open_url_dialog_cancel_button_clicked_cb (GtkButton *button,
gpointer user_data)
{
GtkBuilder *builder = GTK_BUILDER (user_data);
GtkWidget *dialog;
- dialog = GTK_WIDGET (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_open_url_window"));
+ dialog =
+ GTK_WIDGET (gtk_builder_get_object (builder,
"GNUNET_GTK_open_url_window"));
gtk_widget_destroy (GTK_WIDGET (dialog));
g_object_unref (G_OBJECT (builder));
}
@@ -133,8 +132,8 @@ GNUNET_GTK_open_url_dialog_cancel_button_clicked_cb
(GtkButton * button,
* @return FALSE (allow destruction)
*/
gboolean
-GNUNET_GTK_open_url_window_delete_event_cb (GtkWidget * widget,
- GdkEvent * event,
+GNUNET_GTK_open_url_window_delete_event_cb (GtkWidget *widget,
+ GdkEvent *event,
gpointer user_data)
{
GtkBuilder *builder = GTK_BUILDER (user_data);
@@ -153,8 +152,8 @@ GNUNET_GTK_open_url_window_delete_event_cb (GtkWidget *
widget,
* @param user_data the 'GtkBuilder' of the URI dialog
*/
gboolean
-GNUNET_GTK_open_url_dialog_url_textview_key_press_event_cb (GtkWidget * widget,
- GdkEventKey *
event,
+GNUNET_GTK_open_url_dialog_url_textview_key_press_event_cb (GtkWidget *widget,
+ GdkEventKey *event,
gpointer user_data)
{
GtkBuilder *builder = GTK_BUILDER (user_data);
@@ -162,11 +161,12 @@
GNUNET_GTK_open_url_dialog_url_textview_key_press_event_cb (GtkWidget * widget,
if (event->keyval != GDK_KEY_Return)
return FALSE;
- execute = GTK_WIDGET (gtk_builder_get_object (builder,
-
"GNUNET_GTK_open_url_dialog_execute_button"));
+ execute = GTK_WIDGET (
+ gtk_builder_get_object (builder,
+ "GNUNET_GTK_open_url_dialog_execute_button"));
if (gtk_widget_get_sensitive (execute))
GNUNET_GTK_open_url_dialog_execute_button_clicked_cb (GTK_BUTTON (execute),
- user_data);
+ user_data);
return TRUE;
}
@@ -179,9 +179,9 @@ GNUNET_GTK_open_url_dialog_url_textview_key_press_event_cb
(GtkWidget * widget,
* @param user_data the 'GtkBuilder' of the URI dialog
*/
void
-GNUNET_GTK_open_url_dialog_url_textview_buffer_changed_cb (GtkTextBuffer *
- textbuffer,
- gpointer user_data)
+GNUNET_GTK_open_url_dialog_url_textview_buffer_changed_cb (
+ GtkTextBuffer *textbuffer,
+ gpointer user_data)
{
GtkBuilder *builder = GTK_BUILDER (user_data);
struct GNUNET_FS_Uri *uri;
@@ -192,9 +192,9 @@ GNUNET_GTK_open_url_dialog_url_textview_buffer_changed_cb
(GtkTextBuffer *
char *uris;
perr = NULL;
- tb = GTK_TEXT_BUFFER (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_open_url_dialog_url_textview_buffer"));
+ tb = GTK_TEXT_BUFFER (
+ gtk_builder_get_object (builder,
+ "GNUNET_GTK_open_url_dialog_url_textview_buffer"));
gtk_text_buffer_get_iter_at_offset (tb, &ti_start, 0);
gtk_text_buffer_get_iter_at_offset (tb, &ti_end, -1);
uris = gtk_text_buffer_get_text (tb, &ti_start, &ti_end, FALSE);
@@ -203,9 +203,8 @@ GNUNET_GTK_open_url_dialog_url_textview_buffer_changed_cb
(GtkTextBuffer *
else
uri = NULL;
g_free (uris);
- gtk_widget_set_sensitive (GTK_WIDGET
- (gtk_builder_get_object
- (builder,
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
+ builder,
"GNUNET_GTK_open_url_dialog_execute_button")),
(uri == NULL) ? FALSE : TRUE);
if (uri != NULL)
@@ -221,7 +220,7 @@ GNUNET_GTK_open_url_dialog_url_textview_buffer_changed_cb
(GtkTextBuffer *
* @param user_data unused
*/
void
-GNUNET_GTK_main_menu_file_download_uri_activate_cb (GtkWidget * dummy,
+GNUNET_GTK_main_menu_file_download_uri_activate_cb (GtkWidget *dummy,
gpointer user_data)
{
GtkBuilder *builder;
@@ -239,22 +238,22 @@ GNUNET_GTK_main_menu_file_download_uri_activate_cb
(GtkWidget * dummy,
GNUNET_break (0);
return;
}
- dialog = GTK_WIDGET (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_open_url_window"));
- tb = GTK_TEXT_BUFFER (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_open_url_dialog_url_textview_buffer"));
+ dialog =
+ GTK_WIDGET (gtk_builder_get_object (builder,
"GNUNET_GTK_open_url_window"));
+ tb = GTK_TEXT_BUFFER (
+ gtk_builder_get_object (builder,
+ "GNUNET_GTK_open_url_dialog_url_textview_buffer"));
gtk_text_buffer_get_iter_at_offset (tb, &ti_start, 0);
gtk_text_buffer_get_iter_at_offset (tb, &ti_end, -1);
gtk_text_buffer_delete (tb, &ti_start, &ti_end);
/* FIXME-FEATURE: query the clipboard, maybe there's valid URI in there?
* If so, get it. */
- combo = GTK_COMBO_BOX (gtk_builder_get_object
- (builder,
- "GNUNET_GTK_open_url_dialog_anonymity_combobox"));
- gtk_combo_box_set_model (combo, GNUNET_FS_GTK_get_anonymity_level_list_store
());
+ combo = GTK_COMBO_BOX (
+ gtk_builder_get_object (builder,
+ "GNUNET_GTK_open_url_dialog_anonymity_combobox"));
+ gtk_combo_box_set_model (combo,
+ GNUNET_FS_GTK_get_anonymity_level_list_store ());
toplevel = gtk_widget_get_toplevel (dummy);
if (GTK_IS_WINDOW (toplevel))
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (toplevel));
diff --git a/src/fs/gnunet-fs-gtk_open-uri.h b/src/fs/gnunet-fs-gtk_open-uri.h
index edb6cf53..3bb27389 100644
--- a/src/fs/gnunet-fs-gtk_open-uri.h
+++ b/src/fs/gnunet-fs-gtk_open-uri.h
@@ -36,7 +36,6 @@
* #GNUNET_SYSERR if we failed to parse the URI
*/
int
-GNUNET_FS_GTK_handle_uri_string (const char *uris,
- guint anonymity_level);
+GNUNET_FS_GTK_handle_uri_string (const char *uris, guint anonymity_level);
#endif
diff --git a/src/fs/gnunet-fs-gtk_publish-dialog.c
b/src/fs/gnunet-fs-gtk_publish-dialog.c
index c696afa5..bcd10d30 100644
--- a/src/fs/gnunet-fs-gtk_publish-dialog.c
+++ b/src/fs/gnunet-fs-gtk_publish-dialog.c
@@ -40,7 +40,8 @@
/**
* Columns in the publish model.
*/
-enum PUBLISH_ModelColumns {
+enum PUBLISH_ModelColumns
+{
/**
* A gchararray.
*/
@@ -85,7 +86,8 @@ enum PUBLISH_ModelColumns {
/**
* Columns in the identifiers model.
*/
-enum IDENTIFIERS_ModelColumns {
+enum IDENTIFIERS_ModelColumns
+{
/**
* A gchararray.
*/
@@ -115,7 +117,8 @@ enum IDENTIFIERS_ModelColumns {
/**
* The columns in the "GNUNET_GTK_master_publish_dialog_ego_liststore"
*/
-enum EGO_ModelColumns {
+enum EGO_ModelColumns
+{
/**
* A gchararray.
@@ -137,7 +140,8 @@ struct AddDirClientContext;
/**
* Main handle of the dialog for a publish operation.
*/
-struct MainPublishingDialogContext {
+struct MainPublishingDialogContext
+{
/**
* Main builder for the publishing dialog.
@@ -318,7 +322,8 @@ struct MainPublishingDialogContext {
/**
* Context we create when we are scanning a directory.
*/
-struct AddDirClientContext {
+struct AddDirClientContext
+{
/**
* This is a doubly-linked list.
*/
@@ -398,7 +403,8 @@ struct AddDirClientContext {
unsigned int total;
};
-static void clear_keywords_from_tm(struct MainPublishingDialogContext *ctx);
+static void
+clear_keywords_from_tm (struct MainPublishingDialogContext *ctx);
/* ************************ editing operations inside the master dialog *****
*/
@@ -410,17 +416,18 @@ static void clear_keywords_from_tm(struct
MainPublishingDialogContext *ctx);
* @param i2 second iterator
* @return #GNUNET_YES if they are equal
*/
-static int gtk_tree_iter_equals(GtkTreeModel *tm, GtkTreeIter *i1,
- GtkTreeIter *i2) {
+static int
+gtk_tree_iter_equals (GtkTreeModel *tm, GtkTreeIter *i1, GtkTreeIter *i2)
+{
GtkTreePath *p1;
GtkTreePath *p2;
int ret;
- p1 = gtk_tree_model_get_path(tm, i1);
- p2 = gtk_tree_model_get_path(tm, i2);
- ret = gtk_tree_path_compare(p1, p2);
- gtk_tree_path_free(p1);
- gtk_tree_path_free(p2);
+ p1 = gtk_tree_model_get_path (tm, i1);
+ p2 = gtk_tree_model_get_path (tm, i2);
+ ret = gtk_tree_path_compare (p1, p2);
+ gtk_tree_path_free (p1);
+ gtk_tree_path_free (p2);
return (0 == ret) ? GNUNET_YES : GNUNET_NO;
}
@@ -430,7 +437,8 @@ static int gtk_tree_iter_equals(GtkTreeModel *tm,
GtkTreeIter *i1,
* @param ctx master dialog to update selectivity for
*/
static void
-update_selectivity_execute_cancel(struct MainPublishingDialogContext *ctx) {
+update_selectivity_execute_cancel (struct MainPublishingDialogContext *ctx)
+{
gboolean pub_in_global;
gboolean pub_in_own;
gboolean updateable;
@@ -438,32 +446,32 @@ update_selectivity_execute_cancel(struct
MainPublishingDialogContext *ctx) {
GtkTreeIter iter;
pub_in_global =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ctx->global_checkbox));
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ctx->global_checkbox));
pub_in_own =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ctx->own_checkbox));
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ctx->own_checkbox));
updateable =
-
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ctx->updateable_checkbox));
- gtk_widget_set_sensitive(ctx->update_id_hbox, updateable);
- gtk_widget_set_sensitive(ctx->own_vbox, pub_in_own);
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(ctx->updateable_checkbox));
+ gtk_widget_set_sensitive (ctx->update_id_hbox, updateable);
+ gtk_widget_set_sensitive (ctx->own_vbox, pub_in_own);
- ns_id = gtk_entry_get_text(GTK_ENTRY(ctx->identifier_entry));
+ ns_id = gtk_entry_get_text (GTK_ENTRY (ctx->identifier_entry));
/* Don't let the user close the dialog until all scanners are finished and
their windows are closed */
- if ((gtk_tree_model_get_iter_first(ctx->file_info_treemodel, &iter)) &&
+ if ((gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter)) &&
(pub_in_global || pub_in_own) &&
- ((!pub_in_own) ||
+ ((! pub_in_own) ||
((NULL != ctx->ns) && (NULL != ns_id) && ('\0' != ns_id[0]))) &&
(NULL == ctx->adddir_head))
- gtk_widget_set_sensitive(ctx->execute_button, TRUE);
+ gtk_widget_set_sensitive (ctx->execute_button, TRUE);
else
- gtk_widget_set_sensitive(ctx->execute_button, FALSE);
+ gtk_widget_set_sensitive (ctx->execute_button, FALSE);
/* if an 'edit' operation is open, don't even allow "cancel" */
if (ctx->adddir_head == NULL)
- gtk_widget_set_sensitive(ctx->cancel_button, TRUE);
+ gtk_widget_set_sensitive (ctx->cancel_button, TRUE);
else
- gtk_widget_set_sensitive(ctx->cancel_button, FALSE);
+ gtk_widget_set_sensitive (ctx->cancel_button, FALSE);
}
/**
@@ -471,61 +479,71 @@ update_selectivity_execute_cancel(struct
MainPublishingDialogContext *ctx) {
*
* @param ctx master dialog to update selectivity for
*/
-static void update_selectivity_edit(struct MainPublishingDialogContext *ctx) {
+static void
+update_selectivity_edit (struct MainPublishingDialogContext *ctx)
+{
GtkTreeIter iter;
GtkTreeIter parent;
GtkTreeIter pred;
int is_dir;
struct GNUNET_FS_FileInformation *fip;
- if (!gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &iter))
{
- gtk_widget_set_sensitive(ctx->up_button, FALSE);
- gtk_widget_set_sensitive(ctx->down_button, FALSE);
- gtk_widget_set_sensitive(ctx->left_button, FALSE);
- gtk_widget_set_sensitive(ctx->right_button, FALSE);
- gtk_widget_set_sensitive(ctx->delete_button, FALSE);
- gtk_widget_set_sensitive(ctx->edit_button, FALSE);
+ if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL,
&iter))
+ {
+ gtk_widget_set_sensitive (ctx->up_button, FALSE);
+ gtk_widget_set_sensitive (ctx->down_button, FALSE);
+ gtk_widget_set_sensitive (ctx->left_button, FALSE);
+ gtk_widget_set_sensitive (ctx->right_button, FALSE);
+ gtk_widget_set_sensitive (ctx->delete_button, FALSE);
+ gtk_widget_set_sensitive (ctx->edit_button, FALSE);
return;
}
- gtk_widget_set_sensitive(ctx->delete_button, TRUE);
- gtk_widget_set_sensitive(ctx->edit_button, TRUE);
+ gtk_widget_set_sensitive (ctx->delete_button, TRUE);
+ gtk_widget_set_sensitive (ctx->edit_button, TRUE);
/* figure out which move operations are currently legal */
- GNUNET_assert(
- gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &iter));
- if (gtk_tree_model_iter_next(ctx->file_info_treemodel, &iter))
- gtk_widget_set_sensitive(ctx->down_button, TRUE);
+ GNUNET_assert (
+ gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter));
+ if (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter))
+ gtk_widget_set_sensitive (ctx->down_button, TRUE);
+ else
+ gtk_widget_set_sensitive (ctx->down_button, FALSE);
+ GNUNET_assert (
+ gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter));
+ if (gtk_tree_model_iter_parent (ctx->file_info_treemodel, &parent, &iter))
+ {
+ gtk_widget_set_sensitive (ctx->left_button, TRUE);
+ GNUNET_assert (
+ gtk_tree_model_iter_children (ctx->file_info_treemodel, &pred, &parent));
+ }
else
- gtk_widget_set_sensitive(ctx->down_button, FALSE);
- GNUNET_assert(
- gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &iter));
- if (gtk_tree_model_iter_parent(ctx->file_info_treemodel, &parent, &iter)) {
- gtk_widget_set_sensitive(ctx->left_button, TRUE);
- GNUNET_assert(
- gtk_tree_model_iter_children(ctx->file_info_treemodel, &pred,
&parent));
- } else {
- gtk_widget_set_sensitive(ctx->left_button, FALSE);
- GNUNET_assert(
- gtk_tree_model_get_iter_first(ctx->file_info_treemodel, &pred));
+ {
+ gtk_widget_set_sensitive (ctx->left_button, FALSE);
+ GNUNET_assert (
+ gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &pred));
}
/* iterate over 'next' of pred to find out if our
* predecessor is a directory! */
is_dir = GNUNET_SYSERR;
while (GNUNET_YES !=
- gtk_tree_iter_equals(ctx->file_info_treemodel, &pred, &iter)) {
- gtk_tree_model_get(ctx->file_info_treemodel, &pred,
- PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip, -1);
- is_dir = GNUNET_FS_file_information_is_directory(fip);
- GNUNET_assert(gtk_tree_model_iter_next(ctx->file_info_treemodel, &pred));
+ gtk_tree_iter_equals (ctx->file_info_treemodel, &pred, &iter))
+ {
+ gtk_tree_model_get (ctx->file_info_treemodel,
+ &pred,
+ PUBLISH_MC_FILE_INFORMATION_STRUCT,
+ &fip,
+ -1);
+ is_dir = GNUNET_FS_file_information_is_directory (fip);
+ GNUNET_assert (gtk_tree_model_iter_next (ctx->file_info_treemodel, &pred));
}
if (GNUNET_YES == is_dir)
- gtk_widget_set_sensitive(ctx->right_button, TRUE);
+ gtk_widget_set_sensitive (ctx->right_button, TRUE);
else
- gtk_widget_set_sensitive(ctx->right_button, FALSE);
+ gtk_widget_set_sensitive (ctx->right_button, FALSE);
if (GNUNET_SYSERR != is_dir)
- gtk_widget_set_sensitive(ctx->up_button, TRUE);
+ gtk_widget_set_sensitive (ctx->up_button, TRUE);
else
- gtk_widget_set_sensitive(ctx->up_button, FALSE);
+ gtk_widget_set_sensitive (ctx->up_button, FALSE);
}
/**
@@ -535,11 +553,14 @@ static void update_selectivity_edit(struct
MainPublishingDialogContext *ctx) {
* @param ts the changed selection
* @param user_data master publishing dialog context of our window
*/
-void
GNUNET_GTK_master_publish_dialog_file_informatino_treeview_selection_changed_cb(
- GtkTreeSelection *ts, gpointer user_data) {
+void
+GNUNET_GTK_master_publish_dialog_file_informatino_treeview_selection_changed_cb
(
+ GtkTreeSelection *ts,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
- update_selectivity_edit(ctx);
+ update_selectivity_edit (ctx);
}
/**
@@ -551,39 +572,63 @@ void
GNUNET_GTK_master_publish_dialog_file_informatino_treeview_selection_change
* @param iter parent entry, or NULL for top-level addition
* @param pos iterator to set to the location of the new element
*/
-static void create_dir_at_iter(struct MainPublishingDialogContext *ctx,
- const char *name,
- const struct GNUNET_FS_BlockOptions *bo,
- GtkTreeIter *iter, GtkTreeIter *pos) {
+static void
+create_dir_at_iter (struct MainPublishingDialogContext *ctx,
+ const char *name,
+ const struct GNUNET_FS_BlockOptions *bo,
+ GtkTreeIter *iter,
+ GtkTreeIter *pos)
+{
struct GNUNET_FS_FileInformation *fi;
GtkTreeRowReference *row_reference;
GtkTreePath *path;
struct GNUNET_CONTAINER_MetaData *meta;
- meta = GNUNET_CONTAINER_meta_data_create();
- GNUNET_FS_meta_data_make_directory(meta);
- GNUNET_CONTAINER_meta_data_insert(
- meta, "<gnunet-gtk>", EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
- EXTRACTOR_METAFORMAT_UTF8, "text/plain", name, strlen(name) + 1);
- gtk_tree_store_insert_before(GTK_TREE_STORE(ctx->file_info_treemodel), pos,
- iter, NULL);
- path = gtk_tree_model_get_path(ctx->file_info_treemodel, pos);
- row_reference = gtk_tree_row_reference_new(ctx->file_info_treemodel, path);
- gtk_tree_path_free(path);
- fi = GNUNET_FS_file_information_create_empty_directory(
- GNUNET_FS_GTK_get_fs_handle(), row_reference, NULL, meta, bo, name);
- GNUNET_CONTAINER_meta_data_destroy(meta);
- gtk_tree_store_set(
- GTK_TREE_STORE(ctx->file_info_treemodel), pos, PUBLISH_MC_FILESIZE,
- MARKER_DIR_FILE_SIZE, PUBLISH_MC_DO_INDEX, (gboolean)GNUNET_NO,
- PUBLISH_MC_FILENAME, name, PUBLISH_MC_ANONYMITY_LEVEL,
- (guint)bo->anonymity_level, PUBLISH_MC_PRIORITY,
- (guint)bo->content_priority, PUBLISH_MC_FILE_INFORMATION_STRUCT, fi,
- PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE,
- (guint64)bo->expiration_time.abs_value_us, PUBLISH_MC_REPLICATION_LEVEL,
- (guint)bo->replication_level, -1);
- update_selectivity_edit(ctx);
- update_selectivity_execute_cancel(ctx);
+ meta = GNUNET_CONTAINER_meta_data_create ();
+ GNUNET_FS_meta_data_make_directory (meta);
+ GNUNET_CONTAINER_meta_data_insert (meta,
+ "<gnunet-gtk>",
+
EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain",
+ name,
+ strlen (name) + 1);
+ gtk_tree_store_insert_before (GTK_TREE_STORE (ctx->file_info_treemodel),
+ pos,
+ iter,
+ NULL);
+ path = gtk_tree_model_get_path (ctx->file_info_treemodel, pos);
+ row_reference = gtk_tree_row_reference_new (ctx->file_info_treemodel, path);
+ gtk_tree_path_free (path);
+ fi = GNUNET_FS_file_information_create_empty_directory (
+ GNUNET_FS_GTK_get_fs_handle (),
+ row_reference,
+ NULL,
+ meta,
+ bo,
+ name);
+ GNUNET_CONTAINER_meta_data_destroy (meta);
+ gtk_tree_store_set (GTK_TREE_STORE (ctx->file_info_treemodel),
+ pos,
+ PUBLISH_MC_FILESIZE,
+ MARKER_DIR_FILE_SIZE,
+ PUBLISH_MC_DO_INDEX,
+ (gboolean) GNUNET_NO,
+ PUBLISH_MC_FILENAME,
+ name,
+ PUBLISH_MC_ANONYMITY_LEVEL,
+ (guint) bo->anonymity_level,
+ PUBLISH_MC_PRIORITY,
+ (guint) bo->content_priority,
+ PUBLISH_MC_FILE_INFORMATION_STRUCT,
+ fi,
+ PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE,
+ (guint64) bo->expiration_time.abs_value_us,
+ PUBLISH_MC_REPLICATION_LEVEL,
+ (guint) bo->replication_level,
+ -1);
+ update_selectivity_edit (ctx);
+ update_selectivity_execute_cancel (ctx);
}
/**
@@ -601,9 +646,13 @@ static void create_dir_at_iter(struct
MainPublishingDialogContext *ctx,
* we ensure that the tree view is expanded to cover
* the element; the element is also then selected
*/
-static void copy_entry(struct MainPublishingDialogContext *ctx,
- GtkTreeModel *tm, GtkTreeIter *old, GtkTreeIter *newpos,
- int dsel) {
+static void
+copy_entry (struct MainPublishingDialogContext *ctx,
+ GtkTreeModel *tm,
+ GtkTreeIter *old,
+ GtkTreeIter *newpos,
+ int dsel)
+{
GtkTreePath *path;
GtkTreeIter child;
GtkTreeRowReference *rr;
@@ -619,60 +668,93 @@ static void copy_entry(struct MainPublishingDialogContext
*ctx,
guint64 expiration_time_abs;
char *fsf;
- gtk_tree_model_get(
- tm, old, PUBLISH_MC_FILESIZE, &fsf, PUBLISH_MC_DO_INDEX, &do_index,
- PUBLISH_MC_FILENAME, &short_fn, PUBLISH_MC_ANONYMITY_LEVEL,
- &anonymity_level, PUBLISH_MC_PRIORITY, &priority,
- PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip,
- PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE, &expiration_time_abs,
- PUBLISH_MC_REPLICATION_LEVEL, &replication_level, -1);
- gtk_tree_store_set(GTK_TREE_STORE(tm), newpos, PUBLISH_MC_FILESIZE, fsf,
- PUBLISH_MC_DO_INDEX, do_index, PUBLISH_MC_FILENAME,
- short_fn, PUBLISH_MC_ANONYMITY_LEVEL, anonymity_level,
- PUBLISH_MC_PRIORITY, priority,
- PUBLISH_MC_FILE_INFORMATION_STRUCT, fip,
- PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE,
expiration_time_abs,
- PUBLISH_MC_REPLICATION_LEVEL, replication_level, -1);
- g_free(short_fn);
- g_free(fsf);
+ gtk_tree_model_get (tm,
+ old,
+ PUBLISH_MC_FILESIZE,
+ &fsf,
+ PUBLISH_MC_DO_INDEX,
+ &do_index,
+ PUBLISH_MC_FILENAME,
+ &short_fn,
+ PUBLISH_MC_ANONYMITY_LEVEL,
+ &anonymity_level,
+ PUBLISH_MC_PRIORITY,
+ &priority,
+ PUBLISH_MC_FILE_INFORMATION_STRUCT,
+ &fip,
+ PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE,
+ &expiration_time_abs,
+ PUBLISH_MC_REPLICATION_LEVEL,
+ &replication_level,
+ -1);
+ gtk_tree_store_set (GTK_TREE_STORE (tm),
+ newpos,
+ PUBLISH_MC_FILESIZE,
+ fsf,
+ PUBLISH_MC_DO_INDEX,
+ do_index,
+ PUBLISH_MC_FILENAME,
+ short_fn,
+ PUBLISH_MC_ANONYMITY_LEVEL,
+ anonymity_level,
+ PUBLISH_MC_PRIORITY,
+ priority,
+ PUBLISH_MC_FILE_INFORMATION_STRUCT,
+ fip,
+ PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE,
+ expiration_time_abs,
+ PUBLISH_MC_REPLICATION_LEVEL,
+ replication_level,
+ -1);
+ g_free (short_fn);
+ g_free (fsf);
}
/* remember our destination location if needed */
- if (dsel == GNUNET_YES) {
- path = gtk_tree_model_get_path(tm, newpos);
- rr = gtk_tree_row_reference_new(tm, path);
- gtk_tree_path_free(path);
- } else {
+ if (dsel == GNUNET_YES)
+ {
+ path = gtk_tree_model_get_path (tm, newpos);
+ rr = gtk_tree_row_reference_new (tm, path);
+ gtk_tree_path_free (path);
+ }
+ else
+ {
rr = NULL;
}
/* recursively move children */
- if (gtk_tree_model_iter_children(tm, &child, old)) {
- do {
+ if (gtk_tree_model_iter_children (tm, &child, old))
+ {
+ do
+ {
GtkTreeRowReference *crr;
GtkTreeIter cnewpos;
- path = gtk_tree_model_get_path(tm, &child);
- crr = gtk_tree_row_reference_new(tm, path);
- gtk_tree_path_free(path);
- gtk_tree_store_insert_before(GTK_TREE_STORE(tm), &cnewpos, newpos, NULL);
- copy_entry(ctx, tm, &child, &cnewpos, GNUNET_NO);
- path = gtk_tree_row_reference_get_path(crr);
- gtk_tree_row_reference_free(crr);
- GNUNET_assert(gtk_tree_model_get_iter(tm, &child, path));
- gtk_tree_path_free(path);
- } while (gtk_tree_model_iter_next(tm, &child));
+ path = gtk_tree_model_get_path (tm, &child);
+ crr = gtk_tree_row_reference_new (tm, path);
+ gtk_tree_path_free (path);
+ gtk_tree_store_insert_before (GTK_TREE_STORE (tm),
+ &cnewpos,
+ newpos,
+ NULL);
+ copy_entry (ctx, tm, &child, &cnewpos, GNUNET_NO);
+ path = gtk_tree_row_reference_get_path (crr);
+ gtk_tree_row_reference_free (crr);
+ GNUNET_assert (gtk_tree_model_get_iter (tm, &child, path));
+ gtk_tree_path_free (path);
+ } while (gtk_tree_model_iter_next (tm, &child));
}
/* update selection, etc. if applicable */
- if (dsel == GNUNET_YES) {
- path = gtk_tree_row_reference_get_path(rr);
- gtk_tree_row_reference_free(rr);
- gtk_tree_view_expand_to_path(ctx->file_info_treeview, path);
- GNUNET_assert(gtk_tree_model_get_iter(tm, newpos, path));
- gtk_tree_path_free(path);
- gtk_tree_selection_select_iter(ctx->file_info_selection, newpos);
- update_selectivity_edit(ctx);
+ if (dsel == GNUNET_YES)
+ {
+ path = gtk_tree_row_reference_get_path (rr);
+ gtk_tree_row_reference_free (rr);
+ gtk_tree_view_expand_to_path (ctx->file_info_treeview, path);
+ GNUNET_assert (gtk_tree_model_get_iter (tm, newpos, path));
+ gtk_tree_path_free (path);
+ gtk_tree_selection_select_iter (ctx->file_info_selection, newpos);
+ update_selectivity_edit (ctx);
}
}
@@ -683,9 +765,12 @@ static void copy_entry(struct MainPublishingDialogContext
*ctx,
* @param togglebutton button that was toggled
* @param user_data context
*/
-void GNUNET_GTK_master_publish_dialog_global_checkbox_toggled_cb(
- GtkToggleButton *togglebutton, gpointer user_data) {
- update_selectivity_execute_cancel(user_data);
+void
+GNUNET_GTK_master_publish_dialog_global_checkbox_toggled_cb (
+ GtkToggleButton *togglebutton,
+ gpointer user_data)
+{
+ update_selectivity_execute_cancel (user_data);
}
/**
@@ -695,9 +780,12 @@ void
GNUNET_GTK_master_publish_dialog_global_checkbox_toggled_cb(
* @param togglebutton button that was toggled
* @param user_data context
*/
-void GNUNET_GTK_master_publish_dialog_own_checkbox_toggled_cb(
- GtkToggleButton *togglebutton, gpointer user_data) {
- update_selectivity_execute_cancel(user_data);
+void
+GNUNET_GTK_master_publish_dialog_own_checkbox_toggled_cb (
+ GtkToggleButton *togglebutton,
+ gpointer user_data)
+{
+ update_selectivity_execute_cancel (user_data);
}
/**
@@ -707,9 +795,12 @@ void
GNUNET_GTK_master_publish_dialog_own_checkbox_toggled_cb(
* @param togglebutton button that was toggled
* @param user_data context
*/
-void GNUNET_GTK_master_publish_dialog_updateable_checkbox_toggled_cb(
- GtkToggleButton *togglebutton, gpointer user_data) {
- update_selectivity_execute_cancel(user_data);
+void
+GNUNET_GTK_master_publish_dialog_updateable_checkbox_toggled_cb (
+ GtkToggleButton *togglebutton,
+ gpointer user_data)
+{
+ update_selectivity_execute_cancel (user_data);
}
/**
@@ -718,19 +809,22 @@ void
GNUNET_GTK_master_publish_dialog_updateable_checkbox_toggled_cb(
* @param new_text new id for which to generate update id.
* @return new update id (free with g_free()).
*/
-static gchar *generate_update_id(const gchar *new_text) {
+static gchar *
+generate_update_id (const gchar *new_text)
+{
gchar *dash;
gint64 num;
gchar *new_update_id;
gchar *copy_part;
- copy_part = g_strdup(new_text);
- dash = strrchr(copy_part, '-');
- if (!dash)
+ copy_part = g_strdup (new_text);
+ dash = strrchr (copy_part, '-');
+ if (! dash)
num = 0;
- else {
+ else
+ {
gchar *endptr;
- num = g_ascii_strtoll(&dash[1], &endptr, 10);
+ num = g_ascii_strtoll (&dash[1], &endptr, 10);
if (((0 <= num) && (endptr == &dash[1])) || (G_MAXINT64 == num) ||
('\0' != endptr[0]))
num = 0;
@@ -738,10 +832,11 @@ static gchar *generate_update_id(const gchar *new_text) {
dash[0] = '\0';
}
if ('\0' != new_text[0])
- new_update_id = g_strdup_printf("%s-%" G_GINT64_FORMAT, copy_part, num +
1);
+ new_update_id =
+ g_strdup_printf ("%s-%" G_GINT64_FORMAT, copy_part, num + 1);
else
- new_update_id = g_strdup("");
- g_free(copy_part);
+ new_update_id = g_strdup ("");
+ g_free (copy_part);
return new_update_id;
}
@@ -757,16 +852,18 @@ static gchar *generate_update_id(const gchar *new_text) {
* @return TRUE if existing_update_id was generated from previous_id,
* FALSE otherwise
*/
-static gboolean update_id_is_autofilled(const gchar *existing_update_id,
- const gchar *previous_id) {
+static gboolean
+update_id_is_autofilled (const gchar *existing_update_id,
+ const gchar *previous_id)
+{
gboolean result;
gchar *gen_update_id;
result = TRUE;
- gen_update_id = generate_update_id(previous_id);
- if (0 != strcmp(gen_update_id, existing_update_id))
+ gen_update_id = generate_update_id (previous_id);
+ if (0 != strcmp (gen_update_id, existing_update_id))
result = FALSE;
- g_free(gen_update_id);
+ g_free (gen_update_id);
return result;
}
@@ -777,24 +874,27 @@ static gboolean update_id_is_autofilled(const gchar
*existing_update_id,
* @param ctx context
* @param new_text new identifier
*/
-static void maybe_change_update_id(struct MainPublishingDialogContext *ctx,
- const gchar *new_text) {
+static void
+maybe_change_update_id (struct MainPublishingDialogContext *ctx,
+ const gchar *new_text)
+{
const gchar *existing_update_id;
gchar *new_update_id;
new_update_id = NULL;
- existing_update_id = gtk_entry_get_text(GTK_ENTRY(ctx->update_id_entry));
+ existing_update_id = gtk_entry_get_text (GTK_ENTRY (ctx->update_id_entry));
if (((NULL == ctx->previous_id) && ('\0' == existing_update_id[0])) ||
((NULL != ctx->previous_id) &&
- update_id_is_autofilled(existing_update_id, ctx->previous_id)))
- new_update_id = generate_update_id(new_text);
- if (NULL != new_update_id) {
- gtk_entry_set_text(GTK_ENTRY(ctx->update_id_entry), new_update_id);
- g_free(new_update_id);
- }
- g_free(ctx->previous_id);
- ctx->previous_id = g_strdup(new_text);
+ update_id_is_autofilled (existing_update_id, ctx->previous_id)))
+ new_update_id = generate_update_id (new_text);
+ if (NULL != new_update_id)
+ {
+ gtk_entry_set_text (GTK_ENTRY (ctx->update_id_entry), new_update_id);
+ g_free (new_update_id);
+ }
+ g_free (ctx->previous_id);
+ ctx->previous_id = g_strdup (new_text);
}
/**
@@ -805,16 +905,19 @@ static void maybe_change_update_id(struct
MainPublishingDialogContext *ctx,
* @param widget the entry that was changed
* @param user_data our `struct MainPublishingDialogContext`
*/
-void GNUNET_GTK_master_publish_dialog_identifier_entry_changed_cb(
- GtkWidget *widget, gpointer user_data) {
+void
+GNUNET_GTK_master_publish_dialog_identifier_entry_changed_cb (
+ GtkWidget *widget,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
const gchar *new_text;
- new_text = gtk_entry_get_text(GTK_ENTRY(widget));
+ new_text = gtk_entry_get_text (GTK_ENTRY (widget));
if (NULL == new_text)
return;
- maybe_change_update_id(ctx, new_text);
- update_selectivity_execute_cancel(ctx);
+ maybe_change_update_id (ctx, new_text);
+ update_selectivity_execute_cancel (ctx);
}
/**
@@ -825,27 +928,37 @@ void
GNUNET_GTK_master_publish_dialog_identifier_entry_changed_cb(
* @param ts the changed selection
* @param user_data master publishing dialog context of our window
*/
-void
GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview_selection_changed_cb(
- GtkTreeSelection *ts, gpointer user_data) {
+void
+GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview_selection_changed_cb
(
+ GtkTreeSelection *ts,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
GtkTreeIter iter;
gchar *new_text;
gchar *spath;
GtkTreePath *path;
- if (!gtk_tree_selection_get_selected(ts, NULL, &iter))
+ if (! gtk_tree_selection_get_selected (ts, NULL, &iter))
return;
- gtk_tree_model_get(ctx->identifiers_treemodel, &iter, IDENTIFIERS_MC_ID,
- &new_text, IDENTIFIERS_MC_PATH_TO_ORIGINAL, &spath, -1);
+ gtk_tree_model_get (ctx->identifiers_treemodel,
+ &iter,
+ IDENTIFIERS_MC_ID,
+ &new_text,
+ IDENTIFIERS_MC_PATH_TO_ORIGINAL,
+ &spath,
+ -1);
path = NULL;
if (spath)
- path = gtk_tree_path_new_from_string(spath);
- if (path) {
- gtk_tree_selection_select_path(ts, path);
- gtk_tree_path_free(path);
- } else if (new_text)
- gtk_entry_set_text(GTK_ENTRY(ctx->identifier_entry), new_text);
- g_free(new_text);
+ path = gtk_tree_path_new_from_string (spath);
+ if (path)
+ {
+ gtk_tree_selection_select_path (ts, path);
+ gtk_tree_path_free (path);
+ }
+ else if (new_text)
+ gtk_entry_set_text (GTK_ENTRY (ctx->identifier_entry), new_text);
+ g_free (new_text);
}
/**
@@ -855,8 +968,10 @@ void
GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview_selection_ch
* @param dummy the button
* @param user_data master publishing dialog context of our window
*/
-void GNUNET_GTK_master_publish_dialog_right_button_clicked_cb(
- GtkWidget *dummy, gpointer user_data) {
+void
+GNUNET_GTK_master_publish_dialog_right_button_clicked_cb (GtkWidget *dummy,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
GtkTreeIter iter;
GtkTreeIter parent;
@@ -864,33 +979,40 @@ void
GNUNET_GTK_master_publish_dialog_right_button_clicked_cb(
GtkTreeIter prev;
GtkTreeIter pos;
- if (!gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &iter))
{
- GNUNET_break(0);
+ if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL,
&iter))
+ {
+ GNUNET_break (0);
return;
}
- if (gtk_tree_model_iter_parent(ctx->file_info_treemodel, &parent, &iter))
- GNUNET_assert(
- gtk_tree_model_iter_children(ctx->file_info_treemodel, &pred,
&parent));
- else if (!gtk_tree_model_get_iter_first(ctx->file_info_treemodel, &pred)) {
- GNUNET_break(0);
+ if (gtk_tree_model_iter_parent (ctx->file_info_treemodel, &parent, &iter))
+ GNUNET_assert (
+ gtk_tree_model_iter_children (ctx->file_info_treemodel, &pred, &parent));
+ else if (! gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &pred))
+ {
+ GNUNET_break (0);
return;
}
/* iterate over 'next' of pred to find out who our predecessor is! */
- memset(&prev, 0, sizeof(GtkTreeIter));
+ memset (&prev, 0, sizeof (GtkTreeIter));
while (GNUNET_YES !=
- gtk_tree_iter_equals(ctx->file_info_treemodel, &pred, &iter)) {
+ gtk_tree_iter_equals (ctx->file_info_treemodel, &pred, &iter))
+ {
prev = pred;
- GNUNET_assert(gtk_tree_model_iter_next(ctx->file_info_treemodel, &pred));
+ GNUNET_assert (gtk_tree_model_iter_next (ctx->file_info_treemodel, &pred));
}
- gtk_tree_store_insert_before(GTK_TREE_STORE(ctx->file_info_treemodel), &pos,
- &prev, NULL);
- if (!gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &iter))
{
- GNUNET_break(0);
+ gtk_tree_store_insert_before (GTK_TREE_STORE (ctx->file_info_treemodel),
+ &pos,
+ &prev,
+ NULL);
+ if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL,
&iter))
+ {
+ GNUNET_break (0);
return;
}
- copy_entry(ctx, ctx->file_info_treemodel, &iter, &pos, GNUNET_YES);
- GNUNET_FS_GTK_remove_treestore_subtree(
- GTK_TREE_STORE(ctx->file_info_treemodel), &iter);
+ copy_entry (ctx, ctx->file_info_treemodel, &iter, &pos, GNUNET_YES);
+ GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (
+ ctx->file_info_treemodel),
+ &iter);
}
/**
@@ -900,30 +1022,38 @@ void
GNUNET_GTK_master_publish_dialog_right_button_clicked_cb(
* @param dummy the button
* @param user_data master publishing dialog context of our window
*/
-void GNUNET_GTK_master_publish_dialog_left_button_clicked_cb(
- GtkWidget *dummy, gpointer user_data) {
+void
+GNUNET_GTK_master_publish_dialog_left_button_clicked_cb (GtkWidget *dummy,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
GtkTreeIter iter;
GtkTreeIter parent;
GtkTreeIter pos;
- if (!gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &iter))
{
- GNUNET_break(0);
+ if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL,
&iter))
+ {
+ GNUNET_break (0);
return;
}
- if (!gtk_tree_model_iter_parent(ctx->file_info_treemodel, &parent, &iter)) {
- GNUNET_break(0);
+ if (! gtk_tree_model_iter_parent (ctx->file_info_treemodel, &parent, &iter))
+ {
+ GNUNET_break (0);
return;
}
- gtk_tree_store_insert_after(GTK_TREE_STORE(ctx->file_info_treemodel), &pos,
- NULL, &parent);
- if (!gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &iter))
{
- GNUNET_break(0);
+ gtk_tree_store_insert_after (GTK_TREE_STORE (ctx->file_info_treemodel),
+ &pos,
+ NULL,
+ &parent);
+ if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL,
&iter))
+ {
+ GNUNET_break (0);
return;
}
- copy_entry(ctx, ctx->file_info_treemodel, &iter, &pos, GNUNET_YES);
- GNUNET_FS_GTK_remove_treestore_subtree(
- GTK_TREE_STORE(ctx->file_info_treemodel), &iter);
+ copy_entry (ctx, ctx->file_info_treemodel, &iter, &pos, GNUNET_YES);
+ GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (
+ ctx->file_info_treemodel),
+ &iter);
}
/**
@@ -933,8 +1063,10 @@ void
GNUNET_GTK_master_publish_dialog_left_button_clicked_cb(
* @param dummy the button
* @param user_data master publishing dialog context of our window
*/
-void GNUNET_GTK_master_publish_dialog_up_button_clicked_cb(GtkWidget *dummy,
- gpointer user_data)
{
+void
+GNUNET_GTK_master_publish_dialog_up_button_clicked_cb (GtkWidget *dummy,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
GtkTreeIter iter;
GtkTreeIter parent;
@@ -943,35 +1075,45 @@ void
GNUNET_GTK_master_publish_dialog_up_button_clicked_cb(GtkWidget *dummy,
GtkTreeIter *pprev;
GtkTreeIter pos;
- if (!gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &iter))
{
- GNUNET_break(0);
+ if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL,
&iter))
+ {
+ GNUNET_break (0);
return;
}
- if (gtk_tree_model_iter_parent(ctx->file_info_treemodel, &parent, &iter)) {
- GNUNET_assert(TRUE ==
gtk_tree_model_iter_children(ctx->file_info_treemodel,
- &pred, &parent));
+ if (gtk_tree_model_iter_parent (ctx->file_info_treemodel, &parent, &iter))
+ {
+ GNUNET_assert (
+ TRUE ==
+ gtk_tree_model_iter_children (ctx->file_info_treemodel, &pred, &parent));
pprev = &parent;
- } else if (!gtk_tree_model_get_iter_first(ctx->file_info_treemodel, &pred)) {
- GNUNET_break(0);
+ }
+ else if (! gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &pred))
+ {
+ GNUNET_break (0);
return;
}
pprev = NULL;
/* iterate over 'next' of pred to find out who our predecessor is! */
while (GNUNET_YES !=
- gtk_tree_iter_equals(ctx->file_info_treemodel, &pred, &iter)) {
+ gtk_tree_iter_equals (ctx->file_info_treemodel, &pred, &iter))
+ {
prev = pred;
pprev = &prev;
- GNUNET_assert(gtk_tree_model_iter_next(ctx->file_info_treemodel, &pred));
+ GNUNET_assert (gtk_tree_model_iter_next (ctx->file_info_treemodel, &pred));
}
- gtk_tree_store_insert_before(GTK_TREE_STORE(ctx->file_info_treemodel), &pos,
- NULL, pprev);
- if (!gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &iter))
{
- GNUNET_break(0);
+ gtk_tree_store_insert_before (GTK_TREE_STORE (ctx->file_info_treemodel),
+ &pos,
+ NULL,
+ pprev);
+ if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL,
&iter))
+ {
+ GNUNET_break (0);
return;
}
- copy_entry(ctx, ctx->file_info_treemodel, &iter, &pos, GNUNET_YES);
- GNUNET_FS_GTK_remove_treestore_subtree(
- GTK_TREE_STORE(ctx->file_info_treemodel), &iter);
+ copy_entry (ctx, ctx->file_info_treemodel, &iter, &pos, GNUNET_YES);
+ GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (
+ ctx->file_info_treemodel),
+ &iter);
}
/**
@@ -981,31 +1123,39 @@ void
GNUNET_GTK_master_publish_dialog_up_button_clicked_cb(GtkWidget *dummy,
* @param dummy the button
* @param user_data master publishing dialog context of our window
*/
-void GNUNET_GTK_master_publish_dialog_down_button_clicked_cb(
- GtkWidget *dummy, gpointer user_data) {
+void
+GNUNET_GTK_master_publish_dialog_down_button_clicked_cb (GtkWidget *dummy,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
GtkTreeIter iter;
GtkTreeIter next;
GtkTreeIter pos;
- if (!gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &iter))
{
- GNUNET_break(0);
+ if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL,
&iter))
+ {
+ GNUNET_break (0);
return;
}
- if (!gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &next))
{
- GNUNET_break(0);
+ if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL,
&next))
+ {
+ GNUNET_break (0);
return;
}
- GNUNET_assert(gtk_tree_model_iter_next(ctx->file_info_treemodel, &next));
- gtk_tree_store_insert_after(GTK_TREE_STORE(ctx->file_info_treemodel), &pos,
- NULL, &next);
- if (!gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &iter))
{
- GNUNET_break(0);
+ GNUNET_assert (gtk_tree_model_iter_next (ctx->file_info_treemodel, &next));
+ gtk_tree_store_insert_after (GTK_TREE_STORE (ctx->file_info_treemodel),
+ &pos,
+ NULL,
+ &next);
+ if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL,
&iter))
+ {
+ GNUNET_break (0);
return;
}
- copy_entry(ctx, ctx->file_info_treemodel, &iter, &pos, GNUNET_YES);
- GNUNET_FS_GTK_remove_treestore_subtree(
- GTK_TREE_STORE(ctx->file_info_treemodel), &iter);
+ copy_entry (ctx, ctx->file_info_treemodel, &iter, &pos, GNUNET_YES);
+ GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (
+ ctx->file_info_treemodel),
+ &iter);
}
/**
@@ -1015,8 +1165,10 @@ void
GNUNET_GTK_master_publish_dialog_down_button_clicked_cb(
* @param dummy the button
* @param user_data master publishing dialog context of our window
*/
-void GNUNET_GTK_master_publish_dialog_new_button_clicked_cb(
- GtkWidget *dummy, gpointer user_data) {
+void
+GNUNET_GTK_master_publish_dialog_new_button_clicked_cb (GtkWidget *dummy,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
GtkTreeIter iter;
GtkTreeIter pos;
@@ -1028,12 +1180,13 @@ void
GNUNET_GTK_master_publish_dialog_new_button_clicked_cb(
the configuration. */
bo.anonymity_level = 1;
bo.content_priority = 1000;
- bo.expiration_time =
GNUNET_TIME_relative_to_absolute(GNUNET_TIME_UNIT_YEARS);
+ bo.expiration_time =
+ GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_YEARS);
bo.replication_level = 1;
- if (!gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &iter))
- create_dir_at_iter(ctx, "unnamed/", &bo, NULL, &pos);
+ if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL,
&iter))
+ create_dir_at_iter (ctx, "unnamed/", &bo, NULL, &pos);
else
- create_dir_at_iter(ctx, "unnamed/", &bo, &iter, &pos);
+ create_dir_at_iter (ctx, "unnamed/", &bo, &iter, &pos);
}
/**
@@ -1050,17 +1203,24 @@ void
GNUNET_GTK_master_publish_dialog_new_button_clicked_cb(
* @param client_info pointer to the GtkTreeRowReference, freed
* @return GNUNET_OK to traverse entire subtree
*/
-static int free_fi_row_reference(
- void *cls, struct GNUNET_FS_FileInformation *fi, uint64_t length,
- struct GNUNET_CONTAINER_MetaData *meta, struct GNUNET_FS_Uri **uri,
- struct GNUNET_FS_BlockOptions *bo, int *do_index, void **client_info) {
+static int
+free_fi_row_reference (void *cls,
+ struct GNUNET_FS_FileInformation *fi,
+ uint64_t length,
+ struct GNUNET_CONTAINER_MetaData *meta,
+ struct GNUNET_FS_Uri **uri,
+ struct GNUNET_FS_BlockOptions *bo,
+ int *do_index,
+ void **client_info)
+{
GtkTreeRowReference *row = *client_info;
- if (NULL == row) {
- GNUNET_break(0);
+ if (NULL == row)
+ {
+ GNUNET_break (0);
return GNUNET_OK;
}
- gtk_tree_row_reference_free(row);
+ gtk_tree_row_reference_free (row);
*client_info = NULL;
return GNUNET_OK;
}
@@ -1072,8 +1232,10 @@ static int free_fi_row_reference(
* @param dummy the button
* @param user_data master publishing dialog context of our window
*/
-void GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb(
- GtkWidget *dummy, gpointer user_data) {
+void
+GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb (GtkWidget *dummy,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
GtkTreeIter iter;
struct GNUNET_FS_FileInformation *fip;
@@ -1081,51 +1243,63 @@ void
GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb(
GtkTreePath *path;
/* initially, both 'iter' and 'next' point to the selected row */
- if (!gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &iter))
{
- GNUNET_break(0);
+ if (! gtk_tree_selection_get_selected (ctx->file_info_selection, NULL,
&iter))
+ {
+ GNUNET_break (0);
return;
}
- path = gtk_tree_model_get_path(ctx->file_info_treemodel, &iter);
- if (gtk_tree_model_iter_next(ctx->file_info_treemodel, &iter))
- gtk_tree_path_next(path);
- else {
- if (!gtk_tree_path_prev(path)) {
- if ((1 == gtk_tree_path_get_depth(path)) || (!gtk_tree_path_up(path))) {
- gtk_tree_path_free(path);
+ path = gtk_tree_model_get_path (ctx->file_info_treemodel, &iter);
+ if (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter))
+ gtk_tree_path_next (path);
+ else
+ {
+ if (! gtk_tree_path_prev (path))
+ {
+ if ((1 == gtk_tree_path_get_depth (path)) || (! gtk_tree_path_up (path)))
+ {
+ gtk_tree_path_free (path);
path = NULL;
}
}
}
- if (NULL == path) {
+ if (NULL == path)
+ {
rr = NULL;
- } else {
- rr = gtk_tree_row_reference_new(ctx->file_info_treemodel, path);
- gtk_tree_path_free(path);
+ }
+ else
+ {
+ rr = gtk_tree_row_reference_new (ctx->file_info_treemodel, path);
+ gtk_tree_path_free (path);
}
/* 'iter' might have again been clobbered, get it one more time... */
- GNUNET_assert(
- gtk_tree_selection_get_selected(ctx->file_info_selection, NULL, &iter));
+ GNUNET_assert (
+ gtk_tree_selection_get_selected (ctx->file_info_selection, NULL, &iter));
/* now delete the subtree */
- gtk_tree_model_get(ctx->file_info_treemodel, &iter,
- PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip, -1);
- GNUNET_FS_file_information_destroy(fip, &free_fi_row_reference, NULL);
- GNUNET_FS_GTK_remove_treestore_subtree(
- GTK_TREE_STORE(ctx->file_info_treemodel), &iter);
+ gtk_tree_model_get (ctx->file_info_treemodel,
+ &iter,
+ PUBLISH_MC_FILE_INFORMATION_STRUCT,
+ &fip,
+ -1);
+ GNUNET_FS_file_information_destroy (fip, &free_fi_row_reference, NULL);
+ GNUNET_FS_GTK_remove_treestore_subtree (GTK_TREE_STORE (
+ ctx->file_info_treemodel),
+ &iter);
/* finally, select the item from 'rr' (if any) */
- if (NULL != rr) {
- path = gtk_tree_row_reference_get_path(rr);
- gtk_tree_row_reference_free(rr);
- gtk_tree_selection_select_path(ctx->file_info_selection, path);
- gtk_tree_path_free(path);
+ if (NULL != rr)
+ {
+ path = gtk_tree_row_reference_get_path (rr);
+ gtk_tree_row_reference_free (rr);
+ gtk_tree_selection_select_path (ctx->file_info_selection, path);
+ gtk_tree_path_free (path);
}
/* and now, depending on the selection, update the sensitivity of buttons */
- update_selectivity_execute_cancel(ctx);
- update_selectivity_edit(ctx);
+ update_selectivity_execute_cancel (ctx);
+ update_selectivity_edit (ctx);
}
/* ******************** progress dialog / import of directories *************
*/
@@ -1136,19 +1310,23 @@ void
GNUNET_GTK_master_publish_dialog_delete_button_clicked_cb(
*
* @param adcc context for the progress dialog to close
*/
-static void destroy_progress_dialog(struct AddDirClientContext *adcc) {
- GNUNET_assert(NULL == adcc->ds);
- if (NULL != adcc->kill_task) {
- GNUNET_SCHEDULER_cancel(adcc->kill_task);
+static void
+destroy_progress_dialog (struct AddDirClientContext *adcc)
+{
+ GNUNET_assert (NULL == adcc->ds);
+ if (NULL != adcc->kill_task)
+ {
+ GNUNET_SCHEDULER_cancel (adcc->kill_task);
adcc->kill_task = NULL;
}
- gtk_widget_destroy(adcc->progress_dialog);
- g_object_unref(G_OBJECT(adcc->progress_dialog_builder));
- GNUNET_CONTAINER_DLL_remove(adcc->ctx->adddir_head, adcc->ctx->adddir_tail,
- adcc);
- update_selectivity_execute_cancel(adcc->ctx);
- update_selectivity_edit(adcc->ctx);
- GNUNET_free(adcc);
+ gtk_widget_destroy (adcc->progress_dialog);
+ g_object_unref (G_OBJECT (adcc->progress_dialog_builder));
+ GNUNET_CONTAINER_DLL_remove (adcc->ctx->adddir_head,
+ adcc->ctx->adddir_tail,
+ adcc);
+ update_selectivity_execute_cancel (adcc->ctx);
+ update_selectivity_edit (adcc->ctx);
+ GNUNET_free (adcc);
}
/**
@@ -1158,16 +1336,19 @@ static void destroy_progress_dialog(struct
AddDirClientContext *adcc) {
* @param button the cancel button
* @param user_data progress dialog context of our window
*/
-void GNUNET_FS_GTK_progress_dialog_cancel_button_clicked_cb(
- GtkButton *button, gpointer user_data) {
+void
+GNUNET_FS_GTK_progress_dialog_cancel_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
struct AddDirClientContext *adcc = user_data;
- if (NULL != adcc->ds) {
+ if (NULL != adcc->ds)
+ {
/* signal the scanner to finish */
- GNUNET_FS_directory_scan_abort(adcc->ds);
+ GNUNET_FS_directory_scan_abort (adcc->ds);
adcc->ds = NULL;
}
- destroy_progress_dialog(adcc);
+ destroy_progress_dialog (adcc);
}
/**
@@ -1178,9 +1359,11 @@ void
GNUNET_FS_GTK_progress_dialog_cancel_button_clicked_cb(
* @param cls progress dialog context of our window
* @return TRUE to refuse to close
*/
-gboolean GNUNET_FS_GTK_progress_dialog_delete_event_cb(GtkWidget *widget,
- GdkEvent *event,
- void *cls) {
+gboolean
+GNUNET_FS_GTK_progress_dialog_delete_event_cb (GtkWidget *widget,
+ GdkEvent *event,
+ void *cls)
+{
/* Don't allow GTK to kill the window, until the scan is finished */
return TRUE;
}
@@ -1192,13 +1375,14 @@ gboolean
GNUNET_FS_GTK_progress_dialog_delete_event_cb(GtkWidget *widget,
* @param adcc progress dialog context of our window
* @param text text to add
*/
-static void insert_progress_dialog_text(struct AddDirClientContext *adcc,
- const char *text) {
- gtk_text_buffer_insert_at_cursor(adcc->progress_dialog_textbuffer, text, -1);
- gtk_text_view_place_cursor_onscreen(adcc->progress_dialog_textview);
- gtk_adjustment_set_value(
- adcc->textview_vertical_adjustment,
- gtk_adjustment_get_upper(adcc->textview_vertical_adjustment));
+static void
+insert_progress_dialog_text (struct AddDirClientContext *adcc, const char
*text)
+{
+ gtk_text_buffer_insert_at_cursor (adcc->progress_dialog_textbuffer, text,
-1);
+ gtk_text_view_place_cursor_onscreen (adcc->progress_dialog_textview);
+ gtk_adjustment_set_value (adcc->textview_vertical_adjustment,
+ gtk_adjustment_get_upper (
+ adcc->textview_vertical_adjustment));
}
/**
@@ -1211,9 +1395,14 @@ static void insert_progress_dialog_text(struct
AddDirClientContext *adcc,
* @param sibling predecessor of the item, can be NULL (for first)
* @param item_iter entry to set to the added item (OUT)
*/
-static void add_item(struct AddDirClientContext *adcc, GtkTreeStore *ts,
- struct GNUNET_FS_ShareTreeItem *item, GtkTreeIter *parent,
- GtkTreeIter *sibling, GtkTreeIter *item_iter) {
+static void
+add_item (struct AddDirClientContext *adcc,
+ GtkTreeStore *ts,
+ struct GNUNET_FS_ShareTreeItem *item,
+ GtkTreeIter *parent,
+ GtkTreeIter *sibling,
+ GtkTreeIter *item_iter)
+{
char *file_size_fancy;
struct GNUNET_FS_FileInformation *fi;
GtkTreeRowReference *row_reference;
@@ -1221,51 +1410,75 @@ static void add_item(struct AddDirClientContext *adcc,
GtkTreeStore *ts,
struct stat sbuf;
uint64_t fsize;
- if (0 != STAT(item->filename, &sbuf)) {
- GNUNET_log_strerror_file(GNUNET_ERROR_TYPE_ERROR, "stat", item->filename);
+ if (0 != STAT (item->filename, &sbuf))
+ {
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "stat", item->filename);
return;
}
if ((item->is_directory != GNUNET_YES) &&
(GNUNET_OK !=
- GNUNET_DISK_file_size(item->filename, &fsize, GNUNET_YES, GNUNET_YES)))
+ GNUNET_DISK_file_size (item->filename, &fsize, GNUNET_YES, GNUNET_YES)))
return;
- gtk_tree_store_insert_after(ts, item_iter, parent, sibling);
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(ts), item_iter);
- row_reference = gtk_tree_row_reference_new(GTK_TREE_MODEL(ts), path);
- gtk_tree_path_free(path);
- if (item->is_directory == GNUNET_YES) {
+ gtk_tree_store_insert_after (ts, item_iter, parent, sibling);
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), item_iter);
+ row_reference = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), path);
+ gtk_tree_path_free (path);
+ if (item->is_directory == GNUNET_YES)
+ {
/* update meta data mime type (force to be GNUnet-directory) */
if (NULL != item->meta)
- GNUNET_CONTAINER_meta_data_delete(item->meta,
EXTRACTOR_METATYPE_MIMETYPE,
- NULL, 0);
+ GNUNET_CONTAINER_meta_data_delete (item->meta,
+ EXTRACTOR_METATYPE_MIMETYPE,
+ NULL,
+ 0);
else
- item->meta = GNUNET_CONTAINER_meta_data_create();
- GNUNET_FS_meta_data_make_directory(item->meta);
-
- fi = GNUNET_FS_file_information_create_empty_directory(
- GNUNET_FS_GTK_get_fs_handle(), row_reference, item->ksk_uri,
item->meta,
- &adcc->directory_scan_bo, item->filename);
- file_size_fancy = GNUNET_strdup(MARKER_DIR_FILE_SIZE);
- } else {
- fi = GNUNET_FS_file_information_create_from_file(
- GNUNET_FS_GTK_get_fs_handle(), row_reference, item->filename,
- item->ksk_uri, item->meta, adcc->directory_scan_do_index,
- &adcc->directory_scan_bo);
- file_size_fancy = GNUNET_STRINGS_byte_size_fancy(fsize);
- }
- gtk_tree_store_set(
- ts, item_iter, PUBLISH_MC_FILESIZE, file_size_fancy, PUBLISH_MC_DO_INDEX,
- (gboolean)adcc->directory_scan_do_index, PUBLISH_MC_FILENAME,
- item->short_filename, PUBLISH_MC_ANONYMITY_LEVEL,
- (guint)adcc->directory_scan_bo.anonymity_level, PUBLISH_MC_PRIORITY,
- (guint)adcc->directory_scan_bo.content_priority,
- PUBLISH_MC_FILE_INFORMATION_STRUCT, fi,
- PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE,
- (guint64)adcc->directory_scan_bo.expiration_time.abs_value_us,
- PUBLISH_MC_REPLICATION_LEVEL,
- (guint)adcc->directory_scan_bo.replication_level, -1);
- GNUNET_free(file_size_fancy);
+ item->meta = GNUNET_CONTAINER_meta_data_create ();
+ GNUNET_FS_meta_data_make_directory (item->meta);
+
+ fi = GNUNET_FS_file_information_create_empty_directory (
+ GNUNET_FS_GTK_get_fs_handle (),
+ row_reference,
+ item->ksk_uri,
+ item->meta,
+ &adcc->directory_scan_bo,
+ item->filename);
+ file_size_fancy = GNUNET_strdup (MARKER_DIR_FILE_SIZE);
+ }
+ else
+ {
+ fi =
+ GNUNET_FS_file_information_create_from_file (GNUNET_FS_GTK_get_fs_handle
(),
+ row_reference,
+ item->filename,
+ item->ksk_uri,
+ item->meta,
+ adcc
+ ->directory_scan_do_index,
+ &adcc->directory_scan_bo);
+ file_size_fancy = GNUNET_STRINGS_byte_size_fancy (fsize);
+ }
+ gtk_tree_store_set (ts,
+ item_iter,
+ PUBLISH_MC_FILESIZE,
+ file_size_fancy,
+ PUBLISH_MC_DO_INDEX,
+ (gboolean) adcc->directory_scan_do_index,
+ PUBLISH_MC_FILENAME,
+ item->short_filename,
+ PUBLISH_MC_ANONYMITY_LEVEL,
+ (guint) adcc->directory_scan_bo.anonymity_level,
+ PUBLISH_MC_PRIORITY,
+ (guint) adcc->directory_scan_bo.content_priority,
+ PUBLISH_MC_FILE_INFORMATION_STRUCT,
+ fi,
+ PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE,
+ (guint64)
+ adcc->directory_scan_bo.expiration_time.abs_value_us,
+ PUBLISH_MC_REPLICATION_LEVEL,
+ (guint) adcc->directory_scan_bo.replication_level,
+ -1);
+ GNUNET_free (file_size_fancy);
}
/**
@@ -1276,21 +1489,23 @@ static void add_item(struct AddDirClientContext *adcc,
GtkTreeStore *ts,
* @param parent_iter parent of the current entry to add
*/
static void
-add_share_items_to_treestore(struct AddDirClientContext *adcc,
- struct GNUNET_FS_ShareTreeItem *toplevel,
- GtkTreeIter *parent_iter) {
+add_share_items_to_treestore (struct AddDirClientContext *adcc,
+ struct GNUNET_FS_ShareTreeItem *toplevel,
+ GtkTreeIter *parent_iter)
+{
struct MainPublishingDialogContext *ctx = adcc->ctx;
- GtkTreeStore *ts = GTK_TREE_STORE(ctx->file_info_treemodel);
+ GtkTreeStore *ts = GTK_TREE_STORE (ctx->file_info_treemodel);
GtkTreeIter *sibling_iter;
GtkTreeIter last_added;
struct GNUNET_FS_ShareTreeItem *item;
sibling_iter = NULL;
- for (item = toplevel; NULL != item; item = item->next) {
- add_item(adcc, ts, item, parent_iter, sibling_iter, &last_added);
+ for (item = toplevel; NULL != item; item = item->next)
+ {
+ add_item (adcc, ts, item, parent_iter, sibling_iter, &last_added);
sibling_iter = &last_added;
if (item->is_directory == GNUNET_YES)
- add_share_items_to_treestore(adcc, item->children_head, sibling_iter);
+ add_share_items_to_treestore (adcc, item->children_head, sibling_iter);
}
}
@@ -1301,12 +1516,15 @@ add_share_items_to_treestore(struct AddDirClientContext
*adcc,
*
* @param cls progress dialog context of our window
*/
-static void stop_scanner_task(void *cls) {
+static void
+stop_scanner_task (void *cls)
+{
struct AddDirClientContext *adcc = cls;
adcc->kill_task = NULL;
- if (NULL != adcc->ds) {
- GNUNET_FS_directory_scan_abort(adcc->ds);
+ if (NULL != adcc->ds)
+ {
+ GNUNET_FS_directory_scan_abort (adcc->ds);
adcc->ds = NULL;
}
}
@@ -1322,26 +1540,33 @@ static void stop_scanner_task(void *cls) {
* @param reason kind of progress that was made
*/
static void
-directory_scan_cb(void *cls, const char *filename, int is_directory,
- enum GNUNET_FS_DirScannerProgressUpdateReason reason) {
+directory_scan_cb (void *cls,
+ const char *filename,
+ int is_directory,
+ enum GNUNET_FS_DirScannerProgressUpdateReason reason)
+{
struct AddDirClientContext *adcc = cls;
static struct GNUNET_TIME_Absolute last_pulse;
char *s;
gdouble fraction;
- switch (reason) {
+ switch (reason)
+ {
case GNUNET_FS_DIRSCANNER_FILE_START:
- GNUNET_assert(NULL != filename);
- if (GNUNET_TIME_absolute_get_duration(last_pulse).rel_value_us > 100000LL)
{
- gtk_progress_bar_pulse(adcc->progress_dialog_bar);
- last_pulse = GNUNET_TIME_absolute_get();
+ GNUNET_assert (NULL != filename);
+ if (GNUNET_TIME_absolute_get_duration (last_pulse).rel_value_us > 100000LL)
+ {
+ gtk_progress_bar_pulse (adcc->progress_dialog_bar);
+ last_pulse = GNUNET_TIME_absolute_get ();
}
#if VERBOSE_PROGRESS
- if (is_directory == GNUNET_YES) {
- GNUNET_asprintf(&s, _("Scanning directory `%s'.\n"), filename);
- insert_progress_dialog_text(adcc, s);
- GNUNET_free(s);
- } else
+ if (is_directory == GNUNET_YES)
+ {
+ GNUNET_asprintf (&s, _ ("Scanning directory `%s'.\n"), filename);
+ insert_progress_dialog_text (adcc, s);
+ GNUNET_free (s);
+ }
+ else
adcc->total++;
#else
if (is_directory != GNUNET_YES)
@@ -1349,60 +1574,70 @@ directory_scan_cb(void *cls, const char *filename, int
is_directory,
#endif
break;
case GNUNET_FS_DIRSCANNER_FILE_IGNORED:
- GNUNET_assert(NULL != filename);
- GNUNET_asprintf(&s, _("Failed to scan `%s' (access error). Skipping.\n"),
- filename);
-#if !VERBOSE_PROGRESS
- gtk_widget_show(GTK_WIDGET(gtk_builder_get_object(
- adcc->progress_dialog_builder,
- "GNUNET_FS_GTK_progress_dialog_scrolled_window")));
+ GNUNET_assert (NULL != filename);
+ GNUNET_asprintf (&s,
+ _ ("Failed to scan `%s' (access error). Skipping.\n"),
+ filename);
+#if ! VERBOSE_PROGRESS
+ gtk_widget_show (GTK_WIDGET (
+ gtk_builder_get_object (adcc->progress_dialog_builder,
+
"GNUNET_FS_GTK_progress_dialog_scrolled_window")));
#endif
- insert_progress_dialog_text(adcc, s);
- GNUNET_free(s);
+ insert_progress_dialog_text (adcc, s);
+ GNUNET_free (s);
break;
case GNUNET_FS_DIRSCANNER_ALL_COUNTED:
fraction = (adcc->total == 0) ? 1.0 : (1.0 * adcc->done) / adcc->total;
- GNUNET_asprintf(&s, "%u/%u (%3f%%)", adcc->done, adcc->total,
- 100.0 * fraction);
- gtk_progress_bar_set_text(adcc->progress_dialog_bar, s);
- GNUNET_free(s);
- gtk_progress_bar_set_fraction(adcc->progress_dialog_bar, fraction);
+ GNUNET_asprintf (&s,
+ "%u/%u (%3f%%)",
+ adcc->done,
+ adcc->total,
+ 100.0 * fraction);
+ gtk_progress_bar_set_text (adcc->progress_dialog_bar, s);
+ GNUNET_free (s);
+ gtk_progress_bar_set_fraction (adcc->progress_dialog_bar, fraction);
break;
case GNUNET_FS_DIRSCANNER_EXTRACT_FINISHED:
- GNUNET_assert(NULL != filename);
+ GNUNET_assert (NULL != filename);
#if VERBOSE_PROGRESS
- GNUNET_asprintf(&s, _("Processed file `%s'.\n"), filename);
- insert_progress_dialog_text(adcc, s);
- GNUNET_free(s);
+ GNUNET_asprintf (&s, _ ("Processed file `%s'.\n"), filename);
+ insert_progress_dialog_text (adcc, s);
+ GNUNET_free (s);
#endif
adcc->done++;
- GNUNET_assert(adcc->done <= adcc->total);
+ GNUNET_assert (adcc->done <= adcc->total);
fraction = (adcc->total == 0) ? 1.0 : (1.0 * adcc->done) / adcc->total;
- GNUNET_asprintf(&s, "%u/%u (%3f%%)", adcc->done, adcc->total,
- 100.0 * fraction);
- gtk_progress_bar_set_text(adcc->progress_dialog_bar, s);
- GNUNET_free(s);
- gtk_progress_bar_set_fraction(adcc->progress_dialog_bar, fraction);
+ GNUNET_asprintf (&s,
+ "%u/%u (%3f%%)",
+ adcc->done,
+ adcc->total,
+ 100.0 * fraction);
+ gtk_progress_bar_set_text (adcc->progress_dialog_bar, s);
+ GNUNET_free (s);
+ gtk_progress_bar_set_fraction (adcc->progress_dialog_bar, fraction);
break;
case GNUNET_FS_DIRSCANNER_INTERNAL_ERROR:
- if ((NULL != adcc->ds) && (NULL == adcc->kill_task)) {
- insert_progress_dialog_text(adcc, _("Operation failed (press
cancel)\n"));
- adcc->kill_task = GNUNET_SCHEDULER_add_now(&stop_scanner_task, adcc);
+ if ((NULL != adcc->ds) && (NULL == adcc->kill_task))
+ {
+ insert_progress_dialog_text (adcc,
+ _ ("Operation failed (press cancel)\n"));
+ adcc->kill_task = GNUNET_SCHEDULER_add_now (&stop_scanner_task, adcc);
}
break;
case GNUNET_FS_DIRSCANNER_FINISHED: {
struct GNUNET_FS_ShareTreeItem *directory_scan_result;
- insert_progress_dialog_text(adcc, _("Scanner has finished.\n"));
- directory_scan_result = GNUNET_FS_directory_scan_get_result(adcc->ds);
+ insert_progress_dialog_text (adcc, _ ("Scanner has finished.\n"));
+ directory_scan_result = GNUNET_FS_directory_scan_get_result (adcc->ds);
adcc->ds = NULL;
- GNUNET_FS_share_tree_trim(directory_scan_result);
- add_share_items_to_treestore(adcc, directory_scan_result, NULL);
- GNUNET_FS_share_tree_free(directory_scan_result);
- destroy_progress_dialog(adcc);
- } break;
+ GNUNET_FS_share_tree_trim (directory_scan_result);
+ add_share_items_to_treestore (adcc, directory_scan_result, NULL);
+ GNUNET_FS_share_tree_free (directory_scan_result);
+ destroy_progress_dialog (adcc);
+ }
+ break;
default:
- GNUNET_break(0);
+ GNUNET_break (0);
break;
}
}
@@ -1417,47 +1652,54 @@ directory_scan_cb(void *cls, const char *filename, int
is_directory,
* @param bo options for the operation
* @param do_index should we index or insert files (by default)
*/
-static void scan_file_or_directory(struct MainPublishingDialogContext *ctx,
- gchar *filename,
- struct GNUNET_FS_BlockOptions *bo,
- int do_index) {
+static void
+scan_file_or_directory (struct MainPublishingDialogContext *ctx,
+ gchar *filename,
+ struct GNUNET_FS_BlockOptions *bo,
+ int do_index)
+{
struct AddDirClientContext *adcc;
- adcc = GNUNET_new(struct AddDirClientContext);
+ adcc = GNUNET_new (struct AddDirClientContext);
adcc->ctx = ctx;
- GNUNET_CONTAINER_DLL_insert_tail(ctx->adddir_head, ctx->adddir_tail, adcc);
+ GNUNET_CONTAINER_DLL_insert_tail (ctx->adddir_head, ctx->adddir_tail, adcc);
adcc->directory_scan_bo = *bo;
adcc->directory_scan_do_index = do_index;
/* setup the dialog and get the widgets we need most */
adcc->progress_dialog_builder =
- GNUNET_GTK_get_new_builder("gnunet_fs_gtk_progress_dialog.glade", adcc);
- adcc->progress_dialog = GTK_WIDGET(gtk_builder_get_object(
- adcc->progress_dialog_builder, "GNUNET_FS_GTK_progress_dialog"));
- adcc->progress_dialog_bar = GTK_PROGRESS_BAR(
- gtk_builder_get_object(adcc->progress_dialog_builder,
- "GNUNET_FS_GTK_progress_dialog_progressbar"));
- adcc->progress_dialog_textview = GTK_TEXT_VIEW(gtk_builder_get_object(
- adcc->progress_dialog_builder,
"GNUNET_FS_GTK_progress_dialog_textview"));
- adcc->textview_vertical_adjustment = GTK_ADJUSTMENT(gtk_builder_get_object(
- adcc->progress_dialog_builder,
- "GNUNET_FS_GTK_progress_dialog_textview_vertical_adjustment"));
- adcc->progress_dialog_textbuffer = GTK_TEXT_BUFFER(
- gtk_builder_get_object(adcc->progress_dialog_builder,
- "GNUNET_FS_GTK_progress_dialog_textbuffer"));
+ GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_progress_dialog.glade", adcc);
+ adcc->progress_dialog =
+ GTK_WIDGET (gtk_builder_get_object (adcc->progress_dialog_builder,
+ "GNUNET_FS_GTK_progress_dialog"));
+ adcc->progress_dialog_bar = GTK_PROGRESS_BAR (
+ gtk_builder_get_object (adcc->progress_dialog_builder,
+ "GNUNET_FS_GTK_progress_dialog_progressbar"));
+ adcc->progress_dialog_textview = GTK_TEXT_VIEW (
+ gtk_builder_get_object (adcc->progress_dialog_builder,
+ "GNUNET_FS_GTK_progress_dialog_textview"));
+ adcc->textview_vertical_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (
+ adcc->progress_dialog_builder,
+ "GNUNET_FS_GTK_progress_dialog_textview_vertical_adjustment"));
+ adcc->progress_dialog_textbuffer = GTK_TEXT_BUFFER (
+ gtk_builder_get_object (adcc->progress_dialog_builder,
+ "GNUNET_FS_GTK_progress_dialog_textbuffer"));
/* show the window */
- gtk_window_set_transient_for(GTK_WINDOW(adcc->progress_dialog),
- adcc->ctx->master_pubdialog);
- gtk_window_set_title(GTK_WINDOW(adcc->progress_dialog), filename);
- gtk_window_present(GTK_WINDOW(adcc->progress_dialog));
+ gtk_window_set_transient_for (GTK_WINDOW (adcc->progress_dialog),
+ adcc->ctx->master_pubdialog);
+ gtk_window_set_title (GTK_WINDOW (adcc->progress_dialog), filename);
+ gtk_window_present (GTK_WINDOW (adcc->progress_dialog));
/* actually start the scan */
- adcc->ds = GNUNET_FS_directory_scan_start(filename, GNUNET_NO, NULL,
- &directory_scan_cb, adcc);
+ adcc->ds = GNUNET_FS_directory_scan_start (filename,
+ GNUNET_NO,
+ NULL,
+ &directory_scan_cb,
+ adcc);
/* disables 'cancel' button of the master dialog */
- update_selectivity_execute_cancel(ctx);
+ update_selectivity_execute_cancel (ctx);
}
/**
@@ -1467,50 +1709,54 @@ static void scan_file_or_directory(struct
MainPublishingDialogContext *ctx,
* @param response_id result of the dialog (GTK_RESPONSE_OK means to "run")
* @param user_data master publishing dialog context of our window
*/
-void GNUNET_GTK_publish_directory_dialog_response_cb(GtkDialog *dialog,
- gint response_id,
- gpointer user_data) {
+void
+GNUNET_GTK_publish_directory_dialog_response_cb (GtkDialog *dialog,
+ gint response_id,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
- if (GTK_RESPONSE_OK == response_id) {
+ if (GTK_RESPONSE_OK == response_id)
+ {
char *filename;
int do_index;
struct GNUNET_FS_BlockOptions bo;
filename =
- GNUNET_GTK_filechooser_get_filename_utf8(GTK_FILE_CHOOSER(dialog));
- if (!GNUNET_GTK_get_selected_anonymity_level(
- ctx->open_directory_builder,
- "GNUNET_GTK_publish_directory_dialog_anonymity_combobox",
- &bo.anonymity_level)) {
- GNUNET_break(0);
+ GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (dialog));
+ if (! GNUNET_GTK_get_selected_anonymity_level (
+ ctx->open_directory_builder,
+ "GNUNET_GTK_publish_directory_dialog_anonymity_combobox",
+ &bo.anonymity_level))
+ {
+ GNUNET_break (0);
bo.anonymity_level = 1;
}
bo.content_priority =
- gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(
- ctx->open_directory_builder,
- "GNUNET_GTK_publish_directory_dialog_priority_spin_button")));
+ gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object (
+ ctx->open_directory_builder,
+ "GNUNET_GTK_publish_directory_dialog_priority_spin_button")));
bo.replication_level =
- gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(
- ctx->open_directory_builder,
- "GNUNET_GTK_publish_directory_dialog_replication_spin_button")));
+ gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object (
+ ctx->open_directory_builder,
+ "GNUNET_GTK_publish_directory_dialog_replication_spin_button")));
{
GtkSpinButton *sb;
- sb = GTK_SPIN_BUTTON(gtk_builder_get_object(
- ctx->open_directory_builder,
- "GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button"));
- bo.expiration_time = GNUNET_GTK_get_expiration_time(sb);
+ sb = GTK_SPIN_BUTTON (gtk_builder_get_object (
+ ctx->open_directory_builder,
+ "GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button"));
+ bo.expiration_time = GNUNET_GTK_get_expiration_time (sb);
}
do_index =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(
- ctx->open_directory_builder,
- "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton")));
- scan_file_or_directory(ctx, filename, &bo, do_index);
- g_free(filename);
- }
- gtk_widget_destroy(GTK_WIDGET(dialog));
- g_object_unref(G_OBJECT(ctx->open_directory_builder));
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (
+ ctx->open_directory_builder,
+ "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton")));
+ scan_file_or_directory (ctx, filename, &bo, do_index);
+ g_free (filename);
+ }
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ g_object_unref (G_OBJECT (ctx->open_directory_builder));
ctx->open_directory_builder = NULL;
}
@@ -1521,51 +1767,55 @@ void
GNUNET_GTK_publish_directory_dialog_response_cb(GtkDialog *dialog,
* @param response_id result of the dialog (GTK_RESPONSE_OK means to "run")
* @param user_data master publishing dialog context of our window
*/
-void GNUNET_GTK_publish_file_dialog_response_cb(GtkDialog *dialog,
- gint response_id,
- gpointer user_data) {
+void
+GNUNET_GTK_publish_file_dialog_response_cb (GtkDialog *dialog,
+ gint response_id,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
- if (GTK_RESPONSE_OK == response_id) {
+ if (GTK_RESPONSE_OK == response_id)
+ {
char *filename;
struct GNUNET_FS_BlockOptions bo;
int do_index;
filename =
- GNUNET_GTK_filechooser_get_filename_utf8(GTK_FILE_CHOOSER(dialog));
- if (!GNUNET_GTK_get_selected_anonymity_level(
- ctx->open_file_builder,
- "GNUNET_GTK_publish_file_dialog_anonymity_combobox",
- &bo.anonymity_level)) {
- GNUNET_break(0);
+ GNUNET_GTK_filechooser_get_filename_utf8 (GTK_FILE_CHOOSER (dialog));
+ if (! GNUNET_GTK_get_selected_anonymity_level (
+ ctx->open_file_builder,
+ "GNUNET_GTK_publish_file_dialog_anonymity_combobox",
+ &bo.anonymity_level))
+ {
+ GNUNET_break (0);
bo.anonymity_level = 1;
}
bo.content_priority =
- gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(
- ctx->open_file_builder,
- "GNUNET_GTK_publish_file_dialog_priority_spin_button")));
+ gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object (
+ ctx->open_file_builder,
+ "GNUNET_GTK_publish_file_dialog_priority_spin_button")));
{
GtkSpinButton *sb;
- sb = GTK_SPIN_BUTTON(gtk_builder_get_object(
- ctx->open_file_builder,
- "GNUNET_GTK_publish_file_dialog_expiration_year_spin_button"));
- bo.expiration_time = GNUNET_GTK_get_expiration_time(sb);
+ sb = GTK_SPIN_BUTTON (gtk_builder_get_object (
+ ctx->open_file_builder,
+ "GNUNET_GTK_publish_file_dialog_expiration_year_spin_button"));
+ bo.expiration_time = GNUNET_GTK_get_expiration_time (sb);
}
bo.replication_level =
- gtk_spin_button_get_value(GTK_SPIN_BUTTON(gtk_builder_get_object(
- ctx->open_file_builder,
- "GNUNET_GTK_publish_file_dialog_replication_spin_button")));
+ gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object (
+ ctx->open_file_builder,
+ "GNUNET_GTK_publish_file_dialog_replication_spin_button")));
do_index =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(
- ctx->open_file_builder,
- "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")));
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (
+ ctx->open_file_builder,
+ "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")));
- scan_file_or_directory(ctx, filename, &bo, do_index);
- g_free(filename);
+ scan_file_or_directory (ctx, filename, &bo, do_index);
+ g_free (filename);
}
- gtk_widget_destroy(GTK_WIDGET(dialog));
- g_object_unref(G_OBJECT(ctx->open_file_builder));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+ g_object_unref (G_OBJECT (ctx->open_file_builder));
ctx->open_file_builder = NULL;
}
@@ -1578,50 +1828,52 @@ void
GNUNET_GTK_publish_file_dialog_response_cb(GtkDialog *dialog,
* @param dummy the button that was pressed
* @param user_data master publishing dialog context of our window
*/
-void GNUNET_GTK_master_publish_dialog_add_button_clicked_cb(
- GtkWidget *dummy, gpointer user_data) {
+void
+GNUNET_GTK_master_publish_dialog_add_button_clicked_cb (GtkWidget *dummy,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
- ctx->open_file_builder = GNUNET_GTK_get_new_builder(
- "gnunet_fs_gtk_publish_file_dialog.glade", ctx);
- GNUNET_GTK_setup_expiration_year_adjustment(ctx->open_file_builder);
+ ctx->open_file_builder =
+ GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_file_dialog.glade",
ctx);
+ GNUNET_GTK_setup_expiration_year_adjustment (ctx->open_file_builder);
/* FIXME-FEATURE: Use some kind of adjustable defaults instead of 1000, 0 and
* TRUE */
- gtk_spin_button_set_value(
- GTK_SPIN_BUTTON(gtk_builder_get_object(
- ctx->open_file_builder,
- "GNUNET_GTK_publish_file_dialog_priority_spin_button")),
- 1000);
- gtk_spin_button_set_value(
- GTK_SPIN_BUTTON(gtk_builder_get_object(
- ctx->open_file_builder,
- "GNUNET_GTK_publish_file_dialog_replication_spin_button")),
- 0);
- gtk_toggle_button_set_active(
- GTK_TOGGLE_BUTTON(gtk_builder_get_object(
- ctx->open_file_builder,
- "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")),
- TRUE);
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (gtk_builder_get_object (
+ ctx->open_file_builder,
+ "GNUNET_GTK_publish_file_dialog_priority_spin_button")),
+ 1000);
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (gtk_builder_get_object (
+ ctx->open_file_builder,
+ "GNUNET_GTK_publish_file_dialog_replication_spin_button")),
+ 0);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (gtk_builder_get_object (
+ ctx->open_file_builder,
+ "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")),
+ TRUE);
{
GtkComboBox *combo;
- combo = GTK_COMBO_BOX(gtk_builder_get_object(
- ctx->open_file_builder,
- "GNUNET_GTK_publish_file_dialog_anonymity_combobox"));
- gtk_combo_box_set_model(combo,
- GNUNET_FS_GTK_get_anonymity_level_list_store());
+ combo = GTK_COMBO_BOX (
+ gtk_builder_get_object (ctx->open_file_builder,
+
"GNUNET_GTK_publish_file_dialog_anonymity_combobox"));
+ gtk_combo_box_set_model (combo,
+ GNUNET_FS_GTK_get_anonymity_level_list_store ());
}
/* show dialog */
{
GtkWidget *ad;
- ad = GTK_WIDGET(gtk_builder_get_object(ctx->open_file_builder,
- "GNUNET_GTK_publish_file_dialog"));
- gtk_window_set_transient_for(GTK_WINDOW(ad), ctx->master_pubdialog);
- gtk_window_present(GTK_WINDOW(ad));
+ ad = GTK_WIDGET (gtk_builder_get_object (ctx->open_file_builder,
+
"GNUNET_GTK_publish_file_dialog"));
+ gtk_window_set_transient_for (GTK_WINDOW (ad), ctx->master_pubdialog);
+ gtk_window_present (GTK_WINDOW (ad));
}
}
@@ -1634,50 +1886,54 @@ void
GNUNET_GTK_master_publish_dialog_add_button_clicked_cb(
* @param dummy the button that was pressed
* @param user_data master publishing dialog context of our window
*/
-void GNUNET_GTK_master_publish_dialog_open_button_clicked_cb(
- GtkWidget *dummy, gpointer user_data) {
+void
+GNUNET_GTK_master_publish_dialog_open_button_clicked_cb (GtkWidget *dummy,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
- ctx->open_directory_builder = GNUNET_GTK_get_new_builder(
- "gnunet_fs_gtk_publish_directory_dialog.glade", ctx);
- GNUNET_GTK_setup_expiration_year_adjustment(ctx->open_directory_builder);
+ ctx->open_directory_builder =
+ GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_directory_dialog.glade",
+ ctx);
+ GNUNET_GTK_setup_expiration_year_adjustment (ctx->open_directory_builder);
/* FIXME-FEATURE: Use some kind of adjustable defaults instead of 1000, 0 and
* TRUE */
- gtk_spin_button_set_value(
- GTK_SPIN_BUTTON(gtk_builder_get_object(
- ctx->open_directory_builder,
- "GNUNET_GTK_publish_directory_dialog_priority_spin_button")),
- 1000);
- gtk_spin_button_set_value(
- GTK_SPIN_BUTTON(gtk_builder_get_object(
- ctx->open_directory_builder,
- "GNUNET_GTK_publish_directory_dialog_replication_spin_button")),
- 0);
- gtk_toggle_button_set_active(
- GTK_TOGGLE_BUTTON(gtk_builder_get_object(
- ctx->open_directory_builder,
- "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton")),
- TRUE);
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (gtk_builder_get_object (
+ ctx->open_directory_builder,
+ "GNUNET_GTK_publish_directory_dialog_priority_spin_button")),
+ 1000);
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (gtk_builder_get_object (
+ ctx->open_directory_builder,
+ "GNUNET_GTK_publish_directory_dialog_replication_spin_button")),
+ 0);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (gtk_builder_get_object (
+ ctx->open_directory_builder,
+ "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton")),
+ TRUE);
{
GtkComboBox *combo;
- combo = GTK_COMBO_BOX(gtk_builder_get_object(
- ctx->open_directory_builder,
- "GNUNET_GTK_publish_directory_dialog_anonymity_combobox"));
- gtk_combo_box_set_model(combo,
- GNUNET_FS_GTK_get_anonymity_level_list_store());
+ combo = GTK_COMBO_BOX (gtk_builder_get_object (
+ ctx->open_directory_builder,
+ "GNUNET_GTK_publish_directory_dialog_anonymity_combobox"));
+ gtk_combo_box_set_model (combo,
+ GNUNET_FS_GTK_get_anonymity_level_list_store ());
}
/* show dialog */
{
GtkWidget *ad;
- ad = GTK_WIDGET(gtk_builder_get_object(
- ctx->open_directory_builder, "GNUNET_GTK_publish_directory_dialog"));
- gtk_window_set_transient_for(GTK_WINDOW(ad), ctx->master_pubdialog);
- gtk_window_present(GTK_WINDOW(ad));
+ ad = GTK_WIDGET (
+ gtk_builder_get_object (ctx->open_directory_builder,
+ "GNUNET_GTK_publish_directory_dialog"));
+ gtk_window_set_transient_for (GTK_WINDOW (ad), ctx->master_pubdialog);
+ gtk_window_present (GTK_WINDOW (ad));
}
}
@@ -1686,7 +1942,8 @@ void
GNUNET_GTK_master_publish_dialog_open_button_clicked_cb(
/**
* Context we keep while an "edit" sub-dialog is open.
*/
-struct EditPublishContext {
+struct EditPublishContext
+{
/**
* File information that is being edited
*/
@@ -1721,23 +1978,38 @@ struct EditPublishContext {
* this entry from the directory, #GNUNET_SYSERR
* to abort the iteration
*/
-static int update_treeview_after_edit(
- void *cls, struct GNUNET_FS_FileInformation *fi, uint64_t length,
- struct GNUNET_CONTAINER_MetaData *meta, struct GNUNET_FS_Uri **uri,
- struct GNUNET_FS_BlockOptions *bo, int *do_index, void **client_info) {
+static int
+update_treeview_after_edit (void *cls,
+ struct GNUNET_FS_FileInformation *fi,
+ uint64_t length,
+ struct GNUNET_CONTAINER_MetaData *meta,
+ struct GNUNET_FS_Uri **uri,
+ struct GNUNET_FS_BlockOptions *bo,
+ int *do_index,
+ void **client_info)
+{
struct EditPublishContext *epc = cls;
char *name;
- name = GNUNET_CONTAINER_meta_data_get_by_type(
- meta, EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
- gtk_tree_store_set(
- GTK_TREE_STORE(epc->tm), &epc->iter, PUBLISH_MC_DO_INDEX, *do_index,
- PUBLISH_MC_FILENAME, name, PUBLISH_MC_ANONYMITY_LEVEL,
- (guint)bo->anonymity_level, PUBLISH_MC_PRIORITY,
- (guint)bo->content_priority, PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE,
- (guint64)bo->expiration_time.abs_value_us, PUBLISH_MC_REPLICATION_LEVEL,
- (guint)bo->replication_level, -1);
- GNUNET_free_non_null(name);
+ name = GNUNET_CONTAINER_meta_data_get_by_type (
+ meta,
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME);
+ gtk_tree_store_set (GTK_TREE_STORE (epc->tm),
+ &epc->iter,
+ PUBLISH_MC_DO_INDEX,
+ *do_index,
+ PUBLISH_MC_FILENAME,
+ name,
+ PUBLISH_MC_ANONYMITY_LEVEL,
+ (guint) bo->anonymity_level,
+ PUBLISH_MC_PRIORITY,
+ (guint) bo->content_priority,
+ PUBLISH_MC_EXPIRATION_TIME_ABSOLUTE,
+ (guint64) bo->expiration_time.abs_value_us,
+ PUBLISH_MC_REPLICATION_LEVEL,
+ (guint) bo->replication_level,
+ -1);
+ GNUNET_free_non_null (name);
return GNUNET_SYSERR;
}
@@ -1748,14 +2020,16 @@ static int update_treeview_after_edit(
* @param ret GTK_RESPONSE_OK if the dialog was closed with "OK"
* @param root unused (namespace root name)
*/
-static void master_publish_edit_publish_dialog_cb(gpointer cls, gint ret,
- const char *root) {
+static void
+master_publish_edit_publish_dialog_cb (gpointer cls, gint ret, const char
*root)
+{
struct EditPublishContext *epc = cls;
if (ret == GTK_RESPONSE_OK)
- GNUNET_FS_file_information_inspect(epc->fip, &update_treeview_after_edit,
- epc);
- GNUNET_free(epc);
+ GNUNET_FS_file_information_inspect (epc->fip,
+ &update_treeview_after_edit,
+ epc);
+ GNUNET_free (epc);
}
/**
@@ -1765,24 +2039,33 @@ static void
master_publish_edit_publish_dialog_cb(gpointer cls, gint ret,
* @param dummy the 'edit' button
* @param user_data master publishing dialog context of our window
*/
-void GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb(
- GtkWidget *dummy, gpointer user_data) {
+void
+GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb (GtkWidget *dummy,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
struct EditPublishContext *epc;
- epc = GNUNET_new(struct EditPublishContext);
+ epc = GNUNET_new (struct EditPublishContext);
epc->tm = ctx->file_info_treemodel;
- if (!gtk_tree_selection_get_selected(ctx->file_info_selection, NULL,
- &epc->iter)) {
- GNUNET_break(0);
- GNUNET_free(epc);
+ if (! gtk_tree_selection_get_selected (ctx->file_info_selection,
+ NULL,
+ &epc->iter))
+ {
+ GNUNET_break (0);
+ GNUNET_free (epc);
return;
}
- gtk_tree_model_get(ctx->file_info_treemodel, &epc->iter,
- PUBLISH_MC_FILE_INFORMATION_STRUCT, &epc->fip, -1);
- GNUNET_FS_GTK_edit_publish_dialog(ctx->master_pubdialog, epc->fip, GNUNET_NO,
- &master_publish_edit_publish_dialog_cb,
- epc);
+ gtk_tree_model_get (ctx->file_info_treemodel,
+ &epc->iter,
+ PUBLISH_MC_FILE_INFORMATION_STRUCT,
+ &epc->fip,
+ -1);
+ GNUNET_FS_GTK_edit_publish_dialog (ctx->master_pubdialog,
+ epc->fip,
+ GNUNET_NO,
+ &master_publish_edit_publish_dialog_cb,
+ epc);
}
/* ******************** master edit dialog shutdown *********************** */
@@ -1797,21 +2080,27 @@ void
GNUNET_GTK_master_publish_dialog_edit_button_clicked_cb(
* @return file information from the given position (never NULL)
*/
static struct GNUNET_FS_FileInformation *
-get_file_information(GtkTreeModel *tm, GtkTreeIter *iter) {
+get_file_information (GtkTreeModel *tm, GtkTreeIter *iter)
+{
struct GNUNET_FS_FileInformation *fi;
struct GNUNET_FS_FileInformation *fic;
GtkTreeIter child;
- gtk_tree_model_get(tm, iter, PUBLISH_MC_FILE_INFORMATION_STRUCT, &fi, -1);
- gtk_tree_store_set(GTK_TREE_STORE(tm), iter,
- PUBLISH_MC_FILE_INFORMATION_STRUCT, NULL, -1);
- GNUNET_assert(fi != NULL);
- if (gtk_tree_model_iter_children(tm, &child, iter)) {
- GNUNET_break(GNUNET_YES == GNUNET_FS_file_information_is_directory(fi));
- do {
- fic = get_file_information(tm, &child);
- GNUNET_break(GNUNET_OK == GNUNET_FS_file_information_add(fi, fic));
- } while (gtk_tree_model_iter_next(tm, &child));
+ gtk_tree_model_get (tm, iter, PUBLISH_MC_FILE_INFORMATION_STRUCT, &fi, -1);
+ gtk_tree_store_set (GTK_TREE_STORE (tm),
+ iter,
+ PUBLISH_MC_FILE_INFORMATION_STRUCT,
+ NULL,
+ -1);
+ GNUNET_assert (fi != NULL);
+ if (gtk_tree_model_iter_children (tm, &child, iter))
+ {
+ GNUNET_break (GNUNET_YES == GNUNET_FS_file_information_is_directory (fi));
+ do
+ {
+ fic = get_file_information (tm, &child);
+ GNUNET_break (GNUNET_OK == GNUNET_FS_file_information_add (fi, fic));
+ } while (gtk_tree_model_iter_next (tm, &child));
}
return fi;
}
@@ -1822,19 +2111,22 @@ get_file_information(GtkTreeModel *tm, GtkTreeIter
*iter) {
* @param tm tree model we are cleaning up
* @param iter current position to clean up
*/
-static void free_file_information_tree_store(GtkTreeModel *tm,
- GtkTreeIter *iter) {
+static void
+free_file_information_tree_store (GtkTreeModel *tm, GtkTreeIter *iter)
+{
GtkTreeIter child;
struct GNUNET_FS_FileInformation *fip;
- gtk_tree_model_get(tm, iter, PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip, -1);
+ gtk_tree_model_get (tm, iter, PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip, -1);
if (NULL != fip)
- GNUNET_FS_file_information_destroy(fip, NULL, NULL);
+ GNUNET_FS_file_information_destroy (fip, NULL, NULL);
/* recursively clean up children */
- if (gtk_tree_model_iter_children(tm, &child, iter)) {
- do {
- free_file_information_tree_store(tm, &child);
- } while (gtk_tree_model_iter_next(tm, &child));
+ if (gtk_tree_model_iter_children (tm, &child, iter))
+ {
+ do
+ {
+ free_file_information_tree_store (tm, &child);
+ } while (gtk_tree_model_iter_next (tm, &child));
}
}
@@ -1848,7 +2140,8 @@ static void free_file_information_tree_store(GtkTreeModel
*tm,
* open)
*/
static int
-close_master_publish_dialog(struct MainPublishingDialogContext *ctx) {
+close_master_publish_dialog (struct MainPublishingDialogContext *ctx)
+{
GtkTreeIter iter;
/* Refuse to close until all scanners are finished */
@@ -1856,20 +2149,21 @@ close_master_publish_dialog(struct
MainPublishingDialogContext *ctx) {
return GNUNET_NO;
/* free state from the identifiers treemodel */
- gtk_tree_store_clear(GTK_TREE_STORE(ctx->identifiers_treemodel));
+ gtk_tree_store_clear (GTK_TREE_STORE (ctx->identifiers_treemodel));
/* free state from the file info treemodel */
- if (gtk_tree_model_get_iter_first(ctx->file_info_treemodel, &iter))
- do {
- free_file_information_tree_store(ctx->file_info_treemodel, &iter);
- } while (gtk_tree_model_iter_next(ctx->file_info_treemodel, &iter));
- gtk_tree_store_clear(GTK_TREE_STORE(ctx->file_info_treemodel));
- GNUNET_IDENTITY_disconnect(ctx->identity);
- gtk_widget_destroy(GTK_WIDGET(ctx->master_pubdialog));
- g_object_unref(G_OBJECT(ctx->builder));
- GNUNET_free_non_null(ctx->ns_name);
- g_free(ctx->previous_id);
- GNUNET_free(ctx);
+ if (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter))
+ do
+ {
+ free_file_information_tree_store (ctx->file_info_treemodel, &iter);
+ } while (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter));
+ gtk_tree_store_clear (GTK_TREE_STORE (ctx->file_info_treemodel));
+ GNUNET_IDENTITY_disconnect (ctx->identity);
+ gtk_widget_destroy (GTK_WIDGET (ctx->master_pubdialog));
+ g_object_unref (G_OBJECT (ctx->builder));
+ GNUNET_free_non_null (ctx->ns_name);
+ g_free (ctx->previous_id);
+ GNUNET_free (ctx);
return GNUNET_YES;
}
@@ -1891,12 +2185,16 @@ close_master_publish_dialog(struct
MainPublishingDialogContext *ctx) {
* this entry from the directory, #GNUNET_SYSERR
* to abort the iteration
*/
-static int insert_advertisement(void *cls, struct GNUNET_FS_FileInformation
*fi,
- uint64_t length,
- struct GNUNET_CONTAINER_MetaData *meta,
- struct GNUNET_FS_Uri **uri,
- struct GNUNET_FS_BlockOptions *bo,
- int *do_index, void **client_info) {
+static int
+insert_advertisement (void *cls,
+ struct GNUNET_FS_FileInformation *fi,
+ uint64_t length,
+ struct GNUNET_CONTAINER_MetaData *meta,
+ struct GNUNET_FS_Uri **uri,
+ struct GNUNET_FS_BlockOptions *bo,
+ int *do_index,
+ void **client_info)
+{
struct MainPublishingDialogContext *ctx = cls;
struct GNUNET_CRYPTO_EcdsaPublicKey pub;
struct GNUNET_FS_Uri *sks_uri;
@@ -1904,17 +2202,21 @@ static int insert_advertisement(void *cls, struct
GNUNET_FS_FileInformation *fi,
if (NULL == ctx->ns)
return GNUNET_SYSERR;
- GNUNET_IDENTITY_ego_get_public_key(ctx->ns, &pub);
- sks_uri = GNUNET_FS_uri_sks_create(&pub, "/");
- sks_uri_string = GNUNET_FS_uri_to_string(sks_uri);
- GNUNET_FS_uri_destroy(sks_uri);
+ GNUNET_IDENTITY_ego_get_public_key (ctx->ns, &pub);
+ sks_uri = GNUNET_FS_uri_sks_create (&pub, "/");
+ sks_uri_string = GNUNET_FS_uri_to_string (sks_uri);
+ GNUNET_FS_uri_destroy (sks_uri);
if (NULL == sks_uri_string)
return GNUNET_SYSERR;
- GNUNET_CONTAINER_meta_data_insert(meta, "<gnunet>", EXTRACTOR_METATYPE_URI,
- EXTRACTOR_METAFORMAT_UTF8, "text/plain",
- sks_uri_string, strlen(sks_uri_string) +
1);
- GNUNET_free(sks_uri_string);
+ GNUNET_CONTAINER_meta_data_insert (meta,
+ "<gnunet>",
+ EXTRACTOR_METATYPE_URI,
+ EXTRACTOR_METAFORMAT_UTF8,
+ "text/plain",
+ sks_uri_string,
+ strlen (sks_uri_string) + 1);
+ GNUNET_free (sks_uri_string);
return GNUNET_SYSERR;
}
@@ -1925,8 +2227,10 @@ static int insert_advertisement(void *cls, struct
GNUNET_FS_FileInformation *fi,
* @param button the button that was clicked
* @param user_data master publishing dialog context of our window
*/
-void GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb(
- GtkButton *button, gpointer user_data) {
+void
+GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
gchar *namespace_id;
struct GNUNET_IDENTITY_Ego *ns;
@@ -1938,75 +2242,92 @@ void
GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb(
gboolean do_own;
gboolean disable_ads_insertion;
- if (NULL != ctx->adddir_head) {
- GNUNET_break(0);
+ if (NULL != ctx->adddir_head)
+ {
+ GNUNET_break (0);
return;
}
do_global =
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ctx->global_checkbox));
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ctx->global_checkbox));
do_updateable =
-
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ctx->updateable_checkbox));
- do_own = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ctx->own_checkbox));
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(ctx->updateable_checkbox));
+ do_own = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(ctx->own_checkbox));
- disable_ads_insertion = GNUNET_CONFIGURATION_get_value_yesno(
- GNUNET_FS_GTK_get_configuration(), "gnunet-fs-gtk",
- "DISABLE_AUTOMATIC_NAMESPACE_ADVERTISEMENT_INSERTION");
+ disable_ads_insertion = GNUNET_CONFIGURATION_get_value_yesno (
+ GNUNET_FS_GTK_get_configuration (),
+ "gnunet-fs-gtk",
+ "DISABLE_AUTOMATIC_NAMESPACE_ADVERTISEMENT_INSERTION");
if (disable_ads_insertion == GNUNET_SYSERR)
disable_ads_insertion = GNUNET_NO;
ns = NULL;
namespace_id = NULL;
namespace_uid = NULL;
- if (ctx->ns && do_own) {
+ if (ctx->ns && do_own)
+ {
const gchar *id_entry_text;
- if (NULL !=
- (id_entry_text = gtk_entry_get_text(GTK_ENTRY(ctx->identifier_entry))))
- namespace_id = g_strdup(id_entry_text);
- else if (!do_global)
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Global publication is disabled, but
"
- "namespace_id is not available\n");
- if ((NULL != namespace_id) && ('\0' == namespace_id[0])) {
- g_free(namespace_id);
+ if (NULL != (id_entry_text =
+ gtk_entry_get_text (GTK_ENTRY (ctx->identifier_entry))))
+ namespace_id = g_strdup (id_entry_text);
+ else if (! do_global)
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Global publication is disabled, but "
+ "namespace_id is not available\n");
+ if ((NULL != namespace_id) && ('\0' == namespace_id[0]))
+ {
+ g_free (namespace_id);
namespace_id = NULL;
}
- if (NULL != namespace_id) {
- namespace_uid = gtk_entry_get_text(GTK_ENTRY(ctx->update_id_entry));
+ if (NULL != namespace_id)
+ {
+ namespace_uid = gtk_entry_get_text (GTK_ENTRY (ctx->update_id_entry));
if ((NULL == namespace_uid) || ('\0' == namespace_uid[0]) ||
- (!do_updateable))
+ (! do_updateable))
namespace_uid = NULL;
ns = ctx->ns;
- } else if (!do_global)
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
- "Global publication is disabled, but namespace_id unavailable
"
- "or zero-length\n");
- } else if (!do_global)
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
- "Global publication is disabled, ns is either NULL or disabled,
"
- "yet 'Execute' was pressed\n");
- if ((!do_global) && (NULL == ns)) {
- g_free(namespace_id);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ctx->own_checkbox), FALSE);
+ }
+ else if (! do_global)
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Global publication is disabled, but namespace_id
unavailable "
+ "or zero-length\n");
+ }
+ else if (! do_global)
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Global publication is disabled, ns is either NULL or
disabled, "
+ "yet 'Execute' was pressed\n");
+ if ((! do_global) && (NULL == ns))
+ {
+ g_free (namespace_id);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctx->own_checkbox),
FALSE);
return;
}
- if (gtk_tree_model_get_iter_first(ctx->file_info_treemodel, &iter)) {
- if (!do_global)
- clear_keywords_from_tm(ctx);
- do {
- fi = get_file_information(ctx->file_info_treemodel, &iter);
- if (do_global && do_own && !disable_ads_insertion)
- GNUNET_FS_file_information_inspect(fi, insert_advertisement, ctx);
- GNUNET_FS_publish_start(
- GNUNET_FS_GTK_get_fs_handle(), fi,
- (NULL == ns) ? NULL : GNUNET_IDENTITY_ego_get_private_key(ns),
- namespace_id, namespace_uid, GNUNET_FS_PUBLISH_OPTION_NONE);
- } while (gtk_tree_model_iter_next(ctx->file_info_treemodel, &iter));
- } else {
- GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
- "Failed to get first item in files tree view. Is it empty?\n");
- }
- g_free(namespace_id);
- GNUNET_break(GNUNET_YES == close_master_publish_dialog(ctx));
+ if (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter))
+ {
+ if (! do_global)
+ clear_keywords_from_tm (ctx);
+ do
+ {
+ fi = get_file_information (ctx->file_info_treemodel, &iter);
+ if (do_global && do_own && ! disable_ads_insertion)
+ GNUNET_FS_file_information_inspect (fi, insert_advertisement, ctx);
+ GNUNET_FS_publish_start (GNUNET_FS_GTK_get_fs_handle (),
+ fi,
+ (NULL == ns)
+ ? NULL
+ : GNUNET_IDENTITY_ego_get_private_key (ns),
+ namespace_id,
+ namespace_uid,
+ GNUNET_FS_PUBLISH_OPTION_NONE);
+ } while (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter));
+ }
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to get first item in files tree view. Is it empty?\n");
+ }
+ g_free (namespace_id);
+ GNUNET_break (GNUNET_YES == close_master_publish_dialog (ctx));
}
/**
@@ -2025,13 +2346,19 @@ void
GNUNET_GTK_master_publish_dialog_execute_button_clicked_cb(
* modified)
* @return #GNUNET_OK (to continue)
*/
-static int clear_keywords_in_file_information(
- void *cls, struct GNUNET_FS_FileInformation *fi, uint64_t length,
- struct GNUNET_CONTAINER_MetaData *meta, struct GNUNET_FS_Uri **uri,
- struct GNUNET_FS_BlockOptions *bo, int *do_index, void **client_info) {
+static int
+clear_keywords_in_file_information (void *cls,
+ struct GNUNET_FS_FileInformation *fi,
+ uint64_t length,
+ struct GNUNET_CONTAINER_MetaData *meta,
+ struct GNUNET_FS_Uri **uri,
+ struct GNUNET_FS_BlockOptions *bo,
+ int *do_index,
+ void **client_info)
+{
if (NULL == *uri)
return GNUNET_OK;
- GNUNET_FS_uri_destroy(*uri);
+ GNUNET_FS_uri_destroy (*uri);
*uri = NULL;
return GNUNET_OK;
}
@@ -2043,21 +2370,26 @@ static int clear_keywords_in_file_information(
* @param iter current position in the recursion
*/
static void
-clear_keywords_from_file_information_in_tree_store(GtkTreeModel *tm,
- GtkTreeIter *iter) {
+clear_keywords_from_file_information_in_tree_store (GtkTreeModel *tm,
+ GtkTreeIter *iter)
+{
GtkTreeIter child;
struct GNUNET_FS_FileInformation *fip;
- gtk_tree_model_get(tm, iter, PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip, -1);
- if (NULL != fip) {
- GNUNET_FS_file_information_inspect(fip,
&clear_keywords_in_file_information,
- NULL);
+ gtk_tree_model_get (tm, iter, PUBLISH_MC_FILE_INFORMATION_STRUCT, &fip, -1);
+ if (NULL != fip)
+ {
+ GNUNET_FS_file_information_inspect (fip,
+ &clear_keywords_in_file_information,
+ NULL);
}
/* recursively clean up children */
- if (gtk_tree_model_iter_children(tm, &child, iter)) {
- do {
- clear_keywords_from_file_information_in_tree_store(tm, &child);
- } while (gtk_tree_model_iter_next(tm, &child));
+ if (gtk_tree_model_iter_children (tm, &child, iter))
+ {
+ do
+ {
+ clear_keywords_from_file_information_in_tree_store (tm, &child);
+ } while (gtk_tree_model_iter_next (tm, &child));
}
}
@@ -2067,15 +2399,19 @@
clear_keywords_from_file_information_in_tree_store(GtkTreeModel *tm,
*
* @param ctx context
*/
-static void clear_keywords_from_tm(struct MainPublishingDialogContext *ctx) {
+static void
+clear_keywords_from_tm (struct MainPublishingDialogContext *ctx)
+{
GtkTreeIter iter;
/* clear keywords from 'tm' */
- if (gtk_tree_model_get_iter_first(ctx->file_info_treemodel, &iter))
- do {
- clear_keywords_from_file_information_in_tree_store(
- ctx->file_info_treemodel, &iter);
- } while (gtk_tree_model_iter_next(ctx->file_info_treemodel, &iter));
+ if (gtk_tree_model_get_iter_first (ctx->file_info_treemodel, &iter))
+ do
+ {
+ clear_keywords_from_file_information_in_tree_store (ctx
+
->file_info_treemodel,
+ &iter);
+ } while (gtk_tree_model_iter_next (ctx->file_info_treemodel, &iter));
}
/**
@@ -2084,9 +2420,11 @@ static void clear_keywords_from_tm(struct
MainPublishingDialogContext *ctx) {
* @param button the button that was clicked
* @param user_data master publishing dialog context of our window
*/
-void GNUNET_GTK_master_publish_dialog_clear_button_clicked_cb(
- GtkButton *button, gpointer user_data) {
- clear_keywords_from_tm(user_data);
+void
+GNUNET_GTK_master_publish_dialog_clear_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
+ clear_keywords_from_tm (user_data);
}
/**
@@ -2095,11 +2433,13 @@ void
GNUNET_GTK_master_publish_dialog_clear_button_clicked_cb(
* @param button the button that was clicked
* @param user_data master publishing dialog context of our window
*/
-void GNUNET_GTK_master_publish_dialog_cancel_button_clicked_cb(
- GtkButton *button, gpointer user_data) {
+void
+GNUNET_GTK_master_publish_dialog_cancel_button_clicked_cb (GtkButton *button,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
- GNUNET_break(GNUNET_YES == close_master_publish_dialog(ctx));
+ GNUNET_break (GNUNET_YES == close_master_publish_dialog (ctx));
}
/**
@@ -2112,12 +2452,14 @@ void
GNUNET_GTK_master_publish_dialog_cancel_button_clicked_cb(
* @return TRUE to refuse to close (stops other handlers from being invoked)
* FALSE to allow closing the window
*/
-gboolean GNUNET_GTK_master_publish_dialog_delete_event_cb(GtkWidget *widget,
- GdkEvent *event,
- gpointer user_data) {
+gboolean
+GNUNET_GTK_master_publish_dialog_delete_event_cb (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
- if (GNUNET_NO == close_master_publish_dialog(ctx))
+ if (GNUNET_NO == close_master_publish_dialog (ctx))
return TRUE;
return FALSE;
}
@@ -2132,28 +2474,31 @@ gboolean
GNUNET_GTK_master_publish_dialog_delete_event_cb(GtkWidget *widget,
* @param param_spec parameter that was changed
* @param user_data context
*/
-static void expander_callback(GObject *object, GParamSpec *param_spec,
- gpointer user_data) {
+static void
+expander_callback (GObject *object, GParamSpec *param_spec, gpointer user_data)
+{
GtkExpander *expander;
struct MainPublishingDialogContext *ctx = user_data;
GtkAllocation scrolled_allocation;
gint paned_pos;
GValue gv = G_VALUE_INIT;
gboolean expanded;
- expander = GTK_EXPANDER(object);
-
- gtk_widget_get_allocation(GTK_WIDGET(ctx->identifiers_scrolled),
- &scrolled_allocation);
- expanded = gtk_expander_get_expanded(expander);
- gtk_widget_set_visible(GTK_WIDGET(ctx->identifiers_scrolled), expanded);
-
- g_value_init(&gv, G_TYPE_BOOLEAN);
- g_value_set_boolean(&gv, expanded);
- gtk_container_child_set_property(GTK_CONTAINER(ctx->vpaned),
- ctx->bottom_frame, "resize", &gv);
- paned_pos = gtk_paned_get_position(GTK_PANED(ctx->vpaned));
+ expander = GTK_EXPANDER (object);
+
+ gtk_widget_get_allocation (GTK_WIDGET (ctx->identifiers_scrolled),
+ &scrolled_allocation);
+ expanded = gtk_expander_get_expanded (expander);
+ gtk_widget_set_visible (GTK_WIDGET (ctx->identifiers_scrolled), expanded);
+
+ g_value_init (&gv, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&gv, expanded);
+ gtk_container_child_set_property (GTK_CONTAINER (ctx->vpaned),
+ ctx->bottom_frame,
+ "resize",
+ &gv);
+ paned_pos = gtk_paned_get_position (GTK_PANED (ctx->vpaned));
paned_pos = paned_pos + (scrolled_allocation.height * (expanded ? -1 : 1));
- gtk_paned_set_position(GTK_PANED(ctx->vpaned), paned_pos);
+ gtk_paned_set_position (GTK_PANED (ctx->vpaned), paned_pos);
}
/* ******************** master edit dialog initialization *******************
*/
@@ -2161,7 +2506,8 @@ static void expander_callback(GObject *object, GParamSpec
*param_spec,
/**
* Closure for 'add_updateable_to_ts'.
*/
-struct UpdateableContext {
+struct UpdateableContext
+{
/**
* Parent of current insertion.
*/
@@ -2197,9 +2543,13 @@ struct UpdateableContext {
* @param last_meta associate meta data
* @param next_id ID for future updates
*/
-static void add_updateable_to_ts(
- void *cls, const char *last_id, const struct GNUNET_FS_Uri *last_uri,
- const struct GNUNET_CONTAINER_MetaData *last_meta, const char *next_id) {
+static void
+add_updateable_to_ts (void *cls,
+ const char *last_id,
+ const struct GNUNET_FS_Uri *last_uri,
+ const struct GNUNET_CONTAINER_MetaData *last_meta,
+ const char *next_id)
+{
struct UpdateableContext *uc = cls;
struct UpdateableContext sc;
GtkTreeIter iter;
@@ -2221,86 +2571,129 @@ static void add_updateable_to_ts(
uc->update_called = GNUNET_YES;
if (next_id)
- next_id_len = strlen(next_id);
+ next_id_len = strlen (next_id);
else
next_id_len = 0;
if (last_id)
- last_id_len = strlen(last_id);
+ last_id_len = strlen (last_id);
else
last_id_len = 0;
- uristring = GNUNET_FS_uri_to_string(last_uri);
+ uristring = GNUNET_FS_uri_to_string (last_uri);
if (uristring)
- urilen = strlen(uristring);
+ urilen = strlen (uristring);
else
urilen = 0;
mdbuf = NULL;
- mdsize = GNUNET_CONTAINER_meta_data_serialize(
- last_meta, &mdbuf, 64 * 1024, GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL);
+ mdsize = GNUNET_CONTAINER_meta_data_serialize (
+ last_meta,
+ &mdbuf,
+ 64 * 1024,
+ GNUNET_CONTAINER_META_DATA_SERIALIZE_FULL);
if (0 > mdsize)
mdsize = 0;
hashbufsize = last_id_len + next_id_len + urilen + mdsize;
- hashbuf = GNUNET_malloc(hashbufsize);
+ hashbuf = GNUNET_malloc (hashbufsize);
if (last_id)
- strcpy(&hashbuf[0], last_id);
+ strcpy (&hashbuf[0], last_id);
if (next_id)
- strcpy(&hashbuf[last_id_len], next_id);
+ strcpy (&hashbuf[last_id_len], next_id);
if (uristring)
- strcpy(&hashbuf[last_id_len + next_id_len], uristring);
+ strcpy (&hashbuf[last_id_len + next_id_len], uristring);
if (mdbuf)
- memcpy(&hashbuf[last_id_len + next_id_len + urilen], mdbuf, mdsize);
+ memcpy (&hashbuf[last_id_len + next_id_len + urilen], mdbuf, mdsize);
- GNUNET_CRYPTO_hash(hashbuf, hashbufsize, &hc);
+ GNUNET_CRYPTO_hash (hashbuf, hashbufsize, &hc);
- GNUNET_free(uristring);
- GNUNET_free_non_null(mdbuf);
- GNUNET_free(hashbuf);
+ GNUNET_free (uristring);
+ GNUNET_free_non_null (mdbuf);
+ GNUNET_free (hashbuf);
spath = NULL;
- spath = GNUNET_CONTAINER_multihashmap_get(uc->seen, &hc);
-
- desc = GNUNET_FS_GTK_get_description_from_metadata(last_meta,
&desc_is_a_dup);
- if (NULL != spath) {
- displaytext = g_strdup_printf("<i>%s</i>", last_id);
- gtk_tree_store_insert_with_values(
- uc->ts, &iter, uc->parent, G_MAXINT, IDENTIFIERS_MC_ID, last_id,
- IDENTIFIERS_MC_UPDATE_ID, next_id, IDENTIFIERS_MC_DESCRIPTION, desc,
- IDENTIFIERS_MC_PATH_TO_ORIGINAL, spath, IDENTIFIERS_MC_ID_MARKED_UP,
- displaytext, -1);
- } else if (NULL == uc->parent) {
- displaytext = g_strdup_printf("%s", last_id);
- gtk_tree_store_insert_with_values(
- uc->ts, &iter, uc->parent, G_MAXINT, IDENTIFIERS_MC_ID, last_id,
- IDENTIFIERS_MC_UPDATE_ID, next_id, IDENTIFIERS_MC_DESCRIPTION, desc,
- IDENTIFIERS_MC_PATH_TO_ORIGINAL, NULL, IDENTIFIERS_MC_ID_MARKED_UP,
- displaytext, -1);
- } else {
- displaytext = g_strdup_printf("%s", last_id);
- gtk_tree_store_insert_with_values(
- uc->ts, &iter, uc->parent, G_MAXINT, IDENTIFIERS_MC_ID, last_id,
- IDENTIFIERS_MC_UPDATE_ID, next_id, IDENTIFIERS_MC_DESCRIPTION, desc,
- IDENTIFIERS_MC_PATH_TO_ORIGINAL, NULL, IDENTIFIERS_MC_ID_MARKED_UP,
- displaytext, -1);
- }
- g_free(displaytext);
-
- if (NULL == spath) {
+ spath = GNUNET_CONTAINER_multihashmap_get (uc->seen, &hc);
+
+ desc =
+ GNUNET_FS_GTK_get_description_from_metadata (last_meta, &desc_is_a_dup);
+ if (NULL != spath)
+ {
+ displaytext = g_strdup_printf ("<i>%s</i>", last_id);
+ gtk_tree_store_insert_with_values (uc->ts,
+ &iter,
+ uc->parent,
+ G_MAXINT,
+ IDENTIFIERS_MC_ID,
+ last_id,
+ IDENTIFIERS_MC_UPDATE_ID,
+ next_id,
+ IDENTIFIERS_MC_DESCRIPTION,
+ desc,
+ IDENTIFIERS_MC_PATH_TO_ORIGINAL,
+ spath,
+ IDENTIFIERS_MC_ID_MARKED_UP,
+ displaytext,
+ -1);
+ }
+ else if (NULL == uc->parent)
+ {
+ displaytext = g_strdup_printf ("%s", last_id);
+ gtk_tree_store_insert_with_values (uc->ts,
+ &iter,
+ uc->parent,
+ G_MAXINT,
+ IDENTIFIERS_MC_ID,
+ last_id,
+ IDENTIFIERS_MC_UPDATE_ID,
+ next_id,
+ IDENTIFIERS_MC_DESCRIPTION,
+ desc,
+ IDENTIFIERS_MC_PATH_TO_ORIGINAL,
+ NULL,
+ IDENTIFIERS_MC_ID_MARKED_UP,
+ displaytext,
+ -1);
+ }
+ else
+ {
+ displaytext = g_strdup_printf ("%s", last_id);
+ gtk_tree_store_insert_with_values (uc->ts,
+ &iter,
+ uc->parent,
+ G_MAXINT,
+ IDENTIFIERS_MC_ID,
+ last_id,
+ IDENTIFIERS_MC_UPDATE_ID,
+ next_id,
+ IDENTIFIERS_MC_DESCRIPTION,
+ desc,
+ IDENTIFIERS_MC_PATH_TO_ORIGINAL,
+ NULL,
+ IDENTIFIERS_MC_ID_MARKED_UP,
+ displaytext,
+ -1);
+ }
+ g_free (displaytext);
+
+ if (NULL == spath)
+ {
GtkTreePath *path;
char *gspath;
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(uc->ts), &iter);
- spath = gtk_tree_path_to_string(path);
- gtk_tree_path_free(path);
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (uc->ts), &iter);
+ spath = gtk_tree_path_to_string (path);
+ gtk_tree_path_free (path);
/* for the sake of consistency, only put GNUNET_free'able things into the
* map */
- gspath = GNUNET_strdup(spath);
- if (GNUNET_SYSERR == GNUNET_CONTAINER_multihashmap_put(
- uc->seen, &hc, gspath,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
- GNUNET_free(gspath);
- } else
+ gspath = GNUNET_strdup (spath);
+ if (GNUNET_SYSERR == GNUNET_CONTAINER_multihashmap_put (
+ uc->seen,
+ &hc,
+ gspath,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
+ GNUNET_free (gspath);
+ }
+ else
return;
sc.parent = &iter;
@@ -2308,20 +2701,33 @@ static void add_updateable_to_ts(
sc.ns = uc->ns;
sc.seen = uc->seen;
sc.update_called = GNUNET_NO;
- GNUNET_FS_namespace_list_updateable(
- GNUNET_FS_GTK_get_fs_handle(),
- GNUNET_IDENTITY_ego_get_private_key(uc->ns), next_id,
- &add_updateable_to_ts, &sc);
+ GNUNET_FS_namespace_list_updateable (GNUNET_FS_GTK_get_fs_handle (),
+ GNUNET_IDENTITY_ego_get_private_key (
+ uc->ns),
+ next_id,
+ &add_updateable_to_ts,
+ &sc);
if ((sc.update_called == GNUNET_NO) && (NULL != next_id) &&
- (strlen(next_id) > 0)) {
+ (strlen (next_id) > 0))
+ {
/* add leaf */
- displaytext = g_strdup_printf("<b>%s</b>", next_id);
- gtk_tree_store_insert_with_values(
- uc->ts, &titer, &iter, G_MAXINT, IDENTIFIERS_MC_ID, next_id,
- IDENTIFIERS_MC_UPDATE_ID, NULL, IDENTIFIERS_MC_DESCRIPTION, NULL,
- IDENTIFIERS_MC_PATH_TO_ORIGINAL, NULL, IDENTIFIERS_MC_ID_MARKED_UP,
- displaytext, -1);
- g_free(displaytext);
+ displaytext = g_strdup_printf ("<b>%s</b>", next_id);
+ gtk_tree_store_insert_with_values (uc->ts,
+ &titer,
+ &iter,
+ G_MAXINT,
+ IDENTIFIERS_MC_ID,
+ next_id,
+ IDENTIFIERS_MC_UPDATE_ID,
+ NULL,
+ IDENTIFIERS_MC_DESCRIPTION,
+ NULL,
+ IDENTIFIERS_MC_PATH_TO_ORIGINAL,
+ NULL,
+ IDENTIFIERS_MC_ID_MARKED_UP,
+ displaytext,
+ -1);
+ g_free (displaytext);
}
}
@@ -2334,9 +2740,10 @@ static void add_updateable_to_ts(
* @param value value from the map
* @return #GNUNET_YES, always.
*/
-static int free_seen_paths(void *cls, const struct GNUNET_HashCode *key,
- void *value) {
- GNUNET_free_non_null(value);
+static int
+free_seen_paths (void *cls, const struct GNUNET_HashCode *key, void *value)
+{
+ GNUNET_free_non_null (value);
return GNUNET_YES;
}
@@ -2347,8 +2754,10 @@ static int free_seen_paths(void *cls, const struct
GNUNET_HashCode *key,
* @param combo the namespace selection combo box
* @param user_data the `struct MainPublishingDialogContext`
*/
-void GNUNET_GTK_master_publish_dialog_ego_combobox_changed_cb(
- GtkComboBox *combo, gpointer user_data) {
+void
+GNUNET_GTK_master_publish_dialog_ego_combobox_changed_cb (GtkComboBox *combo,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx = user_data;
GtkTreeIter iter;
GtkTreeStore *ts;
@@ -2356,27 +2765,31 @@ void
GNUNET_GTK_master_publish_dialog_ego_combobox_changed_cb(
struct GNUNET_IDENTITY_Ego *ego;
struct UpdateableContext uc;
- ts = GTK_TREE_STORE(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_update_identifiers_treestore"));
- gtk_tree_store_clear(ts);
- if (!gtk_combo_box_get_active_iter(combo, &iter)) {
+ ts = GTK_TREE_STORE (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_update_identifiers_treestore"));
+ gtk_tree_store_clear (ts);
+ if (! gtk_combo_box_get_active_iter (combo, &iter))
+ {
/* entry unselected, etc. */
ctx->ns = NULL;
- gtk_widget_set_sensitive(ctx->identifier_entry, FALSE);
- gtk_widget_set_sensitive(ctx->updateable_checkbox, FALSE);
- gtk_widget_set_sensitive(ctx->update_id_entry, FALSE);
- update_selectivity_execute_cancel(ctx);
+ gtk_widget_set_sensitive (ctx->identifier_entry, FALSE);
+ gtk_widget_set_sensitive (ctx->updateable_checkbox, FALSE);
+ gtk_widget_set_sensitive (ctx->update_id_entry, FALSE);
+ update_selectivity_execute_cancel (ctx);
return;
}
- tm = GTK_TREE_MODEL(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_ego_liststore"));
- gtk_tree_model_get(tm, &iter, EGO_MC_EGO, &ego, -1);
- if (NULL == ego) {
- GNUNET_break(0);
- gtk_widget_set_sensitive(ctx->identifier_entry, FALSE);
- gtk_widget_set_sensitive(ctx->updateable_checkbox, FALSE);
- gtk_widget_set_sensitive(ctx->update_id_entry, FALSE);
- update_selectivity_execute_cancel(ctx);
+ tm = GTK_TREE_MODEL (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_ego_liststore"));
+ gtk_tree_model_get (tm, &iter, EGO_MC_EGO, &ego, -1);
+ if (NULL == ego)
+ {
+ GNUNET_break (0);
+ gtk_widget_set_sensitive (ctx->identifier_entry, FALSE);
+ gtk_widget_set_sensitive (ctx->updateable_checkbox, FALSE);
+ gtk_widget_set_sensitive (ctx->update_id_entry, FALSE);
+ update_selectivity_execute_cancel (ctx);
return;
}
ctx->ns = ego;
@@ -2384,17 +2797,20 @@ void
GNUNET_GTK_master_publish_dialog_ego_combobox_changed_cb(
uc.ts = ts;
uc.ns = ego;
uc.update_called = GNUNET_NO;
- uc.seen = GNUNET_CONTAINER_multihashmap_create(128, GNUNET_NO);
-
- GNUNET_FS_namespace_list_updateable(GNUNET_FS_GTK_get_fs_handle(),
- GNUNET_IDENTITY_ego_get_private_key(ego),
- NULL, &add_updateable_to_ts, &uc);
- GNUNET_CONTAINER_multihashmap_iterate(uc.seen, &free_seen_paths, NULL);
- GNUNET_CONTAINER_multihashmap_destroy(uc.seen);
- gtk_widget_set_sensitive(ctx->identifier_entry, TRUE);
- gtk_widget_set_sensitive(ctx->updateable_checkbox, TRUE);
- gtk_widget_set_sensitive(ctx->update_id_entry, TRUE);
- update_selectivity_execute_cancel(ctx);
+ uc.seen = GNUNET_CONTAINER_multihashmap_create (128, GNUNET_NO);
+
+ GNUNET_FS_namespace_list_updateable (GNUNET_FS_GTK_get_fs_handle (),
+ GNUNET_IDENTITY_ego_get_private_key (
+ ego),
+ NULL,
+ &add_updateable_to_ts,
+ &uc);
+ GNUNET_CONTAINER_multihashmap_iterate (uc.seen, &free_seen_paths, NULL);
+ GNUNET_CONTAINER_multihashmap_destroy (uc.seen);
+ gtk_widget_set_sensitive (ctx->identifier_entry, TRUE);
+ gtk_widget_set_sensitive (ctx->updateable_checkbox, TRUE);
+ gtk_widget_set_sensitive (ctx->update_id_entry, TRUE);
+ update_selectivity_execute_cancel (ctx);
}
/**
@@ -2406,8 +2822,12 @@ void
GNUNET_GTK_master_publish_dialog_ego_combobox_changed_cb(
* @param ego_ctx where to store context data
* @param name name of the namespace to add
*/
-static void add_namespace_to_ts(void *cls, struct GNUNET_IDENTITY_Ego *ego,
- void **ego_ctx, const char *name) {
+static void
+add_namespace_to_ts (void *cls,
+ struct GNUNET_IDENTITY_Ego *ego,
+ void **ego_ctx,
+ const char *name)
+{
struct MainPublishingDialogContext *ctx = cls;
GtkListStore *ls;
GtkTreePath *path;
@@ -2417,38 +2837,50 @@ static void add_namespace_to_ts(void *cls, struct
GNUNET_IDENTITY_Ego *ego,
if (NULL == ego)
return; /* nothing to be done */
- ls = GTK_LIST_STORE(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_ego_liststore"));
+ ls = GTK_LIST_STORE (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_ego_liststore"));
rr = *ego_ctx;
- if (NULL == rr) {
+ if (NULL == rr)
+ {
/* insert operation */
- GNUNET_assert(NULL != name);
- gtk_list_store_insert_with_values(ls, &iter, G_MAXINT, EGO_MC_NAME, name,
- EGO_MC_EGO, ego, -1);
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(ls), &iter);
- rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(ls), path);
- gtk_tree_path_free(path);
+ GNUNET_assert (NULL != name);
+ gtk_list_store_insert_with_values (ls,
+ &iter,
+ G_MAXINT,
+ EGO_MC_NAME,
+ name,
+ EGO_MC_EGO,
+ ego,
+ -1);
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (ls), &iter);
+ rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ls), path);
+ gtk_tree_path_free (path);
*ego_ctx = rr;
- } else if (NULL == name) {
+ }
+ else if (NULL == name)
+ {
/* delete operation */
- path = gtk_tree_row_reference_get_path(rr);
- gtk_tree_row_reference_free(rr);
- GNUNET_assert(gtk_tree_model_get_iter(GTK_TREE_MODEL(ls), &iter, path));
- gtk_tree_path_free(path);
- gtk_list_store_remove(ls, &iter);
+ path = gtk_tree_row_reference_get_path (rr);
+ gtk_tree_row_reference_free (rr);
+ GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ls), &iter, path));
+ gtk_tree_path_free (path);
+ gtk_list_store_remove (ls, &iter);
*ego_ctx = NULL;
- } else {
+ }
+ else
+ {
/* rename operation */
- path = gtk_tree_row_reference_get_path(rr);
- GNUNET_assert(gtk_tree_model_get_iter(GTK_TREE_MODEL(ls), &iter, path));
- gtk_list_store_set(ls, &iter, G_MAXINT, EGO_MC_NAME, name, -1);
- gtk_tree_path_free(path);
- }
- have_ns = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(ls), &iter);
- gtk_widget_set_sensitive(ctx->own_checkbox, have_ns);
- gtk_widget_set_sensitive(ctx->identifier_entry, have_ns);
- gtk_widget_set_sensitive(ctx->updateable_checkbox, have_ns);
- gtk_widget_set_sensitive(ctx->update_id_entry, have_ns);
+ path = gtk_tree_row_reference_get_path (rr);
+ GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ls), &iter, path));
+ gtk_list_store_set (ls, &iter, G_MAXINT, EGO_MC_NAME, name, -1);
+ gtk_tree_path_free (path);
+ }
+ have_ns = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ls), &iter);
+ gtk_widget_set_sensitive (ctx->own_checkbox, have_ns);
+ gtk_widget_set_sensitive (ctx->identifier_entry, have_ns);
+ gtk_widget_set_sensitive (ctx->updateable_checkbox, have_ns);
+ gtk_widget_set_sensitive (ctx->update_id_entry, have_ns);
}
/**
@@ -2457,8 +2889,10 @@ static void add_namespace_to_ts(void *cls, struct
GNUNET_IDENTITY_Ego *ego,
* @param dummy widget that triggered the action
* @param user_data builder of the main window
*/
-void GNUNET_GTK_main_menu_file_publish_activate_cb(GtkWidget *dummy,
- gpointer user_data) {
+void
+GNUNET_GTK_main_menu_file_publish_activate_cb (GtkWidget *dummy,
+ gpointer user_data)
+{
struct MainPublishingDialogContext *ctx;
const struct GNUNET_CONFIGURATION_Handle *cfg;
GtkWidget *toplevel;
@@ -2466,111 +2900,137 @@ void
GNUNET_GTK_main_menu_file_publish_activate_cb(GtkWidget *dummy,
int own_enabled;
int global_enabled;
- ctx = GNUNET_new(struct MainPublishingDialogContext);
+ ctx = GNUNET_new (struct MainPublishingDialogContext);
ctx->builder =
- GNUNET_GTK_get_new_builder("gnunet_fs_gtk_publish_dialog.glade", ctx);
- if (NULL == ctx->builder) {
- GNUNET_break(0);
- GNUNET_free(ctx);
+ GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_publish_dialog.glade", ctx);
+ if (NULL == ctx->builder)
+ {
+ GNUNET_break (0);
+ GNUNET_free (ctx);
return;
}
/* initialize widget references */
- ctx->up_button = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_up_button"));
- ctx->down_button = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_down_button"));
- ctx->left_button = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_left_button"));
- ctx->right_button = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_right_button"));
- ctx->delete_button = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_delete_button"));
- ctx->edit_button = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_edit_button"));
- ctx->execute_button = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_execute_button"));
- ctx->cancel_button = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_cancel_button"));
- ctx->file_info_treeview = GTK_TREE_VIEW(gtk_builder_get_object(
- ctx->builder,
- "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
+ ctx->up_button = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_up_button"));
+ ctx->down_button = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_down_button"));
+ ctx->left_button = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_left_button"));
+ ctx->right_button = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_right_button"));
+ ctx->delete_button = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_delete_button"));
+ ctx->edit_button = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_edit_button"));
+ ctx->execute_button = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+
"GNUNET_GTK_master_publish_dialog_execute_button"));
+ ctx->cancel_button = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_cancel_button"));
+ ctx->file_info_treeview = GTK_TREE_VIEW (gtk_builder_get_object (
+ ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_file_information_tree_view"));
ctx->file_info_selection =
- gtk_tree_view_get_selection(ctx->file_info_treeview);
- ctx->file_info_treemodel = gtk_tree_view_get_model(ctx->file_info_treeview);
- ctx->master_pubdialog = GTK_WINDOW(
- gtk_builder_get_object(ctx->builder,
"GNUNET_GTK_master_publish_dialog"));
-
- ctx->global_checkbox = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_global_checkbox"));
- ctx->own_checkbox = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_own_checkbox"));
- ctx->updateable_checkbox = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_updateable_checkbox"));
- ctx->update_id_entry = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_update_id_entry"));
-
- ctx->own_vbox = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_own_vbox"));
- ctx->update_id_hbox = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_update_id_hbox"));
-
- ctx->identifiers_expander = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder,
- "GNUNET_GTK_master_publish_dialog_previous_identifiers_expander"));
- ctx->vpaned = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_vpaned"));
- ctx->bottom_frame = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_bottom_frame"));
-
- ctx->identifier_entry = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder, "GNUNET_GTK_master_publish_dialog_identifier_entry"));
- ctx->identifiers_scrolled = GTK_WIDGET(gtk_builder_get_object(
- ctx->builder,
- "GNUNET_GTK_master_publish_dialog_previous_identifiers_scrolled"));
- ctx->identifiers_treeview = GTK_TREE_VIEW(gtk_builder_get_object(
- ctx->builder,
- "GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview"));
+ gtk_tree_view_get_selection (ctx->file_info_treeview);
+ ctx->file_info_treemodel = gtk_tree_view_get_model (ctx->file_info_treeview);
+ ctx->master_pubdialog = GTK_WINDOW (
+ gtk_builder_get_object (ctx->builder, "GNUNET_GTK_master_publish_dialog"));
+
+ ctx->global_checkbox = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+
"GNUNET_GTK_master_publish_dialog_global_checkbox"));
+ ctx->own_checkbox = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_own_checkbox"));
+ ctx->updateable_checkbox = GTK_WIDGET (gtk_builder_get_object (
+ ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_updateable_checkbox"));
+ ctx->update_id_entry = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+
"GNUNET_GTK_master_publish_dialog_update_id_entry"));
+
+ ctx->own_vbox = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_own_vbox"));
+ ctx->update_id_hbox = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+
"GNUNET_GTK_master_publish_dialog_update_id_hbox"));
+
+ ctx->identifiers_expander = GTK_WIDGET (gtk_builder_get_object (
+ ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_previous_identifiers_expander"));
+ ctx->vpaned = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_vpaned"));
+ ctx->bottom_frame = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_bottom_frame"));
+
+ ctx->identifier_entry = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+
"GNUNET_GTK_master_publish_dialog_identifier_entry"));
+ ctx->identifiers_scrolled = GTK_WIDGET (gtk_builder_get_object (
+ ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_previous_identifiers_scrolled"));
+ ctx->identifiers_treeview = GTK_TREE_VIEW (gtk_builder_get_object (
+ ctx->builder,
+ "GNUNET_GTK_master_publish_dialog_previous_identifiers_treeview"));
ctx->identifiers_treemodel =
- gtk_tree_view_get_model(ctx->identifiers_treeview);
+ gtk_tree_view_get_model (ctx->identifiers_treeview);
ctx->identifiers_selection =
- gtk_tree_view_get_selection(ctx->identifiers_treeview);
+ gtk_tree_view_get_selection (ctx->identifiers_treeview);
- g_signal_connect(ctx->identifiers_expander, "notify::expanded",
- G_CALLBACK(expander_callback), ctx);
+ g_signal_connect (ctx->identifiers_expander,
+ "notify::expanded",
+ G_CALLBACK (expander_callback),
+ ctx);
- cfg = GNUNET_FS_GTK_get_configuration();
- ctx->identity = GNUNET_IDENTITY_connect(cfg, &add_namespace_to_ts, ctx);
+ cfg = GNUNET_FS_GTK_get_configuration ();
+ ctx->identity = GNUNET_IDENTITY_connect (cfg, &add_namespace_to_ts, ctx);
- updateable_enabled = GNUNET_CONFIGURATION_get_value_yesno(
- cfg, "gnunet-fs-gtk", "MAKE_UPDATEABLE_PUBLICATIONS_BY_DEFAULT");
+ updateable_enabled = GNUNET_CONFIGURATION_get_value_yesno (
+ cfg,
+ "gnunet-fs-gtk",
+ "MAKE_UPDATEABLE_PUBLICATIONS_BY_DEFAULT");
if (GNUNET_SYSERR == updateable_enabled)
updateable_enabled = GNUNET_YES;
- own_enabled = GNUNET_CONFIGURATION_get_value_yesno(
- cfg, "gnunet-fs-gtk", "MAKE_NAMESPACE_PUBLICATIONS_BY_DEFAULT");
+ own_enabled =
+ GNUNET_CONFIGURATION_get_value_yesno (cfg,
+ "gnunet-fs-gtk",
+
"MAKE_NAMESPACE_PUBLICATIONS_BY_DEFAULT");
if (GNUNET_SYSERR == own_enabled)
own_enabled = GNUNET_NO;
- global_enabled = GNUNET_CONFIGURATION_get_value_yesno(
- cfg, "gnunet-fs-gtk", "MAKE_GLOBAL_PUBLICATIONS_BY_DEFAULT");
+ global_enabled =
+ GNUNET_CONFIGURATION_get_value_yesno (cfg,
+ "gnunet-fs-gtk",
+
"MAKE_GLOBAL_PUBLICATIONS_BY_DEFAULT");
if (GNUNET_SYSERR == global_enabled)
global_enabled = GNUNET_YES;
/* This will emit appropriate signals, their handlers will hide
* parts of the dialog as needed.
*/
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ctx->updateable_checkbox),
- GNUNET_YES == updateable_enabled);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ctx->own_checkbox),
- GNUNET_YES == own_enabled);
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ctx->global_checkbox),
- GNUNET_YES == global_enabled);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctx->updateable_checkbox),
+ GNUNET_YES == updateable_enabled);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctx->own_checkbox),
+ GNUNET_YES == own_enabled);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ctx->global_checkbox),
+ GNUNET_YES == global_enabled);
/* show dialog */
- toplevel = gtk_widget_get_toplevel(dummy);
- if (GTK_IS_WINDOW(toplevel))
- gtk_window_set_transient_for(GTK_WINDOW(ctx->master_pubdialog),
- GTK_WINDOW(toplevel));
- gtk_window_present(GTK_WINDOW(ctx->master_pubdialog));
+ toplevel = gtk_widget_get_toplevel (dummy);
+ if (GTK_IS_WINDOW (toplevel))
+ gtk_window_set_transient_for (GTK_WINDOW (ctx->master_pubdialog),
+ GTK_WINDOW (toplevel));
+ gtk_window_present (GTK_WINDOW (ctx->master_pubdialog));
}
/* end of gnunet-fs-gtk_publish-dialog.c */
diff --git a/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
b/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
index 7f7f2bd2..b988fc3a 100644
--- a/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
+++ b/src/fs/gnunet-fs-gtk_publish-edit-dialog.c
@@ -33,93 +33,93 @@
* Columns in the publication metadata model.
*/
enum PUBLISH_MetadataModelColumns
- {
- /**
+{
+ /**
* A guint.
*/
- PUBLISH_METADATA_MC_TYPE = 0,
+ PUBLISH_METADATA_MC_TYPE = 0,
- /**
+ /**
* A guint.
*/
- PUBLISH_METADATA_MC_FORMAT = 1,
+ PUBLISH_METADATA_MC_FORMAT = 1,
- /**
+ /**
* A gchararray.
*/
- PUBLISH_METADATA_MC_TYPE_NAME = 2,
+ PUBLISH_METADATA_MC_TYPE_NAME = 2,
- /**
+ /**
* A gchararray.
*/
- PUBLISH_METADATA_MC_VALUE = 3,
+ PUBLISH_METADATA_MC_VALUE = 3,
- /**
+ /**
* A gchararray.
*/
- PUBLISH_METADATA_MC_DESCRIPTION = 4,
- };
+ PUBLISH_METADATA_MC_DESCRIPTION = 4,
+};
/**
* Columns in the publication metadata types model.
*/
enum PUBLISH_MetadataTypesModelColumns
- {
- /**
+{
+ /**
* A gint.
*/
- PUBLISH_METADATA_TYPES_MC_TYPE = 0,
+ PUBLISH_METADATA_TYPES_MC_TYPE = 0,
- /**
+ /**
* A gint.
*/
- PUBLISH_METADATA_TYPES_MC_FORMAT = 1,
+ PUBLISH_METADATA_TYPES_MC_FORMAT = 1,
- /**
+ /**
* A gchararray.
*/
- PUBLISH_METADATA_TYPES_MC_TYPE_NAME = 2,
+ PUBLISH_METADATA_TYPES_MC_TYPE_NAME = 2,
- /**
+ /**
* A gchararray.
*/
- PUBLISH_METADATA_TYPES_MC_DESCRIPTION = 3
- };
+ PUBLISH_METADATA_TYPES_MC_DESCRIPTION = 3
+};
/**
* Columns in the publication types model.
*/
enum PUBLISH_TypesModelColumns
- {
- /**
+{
+ /**
* A gint.
*/
- PUBLISH_TYPES_MC_TYPE = 0,
+ PUBLISH_TYPES_MC_TYPE = 0,
- /**
+ /**
* A gchararray.
*/
- PUBLISH_TYPES_MC_TYPE_NAME = 1
- };
+ PUBLISH_TYPES_MC_TYPE_NAME = 1
+};
/**
* Columns in the publication keywords model.
*/
enum PUBLISH_KeywordsModelColumns
- {
- /**
+{
+ /**
* A gchararray.
*/
- PUBLISH_TYPES_MC_KEYWORD = 0,
+ PUBLISH_TYPES_MC_KEYWORD = 0,
- /**
+ /**
* A gboolean.
*/
- PUBLISH_TYPES_MC_ADDED = 1
- };
+ PUBLISH_TYPES_MC_ADDED = 1
+};
/**
@@ -259,7 +259,6 @@ struct EditPublicationDialogContext
* Is it allowed for the user to supply keywords in this dialog?
*/
int allow_no_keywords;
-
};
@@ -277,11 +276,9 @@ free_edit_dialog_context (struct
EditPublicationDialogContext *ctx)
}
-
/* ****************** metadata editing ******************** */
-
/**
* Update the set of metatypes listed in the dialog based on the
* given code.
@@ -300,7 +297,8 @@ change_metatypes (struct EditPublicationDialogContext *ctx,
gint code)
#endif
/* double-check that 'code' is valid */
- for (pubtype_count = 0; NULL != types[pubtype_count]; pubtype_count++) ;
+ for (pubtype_count = 0; NULL != types[pubtype_count]; pubtype_count++)
+ ;
GNUNET_assert (code < pubtype_count);
/* clear existing selection of metatypes */
@@ -309,19 +307,20 @@ change_metatypes (struct EditPublicationDialogContext
*ctx, gint code)
max_type = EXTRACTOR_metatype_get_max ();
/* add new types based on selection */
for (i = 0; types[code][i] != EXTRACTOR_METATYPE_RESERVED; i++)
- if ( (types[code][i] < max_type) && (types[code][i] > 0) )
+ if ((types[code][i] < max_type) && (types[code][i] > 0))
gtk_list_store_insert_with_values (ctx->metatypes_liststore,
- &iter, G_MAXINT,
+ &iter,
+ G_MAXINT,
PUBLISH_METADATA_TYPES_MC_TYPE,
types[code][i],
PUBLISH_METADATA_TYPES_MC_FORMAT,
EXTRACTOR_METAFORMAT_UTF8,
PUBLISH_METADATA_TYPES_MC_TYPE_NAME,
- EXTRACTOR_metatype_to_string
- (types [code][i]),
+ EXTRACTOR_metatype_to_string (
+ types[code][i]),
PUBLISH_METADATA_TYPES_MC_DESCRIPTION,
- EXTRACTOR_metatype_to_description
- (types[code][i]),
+ EXTRACTOR_metatype_to_description (
+ types[code][i]),
-1);
#endif
}
@@ -335,7 +334,7 @@ change_metatypes (struct EditPublicationDialogContext *ctx,
gint code)
* @param user_data the 'struct EditPublicationDialogContext'
*/
void
-GNUNET_GTK_edit_publication_type_combo_changed_cb (GtkComboBox * widget,
+GNUNET_GTK_edit_publication_type_combo_changed_cb (GtkComboBox *widget,
gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
@@ -344,8 +343,11 @@ GNUNET_GTK_edit_publication_type_combo_changed_cb
(GtkComboBox * widget,
if (! gtk_combo_box_get_active_iter (widget, &iter))
return;
- gtk_tree_model_get (GTK_TREE_MODEL (ctx->pubtypes_liststore), &iter,
- PUBLISH_TYPES_MC_TYPE, &code, -1);
+ gtk_tree_model_get (GTK_TREE_MODEL (ctx->pubtypes_liststore),
+ &iter,
+ PUBLISH_TYPES_MC_TYPE,
+ &code,
+ -1);
change_metatypes (ctx, code);
}
@@ -358,14 +360,15 @@ GNUNET_GTK_edit_publication_type_combo_changed_cb
(GtkComboBox * widget,
* @param user_data the 'struct EditPublicationDialogContext'
*/
void
-GNUNET_GTK_edit_publication_metadata_treeview_selection_changed_cb
(GtkTreeSelection *ts,
- gpointer user_data)
+GNUNET_GTK_edit_publication_metadata_treeview_selection_changed_cb (
+ GtkTreeSelection *ts,
+ gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object
- (ctx->builder,
-
"GNUNET_GTK_edit_publication_delete_button")),
+ gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (
+ ctx->builder,
+ "GNUNET_GTK_edit_publication_delete_button")),
gtk_tree_selection_get_selected (ts, NULL, NULL));
}
@@ -381,18 +384,20 @@
GNUNET_GTK_edit_publication_metadata_treeview_selection_changed_cb (GtkTreeSelec
* @param user_data the 'struct EditPublicationDialogContext'
*/
void
-GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_edited_cb
(GtkCellRendererText *renderer,
- gchar *
path,
- gchar *
new_text,
-
gpointer user_data)
+GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_edited_cb (
+ GtkCellRendererText *renderer,
+ gchar *path,
+ gchar *new_text,
+ gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
GtkTreeIter iter;
gint type_id;
- if (! gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL
(ctx->meta_liststore),
- &iter,
- path))
+ if (! gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (
+ ctx->meta_liststore),
+ &iter,
+ path))
{
GNUNET_break (0);
return;
@@ -404,9 +409,12 @@
GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_edited_cb (GtkCellR
}
type_id = ctx->meta_combo_selected_type_id;
ctx->meta_combo_selected_type_id = -1;
- gtk_list_store_set (ctx->meta_liststore, &iter,
- PUBLISH_METADATA_MC_TYPE, type_id,
- PUBLISH_METADATA_MC_FORMAT, EXTRACTOR_METAFORMAT_UTF8,
+ gtk_list_store_set (ctx->meta_liststore,
+ &iter,
+ PUBLISH_METADATA_MC_TYPE,
+ type_id,
+ PUBLISH_METADATA_MC_FORMAT,
+ EXTRACTOR_METAFORMAT_UTF8,
#if HAVE_EXTRACTOR
PUBLISH_METADATA_MC_TYPE_NAME,
EXTRACTOR_metatype_to_string (type_id),
@@ -429,19 +437,21 @@
GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_edited_cb (GtkCellR
* @param user_data the 'struct EditPublicationDialogContext'
*/
void
-GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_changed_cb
(GtkCellRendererCombo * combo,
- gchar
* path_string,
-
GtkTreeIter * new_iter,
-
gpointer user_data)
+GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_changed_cb (
+ GtkCellRendererCombo *combo,
+ gchar *path_string,
+ GtkTreeIter *new_iter,
+ gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
GtkTreeModel *combo_model;
gint type_id;
- g_object_get (combo,
- "model", &combo_model, NULL);
- gtk_tree_model_get (combo_model, new_iter,
- PUBLISH_METADATA_MC_TYPE, &type_id,
+ g_object_get (combo, "model", &combo_model, NULL);
+ gtk_tree_model_get (combo_model,
+ new_iter,
+ PUBLISH_METADATA_MC_TYPE,
+ &type_id,
-1);
ctx->meta_combo_selected_type_id = type_id;
}
@@ -458,10 +468,11 @@
GNUNET_GTK_edit_publication_metadata_tree_view_type_renderer_changed_cb (GtkCell
* @param user_data the 'struct EditPublicationDialogContext'
*/
void
-GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb
(GtkCellRendererText * renderer,
- gchar
* path,
- gchar
* new_text,
-
gpointer user_data)
+GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb (
+ GtkCellRendererText *renderer,
+ gchar *path,
+ gchar *new_text,
+ gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
GtkTreeIter iter;
@@ -471,16 +482,20 @@
GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb (GtkCell
size_t slen;
char *pos;
- if (! gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL
(ctx->meta_liststore),
- &iter,
- path))
+ if (! gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (
+ ctx->meta_liststore),
+ &iter,
+ path))
{
GNUNET_break (0);
return;
}
- gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter,
- PUBLISH_METADATA_MC_TYPE, &metatype, -1);
+ gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore),
+ &iter,
+ PUBLISH_METADATA_MC_TYPE,
+ &metatype,
+ -1);
if (metatype == EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME)
{
/* apply filename rules */
@@ -491,17 +506,17 @@
GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb (GtkCell
/* if user put '/' at the end, remove it' */
slen = strlen (avalue);
- while ( (slen > 1) && (avalue[slen - 1] == '\\'))
+ while ((slen > 1) && (avalue[slen - 1] == '\\'))
{
avalue[slen - 1] = '\0';
slen--;
}
/* However, directories must end with '/', so add it */
- if ( (new_text[strlen (new_text) - 1] != '/') &&
- ctx->is_directory == GNUNET_YES)
+ if ((new_text[strlen (new_text) - 1] != '/') &&
+ ctx->is_directory == GNUNET_YES)
{
- char * tmp;
+ char *tmp;
GNUNET_asprintf (&tmp, "%s/", avalue);
GNUNET_free (avalue);
@@ -519,8 +534,10 @@
GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb (GtkCell
ivalue = new_text;
avalue = NULL;
}
- gtk_list_store_set (ctx->meta_liststore, &iter,
- PUBLISH_METADATA_MC_VALUE, ivalue,
+ gtk_list_store_set (ctx->meta_liststore,
+ &iter,
+ PUBLISH_METADATA_MC_VALUE,
+ ivalue,
-1);
GNUNET_free_non_null (avalue);
}
@@ -534,22 +551,25 @@
GNUNET_GTK_edit_publication_metadata_tree_view_value_renderer_edited_cb (GtkCell
* @param user_data the 'struct EditPublicationDialogContext'
*/
void
-GNUNET_GTK_edit_publication_add_button_clicked_cb (GtkButton * button,
+GNUNET_GTK_edit_publication_add_button_clicked_cb (GtkButton *button,
gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
GtkTreeIter iter;
gtk_list_store_insert_with_values (ctx->meta_liststore,
- &iter, 0,
- PUBLISH_METADATA_MC_TYPE, 0,
+ &iter,
+ 0,
+ PUBLISH_METADATA_MC_TYPE,
+ 0,
PUBLISH_METADATA_MC_FORMAT,
EXTRACTOR_METAFORMAT_UTF8,
PUBLISH_METADATA_MC_TYPE_NAME,
- _("Select a type"),
+ _ ("Select a type"),
PUBLISH_METADATA_MC_VALUE,
- _("Specify a value"),
- PUBLISH_METADATA_MC_DESCRIPTION, NULL,
+ _ ("Specify a value"),
+ PUBLISH_METADATA_MC_DESCRIPTION,
+ NULL,
-1);
}
@@ -562,7 +582,7 @@ GNUNET_GTK_edit_publication_add_button_clicked_cb
(GtkButton * button,
* @param user_data the 'struct EditPublicationDialogContext'
*/
void
-GNUNET_GTK_edit_publication_delete_button_clicked_cb (GtkButton * button,
+GNUNET_GTK_edit_publication_delete_button_clicked_cb (GtkButton *button,
gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
@@ -588,8 +608,9 @@ GNUNET_GTK_edit_publication_delete_button_clicked_cb
(GtkButton * button,
* @param user_data the 'struct EditPublicationDialogContext'
*/
void
-GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button_file_set_cb
(GtkFileChooserButton * widget,
-
gpointer user_data)
+GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button_file_set_cb (
+ GtkFileChooserButton *widget,
+ gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
gchar *fn;
@@ -604,7 +625,6 @@
GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button_file_set_cb (Gt
/* ****************** keyword list editing ******************** */
-
/**
* The user has changed the selection in the keyword tree view.
* Update the sensitivity of the 'delete' button.
@@ -613,15 +633,17 @@
GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button_file_set_cb (Gt
* @param user_data the 'struct EditPublicationDialogContext'
*/
void
-GNUNET_GTK_edit_publication_keyword_list_treeview_selection_changed_cb
(GtkTreeSelection *ts,
- gpointer user_data)
+GNUNET_GTK_edit_publication_keyword_list_treeview_selection_changed_cb (
+ GtkTreeSelection *ts,
+ gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object
- (ctx->builder,
-
"GNUNET_GTK_edit_publication_keyword_list_del_button")),
- gtk_tree_selection_get_selected (ts, NULL, NULL));
+ gtk_widget_set_sensitive (
+ GTK_WIDGET (gtk_builder_get_object (
+ ctx->builder,
+ "GNUNET_GTK_edit_publication_keyword_list_del_button")),
+ gtk_tree_selection_get_selected (ts, NULL, NULL));
}
@@ -633,16 +655,18 @@
GNUNET_GTK_edit_publication_keyword_list_treeview_selection_changed_cb (GtkTreeS
* @param user_data the 'struct EditPublicationDialogContext'
*/
void
-GNUNET_GTK_edit_publication_keyword_entry_changed_cb (GtkEditable * editable,
+GNUNET_GTK_edit_publication_keyword_entry_changed_cb (GtkEditable *editable,
gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
const char *keyword;
keyword = gtk_entry_get_text (ctx->keyword_entry);
- gtk_widget_set_sensitive (GTK_WIDGET (gtk_builder_get_object (ctx->builder,
-
"GNUNET_GTK_edit_publication_keyword_list_add_button")),
- (strlen (keyword) > 0) ? TRUE : FALSE);
+ gtk_widget_set_sensitive (
+ GTK_WIDGET (gtk_builder_get_object (
+ ctx->builder,
+ "GNUNET_GTK_edit_publication_keyword_list_add_button")),
+ (strlen (keyword) > 0) ? TRUE : FALSE);
}
@@ -658,9 +682,10 @@ update_confirm_sensitivity (struct
EditPublicationDialogContext *ctx)
{
GtkTreeIter iter;
- if ( (! ctx->allow_no_keywords) &&
- (! gtk_tree_model_get_iter_first (GTK_TREE_MODEL
(ctx->keywords_liststore),
- &iter)) )
+ if ((! ctx->allow_no_keywords) &&
+ (! gtk_tree_model_get_iter_first (GTK_TREE_MODEL (
+ ctx->keywords_liststore),
+ &iter)))
gtk_widget_set_sensitive (ctx->confirm_button, FALSE);
else
gtk_widget_set_sensitive (ctx->confirm_button, TRUE);
@@ -675,9 +700,9 @@ update_confirm_sensitivity (struct
EditPublicationDialogContext *ctx)
* @param user_data the 'struct EditPublicationDialogContext'
*/
void
-GNUNET_GTK_edit_publication_keyword_list_del_button_clicked_cb (GtkButton *
- button,
- gpointer
user_data)
+GNUNET_GTK_edit_publication_keyword_list_del_button_clicked_cb (
+ GtkButton *button,
+ gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
GtkTreeIter iter;
@@ -705,9 +730,9 @@
GNUNET_GTK_edit_publication_keyword_list_del_button_clicked_cb (GtkButton *
* @param user_data the 'struct EditPublicationDialogContext'
*/
void
-GNUNET_GTK_edit_publication_keyword_list_add_button_clicked_cb (GtkButton *
- button,
- gpointer
user_data)
+GNUNET_GTK_edit_publication_keyword_list_add_button_clicked_cb (
+ GtkButton *button,
+ gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
const char *keyword;
@@ -717,9 +742,12 @@
GNUNET_GTK_edit_publication_keyword_list_add_button_clicked_cb (GtkButton *
if (strlen (keyword) == 0)
return;
gtk_list_store_insert_with_values (ctx->keywords_liststore,
- &iter, G_MAXINT,
- PUBLISH_TYPES_MC_KEYWORD, keyword,
- PUBLISH_TYPES_MC_ADDED, TRUE,
+ &iter,
+ G_MAXINT,
+ PUBLISH_TYPES_MC_KEYWORD,
+ keyword,
+ PUBLISH_TYPES_MC_ADDED,
+ TRUE,
-1);
gtk_entry_set_text (ctx->keyword_entry, "");
update_confirm_sensitivity (ctx);
@@ -736,11 +764,10 @@
GNUNET_GTK_edit_publication_keyword_list_add_button_clicked_cb (GtkButton *
* @return TRUE if we handled the event, FALSE if not
*/
gboolean
-GNUNET_GTK_edit_publication_keyword_entry_key_press_event_cb (GtkWidget *
- widget,
- GdkEventKey *
- event,
- gpointer
user_data)
+GNUNET_GTK_edit_publication_keyword_entry_key_press_event_cb (
+ GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
@@ -751,7 +778,6 @@
GNUNET_GTK_edit_publication_keyword_entry_key_press_event_cb (GtkWidget *
}
-
/* ****************** handlers for closing the dialog ******************** */
@@ -762,7 +788,7 @@
GNUNET_GTK_edit_publication_keyword_entry_key_press_event_cb (GtkWidget *
* @param user_data the 'struct EditPublicationDialogContext'
*/
void
-GNUNET_GTK_edit_publication_cancel_button_clicked_cb (GtkButton * button,
+GNUNET_GTK_edit_publication_cancel_button_clicked_cb (GtkButton *button,
gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
@@ -781,8 +807,8 @@ GNUNET_GTK_edit_publication_cancel_button_clicked_cb
(GtkButton * button,
* @return TRUE (always)
*/
gboolean
-GNUNET_GTK_edit_publication_window_delete_event_cb (GtkWidget * widget,
- GdkEvent * event,
+GNUNET_GTK_edit_publication_window_delete_event_cb (GtkWidget *widget,
+ GdkEvent *event,
gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
@@ -819,10 +845,12 @@ GNUNET_GTK_edit_publication_window_delete_event_cb
(GtkWidget * widget,
* @return 0 to continue extracting
*/
static int
-preserve_meta_items (void *cls, const char *plugin_name,
+preserve_meta_items (void *cls,
+ const char *plugin_name,
enum EXTRACTOR_MetaType type,
enum EXTRACTOR_MetaFormat format,
- const char *data_mime_type, const char *data,
+ const char *data_mime_type,
+ const char *data,
size_t data_len)
{
struct EditPublicationDialogContext *ctx = cls;
@@ -837,14 +865,20 @@ preserve_meta_items (void *cls, const char *plugin_name,
{
case EXTRACTOR_METAFORMAT_UTF8:
case EXTRACTOR_METAFORMAT_C_STRING:
- if (TRUE == gtk_tree_model_get_iter_first (GTK_TREE_MODEL
(ctx->meta_liststore), &iter))
+ if (TRUE ==
+ gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ctx->meta_liststore),
+ &iter))
{
do
{
- gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter,
- PUBLISH_METADATA_MC_TYPE, &ntype,
- PUBLISH_METADATA_MC_FORMAT, &nformat,
- PUBLISH_METADATA_MC_VALUE, &value,
+ gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore),
+ &iter,
+ PUBLISH_METADATA_MC_TYPE,
+ &ntype,
+ PUBLISH_METADATA_MC_FORMAT,
+ &nformat,
+ PUBLISH_METADATA_MC_VALUE,
+ &value,
-1);
if ((ntype == type) && (nformat == format) &&
(0 == strcmp (value, data)))
@@ -855,8 +889,9 @@ preserve_meta_items (void *cls, const char *plugin_name,
break;
}
g_free (value);
- }
- while (TRUE == gtk_tree_model_iter_next (GTK_TREE_MODEL
(ctx->meta_liststore), &iter));
+ } while (
+ TRUE ==
+ gtk_tree_model_iter_next (GTK_TREE_MODEL (ctx->meta_liststore),
&iter));
}
break;
case EXTRACTOR_METAFORMAT_UNKNOWN:
@@ -871,9 +906,13 @@ preserve_meta_items (void *cls, const char *plugin_name,
}
if (GNUNET_YES == keep)
GNUNET_break (GNUNET_OK ==
- GNUNET_CONTAINER_meta_data_insert (ctx->md, plugin_name,
type,
- format, data_mime_type,
- data, data_len));
+ GNUNET_CONTAINER_meta_data_insert (ctx->md,
+ plugin_name,
+ type,
+ format,
+ data_mime_type,
+ data,
+ data_len));
return 0;
}
@@ -898,17 +937,17 @@ preserve_meta_items (void *cls, const char *plugin_name,
*/
static int
le_callback (void *cls,
- const char *plugin_name,
- enum EXTRACTOR_MetaType type,
- enum EXTRACTOR_MetaFormat format,
- const char *data_mime_type,
- const char *data,
- size_t data_len)
+ const char *plugin_name,
+ enum EXTRACTOR_MetaType type,
+ enum EXTRACTOR_MetaFormat format,
+ const char *data_mime_type,
+ const char *data,
+ size_t data_len)
{
char **ret = cls;
- if ( (EXTRACTOR_METATYPE_MIMETYPE == type) &&
- (EXTRACTOR_METAFORMAT_BINARY != format) )
+ if ((EXTRACTOR_METATYPE_MIMETYPE == type) &&
+ (EXTRACTOR_METAFORMAT_BINARY != format))
{
*ret = GNUNET_strdup (data);
return 1;
@@ -925,24 +964,18 @@ le_callback (void *cls,
* @param data_size number of bytes in 'data'
*/
static char *
-get_mime_type (const void *data,
- gsize data_size)
+get_mime_type (const void *data, gsize data_size)
{
#if HAVE_EXTRACTOR
char *ret;
struct EXTRACTOR_PluginList *pl;
- pl = EXTRACTOR_plugin_add (NULL,
- "mime",
- NULL,
- EXTRACTOR_OPTION_DEFAULT_POLICY);
+ pl =
+ EXTRACTOR_plugin_add (NULL, "mime", NULL, EXTRACTOR_OPTION_DEFAULT_POLICY);
if (NULL == pl)
return NULL;
ret = NULL;
- EXTRACTOR_extract (pl,
- NULL,
- data, data_size,
- &le_callback, &ret);
+ EXTRACTOR_extract (pl, NULL, data, data_size, &le_callback, &ret);
EXTRACTOR_plugin_remove_all (pl);
return ret;
#else
@@ -966,11 +999,13 @@ get_mime_type (const void *data,
* @return #GNUNET_SYSERR (aborts after first call)
*/
static int
-file_information_update (void *cls, struct GNUNET_FS_FileInformation *fi,
+file_information_update (void *cls,
+ struct GNUNET_FS_FileInformation *fi,
uint64_t length,
struct GNUNET_CONTAINER_MetaData *meta,
struct GNUNET_FS_Uri **uri,
- struct GNUNET_FS_BlockOptions *bo, int *do_index,
+ struct GNUNET_FS_BlockOptions *bo,
+ int *do_index,
void **client_info)
{
struct EditPublicationDialogContext *ctx = cls;
@@ -979,8 +1014,9 @@ file_information_update (void *cls, struct
GNUNET_FS_FileInformation *fi,
/* gather publishing options */
*do_index = gtk_toggle_button_get_active (ctx->index_checkbutton);
- GNUNET_break (GNUNET_GTK_get_selected_anonymity_combo_level
(ctx->anonymity_combo,
-
&bo->anonymity_level));
+ GNUNET_break (
+ GNUNET_GTK_get_selected_anonymity_combo_level (ctx->anonymity_combo,
+ &bo->anonymity_level));
bo->content_priority = gtk_spin_button_get_value (ctx->priority_spin);
bo->replication_level = gtk_spin_button_get_value (ctx->replication_spin);
year = gtk_spin_button_get_value (ctx->expiration_year_spin);
@@ -990,29 +1026,30 @@ file_information_update (void *cls, struct
GNUNET_FS_FileInformation *fi,
if (NULL != (*uri))
GNUNET_FS_uri_destroy (*uri);
*uri = NULL;
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ctx->keywords_liststore),
&iter))
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ctx->keywords_liststore),
+ &iter))
{
do
{
gchar *value;
- gtk_tree_model_get (GTK_TREE_MODEL (ctx->keywords_liststore), &iter,
- PUBLISH_TYPES_MC_KEYWORD, &value,
+ gtk_tree_model_get (GTK_TREE_MODEL (ctx->keywords_liststore),
+ &iter,
+ PUBLISH_TYPES_MC_KEYWORD,
+ &value,
-1);
if (NULL == *uri)
- *uri = GNUNET_FS_uri_ksk_create_from_args (1, (const char **) &value);
+ *uri = GNUNET_FS_uri_ksk_create_from_args (1, (const char **) &value);
else
- GNUNET_FS_uri_ksk_add_keyword (*uri, value, GNUNET_NO);
+ GNUNET_FS_uri_ksk_add_keyword (*uri, value, GNUNET_NO);
g_free (value);
- }
- while (gtk_tree_model_iter_next (GTK_TREE_MODEL (ctx->keywords_liststore),
&iter));
+ } while (gtk_tree_model_iter_next (GTK_TREE_MODEL
(ctx->keywords_liststore),
+ &iter));
}
/* update meta data; first, we copy the unchanged values from the original
meta data */
ctx->md = GNUNET_CONTAINER_meta_data_create ();
- GNUNET_CONTAINER_meta_data_iterate (meta,
- &preserve_meta_items,
- ctx);
+ GNUNET_CONTAINER_meta_data_iterate (meta, &preserve_meta_items, ctx);
/* clear original meta data */
GNUNET_CONTAINER_meta_data_clear (meta);
/* add all of the 'preserved' values */
@@ -1021,7 +1058,8 @@ file_information_update (void *cls, struct
GNUNET_FS_FileInformation *fi,
ctx->md = NULL;
/* now add all of the values from the model; adding will simply do
nothing for values that are already in the set because they were
preserved */
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ctx->meta_liststore),
&iter))
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (ctx->meta_liststore),
+ &iter))
{
do
{
@@ -1029,20 +1067,28 @@ file_information_update (void *cls, struct
GNUNET_FS_FileInformation *fi,
guint nformat;
gchar *value;
- gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore), &iter,
- PUBLISH_METADATA_MC_TYPE, &ntype,
- PUBLISH_METADATA_MC_FORMAT, &nformat,
- PUBLISH_METADATA_MC_VALUE, &value,
+ gtk_tree_model_get (GTK_TREE_MODEL (ctx->meta_liststore),
+ &iter,
+ PUBLISH_METADATA_MC_TYPE,
+ &ntype,
+ PUBLISH_METADATA_MC_FORMAT,
+ &nformat,
+ PUBLISH_METADATA_MC_VALUE,
+ &value,
-1);
if (ntype > 0)
{
- GNUNET_CONTAINER_meta_data_insert (meta, "<user>", ntype, nformat,
- "text/plain", value,
+ GNUNET_CONTAINER_meta_data_insert (meta,
+ "<user>",
+ ntype,
+ nformat,
+ "text/plain",
+ value,
strlen (value) + 1);
}
g_free (value);
- }
- while (gtk_tree_model_iter_next (GTK_TREE_MODEL (ctx->meta_liststore),
&iter));
+ } while (
+ gtk_tree_model_iter_next (GTK_TREE_MODEL (ctx->meta_liststore), &iter));
}
/* finally, if we got a new preview, add it as well */
@@ -1054,15 +1100,16 @@ file_information_update (void *cls, struct
GNUNET_FS_FileInformation *fi,
char *mime;
GFile *f;
- fn = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER
- (gtk_builder_get_object
- (ctx->builder,
-
"GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button")));
+ fn =
+ gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (gtk_builder_get_object (
+ ctx->builder,
+ "GNUNET_GTK_edit_publication_metadata_preview_file_chooser_button")));
f = g_file_new_for_path (fn);
if (! g_file_load_contents (f, NULL, &data, &data_size, NULL, NULL))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Could not load preview `%s' into memory\n"), fn);
+ _ ("Could not load preview `%s' into memory\n"),
+ fn);
}
else
{
@@ -1070,29 +1117,36 @@ file_information_update (void *cls, struct
GNUNET_FS_FileInformation *fi,
#if LINUX
if (NULL == mime)
{
- /* fall back to Gtk mime-detection; this only works on GNU */
- GFileInfo *finfo;
- const char *gmime;
-
- finfo = g_file_query_info (f, G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
- 0, NULL, NULL);
- gmime = g_file_info_get_attribute_string (finfo,
-
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
- if (NULL != gmime)
- mime = GNUNET_strdup (gmime);
- g_object_unref (finfo);
+ /* fall back to Gtk mime-detection; this only works on GNU */
+ GFileInfo *finfo;
+ const char *gmime;
+
+ finfo = g_file_query_info (f,
+ G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
+ 0,
+ NULL,
+ NULL);
+ gmime =
+ g_file_info_get_attribute_string (finfo,
+
G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
+ if (NULL != gmime)
+ mime = GNUNET_strdup (gmime);
+ g_object_unref (finfo);
}
#endif
- GNUNET_CONTAINER_meta_data_insert (meta, "<user>",
+ GNUNET_CONTAINER_meta_data_insert (meta,
+ "<user>",
EXTRACTOR_METATYPE_THUMBNAIL,
- EXTRACTOR_METAFORMAT_BINARY, mime,
- data, data_size);
+ EXTRACTOR_METAFORMAT_BINARY,
+ mime,
+ data,
+ data_size);
GNUNET_free_non_null (mime);
}
g_object_unref (f);
g_free (fn);
}
- return GNUNET_SYSERR; /* only visit top-level item */
+ return GNUNET_SYSERR; /* only visit top-level item */
}
@@ -1105,29 +1159,23 @@ file_information_update (void *cls, struct
GNUNET_FS_FileInformation *fi,
* @param user_data the 'struct EditPublicationDialogContext'
*/
void
-GNUNET_GTK_edit_publication_confirm_button_clicked_cb (GtkButton * button,
+GNUNET_GTK_edit_publication_confirm_button_clicked_cb (GtkButton *button,
gpointer user_data)
{
struct EditPublicationDialogContext *ctx = user_data;
/* push back changes to file-information */
- GNUNET_FS_file_information_inspect (ctx->fip,
- &file_information_update,
- ctx);
+ GNUNET_FS_file_information_inspect (ctx->fip, &file_information_update, ctx);
/* call our continuation */
- ctx->cb (ctx->cb_cls,
- GTK_RESPONSE_OK,
- gtk_entry_get_text (ctx->root_entry));
+ ctx->cb (ctx->cb_cls, GTK_RESPONSE_OK, gtk_entry_get_text (ctx->root_entry));
/* free resources from the edit dialog */
free_edit_dialog_context (ctx);
}
-
/* ****************** code for initialization of the dialog
******************** */
-
/**
* Add each of the keywords to the keyword list store.
*
@@ -1143,9 +1191,13 @@ add_keyword (void *cls, const char *keyword, int
is_mandatory)
GtkTreeIter iter;
ls = GTK_LIST_STORE (cls);
- gtk_list_store_insert_with_values (ls, &iter, G_MAXINT,
- PUBLISH_TYPES_MC_KEYWORD, keyword,
- PUBLISH_TYPES_MC_ADDED, FALSE,
+ gtk_list_store_insert_with_values (ls,
+ &iter,
+ G_MAXINT,
+ PUBLISH_TYPES_MC_KEYWORD,
+ keyword,
+ PUBLISH_TYPES_MC_ADDED,
+ FALSE,
-1);
return GNUNET_OK;
}
@@ -1169,19 +1221,18 @@ add_keyword (void *cls, const char *keyword, int
is_mandatory)
*/
static int
set_window_title_to_filename (void *cls,
- const char *plugin_name,
- enum EXTRACTOR_MetaType type,
- enum EXTRACTOR_MetaFormat format,
- const char *data_mime_type,
- const char *data,
- size_t data_len)
+ const char *plugin_name,
+ enum EXTRACTOR_MetaType type,
+ enum EXTRACTOR_MetaFormat format,
+ const char *data_mime_type,
+ const char *data,
+ size_t data_len)
{
char *utf8;
if (EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME != type)
return 0;
- utf8 = GNUNET_FS_GTK_dubious_meta_to_utf8 (format,
- data, data_len);
+ utf8 = GNUNET_FS_GTK_dubious_meta_to_utf8 (format, data, data_len);
if (NULL == utf8)
return 0;
gtk_window_set_title (GTK_WINDOW (cls), utf8);
@@ -1205,12 +1256,13 @@ set_window_title_to_filename (void *cls,
*/
static int
file_information_import (void *cls,
- struct GNUNET_FS_FileInformation *fi,
- uint64_t length,
- struct GNUNET_CONTAINER_MetaData *meta,
- struct GNUNET_FS_Uri **uri,
- struct GNUNET_FS_BlockOptions *bo, int *do_index,
- void **client_info)
+ struct GNUNET_FS_FileInformation *fi,
+ uint64_t length,
+ struct GNUNET_CONTAINER_MetaData *meta,
+ struct GNUNET_FS_Uri **uri,
+ struct GNUNET_FS_BlockOptions *bo,
+ int *do_index,
+ void **client_info)
{
struct EditPublicationDialogContext *ctx = cls;
GdkPixbuf *pixbuf;
@@ -1220,7 +1272,7 @@ file_information_import (void *cls,
year = (int) GNUNET_TIME_time_to_year (bo->expiration_time);
gtk_spin_button_set_value (ctx->expiration_year_spin, year);
GNUNET_GTK_select_anonymity_combo_level (ctx->anonymity_combo,
- bo->anonymity_level);
+ bo->anonymity_level);
gtk_spin_button_set_value (ctx->priority_spin, bo->content_priority);
gtk_spin_button_set_value (ctx->replication_spin, bo->replication_level);
gtk_toggle_button_set_active (ctx->index_checkbutton, *do_index);
@@ -1228,7 +1280,9 @@ file_information_import (void *cls,
/* import keywords */
if (NULL != *uri)
- GNUNET_FS_uri_ksk_get_keywords (*uri, &add_keyword,
ctx->keywords_liststore);
+ GNUNET_FS_uri_ksk_get_keywords (*uri,
+ &add_keyword,
+ ctx->keywords_liststore);
/* import meta data */
if (NULL != meta)
@@ -1244,11 +1298,11 @@ file_information_import (void *cls,
}
/* Also update window title based on filename */
- gtk_window_set_title (ctx->edit_publication_window, _("<unnamed>"));
+ gtk_window_set_title (ctx->edit_publication_window, _ ("<unnamed>"));
GNUNET_CONTAINER_meta_data_iterate (meta,
- &set_window_title_to_filename,
- ctx->edit_publication_window);
- return GNUNET_SYSERR; /* only visit top-level item */
+ &set_window_title_to_filename,
+ ctx->edit_publication_window);
+ return GNUNET_SYSERR; /* only visit top-level item */
}
@@ -1264,7 +1318,7 @@ file_information_import (void *cls,
* @param cb_cls closure for @a cb
*/
void
-GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent,
+GNUNET_FS_GTK_edit_publish_dialog (GtkWindow *parent,
struct GNUNET_FS_FileInformation *fip,
int is_namespace_edit,
GNUNET_FS_GTK_EditPublishDialogCallback cb,
@@ -1285,7 +1339,8 @@ GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent,
ctx->cb = cb;
ctx->cb_cls = cb_cls;
ctx->meta_combo_selected_type_id = -1;
- ctx->builder = GNUNET_GTK_get_new_builder
("gnunet_fs_gtk_edit_publication.glade", ctx);
+ ctx->builder =
+ GNUNET_GTK_get_new_builder ("gnunet_fs_gtk_edit_publication.glade", ctx);
if (NULL == ctx->builder)
{
@@ -1294,69 +1349,70 @@ GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent,
}
/* obtain various widgets for use later */
- ctx->pubtypes_liststore =
- GTK_LIST_STORE (gtk_builder_get_object
- (ctx->builder,
"GNUNET_GTK_publication_types_liststore"));
- ctx->metatypes_liststore =
- GTK_LIST_STORE (gtk_builder_get_object
- (ctx->builder,
- "GNUNET_GTK_publication_metadata_types_liststore"));
- ctx->meta_treeview = GTK_TREE_VIEW (gtk_builder_get_object
- (ctx->builder,
- "GNUNET_GTK_edit_publication_metadata_tree_view"));
- ctx->keywords_treeview = GTK_TREE_VIEW (gtk_builder_get_object
- (ctx->builder,
- "GNUNET_GTK_edit_publication_keyword_list_tree_view"));
+ ctx->pubtypes_liststore = GTK_LIST_STORE (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_publication_types_liststore"));
+ ctx->metatypes_liststore = GTK_LIST_STORE (
+ gtk_builder_get_object (ctx->builder,
+
"GNUNET_GTK_publication_metadata_types_liststore"));
+ ctx->meta_treeview = GTK_TREE_VIEW (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_edit_publication_metadata_tree_view"));
+ ctx->keywords_treeview = GTK_TREE_VIEW (
+ gtk_builder_get_object (ctx->builder,
+
"GNUNET_GTK_edit_publication_keyword_list_tree_view"));
ctx->edit_publication_window =
GTK_WINDOW (gtk_builder_get_object (ctx->builder,
- "GNUNET_GTK_edit_publication_window"));
- ctx->keywords_liststore = GTK_LIST_STORE (gtk_builder_get_object
- (ctx->builder,
"GNUNET_GTK_publication_keywords_liststore"));
- ctx->keyword_entry =
- GTK_ENTRY (gtk_builder_get_object
- (ctx->builder, "GNUNET_GTK_edit_publication_keyword_entry"));
- ctx->confirm_button = GTK_WIDGET (gtk_builder_get_object
- (ctx->builder,
"GNUNET_GTK_edit_publication_confirm_button"));
- ctx->preview_image =
- GTK_IMAGE (gtk_builder_get_object
- (ctx->builder,
- "GNUNET_GTK_edit_publication_metadata_preview_image"));
- ctx->meta_liststore = GTK_LIST_STORE (gtk_builder_get_object
- (ctx->builder,
- "GNUNET_GTK_publication_metadata_liststore"));
- ctx->root_entry = GTK_ENTRY (gtk_builder_get_object
- (ctx->builder, "GNUNET_GTK_edit_publication_root_entry"));
- ctx->expiration_year_spin = GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (ctx->builder,
-
"GNUNET_GTK_edit_publication_expiration_year_spin_button"));
- ctx->priority_spin = GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (ctx->builder,
-
"GNUNET_GTK_edit_publication_priority_spin_button"));
- ctx->replication_spin = GTK_SPIN_BUTTON
- (gtk_builder_get_object
- (ctx->builder,
-
"GNUNET_GTK_edit_publication_replication_spin_button"));
- ctx->index_checkbutton = GTK_TOGGLE_BUTTON
- (gtk_builder_get_object
- (ctx->builder,
-
"GNUNET_GTK_edit_publication_index_checkbutton"));
- ctx->anonymity_combo = GTK_COMBO_BOX (gtk_builder_get_object (ctx->builder,
-
"GNUNET_GTK_edit_publication_anonymity_combobox"));
+ "GNUNET_GTK_edit_publication_window"));
+ ctx->keywords_liststore = GTK_LIST_STORE (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_publication_keywords_liststore"));
+ ctx->keyword_entry = GTK_ENTRY (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_edit_publication_keyword_entry"));
+ ctx->confirm_button = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_edit_publication_confirm_button"));
+ ctx->preview_image = GTK_IMAGE (
+ gtk_builder_get_object (ctx->builder,
+
"GNUNET_GTK_edit_publication_metadata_preview_image"));
+ ctx->meta_liststore = GTK_LIST_STORE (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_publication_metadata_liststore"));
+ ctx->root_entry = GTK_ENTRY (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_edit_publication_root_entry"));
+ ctx->expiration_year_spin = GTK_SPIN_BUTTON (gtk_builder_get_object (
+ ctx->builder,
+ "GNUNET_GTK_edit_publication_expiration_year_spin_button"));
+ ctx->priority_spin = GTK_SPIN_BUTTON (
+ gtk_builder_get_object (ctx->builder,
+
"GNUNET_GTK_edit_publication_priority_spin_button"));
+ ctx->replication_spin = GTK_SPIN_BUTTON (
+ gtk_builder_get_object (ctx->builder,
+
"GNUNET_GTK_edit_publication_replication_spin_button"));
+ ctx->index_checkbutton = GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_edit_publication_index_checkbutton"));
+ ctx->anonymity_combo = GTK_COMBO_BOX (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_edit_publication_anonymity_combobox"));
/* Basic initialization of widgets models and visibility */
gtk_combo_box_set_model (ctx->anonymity_combo,
- GNUNET_FS_GTK_get_anonymity_level_list_store ());
+ GNUNET_FS_GTK_get_anonymity_level_list_store ());
GNUNET_GTK_setup_expiration_year_adjustment (ctx->builder);
- pubtypes_combo =
- GTK_COMBO_BOX (gtk_builder_get_object
- (ctx->builder, "GNUNET_GTK_edit_publication_type_combo"));
+ pubtypes_combo = GTK_COMBO_BOX (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_edit_publication_type_combo"));
if (gtk_combo_box_get_active_iter (pubtypes_combo, &iter))
{
- gtk_tree_model_get (GTK_TREE_MODEL (ctx->pubtypes_liststore), &iter,
- PUBLISH_TYPES_MC_TYPE, &code, -1);
+ gtk_tree_model_get (GTK_TREE_MODEL (ctx->pubtypes_liststore),
+ &iter,
+ PUBLISH_TYPES_MC_TYPE,
+ &code,
+ -1);
change_metatypes (ctx, 0);
}
else
@@ -1364,20 +1420,21 @@ GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent,
/* indexing does not apply to directories */
gtk_widget_set_visible (GTK_WIDGET (ctx->index_checkbutton),
- ctx->is_directory != GNUNET_YES);
- index_label = GTK_LABEL (gtk_builder_get_object
- (ctx->builder,
- "GNUNET_GTK_edit_publication_index_label"));
+ ctx->is_directory != GNUNET_YES);
+ index_label = GTK_LABEL (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_edit_publication_index_label"));
gtk_widget_set_visible (GTK_WIDGET (index_label),
- ctx->is_directory != GNUNET_YES);
+ ctx->is_directory != GNUNET_YES);
/* show root label only for namespaces */
gtk_widget_set_visible (GTK_WIDGET (ctx->root_entry),
- is_namespace_edit ? TRUE : FALSE);
- root_label = GTK_LABEL (gtk_builder_get_object
- (ctx->builder,
"GNUNET_GTK_edit_publication_root_label"));
+ is_namespace_edit ? TRUE : FALSE);
+ root_label = GTK_LABEL (
+ gtk_builder_get_object (ctx->builder,
+ "GNUNET_GTK_edit_publication_root_label"));
gtk_widget_set_visible (GTK_WIDGET (root_label),
- is_namespace_edit ? TRUE : FALSE);
+ is_namespace_edit ? TRUE : FALSE);
/* import meta data and options */
GNUNET_FS_file_information_inspect (fip, &file_information_import, ctx);
diff --git a/src/fs/gnunet-fs-gtk_publish-edit-dialog.h
b/src/fs/gnunet-fs-gtk_publish-edit-dialog.h
index 6416579e..c12a5ecb 100644
--- a/src/fs/gnunet-fs-gtk_publish-edit-dialog.h
+++ b/src/fs/gnunet-fs-gtk_publish-edit-dialog.h
@@ -38,7 +38,7 @@
* @param root namespace root, NULL for file publishing
*/
typedef void (*GNUNET_FS_GTK_EditPublishDialogCallback) (gpointer cls,
- int ret,
+ int ret,
const char *root);
@@ -54,7 +54,7 @@ typedef void (*GNUNET_FS_GTK_EditPublishDialogCallback)
(gpointer cls,
* @param cb_cls closure for 'cb'
*/
void
-GNUNET_FS_GTK_edit_publish_dialog (GtkWindow * parent,
+GNUNET_FS_GTK_edit_publish_dialog (GtkWindow *parent,
struct GNUNET_FS_FileInformation *fip,
int is_namespace_edit,
GNUNET_FS_GTK_EditPublishDialogCallback cb,
diff --git a/src/fs/gnunet-fs-gtk_unindex.c b/src/fs/gnunet-fs-gtk_unindex.c
index 9b9f0af4..4c488c2e 100644
--- a/src/fs/gnunet-fs-gtk_unindex.c
+++ b/src/fs/gnunet-fs-gtk_unindex.c
@@ -33,47 +33,47 @@
* Columns in the unindex model.
*/
enum UNINDEX_ModelColumns
- {
- /**
+{
+ /**
* A gchararray.
*/
- UNINDEX_MC_FILENAME = 0,
+ UNINDEX_MC_FILENAME = 0,
- /**
+ /**
* A guint64.
*/
- UNINDEX_MC_FILESIZE = 1,
+ UNINDEX_MC_FILESIZE = 1,
- /**
+ /**
* A gchararray representing a color.
*/
- UNINDEX_MC_BACKGROUND_COLOR = 2,
+ UNINDEX_MC_BACKGROUND_COLOR = 2,
- /**
+ /**
* A 'struct UnindexEntry' (gpointer)
*/
- UNINDEX_MC_UNINDEX_CONTEXT = 3,
+ UNINDEX_MC_UNINDEX_CONTEXT = 3,
- /**
+ /**
* A gfloat.
*/
- UNINDEX_MC_UNINDEX_PROGRESS = 4,
+ UNINDEX_MC_UNINDEX_PROGRESS = 4,
- /**
+ /**
* A boolean.
*/
- UNINDEX_MC_PROGRESS_VISIBLE = 5,
+ UNINDEX_MC_PROGRESS_VISIBLE = 5,
- /**
+ /**
* A gchararray.
*/
- UNINDEX_MC_ERROR = 6,
+ UNINDEX_MC_ERROR = 6,
- /**
+ /**
* A GdkPixbuf.
*/
- UNINDEX_MC_STATUS_ICON = 7
- };
+ UNINDEX_MC_STATUS_ICON = 7
+};
/**
@@ -187,8 +187,7 @@ static struct UnindexEntry *ue_tail;
* @param user_data the unindex context
*/
void
-GNUNET_FS_GTK_unindex_button_clicked_cb (GtkWidget * dummy,
- gpointer user_data)
+GNUNET_FS_GTK_unindex_button_clicked_cb (GtkWidget *dummy, gpointer user_data)
{
struct UnindexDialogContext *udc = user_data;
GtkTreeIter iter;
@@ -203,11 +202,15 @@ GNUNET_FS_GTK_unindex_button_clicked_cb (GtkWidget *
dummy,
GNUNET_break (0);
return;
}
- gtk_tree_model_get (udc->model, &iter,
- UNINDEX_MC_FILENAME, &filename,
- UNINDEX_MC_FILESIZE, &filesize,
- UNINDEX_MC_UNINDEX_CONTEXT, &ue,
- -1);
+ gtk_tree_model_get (udc->model,
+ &iter,
+ UNINDEX_MC_FILENAME,
+ &filename,
+ UNINDEX_MC_FILESIZE,
+ &filesize,
+ UNINDEX_MC_UNINDEX_CONTEXT,
+ &ue,
+ -1);
if (NULL != ue)
{
GNUNET_break (0);
@@ -221,15 +224,19 @@ GNUNET_FS_GTK_unindex_button_clicked_cb (GtkWidget *
dummy,
path = gtk_tree_model_get_path (udc->model, &iter);
ue->rr = gtk_tree_row_reference_new (udc->model, path);
gtk_tree_path_free (path);
- ue->uc = GNUNET_FS_unindex_start (GNUNET_FS_GTK_get_fs_handle (),
- filename, ue);
+ ue->uc =
+ GNUNET_FS_unindex_start (GNUNET_FS_GTK_get_fs_handle (), filename, ue);
gtk_list_store_set (GTK_LIST_STORE (udc->model),
- &iter,
- UNINDEX_MC_BACKGROUND_COLOR, "yellow",
- UNINDEX_MC_UNINDEX_CONTEXT, ue,
- UNINDEX_MC_UNINDEX_PROGRESS, 0,
- UNINDEX_MC_PROGRESS_VISIBLE, TRUE,
- -1);
+ &iter,
+ UNINDEX_MC_BACKGROUND_COLOR,
+ "yellow",
+ UNINDEX_MC_UNINDEX_CONTEXT,
+ ue,
+ UNINDEX_MC_UNINDEX_PROGRESS,
+ 0,
+ UNINDEX_MC_PROGRESS_VISIBLE,
+ TRUE,
+ -1);
gtk_widget_set_sensitive (udc->unindex_button, FALSE);
}
@@ -241,8 +248,8 @@ GNUNET_FS_GTK_unindex_button_clicked_cb (GtkWidget * dummy,
* @param user_data the unindex context
*/
void
-GNUNET_FS_GTK_unindex_close_button_clicked_cb (GtkWidget * dummy,
- gpointer user_data)
+GNUNET_FS_GTK_unindex_close_button_clicked_cb (GtkWidget *dummy,
+ gpointer user_data)
{
struct UnindexDialogContext *udc = user_data;
GtkTreeIter iter;
@@ -256,16 +263,17 @@ GNUNET_FS_GTK_unindex_close_button_clicked_cb (GtkWidget
* dummy,
if (gtk_tree_model_get_iter_first (udc->model, &iter))
do
{
- gtk_tree_model_get (udc->model, &iter,
- UNINDEX_MC_UNINDEX_CONTEXT, &ue,
- -1);
+ gtk_tree_model_get (udc->model,
+ &iter,
+ UNINDEX_MC_UNINDEX_CONTEXT,
+ &ue,
+ -1);
if (NULL != ue)
{
- gtk_tree_row_reference_free (ue->rr);
- ue->rr = NULL;
+ gtk_tree_row_reference_free (ue->rr);
+ ue->rr = NULL;
}
- }
- while (TRUE == gtk_tree_model_iter_next (udc->model, &iter));
+ } while (TRUE == gtk_tree_model_iter_next (udc->model, &iter));
gtk_widget_destroy (udc->dialog);
g_object_unref (G_OBJECT (udc->builder));
GNUNET_free (udc);
@@ -281,7 +289,7 @@ GNUNET_FS_GTK_unindex_close_button_clicked_cb (GtkWidget *
dummy,
*/
void
GNUNET_FS_GTK_unindex_treeview_selection_changed_cb (GtkTreeSelection *ts,
- gpointer user_data)
+ gpointer user_data)
{
struct UnindexDialogContext *udc = user_data;
GtkTreeIter iter;
@@ -290,9 +298,7 @@ GNUNET_FS_GTK_unindex_treeview_selection_changed_cb
(GtkTreeSelection *ts,
/* find out if a file is selected */
if (gtk_tree_selection_get_selected (udc->selection, NULL, &iter))
{
- gtk_tree_model_get (udc->model, &iter,
- UNINDEX_MC_UNINDEX_CONTEXT, &ue,
- -1);
+ gtk_tree_model_get (udc->model, &iter, UNINDEX_MC_UNINDEX_CONTEXT, &ue,
-1);
if (NULL == ue)
{
/* selected file not already being unindexed, enable button! */
@@ -313,8 +319,9 @@ GNUNET_FS_GTK_unindex_treeview_selection_changed_cb
(GtkTreeSelection *ts,
* @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort
*/
static int
-add_indexed_file (void *cls, const char *filename,
- const struct GNUNET_HashCode * file_id)
+add_indexed_file (void *cls,
+ const char *filename,
+ const struct GNUNET_HashCode *file_id)
{
struct UnindexDialogContext *udc = cls;
GtkTreeIter iter;
@@ -329,13 +336,11 @@ add_indexed_file (void *cls, const char *filename,
return GNUNET_OK;
}
if (GNUNET_OK !=
- GNUNET_DISK_file_size (filename,
- &filesize,
- GNUNET_YES, GNUNET_YES))
+ GNUNET_DISK_file_size (filename, &filesize, GNUNET_YES, GNUNET_YES))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Could not access indexed file `%s'\n"),
- filename);
+ _ ("Could not access indexed file `%s'\n"),
+ filename);
return GNUNET_OK;
}
for (ue = ue_head; ue != NULL; ue = ue->next)
@@ -344,12 +349,17 @@ add_indexed_file (void *cls, const char *filename,
if (NULL == ue)
{
gtk_list_store_insert_with_values (GTK_LIST_STORE (udc->model),
- &iter, G_MAXINT,
- UNINDEX_MC_FILENAME, filename,
- UNINDEX_MC_FILESIZE, (guint64) filesize,
- UNINDEX_MC_BACKGROUND_COLOR, "white",
- UNINDEX_MC_PROGRESS_VISIBLE, FALSE,
- -1);
+ &iter,
+ G_MAXINT,
+ UNINDEX_MC_FILENAME,
+ filename,
+ UNINDEX_MC_FILESIZE,
+ (guint64) filesize,
+ UNINDEX_MC_BACKGROUND_COLOR,
+ "white",
+ UNINDEX_MC_PROGRESS_VISIBLE,
+ FALSE,
+ -1);
}
else
{
@@ -359,15 +369,23 @@ add_indexed_file (void *cls, const char *filename,
return GNUNET_OK;
}
gtk_list_store_insert_with_values (GTK_LIST_STORE (udc->model),
- &iter, G_MAXINT,
- UNINDEX_MC_FILENAME, filename,
- UNINDEX_MC_FILESIZE, (guint64) filesize,
- UNINDEX_MC_BACKGROUND_COLOR, (NULL ==
ue->emsg) ? "yellow" : "red",
- UNINDEX_MC_UNINDEX_CONTEXT, ue,
- UNINDEX_MC_UNINDEX_PROGRESS,
ue->progress,
- UNINDEX_MC_PROGRESS_VISIBLE, TRUE,
- UNINDEX_MC_ERROR, ue->emsg,
- -1);
+ &iter,
+ G_MAXINT,
+ UNINDEX_MC_FILENAME,
+ filename,
+ UNINDEX_MC_FILESIZE,
+ (guint64) filesize,
+ UNINDEX_MC_BACKGROUND_COLOR,
+ (NULL == ue->emsg) ? "yellow" : "red",
+ UNINDEX_MC_UNINDEX_CONTEXT,
+ ue,
+ UNINDEX_MC_UNINDEX_PROGRESS,
+ ue->progress,
+ UNINDEX_MC_PROGRESS_VISIBLE,
+ TRUE,
+ UNINDEX_MC_ERROR,
+ ue->emsg,
+ -1);
path = gtk_tree_model_get_path (udc->model, &iter);
ue->rr = gtk_tree_row_reference_new (udc->model, path);
}
@@ -382,8 +400,7 @@ add_indexed_file (void *cls, const char *filename,
* @param data the main dialog builder, unused
*/
void
-GNUNET_GTK_main_menu_unindex_activate_cb (GtkWidget * dummy,
- gpointer data)
+GNUNET_GTK_main_menu_unindex_activate_cb (GtkWidget *dummy, gpointer data)
{
GtkWidget *toplevel;
struct UnindexDialogContext *udc;
@@ -403,21 +420,22 @@ GNUNET_GTK_main_menu_unindex_activate_cb (GtkWidget *
dummy,
GNUNET_free (udc);
return;
}
- udc->dialog = GTK_WIDGET (gtk_builder_get_object
- (udc->builder, "GNUNET_FS_GTK_unindex_dialog"));
- udc->treeview = GTK_TREE_VIEW (gtk_builder_get_object
- (udc->builder,
"GNUNET_FS_GTK_unindex_treeview"));
+ udc->dialog = GTK_WIDGET (
+ gtk_builder_get_object (udc->builder, "GNUNET_FS_GTK_unindex_dialog"));
+ udc->treeview = GTK_TREE_VIEW (
+ gtk_builder_get_object (udc->builder, "GNUNET_FS_GTK_unindex_treeview"));
udc->selection = gtk_tree_view_get_selection (udc->treeview);
- udc->unindex_button = GTK_WIDGET (gtk_builder_get_object
- (udc->builder,
"GNUNET_FS_GTK_unindex_button"));
- udc->model = GTK_TREE_MODEL (gtk_builder_get_object
- (udc->builder,
"GNUNET_FS_GTK_unindex_liststore"));
+ udc->unindex_button = GTK_WIDGET (
+ gtk_builder_get_object (udc->builder, "GNUNET_FS_GTK_unindex_button"));
+ udc->model = GTK_TREE_MODEL (
+ gtk_builder_get_object (udc->builder, "GNUNET_FS_GTK_unindex_liststore"));
udc->gic = GNUNET_FS_get_indexed_files (GNUNET_FS_GTK_get_fs_handle (),
- &add_indexed_file,
- udc);
+ &add_indexed_file,
+ udc);
toplevel = gtk_widget_get_toplevel (dummy);
if (GTK_IS_WINDOW (toplevel))
- gtk_window_set_transient_for (GTK_WINDOW (udc->dialog), GTK_WINDOW
(toplevel));
+ gtk_window_set_transient_for (GTK_WINDOW (udc->dialog),
+ GTK_WINDOW (toplevel));
gtk_window_present (GTK_WINDOW (udc->dialog));
master_udc = udc;
}
@@ -436,10 +454,10 @@ GNUNET_GTK_main_menu_unindex_activate_cb (GtkWidget *
dummy,
*/
struct UnindexEntry *
GNUNET_FS_GTK_unindex_handle_resume_ (struct GNUNET_FS_UnindexContext *uc,
- const char *filename,
- uint64_t filesize,
- uint64_t completed,
- const char *emsg)
+ const char *filename,
+ uint64_t filesize,
+ uint64_t completed,
+ const char *emsg)
{
struct UnindexEntry *ue;
@@ -450,9 +468,7 @@ GNUNET_FS_GTK_unindex_handle_resume_ (struct
GNUNET_FS_UnindexContext *uc,
ue->filesize = filesize;
ue->uc = uc;
ue->progress = (gint) ((100LL * completed) / filesize);
- GNUNET_CONTAINER_DLL_insert (ue_head,
- ue_tail,
- ue);
+ GNUNET_CONTAINER_DLL_insert (ue_head, ue_tail, ue);
return ue;
}
@@ -475,18 +491,15 @@ GNUNET_FS_GTK_unindex_handle_stop_ (struct UnindexEntry
*ue)
model = gtk_tree_row_reference_get_model (ue->rr);
gtk_tree_row_reference_free (ue->rr);
ue->rr = NULL;
- GNUNET_assert (TRUE == gtk_tree_model_get_iter (model,
- &iter,
- path));
+ GNUNET_assert (TRUE == gtk_tree_model_get_iter (model, &iter, path));
gtk_tree_path_free (path);
gtk_list_store_set (GTK_LIST_STORE (model),
- &iter,
- UNINDEX_MC_UNINDEX_CONTEXT, NULL,
- -1);
+ &iter,
+ UNINDEX_MC_UNINDEX_CONTEXT,
+ NULL,
+ -1);
}
- GNUNET_CONTAINER_DLL_remove (ue_head,
- ue_tail,
- ue);
+ GNUNET_CONTAINER_DLL_remove (ue_head, ue_tail, ue);
GNUNET_free_non_null (ue->emsg);
GNUNET_free (ue->filename);
GNUNET_free (ue);
@@ -500,8 +513,7 @@ GNUNET_FS_GTK_unindex_handle_stop_ (struct UnindexEntry *ue)
* @param emsg error message
*/
void
-GNUNET_FS_GTK_unindex_handle_error_ (struct UnindexEntry *ue,
- const char *emsg)
+GNUNET_FS_GTK_unindex_handle_error_ (struct UnindexEntry *ue, const char *emsg)
{
GtkTreePath *path;
GtkTreeIter iter;
@@ -512,15 +524,15 @@ GNUNET_FS_GTK_unindex_handle_error_ (struct UnindexEntry
*ue,
return;
path = gtk_tree_row_reference_get_path (ue->rr);
model = gtk_tree_row_reference_get_model (ue->rr);
- GNUNET_assert (TRUE == gtk_tree_model_get_iter (model,
- &iter,
- path));
+ GNUNET_assert (TRUE == gtk_tree_model_get_iter (model, &iter, path));
gtk_tree_path_free (path);
gtk_list_store_set (GTK_LIST_STORE (model),
- &iter,
- UNINDEX_MC_BACKGROUND_COLOR, "red",
- UNINDEX_MC_ERROR, emsg,
- -1);
+ &iter,
+ UNINDEX_MC_BACKGROUND_COLOR,
+ "red",
+ UNINDEX_MC_ERROR,
+ emsg,
+ -1);
}
@@ -532,7 +544,7 @@ GNUNET_FS_GTK_unindex_handle_error_ (struct UnindexEntry
*ue,
*/
void
GNUNET_FS_GTK_unindex_handle_progress_ (struct UnindexEntry *ue,
- uint64_t completed)
+ uint64_t completed)
{
GtkTreePath *path;
GtkTreeIter iter;
@@ -543,14 +555,13 @@ GNUNET_FS_GTK_unindex_handle_progress_ (struct
UnindexEntry *ue,
return;
path = gtk_tree_row_reference_get_path (ue->rr);
model = gtk_tree_row_reference_get_model (ue->rr);
- GNUNET_assert (TRUE == gtk_tree_model_get_iter (model,
- &iter,
- path));
+ GNUNET_assert (TRUE == gtk_tree_model_get_iter (model, &iter, path));
gtk_tree_path_free (path);
gtk_list_store_set (GTK_LIST_STORE (model),
- &iter,
- UNINDEX_MC_UNINDEX_PROGRESS, ue->progress,
- -1);
+ &iter,
+ UNINDEX_MC_UNINDEX_PROGRESS,
+ ue->progress,
+ -1);
}
@@ -570,12 +581,9 @@ GNUNET_FS_GTK_unindex_handle_completed_ (struct
UnindexEntry *ue)
{
path = gtk_tree_row_reference_get_path (ue->rr);
model = gtk_tree_row_reference_get_model (ue->rr);
- GNUNET_assert (TRUE == gtk_tree_model_get_iter (model,
- &iter,
- path));
+ GNUNET_assert (TRUE == gtk_tree_model_get_iter (model, &iter, path));
gtk_tree_path_free (path);
- gtk_list_store_remove (GTK_LIST_STORE (model),
- &iter);
+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
gtk_tree_row_reference_free (ue->rr);
ue->rr = NULL;
}
@@ -583,5 +591,4 @@ GNUNET_FS_GTK_unindex_handle_completed_ (struct
UnindexEntry *ue)
}
-
/* end of gnunet-fs-gtk_unindex.c */
diff --git a/src/fs/gnunet-fs-gtk_unindex.h b/src/fs/gnunet-fs-gtk_unindex.h
index 4cf22f49..a785ae46 100644
--- a/src/fs/gnunet-fs-gtk_unindex.h
+++ b/src/fs/gnunet-fs-gtk_unindex.h
@@ -49,10 +49,10 @@ struct UnindexEntry;
*/
struct UnindexEntry *
GNUNET_FS_GTK_unindex_handle_resume_ (struct GNUNET_FS_UnindexContext *uc,
- const char *filename,
- uint64_t filesize,
- uint64_t completed,
- const char *emsg);
+ const char *filename,
+ uint64_t filesize,
+ uint64_t completed,
+ const char *emsg);
/**
@@ -71,8 +71,7 @@ GNUNET_FS_GTK_unindex_handle_stop_ (struct UnindexEntry *ue);
* @param emsg error message
*/
void
-GNUNET_FS_GTK_unindex_handle_error_ (struct UnindexEntry *ue,
- const char *emsg);
+GNUNET_FS_GTK_unindex_handle_error_ (struct UnindexEntry *ue, const char
*emsg);
/**
@@ -83,7 +82,7 @@ GNUNET_FS_GTK_unindex_handle_error_ (struct UnindexEntry *ue,
*/
void
GNUNET_FS_GTK_unindex_handle_progress_ (struct UnindexEntry *ue,
- uint64_t completed);
+ uint64_t completed);
/**
@@ -95,6 +94,4 @@ void
GNUNET_FS_GTK_unindex_handle_completed_ (struct UnindexEntry *ue);
-
-
#endif
diff --git a/src/fs/metatypes.c b/src/fs/metatypes.c
index 1c1ae6fc..9b49ef4f 100644
--- a/src/fs/metatypes.c
+++ b/src/fs/metatypes.c
@@ -1,235 +1,216 @@
/* *INDENT-OFF* */
-gint types_generic[] = {
- EXTRACTOR_METATYPE_MIMETYPE,
- EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
- EXTRACTOR_METATYPE_TITLE,
- EXTRACTOR_METATYPE_KEYWORDS,
- EXTRACTOR_METATYPE_SUBJECT,
- EXTRACTOR_METATYPE_DESCRIPTION,
- EXTRACTOR_METATYPE_COMMENT,
+gint types_generic[] = {EXTRACTOR_METATYPE_MIMETYPE,
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+ EXTRACTOR_METATYPE_TITLE,
+ EXTRACTOR_METATYPE_KEYWORDS,
+ EXTRACTOR_METATYPE_SUBJECT,
+ EXTRACTOR_METATYPE_DESCRIPTION,
+ EXTRACTOR_METATYPE_COMMENT,
#if HAVE_EXTRACTOR_H
- EXTRACTOR_METATYPE_COPYRIGHT,
- EXTRACTOR_METATYPE_URI,
- EXTRACTOR_METATYPE_CREATOR,
- EXTRACTOR_METATYPE_CREATION_DATE,
+ EXTRACTOR_METATYPE_COPYRIGHT,
+ EXTRACTOR_METATYPE_URI,
+ EXTRACTOR_METATYPE_CREATOR,
+ EXTRACTOR_METATYPE_CREATION_DATE,
#endif
- EXTRACTOR_METATYPE_RESERVED
-};
+ EXTRACTOR_METATYPE_RESERVED};
-gint types_text[] =
-{
- EXTRACTOR_METATYPE_MIMETYPE,
- EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
- EXTRACTOR_METATYPE_TITLE,
- EXTRACTOR_METATYPE_KEYWORDS,
+gint types_text[] = {EXTRACTOR_METATYPE_MIMETYPE,
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+ EXTRACTOR_METATYPE_TITLE,
+ EXTRACTOR_METATYPE_KEYWORDS,
#if HAVE_EXTRACTOR_H
- EXTRACTOR_METATYPE_ABSTRACT,
- EXTRACTOR_METATYPE_SUMMARY,
- EXTRACTOR_METATYPE_SUBJECT,
- EXTRACTOR_METATYPE_AUTHOR_NAME,
- EXTRACTOR_METATYPE_AUTHOR_EMAIL,
- EXTRACTOR_METATYPE_AUTHOR_INSTITUTION,
- EXTRACTOR_METATYPE_DESCRIPTION,
- EXTRACTOR_METATYPE_LANGUAGE,
- EXTRACTOR_METATYPE_COPYRIGHT,
- EXTRACTOR_METATYPE_COMMENT,
- EXTRACTOR_METATYPE_BOOK_TITLE,
- EXTRACTOR_METATYPE_BOOK_EDITION,
- EXTRACTOR_METATYPE_BOOK_CHAPTER_NUMBER,
- EXTRACTOR_METATYPE_JOURNAL_NAME,
- EXTRACTOR_METATYPE_JOURNAL_VOLUME,
- EXTRACTOR_METATYPE_JOURNAL_NUMBER,
- EXTRACTOR_METATYPE_PAGE_COUNT,
- EXTRACTOR_METATYPE_PAGE_RANGE,
- EXTRACTOR_METATYPE_PUBLISHER,
- EXTRACTOR_METATYPE_PUBLISHER_ADDRESS,
- EXTRACTOR_METATYPE_PUBLISHER_INSTITUTION,
- EXTRACTOR_METATYPE_PUBLISHER_SERIES,
- EXTRACTOR_METATYPE_PUBLICATION_TYPE,
- EXTRACTOR_METATYPE_PUBLICATION_DATE,
- EXTRACTOR_METATYPE_URL,
- EXTRACTOR_METATYPE_CREATOR,
- EXTRACTOR_METATYPE_CREATION_DATE,
- EXTRACTOR_METATYPE_MODIFICATION_DATE,
- EXTRACTOR_METATYPE_CHARACTER_SET,
- EXTRACTOR_METATYPE_LINE_COUNT,
- EXTRACTOR_METATYPE_WORD_COUNT,
- EXTRACTOR_METATYPE_PAGE_ORIENTATION,
- EXTRACTOR_METATYPE_PAPER_SIZE,
- EXTRACTOR_METATYPE_TEMPLATE,
- EXTRACTOR_METATYPE_REVISION_HISTORY,
- EXTRACTOR_METATYPE_REVISION_NUMBER,
+ EXTRACTOR_METATYPE_ABSTRACT,
+ EXTRACTOR_METATYPE_SUMMARY,
+ EXTRACTOR_METATYPE_SUBJECT,
+ EXTRACTOR_METATYPE_AUTHOR_NAME,
+ EXTRACTOR_METATYPE_AUTHOR_EMAIL,
+ EXTRACTOR_METATYPE_AUTHOR_INSTITUTION,
+ EXTRACTOR_METATYPE_DESCRIPTION,
+ EXTRACTOR_METATYPE_LANGUAGE,
+ EXTRACTOR_METATYPE_COPYRIGHT,
+ EXTRACTOR_METATYPE_COMMENT,
+ EXTRACTOR_METATYPE_BOOK_TITLE,
+ EXTRACTOR_METATYPE_BOOK_EDITION,
+ EXTRACTOR_METATYPE_BOOK_CHAPTER_NUMBER,
+ EXTRACTOR_METATYPE_JOURNAL_NAME,
+ EXTRACTOR_METATYPE_JOURNAL_VOLUME,
+ EXTRACTOR_METATYPE_JOURNAL_NUMBER,
+ EXTRACTOR_METATYPE_PAGE_COUNT,
+ EXTRACTOR_METATYPE_PAGE_RANGE,
+ EXTRACTOR_METATYPE_PUBLISHER,
+ EXTRACTOR_METATYPE_PUBLISHER_ADDRESS,
+ EXTRACTOR_METATYPE_PUBLISHER_INSTITUTION,
+ EXTRACTOR_METATYPE_PUBLISHER_SERIES,
+ EXTRACTOR_METATYPE_PUBLICATION_TYPE,
+ EXTRACTOR_METATYPE_PUBLICATION_DATE,
+ EXTRACTOR_METATYPE_URL,
+ EXTRACTOR_METATYPE_CREATOR,
+ EXTRACTOR_METATYPE_CREATION_DATE,
+ EXTRACTOR_METATYPE_MODIFICATION_DATE,
+ EXTRACTOR_METATYPE_CHARACTER_SET,
+ EXTRACTOR_METATYPE_LINE_COUNT,
+ EXTRACTOR_METATYPE_WORD_COUNT,
+ EXTRACTOR_METATYPE_PAGE_ORIENTATION,
+ EXTRACTOR_METATYPE_PAPER_SIZE,
+ EXTRACTOR_METATYPE_TEMPLATE,
+ EXTRACTOR_METATYPE_REVISION_HISTORY,
+ EXTRACTOR_METATYPE_REVISION_NUMBER,
#endif
- EXTRACTOR_METATYPE_RESERVED
-};
+ EXTRACTOR_METATYPE_RESERVED};
-gint types_music[] =
-{
- EXTRACTOR_METATYPE_MIMETYPE,
- EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
- EXTRACTOR_METATYPE_TITLE,
- EXTRACTOR_METATYPE_ARTIST,
+gint types_music[] = {EXTRACTOR_METATYPE_MIMETYPE,
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+ EXTRACTOR_METATYPE_TITLE,
+ EXTRACTOR_METATYPE_ARTIST,
#if HAVE_EXTRACTOR_H
- EXTRACTOR_METATYPE_COMPOSER,
- EXTRACTOR_METATYPE_CONDUCTOR,
- EXTRACTOR_METATYPE_ALBUM,
- EXTRACTOR_METATYPE_DURATION,
- EXTRACTOR_METATYPE_KEYWORDS,
- EXTRACTOR_METATYPE_DESCRIPTION,
- EXTRACTOR_METATYPE_GENRE,
- EXTRACTOR_METATYPE_MOOD,
- EXTRACTOR_METATYPE_TRACK_NUMBER,
- EXTRACTOR_METATYPE_LANGUAGE,
- EXTRACTOR_METATYPE_COMMENT,
- EXTRACTOR_METATYPE_ISRC,
- EXTRACTOR_METATYPE_LYRICS,
- EXTRACTOR_METATYPE_COPYRIGHT,
- EXTRACTOR_METATYPE_PUBLISHER,
- EXTRACTOR_METATYPE_PERFORMER,
- EXTRACTOR_METATYPE_PRODUCER,
- EXTRACTOR_METATYPE_SONG_VERSION,
- EXTRACTOR_METATYPE_URI,
- EXTRACTOR_METATYPE_CREATION_DATE,
- EXTRACTOR_METATYPE_DISCLAIMER,
- EXTRACTOR_METATYPE_WRITER,
- EXTRACTOR_METATYPE_CONTRIBUTOR_NAME,
- EXTRACTOR_METATYPE_SONG_COUNT,
- EXTRACTOR_METATYPE_STARTING_SONG,
- EXTRACTOR_METATYPE_BEATS_PER_MINUTE,
- EXTRACTOR_METATYPE_ORIGINAL_TITLE,
- EXTRACTOR_METATYPE_ORIGINAL_ARTIST,
- EXTRACTOR_METATYPE_ORIGINAL_WRITER,
- EXTRACTOR_METATYPE_ORIGINAL_RELEASE_YEAR,
- EXTRACTOR_METATYPE_ORIGINAL_PERFORMER,
- EXTRACTOR_METATYPE_MUSICIAN_CREDITS_LIST,
- EXTRACTOR_METATYPE_SUBTITLE,
+ EXTRACTOR_METATYPE_COMPOSER,
+ EXTRACTOR_METATYPE_CONDUCTOR,
+ EXTRACTOR_METATYPE_ALBUM,
+ EXTRACTOR_METATYPE_DURATION,
+ EXTRACTOR_METATYPE_KEYWORDS,
+ EXTRACTOR_METATYPE_DESCRIPTION,
+ EXTRACTOR_METATYPE_GENRE,
+ EXTRACTOR_METATYPE_MOOD,
+ EXTRACTOR_METATYPE_TRACK_NUMBER,
+ EXTRACTOR_METATYPE_LANGUAGE,
+ EXTRACTOR_METATYPE_COMMENT,
+ EXTRACTOR_METATYPE_ISRC,
+ EXTRACTOR_METATYPE_LYRICS,
+ EXTRACTOR_METATYPE_COPYRIGHT,
+ EXTRACTOR_METATYPE_PUBLISHER,
+ EXTRACTOR_METATYPE_PERFORMER,
+ EXTRACTOR_METATYPE_PRODUCER,
+ EXTRACTOR_METATYPE_SONG_VERSION,
+ EXTRACTOR_METATYPE_URI,
+ EXTRACTOR_METATYPE_CREATION_DATE,
+ EXTRACTOR_METATYPE_DISCLAIMER,
+ EXTRACTOR_METATYPE_WRITER,
+ EXTRACTOR_METATYPE_CONTRIBUTOR_NAME,
+ EXTRACTOR_METATYPE_SONG_COUNT,
+ EXTRACTOR_METATYPE_STARTING_SONG,
+ EXTRACTOR_METATYPE_BEATS_PER_MINUTE,
+ EXTRACTOR_METATYPE_ORIGINAL_TITLE,
+ EXTRACTOR_METATYPE_ORIGINAL_ARTIST,
+ EXTRACTOR_METATYPE_ORIGINAL_WRITER,
+ EXTRACTOR_METATYPE_ORIGINAL_RELEASE_YEAR,
+ EXTRACTOR_METATYPE_ORIGINAL_PERFORMER,
+ EXTRACTOR_METATYPE_MUSICIAN_CREDITS_LIST,
+ EXTRACTOR_METATYPE_SUBTITLE,
#endif
- EXTRACTOR_METATYPE_RESERVED
-};
+ EXTRACTOR_METATYPE_RESERVED};
-gint types_video[] =
-{
- EXTRACTOR_METATYPE_MIMETYPE,
- EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
- EXTRACTOR_METATYPE_TITLE,
+gint types_video[] = {EXTRACTOR_METATYPE_MIMETYPE,
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+ EXTRACTOR_METATYPE_TITLE,
#if HAVE_EXTRACTOR_H
- EXTRACTOR_METATYPE_GENRE,
- EXTRACTOR_METATYPE_KEYWORDS,
- EXTRACTOR_METATYPE_SUMMARY,
- EXTRACTOR_METATYPE_DESCRIPTION,
- EXTRACTOR_METATYPE_DURATION,
- EXTRACTOR_METATYPE_IMAGE_DIMENSIONS,
- EXTRACTOR_METATYPE_COMMENT,
- EXTRACTOR_METATYPE_CREATOR,
- EXTRACTOR_METATYPE_WRITER,
- EXTRACTOR_METATYPE_MOVIE_DIRECTOR,
- EXTRACTOR_METATYPE_PRODUCER,
- EXTRACTOR_METATYPE_PUBLISHER,
- EXTRACTOR_METATYPE_NETWORK_NAME,
- EXTRACTOR_METATYPE_SHOW_NAME,
- EXTRACTOR_METATYPE_CHAPTER_NAME,
- EXTRACTOR_METATYPE_MUSICIAN_CREDITS_LIST,
- EXTRACTOR_METATYPE_COPYRIGHT,
- EXTRACTOR_METATYPE_URI,
- EXTRACTOR_METATYPE_LOCATION_CITY,
- EXTRACTOR_METATYPE_LOCATION_COUNTRY,
- EXTRACTOR_METATYPE_LOCATION_COUNTRY_CODE,
- EXTRACTOR_METATYPE_CREATION_DATE,
- EXTRACTOR_METATYPE_PERFORMER,
+ EXTRACTOR_METATYPE_GENRE,
+ EXTRACTOR_METATYPE_KEYWORDS,
+ EXTRACTOR_METATYPE_SUMMARY,
+ EXTRACTOR_METATYPE_DESCRIPTION,
+ EXTRACTOR_METATYPE_DURATION,
+ EXTRACTOR_METATYPE_IMAGE_DIMENSIONS,
+ EXTRACTOR_METATYPE_COMMENT,
+ EXTRACTOR_METATYPE_CREATOR,
+ EXTRACTOR_METATYPE_WRITER,
+ EXTRACTOR_METATYPE_MOVIE_DIRECTOR,
+ EXTRACTOR_METATYPE_PRODUCER,
+ EXTRACTOR_METATYPE_PUBLISHER,
+ EXTRACTOR_METATYPE_NETWORK_NAME,
+ EXTRACTOR_METATYPE_SHOW_NAME,
+ EXTRACTOR_METATYPE_CHAPTER_NAME,
+ EXTRACTOR_METATYPE_MUSICIAN_CREDITS_LIST,
+ EXTRACTOR_METATYPE_COPYRIGHT,
+ EXTRACTOR_METATYPE_URI,
+ EXTRACTOR_METATYPE_LOCATION_CITY,
+ EXTRACTOR_METATYPE_LOCATION_COUNTRY,
+ EXTRACTOR_METATYPE_LOCATION_COUNTRY_CODE,
+ EXTRACTOR_METATYPE_CREATION_DATE,
+ EXTRACTOR_METATYPE_PERFORMER,
#endif
- EXTRACTOR_METATYPE_RESERVED
-};
+ EXTRACTOR_METATYPE_RESERVED};
-gint types_image[] =
-{
- EXTRACTOR_METATYPE_MIMETYPE,
- EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
- EXTRACTOR_METATYPE_TITLE,
- EXTRACTOR_METATYPE_KEYWORDS,
- EXTRACTOR_METATYPE_DESCRIPTION,
+gint types_image[] = {EXTRACTOR_METATYPE_MIMETYPE,
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+ EXTRACTOR_METATYPE_TITLE,
+ EXTRACTOR_METATYPE_KEYWORDS,
+ EXTRACTOR_METATYPE_DESCRIPTION,
#if HAVE_EXTRACTOR_H
- EXTRACTOR_METATYPE_IMAGE_DIMENSIONS,
- EXTRACTOR_METATYPE_IMAGE_RESOLUTION,
- EXTRACTOR_METATYPE_COMMENT,
- EXTRACTOR_METATYPE_COPYRIGHT,
- EXTRACTOR_METATYPE_SUBJECT,
- EXTRACTOR_METATYPE_CREATOR,
- EXTRACTOR_METATYPE_CREATION_DATE,
- EXTRACTOR_METATYPE_URI,
- EXTRACTOR_METATYPE_LOCATION_CITY,
- EXTRACTOR_METATYPE_LOCATION_COUNTRY,
- EXTRACTOR_METATYPE_LOCATION_COUNTRY_CODE,
- EXTRACTOR_METATYPE_ORGANIZATION,
+ EXTRACTOR_METATYPE_IMAGE_DIMENSIONS,
+ EXTRACTOR_METATYPE_IMAGE_RESOLUTION,
+ EXTRACTOR_METATYPE_COMMENT,
+ EXTRACTOR_METATYPE_COPYRIGHT,
+ EXTRACTOR_METATYPE_SUBJECT,
+ EXTRACTOR_METATYPE_CREATOR,
+ EXTRACTOR_METATYPE_CREATION_DATE,
+ EXTRACTOR_METATYPE_URI,
+ EXTRACTOR_METATYPE_LOCATION_CITY,
+ EXTRACTOR_METATYPE_LOCATION_COUNTRY,
+ EXTRACTOR_METATYPE_LOCATION_COUNTRY_CODE,
+ EXTRACTOR_METATYPE_ORGANIZATION,
#endif
- EXTRACTOR_METATYPE_RESERVED
-};
+ EXTRACTOR_METATYPE_RESERVED};
-gint types_namespace[] =
-{ /* Namespace */
- EXTRACTOR_METATYPE_MIMETYPE,
- EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
- EXTRACTOR_METATYPE_COMMENT,
- EXTRACTOR_METATYPE_TITLE,
- EXTRACTOR_METATYPE_DESCRIPTION,
+gint types_namespace[] = {/* Namespace */
+ EXTRACTOR_METATYPE_MIMETYPE,
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+ EXTRACTOR_METATYPE_COMMENT,
+ EXTRACTOR_METATYPE_TITLE,
+ EXTRACTOR_METATYPE_DESCRIPTION,
#if HAVE_EXTRACTOR_H
- EXTRACTOR_METATYPE_COPYRIGHT,
- EXTRACTOR_METATYPE_RIGHTS,
- EXTRACTOR_METATYPE_KEYWORDS,
- EXTRACTOR_METATYPE_ABSTRACT,
- EXTRACTOR_METATYPE_SUMMARY,
- EXTRACTOR_METATYPE_SUBJECT,
- EXTRACTOR_METATYPE_CREATOR,
- EXTRACTOR_METATYPE_RATING,
- EXTRACTOR_METATYPE_ORGANIZATION,
- EXTRACTOR_METATYPE_RIPPER,
- EXTRACTOR_METATYPE_PRODUCER,
- EXTRACTOR_METATYPE_GROUP,
+ EXTRACTOR_METATYPE_COPYRIGHT,
+ EXTRACTOR_METATYPE_RIGHTS,
+ EXTRACTOR_METATYPE_KEYWORDS,
+ EXTRACTOR_METATYPE_ABSTRACT,
+ EXTRACTOR_METATYPE_SUMMARY,
+ EXTRACTOR_METATYPE_SUBJECT,
+ EXTRACTOR_METATYPE_CREATOR,
+ EXTRACTOR_METATYPE_RATING,
+ EXTRACTOR_METATYPE_ORGANIZATION,
+ EXTRACTOR_METATYPE_RIPPER,
+ EXTRACTOR_METATYPE_PRODUCER,
+ EXTRACTOR_METATYPE_GROUP,
#endif
- EXTRACTOR_METATYPE_RESERVED
-};
+ EXTRACTOR_METATYPE_RESERVED};
-gint types_software[] =
-{
- EXTRACTOR_METATYPE_MIMETYPE,
- EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
- EXTRACTOR_METATYPE_PACKAGE_NAME,
+gint types_software[] = {EXTRACTOR_METATYPE_MIMETYPE,
+ EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME,
+ EXTRACTOR_METATYPE_PACKAGE_NAME,
#if HAVE_EXTRACTOR_H
- EXTRACTOR_METATYPE_PACKAGE_VERSION,
- EXTRACTOR_METATYPE_TARGET_ARCHITECTURE,
- EXTRACTOR_METATYPE_LICENSE,
- EXTRACTOR_METATYPE_TARGET_OS,
- EXTRACTOR_METATYPE_COMMENT,
- EXTRACTOR_METATYPE_SECTION,
- EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
- EXTRACTOR_METATYPE_PACKAGE_CONFLICTS,
- EXTRACTOR_METATYPE_PACKAGE_REPLACES,
- EXTRACTOR_METATYPE_PACKAGE_PROVIDES,
- EXTRACTOR_METATYPE_PACKAGE_RECOMMENDS,
- EXTRACTOR_METATYPE_PACKAGE_SUGGESTS,
- EXTRACTOR_METATYPE_PACKAGE_MAINTAINER,
- EXTRACTOR_METATYPE_PACKAGE_INSTALLED_SIZE,
- EXTRACTOR_METATYPE_PACKAGE_SOURCE,
- EXTRACTOR_METATYPE_PACKAGE_ESSENTIAL,
- EXTRACTOR_METATYPE_PACKAGE_PRE_DEPENDENCY,
- EXTRACTOR_METATYPE_PACKAGE_DISTRIBUTION,
- EXTRACTOR_METATYPE_BUILDHOST,
- EXTRACTOR_METATYPE_VENDOR,
- EXTRACTOR_METATYPE_SOFTWARE_VERSION,
- EXTRACTOR_METATYPE_TARGET_PLATFORM,
- EXTRACTOR_METATYPE_RESOURCE_TYPE,
- EXTRACTOR_METATYPE_LIBRARY_SEARCH_PATH,
- EXTRACTOR_METATYPE_LIBRARY_DEPENDENCY,
- EXTRACTOR_METATYPE_UPLOAD_PRIORITY,
+ EXTRACTOR_METATYPE_PACKAGE_VERSION,
+ EXTRACTOR_METATYPE_TARGET_ARCHITECTURE,
+ EXTRACTOR_METATYPE_LICENSE,
+ EXTRACTOR_METATYPE_TARGET_OS,
+ EXTRACTOR_METATYPE_COMMENT,
+ EXTRACTOR_METATYPE_SECTION,
+ EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY,
+ EXTRACTOR_METATYPE_PACKAGE_CONFLICTS,
+ EXTRACTOR_METATYPE_PACKAGE_REPLACES,
+ EXTRACTOR_METATYPE_PACKAGE_PROVIDES,
+ EXTRACTOR_METATYPE_PACKAGE_RECOMMENDS,
+ EXTRACTOR_METATYPE_PACKAGE_SUGGESTS,
+ EXTRACTOR_METATYPE_PACKAGE_MAINTAINER,
+ EXTRACTOR_METATYPE_PACKAGE_INSTALLED_SIZE,
+ EXTRACTOR_METATYPE_PACKAGE_SOURCE,
+ EXTRACTOR_METATYPE_PACKAGE_ESSENTIAL,
+ EXTRACTOR_METATYPE_PACKAGE_PRE_DEPENDENCY,
+ EXTRACTOR_METATYPE_PACKAGE_DISTRIBUTION,
+ EXTRACTOR_METATYPE_BUILDHOST,
+ EXTRACTOR_METATYPE_VENDOR,
+ EXTRACTOR_METATYPE_SOFTWARE_VERSION,
+ EXTRACTOR_METATYPE_TARGET_PLATFORM,
+ EXTRACTOR_METATYPE_RESOURCE_TYPE,
+ EXTRACTOR_METATYPE_LIBRARY_SEARCH_PATH,
+ EXTRACTOR_METATYPE_LIBRARY_DEPENDENCY,
+ EXTRACTOR_METATYPE_UPLOAD_PRIORITY,
#endif
- EXTRACTOR_METATYPE_RESERVED
-};
+ EXTRACTOR_METATYPE_RESERVED};
/**
@@ -237,15 +218,13 @@ gint types_software[] =
* FIXME-FEATURE-UNCLEAN-MAYBE: should probably move that name list in
* here and only have one place for both...
*/
-gint *types[] = {
- types_generic,
- types_text,
- types_music,
- types_video,
- types_image,
- types_software,
- types_namespace,
- NULL
-};
+gint *types[] = {types_generic,
+ types_text,
+ types_music,
+ types_video,
+ types_image,
+ types_software,
+ types_namespace,
+ NULL};
/* *INDENT-ON* */
diff --git a/src/include/gnunet_gtk.h b/src/include/gnunet_gtk.h
index 582a3c39..5ec8901e 100644
--- a/src/include/gnunet_gtk.h
+++ b/src/include/gnunet_gtk.h
@@ -52,7 +52,6 @@
struct GNUNET_GTK_MainLoop;
-
/* ****************** Initialization *************** */
/**
@@ -63,8 +62,7 @@ struct GNUNET_GTK_MainLoop;
* @return new main window to initialize
*/
GtkWidget *
-GNUNET_GTK_plug_me (const char *env_name,
- GtkWidget *main_window);
+GNUNET_GTK_plug_me (const char *env_name, GtkWidget *main_window);
/**
@@ -130,7 +128,8 @@ GNUNET_GTK_get_new_builder2 (const char *filename,
* use "NULL" to pass the GtkBuilder itself.
* @return NULL on error
*/
-#define GNUNET_GTK_get_new_builder(filename,user_data)
GNUNET_GTK_get_new_builder2(filename,user_data,NULL)
+#define GNUNET_GTK_get_new_builder(filename, user_data) \
+ GNUNET_GTK_get_new_builder2 (filename, user_data, NULL)
/**
@@ -188,8 +187,7 @@ GNUNET_GTK_filechooser_get_filename_utf8 (GtkFileChooser
*fc);
* @param root root of the subtree to remove
*/
void
-GNUNET_FS_GTK_remove_treestore_subtree (GtkTreeStore *ts,
- GtkTreeIter *root);
+GNUNET_FS_GTK_remove_treestore_subtree (GtkTreeStore *ts, GtkTreeIter *root);
/* ******************* main loop ***************** */
@@ -210,7 +208,8 @@ GNUNET_FS_GTK_remove_treestore_subtree (GtkTreeStore *ts,
int
GNUNET_GTK_main_loop_start (const char *binary_name,
const char *binary_help,
- int argc, char *const *argv,
+ int argc,
+ char *const *argv,
struct GNUNET_GETOPT_CommandLineOption *options,
const char *main_window_file,
GNUNET_SCHEDULER_TaskCallback main_task);
@@ -343,7 +342,8 @@ GNUNET_GTK_animation_context_destroy (struct
GNUNET_GTK_AnimationContext *ac);
* @return pixbuf of the AC, NULL on error loading the pixbuf
*/
GdkPixbuf *
-GNUNET_GTK_animation_context_get_pixbuf (struct GNUNET_GTK_AnimationContext
*ac);
+GNUNET_GTK_animation_context_get_pixbuf (
+ struct GNUNET_GTK_AnimationContext *ac);
/**
@@ -366,7 +366,8 @@ GNUNET_GTK_animation_tree_view_register (GtkTreeView *tv,
* @param atv tree view to unregister
*/
void
-GNUNET_GTK_animation_tree_view_unregister (struct
GNUNET_GTK_AnimationTreeViewHandle *atv);
+GNUNET_GTK_animation_tree_view_unregister (
+ struct GNUNET_GTK_AnimationTreeViewHandle *atv);
/* ********************* generic helpers ******************* */
diff --git a/src/include/gnunet_gtk_namestore_plugin.h
b/src/include/gnunet_gtk_namestore_plugin.h
index 34495079..ebf4ea87 100644
--- a/src/include/gnunet_gtk_namestore_plugin.h
+++ b/src/include/gnunet_gtk_namestore_plugin.h
@@ -43,7 +43,7 @@ struct GNUNET_GTK_NAMESTORE_PluginEnvironment
* the dialog were edited. It will check the validity of the dialog
* and update the "save" button accordingly.
*/
- void (*check_validity)(struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc);
+ void (*check_validity) (struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc);
/**
* Builder for the dialog.
@@ -134,7 +134,6 @@ struct GNUNET_GTK_NAMESTORE_PluginEnvironment
* Is this record pending?
*/
gboolean n_is_pending;
-
};
@@ -190,16 +189,13 @@ struct GNUNET_GTK_NAMESTORE_PluginFunctions
* widgets from the existing record (if there is one).
* The `n_value` is the existing value of the record as a string.
*/
- void (*load)(void *cls,
- gchar *n_value,
- GtkBuilder *builder);
+ void (*load) (void *cls, gchar *n_value, GtkBuilder *builder);
/**
* Function that will be called to retrieve the final value of the
* record (in string format) once the dialog is being closed.
*/
- gchar *(*store)(void *cls,
- GtkBuilder *builder);
+ gchar *(*store) (void *cls, GtkBuilder *builder);
/**
* Function to call to validate the state of the dialog. Should
@@ -208,8 +204,7 @@ struct GNUNET_GTK_NAMESTORE_PluginFunctions
* function should highlight fields with invalid inputs for the
* user.
*/
- int (*validate)(void *cls,
- GtkBuilder *builder);
+ int (*validate) (void *cls, GtkBuilder *builder);
/**
* Record type. Can be used by the plugin to override the
@@ -221,7 +216,6 @@ struct GNUNET_GTK_NAMESTORE_PluginFunctions
* dialog.
*/
uint32_t record_type;
-
};
diff --git a/src/lib/about.c b/src/lib/about.c
index 306be2cb..f6d84f37 100644
--- a/src/lib/about.c
+++ b/src/lib/about.c
@@ -81,7 +81,7 @@ destroy_about_dialog (struct AboutDialogContext *ctx)
*/
static void
about_window_show_exclusively (struct AboutDialogContext *ctx,
- const gchar * name)
+ const gchar *name)
{
if (NULL == name)
{
@@ -109,7 +109,7 @@ about_window_show_exclusively (struct AboutDialogContext
*ctx,
* @param ctx the dialog context
*/
G_MODULE_EXPORT void
-GNUNET_GTK_about_window_realized (GtkWidget * widget,
+GNUNET_GTK_about_window_realized (GtkWidget *widget,
struct AboutDialogContext *ctx)
{
gchar *license = NULL;
@@ -138,7 +138,7 @@ GNUNET_GTK_about_window_realized (GtkWidget * widget,
* @param ctx our dialog context
*/
G_MODULE_EXPORT void
-GNUNET_GTK_about_close_button_clicked (GtkButton * widget,
+GNUNET_GTK_about_close_button_clicked (GtkButton *widget,
struct AboutDialogContext *ctx)
{
destroy_about_dialog (ctx);
@@ -153,8 +153,8 @@ GNUNET_GTK_about_close_button_clicked (GtkButton * widget,
* @param ctx our dialog context
*/
G_MODULE_EXPORT gboolean
-GNUNET_GTK_about_window_got_delete_event (GtkWidget * widget,
- GdkEvent * event,
+GNUNET_GTK_about_window_got_delete_event (GtkWidget *widget,
+ GdkEvent *event,
struct AboutDialogContext *ctx)
{
destroy_about_dialog (ctx);
@@ -169,7 +169,7 @@ GNUNET_GTK_about_window_got_delete_event (GtkWidget *
widget,
* @param ctx our dialog context
*/
G_MODULE_EXPORT void
-GNUNET_GTK_about_credits_button_clicked (GtkButton * widget,
+GNUNET_GTK_about_credits_button_clicked (GtkButton *widget,
struct AboutDialogContext *ctx)
{
about_window_show_exclusively (ctx, "about_credits_notebook");
@@ -183,7 +183,7 @@ GNUNET_GTK_about_credits_button_clicked (GtkButton * widget,
* @param ctx our dialog context
*/
G_MODULE_EXPORT void
-GNUNET_GTK_about_license_button_clicked (GtkButton * widget,
+GNUNET_GTK_about_license_button_clicked (GtkButton *widget,
struct AboutDialogContext *ctx)
{
about_window_show_exclusively (ctx, "about_license_scroller");
@@ -211,13 +211,13 @@ GNUNET_GTK_display_about (const char *dialogfile)
GNUNET_free (ctx);
return;
}
- ctx->about_credits_notebook =
- GTK_WIDGET (gtk_builder_get_object (ctx->builder,
"about_credits_notebook"));
- ctx->about_license_scroller =
- GTK_WIDGET (gtk_builder_get_object (ctx->builder,
"about_license_scroller"));
+ ctx->about_credits_notebook = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder, "about_credits_notebook"));
+ ctx->about_license_scroller = GTK_WIDGET (
+ gtk_builder_get_object (ctx->builder, "about_license_scroller"));
ctx->ad = GTK_WIDGET (gtk_builder_get_object (ctx->builder, "about_window"));
ctx->license_contents =
- GTK_TEXT_BUFFER (gtk_builder_get_object (ctx->builder,
"license_contents"));
+ GTK_TEXT_BUFFER (gtk_builder_get_object (ctx->builder,
"license_contents"));
gtk_widget_show (ctx->ad);
}
diff --git a/src/lib/animations.c b/src/lib/animations.c
index ce030f70..0faa2a46 100644
--- a/src/lib/animations.c
+++ b/src/lib/animations.c
@@ -31,7 +31,8 @@
* to fit with the animations used, but not so tiny that we just
* wake up the CPU for nothing all the time.
*/
-#define TICKER_DELAY GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MILLISECONDS, 100)
+#define TICKER_DELAY \
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 100)
/**
@@ -64,7 +65,6 @@ struct GNUNET_GTK_AnimationContext
* Pixbuf with the current image from the animation.
*/
GdkPixbuf *pixbuf;
-
};
@@ -141,18 +141,17 @@ GNUNET_GTK_animation_context_create (const char *filename)
ac = GNUNET_new (struct GNUNET_GTK_AnimationContext);
ac->ani = gdk_pixbuf_animation_new_from_file (filename, &err);
if (NULL == ac->ani)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Failed to load animation from file `%s'\n"),
- filename);
- GNUNET_free (ac);
- return NULL;
- }
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _ ("Failed to load animation from file `%s'\n"),
+ filename);
+ GNUNET_free (ac);
+ return NULL;
+ }
ac->iter = gdk_pixbuf_animation_get_iter (ac->ani, NULL);
- ac->pixbuf = gdk_pixbuf_copy (gdk_pixbuf_animation_iter_get_pixbuf
(ac->iter));
- GNUNET_CONTAINER_DLL_insert (animation_head,
- animation_tail,
- ac);
+ ac->pixbuf =
+ gdk_pixbuf_copy (gdk_pixbuf_animation_iter_get_pixbuf (ac->iter));
+ GNUNET_CONTAINER_DLL_insert (animation_head, animation_tail, ac);
return ac;
}
@@ -171,9 +170,7 @@ GNUNET_GTK_animation_context_destroy (struct
GNUNET_GTK_AnimationContext *ac)
g_object_unref (ac->pixbuf);
g_object_unref (ac->iter);
g_object_unref (ac->ani);
- GNUNET_CONTAINER_DLL_remove (animation_head,
- animation_tail,
- ac);
+ GNUNET_CONTAINER_DLL_remove (animation_head, animation_tail, ac);
GNUNET_free (ac);
}
@@ -209,7 +206,7 @@ tick_animation (struct GNUNET_GTK_AnimationContext *ac)
gint width;
gint height;
- if (!gdk_pixbuf_animation_iter_advance (ac->iter, NULL))
+ if (! gdk_pixbuf_animation_iter_advance (ac->iter, NULL))
return 0;
pixbuf = gdk_pixbuf_animation_iter_get_pixbuf (ac->iter);
width = gdk_pixbuf_get_width (pixbuf);
@@ -243,14 +240,22 @@ redraw_tree_view (struct
GNUNET_GTK_AnimationTreeViewHandle *atv)
x = r.x;
width = r.width;
gtk_tree_view_convert_bin_window_to_widget_coords (atv->tv, x, 0, &r.x,
NULL);
- gtk_tree_view_convert_bin_window_to_widget_coords (atv->tv, x + width, 0,
&r.width, NULL);
+ gtk_tree_view_convert_bin_window_to_widget_coords (atv->tv,
+ x + width,
+ 0,
+ &r.width,
+ NULL);
/* Get visible area of the treeview, in tree coordinates */
gtk_tree_view_get_visible_rect (atv->tv, &tr);
/* Convert y and height of the visible area to widget coordinates */
gtk_tree_view_convert_tree_to_widget_coords (atv->tv, 0, tr.y, NULL, &r.y);
- gtk_tree_view_convert_tree_to_widget_coords (atv->tv, 0, tr.y + tr.height,
NULL, &r.height);
+ gtk_tree_view_convert_tree_to_widget_coords (atv->tv,
+ 0,
+ tr.y + tr.height,
+ NULL,
+ &r.height);
/* r now encloses only column image_col, redraw it */
gdk_window_invalidate_rect (gw, &r, TRUE);
@@ -269,9 +274,7 @@ ticker (void *cls)
struct GNUNET_GTK_AnimationTreeViewHandle *atv;
unsigned int counter;
- ticker_task = GNUNET_SCHEDULER_add_delayed (TICKER_DELAY,
- &ticker,
- NULL);
+ ticker_task = GNUNET_SCHEDULER_add_delayed (TICKER_DELAY, &ticker, NULL);
counter = 0;
for (pos = animation_head; NULL != pos; pos = pos->next)
counter += tick_animation (pos);
@@ -293,20 +296,16 @@ ticker (void *cls)
*/
struct GNUNET_GTK_AnimationTreeViewHandle *
GNUNET_GTK_animation_tree_view_register (GtkTreeView *tv,
- GtkTreeViewColumn *image_col)
+ GtkTreeViewColumn *image_col)
{
struct GNUNET_GTK_AnimationTreeViewHandle *atv;
atv = GNUNET_new (struct GNUNET_GTK_AnimationTreeViewHandle);
atv->tv = tv;
atv->image_col = image_col;
- GNUNET_CONTAINER_DLL_insert (atv_head,
- atv_tail,
- atv);
+ GNUNET_CONTAINER_DLL_insert (atv_head, atv_tail, atv);
if (NULL == ticker_task)
- ticker_task = GNUNET_SCHEDULER_add_delayed (TICKER_DELAY,
- &ticker,
- NULL);
+ ticker_task = GNUNET_SCHEDULER_add_delayed (TICKER_DELAY, &ticker, NULL);
return atv;
}
@@ -317,11 +316,10 @@ GNUNET_GTK_animation_tree_view_register (GtkTreeView *tv,
* @param atv tree view to unregister
*/
void
-GNUNET_GTK_animation_tree_view_unregister (struct
GNUNET_GTK_AnimationTreeViewHandle *atv)
+GNUNET_GTK_animation_tree_view_unregister (
+ struct GNUNET_GTK_AnimationTreeViewHandle *atv)
{
- GNUNET_CONTAINER_DLL_remove (atv_head,
- atv_tail,
- atv);
+ GNUNET_CONTAINER_DLL_remove (atv_head, atv_tail, atv);
GNUNET_free (atv);
if (NULL != atv_head)
return;
diff --git a/src/lib/eventloop.c b/src/lib/eventloop.c
index 7d06ee37..1db9502f 100644
--- a/src/lib/eventloop.c
+++ b/src/lib/eventloop.c
@@ -111,7 +111,7 @@ struct GNUNET_GTK_MainLoop
/**
* Remaining command-line arguments.
*/
- char *const*argv;
+ char *const *argv;
/**
* Number of remaining arguments.
@@ -172,7 +172,6 @@ struct GNUNET_GTK_MainLoop
*/
struct GNUNET_CONTAINER_SList *handles_except;
#endif
-
};
@@ -184,8 +183,7 @@ struct GNUNET_GTK_MainLoop
* @return new main window to initialize
*/
GtkWidget *
-GNUNET_GTK_plug_me (const char *env_name,
- GtkWidget *main_window)
+GNUNET_GTK_plug_me (const char *env_name, GtkWidget *main_window)
{
#if HAVE_GTK_GTKX_H
#ifdef GDK_WINDOWING_X11
@@ -196,22 +194,16 @@ GNUNET_GTK_plug_me (const char *env_name,
if (NULL == (plugid = getenv (env_name)))
return main_window; /* no plugging */
- if (1 != sscanf (plugid,
- "%llu",
- &id))
+ if (1 != sscanf (plugid, "%llu", &id))
{
- fprintf (stderr,
- _("Invalid plug name `%s'\n"),
- plugid);
+ fprintf (stderr, _ ("Invalid plug name `%s'\n"), plugid);
return main_window;
}
plug = gtk_plug_new ((Window) id);
child = gtk_bin_get_child (GTK_BIN (main_window));
g_object_ref (child);
- gtk_container_remove (GTK_CONTAINER (main_window),
- child);
- gtk_container_add (GTK_CONTAINER (plug),
- child);
+ gtk_container_remove (GTK_CONTAINER (main_window), child);
+ gtk_container_add (GTK_CONTAINER (plug), child);
g_object_unref (child);
gtk_widget_destroy (main_window);
return plug;
@@ -270,7 +262,7 @@ GNUNET_GTK_main_loop_get_builder (struct
GNUNET_GTK_MainLoop *ml)
int
GNUNET_GTK_main_loop_build_window (struct GNUNET_GTK_MainLoop *ml,
- gpointer data)
+ gpointer data)
{
ml->builder = GNUNET_GTK_get_new_builder (ml->main_window_file, data);
if (ml->builder == NULL)
@@ -303,7 +295,7 @@ GNUNET_GTK_main_loop_get_configuration_file (struct
GNUNET_GTK_MainLoop *ml)
* @return NULL on error, otherwise the object
*/
GObject *
-GNUNET_GTK_main_loop_get_object (struct GNUNET_GTK_MainLoop * ml,
+GNUNET_GTK_main_loop_get_object (struct GNUNET_GTK_MainLoop *ml,
const char *name)
{
return gtk_builder_get_object (ml->builder, name);
@@ -318,9 +310,9 @@ GNUNET_GTK_main_loop_get_object (struct GNUNET_GTK_MainLoop
* ml,
* @param argv set to argument vector
*/
void
-GNUNET_GTK_main_loop_get_args (struct GNUNET_GTK_MainLoop * ml,
- int *argc,
- char *const**argv)
+GNUNET_GTK_main_loop_get_args (struct GNUNET_GTK_MainLoop *ml,
+ int *argc,
+ char *const **argv)
{
*argc = ml->argc;
*argv = ml->argv;
@@ -367,9 +359,9 @@ keepalive_task (void *cls)
struct GNUNET_GTK_MainLoop *ml = cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Dummy task was scheduled\n");
- ml->dummy_task
- = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &keepalive_task, ml);
+ ml->dummy_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
+ &keepalive_task,
+ ml);
}
@@ -420,8 +412,7 @@ struct _select_params_gtk
int status;
};
-static unsigned __stdcall
-_gnunet_selector_thread (void *p)
+static unsigned __stdcall _gnunet_selector_thread (void *p)
{
struct _select_params_gtk *sp = p;
@@ -429,7 +420,8 @@ _gnunet_selector_thread (void *p)
{
WaitForSingleObject (sp->event_to_wait_for_a_job, INFINITE);
ResetEvent (sp->event_to_wait_for_a_job);
- sp->status = GNUNET_NETWORK_socket_select (sp->rfds, sp->wfds, sp->efds,
sp->timeout);
+ sp->status =
+ GNUNET_NETWORK_socket_select (sp->rfds, sp->wfds, sp->efds, sp->timeout);
SetEvent (sp->event_to_signal_we_woke_up);
}
return 0;
@@ -518,7 +510,8 @@ gnunet_gtk_select (void *cls,
wakeup_event_for_gnunet = CreateEvent (NULL, TRUE, FALSE, NULL);
gnunet_woke_up_event = CreateEvent (NULL, TRUE, FALSE, NULL);
standin_rfds = GNUNET_NETWORK_fdset_create ();
- wakeup_event_for_gnunet_fh = GNUNET_DISK_get_handle_from_w32_handle
(wakeup_event_for_gnunet);
+ wakeup_event_for_gnunet_fh =
+ GNUNET_DISK_get_handle_from_w32_handle (wakeup_event_for_gnunet);
gnunet_selector_thread_job_event = CreateEvent (NULL, TRUE, FALSE, NULL);
sp = GNUNET_new (struct _select_params_gtk);
@@ -526,20 +519,20 @@ gnunet_gtk_select (void *cls,
sp->event_to_that_wakes_us_up = wakeup_event_for_gnunet;
sp->event_to_wait_for_a_job = gnunet_selector_thread_job_event;
- gnunet_select_subthread = (HANDLE) _beginthreadex (NULL, 0,
_gnunet_selector_thread, sp, 0, NULL);
+ gnunet_select_subthread =
+ (HANDLE) _beginthreadex (NULL, 0, _gnunet_selector_thread, sp, 0, NULL);
g_once_init_leave (&initialized, 1);
}
- if (wakeup_event_for_gnunet == NULL ||
- gnunet_woke_up_event == NULL ||
- gnunet_select_subthread == NULL ||
- wakeup_event_for_gnunet_fh == NULL ||
+ if (wakeup_event_for_gnunet == NULL || gnunet_woke_up_event == NULL ||
+ gnunet_select_subthread == NULL || wakeup_event_for_gnunet_fh == NULL ||
gnunet_selector_thread_job_event == NULL)
{
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%s", _("Failed to initialize GNUnet-GTK select\n"));
+ "%s",
+ _ ("Failed to initialize GNUnet-GTK select\n"));
return GNUNET_SYSERR;
}
@@ -547,7 +540,8 @@ gnunet_gtk_select (void *cls,
/* Optimization hack: assume that at least one of the fds
* is not NULL and not empty.
*/
- gnunet_select_result = GNUNET_NETWORK_socket_select (rfds, wfds, efds,
timeout_from_delay);
+ gnunet_select_result =
+ GNUNET_NETWORK_socket_select (rfds, wfds, efds, timeout_from_delay);
if (gnunet_select_result < 0)
return gnunet_select_result;
@@ -559,25 +553,28 @@ gnunet_gtk_select (void *cls,
if (NULL != ml->gmc)
{
g_main_context_prepare (ml->gmc, &max_priority);
- need_gfds =
- g_main_context_query (ml->gmc, max_priority, &delay,
- ml->cached_poll_array,
- ml->cached_poll_array_size);
+ need_gfds = g_main_context_query (ml->gmc,
+ max_priority,
+ &delay,
+ ml->cached_poll_array,
+ ml->cached_poll_array_size);
if (ml->cached_poll_array_size < need_gfds + 1)
{
GNUNET_break (0);
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Ran out of handle space - g_poll() needs %d handles, has %d!\n"),
- need_gfds + 1, ml->cached_poll_array_size);
+ GNUNET_log (
+ GNUNET_ERROR_TYPE_ERROR,
+ _ ("Ran out of handle space - g_poll() needs %d handles, has %d!\n"),
+ need_gfds + 1,
+ ml->cached_poll_array_size);
return GNUNET_SYSERR;
}
}
if (timeout.rel_value_us != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)
{
if (delay >= 0)
- delay =
- GNUNET_MIN (timeout.rel_value_us /
- GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us, delay);
+ delay = GNUNET_MIN (timeout.rel_value_us /
+ GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us,
+ delay);
else
delay = timeout.rel_value_us /
GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us;
}
@@ -587,15 +584,14 @@ gnunet_gtk_select (void *cls,
{
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "g_poll() returned %d\n",
- g_poll_result);
+ "g_poll() returned %d\n",
+ g_poll_result);
return GNUNET_SYSERR;
}
- g_poll_result = (GNUNET_YES == handle_gui_events (ml, max_priority,
need_gfds)) ? 1 : 0;
+ g_poll_result =
+ (GNUNET_YES == handle_gui_events (ml, max_priority, need_gfds)) ? 1 : 0;
- if ((gnunet_select_result > 0) ||
- (g_poll_result > 0) ||
- (delay == 0))
+ if ((gnunet_select_result > 0) || (g_poll_result > 0) || (delay == 0))
{
return gnunet_select_result + g_poll_result;
}
@@ -616,7 +612,8 @@ gnunet_gtk_select (void *cls,
sp->wfds = wfds;
sp->efds = efds;
- sp->timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
delay);
+ sp->timeout =
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, delay);
ml->cached_poll_array[need_gfds].fd = (intptr_t) gnunet_woke_up_event;
ml->cached_poll_array[need_gfds].events = G_IO_IN;
@@ -632,11 +629,12 @@ gnunet_gtk_select (void *cls,
wait_result = WaitForSingleObject (gnunet_woke_up_event, INFINITE);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Finished waiting for the gnunet select thread: %lu %d\n",
- wait_result,
- sp->status);
+ "Finished waiting for the gnunet select thread: %lu %d\n",
+ wait_result,
+ sp->status);
- g_poll_result = (GNUNET_YES == handle_gui_events (ml, max_priority,
need_gfds)) ? 1 : 0;
+ g_poll_result =
+ (GNUNET_YES == handle_gui_events (ml, max_priority, need_gfds)) ? 1 : 0;
if (-1 == sp->status)
{
@@ -675,7 +673,8 @@ gnunet_gtk_select (void *cls,
* @return number of selected sockets, GNUNET_SYSERR on error
*/
static int
-gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet *rfds,
+gnunet_gtk_select (void *cls,
+ struct GNUNET_NETWORK_FDSet *rfds,
struct GNUNET_NETWORK_FDSet *wfds,
struct GNUNET_NETWORK_FDSet *efds,
const struct GNUNET_TIME_Relative timeout)
@@ -728,15 +727,14 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet
*rfds,
isset[0] = (rfds == NULL) ? 0 : FD_ISSET (i, &rfds->sds);
isset[1] = (wfds == NULL) ? 0 : FD_ISSET (i, &wfds->sds);
isset[2] = (efds == NULL) ? 0 : FD_ISSET (i, &efds->sds);
- if ((!isset[0]) && (!isset[1]) && (!isset[2]))
+ if ((! isset[0]) && (! isset[1]) && (! isset[2]))
continue;
if (fd_counter >= ml->cached_poll_array_size)
resize_cached_poll_array (ml, ml->cached_poll_array_size * 2);
ml->cached_poll_array[fd_counter].fd = i;
ml->cached_poll_array[fd_counter].events =
- (isset[0] ? G_IO_IN | G_IO_HUP | G_IO_ERR : 0) | (isset[1] ? G_IO_OUT |
- G_IO_ERR : 0) |
- (isset[2] ? G_IO_ERR : 0);
+ (isset[0] ? G_IO_IN | G_IO_HUP | G_IO_ERR : 0) |
+ (isset[1] ? G_IO_OUT | G_IO_ERR : 0) | (isset[2] ? G_IO_ERR : 0);
fd_counter++;
}
@@ -747,9 +745,11 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet
*rfds,
while (1)
{
need_gfds =
- g_main_context_query (ml->gmc, max_priority, &delay,
- &ml->cached_poll_array[fd_counter],
- ml->cached_poll_array_size - fd_counter);
+ g_main_context_query (ml->gmc,
+ max_priority,
+ &delay,
+ &ml->cached_poll_array[fd_counter],
+ ml->cached_poll_array_size - fd_counter);
if (ml->cached_poll_array_size >= need_gfds + fd_counter)
break;
resize_cached_poll_array (ml, fd_counter + need_gfds);
@@ -758,16 +758,18 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet
*rfds,
if (timeout.rel_value_us != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)
{
if (delay >= 0)
- delay =
- GNUNET_MIN (timeout.rel_value_us /
- GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us, delay);
+ delay = GNUNET_MIN (timeout.rel_value_us /
+ GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us,
+ delay);
else
delay = timeout.rel_value_us /
GNUNET_TIME_UNIT_MILLISECONDS.rel_value_us;
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"We have %d of our FDs and %d of GMC ones, going to wait
%6dms\n",
- fd_counter, need_gfds, delay);
+ fd_counter,
+ need_gfds,
+ delay);
poll_result = g_poll (ml->cached_poll_array, fd_counter + need_gfds, delay);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "g_poll returned : %d\n", poll_result);
if (-1 == poll_result)
@@ -784,10 +786,11 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet
*rfds,
max_priority,
&ml->cached_poll_array[fd_counter],
need_gfds))
- GNUNET_SCHEDULER_add_with_reason_and_priority (&dispatch_gtk_task,
- ml,
-
GNUNET_SCHEDULER_REASON_STARTUP,
-
GNUNET_SCHEDULER_PRIORITY_UI);
+ GNUNET_SCHEDULER_add_with_reason_and_priority (
+ &dispatch_gtk_task,
+ ml,
+ GNUNET_SCHEDULER_REASON_STARTUP,
+ GNUNET_SCHEDULER_PRIORITY_UI);
}
/* Now map back GNUnet scheduler events ... */
if (NULL != rfds)
@@ -801,11 +804,9 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet
*rfds,
int set = 0;
if ((NULL != rfds) &&
- (set |=
- (FD_ISSET (ml->cached_poll_array[ui].fd, &aread) &&
- (0 !=
- (ml->cached_poll_array[ui].
- revents & (G_IO_IN | G_IO_HUP | G_IO_ERR))))))
+ (set |= (FD_ISSET (ml->cached_poll_array[ui].fd, &aread) &&
+ (0 != (ml->cached_poll_array[ui].revents &
+ (G_IO_IN | G_IO_HUP | G_IO_ERR))))))
GNUNET_NETWORK_fdset_set_native (rfds, ml->cached_poll_array[ui].fd);
if ((NULL != wfds) &&
(set |=
@@ -813,9 +814,8 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet
*rfds,
(0 != (ml->cached_poll_array[ui].revents & (G_IO_OUT | G_IO_ERR))))))
GNUNET_NETWORK_fdset_set_native (wfds, ml->cached_poll_array[ui].fd);
if ((NULL != efds) &&
- (set |=
- (FD_ISSET (ml->cached_poll_array[ui].fd, &aexcept) &&
- (0 != (ml->cached_poll_array[ui].revents & G_IO_ERR)))))
+ (set |= (FD_ISSET (ml->cached_poll_array[ui].fd, &aexcept) &&
+ (0 != (ml->cached_poll_array[ui].revents & G_IO_ERR)))))
GNUNET_NETWORK_fdset_set_native (efds, ml->cached_poll_array[ui].fd);
if (set)
result++;
@@ -836,7 +836,9 @@ gnunet_gtk_select (void *cls, struct GNUNET_NETWORK_FDSet
*rfds,
* @param cfg handle to the configuration
*/
static void
-run_main_loop (void *cls, char *const *args, const char *cfgfile,
+run_main_loop (void *cls,
+ char *const *args,
+ const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_GTK_MainLoop *ml = cls;
@@ -862,7 +864,8 @@ run_main_loop (void *cls, char *const *args, const char
*cfgfile,
(void) GNUNET_CONFIGURATION_load_from (gcfg, baseconfig);
GNUNET_free (baseconfig);
/* FIXME: this was supposed to search the GTK-IPK, so the logic here is
badly broken now */
- if (NULL == (ipath2 = GNUNET_OS_installation_get_path
(GNUNET_OS_IPK_DATADIR)))
+ if (NULL ==
+ (ipath2 = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR)))
{
GNUNET_break (0);
return;
@@ -870,16 +873,14 @@ run_main_loop (void *cls, char *const *args, const char
*cfgfile,
if (0 != strcmp (ipath, ipath2))
{
GNUNET_asprintf (&baseconfig, "%s%s", ipath2, "config.d");
- if (GNUNET_YES ==
- GNUNET_DISK_directory_test (baseconfig, GNUNET_YES))
+ if (GNUNET_YES == GNUNET_DISK_directory_test (baseconfig, GNUNET_YES))
(void) GNUNET_CONFIGURATION_load_from (gcfg, baseconfig);
GNUNET_free (baseconfig);
}
GNUNET_free (ipath2);
GNUNET_free (ipath);
- if (GNUNET_YES ==
- GNUNET_DISK_file_test (cfgfile))
+ if (GNUNET_YES == GNUNET_DISK_file_test (cfgfile))
(void) GNUNET_CONFIGURATION_parse (gcfg, cfgfile);
ml->rs = GNUNET_NETWORK_fdset_create ();
ml->ws = GNUNET_NETWORK_fdset_create ();
@@ -896,9 +897,9 @@ run_main_loop (void *cls, char *const *args, const char
*cfgfile,
GNUNET_SCHEDULER_set_select (&gnunet_gtk_select, ml);
/* keep Gtk event loop running even if there are no GNUnet tasks */
- ml->dummy_task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &keepalive_task, ml);
+ ml->dummy_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
+ &keepalive_task,
+ ml);
/* run main task of the application */
GNUNET_SCHEDULER_add_with_reason_and_priority (ml->main_task,
@@ -922,8 +923,9 @@ run_main_loop (void *cls, char *const *args, const char
*cfgfile,
*/
int
GNUNET_GTK_main_loop_start (const char *binary_name,
- const char *binary_help,
- int argc, char *const *argv,
+ const char *binary_help,
+ int argc,
+ char *const *argv,
struct GNUNET_GETOPT_CommandLineOption *options,
const char *main_window_file,
GNUNET_SCHEDULER_TaskCallback main_task)
@@ -934,9 +936,13 @@ GNUNET_GTK_main_loop_start (const char *binary_name,
memset (&ml, 0, sizeof (ml));
ml.main_window_file = main_window_file;
ml.main_task = main_task;
- ret = GNUNET_PROGRAM_run (argc, argv, binary_name,
- binary_help, options,
- &run_main_loop, &ml);
+ ret = GNUNET_PROGRAM_run (argc,
+ argv,
+ binary_name,
+ binary_help,
+ options,
+ &run_main_loop,
+ &ml);
if (NULL != ml.cached_poll_array)
g_free (ml.cached_poll_array);
if (NULL != ml.rs)
diff --git a/src/lib/glade.c b/src/lib/glade.c
index 3ffc0641..602487d2 100644
--- a/src/lib/glade.c
+++ b/src/lib/glade.c
@@ -36,8 +36,7 @@ GNUNET_GTK_set_icon_search_path ()
char *buf;
buf = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_ICONDIR);
- gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (),
- buf);
+ gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), buf);
GNUNET_free (buf);
}
@@ -72,7 +71,7 @@ gboolean
GNUNET_GTK_get_tree_string (GtkTreeView *treeview,
GtkTreePath *treepath,
guint column,
- gchar ** value)
+ gchar **value)
{
gboolean ok;
GtkTreeModel *model;
@@ -81,18 +80,12 @@ GNUNET_GTK_get_tree_string (GtkTreeView *treeview,
model = gtk_tree_view_get_model (treeview);
if (! model)
return FALSE;
- ok = gtk_tree_model_get_iter (model,
- &iter,
- treepath);
+ ok = gtk_tree_model_get_iter (model, &iter, treepath);
if (! ok)
return FALSE;
*value = NULL;
- gtk_tree_model_get (model,
- &iter,
- column,
- value,
- -1);
+ gtk_tree_model_get (model, &iter, column, value, -1);
if (NULL == *value)
return FALSE;
return TRUE;
@@ -120,17 +113,12 @@ GNUNET_GTK_get_new_builder2 (const char *filename,
ret = gtk_builder_new ();
gtk_builder_set_translation_domain (ret, "gnunet-gtk");
- GNUNET_asprintf (&glade_path,
- "%s%s",
- GNUNET_GTK_get_data_dir (),
- filename);
+ GNUNET_asprintf (&glade_path, "%s%s", GNUNET_GTK_get_data_dir (), filename);
error = NULL;
- if (0 == gtk_builder_add_from_file (ret,
- glade_path,
- &error))
+ if (0 == gtk_builder_add_from_file (ret, glade_path, &error))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to load `%s': %s\n"),
+ _ ("Failed to load `%s': %s\n"),
glade_path,
error->message);
g_error_free (error);
@@ -140,12 +128,9 @@ GNUNET_GTK_get_new_builder2 (const char *filename,
if (NULL == user_data)
user_data = ret;
if (NULL != cb)
- gtk_builder_connect_signals_full (ret,
- cb,
- user_data);
+ gtk_builder_connect_signals_full (ret, cb, user_data);
else
- gtk_builder_connect_signals (ret,
- user_data);
+ gtk_builder_connect_signals (ret, user_data);
GNUNET_free (glade_path);
return ret;
}
@@ -158,16 +143,12 @@ GNUNET_GTK_get_new_builder2 (const char *filename,
* @param root root of the subtree to remove
*/
void
-GNUNET_FS_GTK_remove_treestore_subtree (GtkTreeStore *ts,
- GtkTreeIter *root)
+GNUNET_FS_GTK_remove_treestore_subtree (GtkTreeStore *ts, GtkTreeIter *root)
{
GtkTreeIter child;
- while (gtk_tree_model_iter_children (GTK_TREE_MODEL (ts),
- &child,
- root))
- GNUNET_FS_GTK_remove_treestore_subtree (ts,
- &child);
+ while (gtk_tree_model_iter_children (GTK_TREE_MODEL (ts), &child, root))
+ GNUNET_FS_GTK_remove_treestore_subtree (ts, &child);
gtk_tree_store_remove (ts, root);
}
diff --git a/src/lib/misc.c b/src/lib/misc.c
index df6d5695..92b87006 100644
--- a/src/lib/misc.c
+++ b/src/lib/misc.c
@@ -35,14 +35,14 @@
* the adjustment
*/
void
-GNUNET_GTK_setup_expiration_year_adjustment (GtkBuilder * builder)
+GNUNET_GTK_setup_expiration_year_adjustment (GtkBuilder *builder)
{
GtkAdjustment *aj;
unsigned int year;
year = GNUNET_TIME_get_current_year ();
- aj = GTK_ADJUSTMENT (gtk_builder_get_object
- (builder, "expiration_year_adjustment"));
+ aj = GTK_ADJUSTMENT (
+ gtk_builder_get_object (builder, "expiration_year_adjustment"));
gtk_adjustment_set_value (aj, year + 2);
gtk_adjustment_set_lower (aj, year + 1);
}
@@ -56,7 +56,7 @@ GNUNET_GTK_setup_expiration_year_adjustment (GtkBuilder *
builder)
* @return expiration time in the usual GNUnet format
*/
struct GNUNET_TIME_Absolute
-GNUNET_GTK_get_expiration_time (GtkSpinButton * spin)
+GNUNET_GTK_get_expiration_time (GtkSpinButton *spin)
{
struct GNUNET_TIME_Absolute ret;
int year;
@@ -78,13 +78,14 @@ GNUNET_GTK_get_expiration_time (GtkSpinButton * spin)
* @return TRUE on success, FALSE on failure
*/
gboolean
-GNUNET_GTK_get_selected_anonymity_level (GtkBuilder * builder,
- gchar * combo_name, guint * p_level)
+GNUNET_GTK_get_selected_anonymity_level (GtkBuilder *builder,
+ gchar *combo_name,
+ guint *p_level)
{
GtkComboBox *combo;
combo = GTK_COMBO_BOX (gtk_builder_get_object (builder, combo_name));
- if (!combo)
+ if (! combo)
return FALSE;
return GNUNET_GTK_get_selected_anonymity_combo_level (combo, p_level);
}
@@ -98,7 +99,8 @@ GNUNET_GTK_get_selected_anonymity_level (GtkBuilder * builder,
* @return TRUE on success, FALSE on failure
*/
gboolean
-GNUNET_GTK_get_selected_anonymity_combo_level (GtkComboBox *combo, guint
*p_level)
+GNUNET_GTK_get_selected_anonymity_combo_level (GtkComboBox *combo,
+ guint *p_level)
{
GtkTreeIter iter;
GtkTreeModel *model;
@@ -107,9 +109,10 @@ GNUNET_GTK_get_selected_anonymity_combo_level (GtkComboBox
*combo, guint *p_leve
if (! gtk_combo_box_get_active_iter (combo, &iter))
return FALSE;
model = gtk_combo_box_get_model (combo);
- if (!model)
+ if (! model)
return FALSE;
- gtk_tree_model_get (model, &iter,
+ gtk_tree_model_get (model,
+ &iter,
GNUNET_GTK_ANONYMITY_LEVEL_MC_LEVEL,
&level,
-1);
diff --git a/src/lib/nls.c b/src/lib/nls.c
index 6bcc04a9..cc6f0e5f 100644
--- a/src/lib/nls.c
+++ b/src/lib/nls.c
@@ -40,7 +40,9 @@ GNUNET_GTK_setup_nls ()
char *path;
setlocale (LC_ALL, "");
- GNUNET_asprintf (&path, "%s/%s/locale/", GNUNET_GTK_get_data_dir (),
+ GNUNET_asprintf (&path,
+ "%s/%s/locale/",
+ GNUNET_GTK_get_data_dir (),
PACKAGE_NAME);
bindtextdomain ("gnunet-gtk", path);
textdomain ("gnunet-gtk");
@@ -48,8 +50,9 @@ GNUNET_GTK_setup_nls ()
bind_textdomain_codeset ("gnunet-gtk", "UTF-8");
GNUNET_free (path);
#else
- fprintf (stderr,
- "WARNING: gnunet-gtk was compiled without i18n support (did CFLAGS
contain -Werror?).\n");
+ fprintf (
+ stderr,
+ "WARNING: gnunet-gtk was compiled without i18n support (did CFLAGS contain
-Werror?).\n");
#endif
}
@@ -62,7 +65,7 @@ GNUNET_GTK_setup_nls ()
* @return TRUE if the locale is utf-8
*/
static gboolean
-get_filename_charset (const gchar ** filename_charset)
+get_filename_charset (const gchar **filename_charset)
{
const gchar **charsets;
gboolean is_utf8;
@@ -83,7 +86,7 @@ get_filename_charset (const gchar ** filename_charset)
* @return string in UTF-8, NULL if str_loc was NULL
*/
char *
-GNUNET_GTK_from_loc_to_utf8 (const char * str_loc)
+GNUNET_GTK_from_loc_to_utf8 (const char *str_loc)
{
char *str_utf8;
const char *loc_charset;
@@ -108,7 +111,7 @@ GNUNET_GTK_from_loc_to_utf8 (const char * str_loc)
* @return filename in utf-8 encoding
*/
static char *
-from_filename_to_utf8 (gchar * filename)
+from_filename_to_utf8 (gchar *filename)
{
char *str_utf8;
const char *filename_charset;
@@ -122,7 +125,7 @@ from_filename_to_utf8 (gchar * filename)
str_utf8 = GNUNET_strdup (filename);
else
str_utf8 =
- GNUNET_STRINGS_to_utf8 (filename, strlen (filename), filename_charset);
+ GNUNET_STRINGS_to_utf8 (filename, strlen (filename), filename_charset);
return str_utf8;
}
@@ -135,7 +138,7 @@ from_filename_to_utf8 (gchar * filename)
* @return selected filename as UTF-8, NULL on errors
*/
char *
-GNUNET_GTK_filechooser_get_filename_utf8 (GtkFileChooser * fc)
+GNUNET_GTK_filechooser_get_filename_utf8 (GtkFileChooser *fc)
{
char *filename_utf8;
gchar *filename = gtk_file_chooser_get_filename (fc);
diff --git a/src/lib/os_installation.c b/src/lib/os_installation.c
index aa0b5a10..762ce3e6 100644
--- a/src/lib/os_installation.c
+++ b/src/lib/os_installation.c
@@ -29,18 +29,17 @@
* Default project data used for installation path detection
* for gnunet-gtk.
*/
-static const struct GNUNET_OS_ProjectData gtk_pd = {
- .libname = "libgnunetgtk",
- .project_dirname = "gnunet",
- .binary_name = "gnunet-fs-gtk",
- .env_varname = "GNUNET_GTK_PREFIX",
- .env_varname_alt = "GNUNET_PREFIX",
- .base_config_varname = "GNUNET_BASE_CONFIG",
- .bug_email = "address@hidden",
- .homepage = "http://www.gnu.org/s/gnunet/",
- .config_file = "gnunet.conf",
- .user_config_file = "~/.config/gnunet.conf"
-};
+static const struct GNUNET_OS_ProjectData gtk_pd =
+ {.libname = "libgnunetgtk",
+ .project_dirname = "gnunet",
+ .binary_name = "gnunet-fs-gtk",
+ .env_varname = "GNUNET_GTK_PREFIX",
+ .env_varname_alt = "GNUNET_PREFIX",
+ .base_config_varname = "GNUNET_BASE_CONFIG",
+ .bug_email = "address@hidden",
+ .homepage = "http://www.gnu.org/s/gnunet/",
+ .config_file = "gnunet.conf",
+ .user_config_file = "~/.config/gnunet.conf"};
/**
@@ -56,12 +55,10 @@ GNUNET_GTK_project_data_default (void)
/**
* Initialize libgnunetgtk.
*/
-void __attribute__ ((constructor))
-GNUNET_GTK_init ()
+void __attribute__ ((constructor)) GNUNET_GTK_init ()
{
GNUNET_OS_init (>k_pd);
}
-
/* end of os_installation.c */
diff --git a/src/lib/trayicon.c b/src/lib/trayicon.c
index c7c57a16..1b8edd85 100644
--- a/src/lib/trayicon.c
+++ b/src/lib/trayicon.c
@@ -46,8 +46,7 @@ static GtkWindow *main_window;
* @param user_data unused
*/
static void
-tray_icon_on_click (GtkStatusIcon *status_icon,
- gpointer user_data)
+tray_icon_on_click (GtkStatusIcon *status_icon, gpointer user_data)
{
gboolean tlf;
@@ -73,8 +72,7 @@ tray_icon_on_click (GtkStatusIcon *status_icon,
* @param user_data the main loop context
*/
void
-GNUNET_GTK_tray_icon_quit (GtkMenuItem *menuitem,
- gpointer user_data)
+GNUNET_GTK_tray_icon_quit (GtkMenuItem *menuitem, gpointer user_data)
{
/* struct GNUNET_GTK_MainLoop *ml = user_data; */
GNUNET_SCHEDULER_shutdown ();
@@ -90,9 +88,7 @@ GNUNET_GTK_tray_icon_quit (GtkMenuItem *menuitem,
* @param user_data unused
*/
static int
-tray_icon_on_menu (GtkWidget *widget,
- GdkEvent *event,
- gpointer user_data)
+tray_icon_on_menu (GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
struct GNUNET_GTK_MainLoop *ml = user_data;
GtkMenu *tray_menu;
@@ -105,12 +101,16 @@ tray_icon_on_menu (GtkWidget *widget,
if (event_button->button == 3)
{
builder =
- GNUNET_GTK_get_new_builder ("gnunet_gtk_status_bar_menu.glade", ml);
- tray_menu =
- GTK_MENU (gtk_builder_get_object
- (builder, "GNUNET_GTK_status_bar_popup_menu"));
+ GNUNET_GTK_get_new_builder ("gnunet_gtk_status_bar_menu.glade", ml);
+ tray_menu = GTK_MENU (
+ gtk_builder_get_object (builder, "GNUNET_GTK_status_bar_popup_menu"));
g_object_ref (tray_menu);
- gtk_menu_popup (tray_menu, NULL, NULL, NULL, NULL, event_button->button,
+ gtk_menu_popup (tray_menu,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ event_button->button,
event_button->time);
g_object_unref (builder);
}
@@ -140,10 +140,14 @@ GNUNET_GTK_tray_icon_create (struct GNUNET_GTK_MainLoop
*ml,
}
main_window = main;
tray_icon = gtk_status_icon_new ();
- g_signal_connect (G_OBJECT (tray_icon), "activate",
- G_CALLBACK (tray_icon_on_click), ml);
- g_signal_connect (G_OBJECT (tray_icon), "button_press_event",
- G_CALLBACK (tray_icon_on_menu), ml);
+ g_signal_connect (G_OBJECT (tray_icon),
+ "activate",
+ G_CALLBACK (tray_icon_on_click),
+ ml);
+ g_signal_connect (G_OBJECT (tray_icon),
+ "button_press_event",
+ G_CALLBACK (tray_icon_on_menu),
+ ml);
gtk_status_icon_set_from_icon_name (tray_icon, icon_name);
gtk_status_icon_set_tooltip_text (tray_icon, tooltip);
gtk_status_icon_set_visible (tray_icon, TRUE);
@@ -157,8 +161,7 @@ GNUNET_GTK_tray_icon_create (struct GNUNET_GTK_MainLoop *ml,
* @param tooltip tooltip for the tray icon
*/
void
-GNUNET_GTK_tray_icon_change (const char *icon_name,
- const char *tooltip)
+GNUNET_GTK_tray_icon_change (const char *icon_name, const char *tooltip)
{
if (NULL == tray_icon)
return;
diff --git a/src/namestore/gnunet-namestore-gtk_edit.c
b/src/namestore/gnunet-namestore-gtk_edit.c
index dbccaeae..db2e97c7 100644
--- a/src/namestore/gnunet-namestore-gtk_edit.c
+++ b/src/namestore/gnunet-namestore-gtk_edit.c
@@ -34,17 +34,20 @@
* @param user_data the '' of the dialog
*/
void
-GNS_edit_dialog_expiration_relative_radiobutton_toggled_cb (GtkToggleButton
*button,
- gpointer user_data)
+GNS_edit_dialog_expiration_relative_radiobutton_toggled_cb (
+ GtkToggleButton *button,
+ gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
if (gtk_toggle_button_get_active (button))
- gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_relative_combobox")));
+ gtk_widget_show (GTK_WIDGET (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_relative_combobox")));
else
- gtk_widget_hide (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_relative_combobox")));
+ gtk_widget_hide (GTK_WIDGET (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_relative_combobox")));
}
@@ -55,8 +58,9 @@ GNS_edit_dialog_expiration_relative_radiobutton_toggled_cb
(GtkToggleButton *but
* @param user_data the '' of the dialog
*/
void
-GNS_edit_dialog_expiration_forever_radiobutton_toggled_cb (GtkToggleButton
*button,
- gpointer user_data)
+GNS_edit_dialog_expiration_forever_radiobutton_toggled_cb (
+ GtkToggleButton *button,
+ gpointer user_data)
{
/* nothing to do */
}
@@ -69,27 +73,31 @@ GNS_edit_dialog_expiration_forever_radiobutton_toggled_cb
(GtkToggleButton *butt
* @param user_data the '' of the dialog
*/
void
-GNS_edit_dialog_expiration_absolute_radiobutton_toggled_cb (GtkToggleButton
*button,
- gpointer user_data)
+GNS_edit_dialog_expiration_absolute_radiobutton_toggled_cb (
+ GtkToggleButton *button,
+ gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
if (gtk_toggle_button_get_active (button))
{
- gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_calendar")));
- gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_expiration_absolute_hbox")));
+ gtk_widget_show (GTK_WIDGET (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_absolute_calendar")));
+ gtk_widget_show (GTK_WIDGET (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_absolute_hbox")));
}
else
{
- 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_absolute_calendar")));
+ gtk_widget_hide (GTK_WIDGET (
+ gtk_builder_get_object (edc->builder,
+ "edit_dialog_expiration_absolute_hbox")));
}
}
-
/* end of gnunet-namestore-gtk_edit.c */
diff --git a/src/namestore/plugin_gtk_namestore_a.c
b/src/namestore/plugin_gtk_namestore_a.c
index 8ab8a755..0141b850 100644
--- a/src/namestore/plugin_gtk_namestore_a.c
+++ b/src/namestore/plugin_gtk_namestore_a.c
@@ -35,8 +35,7 @@
* @param user_data the plugin environment
*/
static void
-GNS_edit_dialog_a_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
+GNS_edit_dialog_a_entry_changed_cb (GtkEditable *entry, gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
@@ -54,16 +53,12 @@ GNS_edit_dialog_a_entry_changed_cb (GtkEditable *entry,
* @param builder the edit dialog's builder
*/
static void
-a_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+a_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
GtkEntry *entry;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_a_entry"));
- gtk_entry_set_text (entry,
- n_value);
+ entry = GTK_ENTRY (gtk_builder_get_object (builder, "edit_dialog_a_entry"));
+ gtk_entry_set_text (entry, n_value);
}
@@ -76,14 +71,12 @@ a_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-a_store (void *cls,
- GtkBuilder *builder)
+a_store (void *cls, GtkBuilder *builder)
{
GtkEntry *entry;
const gchar *value;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_a_entry"));
+ entry = GTK_ENTRY (gtk_builder_get_object (builder, "edit_dialog_a_entry"));
value = gtk_entry_get_text (entry);
return g_strdup (value);
}
@@ -101,18 +94,16 @@ a_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-a_validate (void *cls,
- GtkBuilder *builder)
+a_validate (void *cls, GtkBuilder *builder)
{
GtkEditable *entry;
const gchar *preedit;
struct in_addr v4;
- entry = GTK_EDITABLE (gtk_builder_get_object (builder,
- "edit_dialog_a_entry")),
+ entry =
+ GTK_EDITABLE (gtk_builder_get_object (builder, "edit_dialog_a_entry")),
preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (1 != inet_pton (AF_INET, preedit, &v4)) )
+ if ((NULL == preedit) || (1 != inet_pton (AF_INET, preedit, &v4)))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -129,11 +120,10 @@ libgnunet_plugin_gtk_namestore_a_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "GNS_edit_dialog_a_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_a_entry_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"GNS_edit_dialog_a_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_a_entry_changed_cb)},
+ {NULL, NULL}};
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
diff --git a/src/namestore/plugin_gtk_namestore_aaaa.c
b/src/namestore/plugin_gtk_namestore_aaaa.c
index a004929c..32ded8b1 100644
--- a/src/namestore/plugin_gtk_namestore_aaaa.c
+++ b/src/namestore/plugin_gtk_namestore_aaaa.c
@@ -35,8 +35,7 @@
* @param user_data the plugin environment
*/
static void
-GNS_edit_dialog_aaaa_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
+GNS_edit_dialog_aaaa_entry_changed_cb (GtkEditable *entry, gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
@@ -54,9 +53,7 @@ GNS_edit_dialog_aaaa_entry_changed_cb (GtkEditable *entry,
* @param builder the edit dialog's builder
*/
static void
-aaaa_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+aaaa_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
GNUNET_break (0);
}
@@ -71,14 +68,13 @@ aaaa_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-aaaa_store (void *cls,
- GtkBuilder *builder)
+aaaa_store (void *cls, GtkBuilder *builder)
{
GtkEntry *entry;
const gchar *value;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_aaaa_entry"));
+ entry =
+ GTK_ENTRY (gtk_builder_get_object (builder, "edit_dialog_aaaa_entry"));
value = gtk_entry_get_text (entry);
return g_strdup (value);
}
@@ -96,18 +92,16 @@ aaaa_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-aaaa_validate (void *cls,
- GtkBuilder *builder)
+aaaa_validate (void *cls, GtkBuilder *builder)
{
GtkEditable *entry;
const gchar *preedit;
struct in6_addr v6;
- entry = GTK_EDITABLE (gtk_builder_get_object (builder,
- "edit_dialog_aaaa_entry")),
+ entry =
+ GTK_EDITABLE (gtk_builder_get_object (builder, "edit_dialog_aaaa_entry")),
preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (1 != inet_pton (AF_INET6, preedit, &v6)) )
+ if ((NULL == preedit) || (1 != inet_pton (AF_INET6, preedit, &v6)))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -124,11 +118,10 @@ libgnunet_plugin_gtk_namestore_aaaa_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "GNS_edit_dialog_aaaa_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_aaaa_entry_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"GNS_edit_dialog_aaaa_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_aaaa_entry_changed_cb)},
+ {NULL, NULL}};
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
diff --git a/src/namestore/plugin_gtk_namestore_box.c
b/src/namestore/plugin_gtk_namestore_box.c
index 8b00b810..82f8fae0 100644
--- a/src/namestore/plugin_gtk_namestore_box.c
+++ b/src/namestore/plugin_gtk_namestore_box.c
@@ -76,7 +76,6 @@ struct BoxContext
* Record type in the box that we are editing.
*/
unsigned int record_type;
-
};
@@ -90,9 +89,7 @@ struct BoxContext
* @param builder the edit dialog's builder
*/
static void
-box_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+box_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
struct BoxContext *bc = cls;
unsigned int protocol;
@@ -101,15 +98,11 @@ box_load (void *cls,
size_t slen = strlen (n_value) + 1;
char rest[slen];
- if (4 != SSCANF (n_value,
- "%u %u %u %s",
- &protocol,
- &service,
- &record_type,
- rest))
+ if (4 !=
+ SSCANF (n_value, "%u %u %u %s", &protocol, &service, &record_type, rest))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Unable to parse (boxed) BOX record `%s'\n"),
+ _ ("Unable to parse (boxed) BOX record `%s'\n"),
n_value);
return;
}
@@ -117,24 +110,20 @@ box_load (void *cls,
switch (record_type)
{
case GNUNET_DNSPARSER_TYPE_SRV:
- gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (builder,
-
"edit_dialog_srv_frame")));
- srv_load (bc->env,
- n_value,
- builder);
+ gtk_widget_show (
+ GTK_WIDGET (gtk_builder_get_object (builder, "edit_dialog_srv_frame")));
+ srv_load (bc->env, n_value, builder);
break;
#if HAVE_GNUTLS
case GNUNET_DNSPARSER_TYPE_TLSA:
- gtk_widget_show (GTK_WIDGET (gtk_builder_get_object (builder,
-
"edit_dialog_tlsa_frame")));
- tlsa_load (bc->env,
- n_value,
- builder);
+ gtk_widget_show (
+ GTK_WIDGET (gtk_builder_get_object (builder, "edit_dialog_tlsa_frame")));
+ tlsa_load (bc->env, n_value, builder);
break;
#endif
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Boxed record type %u not supported\n"),
+ _ ("Boxed record type %u not supported\n"),
record_type);
break;
}
@@ -150,24 +139,21 @@ box_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-box_store (void *cls,
- GtkBuilder *builder)
+box_store (void *cls, GtkBuilder *builder)
{
struct BoxContext *bc = cls;
switch (bc->record_type)
{
case GNUNET_DNSPARSER_TYPE_SRV:
- return srv_store (bc->env,
- builder);
+ return srv_store (bc->env, builder);
#if HAVE_GNUTLS
case GNUNET_DNSPARSER_TYPE_TLSA:
- return tlsa_store (bc->env,
- builder);
+ return tlsa_store (bc->env, builder);
#endif
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Boxed record type %u not supported\n"),
+ _ ("Boxed record type %u not supported\n"),
bc->record_type);
return NULL;
}
@@ -186,24 +172,21 @@ box_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-box_validate (void *cls,
- GtkBuilder *builder)
+box_validate (void *cls, GtkBuilder *builder)
{
struct BoxContext *bc = cls;
switch (bc->record_type)
{
case GNUNET_DNSPARSER_TYPE_SRV:
- return srv_validate (bc->env,
- builder);
+ return srv_validate (bc->env, builder);
#if HAVE_GNUTLS
case GNUNET_DNSPARSER_TYPE_TLSA:
- return tlsa_validate (bc->env,
- builder);
+ return tlsa_validate (bc->env, builder);
#endif
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Boxed record type %u not supported\n"),
+ _ ("Boxed record type %u not supported\n"),
bc->record_type);
return GNUNET_SYSERR;
}
@@ -223,28 +206,28 @@ libgnunet_plugin_gtk_namestore_box_init (void *cls)
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
/* SRV plugin */
- { "GNS_edit_dialog_srv_target_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_srv_target_entry_changed_cb) },
+ {"GNS_edit_dialog_srv_target_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_srv_target_entry_changed_cb)},
#if HAVE_GNUTLS
/* TLSA plugin */
- { "tlsa_value_textbuffer_changed_cb",
- G_CALLBACK (tlsa_value_textbuffer_changed_cb) },
- { "edit_dialog_tlsa_selector_radiobutton_toggled_cb",
- G_CALLBACK (edit_dialog_tlsa_selector_radiobutton_toggled_cb) },
- { "edit_dialog_tlsa_usage_radiobutton_toggled_cb",
- G_CALLBACK (edit_dialog_tlsa_usage_radiobutton_toggled_cb) },
- { "edit_dialog_tlsa_matching_type_radiobutton_toggled_cb",
- G_CALLBACK (edit_dialog_tlsa_matching_type_radiobutton_toggled_cb) },
- { "tlsa_import_button_clicked_cb",
- G_CALLBACK (tlsa_import_button_clicked_cb) },
- { "edit_dialog_tlsa_import_entry_changed_cb",
- G_CALLBACK (edit_dialog_tlsa_import_entry_changed_cb) },
+ {"tlsa_value_textbuffer_changed_cb",
+ G_CALLBACK (tlsa_value_textbuffer_changed_cb)},
+ {"edit_dialog_tlsa_selector_radiobutton_toggled_cb",
+ G_CALLBACK (edit_dialog_tlsa_selector_radiobutton_toggled_cb)},
+ {"edit_dialog_tlsa_usage_radiobutton_toggled_cb",
+ G_CALLBACK (edit_dialog_tlsa_usage_radiobutton_toggled_cb)},
+ {"edit_dialog_tlsa_matching_type_radiobutton_toggled_cb",
+ G_CALLBACK (edit_dialog_tlsa_matching_type_radiobutton_toggled_cb)},
+ {"tlsa_import_button_clicked_cb",
+ G_CALLBACK (tlsa_import_button_clicked_cb)},
+ {"edit_dialog_tlsa_import_entry_changed_cb",
+ G_CALLBACK (edit_dialog_tlsa_import_entry_changed_cb)},
#endif
/* generic CBs */
- { "edit_dialog_protocol_combobox_changed_cb",
- G_CALLBACK (edit_dialog_protocol_combobox_changed_cb) },
+ {"edit_dialog_protocol_combobox_changed_cb",
+ G_CALLBACK (edit_dialog_protocol_combobox_changed_cb)},
/* need to include symbols from all boxed types here */
- { NULL, NULL }
+ {NULL, NULL}
};
struct BoxContext *bc;
diff --git a/src/namestore/plugin_gtk_namestore_cname.c
b/src/namestore/plugin_gtk_namestore_cname.c
index 57c07c67..2e1abce4 100644
--- a/src/namestore/plugin_gtk_namestore_cname.c
+++ b/src/namestore/plugin_gtk_namestore_cname.c
@@ -35,8 +35,7 @@
* @param user_data the plugin environment
*/
static void
-GNS_edit_dialog_cname_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
+GNS_edit_dialog_cname_entry_changed_cb (GtkEditable *entry, gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
@@ -54,16 +53,13 @@ GNS_edit_dialog_cname_entry_changed_cb (GtkEditable *entry,
* @param builder the edit dialog's builder
*/
static void
-cname_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+cname_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
GtkEntry *entry;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_cname_entry"));
- gtk_entry_set_text (entry,
- n_value);
+ entry =
+ GTK_ENTRY (gtk_builder_get_object (builder, "edit_dialog_cname_entry"));
+ gtk_entry_set_text (entry, n_value);
}
@@ -76,14 +72,13 @@ cname_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-cname_store (void *cls,
- GtkBuilder *builder)
+cname_store (void *cls, GtkBuilder *builder)
{
GtkEntry *entry;
const gchar *value;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_cname_entry"));
+ entry =
+ GTK_ENTRY (gtk_builder_get_object (builder, "edit_dialog_cname_entry"));
value = gtk_entry_get_text (entry);
return g_strdup (value);
}
@@ -101,17 +96,15 @@ cname_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-cname_validate (void *cls,
- GtkBuilder *builder)
+cname_validate (void *cls, GtkBuilder *builder)
{
GtkEditable *entry;
const gchar *preedit;
- entry = GTK_EDITABLE (gtk_builder_get_object (builder,
- "edit_dialog_cname_entry")),
+ entry =
+ GTK_EDITABLE (gtk_builder_get_object (builder, "edit_dialog_cname_entry")),
preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
+ if ((NULL == preedit) || (GNUNET_OK != GNUNET_DNSPARSER_check_name
(preedit)))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -128,11 +121,10 @@ libgnunet_plugin_gtk_namestore_cname_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "GNS_edit_dialog_cname_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_cname_entry_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"GNS_edit_dialog_cname_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_cname_entry_changed_cb)},
+ {NULL, NULL}};
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
diff --git a/src/namestore/plugin_gtk_namestore_gns2dns.c
b/src/namestore/plugin_gtk_namestore_gns2dns.c
index 41fd3395..0a308d45 100644
--- a/src/namestore/plugin_gtk_namestore_gns2dns.c
+++ b/src/namestore/plugin_gtk_namestore_gns2dns.c
@@ -27,7 +27,6 @@
#include "gnunet_gtk_namestore_plugin.h"
-
/**
* The user has edited the GNS2DNS record value. Enable/disable 'save'
* button depending on the validity of the value.
@@ -55,9 +54,7 @@ GNS_edit_dialog_gns2dns_entry_changed_cb (GtkEditable *entry,
* @param builder the edit dialog's builder
*/
static void
-gns2dns_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+gns2dns_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
char *cpy;
char *at;
@@ -67,18 +64,20 @@ gns2dns_load (void *cls,
if (NULL == at)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Unable to parse GNS2DNS record `%s'\n"),
+ _ ("Unable to parse GNS2DNS record `%s'\n"),
n_value);
GNUNET_free (cpy);
return;
}
*at = '\0';
at++;
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_gns2dns_ns_entry")),
+ gtk_entry_set_text (GTK_ENTRY (
+ gtk_builder_get_object (builder,
+
"edit_dialog_gns2dns_ns_entry")),
cpy);
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_gns2dns_ip_entry")),
+ gtk_entry_set_text (GTK_ENTRY (
+ gtk_builder_get_object (builder,
+
"edit_dialog_gns2dns_ip_entry")),
at);
GNUNET_free (cpy);
}
@@ -93,24 +92,20 @@ gns2dns_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-gns2dns_store (void *cls,
- GtkBuilder *builder)
+gns2dns_store (void *cls, GtkBuilder *builder)
{
GtkEntry *entry;
const gchar *ns_value;
const gchar *ip_value;
char *ret;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_gns2dns_ns_entry"));
+ entry = GTK_ENTRY (
+ gtk_builder_get_object (builder, "edit_dialog_gns2dns_ns_entry"));
ns_value = gtk_entry_get_text (entry);
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_gns2dns_ip_entry"));
+ entry = GTK_ENTRY (
+ gtk_builder_get_object (builder, "edit_dialog_gns2dns_ip_entry"));
ip_value = gtk_entry_get_text (entry);
- GNUNET_asprintf (&ret,
- "address@hidden",
- ns_value,
- ip_value);
+ GNUNET_asprintf (&ret, "address@hidden", ns_value, ip_value);
return ret;
}
@@ -127,23 +122,20 @@ gns2dns_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-gns2dns_validate (void *cls,
- GtkBuilder *builder)
+gns2dns_validate (void *cls, GtkBuilder *builder)
{
GtkEditable *entry;
const gchar *preedit;
- entry = GTK_EDITABLE (gtk_builder_get_object (builder,
-
"edit_dialog_gns2dns_ns_entry")),
+ entry = GTK_EDITABLE (
+ gtk_builder_get_object (builder, "edit_dialog_gns2dns_ns_entry")),
preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
+ if ((NULL == preedit) || (GNUNET_OK != GNUNET_DNSPARSER_check_name
(preedit)))
return GNUNET_SYSERR;
- entry = GTK_EDITABLE (gtk_builder_get_object (builder,
-
"edit_dialog_gns2dns_ip_entry")),
+ entry = GTK_EDITABLE (
+ gtk_builder_get_object (builder, "edit_dialog_gns2dns_ip_entry")),
preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
+ if ((NULL == preedit) || (GNUNET_OK != GNUNET_DNSPARSER_check_name
(preedit)))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -160,13 +152,12 @@ libgnunet_plugin_gtk_namestore_gns2dns_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "GNS_edit_dialog_gns2dns_ip_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_gns2dns_entry_changed_cb) },
- { "GNS_edit_dialog_gns2dns_ns_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_gns2dns_entry_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"GNS_edit_dialog_gns2dns_ip_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_gns2dns_entry_changed_cb)},
+ {"GNS_edit_dialog_gns2dns_ns_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_gns2dns_entry_changed_cb)},
+ {NULL, NULL}};
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
diff --git a/src/namestore/plugin_gtk_namestore_leho.c
b/src/namestore/plugin_gtk_namestore_leho.c
index a70c4bc3..73b783b6 100644
--- a/src/namestore/plugin_gtk_namestore_leho.c
+++ b/src/namestore/plugin_gtk_namestore_leho.c
@@ -35,8 +35,7 @@
* @param user_data the plugin environment
*/
static void
-GNS_edit_dialog_leho_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
+GNS_edit_dialog_leho_entry_changed_cb (GtkEditable *entry, gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
@@ -54,16 +53,13 @@ GNS_edit_dialog_leho_entry_changed_cb (GtkEditable *entry,
* @param builder the edit dialog's builder
*/
static void
-leho_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+leho_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
GtkEntry *entry;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_leho_entry"));
- gtk_entry_set_text (entry,
- n_value);
+ entry =
+ GTK_ENTRY (gtk_builder_get_object (builder, "edit_dialog_leho_entry"));
+ gtk_entry_set_text (entry, n_value);
}
@@ -76,14 +72,13 @@ leho_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-leho_store (void *cls,
- GtkBuilder *builder)
+leho_store (void *cls, GtkBuilder *builder)
{
GtkEntry *entry;
const gchar *value;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_leho_entry"));
+ entry =
+ GTK_ENTRY (gtk_builder_get_object (builder, "edit_dialog_leho_entry"));
value = gtk_entry_get_text (entry);
return g_strdup (value);
}
@@ -101,17 +96,15 @@ leho_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-leho_validate (void *cls,
- GtkBuilder *builder)
+leho_validate (void *cls, GtkBuilder *builder)
{
GtkEditable *entry;
const gchar *preedit;
- entry = GTK_EDITABLE (gtk_builder_get_object (builder,
- "edit_dialog_leho_entry")),
+ entry =
+ GTK_EDITABLE (gtk_builder_get_object (builder, "edit_dialog_leho_entry")),
preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
+ if ((NULL == preedit) || (GNUNET_OK != GNUNET_DNSPARSER_check_name
(preedit)))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -128,11 +121,10 @@ libgnunet_plugin_gtk_namestore_leho_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "GNS_edit_dialog_leho_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_leho_entry_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"GNS_edit_dialog_leho_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_leho_entry_changed_cb)},
+ {NULL, NULL}};
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
diff --git a/src/namestore/plugin_gtk_namestore_mx.c
b/src/namestore/plugin_gtk_namestore_mx.c
index e1376554..bc9b299b 100644
--- a/src/namestore/plugin_gtk_namestore_mx.c
+++ b/src/namestore/plugin_gtk_namestore_mx.c
@@ -35,8 +35,7 @@
* @param user_data the plugin environment
*/
static void
-GNS_edit_dialog_mx_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
+GNS_edit_dialog_mx_entry_changed_cb (GtkEditable *entry, gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
@@ -54,31 +53,27 @@ GNS_edit_dialog_mx_entry_changed_cb (GtkEditable *entry,
* @param builder the edit dialog's builder
*/
static void
-mx_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+mx_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
uint16_t mx_pref;
char result[253 + 1];
- if (2 != SSCANF (n_value,
- "%hu,%253s",
- &mx_pref, result))
+ if (2 != SSCANF (n_value, "%hu,%253s", &mx_pref, result))
{
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Unable to parse MX record `%s'\n"),
+ _ ("Unable to parse MX record `%s'\n"),
n_value);
return;
}
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_mx_entry")),
+ gtk_entry_set_text (GTK_ENTRY (
+ gtk_builder_get_object (builder,
+ "edit_dialog_mx_entry")),
result);
- gtk_spin_button_set_value
- (GTK_SPIN_BUTTON
- (gtk_builder_get_object (builder,
- "edit_dialog_mx_distance_spinbutton")),
- mx_pref);
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder, "edit_dialog_mx_distance_spinbutton")),
+ mx_pref);
}
@@ -91,8 +86,7 @@ mx_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-mx_store (void *cls,
- GtkBuilder *builder)
+mx_store (void *cls, GtkBuilder *builder)
{
GtkEntry *entry;
const gchar *value;
@@ -100,17 +94,11 @@ mx_store (void *cls,
unsigned int distance;
gchar *ret;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_mx_entry"));
+ entry = GTK_ENTRY (gtk_builder_get_object (builder, "edit_dialog_mx_entry"));
value = gtk_entry_get_text (entry);
- distance = gtk_spin_button_get_value
- (GTK_SPIN_BUTTON
- (gtk_builder_get_object (builder,
- "edit_dialog_mx_distance_spinbutton")));
- GNUNET_asprintf (&result,
- "%hu,%s",
- distance,
- value);
+ distance = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder, "edit_dialog_mx_distance_spinbutton")));
+ GNUNET_asprintf (&result, "%hu,%s", distance, value);
ret = g_strdup (result);
GNUNET_free (result);
return ret;
@@ -129,17 +117,15 @@ mx_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-mx_validate (void *cls,
- GtkBuilder *builder)
+mx_validate (void *cls, GtkBuilder *builder)
{
GtkEditable *entry;
const gchar *preedit;
- entry = GTK_EDITABLE (gtk_builder_get_object (builder,
- "edit_dialog_mx_entry")),
+ entry =
+ GTK_EDITABLE (gtk_builder_get_object (builder, "edit_dialog_mx_entry")),
preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
+ if ((NULL == preedit) || (GNUNET_OK != GNUNET_DNSPARSER_check_name
(preedit)))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -156,11 +142,10 @@ libgnunet_plugin_gtk_namestore_mx_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "GNS_edit_dialog_mx_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_mx_entry_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"GNS_edit_dialog_mx_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_mx_entry_changed_cb)},
+ {NULL, NULL}};
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
diff --git a/src/namestore/plugin_gtk_namestore_phone.c
b/src/namestore/plugin_gtk_namestore_phone.c
index 7d69c649..42582fd9 100644
--- a/src/namestore/plugin_gtk_namestore_phone.c
+++ b/src/namestore/plugin_gtk_namestore_phone.c
@@ -54,31 +54,28 @@ GNS_edit_dialog_phone_peer_entry_changed_cb (GtkEditable
*entry,
* @param builder the edit dialog's builder
*/
static void
-phone_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+phone_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
const char *minus;
unsigned int line;
- if (1 != (sscanf (n_value,
- "%u-",
- &line)))
+ if (1 != (sscanf (n_value, "%u-", &line)))
{
GNUNET_break (0);
return;
}
- gtk_spin_button_set_value (GTK_SPIN_BUTTON
- (gtk_builder_get_object (builder,
-
"edit_dialog_phone_line_spinbutton")),
- line);
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder, "edit_dialog_phone_line_spinbutton")),
+ line);
if (NULL == (minus = strchr (n_value, '-')))
{
GNUNET_break (0);
return;
}
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_phone_peer_entry")),
+ gtk_entry_set_text (GTK_ENTRY (
+ gtk_builder_get_object (builder,
+
"edit_dialog_phone_peer_entry")),
minus + 1);
}
@@ -92,8 +89,7 @@ phone_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-phone_store (void *cls,
- GtkBuilder *builder)
+phone_store (void *cls, GtkBuilder *builder)
{
GtkEntry *entry;
GtkSpinButton *spin;
@@ -101,16 +97,13 @@ phone_store (void *cls,
unsigned int line;
char *ret;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_phone_peer_entry"));
+ entry = GTK_ENTRY (
+ gtk_builder_get_object (builder, "edit_dialog_phone_peer_entry"));
value = gtk_entry_get_text (entry);
- spin = GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
-
"edit_dialog_phone_line_spinbutton"));
+ spin = GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder, "edit_dialog_phone_line_spinbutton"));
line = gtk_spin_button_get_value (spin);
- GNUNET_asprintf (&ret,
- "%u-%s",
- line,
- value);
+ GNUNET_asprintf (&ret, "%u-%s", line, value);
return ret;
}
@@ -127,21 +120,20 @@ phone_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-phone_validate (void *cls,
- GtkBuilder *builder)
+phone_validate (void *cls, GtkBuilder *builder)
{
GtkEditable *entry;
const gchar *preedit;
struct GNUNET_CRYPTO_EcdsaPublicKey pub;
- entry = GTK_EDITABLE (gtk_builder_get_object (builder,
-
"edit_dialog_phone_peer_entry"));
+ entry = GTK_EDITABLE (
+ gtk_builder_get_object (builder, "edit_dialog_phone_peer_entry"));
preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK !=
- GNUNET_CRYPTO_ecdsa_public_key_from_string (preedit,
- strlen (preedit),
- &pub)) )
+ if ((NULL == preedit) ||
+ (GNUNET_OK !=
+ GNUNET_CRYPTO_ecdsa_public_key_from_string (preedit,
+ strlen (preedit),
+ &pub)))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -158,11 +150,10 @@ libgnunet_plugin_gtk_namestore_phone_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "GNS_edit_dialog_phone_peer_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_phone_peer_entry_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"GNS_edit_dialog_phone_peer_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_phone_peer_entry_changed_cb)},
+ {NULL, NULL}};
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
diff --git a/src/namestore/plugin_gtk_namestore_pkey.c
b/src/namestore/plugin_gtk_namestore_pkey.c
index a1551d27..428fa422 100644
--- a/src/namestore/plugin_gtk_namestore_pkey.c
+++ b/src/namestore/plugin_gtk_namestore_pkey.c
@@ -35,8 +35,7 @@
* @param user_data the plugin environment
*/
static void
-GNS_edit_dialog_pkey_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
+GNS_edit_dialog_pkey_entry_changed_cb (GtkEditable *entry, gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
@@ -54,12 +53,11 @@ GNS_edit_dialog_pkey_entry_changed_cb (GtkEditable *entry,
* @param builder the edit dialog's builder
*/
static void
-pkey_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+pkey_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_pkey_entry")),
+ gtk_entry_set_text (GTK_ENTRY (
+ gtk_builder_get_object (builder,
+ "edit_dialog_pkey_entry")),
n_value);
}
@@ -73,14 +71,13 @@ pkey_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-pkey_store (void *cls,
- GtkBuilder *builder)
+pkey_store (void *cls, GtkBuilder *builder)
{
GtkEntry *entry;
const gchar *value;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_pkey_entry"));
+ entry =
+ GTK_ENTRY (gtk_builder_get_object (builder, "edit_dialog_pkey_entry"));
value = gtk_entry_get_text (entry);
return g_strdup (value);
}
@@ -98,21 +95,20 @@ pkey_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-pkey_validate (void *cls,
- GtkBuilder *builder)
+pkey_validate (void *cls, GtkBuilder *builder)
{
GtkEditable *entry;
const gchar *preedit;
struct GNUNET_CRYPTO_EcdsaPublicKey pub;
- entry = GTK_EDITABLE (gtk_builder_get_object (builder,
- "edit_dialog_pkey_entry")),
+ entry =
+ GTK_EDITABLE (gtk_builder_get_object (builder, "edit_dialog_pkey_entry")),
preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK !=
- GNUNET_CRYPTO_ecdsa_public_key_from_string (preedit,
- strlen (preedit),
- &pub)) )
+ if ((NULL == preedit) ||
+ (GNUNET_OK !=
+ GNUNET_CRYPTO_ecdsa_public_key_from_string (preedit,
+ strlen (preedit),
+ &pub)))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -129,11 +125,10 @@ libgnunet_plugin_gtk_namestore_pkey_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "GNS_edit_dialog_pkey_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_pkey_entry_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"GNS_edit_dialog_pkey_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_pkey_entry_changed_cb)},
+ {NULL, NULL}};
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
diff --git a/src/namestore/plugin_gtk_namestore_ptr.c
b/src/namestore/plugin_gtk_namestore_ptr.c
index 20673906..6ca7c158 100644
--- a/src/namestore/plugin_gtk_namestore_ptr.c
+++ b/src/namestore/plugin_gtk_namestore_ptr.c
@@ -35,8 +35,7 @@
* @param user_data the plugin environment
*/
static void
-GNS_edit_dialog_ptr_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
+GNS_edit_dialog_ptr_entry_changed_cb (GtkEditable *entry, gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
@@ -54,12 +53,11 @@ GNS_edit_dialog_ptr_entry_changed_cb (GtkEditable *entry,
* @param builder the edit dialog's builder
*/
static void
-ptr_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+ptr_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_ptr_entry")),
+ gtk_entry_set_text (GTK_ENTRY (
+ gtk_builder_get_object (builder,
+ "edit_dialog_ptr_entry")),
n_value);
}
@@ -73,14 +71,12 @@ ptr_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-ptr_store (void *cls,
- GtkBuilder *builder)
+ptr_store (void *cls, GtkBuilder *builder)
{
GtkEntry *entry;
const gchar *value;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_ptr_entry"));
+ entry = GTK_ENTRY (gtk_builder_get_object (builder,
"edit_dialog_ptr_entry"));
value = gtk_entry_get_text (entry);
return g_strdup (value);
}
@@ -98,17 +94,15 @@ ptr_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-ptr_validate (void *cls,
- GtkBuilder *builder)
+ptr_validate (void *cls, GtkBuilder *builder)
{
GtkEditable *entry;
const gchar *preedit;
- entry = GTK_EDITABLE (gtk_builder_get_object (builder,
- "edit_dialog_ptr_entry")),
+ entry =
+ GTK_EDITABLE (gtk_builder_get_object (builder, "edit_dialog_ptr_entry")),
preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
+ if ((NULL == preedit) || (GNUNET_OK != GNUNET_DNSPARSER_check_name
(preedit)))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -125,11 +119,10 @@ libgnunet_plugin_gtk_namestore_ptr_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "GNS_edit_dialog_ptr_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_ptr_entry_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"GNS_edit_dialog_ptr_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_ptr_entry_changed_cb)},
+ {NULL, NULL}};
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
diff --git a/src/namestore/plugin_gtk_namestore_soa.c
b/src/namestore/plugin_gtk_namestore_soa.c
index 0645e610..69b856f6 100644
--- a/src/namestore/plugin_gtk_namestore_soa.c
+++ b/src/namestore/plugin_gtk_namestore_soa.c
@@ -36,7 +36,7 @@
*/
static void
GNS_edit_dialog_soa_contact_email_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
+ gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
@@ -53,7 +53,7 @@ GNS_edit_dialog_soa_contact_email_entry_changed_cb
(GtkEditable *entry,
*/
static void
GNS_edit_dialog_soa_source_host_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
+ gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
@@ -71,9 +71,7 @@ GNS_edit_dialog_soa_source_host_entry_changed_cb (GtkEditable
*entry,
* @param builder the edit dialog's builder
*/
static void
-soa_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+soa_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
char soa_rname[253 + 1];
char soa_mname[253 + 1];
@@ -94,37 +92,39 @@ soa_load (void *cls,
&soa_min))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Unable to parse SOA record `%s'\n"),
+ _ ("Unable to parse SOA record `%s'\n"),
n_value);
return;
}
/* set SOA record */
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_soa_source_host_entry")),
- soa_rname);
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_soa_contact_email_entry")),
- soa_mname);
- gtk_spin_button_set_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
-
"edit_dialog_soa_serial_number_spinbutton")),
- soa_serial);
- gtk_spin_button_set_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
-
"edit_dialog_soa_refresh_time_spinbutton")),
- soa_refresh);
- gtk_spin_button_set_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
-
"edit_dialog_soa_retry_time_spinbutton")),
- soa_retry);
- gtk_spin_button_set_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
-
"edit_dialog_soa_expire_time_spinbutton")),
- soa_expire);
- gtk_spin_button_set_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
-
"edit_dialog_soa_minimum_ttl_spinbutton")),
- soa_min);
+ gtk_entry_set_text (
+ GTK_ENTRY (
+ gtk_builder_get_object (builder, "edit_dialog_soa_source_host_entry")),
+ soa_rname);
+ gtk_entry_set_text (
+ GTK_ENTRY (
+ gtk_builder_get_object (builder, "edit_dialog_soa_contact_email_entry")),
+ soa_mname);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object (
+ builder,
+ "edit_dialog_soa_serial_number_spinbutton")),
+ soa_serial);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object (
+ builder,
+ "edit_dialog_soa_refresh_time_spinbutton")),
+ soa_refresh);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object (
+ builder,
+ "edit_dialog_soa_retry_time_spinbutton")),
+ soa_retry);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object (
+ builder,
+ "edit_dialog_soa_expire_time_spinbutton")),
+ soa_expire);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object (
+ builder,
+ "edit_dialog_soa_minimum_ttl_spinbutton")),
+ soa_min);
}
@@ -137,8 +137,7 @@ soa_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-soa_store (void *cls,
- GtkBuilder *builder)
+soa_store (void *cls, GtkBuilder *builder)
{
GtkEntry *entry;
const gchar *source_host;
@@ -150,25 +149,30 @@ soa_store (void *cls,
unsigned int soa_min;
char *result;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_soa_source_host_entry"));
+ entry = GTK_ENTRY (
+ gtk_builder_get_object (builder, "edit_dialog_soa_source_host_entry"));
source_host = gtk_entry_get_text (entry);
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_soa_contact_email_entry"));
+ entry = GTK_ENTRY (
+ gtk_builder_get_object (builder, "edit_dialog_soa_contact_email_entry"));
contact_email = gtk_entry_get_text (entry);
- soa_serial = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (builder,
-
"edit_dialog_soa_serial_number_spinbutton")));
- soa_refresh = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (builder,
-
"edit_dialog_soa_refresh_time_spinbutton")));
- soa_retry = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (builder,
-
"edit_dialog_soa_retry_time_spinbutton")));
- soa_expire = gtk_spin_button_get_value (GTK_SPIN_BUTTON
(gtk_builder_get_object (builder,
-
"edit_dialog_soa_expire_time_spinbutton")));
- soa_min = gtk_spin_button_get_value (GTK_SPIN_BUTTON (gtk_builder_get_object
(builder,
-
"edit_dialog_soa_minimum_ttl_spinbutton")));
+ soa_serial = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder,
+ "edit_dialog_soa_serial_number_spinbutton")));
+ soa_refresh = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder,
+ "edit_dialog_soa_refresh_time_spinbutton")));
+ soa_retry = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder,
"edit_dialog_soa_retry_time_spinbutton")));
+ soa_expire = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder,
+ "edit_dialog_soa_expire_time_spinbutton")));
+ soa_min = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder,
+ "edit_dialog_soa_minimum_ttl_spinbutton")));
GNUNET_asprintf (&result,
"rname=%s mname=%s %lu,%lu,%lu,%lu,%lu",
- source_host, contact_email,
+ source_host,
+ contact_email,
soa_serial,
soa_refresh,
soa_retry,
@@ -190,29 +194,26 @@ soa_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-soa_validate (void *cls,
- GtkBuilder *builder)
+soa_validate (void *cls, GtkBuilder *builder)
{
GtkEditable *entry;
const gchar *preedit;
- entry = GTK_EDITABLE (gtk_builder_get_object (builder,
-
"edit_dialog_soa_source_host_entry")),
+ entry = GTK_EDITABLE (
+ gtk_builder_get_object (builder, "edit_dialog_soa_source_host_entry")),
preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
+ if ((NULL == preedit) || (GNUNET_OK != GNUNET_DNSPARSER_check_name
(preedit)))
return GNUNET_SYSERR;
/* check for '@' in the e-mail --- required format uses "." instead! */
- entry = GTK_EDITABLE (gtk_builder_get_object (builder,
-
"edit_dialog_soa_contact_email_entry")),
+ entry = GTK_EDITABLE (
+ gtk_builder_get_object (builder, "edit_dialog_soa_contact_email_entry")),
preedit = gtk_editable_get_chars (entry, 0, -1);
/* E-mail is specified in the RFC also as a 'domain-name', hence
we check above that it follows those conventions as well; the '@'
is a common mistake, and while it should be illegal despite IDN,
it feels better to check explicitly. */
- if ( (NULL == preedit) ||
- (NULL != strstr (preedit, "@")) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
+ if ((NULL == preedit) || (NULL != strstr (preedit, "@")) ||
+ (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -229,13 +230,12 @@ libgnunet_plugin_gtk_namestore_soa_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "GNS_edit_dialog_soa_contact_email_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_soa_contact_email_entry_changed_cb) },
- { "GNS_edit_dialog_soa_source_host_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_soa_source_host_entry_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"GNS_edit_dialog_soa_contact_email_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_soa_contact_email_entry_changed_cb)},
+ {"GNS_edit_dialog_soa_source_host_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_soa_source_host_entry_changed_cb)},
+ {NULL, NULL}};
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
diff --git a/src/namestore/plugin_gtk_namestore_srv.c
b/src/namestore/plugin_gtk_namestore_srv.c
index b701edb2..8707f179 100644
--- a/src/namestore/plugin_gtk_namestore_srv.c
+++ b/src/namestore/plugin_gtk_namestore_srv.c
@@ -78,9 +78,7 @@ edit_dialog_protocol_combobox_changed_cb (GtkEditable *entry,
* @param builder the edit dialog's builder
*/
static void
-srv_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+srv_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
unsigned int protocol;
GtkComboBox *cb;
@@ -105,7 +103,7 @@ srv_load (void *cls,
target_name))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Unable to parse (boxed) SRV record `%s'\n"),
+ _ ("Unable to parse (boxed) SRV record `%s'\n"),
n_value);
return;
}
@@ -114,47 +112,41 @@ srv_load (void *cls,
GNUNET_break (0);
return;
}
- gtk_spin_button_set_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
- "edit_dialog_port_spinbutton")),
- protocol);
- cb = GTK_COMBO_BOX (gtk_builder_get_object (builder,
-
"edit_dialog_protocol_combobox"));
- tm = GTK_TREE_MODEL (gtk_builder_get_object (builder,
-
"edit_dialog_protocol_liststore"));
- if (gtk_tree_model_get_iter_first (tm,
- &iter))
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder, "edit_dialog_port_spinbutton")),
+ protocol);
+ cb = GTK_COMBO_BOX (
+ gtk_builder_get_object (builder, "edit_dialog_protocol_combobox"));
+ tm = GTK_TREE_MODEL (
+ gtk_builder_get_object (builder, "edit_dialog_protocol_liststore"));
+ if (gtk_tree_model_get_iter_first (tm, &iter))
{
do
{
- gtk_tree_model_get (tm,
- &iter,
- 1, &service_at_iter,
- -1);
+ gtk_tree_model_get (tm, &iter, 1, &service_at_iter, -1);
if (service_at_iter == service)
{
- gtk_combo_box_set_active_iter (cb,
- &iter);
+ gtk_combo_box_set_active_iter (cb, &iter);
break;
}
- }
- while (gtk_tree_model_iter_next (tm,
- &iter));
+ } while (gtk_tree_model_iter_next (tm, &iter));
}
- gtk_spin_button_set_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
-
"edit_dialog_srv_priority_spinbutton")),
- priority);
- gtk_spin_button_set_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
-
"edit_dialog_srv_weight_spinbutton")),
- weight);
- gtk_spin_button_set_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
-
"edit_dialog_srv_value_port_spinbutton")),
- port);
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_srv_target_entry")),
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder, "edit_dialog_srv_priority_spinbutton")),
+ priority);
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder, "edit_dialog_srv_weight_spinbutton")),
+ weight);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (gtk_builder_get_object (
+ builder,
+ "edit_dialog_srv_value_port_spinbutton")),
+ port);
+ gtk_entry_set_text (GTK_ENTRY (
+ gtk_builder_get_object (builder,
+
"edit_dialog_srv_target_entry")),
target_name);
}
@@ -168,8 +160,7 @@ srv_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-srv_store (void *cls,
- GtkBuilder *builder)
+srv_store (void *cls, GtkBuilder *builder)
{
unsigned int protocol;
GtkComboBox *cb;
@@ -183,34 +174,26 @@ srv_store (void *cls,
char *result;
GtkTreeModel *tm;
- protocol = gtk_spin_button_get_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
- "edit_dialog_port_spinbutton")));
- cb = GTK_COMBO_BOX (gtk_builder_get_object (builder,
-
"edit_dialog_protocol_combobox"));
- if (! gtk_combo_box_get_active_iter (cb,
- &iter))
+ protocol = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder, "edit_dialog_port_spinbutton")));
+ cb = GTK_COMBO_BOX (
+ gtk_builder_get_object (builder, "edit_dialog_protocol_combobox"));
+ if (! gtk_combo_box_get_active_iter (cb, &iter))
{
GNUNET_break (0);
return NULL;
}
- tm = GTK_TREE_MODEL (gtk_builder_get_object (builder,
-
"edit_dialog_protocol_liststore"));
- gtk_tree_model_get (tm,
- &iter,
- 1, &service,
- -1);
- priority = gtk_spin_button_get_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
-
"edit_dialog_srv_priority_spinbutton")));
- weight = gtk_spin_button_get_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
-
"edit_dialog_srv_weight_spinbutton")));
- port = gtk_spin_button_get_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
-
"edit_dialog_srv_value_port_spinbutton")));
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_srv_target_entry"));
+ tm = GTK_TREE_MODEL (
+ gtk_builder_get_object (builder, "edit_dialog_protocol_liststore"));
+ gtk_tree_model_get (tm, &iter, 1, &service, -1);
+ priority = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder, "edit_dialog_srv_priority_spinbutton")));
+ weight = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder, "edit_dialog_srv_weight_spinbutton")));
+ port = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder,
"edit_dialog_srv_value_port_spinbutton")));
+ entry = GTK_ENTRY (
+ gtk_builder_get_object (builder, "edit_dialog_srv_target_entry"));
target = gtk_entry_get_text (entry);
GNUNET_asprintf (&result,
"%u %u %u %u %u %u %s",
@@ -237,24 +220,21 @@ srv_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-srv_validate (void *cls,
- GtkBuilder *builder)
+srv_validate (void *cls, GtkBuilder *builder)
{
GtkEditable *entry;
const gchar *preedit;
GtkComboBox *cb;
GtkTreeIter iter;
- entry = GTK_EDITABLE (gtk_builder_get_object (builder,
-
"edit_dialog_srv_target_entry"));
+ entry = GTK_EDITABLE (
+ gtk_builder_get_object (builder, "edit_dialog_srv_target_entry"));
preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
+ if ((NULL == preedit) || (GNUNET_OK != GNUNET_DNSPARSER_check_name
(preedit)))
return GNUNET_SYSERR;
- cb = GTK_COMBO_BOX (gtk_builder_get_object (builder,
-
"edit_dialog_protocol_combobox"));
- if (! gtk_combo_box_get_active_iter (cb,
- &iter))
+ cb = GTK_COMBO_BOX (
+ gtk_builder_get_object (builder, "edit_dialog_protocol_combobox"));
+ if (! gtk_combo_box_get_active_iter (cb, &iter))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -271,14 +251,13 @@ libgnunet_plugin_gtk_namestore_srv_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "GNS_edit_dialog_srv_target_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_srv_target_entry_changed_cb) },
- /* generic CBs */
- { "edit_dialog_protocol_combobox_changed_cb",
- G_CALLBACK (edit_dialog_protocol_combobox_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"GNS_edit_dialog_srv_target_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_srv_target_entry_changed_cb)},
+ /* generic CBs */
+ {"edit_dialog_protocol_combobox_changed_cb",
+ G_CALLBACK (edit_dialog_protocol_combobox_changed_cb)},
+ {NULL, NULL}};
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
diff --git a/src/namestore/plugin_gtk_namestore_template.c
b/src/namestore/plugin_gtk_namestore_template.c
index fc13f1da..561ecafe 100644
--- a/src/namestore/plugin_gtk_namestore_template.c
+++ b/src/namestore/plugin_gtk_namestore_template.c
@@ -35,8 +35,7 @@
* @param user_data the plugin environment
*/
static void
-FOO_changed_cb (GtkEditable *entry,
- gpointer user_data)
+FOO_changed_cb (GtkEditable *entry, gpointer user_data)
{
*edc = user_data;
@@ -53,9 +52,7 @@ FOO_changed_cb (GtkEditable *entry,
* @param builder the edit dialog's builder
*/
static void
-template_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+template_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
GNUNET_break (0);
}
@@ -70,8 +67,7 @@ template_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-template_store (void *cls,
- GtkBuilder *builder)
+template_store (void *cls, GtkBuilder *builder)
{
GNUNET_break (0);
return NULL;
@@ -90,8 +86,7 @@ template_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-template_validate (void *cls,
- GtkBuilder *builder)
+template_validate (void *cls, GtkBuilder *builder)
{
GNUNET_break (0);
return GNUNET_OK;
@@ -109,11 +104,8 @@ libgnunet_plugin_gtk_namestore_template_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "FOO_changed_cb",
- G_CALLBACK (FOO_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"FOO_changed_cb", G_CALLBACK (FOO_changed_cb)}, {NULL, NULL}};
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
diff --git a/src/namestore/plugin_gtk_namestore_tlsa.c
b/src/namestore/plugin_gtk_namestore_tlsa.c
index 3dc90a3e..719d51cc 100644
--- a/src/namestore/plugin_gtk_namestore_tlsa.c
+++ b/src/namestore/plugin_gtk_namestore_tlsa.c
@@ -42,8 +42,7 @@
* @param user_data the plugin environment
*/
static void
-tlsa_value_textbuffer_changed_cb (GtkTextBuffer *textbuffer,
- gpointer user_data)
+tlsa_value_textbuffer_changed_cb (GtkTextBuffer *textbuffer, gpointer
user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
@@ -93,8 +92,9 @@ edit_dialog_tlsa_usage_radiobutton_toggled_cb
(GtkToggleButton *togglebutton,
* @param user_data the plugin environment
*/
static void
-edit_dialog_tlsa_matching_type_radiobutton_toggled_cb (GtkToggleButton
*togglebutton,
- gpointer user_data)
+edit_dialog_tlsa_matching_type_radiobutton_toggled_cb (
+ GtkToggleButton *togglebutton,
+ gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
@@ -130,15 +130,13 @@ edit_dialog_protocol_combobox_changed_cb (GtkEditable
*entry,
* @return index of the selected button, -1 for none
*/
static int
-get_selected_radio_value (GtkBuilder *builder,
- const char *const*button_names)
+get_selected_radio_value (GtkBuilder *builder, const char *const *button_names)
{
GtkToggleButton *b;
- for (int i=0; NULL != button_names[i]; i++)
+ for (int i = 0; NULL != button_names[i]; i++)
{
- b = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder,
- button_names[i]));
+ b = GTK_TOGGLE_BUTTON (gtk_builder_get_object (builder, button_names[i]));
if (gtk_toggle_button_get_active (b))
return i;
}
@@ -150,36 +148,33 @@ get_selected_radio_value (GtkBuilder *builder,
* NULL-terminated array with the names of the "usage" buttons,
* in order to match the respective value in TLSA.
*/
-static const char *const usage_buttons[] = {
- "edit_dialog_tlsa_usage_ca_radiobutton",
- "edit_dialog_tlsa_usage_service_cert_radiobutton",
- "edit_dialog_tlsa_usage_trust_anchor_radiobutton",
- "edit_dialog_tlsa_usage_domain_issued_cert_radiobutton",
- NULL
-};
+static const char *const usage_buttons[] =
+ {"edit_dialog_tlsa_usage_ca_radiobutton",
+ "edit_dialog_tlsa_usage_service_cert_radiobutton",
+ "edit_dialog_tlsa_usage_trust_anchor_radiobutton",
+ "edit_dialog_tlsa_usage_domain_issued_cert_radiobutton",
+ NULL};
/**
* NULL-terminated array with the names of the "selector" buttons,
* in order to match the respective value in TLSA.
*/
-static const char *const selector_buttons[] = {
- "edit_dialog_tlsa_selector_full_cert_radiobutton",
- "edit_dialog_tlsa_selector_subject_public_key_radiobutton",
- NULL
-};
+static const char *const selector_buttons[] =
+ {"edit_dialog_tlsa_selector_full_cert_radiobutton",
+ "edit_dialog_tlsa_selector_subject_public_key_radiobutton",
+ NULL};
/**
* NULL-terminated array with the names of the "matching type" buttons,
* in order to match the respective value in TLSA.
*/
-static const char *const matching_type_buttons[] = {
- "edit_dialog_tlsa_matching_type_full_contents_radiobutton",
- "edit_dialog_tlsa_matching_type_sha256_radiobutton",
- "edit_dialog_tlsa_matching_type_sha512_radiobutton",
- NULL
-};
+static const char *const matching_type_buttons[] =
+ {"edit_dialog_tlsa_matching_type_full_contents_radiobutton",
+ "edit_dialog_tlsa_matching_type_sha256_radiobutton",
+ "edit_dialog_tlsa_matching_type_sha512_radiobutton",
+ NULL};
/**
@@ -192,9 +187,7 @@ static const char *const matching_type_buttons[] = {
* @param builder the edit dialog's builder
*/
static void
-tlsa_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+tlsa_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
unsigned int protocol;
GtkComboBox *cb;
@@ -221,7 +214,7 @@ tlsa_load (void *cls,
cert_data))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Unable to parse (boxed) TLSA record `%s'\n"),
+ _ ("Unable to parse (boxed) TLSA record `%s'\n"),
n_value);
return;
}
@@ -230,62 +223,54 @@ tlsa_load (void *cls,
GNUNET_break (0);
return;
}
- gtk_spin_button_set_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
- "edit_dialog_port_spinbutton")),
- service);
- cb = GTK_COMBO_BOX (gtk_builder_get_object (builder,
-
"edit_dialog_protocol_combobox"));
- tm = GTK_TREE_MODEL (gtk_builder_get_object (builder,
-
"edit_dialog_protocol_liststore"));
- if (gtk_tree_model_get_iter_first (tm,
- &iter))
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder, "edit_dialog_port_spinbutton")),
+ service);
+ cb = GTK_COMBO_BOX (
+ gtk_builder_get_object (builder, "edit_dialog_protocol_combobox"));
+ tm = GTK_TREE_MODEL (
+ gtk_builder_get_object (builder, "edit_dialog_protocol_liststore"));
+ if (gtk_tree_model_get_iter_first (tm, &iter))
{
do
{
- gtk_tree_model_get (tm,
- &iter,
- 1, &protocol_at_iter,
- -1);
+ gtk_tree_model_get (tm, &iter, 1, &protocol_at_iter, -1);
if (protocol_at_iter == protocol)
{
- gtk_combo_box_set_active_iter (cb,
- &iter);
+ gtk_combo_box_set_active_iter (cb, &iter);
break;
}
- }
- while (gtk_tree_model_iter_next (tm,
- &iter));
+ } while (gtk_tree_model_iter_next (tm, &iter));
}
switch (usage)
{
case 0: /* CA cert */
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (gtk_builder_get_object
- (builder,
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (
+ builder,
"edit_dialog_tlsa_usage_ca_radiobutton")),
TRUE);
break;
case 1: /* Entity cert */
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (gtk_builder_get_object
- (builder,
-
"edit_dialog_tlsa_usage_service_cert_radiobutton")),
- TRUE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (builder,
+
"edit_dialog_tlsa_usage_service_cert_radiobutton")),
+ TRUE);
break;
case 2: /* Trust anchor */
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (gtk_builder_get_object
- (builder,
-
"edit_dialog_tlsa_usage_trust_anchor_radiobutton")),
- TRUE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (builder,
+
"edit_dialog_tlsa_usage_trust_anchor_radiobutton")),
+ TRUE);
break;
case 3: /* Domain-issued cert */
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (gtk_builder_get_object
- (builder,
-
"edit_dialog_tlsa_usage_domain_issued_cert_radiobutton")),
- TRUE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (gtk_builder_get_object (
+ builder,
+ "edit_dialog_tlsa_usage_domain_issued_cert_radiobutton")),
+ TRUE);
break;
default:
GNUNET_break_op (0);
@@ -294,50 +279,47 @@ tlsa_load (void *cls,
switch (selector)
{
case 0: /* full cert, binary */
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (gtk_builder_get_object
- (builder,
-
"edit_dialog_tlsa_selector_full_cert_radiobutton")),
- TRUE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (builder,
+
"edit_dialog_tlsa_selector_full_cert_radiobutton")),
+ TRUE);
break;
case 1: /* full cert, DER */
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (gtk_builder_get_object
- (builder,
-
"edit_dialog_tlsa_selector_subject_public_key_radiobutton")),
- TRUE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (gtk_builder_get_object (
+ builder,
+ "edit_dialog_tlsa_selector_subject_public_key_radiobutton")),
+ TRUE);
break;
}
switch (matching_type)
{
case 0: /* exact match */
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (gtk_builder_get_object
- (builder,
-
"edit_dialog_tlsa_matching_type_full_contents_radiobutton")),
- TRUE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (gtk_builder_get_object (
+ builder,
+ "edit_dialog_tlsa_matching_type_full_contents_radiobutton")),
+ TRUE);
break;
case 1: /* SHA-256 hash */
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (gtk_builder_get_object
- (builder,
-
"edit_dialog_tlsa_matching_type_sha256_radiobutton")),
- TRUE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (gtk_builder_get_object (
+ builder,
+ "edit_dialog_tlsa_matching_type_sha256_radiobutton")),
+ TRUE);
break;
case 2: /* SHA-512 hash */
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (gtk_builder_get_object
- (builder,
-
"edit_dialog_tlsa_matching_type_sha512_radiobutton")),
- TRUE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (gtk_builder_get_object (
+ builder,
+ "edit_dialog_tlsa_matching_type_sha512_radiobutton")),
+ TRUE);
break;
}
- tb = gtk_text_view_get_buffer (GTK_TEXT_VIEW
- (gtk_builder_get_object (builder,
-
"edit_dialog_tlsa_value_textview")));
- gtk_text_buffer_set_text (tb,
- cert_data,
- -1);
+ tb = gtk_text_view_get_buffer (GTK_TEXT_VIEW (
+ gtk_builder_get_object (builder, "edit_dialog_tlsa_value_textview")));
+ gtk_text_buffer_set_text (tb, cert_data, -1);
}
@@ -350,8 +332,7 @@ tlsa_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-tlsa_store (void *cls,
- GtkBuilder *builder)
+tlsa_store (void *cls, GtkBuilder *builder)
{
unsigned int protocol;
GtkComboBox *cb;
@@ -367,48 +348,34 @@ tlsa_store (void *cls,
GtkTextIter ti_start;
GtkTextIter ti_end;
- service = gtk_spin_button_get_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
- "edit_dialog_port_spinbutton")));
- cb = GTK_COMBO_BOX (gtk_builder_get_object (builder,
-
"edit_dialog_protocol_combobox"));
- if (! gtk_combo_box_get_active_iter (cb,
- &iter))
+ service = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (builder, "edit_dialog_port_spinbutton")));
+ cb = GTK_COMBO_BOX (
+ gtk_builder_get_object (builder, "edit_dialog_protocol_combobox"));
+ if (! gtk_combo_box_get_active_iter (cb, &iter))
{
GNUNET_break (0);
return NULL;
}
- tm = GTK_TREE_MODEL (gtk_builder_get_object (builder,
-
"edit_dialog_protocol_liststore"));
- gtk_tree_model_get (tm,
- &iter,
- 1, &protocol,
- -1);
- usage = get_selected_radio_value (builder,
- usage_buttons);
- selector = get_selected_radio_value (builder,
- selector_buttons);
- matching_type = get_selected_radio_value (builder,
- matching_type_buttons);
- if ( (-1 == usage) ||
- (-1 == selector) ||
- (-1 == matching_type) )
+ tm = GTK_TREE_MODEL (
+ gtk_builder_get_object (builder, "edit_dialog_protocol_liststore"));
+ gtk_tree_model_get (tm, &iter, 1, &protocol, -1);
+ usage = get_selected_radio_value (builder, usage_buttons);
+ selector = get_selected_radio_value (builder, selector_buttons);
+ matching_type = get_selected_radio_value (builder, matching_type_buttons);
+ if ((-1 == usage) || (-1 == selector) || (-1 == matching_type))
{
GNUNET_break (0);
return NULL;
}
- tb = gtk_text_view_get_buffer (GTK_TEXT_VIEW
- (gtk_builder_get_object (builder,
-
"edit_dialog_tlsa_value_textview")));
+ tb = gtk_text_view_get_buffer (GTK_TEXT_VIEW (
+ gtk_builder_get_object (builder, "edit_dialog_tlsa_value_textview")));
gtk_text_buffer_get_iter_at_offset (tb, &ti_start, 0);
gtk_text_buffer_get_iter_at_offset (tb, &ti_end, -1);
- value = gtk_text_buffer_get_text (tb,
- &ti_start,
- &ti_end,
- FALSE);
+ value = gtk_text_buffer_get_text (tb, &ti_start, &ti_end, FALSE);
GNUNET_asprintf (&result,
"%u %u %u %u %u %u %s",
protocol,
@@ -435,8 +402,7 @@ tlsa_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-tlsa_validate (void *cls,
- GtkBuilder *builder)
+tlsa_validate (void *cls, GtkBuilder *builder)
{
GtkComboBox *cb;
GtkTreeIter iter;
@@ -452,42 +418,33 @@ tlsa_validate (void *cls,
unsigned int selector;
int err;
- cb = GTK_COMBO_BOX (gtk_builder_get_object (builder,
-
"edit_dialog_protocol_combobox"));
- if (! gtk_combo_box_get_active_iter (cb,
- &iter))
+ cb = GTK_COMBO_BOX (
+ gtk_builder_get_object (builder, "edit_dialog_protocol_combobox"));
+ if (! gtk_combo_box_get_active_iter (cb, &iter))
{
return GNUNET_SYSERR;
}
- tb = gtk_text_view_get_buffer (GTK_TEXT_VIEW
- (gtk_builder_get_object (builder,
-
"edit_dialog_tlsa_value_textview")));
+ tb = gtk_text_view_get_buffer (GTK_TEXT_VIEW (
+ gtk_builder_get_object (builder, "edit_dialog_tlsa_value_textview")));
gtk_text_buffer_get_iter_at_offset (tb, &ti_start, 0);
gtk_text_buffer_get_iter_at_offset (tb, &ti_end, -1);
- value = gtk_text_buffer_get_text (tb,
- &ti_start,
- &ti_end,
- FALSE);
+ value = gtk_text_buffer_get_text (tb, &ti_start, &ti_end, FALSE);
if (0 == strlen (value))
return GNUNET_SYSERR;
{
size_t slen = strlen (value);
uint8_t bin[slen / 2];
- if (slen / 2 !=
- GNUNET_DNSPARSER_hex_to_bin (value,
- bin))
+ if (slen / 2 != GNUNET_DNSPARSER_hex_to_bin (value, bin))
{
/* not hex */
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Certificate value is not in hex...\n"));
+ _ ("Certificate value is not in hex...\n"));
return GNUNET_SYSERR;
}
- matching_type = get_selected_radio_value (builder,
- matching_type_buttons);
- selector = get_selected_radio_value (builder,
- selector_buttons);
+ matching_type = get_selected_radio_value (builder, matching_type_buttons);
+ selector = get_selected_radio_value (builder, selector_buttons);
switch (matching_type)
{
case 0: /* exact match */
@@ -496,49 +453,43 @@ tlsa_validate (void *cls,
switch (selector)
{
case 0: /* full Cert */
- if (GNUTLS_E_SUCCESS !=
- (err = gnutls_x509_crt_init (&cert)))
+ if (GNUTLS_E_SUCCESS != (err = gnutls_x509_crt_init (&cert)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to initialize CERT: %s\n"),
+ _ ("Failed to initialize CERT: %s\n"),
gnutls_strerror_name (err));
ret = GNUNET_SYSERR;
break;
}
if (GNUTLS_E_SUCCESS !=
- (err = gnutls_x509_crt_import (cert,
- &datum,
- GNUTLS_X509_FMT_DER)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to parse CERT: %s\n"),
- gnutls_strerror_name (err));
- ret = GNUNET_SYSERR;
- }
+ (err = gnutls_x509_crt_import (cert, &datum, GNUTLS_X509_FMT_DER)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _ ("Failed to parse CERT: %s\n"),
+ gnutls_strerror_name (err));
+ ret = GNUNET_SYSERR;
+ }
else
ret = GNUNET_OK;
gnutls_x509_crt_deinit (cert);
break;
case 1: /* subject public key only */
- if (GNUTLS_E_SUCCESS !=
- (err = gnutls_pubkey_init (&pk)))
+ if (GNUTLS_E_SUCCESS != (err = gnutls_pubkey_init (&pk)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to initialize PK: %s\n"),
+ _ ("Failed to initialize PK: %s\n"),
gnutls_strerror_name (err));
ret = GNUNET_SYSERR;
break;
}
if (GNUTLS_E_SUCCESS !=
- (err = gnutls_pubkey_import (pk,
- &datum,
- GNUTLS_X509_FMT_DER)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to parse PK: %s\n"),
- gnutls_strerror_name (err));
- ret = GNUNET_SYSERR;
- }
+ (err = gnutls_pubkey_import (pk, &datum, GNUTLS_X509_FMT_DER)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ _ ("Failed to parse PK: %s\n"),
+ gnutls_strerror_name (err));
+ ret = GNUNET_SYSERR;
+ }
else
ret = GNUNET_OK;
gnutls_pubkey_deinit (pk);
@@ -607,8 +558,7 @@ struct ImportContext
* @param ic the import context
*/
static void
-import_x509_certificate (gnutls_session_t session,
- struct ImportContext *ic)
+import_x509_certificate (gnutls_session_t session, struct ImportContext *ic)
{
GtkBuilder *builder = ic->builder;
const gnutls_datum_t *cert_list;
@@ -622,14 +572,13 @@ import_x509_certificate (gnutls_session_t session,
size_t bsize;
char *hex;
gnutls_datum_t datum;
- uint8_t sha256[256/8];
- uint8_t sha512[512/8];
+ uint8_t sha256[256 / 8];
+ uint8_t sha512[512 / 8];
size_t ssize;
GtkTextBuffer *tb;
unsigned int i;
- cert_list = gnutls_certificate_get_peers (session,
- &cert_list_size);
+ cert_list = gnutls_certificate_get_peers (session, &cert_list_size);
if (0 == cert_list_size)
{
/* is it possible to succeed with TLS handshake and have
@@ -638,10 +587,9 @@ import_x509_certificate (gnutls_session_t session,
return;
}
- usage = get_selected_radio_value (builder,
- usage_buttons);
+ usage = get_selected_radio_value (builder, usage_buttons);
/* Find out which certificate we care about based on usage */
- for (i=0;i<cert_list_size;i++)
+ for (i = 0; i < cert_list_size; i++)
{
char san[256];
size_t san_size = sizeof (san);
@@ -652,9 +600,7 @@ import_x509_certificate (gnutls_session_t session,
gnutls_x509_crt_init (&cert);
if (GNUTLS_E_SUCCESS !=
- gnutls_x509_crt_import (cert,
- &cert_list[i],
- GNUTLS_X509_FMT_DER))
+ gnutls_x509_crt_import (cert, &cert_list[i], GNUTLS_X509_FMT_DER))
{
GNUNET_break (0);
gnutls_x509_crt_deinit (cert);
@@ -663,35 +609,27 @@ import_x509_certificate (gnutls_session_t session,
if (1 == usage)
break; /* RFC 6394: first certificate (i==0) is to be pinned */
matches_dn = GNUNET_NO;
- if ( (0 == gnutls_x509_crt_get_subject (cert,
- &dn)) &&
- (0 == gnutls_x509_dn_get_str (dn,
- &str)) )
+ if ((0 == gnutls_x509_crt_get_subject (cert, &dn)) &&
+ (0 == gnutls_x509_dn_get_str (dn, &str)))
{
const char *cn;
- cn = memmem (str.data,
- str.size,
- ",CN=",
- 4);
- if ( (NULL != cn) &&
- ( ('\0' == cn[4 + strlen (ic->name)]) ||
- (',' == cn[4 + strlen (ic->name)]) ) &&
- (0 == strncasecmp (cn + 4,
- ic->name,
- strlen (ic->name))) )
+ cn = memmem (str.data, str.size, ",CN=", 4);
+ if ((NULL != cn) &&
+ (('\0' == cn[4 + strlen (ic->name)]) ||
+ (',' == cn[4 + strlen (ic->name)])) &&
+ (0 == strncasecmp (cn + 4, ic->name, strlen (ic->name))))
matches_dn = GNUNET_YES;
}
- for (unsigned int seq=0;
- GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE !=
gnutls_x509_crt_get_subject_alt_name (cert,
-
seq,
-
san,
-
&san_size,
-
&critical);
+ for (unsigned int seq = 0; GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE !=
+ gnutls_x509_crt_get_subject_alt_name (cert,
+ seq,
+ san,
+ &san_size,
+
&critical);
seq++)
{
- if (0 == strcasecmp (san,
- ic->name))
+ if (0 == strcasecmp (san, ic->name))
{
matches_dn = GNUNET_YES;
break;
@@ -699,8 +637,8 @@ import_x509_certificate (gnutls_session_t session,
}
/* usage = 3: we want to match DN, otherwise we do NOT want to
match DN */
- if ( (GNUNET_NO == matches_dn) ^ /* XOR */
- (3 == usage) /* Domain issued certificate */ )
+ if ((GNUNET_NO == matches_dn) ^ /* XOR */
+ (3 == usage) /* Domain issued certificate */)
break;
gnutls_x509_crt_deinit (cert);
}
@@ -713,17 +651,13 @@ import_x509_certificate (gnutls_session_t session,
return;
}
- selector = get_selected_radio_value (builder,
- selector_buttons);
+ selector = get_selected_radio_value (builder, selector_buttons);
switch (selector)
{
case 0: /* full cert */
bsize = sizeof (buf);
if (GNUTLS_E_SUCCESS !=
- gnutls_x509_crt_export (cert,
- GNUTLS_X509_FMT_DER,
- buf,
- &bsize))
+ gnutls_x509_crt_export (cert, GNUTLS_X509_FMT_DER, buf, &bsize))
{
GNUNET_break (0);
gnutls_x509_crt_deinit (cert);
@@ -731,17 +665,13 @@ import_x509_certificate (gnutls_session_t session,
}
break;
case 1: /* subject public key only */
- if (GNUTLS_E_SUCCESS !=
- gnutls_pubkey_init (&pk))
+ if (GNUTLS_E_SUCCESS != gnutls_pubkey_init (&pk))
{
GNUNET_break (0);
gnutls_x509_crt_deinit (cert);
return;
}
- if (GNUTLS_E_SUCCESS !=
- gnutls_pubkey_import_x509 (pk,
- cert,
- 0))
+ if (GNUTLS_E_SUCCESS != gnutls_pubkey_import_x509 (pk, cert, 0))
{
GNUNET_break (0);
gnutls_x509_crt_deinit (cert);
@@ -750,10 +680,7 @@ import_x509_certificate (gnutls_session_t session,
}
bsize = sizeof (buf);
if (GNUTLS_E_SUCCESS !=
- gnutls_pubkey_export (pk,
- GNUTLS_X509_FMT_DER,
- buf,
- &bsize))
+ gnutls_pubkey_export (pk, GNUTLS_X509_FMT_DER, buf, &bsize))
{
GNUNET_break (0);
gnutls_x509_crt_deinit (cert);
@@ -771,37 +698,29 @@ import_x509_certificate (gnutls_session_t session,
/* 'buf' now contains 'bsize' bytes of the binary data to
hash or store in the TLSA record; hash depending on
user preferences. */
- matching_type = get_selected_radio_value (builder,
- matching_type_buttons);
+ matching_type = get_selected_radio_value (builder, matching_type_buttons);
switch (matching_type)
{
case 0: /* exact match */
- hex = GNUNET_DNSPARSER_bin_to_hex (buf,
- bsize);
+ hex = GNUNET_DNSPARSER_bin_to_hex (buf, bsize);
break;
case 1: /* SHA-256 hash */
datum.size = bsize;
datum.data = (void *) buf;
ssize = sizeof (sha256);
- GNUNET_assert (GNUTLS_E_SUCCESS ==
- gnutls_fingerprint (GNUTLS_MAC_SHA256,
- &datum,
- sha256,
- &ssize));
- hex = GNUNET_DNSPARSER_bin_to_hex (sha256,
- sizeof (sha256));
+ GNUNET_assert (
+ GNUTLS_E_SUCCESS ==
+ gnutls_fingerprint (GNUTLS_MAC_SHA256, &datum, sha256, &ssize));
+ hex = GNUNET_DNSPARSER_bin_to_hex (sha256, sizeof (sha256));
break;
case 2: /* SHA-512 hash */
datum.size = bsize;
datum.data = (void *) buf;
ssize = sizeof (sha512);
- GNUNET_assert (GNUTLS_E_SUCCESS ==
- gnutls_fingerprint (GNUTLS_MAC_SHA512,
- &datum,
- sha512,
- &ssize));
- hex = GNUNET_DNSPARSER_bin_to_hex (sha512,
- sizeof (sha512));
+ GNUNET_assert (
+ GNUTLS_E_SUCCESS ==
+ gnutls_fingerprint (GNUTLS_MAC_SHA512, &datum, sha512, &ssize));
+ hex = GNUNET_DNSPARSER_bin_to_hex (sha512, sizeof (sha512));
break;
default:
GNUNET_break (0);
@@ -809,12 +728,9 @@ import_x509_certificate (gnutls_session_t session,
}
/* Finally store 'hex' to the text buffer */
- tb = gtk_text_view_get_buffer (GTK_TEXT_VIEW
- (gtk_builder_get_object (builder,
-
"edit_dialog_tlsa_value_textview")));
- gtk_text_buffer_set_text (tb,
- hex,
- -1);
+ tb = gtk_text_view_get_buffer (GTK_TEXT_VIEW (
+ gtk_builder_get_object (builder, "edit_dialog_tlsa_value_textview")));
+ gtk_text_buffer_set_text (tb, hex, -1);
GNUNET_free (hex);
}
@@ -827,9 +743,7 @@ import_x509_certificate (gnutls_session_t session,
* @param addrlen length of @a addr
*/
static void
-import_address_cb (void *cls,
- const struct sockaddr *addr,
- socklen_t addrlen)
+import_address_cb (void *cls, const struct sockaddr *addr, socklen_t addrlen)
{
struct ImportContext *ic = cls;
int pf;
@@ -848,15 +762,14 @@ import_address_cb (void *cls,
{
if (GNUNET_YES != ic->done)
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Name resolution for `%s' failed\n"),
+ _ ("Name resolution for `%s' failed\n"),
ic->name);
GNUNET_free (ic->name);
GNUNET_free (ic);
return;
}
- port = gtk_spin_button_get_value
- (GTK_SPIN_BUTTON (gtk_builder_get_object (ic->builder,
- "edit_dialog_port_spinbutton")));
+ port = gtk_spin_button_get_value (GTK_SPIN_BUTTON (
+ gtk_builder_get_object (ic->builder, "edit_dialog_port_spinbutton")));
switch (addr->sa_family)
{
case AF_INET:
@@ -873,30 +786,23 @@ import_address_cb (void *cls,
break;
default:
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Unsupported address family %d\n"),
+ _ ("Unsupported address family %d\n"),
addr->sa_family);
return;
}
- ic->sock = GNUNET_NETWORK_socket_create (pf,
- SOCK_STREAM,
- 0);
+ ic->sock = GNUNET_NETWORK_socket_create (pf, SOCK_STREAM, 0);
if (NULL == ic->sock)
{
- GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
- "socket");
+ GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "socket");
return;
}
GNUNET_break (GNUNET_OK ==
- GNUNET_NETWORK_socket_set_blocking (ic->sock,
- GNUNET_YES));
- if ( (GNUNET_OK !=
- GNUNET_NETWORK_socket_connect (ic->sock,
- a,
- addrlen)) &&
- (EINPROGRESS != errno) )
+ GNUNET_NETWORK_socket_set_blocking (ic->sock, GNUNET_YES));
+ if ((GNUNET_OK != GNUNET_NETWORK_socket_connect (ic->sock, a, addrlen)) &&
+ (EINPROGRESS != errno))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Failed to connect to target address `%s': %s\n"),
+ _ ("Failed to connect to target address `%s': %s\n"),
GNUNET_a2s (addr, addrlen),
STRERROR (errno));
GNUNET_NETWORK_socket_close (ic->sock);
@@ -905,8 +811,7 @@ import_address_cb (void *cls,
/* initialize TLS session */
gnutls_init (&session, GNUTLS_CLIENT);
- gnutls_session_set_ptr (session,
- ic);
+ gnutls_session_set_ptr (session, ic);
gnutls_server_name_set (session,
GNUTLS_NAME_DNS,
ic->name,
@@ -916,23 +821,17 @@ import_address_cb (void *cls,
/* Use default priorities */
gnutls_certificate_allocate_credentials (&xcred);
if (GNUTLS_E_SUCCESS !=
- (ret = gnutls_priority_set_direct (session,
- "PERFORMANCE",
- NULL)))
+ (ret = gnutls_priority_set_direct (session, "PERFORMANCE", NULL)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to initialize cipher suite: %s\n"),
+ _ ("Failed to initialize cipher suite: %s\n"),
gnutls_strerror (ret));
goto cleanup;
}
/* put the x509 credentials to the current session */
- gnutls_credentials_set (session,
- GNUTLS_CRD_CERTIFICATE,
- xcred);
- gnutls_transport_set_int (session,
- GNUNET_NETWORK_get_fd (ic->sock));
- gnutls_handshake_set_timeout (session,
- 2000 /* 2s */);
+ gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, xcred);
+ gnutls_transport_set_int (session, GNUNET_NETWORK_get_fd (ic->sock));
+ gnutls_handshake_set_timeout (session, 2000 /* 2s */);
/* TODO: do this in event loop, with insensitive GUI,
with possibly higher timeout ... */
@@ -940,8 +839,7 @@ import_address_cb (void *cls,
do
{
ret = gnutls_handshake (session);
- }
- while ( (ret < 0) && (0 == gnutls_error_is_fatal (ret)) );
+ } while ((ret < 0) && (0 == gnutls_error_is_fatal (ret)));
/* finally, access the certificate */
if (GNUTLS_E_SUCCESS == ret)
@@ -951,30 +849,28 @@ import_address_cb (void *cls,
{
case GNUTLS_CRT_UNKNOWN:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Server certificate type not supported\n"));
+ _ ("Server certificate type not supported\n"));
break;
case GNUTLS_CRT_X509:
- import_x509_certificate (session,
- ic);
+ import_x509_certificate (session, ic);
break;
default:
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Server certificate type not supported\n"));
+ _ ("Server certificate type not supported\n"));
break;
}
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("TLS handshake failed: %s\n"),
+ _ ("TLS handshake failed: %s\n"),
gnutls_strerror (ret));
}
gnutls_bye (session, GNUTLS_SHUT_RDWR);
ic->done = GNUNET_YES;
- cleanup:
- GNUNET_break (GNUNET_OK ==
- GNUNET_NETWORK_socket_close (ic->sock));
+cleanup:
+ GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (ic->sock));
gnutls_deinit (session);
gnutls_certificate_free_credentials (xcred);
}
@@ -988,21 +884,18 @@ import_address_cb (void *cls,
* @param user_data the plugin environment
*/
static void
-tlsa_import_button_clicked_cb (GtkButton *button,
- gpointer user_data)
+tlsa_import_button_clicked_cb (GtkButton *button, gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
struct ImportContext *ic;
const gchar *name;
GtkWidget *entry;
- entry = GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_tlsa_import_entry"));
- name = gtk_editable_get_chars (GTK_EDITABLE (entry),
- 0, -1);
- if ( (NULL == name) ||
- (0 == strlen (name)) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (name)) )
+ entry = GTK_WIDGET (
+ gtk_builder_get_object (edc->builder, "edit_dialog_tlsa_import_entry"));
+ name = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
+ if ((NULL == name) || (0 == strlen (name)) ||
+ (GNUNET_OK != GNUNET_DNSPARSER_check_name (name)))
{
/* import button should not have been sensitive */
GNUNET_break (0);
@@ -1035,13 +928,11 @@ edit_dialog_tlsa_import_entry_changed_cb (GtkEditable
*entry,
gboolean sens;
GtkWidget *button;
- button = GTK_WIDGET (gtk_builder_get_object (edc->builder,
-
"edit_dialog_tlsa_import_button"));
- preedit = gtk_editable_get_chars (GTK_EDITABLE (entry),
- 0, -1);
- if ( (NULL == preedit) ||
- (0 == strlen (preedit)) ||
- (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)) )
+ button = GTK_WIDGET (
+ gtk_builder_get_object (edc->builder, "edit_dialog_tlsa_import_button"));
+ preedit = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
+ if ((NULL == preedit) || (0 == strlen (preedit)) ||
+ (GNUNET_OK != GNUNET_DNSPARSER_check_name (preedit)))
sens = FALSE;
else
sens = TRUE;
@@ -1060,24 +951,23 @@ libgnunet_plugin_gtk_namestore_tlsa_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "tlsa_value_textbuffer_changed_cb",
- G_CALLBACK (tlsa_value_textbuffer_changed_cb) },
- { "edit_dialog_tlsa_selector_radiobutton_toggled_cb",
- G_CALLBACK (edit_dialog_tlsa_selector_radiobutton_toggled_cb) },
- { "edit_dialog_tlsa_usage_radiobutton_toggled_cb",
- G_CALLBACK (edit_dialog_tlsa_usage_radiobutton_toggled_cb) },
- { "edit_dialog_tlsa_matching_type_radiobutton_toggled_cb",
- G_CALLBACK (edit_dialog_tlsa_matching_type_radiobutton_toggled_cb) },
- { "tlsa_import_button_clicked_cb",
- G_CALLBACK (tlsa_import_button_clicked_cb) },
- { "edit_dialog_tlsa_import_entry_changed_cb",
- G_CALLBACK (edit_dialog_tlsa_import_entry_changed_cb) },
- /* generic CBs */
- { "edit_dialog_protocol_combobox_changed_cb",
- G_CALLBACK (edit_dialog_protocol_combobox_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"tlsa_value_textbuffer_changed_cb",
+ G_CALLBACK (tlsa_value_textbuffer_changed_cb)},
+ {"edit_dialog_tlsa_selector_radiobutton_toggled_cb",
+ G_CALLBACK (edit_dialog_tlsa_selector_radiobutton_toggled_cb)},
+ {"edit_dialog_tlsa_usage_radiobutton_toggled_cb",
+ G_CALLBACK (edit_dialog_tlsa_usage_radiobutton_toggled_cb)},
+ {"edit_dialog_tlsa_matching_type_radiobutton_toggled_cb",
+ G_CALLBACK (edit_dialog_tlsa_matching_type_radiobutton_toggled_cb)},
+ {"tlsa_import_button_clicked_cb",
+ G_CALLBACK (tlsa_import_button_clicked_cb)},
+ {"edit_dialog_tlsa_import_entry_changed_cb",
+ G_CALLBACK (edit_dialog_tlsa_import_entry_changed_cb)},
+ /* generic CBs */
+ {"edit_dialog_protocol_combobox_changed_cb",
+ G_CALLBACK (edit_dialog_protocol_combobox_changed_cb)},
+ {NULL, NULL}};
gnutls_global_init ();
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
diff --git a/src/namestore/plugin_gtk_namestore_txt.c
b/src/namestore/plugin_gtk_namestore_txt.c
index 9affbf96..dc819638 100644
--- a/src/namestore/plugin_gtk_namestore_txt.c
+++ b/src/namestore/plugin_gtk_namestore_txt.c
@@ -35,8 +35,7 @@
* @param user_data the plugin environment
*/
static void
-GNS_edit_dialog_txt_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
+GNS_edit_dialog_txt_entry_changed_cb (GtkEditable *entry, gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
@@ -54,12 +53,11 @@ GNS_edit_dialog_txt_entry_changed_cb (GtkEditable *entry,
* @param builder the edit dialog's builder
*/
static void
-txt_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+txt_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_txt_entry")),
+ gtk_entry_set_text (GTK_ENTRY (
+ gtk_builder_get_object (builder,
+ "edit_dialog_txt_entry")),
n_value);
}
@@ -73,14 +71,12 @@ txt_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-txt_store (void *cls,
- GtkBuilder *builder)
+txt_store (void *cls, GtkBuilder *builder)
{
GtkEntry *entry;
const gchar *value;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_txt_entry"));
+ entry = GTK_ENTRY (gtk_builder_get_object (builder,
"edit_dialog_txt_entry"));
value = gtk_entry_get_text (entry);
return g_strdup (value);
}
@@ -98,8 +94,7 @@ txt_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-txt_validate (void *cls,
- GtkBuilder *builder)
+txt_validate (void *cls, GtkBuilder *builder)
{
return GNUNET_OK;
}
@@ -116,11 +111,10 @@ libgnunet_plugin_gtk_namestore_txt_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "GNS_edit_dialog_txt_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_txt_entry_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"GNS_edit_dialog_txt_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_txt_entry_changed_cb)},
+ {NULL, NULL}};
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
diff --git a/src/namestore/plugin_gtk_namestore_vpn.c
b/src/namestore/plugin_gtk_namestore_vpn.c
index f0ee0f57..8a563051 100644
--- a/src/namestore/plugin_gtk_namestore_vpn.c
+++ b/src/namestore/plugin_gtk_namestore_vpn.c
@@ -36,7 +36,7 @@
*/
static void
GNS_edit_dialog_vpn_peer_entry_changed_cb (GtkEditable *entry,
- gpointer user_data)
+ gpointer user_data)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *edc = user_data;
@@ -54,35 +54,39 @@ GNS_edit_dialog_vpn_peer_entry_changed_cb (GtkEditable
*entry,
* @param builder the edit dialog's builder
*/
static void
-vpn_load (void *cls,
- gchar *n_value,
- GtkBuilder *builder)
+vpn_load (void *cls, gchar *n_value, GtkBuilder *builder)
{
char s_peer[53 + 1];
char s_serv[253 + 1];
unsigned int proto;
- if (3 != SSCANF (n_value,
- "%u %53s %253s",
- &proto, s_peer, s_serv))
+ if (3 != SSCANF (n_value, "%u %53s %253s", &proto, s_peer, s_serv))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Unable to parse VPN record string `%s'\n"),
+ _ ("Unable to parse VPN record string `%s'\n"),
n_value);
return;
}
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_vpn_identifier_entry")),
- s_serv);
- gtk_entry_set_text (GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_vpn_peer_entry")),
+ gtk_entry_set_text (
+ GTK_ENTRY (
+ gtk_builder_get_object (builder, "edit_dialog_vpn_identifier_entry")),
+ s_serv);
+ gtk_entry_set_text (GTK_ENTRY (
+ gtk_builder_get_object (builder,
+ "edit_dialog_vpn_peer_entry")),
s_peer);
if (IPPROTO_UDP == proto)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(builder,
-
"edit_dialog_vpn_protocol_udp_radiobutton")), TRUE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (builder,
+ "edit_dialog_vpn_protocol_udp_radiobutton")),
+ TRUE);
else
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object
(builder,
-
"edit_dialog_vpn_protocol_tcp_radiobutton")), TRUE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (builder,
+ "edit_dialog_vpn_protocol_tcp_radiobutton")),
+ TRUE);
}
@@ -95,8 +99,7 @@ vpn_load (void *cls,
* @return record value as a string, as specified in the dialog
*/
static gchar *
-vpn_store (void *cls,
- GtkBuilder *builder)
+vpn_store (void *cls, GtkBuilder *builder)
{
GtkEntry *entry;
const gchar *identifier;
@@ -104,14 +107,18 @@ vpn_store (void *cls,
unsigned int proto;
char *result;
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
-
"edit_dialog_vpn_identifier_entry"));
+ entry = GTK_ENTRY (
+ gtk_builder_get_object (builder, "edit_dialog_vpn_identifier_entry"));
identifier = gtk_entry_get_text (entry);
- entry = GTK_ENTRY (gtk_builder_get_object (builder,
- "edit_dialog_vpn_peer_entry"));
+ entry =
+ GTK_ENTRY (gtk_builder_get_object (builder, "edit_dialog_vpn_peer_entry"));
peer = gtk_entry_get_text (entry);
- proto = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(gtk_builder_get_object (builder,
-
"edit_dialog_vpn_protocol_tcp_radiobutton"))) ? IPPROTO_TCP : IPPROTO_UDP;
+ proto =
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
+ gtk_builder_get_object (builder,
+ "edit_dialog_vpn_protocol_tcp_radiobutton")))
+ ? IPPROTO_TCP
+ : IPPROTO_UDP;
GNUNET_asprintf (&result,
"%u %s %s",
proto,
@@ -133,21 +140,20 @@ vpn_store (void *cls,
* @return #GNUNET_OK if there is a valid record value in the dialog
*/
static int
-vpn_validate (void *cls,
- GtkBuilder *builder)
+vpn_validate (void *cls, GtkBuilder *builder)
{
GtkEditable *entry;
const gchar *preedit;
struct GNUNET_CRYPTO_EddsaPublicKey pk;
- entry = GTK_EDITABLE (gtk_builder_get_object (builder,
- "edit_dialog_vpn_peer_entry")),
+ entry = GTK_EDITABLE (
+ gtk_builder_get_object (builder, "edit_dialog_vpn_peer_entry")),
preedit = gtk_editable_get_chars (entry, 0, -1);
- if ( (NULL == preedit) ||
- (GNUNET_OK !=
- GNUNET_CRYPTO_eddsa_public_key_from_string (preedit,
- strlen (preedit),
- &pk)) )
+ if ((NULL == preedit) ||
+ (GNUNET_OK !=
+ GNUNET_CRYPTO_eddsa_public_key_from_string (preedit,
+ strlen (preedit),
+ &pk)))
return GNUNET_SYSERR;
return GNUNET_OK;
}
@@ -164,11 +170,10 @@ libgnunet_plugin_gtk_namestore_vpn_init (void *cls)
{
struct GNUNET_GTK_NAMESTORE_PluginEnvironment *env = cls;
struct GNUNET_GTK_NAMESTORE_PluginFunctions *plugin;
- static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] = {
- { "GNS_edit_dialog_vpn_peer_entry_changed_cb",
- G_CALLBACK (GNS_edit_dialog_vpn_peer_entry_changed_cb) },
- { NULL, NULL }
- };
+ static struct GNUNET_GTK_NAMESTORE_Symbol symbols[] =
+ {{"GNS_edit_dialog_vpn_peer_entry_changed_cb",
+ G_CALLBACK (GNS_edit_dialog_vpn_peer_entry_changed_cb)},
+ {NULL, NULL}};
plugin = GNUNET_new (struct GNUNET_GTK_NAMESTORE_PluginFunctions);
plugin->cls = env;
diff --git a/src/peerinfo/gnunet-peerinfo-gtk-about.c
b/src/peerinfo/gnunet-peerinfo-gtk-about.c
index a39ea692..9994657d 100644
--- a/src/peerinfo/gnunet-peerinfo-gtk-about.c
+++ b/src/peerinfo/gnunet-peerinfo-gtk-about.c
@@ -32,7 +32,7 @@
* This displays an about window
*/
void
-GNUNET_PEERINFO_GTK_main_menu_help_about_activate_cb (GtkWidget * dummy,
+GNUNET_PEERINFO_GTK_main_menu_help_about_activate_cb (GtkWidget *dummy,
gpointer data)
{
GNUNET_GTK_display_about ("gnunet_peerinfo_gtk_about_window.glade");
diff --git a/src/peerinfo/gnunet-peerinfo-gtk-flags.c
b/src/peerinfo/gnunet-peerinfo-gtk-flags.c
index 0a107894..30a39f76 100644
--- a/src/peerinfo/gnunet-peerinfo-gtk-flags.c
+++ b/src/peerinfo/gnunet-peerinfo-gtk-flags.c
@@ -100,8 +100,7 @@ GNUNET_PEERINFO_GTK_get_flag (const char *cc)
for (i = 0; i < strlen (mcc); i++)
mcc[i] = tolower (mcc[i]);
dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
- GNUNET_asprintf (&fn, "%sflags%s%s.png", dir,
- DIR_SEPARATOR_STR, mcc);
+ GNUNET_asprintf (&fn, "%sflags%s%s.png", dir, DIR_SEPARATOR_STR, mcc);
GNUNET_free (dir);
flagBuf = gdk_pixbuf_new_from_file (fn, NULL);
pos = GNUNET_new (struct Flag);
diff --git a/src/peerinfo/gnunet-peerinfo-gtk-flags.h
b/src/peerinfo/gnunet-peerinfo-gtk-flags.h
index 1877fb8f..915cfc3d 100644
--- a/src/peerinfo/gnunet-peerinfo-gtk-flags.h
+++ b/src/peerinfo/gnunet-peerinfo-gtk-flags.h
@@ -39,7 +39,6 @@ GdkPixbuf *
GNUNET_PEERINFO_GTK_get_flag (const char *cc);
-
/**
* Deallocate all cached flags.
*/
diff --git a/src/peerinfo/gnunet-peerinfo-gtk.c
b/src/peerinfo/gnunet-peerinfo-gtk.c
index b774f3bc..ec1a0526 100644
--- a/src/peerinfo/gnunet-peerinfo-gtk.c
+++ b/src/peerinfo/gnunet-peerinfo-gtk.c
@@ -35,7 +35,8 @@
#include <unique/unique.h>
#endif
-#define UPDATE_FREQUENCY GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 1)
+#define UPDATE_FREQUENCY \
+ GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
/**
* Should we show peers that have no connections and
@@ -247,7 +248,6 @@ struct PeerAddress
* Is this address active in ATS?
*/
gboolean address_ats_active;
-
};
@@ -290,7 +290,6 @@ struct PeerInfo
* State of this address in the transport state machine.
*/
enum GNUNET_TRANSPORT_PeerState state;
-
};
@@ -416,16 +415,14 @@ do_update (void *cls)
{
gtk_widget_thaw_child_notify (GTK_WIDGET (tv));
update_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS,
- &do_update,
- NULL);
-
+ &do_update,
+ NULL);
}
else
{
gtk_widget_freeze_child_notify (GTK_WIDGET (tv));
- update_task = GNUNET_SCHEDULER_add_delayed (UPDATE_FREQUENCY,
- &do_update,
- NULL);
+ update_task =
+ GNUNET_SCHEDULER_add_delayed (UPDATE_FREQUENCY, &do_update, NULL);
}
}
@@ -461,12 +458,9 @@ get_object (const char *name)
* @param pa address to free
*/
static void
-free_peer_address (struct PeerInfo *info,
- struct PeerAddress *pa)
+free_peer_address (struct PeerInfo *info, struct PeerAddress *pa)
{
- GNUNET_CONTAINER_DLL_remove (info->pa_head,
- info->pa_tail,
- pa);
+ GNUNET_CONTAINER_DLL_remove (info->pa_head, info->pa_tail, pa);
if (NULL != pa->tos)
{
GNUNET_TRANSPORT_address_to_string_cancel (pa->tos);
@@ -490,16 +484,13 @@ free_peer_address (struct PeerInfo *info,
* @return #GNUNET_OK (continue to iterate)
*/
static int
-free_paths (void *cts,
- const struct GNUNET_PeerIdentity *key,
- void *value)
+free_paths (void *cts, const struct GNUNET_PeerIdentity *key, void *value)
{
struct PeerInfo *info = value;
struct PeerAddress *pa;
while (NULL != (pa = info->pa_head))
- free_peer_address (info,
- pa);
+ free_peer_address (info, pa);
gtk_tree_row_reference_free (info->rr);
GNUNET_free (info);
return GNUNET_OK;
@@ -540,7 +531,7 @@ shutdown_task (void *cts)
GNUNET_TRANSPORT_monitor_peers_cancel (pmc);
pmc = NULL;
}
- if (NULL != pm )
+ if (NULL != pm)
{
GNUNET_TRANSPORT_monitor_plugins_cancel (pm);
pm = NULL;
@@ -550,9 +541,7 @@ shutdown_task (void *cts)
GNUNET_CORE_monitor_stop (cm);
cm = NULL;
}
- GNUNET_CONTAINER_multipeermap_iterate (peer2info,
- &free_paths,
- NULL);
+ GNUNET_CONTAINER_multipeermap_iterate (peer2info, &free_paths, NULL);
GNUNET_CONTAINER_multipeermap_destroy (peer2info);
peer2info = NULL;
GNUNET_PEERINFO_GTK_flags_shutdown ();
@@ -566,16 +555,13 @@ shutdown_task (void *cts)
* @param iter set to the iter corresponding to @a rr
*/
static void
-get_iter_from_rr (GtkTreeRowReference *rr,
- GtkTreeIter *iter)
+get_iter_from_rr (GtkTreeRowReference *rr, GtkTreeIter *iter)
{
GtkTreePath *path;
path = gtk_tree_row_reference_get_path (rr);
GNUNET_assert (NULL != path);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts),
- iter,
- path));
+ GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts), iter, path));
gtk_tree_path_free (path);
}
@@ -590,9 +576,7 @@ get_iter_from_rr (GtkTreeRowReference *rr,
* if #GNUNET_SYSERR: address is invalid
*/
static void
-peer_address_string_cb (void *cts,
- const char *address,
- int res)
+peer_address_string_cb (void *cts, const char *address, int res)
{
struct PeerAddress *pa = cts;
GtkTreeIter iter;
@@ -614,23 +598,32 @@ peer_address_string_cb (void *cts,
{
for (dot = colon - 1; dot != address; dot--)
if ('.' == *dot)
- break;
+ break;
if ('.' == *dot)
country = GNUNET_strndup (&dot[1], (colon - dot) - 1);
}
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_COUNTRY_NAME, country,
- PEERINFO_MC_COUNTRY_FLAG, GNUNET_PEERINFO_GTK_get_flag
(country),
- PEERINFO_MC_ADDRESS_AS_STRING, address,
- -1);
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_COUNTRY_NAME,
+ country,
+ PEERINFO_MC_COUNTRY_FLAG,
+ GNUNET_PEERINFO_GTK_get_flag (country),
+ PEERINFO_MC_ADDRESS_AS_STRING,
+ address,
+ -1);
if (pa->address_ats_active)
{
get_iter_from_rr (pa->pi->rr, &iter);
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_COUNTRY_NAME, country,
- PEERINFO_MC_COUNTRY_FLAG, GNUNET_PEERINFO_GTK_get_flag
(country),
- PEERINFO_MC_ADDRESS_AS_STRING, address,
- PEERINFO_MC_PLUGIN_NAME, pa->plugin,
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_COUNTRY_NAME,
+ country,
+ PEERINFO_MC_COUNTRY_FLAG,
+ GNUNET_PEERINFO_GTK_get_flag (country),
+ PEERINFO_MC_ADDRESS_AS_STRING,
+ address,
+ PEERINFO_MC_PLUGIN_NAME,
+ pa->plugin,
-1);
}
pa->address_as_string = GNUNET_strdup (address);
@@ -638,7 +631,6 @@ peer_address_string_cb (void *cts,
}
-
/**
* Obtain the address entry for the given address at the given
* peer. If the address entry does not yet exist, create it.
@@ -648,8 +640,7 @@ peer_address_string_cb (void *cts,
* @return address entry for the given address
*/
static struct PeerAddress *
-get_address (struct PeerInfo *pi,
- const struct GNUNET_HELLO_Address *addr)
+get_address (struct PeerInfo *pi, const struct GNUNET_HELLO_Address *addr)
{
static struct PeerAddress *pa;
GtkTreeIter iter;
@@ -657,12 +648,9 @@ get_address (struct PeerInfo *pi,
GtkTreePath *path;
for (pa = pi->pa_head; NULL != pa; pa = pa->next)
- if ( (addr->address_length == pa->addr_len) &&
- (0 == memcmp (addr->address,
- pa->addr,
- addr->address_length)) &&
- (0 == strcmp (addr->transport_name,
- pa->plugin)) )
+ if ((addr->address_length == pa->addr_len) &&
+ (0 == memcmp (addr->address, pa->addr, addr->address_length)) &&
+ (0 == strcmp (addr->transport_name, pa->plugin)))
return pa;
pa = GNUNET_malloc (sizeof (struct PeerAddress) + addr->address_length);
pa->plugin = GNUNET_strdup (addr->transport_name);
@@ -670,33 +658,28 @@ get_address (struct PeerInfo *pi,
pa->pi = pi;
memcpy (&pa[1], addr->address, addr->address_length);
pa->addr_len = addr->address_length;
- GNUNET_CONTAINER_DLL_insert (pi->pa_head,
- pi->pa_tail,
- pa);
+ GNUNET_CONTAINER_DLL_insert (pi->pa_head, pi->pa_tail, pa);
path = gtk_tree_row_reference_get_path (pi->rr);
GNUNET_assert (NULL != path);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts),
- &iter,
- path));
+ GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts), &iter, path));
gtk_tree_path_free (path);
gtk_tree_store_insert_with_values (ts,
&aiter,
&iter,
-1 /* append */,
- PEERINFO_MC_PLUGIN_NAME,
addr->transport_name,
+ PEERINFO_MC_PLUGIN_NAME,
+ addr->transport_name,
-1);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts),
- &aiter);
- pa->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts),
- path);
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), &aiter);
+ pa->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), path);
GNUNET_assert (NULL != pa->rr);
gtk_tree_path_free (path);
pa->tos = GNUNET_TRANSPORT_address_to_string (get_configuration (),
- addr,
+ addr,
GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
&peer_address_string_cb,
- pa);
+ pa);
return pa;
}
@@ -722,14 +705,14 @@ peer_address_cb (void *cts,
path = gtk_tree_row_reference_get_path (info->rr);
GNUNET_assert (NULL != path);
- GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts),
- &iter,
- path));
+ GNUNET_assert (gtk_tree_model_get_iter (GTK_TREE_MODEL (ts), &iter, path));
gtk_tree_path_free (path);
pa = get_address (info, address);
get_iter_from_rr (pa->rr, &iter);
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_PEERINFO_ADDRESS_EXPIRATION,
GNUNET_STRINGS_absolute_time_to_string (expiration),
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_PEERINFO_ADDRESS_EXPIRATION,
+ GNUNET_STRINGS_absolute_time_to_string (expiration),
-1);
return GNUNET_OK;
}
@@ -758,28 +741,31 @@ get_peer_info (const struct GNUNET_PeerIdentity *peer)
if (NULL != friends)
{
- gtk_tree_store_set (ts, &iter,
+ gtk_tree_store_set (ts,
+ &iter,
PEERINFO_MC_IS_FRIEND,
- GNUNET_CONTAINER_multipeermap_contains (friends,
- peer),
+ GNUNET_CONTAINER_multipeermap_contains (friends, peer),
-1);
}
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_PEER_IDENTITY_STRING, GNUNET_i2s (peer),
- PEERINFO_MC_PEERINFO, info,
- PEERINFO_MC_SHOW_FRIEND, TRUE,
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_PEER_IDENTITY_STRING,
+ GNUNET_i2s (peer),
+ PEERINFO_MC_PEERINFO,
+ info,
+ PEERINFO_MC_SHOW_FRIEND,
+ TRUE,
-1);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts),
- &iter);
- info->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts),
- path);
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (ts), &iter);
+ info->rr = gtk_tree_row_reference_new (GTK_TREE_MODEL (ts), path);
GNUNET_assert (NULL != info->rr);
gtk_tree_path_free (path);
GNUNET_assert (GNUNET_OK ==
- GNUNET_CONTAINER_multipeermap_put (peer2info,
- peer,
- info,
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+ GNUNET_CONTAINER_multipeermap_put (
+ peer2info,
+ peer,
+ info,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
return info;
}
@@ -800,14 +786,13 @@ peerinfo_processor (void *cts,
{
struct PeerInfo *info;
- if ( (NULL == hello) ||
- ( (! show_inactive) &&
- (0 ==
- GNUNET_TIME_absolute_get_remaining (GNUNET_HELLO_get_last_expiration
(hello)).rel_value_us) ) )
+ if ((NULL == hello) ||
+ ((! show_inactive) && (0 == GNUNET_TIME_absolute_get_remaining (
+ GNUNET_HELLO_get_last_expiration (hello))
+ .rel_value_us)))
return;
info = get_peer_info (peer);
- GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO,
- &peer_address_cb, info);
+ GNUNET_HELLO_iterate_addresses (hello, GNUNET_NO, &peer_address_cb, info);
}
@@ -820,19 +805,22 @@ peerinfo_processor (void *cts,
* @return #GNUNET_OK
*/
static int
-reset_ats_status (void *cls,
- const struct GNUNET_PeerIdentity *pid,
- void *value)
+reset_ats_status (void *cls, const struct GNUNET_PeerIdentity *pid, void
*value)
{
struct PeerInfo *info = value;
GtkTreeIter iter;
get_iter_from_rr (info->rr, &iter);
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_ATS_CONNECTIVITY_LED, NULL,
- PEERINFO_MC_ATS_SELECTED_STATUS, FALSE,
- PEERINFO_MC_BANDWIDTH_IN, 0,
- PEERINFO_MC_BANDWIDTH_OUT, 0,
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_ATS_CONNECTIVITY_LED,
+ NULL,
+ PEERINFO_MC_ATS_SELECTED_STATUS,
+ FALSE,
+ PEERINFO_MC_BANDWIDTH_IN,
+ 0,
+ PEERINFO_MC_BANDWIDTH_OUT,
+ 0,
-1);
return GNUNET_OK;
}
@@ -867,9 +855,7 @@ ats_status_cb (void *cts,
if (NULL == address)
{
/* state 'reset' / disconnect from service, reset everything */
- GNUNET_CONTAINER_multipeermap_iterate (peer2info,
- &reset_ats_status,
- NULL);
+ GNUNET_CONTAINER_multipeermap_iterate (peer2info, &reset_ats_status, NULL);
return;
}
@@ -885,12 +871,17 @@ ats_status_cb (void *cts,
free_peer_address (info, pa);
return;
}
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_ATS_CONNECTIVITY_LED,
(pa->address_ats_active) ? led_green : led_red,
- PEERINFO_MC_ATS_SELECTED_STATUS, pa->address_ats_active,
- PEERINFO_MC_BANDWIDTH_IN, pa->ats_in,
- PEERINFO_MC_BANDWIDTH_OUT, pa->ats_out,
- -1);
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_ATS_CONNECTIVITY_LED,
+ (pa->address_ats_active) ? led_green : led_red,
+ PEERINFO_MC_ATS_SELECTED_STATUS,
+ pa->address_ats_active,
+ PEERINFO_MC_BANDWIDTH_IN,
+ pa->ats_in,
+ PEERINFO_MC_BANDWIDTH_OUT,
+ pa->ats_out,
+ -1);
act = (GNUNET_YES == address_active) ? pa : NULL;
for (pa = info->pa_head; NULL != pa; pa = pa->next)
{
@@ -905,9 +896,12 @@ ats_status_cb (void *cts,
{
/* second address became active, set BW for first to zero */
get_iter_from_rr (pa->rr, &iter);
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_BANDWIDTH_IN, (guint) 0,
- PEERINFO_MC_BANDWIDTH_OUT, (guint) 0,
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_BANDWIDTH_IN,
+ (guint) 0,
+ PEERINFO_MC_BANDWIDTH_OUT,
+ (guint) 0,
-1);
}
}
@@ -916,29 +910,47 @@ ats_status_cb (void *cts,
if (NULL == act)
{
/* no active address, make sure per-peer state is on 'off' */
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_ATS_CONNECTIVITY_LED, led_red,
- PEERINFO_MC_ATS_SELECTED_STATUS, FALSE,
- PEERINFO_MC_BANDWIDTH_IN, (guint) 0,
- PEERINFO_MC_BANDWIDTH_OUT, (guint) 0,
- PEERINFO_MC_COUNTRY_NAME, NULL,
- PEERINFO_MC_COUNTRY_FLAG, NULL,
- PEERINFO_MC_ADDRESS_AS_STRING, NULL,
- PEERINFO_MC_PLUGIN_NAME, NULL,
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_ATS_CONNECTIVITY_LED,
+ led_red,
+ PEERINFO_MC_ATS_SELECTED_STATUS,
+ FALSE,
+ PEERINFO_MC_BANDWIDTH_IN,
+ (guint) 0,
+ PEERINFO_MC_BANDWIDTH_OUT,
+ (guint) 0,
+ PEERINFO_MC_COUNTRY_NAME,
+ NULL,
+ PEERINFO_MC_COUNTRY_FLAG,
+ NULL,
+ PEERINFO_MC_ADDRESS_AS_STRING,
+ NULL,
+ PEERINFO_MC_PLUGIN_NAME,
+ NULL,
-1);
}
else
{
/* update per-peer state to that of active address */
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_ATS_CONNECTIVITY_LED, led_green,
- PEERINFO_MC_ATS_SELECTED_STATUS, TRUE,
- PEERINFO_MC_BANDWIDTH_IN, act->ats_in,
- PEERINFO_MC_BANDWIDTH_OUT, act->ats_out,
- PEERINFO_MC_COUNTRY_NAME, act->country_name,
- PEERINFO_MC_COUNTRY_FLAG, GNUNET_PEERINFO_GTK_get_flag
(act->country_name),
- PEERINFO_MC_ADDRESS_AS_STRING, act->address_as_string,
- PEERINFO_MC_PLUGIN_NAME, act->plugin,
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_ATS_CONNECTIVITY_LED,
+ led_green,
+ PEERINFO_MC_ATS_SELECTED_STATUS,
+ TRUE,
+ PEERINFO_MC_BANDWIDTH_IN,
+ act->ats_in,
+ PEERINFO_MC_BANDWIDTH_OUT,
+ act->ats_out,
+ PEERINFO_MC_COUNTRY_NAME,
+ act->country_name,
+ PEERINFO_MC_COUNTRY_FLAG,
+ GNUNET_PEERINFO_GTK_get_flag (act->country_name),
+ PEERINFO_MC_ADDRESS_AS_STRING,
+ act->address_as_string,
+ PEERINFO_MC_PLUGIN_NAME,
+ act->plugin,
-1);
}
}
@@ -963,22 +975,34 @@ reset_transport_peer_status (void *cls,
struct PeerAddress *pa;
get_iter_from_rr (info->rr, &iter);
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_NEIGHBOUR_CONNECTED_STATUS, NULL,
- PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING,
NULL,
- PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_LED, NULL,
- PEERINFO_MC_NEIGHBOUR_STATE_AS_STRING, NULL,
- PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING, NULL,
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_NEIGHBOUR_CONNECTED_STATUS,
+ NULL,
+ PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING,
+ NULL,
+ PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_LED,
+ NULL,
+ PEERINFO_MC_NEIGHBOUR_STATE_AS_STRING,
+ NULL,
+ PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING,
+ NULL,
-1);
for (pa = info->pa_head; NULL != pa; pa = pa->next)
{
get_iter_from_rr (pa->rr, &iter);
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_NEIGHBOUR_CONNECTED_STATUS, FALSE,
- PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING,
NULL,
- PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_LED, NULL,
- PEERINFO_MC_NEIGHBOUR_STATE_AS_STRING, NULL,
- PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING, NULL,
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_NEIGHBOUR_CONNECTED_STATUS,
+ FALSE,
+ PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING,
+ NULL,
+ PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_LED,
+ NULL,
+ PEERINFO_MC_NEIGHBOUR_STATE_AS_STRING,
+ NULL,
+ PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING,
+ NULL,
-1);
}
return GNUNET_OK;
@@ -997,10 +1021,10 @@ reset_transport_peer_status (void *cls,
*/
static void
transport_peer_cb (void *cts,
- const struct GNUNET_PeerIdentity *peer,
- const struct GNUNET_HELLO_Address *address,
- enum GNUNET_TRANSPORT_PeerState state,
- struct GNUNET_TIME_Absolute state_timeout)
+ const struct GNUNET_PeerIdentity *peer,
+ const struct GNUNET_HELLO_Address *address,
+ enum GNUNET_TRANSPORT_PeerState state,
+ struct GNUNET_TIME_Absolute state_timeout)
{
struct PeerInfo *info;
GtkTreeIter iter;
@@ -1063,34 +1087,52 @@ transport_peer_cb (void *cts,
con = (GNUNET_YES == GNUNET_TRANSPORT_is_connected (state));
get_iter_from_rr (info->rr, &iter);
tos = GNUNET_STRINGS_absolute_time_to_string (state_timeout);
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_NEIGHBOUR_CONNECTED_STATUS, con,
- PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING,
con ? tos : NULL,
- PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_LED, led,
- PEERINFO_MC_NEIGHBOUR_STATE_AS_STRING,
GNUNET_TRANSPORT_ps2s (state),
- PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING, tos,
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_NEIGHBOUR_CONNECTED_STATUS,
+ con,
+ PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING,
+ con ? tos : NULL,
+ PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_LED,
+ led,
+ PEERINFO_MC_NEIGHBOUR_STATE_AS_STRING,
+ GNUNET_TRANSPORT_ps2s (state),
+ PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING,
+ tos,
-1);
for (pa = info->pa_head; NULL != pa; pa = pa->next)
{
get_iter_from_rr (pa->rr, &iter);
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_NEIGHBOUR_CONNECTED_STATUS, FALSE,
- PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING,
NULL,
- PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_LED, NULL,
- PEERINFO_MC_NEIGHBOUR_STATE_AS_STRING, NULL,
- PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING, NULL,
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_NEIGHBOUR_CONNECTED_STATUS,
+ FALSE,
+ PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING,
+ NULL,
+ PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_LED,
+ NULL,
+ PEERINFO_MC_NEIGHBOUR_STATE_AS_STRING,
+ NULL,
+ PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING,
+ NULL,
-1);
}
if (NULL == address)
return;
pa = get_address (info, address);
get_iter_from_rr (pa->rr, &iter);
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_NEIGHBOUR_CONNECTED_STATUS, con,
- PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING,
con ? tos : NULL,
- PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_LED, led,
- PEERINFO_MC_NEIGHBOUR_STATE_AS_STRING,
GNUNET_TRANSPORT_ps2s (state),
- PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING, tos,
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_NEIGHBOUR_CONNECTED_STATUS,
+ con,
+ PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_TIMEOUT_AS_STRING,
+ con ? tos : NULL,
+ PEERINFO_MC_NEIGHBOUR_CONNECTIVITY_LED,
+ led,
+ PEERINFO_MC_NEIGHBOUR_STATE_AS_STRING,
+ GNUNET_TRANSPORT_ps2s (state),
+ PEERINFO_MC_NEIGHBOUR_STATE_TIMEOUT_AS_STRING,
+ tos,
-1);
}
@@ -1114,9 +1156,9 @@ transport_peer_cb (void *cts,
*/
static void
transport_plugin_cb (void *cls,
- struct GNUNET_TRANSPORT_PluginSession *session,
- void **session_ctx,
- const struct GNUNET_TRANSPORT_SessionInfo *sinfo)
+ struct GNUNET_TRANSPORT_PluginSession *session,
+ void **session_ctx,
+ const struct GNUNET_TRANSPORT_SessionInfo *sinfo)
{
struct PeerInfo *info;
GtkTreeIter iter;
@@ -1124,8 +1166,7 @@ transport_plugin_cb (void *cls,
struct PeerAddress *pa;
GdkPixbuf *led;
- if ( (NULL == session) &&
- (NULL == sinfo) )
+ if ((NULL == session) && (NULL == sinfo))
{
/* initial iteration completed, ignore */
return;
@@ -1168,10 +1209,14 @@ transport_plugin_cb (void *cls,
tos = NULL;
pa = get_address (info, sinfo->address);
get_iter_from_rr (pa->rr, &iter);
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_PLUGIN_CONNECTIVITY_STATUS, (led_green ==
led),
- PEERINFO_MC_PLUGIN_CONNECTIVITY_LED, led,
- PEERINFO_MC_PLUGIN_CONNECTIVITY_TIMEOUT_AS_STRING, tos,
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_PLUGIN_CONNECTIVITY_STATUS,
+ (led_green == led),
+ PEERINFO_MC_PLUGIN_CONNECTIVITY_LED,
+ led,
+ PEERINFO_MC_PLUGIN_CONNECTIVITY_TIMEOUT_AS_STRING,
+ tos,
-1);
}
@@ -1193,9 +1238,12 @@ reset_core_status (void *cls,
GtkTreeIter iter;
get_iter_from_rr (info->rr, &iter);
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_CORE_CONNECTIVITY_LED, NULL,
- PEERINFO_MC_CORE_CONNECTED_STATUS, (guint) 0,
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_CORE_CONNECTIVITY_LED,
+ NULL,
+ PEERINFO_MC_CORE_CONNECTED_STATUS,
+ (guint) 0,
-1);
return GNUNET_OK;
}
@@ -1249,9 +1297,7 @@ handle_core_monitor_event (void *cts,
case GNUNET_CORE_KX_ITERATION_FINISHED:
return;
case GNUNET_CORE_KX_CORE_DISCONNECT:
- GNUNET_CONTAINER_multipeermap_iterate (peer2info,
- &reset_core_status,
- NULL);
+ GNUNET_CONTAINER_multipeermap_iterate (peer2info, &reset_core_status,
NULL);
return;
default:
GNUNET_break (0);
@@ -1261,9 +1307,12 @@ handle_core_monitor_event (void *cts,
}
info = get_peer_info (peer);
get_iter_from_rr (info->rr, &iter);
- gtk_tree_store_set (ts, &iter,
- PEERINFO_MC_CORE_CONNECTIVITY_LED, led,
- PEERINFO_MC_CORE_CONNECTED_STATUS, status,
+ gtk_tree_store_set (ts,
+ &iter,
+ PEERINFO_MC_CORE_CONNECTIVITY_LED,
+ led,
+ PEERINFO_MC_CORE_CONNECTED_STATUS,
+ status,
-1);
}
@@ -1277,9 +1326,7 @@ handle_core_monitor_event (void *cts,
* @return #GNUNET_OK if the writing succeeded
*/
static int
-write_friend (void *cts,
- const struct GNUNET_PeerIdentity *friend,
- void *value)
+write_friend (void *cts, const struct GNUNET_PeerIdentity *friend, void *value)
{
struct GNUNET_FRIENDS_Writer *w = cts;
@@ -1301,11 +1348,8 @@ write_friends ()
GNUNET_break (0);
return;
}
- GNUNET_CONTAINER_multipeermap_iterate (friends,
- &write_friend,
- w);
- if (GNUNET_OK !=
- GNUNET_FRIENDS_write_stop (w))
+ GNUNET_CONTAINER_multipeermap_iterate (friends, &write_friend, w);
+ if (GNUNET_OK != GNUNET_FRIENDS_write_stop (w))
{
GNUNET_break (0);
return;
@@ -1322,9 +1366,10 @@ write_friends ()
* @param user_data our main window builder
*/
void
-GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb
(GtkCellRendererToggle *cell_renderer,
- gchar
*path,
-
gpointer user_data)
+GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb (
+ GtkCellRendererToggle *cell_renderer,
+ gchar *path,
+ gpointer user_data)
{
GtkTreeIter old;
struct PeerInfo *info;
@@ -1335,36 +1380,32 @@
GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb (GtkCellRe
GNUNET_break (0);
return;
}
- if (! gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts),
- &old,
- path))
+ if (! gtk_tree_model_get_iter_from_string (GTK_TREE_MODEL (ts), &old, path))
{
GNUNET_break (0);
return;
}
gtk_tree_model_get (GTK_TREE_MODEL (ts),
- &old,
- PEERINFO_MC_PEERINFO, &info,
- PEERINFO_MC_IS_FRIEND, &oldvalue,
- -1);
- gtk_tree_store_set (ts,
- &old,
- PEERINFO_MC_IS_FRIEND, ! oldvalue,
+ &old,
+ PEERINFO_MC_PEERINFO,
+ &info,
+ PEERINFO_MC_IS_FRIEND,
+ &oldvalue,
-1);
+ gtk_tree_store_set (ts, &old, PEERINFO_MC_IS_FRIEND, ! oldvalue, -1);
if (oldvalue)
{
- GNUNET_break (1 ==
- GNUNET_CONTAINER_multipeermap_remove_all (friends,
- &info->pid));
+ GNUNET_break (
+ 1 == GNUNET_CONTAINER_multipeermap_remove_all (friends, &info->pid));
}
else
{
GNUNET_break (GNUNET_YES ==
- GNUNET_CONTAINER_multipeermap_put (friends,
- &info->pid,
- "true",
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
-
+ GNUNET_CONTAINER_multipeermap_put (
+ friends,
+ &info->pid,
+ "true",
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
}
write_friends ();
}
@@ -1377,8 +1418,7 @@
GNUNET_PEERINFO_GTK_main_window_friends_cellrenderertoggle_toggled_cb (GtkCellRe
* @param user_data unused
*/
void
-GNUNET_PEERINFO_GTK_quit_cb (GObject * object,
- gpointer user_data)
+GNUNET_PEERINFO_GTK_quit_cb (GObject *object, gpointer user_data)
{
GNUNET_SCHEDULER_shutdown ();
}
@@ -1398,8 +1438,7 @@ load_led (const char *color)
char *fn;
dir = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_DATADIR);
- GNUNET_asprintf (&fn, "%s%s.png", dir,
- color);
+ GNUNET_asprintf (&fn, "%s%s.png", dir, color);
GNUNET_free (dir);
pixbuf = gdk_pixbuf_new_from_file (fn, NULL);
GNUNET_free (fn);
@@ -1414,8 +1453,7 @@ load_led (const char *color)
* @param friend the friend to add
*/
static void
-add_friend (void *cts,
- const struct GNUNET_PeerIdentity *friend)
+add_friend (void *cts, const struct GNUNET_PeerIdentity *friend)
{
if (NULL == friends)
{
@@ -1423,10 +1461,11 @@ add_friend (void *cts,
return;
}
GNUNET_break (GNUNET_YES ==
- GNUNET_CONTAINER_multipeermap_put (friends,
- friend,
- "true",
-
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+ GNUNET_CONTAINER_multipeermap_put (
+ friends,
+ friend,
+ "true",
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
}
@@ -1457,9 +1496,13 @@ query_tooltip_cb (GtkWidget *widget,
int model_column = -1;
gchar *tmp;
- if (! gtk_tree_view_get_tooltip_context (tv, &x, &y,
+ if (! gtk_tree_view_get_tooltip_context (tv,
+ &x,
+ &y,
keyboard_tip,
- &model, &path, &iter))
+ &model,
+ &path,
+ &iter))
return FALSE;
if (! gtk_tree_view_get_path_at_pos (tv, x, y, NULL, &column, NULL, NULL))
return FALSE;
@@ -1475,19 +1518,11 @@ query_tooltip_cb (GtkWidget *widget,
if (-1 == model_column)
return FALSE;
- gtk_tree_model_get (model,
- &iter,
- model_column, &tmp,
- -1);
+ gtk_tree_model_get (model, &iter, model_column, &tmp, -1);
if (NULL == tmp)
return FALSE;
- gtk_tooltip_set_text (tooltip,
- tmp);
- gtk_tree_view_set_tooltip_cell (tv,
- tooltip,
- path,
- column,
- NULL);
+ gtk_tooltip_set_text (tooltip, tmp);
+ gtk_tree_view_set_tooltip_cell (tv, tooltip, path, column, NULL);
g_free (tmp);
gtk_tree_path_free (path);
return TRUE;
@@ -1508,9 +1543,7 @@ run (void *cts)
int can_edit_friends;
ml = cts;
- if (GNUNET_OK !=
- GNUNET_GTK_main_loop_build_window (ml,
- NULL))
+ if (GNUNET_OK != GNUNET_GTK_main_loop_build_window (ml, NULL))
return;
cfg = get_configuration ();
led_green = load_led ("green");
@@ -1522,75 +1555,59 @@ run (void *cts)
GNUNET_GTK_setup_nls ();
can_edit_friends =
(GNUNET_NO ==
- GNUNET_CONFIGURATION_have_value (cfg,
- "ARM",
- "SYSTEM_ONLY")) ||
+ GNUNET_CONFIGURATION_have_value (cfg, "ARM", "SYSTEM_ONLY")) ||
(GNUNET_YES ==
- GNUNET_CONFIGURATION_get_value_yesno (cfg,
- "ARM",
- "SYSTEM_ONLY"));
+ GNUNET_CONFIGURATION_get_value_yesno (cfg, "ARM", "SYSTEM_ONLY"));
if (can_edit_friends)
{
friends = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO);
- if (GNUNET_OK !=
- GNUNET_FRIENDS_parse (cfg,
- &add_friend,
- NULL))
+ if (GNUNET_OK != GNUNET_FRIENDS_parse (cfg, &add_friend, NULL))
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Failed to parse list of friends\n"));
+ _ ("Failed to parse list of friends\n"));
}
else
{
- gtk_tree_view_column_set_visible
- (GTK_TREE_VIEW_COLUMN
- (get_object ("GNUNET_PEERINFO_GTK_main_window_friends_treeviewcolumn")),
- FALSE);
+ gtk_tree_view_column_set_visible (
+ GTK_TREE_VIEW_COLUMN (
+ get_object ("GNUNET_PEERINFO_GTK_main_window_friends_treeviewcolumn")),
+ FALSE);
}
peer2info = GNUNET_CONTAINER_multipeermap_create (256, GNUNET_NO);
- cm = GNUNET_CORE_monitor_start (cfg,
- &handle_core_monitor_event,
- NULL);
- pnc = GNUNET_PEERINFO_notify (cfg,
- GNUNET_NO,
- &peerinfo_processor, NULL);
+ cm = GNUNET_CORE_monitor_start (cfg, &handle_core_monitor_event, NULL);
+ pnc = GNUNET_PEERINFO_notify (cfg, GNUNET_NO, &peerinfo_processor, NULL);
pmc = GNUNET_TRANSPORT_monitor_peers (cfg,
- NULL,
- GNUNET_NO,
- &transport_peer_cb,
- NULL);
- pm = GNUNET_TRANSPORT_monitor_plugins (cfg,
- &transport_plugin_cb,
- NULL);
- ats = GNUNET_ATS_performance_init (cfg,
- &ats_status_cb, NULL);
- tvc_core_connectivity = GTK_TREE_VIEW_COLUMN (get_object
("GNUNET_PEERINFO_GTK_main_window_core_connectivity_treeviewcolumn"));
- tvc_ats_connectivity = GTK_TREE_VIEW_COLUMN (get_object
("GNUNET_PEERINFO_GTK_main_window_ats_connectivity_treeviewcolumn"));
- tvc_plugin_connectivity = GTK_TREE_VIEW_COLUMN (get_object
("GNUNET_PEERINFO_GTK_main_window_plugin_connectivity_treeviewcolumn"));
- tvc_transport_connectivity = GTK_TREE_VIEW_COLUMN (get_object
("GNUNET_PEERINFO_GTK_main_window_transport_connectivity_treeviewcolumn"));
+ NULL,
+ GNUNET_NO,
+ &transport_peer_cb,
+ NULL);
+ pm = GNUNET_TRANSPORT_monitor_plugins (cfg, &transport_plugin_cb, NULL);
+ ats = GNUNET_ATS_performance_init (cfg, &ats_status_cb, NULL);
+ tvc_core_connectivity = GTK_TREE_VIEW_COLUMN (get_object (
+ "GNUNET_PEERINFO_GTK_main_window_core_connectivity_treeviewcolumn"));
+ tvc_ats_connectivity = GTK_TREE_VIEW_COLUMN (get_object (
+ "GNUNET_PEERINFO_GTK_main_window_ats_connectivity_treeviewcolumn"));
+ tvc_plugin_connectivity = GTK_TREE_VIEW_COLUMN (get_object (
+ "GNUNET_PEERINFO_GTK_main_window_plugin_connectivity_treeviewcolumn"));
+ tvc_transport_connectivity = GTK_TREE_VIEW_COLUMN (get_object (
+ "GNUNET_PEERINFO_GTK_main_window_transport_connectivity_treeviewcolumn"));
/* setup main window */
main_window = GTK_WIDGET (get_object ("GNUNET_PEERINFO_GTK_main_window"));
- main_window = GNUNET_GTK_plug_me ("GNUNET_PEERINFO_GTK_PLUG",
- main_window);
+ main_window = GNUNET_GTK_plug_me ("GNUNET_PEERINFO_GTK_PLUG", main_window);
ts = GTK_TREE_STORE (get_object ("GNUNET_PEERINFO_GTK_tree_store"));
GNUNET_assert (NULL != ts);
gtk_window_maximize (GTK_WINDOW (main_window));
tv = GTK_TREE_VIEW (get_object ("GNUNET_PEERINFO_GTK_main_window_treeview"));
g_object_set (tv, "has-tooltip", TRUE, NULL);
- g_signal_connect (tv, "query-tooltip",
- G_CALLBACK (query_tooltip_cb),
- NULL);
+ g_signal_connect (tv, "query-tooltip", G_CALLBACK (query_tooltip_cb), NULL);
#if HAVE_LIBUNIQUE
- unique_app_watch_window (unique_app,
- GTK_WINDOW (main_window));
+ unique_app_watch_window (unique_app, GTK_WINDOW (main_window));
#endif
/* make GUI visible */
gtk_widget_show (main_window);
gtk_window_present (GTK_WINDOW (main_window));
- update_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
- &do_update,
- NULL);
- GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
- NULL);
+ update_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &do_update, NULL);
+ GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
}
@@ -1604,25 +1621,23 @@ run (void *cts)
int
main (int argc, char **argv)
{
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_option_flag ('s',
- "show-inactive",
- gettext_noop ("show peers even if the are
inactive and we know nothing except their public key"),
- &show_inactive),
- GNUNET_GETOPT_OPTION_END
- };
+ struct GNUNET_GETOPT_CommandLineOption options[] =
+ {GNUNET_GETOPT_option_flag (
+ 's',
+ "show-inactive",
+ gettext_noop (
+ "show peers even if the are inactive and we know nothing except their
public key"),
+ &show_inactive),
+ GNUNET_GETOPT_OPTION_END};
#if HAVE_LIBUNIQUE
gtk_init (&argc, &argv);
- unique_app = unique_app_new ("org.gnunet.gnunet-peerinfo-gtk",
- NULL);
+ unique_app = unique_app_new ("org.gnunet.gnunet-peerinfo-gtk", NULL);
if (unique_app_is_running (unique_app))
{
UniqueResponse response;
- response = unique_app_send_message (unique_app,
- UNIQUE_ACTIVATE,
- NULL);
+ response = unique_app_send_message (unique_app, UNIQUE_ACTIVATE, NULL);
g_object_unref (unique_app);
return (UNIQUE_RESPONSE_OK == response) ? 0 : 1;
}
diff --git a/src/setup/gnunet-setup-datacache-config.c
b/src/setup/gnunet-setup-datacache-config.c
index d4bf668f..958ce611 100644
--- a/src/setup/gnunet-setup-datacache-config.c
+++ b/src/setup/gnunet-setup-datacache-config.c
@@ -30,7 +30,7 @@
* Stub implementation of the 'DeleteNotifyCallback' callback.
*/
static void
-dnc_dummy (void *cls, const struct GNUNET_HashCode * key, size_t size)
+dnc_dummy (void *cls, const struct GNUNET_HashCode *key, size_t size)
{
/* do nothing */
}
@@ -45,12 +45,11 @@ dnc_dummy (void *cls, const struct GNUNET_HashCode * key,
size_t size)
static int
test_config (const char *name)
{
- struct GNUNET_DATACACHE_PluginEnvironment env = {
- cfg,
- "dhtcache",
- NULL, &dnc_dummy,
- 1024LL
- };
+ struct GNUNET_DATACACHE_PluginEnvironment env = {cfg,
+ "dhtcache",
+ NULL,
+ &dnc_dummy,
+ 1024LL};
void *ret;
ret = GNUNET_PLUGIN_load (name, &env);
@@ -84,7 +83,7 @@ GNUNET_setup_datacache_postgres_invalidate_cb ()
void
-GNUNET_setup_datacache_postgres_tab_test_button_clicked_cb (GtkWidget * widget,
+GNUNET_setup_datacache_postgres_tab_test_button_clicked_cb (GtkWidget *widget,
gpointer user_data)
{
if (GNUNET_OK == test_config ("libgnunet_plugin_datacache_postgres"))
@@ -100,5 +99,4 @@ GNUNET_setup_datacache_postgres_tab_test_button_clicked_cb
(GtkWidget * widget,
}
-
/* end of gnunet-setup-datacache-config.c */
diff --git a/src/setup/gnunet-setup-datacache-plugins.c
b/src/setup/gnunet-setup-datacache-plugins.c
index 512766ea..5a40225e 100644
--- a/src/setup/gnunet-setup-datacache-plugins.c
+++ b/src/setup/gnunet-setup-datacache-plugins.c
@@ -34,7 +34,7 @@
* @param name name of the plugin to check
*/
static void
-test_plugin (GtkWidget * widget, const char *name)
+test_plugin (GtkWidget *widget, const char *name)
{
if (GNUNET_YES == GNUNET_PLUGIN_test (name))
{
@@ -48,9 +48,8 @@ test_plugin (GtkWidget * widget, const char *name)
}
-
void
-GNUNET_setup_fs_datacache_sqlite_radiobutton_realize_cb (GtkWidget * widget,
+GNUNET_setup_fs_datacache_sqlite_radiobutton_realize_cb (GtkWidget *widget,
gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_datacache_sqlite");
@@ -58,20 +57,19 @@ GNUNET_setup_fs_datacache_sqlite_radiobutton_realize_cb
(GtkWidget * widget,
void
-GNUNET_setup_fs_datacache_heap_radiobutton_realize_cb (GtkWidget * widget,
- gpointer user_data)
+GNUNET_setup_fs_datacache_heap_radiobutton_realize_cb (GtkWidget *widget,
+ gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_datacache_heap");
}
void
-GNUNET_setup_fs_datacache_postgres_radiobutton_realize_cb (GtkWidget * widget,
+GNUNET_setup_fs_datacache_postgres_radiobutton_realize_cb (GtkWidget *widget,
gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_datacache_postgres");
}
-
/* end of gnunet-setup-transport-plugins.c */
diff --git a/src/setup/gnunet-setup-datastore-config.c
b/src/setup/gnunet-setup-datastore-config.c
index 2e41ec4b..ff0ee74d 100644
--- a/src/setup/gnunet-setup-datastore-config.c
+++ b/src/setup/gnunet-setup-datastore-config.c
@@ -45,10 +45,7 @@ duc_dummy (void *cls, int delta)
static int
test_config (const char *name)
{
- struct GNUNET_DATASTORE_PluginEnvironment env = {
- cfg,
- &duc_dummy, NULL
- };
+ struct GNUNET_DATASTORE_PluginEnvironment env = {cfg, &duc_dummy, NULL};
void *ret;
ret = GNUNET_PLUGIN_load (name, &env);
@@ -90,7 +87,7 @@ GNUNET_setup_datastore_postgres_invalidate_cb ()
void
-GNUNET_setup_datastore_mysql_tab_test_button_clicked_cb (GtkWidget * widget,
+GNUNET_setup_datastore_mysql_tab_test_button_clicked_cb (GtkWidget *widget,
gpointer user_data)
{
if (GNUNET_OK == test_config ("libgnunet_plugin_datastore_mysql"))
@@ -107,7 +104,7 @@ GNUNET_setup_datastore_mysql_tab_test_button_clicked_cb
(GtkWidget * widget,
void
-GNUNET_setup_datastore_postgres_tab_test_button_clicked_cb (GtkWidget * widget,
+GNUNET_setup_datastore_postgres_tab_test_button_clicked_cb (GtkWidget *widget,
gpointer user_data)
{
if (GNUNET_OK == test_config ("libgnunet_plugin_datastore_postgres"))
@@ -123,5 +120,4 @@ GNUNET_setup_datastore_postgres_tab_test_button_clicked_cb
(GtkWidget * widget,
}
-
/* end of gnunet-setup-datastore-config.c */
diff --git a/src/setup/gnunet-setup-datastore-plugins.c
b/src/setup/gnunet-setup-datastore-plugins.c
index bf5ad468..e772e3ba 100644
--- a/src/setup/gnunet-setup-datastore-plugins.c
+++ b/src/setup/gnunet-setup-datastore-plugins.c
@@ -33,7 +33,7 @@
* @param name name of the plugin to check
*/
static void
-test_plugin (GtkWidget * widget, const char *name)
+test_plugin (GtkWidget *widget, const char *name)
{
if (GNUNET_YES == GNUNET_PLUGIN_test (name))
{
@@ -48,7 +48,7 @@ test_plugin (GtkWidget * widget, const char *name)
void
-GNUNET_setup_fs_datastore_sqlite_radiobutton_realize_cb (GtkWidget * widget,
+GNUNET_setup_fs_datastore_sqlite_radiobutton_realize_cb (GtkWidget *widget,
gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_datastore_sqlite");
@@ -56,7 +56,7 @@ GNUNET_setup_fs_datastore_sqlite_radiobutton_realize_cb
(GtkWidget * widget,
void
-GNUNET_setup_fs_datastore_mysql_radiobutton_realize_cb (GtkWidget * widget,
+GNUNET_setup_fs_datastore_mysql_radiobutton_realize_cb (GtkWidget *widget,
gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_datastore_mysql");
@@ -64,12 +64,11 @@ GNUNET_setup_fs_datastore_mysql_radiobutton_realize_cb
(GtkWidget * widget,
void
-GNUNET_setup_fs_datastore_postgres_radiobutton_realize_cb (GtkWidget * widget,
+GNUNET_setup_fs_datastore_postgres_radiobutton_realize_cb (GtkWidget *widget,
gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_datastore_postgres");
}
-
/* end of gnunet-setup-datastore-plugins.c */
diff --git a/src/setup/gnunet-setup-exit-services.c
b/src/setup/gnunet-setup-exit-services.c
index eb8c3aed..641642e9 100644
--- a/src/setup/gnunet-setup-exit-services.c
+++ b/src/setup/gnunet-setup-exit-services.c
@@ -64,8 +64,7 @@ enum ServiceModelColumns
* @param section name of the section
*/
static void
-add_name_entry_to_list_store (void *cls,
- const char *section)
+add_name_entry_to_list_store (void *cls, const char *section)
{
GtkListStore *ls = cls;
GtkTreeIter iter;
@@ -78,11 +77,17 @@ add_name_entry_to_list_store (void *cls,
if (NULL == section)
{
- gtk_list_store_insert_with_values (ls, &iter, G_MAXINT,
- SERVICE_MC_SERVICE_NAME, "",
- SERVICE_MC_ISUDP, FALSE,
- SERVICE_MC_VISIBLE_PORT, (guint) 80,
- SERVICE_MC_DESTINATION_ADDRESS,
"169.254.86.1:8080",
+ gtk_list_store_insert_with_values (ls,
+ &iter,
+ G_MAXINT,
+ SERVICE_MC_SERVICE_NAME,
+ "",
+ SERVICE_MC_ISUDP,
+ FALSE,
+ SERVICE_MC_VISIBLE_PORT,
+ (guint) 80,
+ SERVICE_MC_DESTINATION_ADDRESS,
+ "169.254.86.1:8080",
-1);
return;
}
@@ -95,12 +100,12 @@ add_name_entry_to_list_store (void *cls,
udp = FALSE;
do
{
- if (GNUNET_OK ==
- GNUNET_CONFIGURATION_get_value_string (cfg, section,
- (udp)
- ? "UDP_REDIRECTS"
- : "TCP_REDIRECTS",
- &cpy))
+ if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg,
+ section,
+ (udp)
+ ? "UDP_REDIRECTS"
+ :
"TCP_REDIRECTS",
+ &cpy))
{
for (redirect = strtok (cpy, " "); NULL != redirect;
redirect = strtok (NULL, " "))
@@ -108,7 +113,7 @@ add_name_entry_to_list_store (void *cls,
if (NULL == (destination = strstr (redirect, ":")))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Option `%s' is not formatted correctly!\n"),
+ _ ("Option `%s' is not formatted correctly!\n"),
redirect);
continue;
}
@@ -116,25 +121,30 @@ add_name_entry_to_list_store (void *cls,
destination++;
local_port = atoi (redirect);
- if (!((local_port > 0) && (local_port < 65536)))
+ if (! ((local_port > 0) && (local_port < 65536)))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("`%s' is not a valid port number!\n"),
+ _ ("`%s' is not a valid port number!\n"),
redirect);
continue;
}
- gtk_list_store_insert_with_values (ls, &iter, 0,
- SERVICE_MC_SERVICE_NAME, sld,
- SERVICE_MC_ISUDP, udp,
- SERVICE_MC_VISIBLE_PORT, local_port,
- SERVICE_MC_DESTINATION_ADDRESS,
destination,
+ gtk_list_store_insert_with_values (ls,
+ &iter,
+ 0,
+ SERVICE_MC_SERVICE_NAME,
+ sld,
+ SERVICE_MC_ISUDP,
+ udp,
+ SERVICE_MC_VISIBLE_PORT,
+ local_port,
+ SERVICE_MC_DESTINATION_ADDRESS,
+ destination,
-1);
}
GNUNET_free (cpy);
}
- udp = !udp;
- }
- while (udp);
+ udp = ! udp;
+ } while (udp);
GNUNET_free (sld);
}
@@ -151,12 +161,13 @@ add_name_entry_to_list_store (void *cls,
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
int
-load_hosted_service_configuration (const void *cls,
- const char *section,
- const char *option,
- const char *value,
- GObject * widget,
- const struct GNUNET_CONFIGURATION_Handle
*cfg)
+load_hosted_service_configuration (
+ const void *cls,
+ const char *section,
+ const char *option,
+ const char *value,
+ GObject *widget,
+ const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GtkTreeView *tv;
GtkListStore *ls;
@@ -201,7 +212,6 @@ struct HostedServiceInfo
* String describing all UDP redirects.
*/
char *udpred;
-
};
@@ -213,15 +223,13 @@ struct HostedServiceInfo
* @param section name of a section in the configuration
*/
static void
-collect_hosted_service_sections (void *cls,
- const char *section)
+collect_hosted_service_sections (void *cls, const char *section)
{
struct HostedServiceInfo **base = cls;
struct HostedServiceInfo *pos;
if ((8 > strlen (section)) ||
- (0 != strcmp (".gnunet.",
- section + ((strlen (section) - 8)))))
+ (0 != strcmp (".gnunet.", section + ((strlen (section) - 8)))))
return;
pos = GNUNET_new (struct HostedServiceInfo);
pos->section = GNUNET_strdup (section);
@@ -240,8 +248,7 @@ collect_hosted_service_sections (void *cls,
* @param section name of a section in the configuration
*/
static void
-remove_hosted_service_sections (void *cls,
- const char *section)
+remove_hosted_service_sections (void *cls, const char *section)
{
if ((8 > strlen (section)) ||
(0 != strcmp (".gnunet.", section + ((strlen (section) - 8)))))
@@ -257,7 +264,7 @@ remove_hosted_service_sections (void *cls,
* @param tm model to use
*/
static void
-update_hosted_service_configuration (GtkTreeModel * tm)
+update_hosted_service_configuration (GtkTreeModel *tm)
{
GtkTreeIter iter;
gchar *name;
@@ -275,11 +282,16 @@ update_hosted_service_configuration (GtkTreeModel * tm)
if (gtk_tree_model_get_iter_first (tm, &iter))
do
{
- gtk_tree_model_get (tm, &iter,
- SERVICE_MC_SERVICE_NAME, &name,
- SERVICE_MC_ISUDP, &is_udp,
- SERVICE_MC_VISIBLE_PORT, &srcport,
- SERVICE_MC_DESTINATION_ADDRESS, &targetaddress,
+ gtk_tree_model_get (tm,
+ &iter,
+ SERVICE_MC_SERVICE_NAME,
+ &name,
+ SERVICE_MC_ISUDP,
+ &is_udp,
+ SERVICE_MC_VISIBLE_PORT,
+ &srcport,
+ SERVICE_MC_DESTINATION_ADDRESS,
+ &targetaddress,
-1);
if (0 != strlen (name))
{
@@ -304,9 +316,7 @@ update_hosted_service_configuration (GtkTreeModel * tm)
"%u:%s %s",
srcport,
targetaddress,
- (is_udp)
- ? pos->udpred
- : pos->tcpred);
+ (is_udp) ? pos->udpred : pos->tcpred);
if (is_udp)
{
GNUNET_free (pos->udpred);
@@ -320,8 +330,7 @@ update_hosted_service_configuration (GtkTreeModel * tm)
}
g_free (name);
g_free (targetaddress);
- }
- while (TRUE == gtk_tree_model_iter_next (tm, &iter));
+ } while (TRUE == gtk_tree_model_iter_next (tm, &iter));
GNUNET_CONFIGURATION_iterate_sections (cfg,
&remove_hosted_service_sections,
NULL);
@@ -330,11 +339,13 @@ update_hosted_service_configuration (GtkTreeModel * tm)
pos = head;
head = pos->next;
if (strlen (pos->udpred) > 0)
- GNUNET_CONFIGURATION_set_value_string (cfg, pos->section,
+ GNUNET_CONFIGURATION_set_value_string (cfg,
+ pos->section,
"UDP_REDIRECTS",
pos->udpred);
if (strlen (pos->tcpred) > 0)
- GNUNET_CONFIGURATION_set_value_string (cfg, pos->section,
+ GNUNET_CONFIGURATION_set_value_string (cfg,
+ pos->section,
"TCP_REDIRECTS",
pos->tcpred);
GNUNET_free (pos->tcpred);
@@ -359,9 +370,9 @@ update_hosted_service_configuration (GtkTreeModel * tm)
* @param user_data NULL
*/
static void
-save_hosted_service_name (GtkCellRendererText * renderer,
- gchar * path,
- gchar * new_text,
+save_hosted_service_name (GtkCellRendererText *renderer,
+ gchar *path,
+ gchar *new_text,
gpointer user_data)
{
GtkTreeModel *tm;
@@ -369,7 +380,8 @@ save_hosted_service_name (GtkCellRendererText * renderer,
GtkTreeIter iter;
gchar *old;
- tm = GTK_TREE_MODEL (GNUNET_SETUP_get_object
("GNUNET_setup_hosted_service_liststore"));
+ tm = GTK_TREE_MODEL (
+ GNUNET_SETUP_get_object ("GNUNET_setup_hosted_service_liststore"));
if (NULL == tm)
{
GNUNET_break (0);
@@ -397,8 +409,7 @@ save_hosted_service_name (GtkCellRendererText * renderer,
return;
}
/* update model */
- gtk_list_store_set (ls, &iter,
- SERVICE_MC_SERVICE_NAME, new_text, -1);
+ gtk_list_store_set (ls, &iter, SERVICE_MC_SERVICE_NAME, new_text, -1);
/* update configuration */
update_hosted_service_configuration (tm);
if ((0 == strlen (old)) && (0 != strlen (new_text)))
@@ -421,11 +432,12 @@ save_hosted_service_name (GtkCellRendererText * renderer,
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
int
-hosted_service_name_install_edited_handler (const void *cls,
- const char *section,
- const char *option,
- GObject * widget,
- struct GNUNET_CONFIGURATION_Handle
*cfg)
+hosted_service_name_install_edited_handler (
+ const void *cls,
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct GNUNET_CONFIGURATION_Handle *cfg)
{
static int once;
GtkCellRendererText *rt;
@@ -435,9 +447,7 @@ hosted_service_name_install_edited_handler (const void *cls,
return GNUNET_SYSERR;
if (0 != once++)
return GNUNET_OK;
- g_signal_connect (rt, "edited",
- G_CALLBACK (&save_hosted_service_name),
- NULL);
+ g_signal_connect (rt, "edited", G_CALLBACK (&save_hosted_service_name),
NULL);
return GNUNET_OK;
}
@@ -455,8 +465,8 @@ hosted_service_name_install_edited_handler (const void *cls,
* @param user_data NULL
*/
static void
-save_hosted_service_is_udp (GtkCellRendererToggle * renderer,
- gchar * path,
+save_hosted_service_is_udp (GtkCellRendererToggle *renderer,
+ gchar *path,
gpointer user_data)
{
GtkTreeModel *tm;
@@ -464,7 +474,8 @@ save_hosted_service_is_udp (GtkCellRendererToggle *
renderer,
GtkTreeIter iter;
gboolean is_udp;
- tm = GTK_TREE_MODEL (GNUNET_SETUP_get_object
("GNUNET_setup_hosted_service_liststore"));
+ tm = GTK_TREE_MODEL (
+ GNUNET_SETUP_get_object ("GNUNET_setup_hosted_service_liststore"));
if (NULL == tm)
{
GNUNET_break (0);
@@ -482,12 +493,8 @@ save_hosted_service_is_udp (GtkCellRendererToggle *
renderer,
return;
}
/* update model */
- gtk_tree_model_get (tm, &iter,
- SERVICE_MC_ISUDP, &is_udp,
- -1);
- gtk_list_store_set (ls, &iter,
- SERVICE_MC_ISUDP, ! is_udp,
- -1);
+ gtk_tree_model_get (tm, &iter, SERVICE_MC_ISUDP, &is_udp, -1);
+ gtk_list_store_set (ls, &iter, SERVICE_MC_ISUDP, ! is_udp, -1);
/* update configuration */
update_hosted_service_configuration (tm);
}
@@ -504,11 +511,12 @@ save_hosted_service_is_udp (GtkCellRendererToggle *
renderer,
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
int
-hosted_service_is_udp_install_toggled_handler (const void *cls,
- const char *section,
- const char *option,
- GObject * widget,
- struct
GNUNET_CONFIGURATION_Handle *cfg)
+hosted_service_is_udp_install_toggled_handler (
+ const void *cls,
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct GNUNET_CONFIGURATION_Handle *cfg)
{
static int once;
GtkCellRendererToggle *rt;
@@ -518,7 +526,9 @@ hosted_service_is_udp_install_toggled_handler (const void
*cls,
return GNUNET_SYSERR;
if (0 != once++)
return GNUNET_OK;
- g_signal_connect (rt, "toggled", G_CALLBACK (&save_hosted_service_is_udp),
+ g_signal_connect (rt,
+ "toggled",
+ G_CALLBACK (&save_hosted_service_is_udp),
NULL);
return GNUNET_OK;
}
@@ -538,9 +548,9 @@ hosted_service_is_udp_install_toggled_handler (const void
*cls,
* @param user_data NULL
*/
static void
-save_hosted_service_visible_port (GtkCellRendererText * renderer,
- gchar * path,
- gchar * new_text,
+save_hosted_service_visible_port (GtkCellRendererText *renderer,
+ gchar *path,
+ gchar *new_text,
gpointer user_data)
{
GtkTreeModel *tm;
@@ -548,18 +558,16 @@ save_hosted_service_visible_port (GtkCellRendererText *
renderer,
GtkTreeIter iter;
int port;
- if ( (1 != sscanf (new_text,
- "%d",
- &port) ) ||
- (port < 1) ||
- (port > UINT16_MAX) )
+ if ((1 != sscanf (new_text, "%d", &port)) || (port < 1) ||
+ (port > UINT16_MAX))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Illegal value `%s' for port\n"),
+ _ ("Illegal value `%s' for port\n"),
new_text);
return;
}
- tm = GTK_TREE_MODEL (GNUNET_SETUP_get_object
("GNUNET_setup_hosted_service_liststore"));
+ tm = GTK_TREE_MODEL (
+ GNUNET_SETUP_get_object ("GNUNET_setup_hosted_service_liststore"));
if (NULL == tm)
{
GNUNET_break (0);
@@ -577,9 +585,7 @@ save_hosted_service_visible_port (GtkCellRendererText *
renderer,
return;
}
/* update model */
- gtk_list_store_set (ls, &iter,
- SERVICE_MC_VISIBLE_PORT, port,
- -1);
+ gtk_list_store_set (ls, &iter, SERVICE_MC_VISIBLE_PORT, port, -1);
/* update configuration */
update_hosted_service_configuration (tm);
}
@@ -596,11 +602,12 @@ save_hosted_service_visible_port (GtkCellRendererText *
renderer,
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
int
-hosted_service_visible_port_install_edited_handler (const void *cls,
- const char *section,
- const char *option,
- GObject * widget,
- struct
GNUNET_CONFIGURATION_Handle *cfg)
+hosted_service_visible_port_install_edited_handler (
+ const void *cls,
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct GNUNET_CONFIGURATION_Handle *cfg)
{
static int once;
GtkCellRendererText *rt;
@@ -610,7 +617,9 @@ hosted_service_visible_port_install_edited_handler (const
void *cls,
return GNUNET_SYSERR;
if (0 != once++)
return GNUNET_OK;
- g_signal_connect (rt, "edited", G_CALLBACK
(&save_hosted_service_visible_port),
+ g_signal_connect (rt,
+ "edited",
+ G_CALLBACK (&save_hosted_service_visible_port),
NULL);
return GNUNET_OK;
}
@@ -630,8 +639,9 @@ hosted_service_visible_port_install_edited_handler (const
void *cls,
* @param user_data NULL
*/
static void
-save_hosted_service_destination (GtkCellRendererText * renderer,
- gchar * path, gchar * new_text,
+save_hosted_service_destination (GtkCellRendererText *renderer,
+ gchar *path,
+ gchar *new_text,
gpointer user_data)
{
GtkTreeModel *tm;
@@ -640,27 +650,26 @@ save_hosted_service_destination (GtkCellRendererText *
renderer,
struct sockaddr_in v4;
struct sockaddr_in6 v6;
- if ( ('[' != new_text[0]) &&
- (GNUNET_OK !=
- GNUNET_STRINGS_to_address_ipv4 (new_text, strlen (new_text),
- &v4)) )
+ if (('[' != new_text[0]) &&
+ (GNUNET_OK !=
+ GNUNET_STRINGS_to_address_ipv4 (new_text, strlen (new_text), &v4)))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Illegal IPv4 destination address `%s'\n"),
+ _ ("Illegal IPv4 destination address `%s'\n"),
new_text);
return;
}
- if ( ('[' == new_text[0]) &&
- (GNUNET_OK !=
- GNUNET_STRINGS_to_address_ipv6 (new_text, strlen (new_text),
- &v6)) )
+ if (('[' == new_text[0]) &&
+ (GNUNET_OK !=
+ GNUNET_STRINGS_to_address_ipv6 (new_text, strlen (new_text), &v6)))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Illegal IPv6 destination address `%s'\n"),
+ _ ("Illegal IPv6 destination address `%s'\n"),
new_text);
return;
}
- tm = GTK_TREE_MODEL (GNUNET_SETUP_get_object
("GNUNET_setup_hosted_service_liststore"));
+ tm = GTK_TREE_MODEL (
+ GNUNET_SETUP_get_object ("GNUNET_setup_hosted_service_liststore"));
if (NULL == tm)
{
GNUNET_break (0);
@@ -678,9 +687,7 @@ save_hosted_service_destination (GtkCellRendererText *
renderer,
return;
}
/* update model */
- gtk_list_store_set (ls, &iter,
- SERVICE_MC_DESTINATION_ADDRESS, new_text,
- -1);
+ gtk_list_store_set (ls, &iter, SERVICE_MC_DESTINATION_ADDRESS, new_text, -1);
/* update configuration */
update_hosted_service_configuration (tm);
}
@@ -697,11 +704,12 @@ save_hosted_service_destination (GtkCellRendererText *
renderer,
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
int
-hosted_service_destination_install_edited_handler (const void *cls,
- const char *section,
- const char *option,
- GObject * widget,
- struct
GNUNET_CONFIGURATION_Handle *cfg)
+hosted_service_destination_install_edited_handler (
+ const void *cls,
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct GNUNET_CONFIGURATION_Handle *cfg)
{
static int once;
GtkCellRendererText *rt;
@@ -711,8 +719,10 @@ hosted_service_destination_install_edited_handler (const
void *cls,
return GNUNET_SYSERR;
if (0 != once++)
return GNUNET_OK;
- g_signal_connect (rt, "edited",
- G_CALLBACK (&save_hosted_service_destination), NULL);
+ g_signal_connect (rt,
+ "edited",
+ G_CALLBACK (&save_hosted_service_destination),
+ NULL);
return GNUNET_OK;
}
diff --git a/src/setup/gnunet-setup-exit-services.h
b/src/setup/gnunet-setup-exit-services.h
index 063e05da..b98ab37e 100644
--- a/src/setup/gnunet-setup-exit-services.h
+++ b/src/setup/gnunet-setup-exit-services.h
@@ -31,8 +31,6 @@
#include <gdk/gdkkeysyms.h>
-
-
/**
* Initialize the GtkListModel with the hosted service specification.
*
@@ -45,12 +43,13 @@
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
int
-load_hosted_service_configuration (const void *cls,
- const char *section,
- const char *option,
- const char *value,
- GObject * widget,
- const struct GNUNET_CONFIGURATION_Handle
*cfg);
+load_hosted_service_configuration (
+ const void *cls,
+ const char *section,
+ const char *option,
+ const char *value,
+ GObject *widget,
+ const struct GNUNET_CONFIGURATION_Handle *cfg);
/**
@@ -64,11 +63,12 @@ load_hosted_service_configuration (const void *cls,
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
int
-hosted_service_name_install_edited_handler (const void *cls,
- const char *section,
- const char *option,
- GObject * widget,
- struct GNUNET_CONFIGURATION_Handle
*cfg);
+hosted_service_name_install_edited_handler (
+ const void *cls,
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct GNUNET_CONFIGURATION_Handle *cfg);
/**
@@ -82,11 +82,12 @@ hosted_service_name_install_edited_handler (const void *cls,
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
int
-hosted_service_is_udp_install_toggled_handler (const void *cls,
- const char *section,
- const char *option,
- GObject * widget,
- struct
GNUNET_CONFIGURATION_Handle *cfg);
+hosted_service_is_udp_install_toggled_handler (
+ const void *cls,
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct GNUNET_CONFIGURATION_Handle *cfg);
/**
@@ -100,12 +101,12 @@ hosted_service_is_udp_install_toggled_handler (const void
*cls,
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
int
-hosted_service_visible_port_install_edited_handler (const void *cls,
- const char *section,
- const char *option,
- GObject * widget,
- struct
GNUNET_CONFIGURATION_Handle *cfg);
-
+hosted_service_visible_port_install_edited_handler (
+ const void *cls,
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct GNUNET_CONFIGURATION_Handle *cfg);
/**
@@ -119,11 +120,12 @@ hosted_service_visible_port_install_edited_handler (const
void *cls,
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
int
-hosted_service_destination_install_edited_handler (const void *cls,
- const char *section,
- const char *option,
- GObject * widget,
- struct
GNUNET_CONFIGURATION_Handle *cfg);
+hosted_service_destination_install_edited_handler (
+ const void *cls,
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct GNUNET_CONFIGURATION_Handle *cfg);
#endif
diff --git a/src/setup/gnunet-setup-hostlist-editing.c
b/src/setup/gnunet-setup-hostlist-editing.c
index 9ca8eb11..f2a90742 100644
--- a/src/setup/gnunet-setup-hostlist-editing.c
+++ b/src/setup/gnunet-setup-hostlist-editing.c
@@ -36,18 +36,19 @@
* @param user_data not used
*/
void
-GNUNET_setup_hostlist_url_cellrenderertext_edited_cb (GtkCellRendererText
*renderer,
- gchar * path,
- gchar * new_text,
- gpointer user_data)
+GNUNET_setup_hostlist_url_cellrenderertext_edited_cb (
+ GtkCellRendererText *renderer,
+ gchar *path,
+ gchar *new_text,
+ gpointer user_data)
{
GtkListStore *ls;
GtkTreeIter old;
GtkTreeIter iter;
gchar *oldtext;
- ls = GTK_LIST_STORE (GNUNET_SETUP_get_object
- ("GNUNET_setup_hostlist_url_liststore"));
+ ls = GTK_LIST_STORE (
+ GNUNET_SETUP_get_object ("GNUNET_setup_hostlist_url_liststore"));
if (NULL == ls)
{
GNUNET_break (0);
@@ -58,22 +59,30 @@ GNUNET_setup_hostlist_url_cellrenderertext_edited_cb
(GtkCellRendererText *rende
GNUNET_break (0);
return;
}
- gtk_tree_model_get (GTK_TREE_MODEL (ls), &old,
- GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, &oldtext,
+ gtk_tree_model_get (GTK_TREE_MODEL (ls),
+ &old,
+ GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL,
+ &oldtext,
-1);
if (0 == strlen (oldtext))
{
gtk_list_store_insert_before (ls, &iter, &old);
- gtk_list_store_set (ls, &iter,
- GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, new_text,
- GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE, FALSE,
+ gtk_list_store_set (ls,
+ &iter,
+ GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL,
+ new_text,
+ GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE,
+ FALSE,
-1);
}
else
{
- gtk_list_store_set (ls, &old,
- GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, new_text,
- GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE, FALSE,
+ gtk_list_store_set (ls,
+ &old,
+ GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL,
+ new_text,
+ GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE,
+ FALSE,
-1);
}
g_free (oldtext);
diff --git a/src/setup/gnunet-setup-hostlist-server.c
b/src/setup/gnunet-setup-hostlist-server.c
index 0a9523e1..b812676d 100644
--- a/src/setup/gnunet-setup-hostlist-server.c
+++ b/src/setup/gnunet-setup-hostlist-server.c
@@ -41,8 +41,7 @@
* @param result GNUNET_YES if the hostlist daemon has an integrated hostlist
* server, GNUNET_NO otherwise
*/
-typedef void (*TestHostlistDaemonCallback) (void *cls,
- int result);
+typedef void (*TestHostlistDaemonCallback) (void *cls, int result);
/**
@@ -69,15 +68,13 @@ struct CommandContext
* GNUNET_YES if the target argument was found, GNUNET_NO otherwise.
*/
int found;
-
};
static void
-set_checkbutton_status (void *cls,
- int result)
+set_checkbutton_status (void *cls, int result)
{
- GtkWidget * widget = cls;
+ GtkWidget *widget = cls;
GtkToggleButton *button;
if (GNUNET_YES != result)
@@ -97,10 +94,9 @@ set_checkbutton_status (void *cls,
static void
-set_spinbutton_status (void *cls,
- int result)
+set_spinbutton_status (void *cls, int result)
{
- GtkWidget * widget = cls;
+ GtkWidget *widget = cls;
if (GNUNET_YES != result)
gtk_widget_set_sensitive (widget, FALSE);
@@ -152,8 +148,7 @@ process_hostlist_daemon_output (void *cls, const char *line)
* @param cls closure for the callback
*/
static void
-test_hostlist_daemon (TestHostlistDaemonCallback callback,
- void *cls)
+test_hostlist_daemon (TestHostlistDaemonCallback callback, void *cls)
{
struct CommandContext *ctx;
char *binary;
@@ -174,15 +169,15 @@ test_hostlist_daemon (TestHostlistDaemonCallback callback,
if (NULL == ctx->cmd)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Could not determine whether the hostlist daemon has"
- " an integrated hostlist server!\n"));
+ _ ("Could not determine whether the hostlist daemon has"
+ " an integrated hostlist server!\n"));
GNUNET_free (ctx);
}
}
void
-GNUNET_setup_hostlist_offer_hostlist_checkbutton_realize_cb (GtkWidget *
widget,
+GNUNET_setup_hostlist_offer_hostlist_checkbutton_realize_cb (GtkWidget *widget,
gpointer
user_data)
{
test_hostlist_daemon (&set_checkbutton_status, widget);
@@ -190,7 +185,7 @@ GNUNET_setup_hostlist_offer_hostlist_checkbutton_realize_cb
(GtkWidget * widget,
void
-GNUNET_setup_hostlist_advertise_checkbutton_realize_cb (GtkWidget * widget,
+GNUNET_setup_hostlist_advertise_checkbutton_realize_cb (GtkWidget *widget,
gpointer user_data)
{
test_hostlist_daemon (&set_checkbutton_status, widget);
@@ -198,7 +193,7 @@ GNUNET_setup_hostlist_advertise_checkbutton_realize_cb
(GtkWidget * widget,
void
-GNUNET_setup_hostlist_server_port_spin_button_realize_cb (GtkWidget * widget,
+GNUNET_setup_hostlist_server_port_spin_button_realize_cb (GtkWidget *widget,
gpointer user_data)
{
test_hostlist_daemon (&set_spinbutton_status, widget);
diff --git a/src/setup/gnunet-setup-namestore-config.c
b/src/setup/gnunet-setup-namestore-config.c
index e3c277bb..f539127b 100644
--- a/src/setup/gnunet-setup-namestore-config.c
+++ b/src/setup/gnunet-setup-namestore-config.c
@@ -69,7 +69,7 @@ GNUNET_setup_namestore_postgres_invalidate_cb ()
void
-GNUNET_setup_namestore_postgres_tab_test_button_clicked_cb (GtkWidget * widget,
+GNUNET_setup_namestore_postgres_tab_test_button_clicked_cb (GtkWidget *widget,
gpointer user_data)
{
if (GNUNET_OK == test_config ("libgnunet_plugin_namestore_postgres"))
diff --git a/src/setup/gnunet-setup-namestore-plugins.c
b/src/setup/gnunet-setup-namestore-plugins.c
index e9c5d31a..fdb7832e 100644
--- a/src/setup/gnunet-setup-namestore-plugins.c
+++ b/src/setup/gnunet-setup-namestore-plugins.c
@@ -33,7 +33,7 @@
* @param name name of the plugin to check
*/
static void
-test_plugin (GtkWidget * widget, const char *name)
+test_plugin (GtkWidget *widget, const char *name)
{
if (GNUNET_YES == GNUNET_PLUGIN_test (name))
{
@@ -48,20 +48,19 @@ test_plugin (GtkWidget * widget, const char *name)
void
-GNUNET_setup_namestore_sqlite_radiobutton_realize_cb (GtkWidget * widget,
- gpointer user_data)
+GNUNET_setup_namestore_sqlite_radiobutton_realize_cb (GtkWidget *widget,
+ gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_namestore_sqlite");
}
void
-GNUNET_setup_namestore_postgres_radiobutton_realize_cb (GtkWidget * widget,
- gpointer user_data)
+GNUNET_setup_namestore_postgres_radiobutton_realize_cb (GtkWidget *widget,
+ gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_namestore_postgres");
}
-
/* end of gnunet-setup-namestore-plugins.c */
diff --git a/src/setup/gnunet-setup-options.c b/src/setup/gnunet-setup-options.c
index b0e64142..bd8944b4 100644
--- a/src/setup/gnunet-setup-options.c
+++ b/src/setup/gnunet-setup-options.c
@@ -63,7 +63,6 @@ struct PortSpecification
* Name of the transport/daemon which owns this port.
*/
const char *owner_name;
-
};
@@ -80,10 +79,10 @@ struct PortSpecification
*/
static int
load_yes_no (const void *cls,
- const char *section,
- const char *option,
+ const char *section,
+ const char *option,
const char *value,
- GObject * widget,
+ GObject *widget,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GtkToggleButton *button;
@@ -92,8 +91,8 @@ load_yes_no (const void *cls,
if (NULL == button)
return GNUNET_SYSERR;
gtk_toggle_button_set_active (button,
- (0 ==
- strcasecmp (value, "YES")) ? TRUE : FALSE);
+ (0 == strcasecmp (value, "YES")) ? TRUE
+ : FALSE);
return GNUNET_OK;
}
@@ -110,10 +109,10 @@ load_yes_no (const void *cls,
*/
static int
save_yes_no (const void *cls,
- const char *section,
- const char *option,
- GObject * widget,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct GNUNET_CONFIGURATION_Handle *cfg)
{
GtkToggleButton *button;
gboolean mode;
@@ -122,7 +121,9 @@ save_yes_no (const void *cls,
if (button == NULL)
return GNUNET_SYSERR;
mode = gtk_toggle_button_get_active (button);
- GNUNET_CONFIGURATION_set_value_string (cfg, section, option,
+ GNUNET_CONFIGURATION_set_value_string (cfg,
+ section,
+ option,
mode == TRUE ? "YES" : "NO");
return GNUNET_OK;
}
@@ -141,10 +142,10 @@ save_yes_no (const void *cls,
*/
static int
load_filename (const void *cls,
- const char *section,
- const char *option,
+ const char *section,
+ const char *option,
const char *value,
- GObject * widget,
+ GObject *widget,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GtkFileChooser *chooser;
@@ -171,7 +172,7 @@ static int
save_filename (const void *cls,
const char *section,
const char *option,
- GObject * widget,
+ GObject *widget,
struct GNUNET_CONFIGURATION_Handle *cfg)
{
GtkFileChooser *chooser;
@@ -202,10 +203,10 @@ save_filename (const void *cls,
*/
static int
load_text (const void *cls,
- const char *section,
- const char *option,
+ const char *section,
+ const char *option,
const char *value,
- GObject * widget,
+ GObject *widget,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GtkEntry *entry;
@@ -230,10 +231,10 @@ load_text (const void *cls,
*/
static int
save_text (const void *cls,
- const char *section,
- const char *option,
- GObject * widget,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct GNUNET_CONFIGURATION_Handle *cfg)
{
GtkEntry *entry;
const gchar *txt;
@@ -321,10 +322,10 @@ save_combo_text (const void *cls,
*/
static int
load_number (const void *cls,
- const char *section,
- const char *option,
+ const char *section,
+ const char *option,
const char *value,
- GObject * widget,
+ GObject *widget,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
GtkSpinButton *spin;
@@ -352,19 +353,21 @@ load_number (const void *cls,
*/
static int
save_number (const void *cls,
- const char *section,
- const char *option,
- GObject * widget,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct GNUNET_CONFIGURATION_Handle *cfg)
{
GtkSpinButton *spin;
spin = GTK_SPIN_BUTTON (widget);
if (spin == NULL)
return GNUNET_SYSERR;
- GNUNET_CONFIGURATION_set_value_number (cfg, section, option,
- gtk_spin_button_get_value_as_int
- (spin));
+ GNUNET_CONFIGURATION_set_value_number (cfg,
+ section,
+ option,
+ gtk_spin_button_get_value_as_int (
+ spin));
return GNUNET_OK;
}
@@ -373,25 +376,28 @@ save_number (const void *cls,
* NULL-terminated list of port specifications, which should be checked
* for collisions.
*/
-static struct PortSpecification port_specifications[] = {
- {
- "GNUNET_setup_hostlist_server_port_spin_button",
- "GNUNET_setup_hostlist_offer_hostlist_checkbutton",
- gettext_noop ("the hostlist server"),},
- {
- "GNUNET_setup_transport_tcp_port_spinbutton",
- "GNUNET_setup_transport_tcp_checkbutton",
- gettext_noop ("the TCP transport plugin"),},
- {
- "GNUNET_setup_transport_http_port_spinbutton",
- "GNUNET_setup_transport_http_server_checkbutton",
- gettext_noop ("the HTTP transport plugin"),},
- {
- "GNUNET_setup_transport_https_port_spinbutton",
- "GNUNET_setup_transport_https_server_checkbutton",
- gettext_noop ("the HTTPS transport plugin"),},
- {NULL, NULL}
-};
+static struct PortSpecification port_specifications[] =
+ {{
+ "GNUNET_setup_hostlist_server_port_spin_button",
+ "GNUNET_setup_hostlist_offer_hostlist_checkbutton",
+ gettext_noop ("the hostlist server"),
+ },
+ {
+ "GNUNET_setup_transport_tcp_port_spinbutton",
+ "GNUNET_setup_transport_tcp_checkbutton",
+ gettext_noop ("the TCP transport plugin"),
+ },
+ {
+ "GNUNET_setup_transport_http_port_spinbutton",
+ "GNUNET_setup_transport_http_server_checkbutton",
+ gettext_noop ("the HTTP transport plugin"),
+ },
+ {
+ "GNUNET_setup_transport_https_port_spinbutton",
+ "GNUNET_setup_transport_https_server_checkbutton",
+ gettext_noop ("the HTTPS transport plugin"),
+ },
+ {NULL, NULL}};
/**
@@ -410,15 +416,15 @@ get_port_spinbutton (unsigned int i)
GtkSpinButton *spinbt;
gboolean mode;
- if ( (NULL == port_specifications[i].spinbutton_name) ||
- (NULL == port_specifications[i].checkbutton_name) )
+ if ((NULL == port_specifications[i].spinbutton_name) ||
+ (NULL == port_specifications[i].checkbutton_name))
return NULL;
cb_name = port_specifications[i].checkbutton_name;
widget = GTK_WIDGET (GNUNET_SETUP_get_object (cb_name));
if (widget == NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Widget `%s' not found\n"),
+ _ ("Widget `%s' not found\n"),
cb_name);
return NULL;
}
@@ -426,7 +432,7 @@ get_port_spinbutton (unsigned int i)
if (checkbt == NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Specified widget `%s' is not a checkbutton\n"),
+ _ ("Specified widget `%s' is not a checkbutton\n"),
cb_name);
return NULL;
}
@@ -439,7 +445,7 @@ get_port_spinbutton (unsigned int i)
if (widget == NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Widget `%s' not found\n"),
+ _ ("Widget `%s' not found\n"),
sb_name);
return NULL;
}
@@ -447,7 +453,7 @@ get_port_spinbutton (unsigned int i)
if (spinbt == NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Specified widget `%s' is not a spinbutton\n"),
+ _ ("Specified widget `%s' is not a spinbutton\n"),
sb_name);
return NULL;
}
@@ -462,8 +468,7 @@ get_port_spinbutton (unsigned int i)
* @param widget widget whose state was changed (unused)
*/
static void
-highlight_port_collisions (const void *cls,
- GObject *widget)
+highlight_port_collisions (const void *cls, GObject *widget)
{
static GtkCssProvider *conflict_provider;
unsigned int i;
@@ -478,25 +483,23 @@ highlight_port_collisions (const void *cls,
{
conflict_provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (conflict_provider,
- ".conflict {\n color: rgba(255, 0.0, 0.0,
255);\n}",
- -1,
- NULL);
- for (i = 0;
- NULL != port_specifications[i].spinbutton_name;
- i++)
+ gtk_css_provider_load_from_data (
+ conflict_provider,
+ ".conflict {\n color: rgba(255, 0.0, 0.0, 255);\n}",
+ -1,
+ NULL);
+ for (i = 0; NULL != port_specifications[i].spinbutton_name; i++)
{
spinbt_i = get_port_spinbutton (i);
if (NULL == spinbt_i)
- continue;
- gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET
(spinbt_i)),
- GTK_STYLE_PROVIDER (conflict_provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ continue;
+ gtk_style_context_add_provider (gtk_widget_get_style_context (
+ GTK_WIDGET (spinbt_i)),
+ GTK_STYLE_PROVIDER (conflict_provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
}
- for (i = 0;
- NULL != port_specifications[i].spinbutton_name;
- i++)
+ for (i = 0; NULL != port_specifications[i].spinbutton_name; i++)
{
spinbt_i = get_port_spinbutton (i);
if (NULL == spinbt_i)
@@ -504,12 +507,10 @@ highlight_port_collisions (const void *cls,
port = gtk_spin_button_get_value_as_int (spinbt_i);
found = GNUNET_NO;
- for (j = 0;
- NULL != port_specifications[j].spinbutton_name;
- j++)
+ for (j = 0; NULL != port_specifications[j].spinbutton_name; j++)
{
if (i == j)
- continue;
+ continue;
spinbt_j = get_port_spinbutton (j);
if (NULL == spinbt_j)
continue;
@@ -521,21 +522,21 @@ highlight_port_collisions (const void *cls,
}
if (GNUNET_YES == found)
{
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET
(spinbt_i)),
- "conflict");
+ gtk_style_context_add_class (gtk_widget_get_style_context (
+ GTK_WIDGET (spinbt_i)),
+ "conflict");
GNUNET_asprintf (&tooltip,
- _("This port is already occupied by %s."),
- port_specifications[j].owner_name);
- gtk_widget_set_tooltip_text (GTK_WIDGET (spinbt_i),
- tooltip);
+ _ ("This port is already occupied by %s."),
+ port_specifications[j].owner_name);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (spinbt_i), tooltip);
GNUNET_free (tooltip);
}
else
{
- gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET
(spinbt_i)),
- "conflict");
- gtk_widget_set_tooltip_text (GTK_WIDGET (spinbt_i),
- "");
+ gtk_style_context_remove_class (gtk_widget_get_style_context (
+ GTK_WIDGET (spinbt_i)),
+ "conflict");
+ gtk_widget_set_tooltip_text (GTK_WIDGET (spinbt_i), "");
}
}
}
@@ -548,8 +549,7 @@ highlight_port_collisions (const void *cls,
* @param widget widget whose state was changed
*/
static void
-validate_v4_policy (const void *cls,
- GObject *widget)
+validate_v4_policy (const void *cls, GObject *widget)
{
static GtkCssProvider *invalid_syntax_provider;
GtkEntry *entry;
@@ -561,40 +561,41 @@ validate_v4_policy (const void *cls,
entry = GTK_ENTRY (widget);
text = gtk_entry_get_text (entry);
r = GNUNET_TUN_ipv4policy2regex (text);
- invalid = ( (strlen (text) > 0) &&
- ( (NULL == r) ||
- (text[strlen(text)-1] != ';') ) );
+ invalid =
+ ((strlen (text) > 0) && ((NULL == r) || (text[strlen (text) - 1] != ';')));
if (invalid)
{
if (NULL == invalid_syntax_provider)
{
invalid_syntax_provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (invalid_syntax_provider,
- ".syntax_error {\n color: rgba(255, 0.0,
0.0, 255);\n}",
- -1,
- NULL);
- gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET
(entry)),
- GTK_STYLE_PROVIDER
(invalid_syntax_provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ gtk_css_provider_load_from_data (
+ invalid_syntax_provider,
+ ".syntax_error {\n color: rgba(255, 0.0, 0.0, 255);\n}",
+ -1,
+ NULL);
+ gtk_style_context_add_provider (gtk_widget_get_style_context (
+ GTK_WIDGET (entry)),
+ GTK_STYLE_PROVIDER (
+ invalid_syntax_provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET
(entry)),
- "syntax_error");
- GNUNET_asprintf (&tooltip,
- _("Invalid policy."));
- gtk_widget_set_tooltip_text (GTK_WIDGET (widget),
- tooltip);
+ gtk_style_context_add_class (gtk_widget_get_style_context (
+ GTK_WIDGET (entry)),
+ "syntax_error");
+ GNUNET_asprintf (&tooltip, _ ("Invalid policy."));
+ gtk_widget_set_tooltip_text (GTK_WIDGET (widget), tooltip);
GNUNET_free (tooltip);
}
else
{
if (NULL != invalid_syntax_provider)
{
- gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET
(entry)),
- "syntax_error");
+ gtk_style_context_remove_class (gtk_widget_get_style_context (
+ GTK_WIDGET (entry)),
+ "syntax_error");
}
- gtk_widget_set_tooltip_text (GTK_WIDGET (widget),
- "");
+ gtk_widget_set_tooltip_text (GTK_WIDGET (widget), "");
}
GNUNET_free_non_null (r);
}
@@ -607,8 +608,7 @@ validate_v4_policy (const void *cls,
* @param widget widget whose state was changed
*/
static void
-validate_v6_policy (const void *cls,
- GObject *widget)
+validate_v6_policy (const void *cls, GObject *widget)
{
static GtkCssProvider *invalid_syntax_provider;
GtkEntry *entry;
@@ -620,39 +620,40 @@ validate_v6_policy (const void *cls,
entry = GTK_ENTRY (widget);
text = gtk_entry_get_text (entry);
r = GNUNET_TUN_ipv6policy2regex (text);
- invalid = ( (strlen (text) > 0) &&
- ( (NULL == r) ||
- (text[strlen(text)-1] != ';') ) );
+ invalid =
+ ((strlen (text) > 0) && ((NULL == r) || (text[strlen (text) - 1] != ';')));
if (invalid)
{
if (NULL == invalid_syntax_provider)
{
invalid_syntax_provider = gtk_css_provider_new ();
- gtk_css_provider_load_from_data (invalid_syntax_provider,
- ".syntax_error {\n color: rgba(255, 0.0,
0.0, 255);\n}",
- -1,
- NULL);
- gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET
(entry)),
- GTK_STYLE_PROVIDER
(invalid_syntax_provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+ gtk_css_provider_load_from_data (
+ invalid_syntax_provider,
+ ".syntax_error {\n color: rgba(255, 0.0, 0.0, 255);\n}",
+ -1,
+ NULL);
+ gtk_style_context_add_provider (gtk_widget_get_style_context (
+ GTK_WIDGET (entry)),
+ GTK_STYLE_PROVIDER (
+ invalid_syntax_provider),
+ GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
- gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET
(entry)),
- "syntax_error");
- GNUNET_asprintf (&tooltip,
- _("Invalid policy."));
- gtk_widget_set_tooltip_text (GTK_WIDGET (widget),
- tooltip);
+ gtk_style_context_add_class (gtk_widget_get_style_context (
+ GTK_WIDGET (entry)),
+ "syntax_error");
+ GNUNET_asprintf (&tooltip, _ ("Invalid policy."));
+ gtk_widget_set_tooltip_text (GTK_WIDGET (widget), tooltip);
GNUNET_free (tooltip);
}
else
{
if (NULL != invalid_syntax_provider)
{
- gtk_style_context_remove_class (gtk_widget_get_style_context (GTK_WIDGET
(entry)),
- "syntax_error");
+ gtk_style_context_remove_class (gtk_widget_get_style_context (
+ GTK_WIDGET (entry)),
+ "syntax_error");
}
- gtk_widget_set_tooltip_text (GTK_WIDGET (widget),
- "");
+ gtk_widget_set_tooltip_text (GTK_WIDGET (widget), "");
}
GNUNET_free_non_null (r);
}
@@ -672,10 +673,10 @@ validate_v6_policy (const void *cls,
*/
static int
load_option_list (const void *cls,
- const char *section,
- const char *option,
+ const char *section,
+ const char *option,
const char *value,
- GObject * widget,
+ GObject *widget,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
const char *word = cls;
@@ -717,10 +718,10 @@ load_option_list (const void *cls,
*/
static int
save_option_list (const void *cls,
- const char *section,
- const char *option,
- GObject * widget,
- struct GNUNET_CONFIGURATION_Handle *cfg)
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct GNUNET_CONFIGURATION_Handle *cfg)
{
const char *word = cls;
GtkToggleButton *button;
@@ -749,8 +750,8 @@ save_option_list (const void *cls,
* @return TRUE to stop other handlers from being invoked
*/
gboolean
-GNUNET_setup_treeview_key_press_event_cb (GtkTreeView * tv,
- GdkEventKey * event,
+GNUNET_setup_treeview_key_press_event_cb (GtkTreeView *tv,
+ GdkEventKey *event,
gpointer user_data)
{
GtkListStore *ls;
@@ -765,7 +766,7 @@ GNUNET_setup_treeview_key_press_event_cb (GtkTreeView * tv,
#else
(event->keyval != GDK_KEY_Delete)
#endif
- )
+ )
return FALSE;
ls = GTK_LIST_STORE (gtk_tree_view_get_model (tv));
if (ls == NULL)
@@ -776,11 +777,13 @@ GNUNET_setup_treeview_key_press_event_cb (GtkTreeView *
tv,
sel = gtk_tree_view_get_selection (tv);
if (TRUE != gtk_tree_selection_get_selected (sel, &tm, &iter))
return FALSE;
- gtk_tree_model_get (tm, &iter,
- GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE, &editable,
+ gtk_tree_model_get (tm,
+ &iter,
+ GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE,
+ &editable,
-1);
if (TRUE == editable)
- return FALSE; /* likely currently editing... */
+ return FALSE; /* likely currently editing... */
gtk_list_store_remove (ls, &iter);
if (TRUE == gtk_tree_model_get_iter_first (tm, &iter))
gtk_tree_selection_select_iter (sel, &iter);
@@ -801,10 +804,10 @@ GNUNET_setup_treeview_key_press_event_cb (GtkTreeView *
tv,
*/
static int
load_string_list_store (const void *cls,
- const char *section,
+ const char *section,
const char *option,
- const char *value,
- GObject * widget,
+ const char *value,
+ GObject *widget,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
char *t;
@@ -818,17 +821,19 @@ load_string_list_store (const void *cls,
t = GNUNET_strdup (value);
for (w = strtok (t, " "); w != NULL; w = strtok (NULL, " "))
gtk_list_store_insert_with_values (ls,
- &iter,
- G_MAXINT,
- GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, w,
+ &iter,
+ G_MAXINT,
+ GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL,
+ w,
GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE,
FALSE,
-1);
GNUNET_free (t);
gtk_list_store_insert_with_values (ls,
- &iter,
- G_MAXINT,
- GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, "",
+ &iter,
+ G_MAXINT,
+ GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL,
+ "",
GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE,
TRUE,
-1);
@@ -849,9 +854,9 @@ load_string_list_store (const void *cls,
*/
static int
save_string_list_store (const void *cls,
- const char *section,
+ const char *section,
const char *option,
- GObject * widget,
+ GObject *widget,
struct GNUNET_CONFIGURATION_Handle *cfg)
{
GtkTreeModel *tm;
@@ -868,24 +873,26 @@ save_string_list_store (const void *cls,
{
do
{
- gtk_tree_model_get (tm, &iter,
- GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL, &val, -1);
+ gtk_tree_model_get (tm,
+ &iter,
+ GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL,
+ &val,
+ -1);
if (0 < strlen (val))
{
- if (value == NULL)
- {
- value = GNUNET_strdup (val);
- }
- else
- {
- GNUNET_asprintf (&n, "%s %s", value, val);
- GNUNET_free (value);
- value = n;
- }
+ if (value == NULL)
+ {
+ value = GNUNET_strdup (val);
+ }
+ else
+ {
+ GNUNET_asprintf (&n, "%s %s", value, val);
+ GNUNET_free (value);
+ value = n;
+ }
}
g_free (val);
- }
- while (TRUE == gtk_tree_model_iter_next (tm, &iter));
+ } while (TRUE == gtk_tree_model_iter_next (tm, &iter));
}
if (value == NULL)
value = GNUNET_strdup ("");
@@ -898,295 +905,262 @@ save_string_list_store (const void *cls,
/**
* Hide "min connected friends" option if in F2F-only mode.
*/
-static struct GNUNET_SETUP_VisibilitySpecification
hide_min_connected_friends[] = {
- {"GNUNET_setup_minimum_friends_label", NULL, REX_YES },
- {"GNUNET_setup_minimum_friends_spinbutton", NULL, REX_YES },
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification
+ hide_min_connected_friends[] =
+ {{"GNUNET_setup_minimum_friends_label", NULL, REX_YES},
+ {"GNUNET_setup_minimum_friends_spinbutton", NULL, REX_YES},
+ {NULL, NULL, NULL}};
/**
* Hide "hostlist" options if hostlist is not in use.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_hostlist_tab[] = {
- {"GNUNET_setup_hostlist_vbox", "YES", NULL},
- {"GNUNET_setup_hostlist_label", "YES", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_hostlist_tab[] =
+ {{"GNUNET_setup_hostlist_vbox", "YES", NULL},
+ {"GNUNET_setup_hostlist_label", "YES", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "exit" options if VPN exit is not in use.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_exit_options[] = {
- {"GNUNET_setup_exit_label", "YES", NULL},
- {"GNUNET_setup_exit_vbox", "YES", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_exit_options[] =
+ {{"GNUNET_setup_exit_label", "YES", NULL},
+ {"GNUNET_setup_exit_vbox", "YES", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide DNS "exit" options if DNS exit is not in use.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_dns_exit_options[] = {
- {"GNUNET_setup_dns_resolver_hbox", "YES", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_dns_exit_options[] =
+ {{"GNUNET_setup_dns_resolver_hbox", "YES", NULL}, {NULL, NULL, NULL}};
/**
* Hide IPv4 "exit" options if IPv4 exit is not in use.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_v4_exit_options[] = {
- {"GNUNET_SETUP_exit_policy_v4_hbox", "YES", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_v4_exit_options[] =
+ {{"GNUNET_SETUP_exit_policy_v4_hbox", "YES", NULL}, {NULL, NULL, NULL}};
/**
* Hide IPv6 "exit" options if IPv6 exit is not in use.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_v6_exit_options[] = {
- {"GNUNET_SETUP_exit_policy_v6_hbox", "YES", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_v6_exit_options[] =
+ {{"GNUNET_SETUP_exit_policy_v6_hbox", "YES", NULL}, {NULL, NULL, NULL}};
/**
* Hide "hostlist" server options if hostlist server is not in use.
*/
static struct GNUNET_SETUP_VisibilitySpecification
- hide_hostlist_server_options[] = {
- {"GNUNET_setup_hostlist_advertise_checkbutton", "(^| )-p($| )", NULL},
- {"GNUNET_setup_hostlist_port_label", "(^| )-p($| )", NULL},
- {"GNUNET_setup_hostlist_server_port_spin_button", "(^| )-p($| )", NULL},
- {NULL, NULL, NULL}
-};
+ hide_hostlist_server_options[] =
+ {{"GNUNET_setup_hostlist_advertise_checkbutton", "(^| )-p($| )", NULL},
+ {"GNUNET_setup_hostlist_port_label", "(^| )-p($| )", NULL},
+ {"GNUNET_setup_hostlist_server_port_spin_button", "(^| )-p($| )", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "hostlist" proxy options if proxy is not in use.
*/
static struct GNUNET_SETUP_VisibilitySpecification
- hide_hostlist_proxy_options[] = {
- {"GNUNET_setup_hostlist_proxy_hostname_hbox", NULL, "NONE"},
- {"GNUNET_setup_hostlist_proxy_username_hbox", NULL, "NONE"},
- {"GNUNET_setup_hostlist_proxy_password_hbox", NULL, "NONE"},
- {NULL, NULL, NULL}
-};
+ hide_hostlist_proxy_options[] =
+ {{"GNUNET_setup_hostlist_proxy_hostname_hbox", NULL, "NONE"},
+ {"GNUNET_setup_hostlist_proxy_username_hbox", NULL, "NONE"},
+ {"GNUNET_setup_hostlist_proxy_password_hbox", NULL, "NONE"},
+ {NULL, NULL, NULL}};
/**
* Hide "http-client" proxy options if proxy is not in use.
*/
-static struct GNUNET_SETUP_VisibilitySpecification
- hide_http_proxy_options[] = {
- {"GNUNET_setup_transport_http_client_proxy_hostname_hbox", NULL, "NONE"},
- {"GNUNET_setup_transport_http_client_proxy_username_hbox", NULL, "NONE"},
- {"GNUNET_setup_transport_http_client_proxy_password_hbox", NULL, "NONE"},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_http_proxy_options[] =
+ {{"GNUNET_setup_transport_http_client_proxy_hostname_hbox", NULL, "NONE"},
+ {"GNUNET_setup_transport_http_client_proxy_username_hbox", NULL, "NONE"},
+ {"GNUNET_setup_transport_http_client_proxy_password_hbox", NULL, "NONE"},
+ {NULL, NULL, NULL}};
/**
* Hide "https-client" proxy options if proxy is not in use.
*/
-static struct GNUNET_SETUP_VisibilitySpecification
- hide_https_proxy_options[] = {
- {"GNUNET_setup_transport_https_client_proxy_hostname_hbox", NULL, "NONE"},
- {"GNUNET_setup_transport_https_client_proxy_username_hbox", NULL, "NONE"},
- {"GNUNET_setup_transport_https_client_proxy_password_hbox", NULL, "NONE"},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_https_proxy_options[] =
+ {{"GNUNET_setup_transport_https_client_proxy_hostname_hbox", NULL, "NONE"},
+ {"GNUNET_setup_transport_https_client_proxy_username_hbox", NULL, "NONE"},
+ {"GNUNET_setup_transport_https_client_proxy_password_hbox", NULL, "NONE"},
+ {NULL, NULL, NULL}};
/**
* Hide "fs" tab if FS not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_fs_tab[] = {
- {"GNUNET_setup_fs_main_vbox", "YES", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_fs_tab[] =
+ {{"GNUNET_setup_fs_main_vbox", "YES", NULL}, {NULL, NULL, NULL}};
/**
* Hide "vpn" tab and "pt" checkbutton if VPN is not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_vpn_options[] = {
- {"GNUNET_setup_general_services_pt_checkbutton", "YES", NULL},
- {"GNUNET_setup_vpn_vbox", "YES", NULL},
- {"GNUNET_setup_vpn_label", "YES", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_vpn_options[] =
+ {{"GNUNET_setup_general_services_pt_checkbutton", "YES", NULL},
+ {"GNUNET_setup_vpn_vbox", "YES", NULL},
+ {"GNUNET_setup_vpn_label", "YES", NULL},
+ {NULL, NULL, NULL}};
/**
* Hides "vpn" option if PT is active (so that it cannot be disabled),
* and shows PT-specific options.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_pt_options[] = {
- {"GNUNET_setup_pt_frame", "YES", NULL},
- {"GNUNET_setup_general_services_vpn_checkbutton", "NO", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_pt_options[] =
+ {{"GNUNET_setup_pt_frame", "YES", NULL},
+ {"GNUNET_setup_general_services_vpn_checkbutton", "NO", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "namestore" tab if GNS not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_gns_tabs[] = {
- {"GNUNET_setup_namestore_vbox", "YES", NULL},
- {"GNUNET_setup_namestore_label", "YES", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_gns_tabs[] =
+ {{"GNUNET_setup_namestore_vbox", "YES", NULL},
+ {"GNUNET_setup_namestore_label", "YES", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "tcp" tab if TCP not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_tcp_tab[] = {
- {"GNUNET_setup_transport_tcp_vbox", "(^| )tcp($| )", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_tcp_tab[] =
+ {{"GNUNET_setup_transport_tcp_vbox", "(^| )tcp($| )", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "udp" tab if UDP not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_udp_tab[] = {
- {"GNUNET_setup_transport_udp_vbox", "(^| )udp($| )", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_udp_tab[] =
+ {{"GNUNET_setup_transport_udp_vbox", "(^| )udp($| )", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "http-client" tab if HTTP client not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_http_client_tab[] = {
- {"GNUNET_setup_transport_http_client_vbox", "(^| )http_client($| )", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_http_client_tab[] =
+ {{"GNUNET_setup_transport_http_client_vbox", "(^| )http_client($| )", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "http server" tab if HTTP server not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_http_server_tab[] = {
- {"GNUNET_setup_transport_http_server_vbox", "(^| )http_server($| )", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_http_server_tab[] =
+ {{"GNUNET_setup_transport_http_server_vbox", "(^| )http_server($| )", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "https-client" tab if HTTPS client not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_https_client_tab[] = {
- {"GNUNET_setup_transport_https_client_vbox", "(^| )https_client($| )", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_https_client_tab[] =
+ {{"GNUNET_setup_transport_https_client_vbox", "(^| )https_client($| )",
NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "https server" tab if HTTPS server not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_https_server_tab[] = {
- {"GNUNET_setup_transport_https_server_vbox", "(^| )https_server($| )", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_https_server_tab[] =
+ {{"GNUNET_setup_transport_https_server_vbox", "(^| )https_server($| )",
NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "dv" tab if DV not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_dv_tab[] = {
- {"GNUNET_setup_transport_dv_vbox", "(^| )dv($| )", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_dv_tab[] =
+ {{"GNUNET_setup_transport_dv_vbox", "(^| )dv($| )", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "wlan" tab if WLAN not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_wlan_tab[] = {
- {"GNUNET_setup_transport_wlan_vbox", "(^| )wlan($| )", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_wlan_tab[] =
+ {{"GNUNET_setup_transport_wlan_vbox", "(^| )wlan($| )", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "sqlite datastore" tab if sqlite not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_sqlite_datastore_tab[]
= {
- {"GNUNET_setup_fs_datastore_sqlite_label", "^sqlite$", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_sqlite_datastore_tab[]
=
+ {{"GNUNET_setup_fs_datastore_sqlite_label", "^sqlite$", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "mysql datastore" tab if mysql not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_mysql_datastore_tab[]
= {
- {"GNUNET_setup_datastore_mysql_vbox", "^mysql$", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_mysql_datastore_tab[] =
+ {{"GNUNET_setup_datastore_mysql_vbox", "^mysql$", NULL}, {NULL, NULL, NULL}};
/**
* Hide "postgres datastore" tab if postgres not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification
hide_postgres_datastore_tab[] = {
- {"GNUNET_setup_datastore_postgres_config_hbox", "^postgres$", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification
+ hide_postgres_datastore_tab[] =
+ {{"GNUNET_setup_datastore_postgres_config_hbox", "^postgres$", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "sqlite datacache" tab if sqlite not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_sqlite_datacache_tab[]
= {
- {"GNUNET_setup_fs_datacache_sqlite_body_label", "^sqlite$", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_sqlite_datacache_tab[]
=
+ {{"GNUNET_setup_fs_datacache_sqlite_body_label", "^sqlite$", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "heap datacache" tab if heap not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_heap_datacache_tab[] =
{
- {"GNUNET_setup_datacache_heap_vbox", "^heap$", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_heap_datacache_tab[] =
+ {{"GNUNET_setup_datacache_heap_vbox", "^heap$", NULL}, {NULL, NULL, NULL}};
/**
* Hide "postgres datacache" tab if postgres not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification
hide_postgres_datacache_tab[] = {
- {"GNUNET_setup_datacache_postgres_hbox", "^postgres$", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification
+ hide_postgres_datacache_tab[] = {{"GNUNET_setup_datacache_postgres_hbox",
+ "^postgres$",
+ NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "sqlite namestore" tab if sqlite not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_sqlite_namestore_tab[]
= {
- {"GNUNET_setup_namestore_sqlite_label", "^sqlite$", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_sqlite_namestore_tab[]
=
+ {{"GNUNET_setup_namestore_sqlite_label", "^sqlite$", NULL},
+ {NULL, NULL, NULL}};
/**
* Hide "postgres datastore" tab if postgres not active.
*/
-static struct GNUNET_SETUP_VisibilitySpecification
hide_postgres_namestore_tab[] = {
- {"GNUNET_setup_namestore_postgres_hbox", "^postgres$", NULL},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification
+ hide_postgres_namestore_tab[] = {{"GNUNET_setup_namestore_postgres_hbox",
+ "^postgres$",
+ NULL},
+ {NULL, NULL, NULL}};
/**
* Hide advertised TCP port if port is zero.
*/
-static struct GNUNET_SETUP_VisibilitySpecification hide_all_tcp_options[] = {
- {"GNUNET_setup_transport_tcp_adv_port_hbox", NULL, "^0$"},
- {NULL, NULL, NULL}
-};
+static struct GNUNET_SETUP_VisibilitySpecification hide_all_tcp_options[] =
+ {{"GNUNET_setup_transport_tcp_adv_port_hbox", NULL, "^0$"},
+ {NULL, NULL, NULL}};
/**
@@ -1196,1328 +1170,1412 @@ const struct GNUNET_SETUP_OptionSpecification
option_specifications[] = {
/* GENERAL TAB */
- {
- "GNUNET_setup_friends_only_checkbutton",
+ {"GNUNET_setup_friends_only_checkbutton",
"toggled",
"topology",
"FRIENDS-ONLY",
gettext_noop ("Should GNUnet exclusively connect to friends?"),
"https://old.gnunet.org/configuration-f2f",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
hide_min_connected_friends},
- {
- "GNUNET_setup_minimum_friends_spinbutton",
+ {"GNUNET_setup_minimum_friends_spinbutton",
"value-changed",
"topology",
"MINIMUM-FRIENDS",
gettext_noop ("Minimum number of friendly connections"),
"https://old.gnunet.org/configuration-f2f",
&load_number,
- &save_number, NULL,
- NULL, NULL,
+ &save_number,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_general_services_topology_checkbutton",
+ {"GNUNET_setup_general_services_topology_checkbutton",
"toggled",
"topology",
"FORCESTART",
gettext_noop ("Topology should always be loaded"),
"https://old.gnunet.org/configuration-topology",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_general_services_hostlist_checkbutton",
+ {"GNUNET_setup_general_services_hostlist_checkbutton",
"toggled",
"hostlist",
"FORCESTART",
- gettext_noop
- ("Should hostlist support be started automatically on startup?"),
+ gettext_noop (
+ "Should hostlist support be started automatically on startup?"),
"https://old.gnunet.org/configuration-hostlist",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
hide_hostlist_tab},
- {
- "GNUNET_setup_general_services_fs_checkbutton",
+ {"GNUNET_setup_general_services_fs_checkbutton",
"toggled",
"fs",
"FORCESTART",
gettext_noop ("Should file-sharing be started automatically on startup?"),
"https://old.gnunet.org/configuration-fs",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
hide_fs_tab},
- {
- "GNUNET_setup_hostlist_client_enable_checkbutton",
+ {"GNUNET_setup_hostlist_client_enable_checkbutton",
"toggled",
"hostlist",
"OPTIONS",
gettext_noop ("Should GNUnet learn about other peers using hostlists"),
"https://old.gnunet.org/configuration-hostlist",
&load_option_list,
- &save_option_list, "-b",
- NULL, NULL,
+ &save_option_list,
+ "-b",
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_hostlist_client_learn_checkbutton",
+ {"GNUNET_setup_hostlist_client_learn_checkbutton",
"toggled",
"hostlist",
"OPTIONS",
gettext_noop ("Should GNUnet learn hostlists from other peers"),
"https://old.gnunet.org/configuration-hostlist",
&load_option_list,
- &save_option_list, "-e",
- NULL, NULL,
+ &save_option_list,
+ "-e",
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_hostlist_offer_hostlist_checkbutton",
+ {"GNUNET_setup_hostlist_offer_hostlist_checkbutton",
"toggled",
"hostlist",
"OPTIONS",
gettext_noop ("Should this peer offer a hostlist to other peers"),
"https://old.gnunet.org/configuring-hostlist-bootstrap",
&load_option_list,
- &save_option_list, "-p",
- &highlight_port_collisions, NULL,
+ &save_option_list,
+ "-p",
+ &highlight_port_collisions,
+ NULL,
hide_hostlist_server_options},
- {
- "GNUNET_setup_hostlist_advertise_checkbutton",
+ {"GNUNET_setup_hostlist_advertise_checkbutton",
"toggled",
"hostlist",
"OPTIONS",
gettext_noop ("Should this peer advertise its hostlist to other peers"),
"https://old.gnunet.org/configuring-hostlist-bootstrap",
&load_option_list,
- &save_option_list, "-a",
- NULL, NULL,
+ &save_option_list,
+ "-a",
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_hostlist_server_port_spin_button",
+ {"GNUNET_setup_hostlist_server_port_spin_button",
"value-changed",
"hostlist",
"HTTPPORT",
gettext_noop ("Port this peers hostlist should be offered on"),
"https://old.gnunet.org/configuring-hostlist-bootstrap",
&load_number,
- &save_number, NULL,
- &highlight_port_collisions, NULL,
+ &save_number,
+ NULL,
+ &highlight_port_collisions,
+ NULL,
NULL},
- {
- "GNUNET_setup_hostlist_url_liststore",
+ {"GNUNET_setup_hostlist_url_liststore",
"row-changed",
"hostlist",
"SERVERS",
- NULL, NULL,
+ NULL,
+ NULL,
&load_string_list_store,
- &save_string_list_store, NULL,
- NULL, NULL,
+ &save_string_list_store,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_hostlist_url_liststore",
+ {"GNUNET_setup_hostlist_url_liststore",
"row-deleted",
"hostlist",
"SERVERS",
- NULL, NULL,
NULL,
- &save_string_list_store, NULL,
- NULL, NULL,
+ NULL,
+ NULL,
+ &save_string_list_store,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_hostlist_url_treeview",
- NULL, NULL, NULL, /* FIXME */
+ {"GNUNET_setup_hostlist_url_treeview",
+ NULL,
+ NULL,
+ NULL, /* FIXME */
gettext_noop ("Known hostlist URLs"),
"https://old.gnunet.org/configuration-hostlist",
- NULL, NULL, NULL, /* FIXME */
- NULL, NULL,
+ NULL,
+ NULL,
+ NULL, /* FIXME */
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_hostlist_proxy_type_none_radiobutton",
+ {"GNUNET_setup_hostlist_proxy_type_none_radiobutton",
"toggled",
"hostlist",
"PROXY_TYPE",
gettext_noop ("Do not use a proxy to download hostlists"),
"https://old.gnunet.org/configuration-hostlist-proxy",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "NONE",
- NULL, NULL,
- hide_hostlist_proxy_options
- },
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "NONE",
+ NULL,
+ NULL,
+ hide_hostlist_proxy_options},
- {
- "GNUNET_setup_hostlist_proxy_type_http_radiobutton",
+ {"GNUNET_setup_hostlist_proxy_type_http_radiobutton",
"toggled",
"hostlist",
"PROXY_TYPE",
gettext_noop ("Use an HTTP proxy"),
"https://old.gnunet.org/configuration-hostlist-proxy",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "HTTP",
- NULL, NULL,
- hide_hostlist_proxy_options
- },
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "HTTP",
+ NULL,
+ NULL,
+ hide_hostlist_proxy_options},
- {
- "GNUNET_setup_hostlist_proxy_type_http_10_radiobutton",
+ {"GNUNET_setup_hostlist_proxy_type_http_10_radiobutton",
"toggled",
"hostlist",
"PROXY_TYPE",
gettext_noop ("Use an HTTP v1.0 (only) proxy"),
"https://old.gnunet.org/configuration-hostlist-proxy",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "HTTP_1_0",
- NULL, NULL,
- hide_hostlist_proxy_options
- },
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "HTTP_1_0",
+ NULL,
+ NULL,
+ hide_hostlist_proxy_options},
- {
- "GNUNET_setup_hostlist_proxy_type_socks4_radiobutton",
+ {"GNUNET_setup_hostlist_proxy_type_socks4_radiobutton",
"toggled",
"hostlist",
"PROXY_TYPE",
gettext_noop ("Use a SOCKS v4 proxy"),
"https://old.gnunet.org/configuration-hostlist-proxy",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "SOCKS4",
- NULL, NULL,
- hide_hostlist_proxy_options
- },
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "SOCKS4",
+ NULL,
+ NULL,
+ hide_hostlist_proxy_options},
- {
- "GNUNET_setup_hostlist_proxy_type_socks4a_radiobutton",
+ {"GNUNET_setup_hostlist_proxy_type_socks4a_radiobutton",
"toggled",
"hostlist",
"PROXY_TYPE",
gettext_noop ("Use a SOCKS v4a proxy"),
"https://old.gnunet.org/configuration-hostlist-proxy",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "SOCKS4a",
- NULL, NULL,
- hide_hostlist_proxy_options
- },
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "SOCKS4a",
+ NULL,
+ NULL,
+ hide_hostlist_proxy_options},
- {
- "GNUNET_setup_hostlist_proxy_type_socks5_radiobutton",
+ {"GNUNET_setup_hostlist_proxy_type_socks5_radiobutton",
"toggled",
"hostlist",
"PROXY_TYPE",
gettext_noop ("Use a SOCKS v5 proxy"),
"https://old.gnunet.org/configuration-hostlist-proxy",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "SOCKS5",
- NULL, NULL,
- hide_hostlist_proxy_options
- },
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "SOCKS5",
+ NULL,
+ NULL,
+ hide_hostlist_proxy_options},
- {
- "GNUNET_setup_hostlist_proxy_type_socks5_hostname_radiobutton",
+ {"GNUNET_setup_hostlist_proxy_type_socks5_hostname_radiobutton",
"toggled",
"hostlist",
"PROXY_TYPE",
gettext_noop ("Use a SOCKS v5 proxy with hostname"),
"https://old.gnunet.org/configuration-hostlist-proxy",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "SOCKS5_HOSTNAME",
- NULL, NULL,
- hide_hostlist_proxy_options
- },
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "SOCKS5_HOSTNAME",
+ NULL,
+ NULL,
+ hide_hostlist_proxy_options},
- {
- "GNUNET_setup_hostlist_proxy_hostname_entry",
+ {"GNUNET_setup_hostlist_proxy_hostname_entry",
"changed",
"hostlist",
"PROXY",
gettext_noop ("Specify hostname or IP (and optionally) port of the proxy"),
"https://old.gnunet.org/configuration-hostlist-proxy",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_hostlist_proxy_username_entry",
+ {"GNUNET_setup_hostlist_proxy_username_entry",
"changed",
"hostlist",
"PROXY_USERNAME",
gettext_noop ("Specify username for the proxy (if needed)"),
"https://old.gnunet.org/configuration-hostlist-proxy",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_hostlist_proxy_password_entry",
+ {"GNUNET_setup_hostlist_proxy_password_entry",
"changed",
"hostlist",
"PROXY_PASSWORD",
gettext_noop ("Specify password for the proxy (if needed)"),
"https://old.gnunet.org/configuration-hostlist-proxy",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_bandwidth_out_spinbutton",
+ {"GNUNET_setup_bandwidth_out_spinbutton",
"value-changed",
"ats",
"WAN_QUOTA_OUT",
gettext_noop ("How many bytes per second are we allowed to transmit?"),
"https://old.gnunet.org/configuration-bandwidth",
&load_number,
- &save_number, NULL,
- NULL, NULL,
+ &save_number,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_bandwidth_in_spinbutton",
+ {"GNUNET_setup_bandwidth_in_spinbutton",
"value-changed",
"ats",
"WAN_QUOTA_IN",
gettext_noop ("How many bytes per second are we allowed to receive?"),
"https://old.gnunet.org/configuration-bandwidth",
&load_number,
- &save_number, NULL,
- NULL, NULL,
+ &save_number,
+ NULL,
+ NULL,
+ NULL,
NULL},
/* Transport TAB */
- {
- "GNUNET_setup_transport_tcp_checkbutton",
+ {"GNUNET_setup_transport_tcp_checkbutton",
"toggled",
"transport",
"PLUGINS",
gettext_noop ("Enable communication via TCP"),
"https://old.gnunet.org/configuration-tcp",
&load_option_list,
- &save_option_list, "tcp",
- &highlight_port_collisions, NULL,
+ &save_option_list,
+ "tcp",
+ &highlight_port_collisions,
+ NULL,
hide_tcp_tab},
- {
- "GNUNET_setup_transport_udp_checkbutton",
+ {"GNUNET_setup_transport_udp_checkbutton",
"toggled",
"transport",
"PLUGINS",
gettext_noop ("Enable communication via UDP"),
"https://old.gnunet.org/configuration-udp",
&load_option_list,
- &save_option_list, "udp",
- NULL, NULL,
+ &save_option_list,
+ "udp",
+ NULL,
+ NULL,
hide_udp_tab},
- {
- "GNUNET_setup_transport_http_server_checkbutton",
+ {"GNUNET_setup_transport_http_server_checkbutton",
"toggled",
"transport",
"PLUGINS",
gettext_noop ("Enable communication via HTTP as a server"),
"https://old.gnunet.org/configuration-http",
&load_option_list,
- &save_option_list, "http_server",
- &highlight_port_collisions, NULL,
+ &save_option_list,
+ "http_server",
+ &highlight_port_collisions,
+ NULL,
hide_http_server_tab},
- {
- "GNUNET_setup_transport_http_client_checkbutton",
+ {"GNUNET_setup_transport_http_client_checkbutton",
"toggled",
"transport",
"PLUGINS",
gettext_noop ("Enable communication via HTTP as a client"),
"https://old.gnunet.org/configuration-http",
&load_option_list,
- &save_option_list, "http_client",
- &highlight_port_collisions, NULL,
+ &save_option_list,
+ "http_client",
+ &highlight_port_collisions,
+ NULL,
hide_http_client_tab},
- {
- "GNUNET_setup_transport_https_server_checkbutton",
+ {"GNUNET_setup_transport_https_server_checkbutton",
"toggled",
"transport",
"PLUGINS",
gettext_noop ("Enable communication via HTTPS as a server"),
"https://old.gnunet.org/configuration-https",
&load_option_list,
- &save_option_list, "https_server",
- &highlight_port_collisions, NULL,
+ &save_option_list,
+ "https_server",
+ &highlight_port_collisions,
+ NULL,
hide_https_server_tab},
- {
- "GNUNET_setup_transport_https_client_checkbutton",
+ {"GNUNET_setup_transport_https_client_checkbutton",
"toggled",
"transport",
"PLUGINS",
gettext_noop ("Enable communication via HTTPS as a client"),
"https://old.gnunet.org/configuration-https",
&load_option_list,
- &save_option_list, "https_client",
- &highlight_port_collisions, NULL,
+ &save_option_list,
+ "https_client",
+ &highlight_port_collisions,
+ NULL,
hide_https_client_tab},
- {
- "GNUNET_setup_transport_dv_checkbutton",
+ {"GNUNET_setup_transport_dv_checkbutton",
"toggled",
"transport",
"PLUGINS",
gettext_noop ("Enable communication via DV"),
"https://old.gnunet.org/configuration-dv",
&load_option_list,
- &save_option_list, "dv",
- NULL, NULL,
+ &save_option_list,
+ "dv",
+ NULL,
+ NULL,
hide_dv_tab},
- {
- "GNUNET_setup_transport_wlan_checkbutton",
+ {"GNUNET_setup_transport_wlan_checkbutton",
"toggled",
"transport",
"PLUGINS",
gettext_noop ("Enable communication via WLAN"),
"https://old.gnunet.org/configuration-wlan",
&load_option_list,
- &save_option_list, "wlan",
- NULL, NULL,
+ &save_option_list,
+ "wlan",
+ NULL,
+ NULL,
hide_wlan_tab},
- {
- "GNUNET_setup_transport_tcp_port_spinbutton",
+ {"GNUNET_setup_transport_tcp_port_spinbutton",
"value-changed",
"transport-tcp",
"PORT",
gettext_noop ("Port we bind to for TCP"),
"https://old.gnunet.org/configuration-tcp",
&load_number,
- &save_number, NULL,
- &highlight_port_collisions, NULL,
+ &save_number,
+ NULL,
+ &highlight_port_collisions,
+ NULL,
hide_all_tcp_options},
- {
- "GNUNET_setup_transport_tcp_adv_port_spinbutton",
+ {"GNUNET_setup_transport_tcp_adv_port_spinbutton",
"value-changed",
"transport-tcp",
"ADVERTISED_PORT",
gettext_noop ("Port visible to other peers"),
"https://old.gnunet.org/configuration-tcp",
&load_number,
- &save_number, NULL,
- NULL, NULL,
+ &save_number,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_transport_udp_port_spinbutton",
+ {"GNUNET_setup_transport_udp_port_spinbutton",
"value-changed",
"transport-udp",
"PORT",
gettext_noop ("Port for inbound UDP packets, use 0 if behind NAT"),
"https://old.gnunet.org/configuration-udp",
&load_number,
- &save_number, NULL,
- NULL, NULL,
+ &save_number,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_transport_udp_advertised_port_spinbutton",
+ {"GNUNET_setup_transport_udp_advertised_port_spinbutton",
"value-changed",
"transport-udp",
"ADVERTISED_PORT",
gettext_noop ("Port visible to other peers"),
"https://old.gnunet.org/configuration-udp",
&load_number,
- &save_number, NULL,
- NULL, NULL,
+ &save_number,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_transport_http_port_spinbutton",
+ {"GNUNET_setup_transport_http_port_spinbutton",
"value-changed",
"transport-http_server",
"PORT",
gettext_noop ("Port for inbound HTTP connections, use 0 if behind NAT"),
"https://old.gnunet.org/configuration-http",
&load_number,
- &save_number, NULL,
- &highlight_port_collisions, NULL,
+ &save_number,
+ NULL,
+ &highlight_port_collisions,
+ NULL,
NULL},
- {
- "GNUNET_setup_transport_http_advertised_port_spinbutton",
+ {"GNUNET_setup_transport_http_advertised_port_spinbutton",
"value-changed",
"transport-http_server",
"ADVERTISED_PORT",
gettext_noop ("Port visible to other peers"),
"https://old.gnunet.org/configuration-http",
&load_number,
- &save_number, NULL,
- NULL, NULL,
+ &save_number,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_transport_https_port_spinbutton",
+ {"GNUNET_setup_transport_https_port_spinbutton",
"value-changed",
"transport-https_server",
"PORT",
gettext_noop ("Port for inbound HTTPS connections, use 0 if behind NAT"),
"https://old.gnunet.org/configuration-https",
&load_number,
- &save_number, NULL,
- &highlight_port_collisions, NULL,
+ &save_number,
+ NULL,
+ &highlight_port_collisions,
+ NULL,
NULL},
- {
- "GNUNET_setup_transport_https_advertised_port_spinbutton",
+ {"GNUNET_setup_transport_https_advertised_port_spinbutton",
"value-changed",
"transport-https_server",
"ADVERTISED_PORT",
gettext_noop ("Port visible to other peers"),
"https://old.gnunet.org/configuration-https",
&load_number,
- &save_number, NULL,
- NULL, NULL,
+ &save_number,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_transport_http_client_proxy_type_none_radiobutton",
- "toggled",
- "transport-http_client",
- "PROXY_TYPE",
- gettext_noop ("Do not use a proxy with the HTTP plugin"),
- "https://old.gnunet.org/configuration-http",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "NONE",
- NULL, NULL,
- hide_http_proxy_options
- },
-
- {
- "GNUNET_setup_transport_http_client_proxy_type_http_radiobutton",
- "toggled",
- "transport-http_client",
- "PROXY_TYPE",
- gettext_noop ("Use an HTTP proxy"),
- "https://old.gnunet.org/configuration-http",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "HTTP",
- NULL, NULL,
- hide_http_proxy_options
- },
-
- {
- "GNUNET_setup_transport_http_client_proxy_type_socks4_radiobutton",
- "toggled",
- "transport-http_client",
- "PROXY_TYPE",
- gettext_noop ("Use a SOCKS v4 proxy"),
- "https://old.gnunet.org/configuration-http",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "SOCKS4",
- NULL, NULL,
- hide_http_proxy_options
- },
-
- {
- "GNUNET_setup_transport_http_client_proxy_type_socks4a_radiobutton",
- "toggled",
- "transport-http_client",
- "PROXY_TYPE",
- gettext_noop ("Use a SOCKS v4a proxy"),
- "https://old.gnunet.org/configuration-http",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "SOCKS4a",
- NULL, NULL,
- hide_http_proxy_options
- },
-
- {
- "GNUNET_setup_transport_http_client_proxy_type_socks5_radiobutton",
- "toggled",
- "transport-http_client",
- "PROXY_TYPE",
- gettext_noop ("Use a SOCKS v5 proxy"),
- "https://old.gnunet.org/configuration-http",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "SOCKS5",
- NULL, NULL,
- hide_http_proxy_options
- },
-
- {
- "GNUNET_setup_transport_http_client_proxy_type_socks5_hostname_radiobutton",
- "toggled",
- "transport-http_client",
- "PROXY_TYPE",
- gettext_noop ("Use a SOCKS v5 proxy with hostname"),
- "https://old.gnunet.org/configuration-http",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "SOCKS5_HOSTNAME",
- NULL, NULL,
- hide_http_proxy_options
- },
-
- {
- "GNUNET_setup_transport_http_client_proxy_hostname_entry",
- "changed",
- "transport-http_client",
- "PROXY",
- gettext_noop ("Specify hostname or IP (and optionally) port of the proxy"),
- "https://old.gnunet.org/configuration-http",
- &load_text,
- &save_text, NULL,
- NULL, NULL,
- NULL},
-
- {
- "GNUNET_setup_transport_http_client_proxy_username_entry",
- "changed",
- "transport-http_client",
- "PROXY_USERNAME",
- gettext_noop ("Specify username for the proxy (if needed)"),
- "https://old.gnunet.org/configuration-http",
- &load_text,
- &save_text, NULL,
- NULL, NULL,
- NULL},
-
- {
- "GNUNET_setup_transport_http_client_proxy_password_entry",
- "changed",
- "transport-http_client",
- "PROXY_PASSWORD",
- gettext_noop ("Specify password for the proxy (if needed)"),
- "https://old.gnunet.org/configuration-http",
- &load_text,
- &save_text, NULL,
- NULL, NULL,
- NULL},
+ {"GNUNET_setup_transport_http_client_proxy_type_none_radiobutton",
+ "toggled",
+ "transport-http_client",
+ "PROXY_TYPE",
+ gettext_noop ("Do not use a proxy with the HTTP plugin"),
+ "https://old.gnunet.org/configuration-http",
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "NONE",
+ NULL,
+ NULL,
+ hide_http_proxy_options},
+
+ {"GNUNET_setup_transport_http_client_proxy_type_http_radiobutton",
+ "toggled",
+ "transport-http_client",
+ "PROXY_TYPE",
+ gettext_noop ("Use an HTTP proxy"),
+ "https://old.gnunet.org/configuration-http",
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "HTTP",
+ NULL,
+ NULL,
+ hide_http_proxy_options},
+ {"GNUNET_setup_transport_http_client_proxy_type_socks4_radiobutton",
+ "toggled",
+ "transport-http_client",
+ "PROXY_TYPE",
+ gettext_noop ("Use a SOCKS v4 proxy"),
+ "https://old.gnunet.org/configuration-http",
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "SOCKS4",
+ NULL,
+ NULL,
+ hide_http_proxy_options},
+
+ {"GNUNET_setup_transport_http_client_proxy_type_socks4a_radiobutton",
+ "toggled",
+ "transport-http_client",
+ "PROXY_TYPE",
+ gettext_noop ("Use a SOCKS v4a proxy"),
+ "https://old.gnunet.org/configuration-http",
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "SOCKS4a",
+ NULL,
+ NULL,
+ hide_http_proxy_options},
+
+ {"GNUNET_setup_transport_http_client_proxy_type_socks5_radiobutton",
+ "toggled",
+ "transport-http_client",
+ "PROXY_TYPE",
+ gettext_noop ("Use a SOCKS v5 proxy"),
+ "https://old.gnunet.org/configuration-http",
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "SOCKS5",
+ NULL,
+ NULL,
+ hide_http_proxy_options},
+
+ {"GNUNET_setup_transport_http_client_proxy_type_socks5_hostname_radiobutton",
+ "toggled",
+ "transport-http_client",
+ "PROXY_TYPE",
+ gettext_noop ("Use a SOCKS v5 proxy with hostname"),
+ "https://old.gnunet.org/configuration-http",
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "SOCKS5_HOSTNAME",
+ NULL,
+ NULL,
+ hide_http_proxy_options},
+
+ {"GNUNET_setup_transport_http_client_proxy_hostname_entry",
+ "changed",
+ "transport-http_client",
+ "PROXY",
+ gettext_noop ("Specify hostname or IP (and optionally) port of the proxy"),
+ "https://old.gnunet.org/configuration-http",
+ &load_text,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
+ NULL},
+
+ {"GNUNET_setup_transport_http_client_proxy_username_entry",
+ "changed",
+ "transport-http_client",
+ "PROXY_USERNAME",
+ gettext_noop ("Specify username for the proxy (if needed)"),
+ "https://old.gnunet.org/configuration-http",
+ &load_text,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
+ NULL},
+
+ {"GNUNET_setup_transport_http_client_proxy_password_entry",
+ "changed",
+ "transport-http_client",
+ "PROXY_PASSWORD",
+ gettext_noop ("Specify password for the proxy (if needed)"),
+ "https://old.gnunet.org/configuration-http",
+ &load_text,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
+ NULL},
/* HTTPS client */
- {
- "GNUNET_setup_transport_https_client_proxy_type_none_radiobutton",
+ {"GNUNET_setup_transport_https_client_proxy_type_none_radiobutton",
"toggled",
"transport-https_client",
"PROXY_TYPE",
gettext_noop ("Do not use a proxy for HTTPS plugin"),
"https://old.gnunet.org/configuration-http",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "NONE",
- NULL, NULL,
- hide_https_proxy_options
- },
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "NONE",
+ NULL,
+ NULL,
+ hide_https_proxy_options},
- {
- "GNUNET_setup_transport_https_client_proxy_type_http_radiobutton",
+ {"GNUNET_setup_transport_https_client_proxy_type_http_radiobutton",
"toggled",
"transport-https_client",
"PROXY_TYPE",
gettext_noop ("Use an HTTP proxy"),
"https://old.gnunet.org/configuration-http",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "HTTP",
- NULL, NULL,
- hide_https_proxy_options
- },
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "HTTP",
+ NULL,
+ NULL,
+ hide_https_proxy_options},
- {
- "GNUNET_setup_transport_https_client_proxy_type_socks4_radiobutton",
+ {"GNUNET_setup_transport_https_client_proxy_type_socks4_radiobutton",
"toggled",
"transport-https_client",
"PROXY_TYPE",
gettext_noop ("Use a SOCKS v4 proxy"),
"https://old.gnunet.org/configuration-http",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "SOCKS4",
- NULL, NULL,
- hide_https_proxy_options
- },
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "SOCKS4",
+ NULL,
+ NULL,
+ hide_https_proxy_options},
- {
- "GNUNET_setup_transport_https_client_proxy_type_socks4a_radiobutton",
+ {"GNUNET_setup_transport_https_client_proxy_type_socks4a_radiobutton",
"toggled",
"transport-https_client",
"PROXY_TYPE",
gettext_noop ("Use a SOCKS v4a proxy"),
"https://old.gnunet.org/configuration-http",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "SOCKS4a",
- NULL, NULL,
- hide_https_proxy_options
- },
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "SOCKS4a",
+ NULL,
+ NULL,
+ hide_https_proxy_options},
- {
- "GNUNET_setup_transport_https_client_proxy_type_socks5_radiobutton",
+ {"GNUNET_setup_transport_https_client_proxy_type_socks5_radiobutton",
"toggled",
"transport-https_client",
"PROXY_TYPE",
gettext_noop ("Use a SOCKS v5 proxy"),
"https://old.gnunet.org/configuration-http",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "SOCKS5",
- NULL, NULL,
- hide_https_proxy_options
- },
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "SOCKS5",
+ NULL,
+ NULL,
+ hide_https_proxy_options},
- {
-
"GNUNET_setup_transport_https_client_proxy_type_socks5_hostname_radiobutton",
+
{"GNUNET_setup_transport_https_client_proxy_type_socks5_hostname_radiobutton",
"toggled",
"transport-https_client",
"PROXY_TYPE",
gettext_noop ("Use a SOCKS v5 proxy with hostname"),
"https://old.gnunet.org/configuration-http",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "SOCKS5_HOSTNAME",
- NULL, NULL,
- hide_https_proxy_options
- },
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "SOCKS5_HOSTNAME",
+ NULL,
+ NULL,
+ hide_https_proxy_options},
- {
- "GNUNET_setup_transport_https_client_proxy_hostname_entry",
+ {"GNUNET_setup_transport_https_client_proxy_hostname_entry",
"changed",
"transport-https_client",
"PROXY",
gettext_noop ("Specify hostname or IP (and optionally) port of the proxy"),
"https://old.gnunet.org/configuration-http",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_transport_https_client_proxy_username_entry",
+ {"GNUNET_setup_transport_https_client_proxy_username_entry",
"changed",
"transport-https_client",
"PROXY_USERNAME",
gettext_noop ("Specify username for the proxy (if needed)"),
"https://old.gnunet.org/configuration-http",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_transport_https_client_proxy_password_entry",
+ {"GNUNET_setup_transport_https_client_proxy_password_entry",
"changed",
"transport-https_client",
"PROXY_PASSWORD",
gettext_noop ("Specify password for the proxy (if needed)"),
"https://old.gnunet.org/configuration-http",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
/* FS TAB */
- {
- "GNUNET_setup_fs_datastore_quota_spinbutton",
+ {"GNUNET_setup_fs_datastore_quota_spinbutton",
"value-changed",
"datastore",
"QUOTA",
- gettext_noop ("How many bytes are we allowed to store in the local
datastore?"),
+ gettext_noop (
+ "How many bytes are we allowed to store in the local datastore?"),
"https://old.gnunet.org/datastore-quota",
&load_number,
- &save_number, NULL,
- NULL, NULL,
+ &save_number,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_fs_datastore_sqlite_radiobutton",
+ {"GNUNET_setup_fs_datastore_sqlite_radiobutton",
"toggled",
"datastore",
"DATABASE",
gettext_noop ("Use sqLite to store file-sharing content"),
"https://old.gnunet.org/configuration-datastore",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "sqlite",
- NULL, NULL,
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "sqlite",
+ NULL,
+ NULL,
hide_sqlite_datastore_tab},
- {
- "GNUNET_setup_fs_datastore_mysql_radiobutton",
+ {"GNUNET_setup_fs_datastore_mysql_radiobutton",
"toggled",
"datastore",
"DATABASE",
gettext_noop ("Use MySQL to store file-sharing content"),
"https://old.gnunet.org/configuration-datastore",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "mysql",
- NULL, NULL,
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "mysql",
+ NULL,
+ NULL,
hide_mysql_datastore_tab},
- {
- "GNUNET_setup_fs_datastore_postgres_radiobutton",
+ {"GNUNET_setup_fs_datastore_postgres_radiobutton",
"toggled",
"datastore",
"DATABASE",
gettext_noop ("Use Postgres to store file-sharing content"),
"https://old.gnunet.org/configuration-datastore",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "postgres",
- NULL, NULL,
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "postgres",
+ NULL,
+ NULL,
hide_postgres_datastore_tab},
- {
- "GNUNET_setup_datastore_mysql_database_name_entry",
+ {"GNUNET_setup_datastore_mysql_database_name_entry",
"changed",
"datastore-mysql",
"DATABASE",
gettext_noop ("Name for the MySQL database"),
"https://old.gnunet.org/configuration-datastore",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_datastore_mysql_config_file_filechooserbutton",
+ {"GNUNET_setup_datastore_mysql_config_file_filechooserbutton",
"selection-changed",
"datastore-mysql",
"CONFIG",
gettext_noop ("Configuration file for MySQL access"),
"http://dev.mysql.com/doc/refman/5.5/en/option-files.html",
&load_filename,
- &save_filename, NULL,
- NULL, NULL,
+ &save_filename,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_datastore_mysql_username_entry",
+ {"GNUNET_setup_datastore_mysql_username_entry",
"changed",
"datastore-mysql",
"USER",
gettext_noop ("Username for MySQL access"),
"https://old.gnunet.org/configuration-datastore",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_datastore_mysql_password_entry",
+ {"GNUNET_setup_datastore_mysql_password_entry",
"changed",
"datastore-mysql",
"PASSWORD",
gettext_noop ("Password for MySQL access"),
"https://old.gnunet.org/configuration-datastore",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_datastore_mysql_hostname_entry",
+ {"GNUNET_setup_datastore_mysql_hostname_entry",
"changed",
"datastore-mysql",
"HOST",
gettext_noop ("Name of host running MySQL database"),
"https://old.gnunet.org/configuration-datastore",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_datastore_mysql_port_spinbutton",
+ {"GNUNET_setup_datastore_mysql_port_spinbutton",
"value-changed",
"datastore-mysql",
"PORT",
gettext_noop ("Port of MySQL database"),
"https://old.gnunet.org/configuration-datastore",
&load_number,
- &save_number, NULL,
- NULL, NULL,
+ &save_number,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_datastore_postgres_config_entry",
+ {"GNUNET_setup_datastore_postgres_config_entry",
"changed",
"datastore-postgres",
"CONFIG",
gettext_noop ("Configuration for Postgres (passed to PQconnectdb)"),
"http://www.postgresql.org/docs/8.1/static/libpq.html#LIBPQ-CONNECT",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_fs_migration_from_checkbutton",
+ {"GNUNET_setup_fs_migration_from_checkbutton",
"toggled",
"fs",
"CONTENT_PUSHING",
gettext_noop ("Should we try to push our content to other peers?"),
"https://old.gnunet.org/configuration-fs",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_fs_migration_to_checkbutton",
+ {"GNUNET_setup_fs_migration_to_checkbutton",
"toggled",
"fs",
"CONTENT_CACHING",
gettext_noop ("Are we allowed to cache content received from other peers?"),
"https://old.gnunet.org/configuration-fs",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_fs_datacache_quota_spinbutton",
+ {"GNUNET_setup_fs_datacache_quota_spinbutton",
"value-changed",
"dhtcache",
"QUOTA",
- gettext_noop ("How many bytes are we allowed to store in the local
datacache?"),
+ gettext_noop (
+ "How many bytes are we allowed to store in the local datacache?"),
"https://old.gnunet.org/datacache-quota",
&load_number,
- &save_number, NULL,
- NULL, NULL,
+ &save_number,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_fs_datacache_sqlite_radiobutton",
+ {"GNUNET_setup_fs_datacache_sqlite_radiobutton",
"toggled",
"dhtcache",
"DATABASE",
gettext_noop ("Use sqLite to cache DHT data"),
"https://old.gnunet.org/configuration-datacache",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "sqlite",
- NULL, NULL,
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "sqlite",
+ NULL,
+ NULL,
hide_sqlite_datacache_tab},
- {
- "GNUNET_setup_fs_datacache_heap_radiobutton",
+ {"GNUNET_setup_fs_datacache_heap_radiobutton",
"toggled",
"dhtcache",
"DATABASE",
gettext_noop ("Use memory to cache DHT data"),
"https://old.gnunet.org/configuration-datacache",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "heap",
- NULL, NULL,
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "heap",
+ NULL,
+ NULL,
hide_heap_datacache_tab},
- {
- "GNUNET_setup_fs_datacache_postgres_radiobutton",
+ {"GNUNET_setup_fs_datacache_postgres_radiobutton",
"toggled",
"dhtcache",
"DATABASE",
gettext_noop ("Use Postgres to cache DHT data"),
"https://old.gnunet.org/configuration-datacache",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "postgres",
- NULL, NULL,
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "postgres",
+ NULL,
+ NULL,
hide_postgres_datacache_tab},
- {
- "GNUNET_setup_transport_wlan_interface_entry",
+ {"GNUNET_setup_transport_wlan_interface_entry",
"changed",
"transport-wlan",
"INTERFACE",
gettext_noop ("Name of monitoring interface to use (monX)"),
"https://old.gnunet.org/configuration-wlan",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_datacache_postgres_config_entry",
+ {"GNUNET_setup_datacache_postgres_config_entry",
"changed",
"datacache-postgres",
"CONFIG",
gettext_noop ("Configuration for Postgres (passed to PQconnectdb)"),
"http://www.postgresql.org/docs/8.1/static/libpq.html#LIBPQ-CONNECT",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
/* VPN/PT service */
- {
- "GNUNET_setup_general_services_vpn_checkbutton",
+ {"GNUNET_setup_general_services_vpn_checkbutton",
"toggled",
"vpn",
"FORCESTART",
gettext_noop ("Should the VPN be started automatically on startup?"),
"https://old.gnunet.org/configuration-vpn",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
hide_vpn_options},
- {
- "GNUNET_setup_general_services_pt_checkbutton",
+ {"GNUNET_setup_general_services_pt_checkbutton",
"toggled",
"pt",
"FORCESTART",
gettext_noop ("Should the PT be started automatically on startup?"),
"https://old.gnunet.org/configuration-vpn",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
hide_pt_options},
- {
- "GNUNET_setup_pt_ipv4_checkbutton",
+ {"GNUNET_setup_pt_ipv4_checkbutton",
"toggled",
"pt",
"TUNNEL_IPV4",
- gettext_noop
- ("Tunnel IPv4 traffic over GNUnet"),
+ gettext_noop ("Tunnel IPv4 traffic over GNUnet"),
"https://old.gnunet.org/configuration-vpn",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
- NULL },
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
+ NULL},
- {
- "GNUNET_setup_pt_ipv6_checkbutton",
+ {"GNUNET_setup_pt_ipv6_checkbutton",
"toggled",
"pt",
"TUNNEL_IPV6",
- gettext_noop
- ("Tunnel IPv6 traffic over GNUnet"),
+ gettext_noop ("Tunnel IPv6 traffic over GNUnet"),
"https://old.gnunet.org/configuration-vpn",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
- NULL },
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
+ NULL},
- {
- "GNUNET_setup_pt_dns_checkbutton",
+ {"GNUNET_setup_pt_dns_checkbutton",
"toggled",
"pt",
"TUNNEL_DNS",
- gettext_noop
- ("Tunnel DNS traffic over GNUnet"),
+ gettext_noop ("Tunnel DNS traffic over GNUnet"),
"https://old.gnunet.org/configuration-vpn",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
- NULL },
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
+ NULL},
- {
- "GNUNET_setup_vpn_interface_entry",
+ {"GNUNET_setup_vpn_interface_entry",
"changed",
"vpn",
"IFNAME",
gettext_noop ("Name of the virtual interface the GNUnet VPN should create"),
"https://old.gnunet.org/configuration-vpn",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_vpn_interface_v4_ip_entry",
+ {"GNUNET_setup_vpn_interface_v4_ip_entry",
"changed",
"vpn",
"IPV4ADDR",
gettext_noop ("IPv4 address to use for the VPN interface"),
"https://old.gnunet.org/configuration-vpn",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_vpn_interface_v4_mask_entry",
+ {"GNUNET_setup_vpn_interface_v4_mask_entry",
"changed",
"vpn",
"IPV4MASK",
gettext_noop ("IPv4 network mask to use for the VPN interface"),
"https://old.gnunet.org/configuration-vpn",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_vpn_interface_v6_ip_entry",
+ {"GNUNET_setup_vpn_interface_v6_ip_entry",
"changed",
"vpn",
"IPV6ADDR",
gettext_noop ("IPv6 address to use for the VPN interface"),
"https://old.gnunet.org/configuration-vpn",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_vpn_interface_v6_mask_spinbutton",
+ {"GNUNET_setup_vpn_interface_v6_mask_spinbutton",
"value-changed",
"vpn",
"IPV6PREFIX",
gettext_noop ("IPv6 network prefix length to use for the VPN interface"),
"https://old.gnunet.org/configuration-vpn",
&load_number,
- &save_number, NULL,
- NULL, NULL,
+ &save_number,
+ NULL,
+ NULL,
+ NULL,
NULL},
/* exit daemon */
- {
- "GNUNET_setup_general_services_exit_checkbutton",
+ {"GNUNET_setup_general_services_exit_checkbutton",
"toggled",
"exit",
"FORCESTART",
- gettext_noop
- ("Activate the VPN exit to provide services and/or to enable others to use
your Internet connection"),
+ gettext_noop (
+ "Activate the VPN exit to provide services and/or to enable others to use
your Internet connection"),
"https://old.gnunet.org/configuration-exit",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
hide_exit_options},
- {
- "GNUNET_setup_dns_resolver_ip_entry",
+ {"GNUNET_setup_dns_resolver_ip_entry",
"changed",
"exit",
"DNS_RESOLVER",
- gettext_noop
- ("IP address of the external DNS resolver to use (values from your
resolve.conf are usually appropriate))"),
+ gettext_noop (
+ "IP address of the external DNS resolver to use (values from your
resolve.conf are usually appropriate))"),
"https://old.gnunet.org/configuration-exit",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_dns_enable_exit_checkbutton",
+ {"GNUNET_setup_dns_enable_exit_checkbutton",
"toggled",
"exit",
"EXIT_DNS",
- gettext_noop
- ("Allow other peers to perform DNS resolutions using your Internet
connection"),
+ gettext_noop (
+ "Allow other peers to perform DNS resolutions using your Internet
connection"),
"https://old.gnunet.org/configuration-dns",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
hide_dns_exit_options},
- {
- "GNUNET_setup_exit_interface_name_entry",
+ {"GNUNET_setup_exit_interface_name_entry",
"changed",
"exit",
"TUN_IFNAME",
- gettext_noop
- ("Name of the virtual interface the GNUnet exit service should create for
traffic exiting the VPN to the Internet"),
+ gettext_noop (
+ "Name of the virtual interface the GNUnet exit service should create for
traffic exiting the VPN to the Internet"),
"https://old.gnunet.org/configuration-exit",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_exit_interface_v4_ip_entry",
+ {"GNUNET_setup_exit_interface_v4_ip_entry",
"changed",
"exit",
"IPV4ADDR",
gettext_noop ("IPv4 address to use for the Exit interface"),
"https://old.gnunet.org/configuration-exit",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_exit_interface_v4_mask_entry",
+ {"GNUNET_setup_exit_interface_v4_mask_entry",
"changed",
"exit",
"IPV4MASK",
gettext_noop ("IPv4 network mask to use for the Exit interface"),
"https://old.gnunet.org/configuration-exit",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_exit_interface_v6_ip_entry",
+ {"GNUNET_setup_exit_interface_v6_ip_entry",
"changed",
"exit",
"IPV6ADDR",
gettext_noop ("IPv6 address to use for the Exit interface"),
"https://old.gnunet.org/configuration-exit",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_exit_interface_v6_mask_spinbutton",
+ {"GNUNET_setup_exit_interface_v6_mask_spinbutton",
"value-changed",
"exit",
"IPV6PREFIX",
- gettext_noop
- ("IPv6 network prefix length to use for the Exit interface"),
+ gettext_noop ("IPv6 network prefix length to use for the Exit interface"),
"https://old.gnunet.org/configuration-exit",
&load_number,
- &save_number, NULL,
- NULL, NULL,
+ &save_number,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_setup_exit_enable_ipv4_exit_checkbutton",
+ {"GNUNET_setup_exit_enable_ipv4_exit_checkbutton",
"toggled",
"exit",
"EXIT_IPV4",
- gettext_noop
- ("Allow other users to use your Internet connection for UDP traffic (via
the Exit interface)"),
+ gettext_noop (
+ "Allow other users to use your Internet connection for UDP traffic (via
the Exit interface)"),
"https://old.gnunet.org/configuration-exit",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
hide_v4_exit_options},
- {
- "GNUNET_setup_exit_enable_ipv6_exit_checkbutton",
+ {"GNUNET_setup_exit_enable_ipv6_exit_checkbutton",
"toggled",
"exit",
"EXIT_IPV6",
- gettext_noop
- ("Allow other users to use your Internet connection for TCP traffic (via
the Exit interface)"),
+ gettext_noop (
+ "Allow other users to use your Internet connection for TCP traffic (via
the Exit interface)"),
"https://old.gnunet.org/configuration-exit",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
hide_v6_exit_options},
- {
- "GNUNET_SETUP_exit_policy_v4_entry",
+ {"GNUNET_SETUP_exit_policy_v4_entry",
"changed",
"exit",
"EXIT_RANGE_IPV4_POLICY",
- gettext_noop
- ("Which IPv4 addresses and ports do you allow other users to send traffic
towards (via the Exit interface)"),
+ gettext_noop (
+ "Which IPv4 addresses and ports do you allow other users to send traffic
towards (via the Exit interface)"),
"https://old.gnunet.org/configuration-exit",
&load_text,
- &save_text, NULL,
- &validate_v4_policy, NULL,
+ &save_text,
+ NULL,
+ &validate_v4_policy,
+ NULL,
NULL},
- {
- "GNUNET_SETUP_exit_policy_v6_entry",
+ {"GNUNET_SETUP_exit_policy_v6_entry",
"changed",
"exit",
"EXIT_RANGE_IPV6_POLICY",
- gettext_noop
- ("Which IPv6 addresses and ports do you allow other users to send traffic
towards (via the Exit interface)"),
+ gettext_noop (
+ "Which IPv6 addresses and ports do you allow other users to send traffic
towards (via the Exit interface)"),
"https://old.gnunet.org/configuration-exit",
&load_text,
- &save_text, NULL,
- &validate_v6_policy, NULL,
+ &save_text,
+ NULL,
+ &validate_v6_policy,
+ NULL,
NULL},
-
-
/* Namestore TAB */
- {
- "GNUNET_setup_namestore_sqlite_radiobutton",
+ {"GNUNET_setup_namestore_sqlite_radiobutton",
"toggled",
"namestore",
"DATABASE",
gettext_noop ("Use sqLite to store names"),
"https://old.gnunet.org/configuration-namestore",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "sqlite",
- NULL, NULL,
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "sqlite",
+ NULL,
+ NULL,
hide_sqlite_namestore_tab},
- {
- "GNUNET_setup_namestore_postgres_radiobutton",
+ {"GNUNET_setup_namestore_postgres_radiobutton",
"toggled",
"namestore",
"DATABASE",
gettext_noop ("Use PostGres to store names"),
"https://old.gnunet.org/configuration-namestore",
- &load_option_list /* abuse! */ ,
- &save_option_list /* abuse! */ , "postgres",
- NULL, NULL,
+ &load_option_list /* abuse! */,
+ &save_option_list /* abuse! */,
+ "postgres",
+ NULL,
+ NULL,
hide_postgres_namestore_tab},
- {
- "GNUNET_setup_namestore_postgres_config_entry",
+ {"GNUNET_setup_namestore_postgres_config_entry",
"changed",
"namestore-postgres",
"CONFIG",
gettext_noop ("Configuration for Postgres (passed to PQconnectdb)"),
"http://www.postgresql.org/docs/8.1/static/libpq.html#LIBPQ-CONNECT",
&load_text,
- &save_text, NULL,
- NULL, NULL,
+ &save_text,
+ NULL,
+ NULL,
+ NULL,
NULL},
/* GNS */
- {
- "GNUNET_setup_general_services_gns_checkbutton",
+ {"GNUNET_setup_general_services_gns_checkbutton",
"toggled",
"gns",
"FORCESTART",
gettext_noop ("Should the GNS be started automatically on startup?"),
"https://old.gnunet.org/configuration-gns",
&load_yes_no,
- &save_yes_no, NULL,
- NULL, NULL,
+ &save_yes_no,
+ NULL,
+ NULL,
+ NULL,
hide_gns_tabs},
/* EXIT services */
- {
- "GNUNET_setup_hosted_service_treeview",
+ {"GNUNET_setup_hosted_service_treeview",
NULL,
NULL,
NULL,
- gettext_noop
- ("Specification of .gnunet hosted services"),
+ gettext_noop ("Specification of .gnunet hosted services"),
"https://old.gnunet.org/configuration-dns",
&load_hosted_service_configuration,
- NULL, NULL,
- NULL, NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
NULL},
- {
- "GNUNET_SETUP_hosted_service_identifier_cellrenderertext",
+ {"GNUNET_SETUP_hosted_service_identifier_cellrenderertext",
"editing-started",
NULL,
NULL,
@@ -2530,8 +2588,7 @@ const struct GNUNET_SETUP_OptionSpecification
option_specifications[] = {
NULL,
NULL},
- {
- "GNUNET_SETUP_hosted_service_is_udp_cellrenderertoggle",
+ {"GNUNET_SETUP_hosted_service_is_udp_cellrenderertoggle",
"toggled",
NULL,
NULL,
@@ -2544,8 +2601,7 @@ const struct GNUNET_SETUP_OptionSpecification
option_specifications[] = {
NULL,
NULL},
- {
- "GNUNET_SETUP_hosted_service_port_cellrenderertext",
+ {"GNUNET_SETUP_hosted_service_port_cellrenderertext",
"editing-started",
NULL,
NULL,
@@ -2558,8 +2614,7 @@ const struct GNUNET_SETUP_OptionSpecification
option_specifications[] = {
NULL,
NULL},
- {
- "GNUNET_SETUP_hosted_service_destination_cellrenderertext",
+ {"GNUNET_SETUP_hosted_service_destination_cellrenderertext",
"editing-started",
NULL,
NULL,
@@ -2573,13 +2628,9 @@ const struct GNUNET_SETUP_OptionSpecification
option_specifications[] = {
NULL},
-
/* END of list */
- {NULL, NULL, NULL, NULL, NULL,
- NULL, NULL, NULL, NULL, NULL,
- NULL}
-};
+ {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}};
/* end of gnunet-setup-options.c */
diff --git a/src/setup/gnunet-setup-options.h b/src/setup/gnunet-setup-options.h
index 5b94d0c3..fc60941f 100644
--- a/src/setup/gnunet-setup-options.h
+++ b/src/setup/gnunet-setup-options.h
@@ -40,11 +40,13 @@
* @param cfg configuration handle
* @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
*/
-typedef int (*GNUNET_SETUP_LoadFunction) (const void *cls, const char *section,
- const char *option, const char
*value,
- GObject * widget,
- const struct
- GNUNET_CONFIGURATION_Handle * cfg);
+typedef int (*GNUNET_SETUP_LoadFunction) (
+ const void *cls,
+ const char *section,
+ const char *option,
+ const char *value,
+ GObject *widget,
+ const struct GNUNET_CONFIGURATION_Handle *cfg);
/**
@@ -58,10 +60,12 @@ typedef int (*GNUNET_SETUP_LoadFunction) (const void *cls,
const char *section,
* @param cfg configuration handle to update
* @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
*/
-typedef int (*GNUNET_SETUP_SaveFunction) (const void *cls, const char *section,
- const char *option, GObject * widget,
- struct GNUNET_CONFIGURATION_Handle *
- cfg);
+typedef int (*GNUNET_SETUP_SaveFunction) (
+ const void *cls,
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct GNUNET_CONFIGURATION_Handle *cfg);
/**
@@ -98,7 +102,6 @@ struct GNUNET_SETUP_VisibilitySpecification
* hidden. If NULL, the "show_value" controls visibility.
*/
const char *hide_value;
-
};
@@ -168,7 +171,6 @@ struct GNUNET_SETUP_OptionSpecification
* NULL-terminated).
*/
const struct GNUNET_SETUP_VisibilitySpecification *visibility;
-
};
diff --git a/src/setup/gnunet-setup-transport-plugins.c
b/src/setup/gnunet-setup-transport-plugins.c
index 68eb1d7a..5a5a14ff 100644
--- a/src/setup/gnunet-setup-transport-plugins.c
+++ b/src/setup/gnunet-setup-transport-plugins.c
@@ -34,7 +34,7 @@
* @param name name of the plugin to check
*/
static void
-test_plugin (GtkWidget * widget, const char *name)
+test_plugin (GtkWidget *widget, const char *name)
{
if (GNUNET_YES == GNUNET_PLUGIN_test (name))
{
@@ -48,9 +48,8 @@ test_plugin (GtkWidget * widget, const char *name)
}
-
void
-GNUNET_setup_transport_tcp_checkbutton_realize_cb (GtkWidget * widget,
+GNUNET_setup_transport_tcp_checkbutton_realize_cb (GtkWidget *widget,
gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_transport_tcp");
@@ -58,7 +57,7 @@ GNUNET_setup_transport_tcp_checkbutton_realize_cb (GtkWidget
* widget,
void
-GNUNET_setup_transport_udp_checkbutton_realize_cb (GtkWidget * widget,
+GNUNET_setup_transport_udp_checkbutton_realize_cb (GtkWidget *widget,
gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_transport_udp");
@@ -66,39 +65,39 @@ GNUNET_setup_transport_udp_checkbutton_realize_cb
(GtkWidget * widget,
void
-GNUNET_setup_transport_http_server_checkbutton_realize_cb (GtkWidget * widget,
- gpointer user_data)
+GNUNET_setup_transport_http_server_checkbutton_realize_cb (GtkWidget *widget,
+ gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_transport_http_server");
}
void
-GNUNET_setup_transport_http_client_checkbutton_realize_cb (GtkWidget * widget,
- gpointer user_data)
+GNUNET_setup_transport_http_client_checkbutton_realize_cb (GtkWidget *widget,
+ gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_transport_http_client");
}
void
-GNUNET_setup_transport_https_server_checkbutton_realize_cb (GtkWidget * widget,
- gpointer user_data)
+GNUNET_setup_transport_https_server_checkbutton_realize_cb (GtkWidget *widget,
+ gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_transport_https_server");
}
void
-GNUNET_setup_transport_https_client_checkbutton_realize_cb (GtkWidget * widget,
- gpointer user_data)
+GNUNET_setup_transport_https_client_checkbutton_realize_cb (GtkWidget *widget,
+ gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_transport_https_client");
}
void
-GNUNET_setup_transport_dv_checkbutton_realize_cb (GtkWidget * widget,
+GNUNET_setup_transport_dv_checkbutton_realize_cb (GtkWidget *widget,
gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_transport_dv");
@@ -106,7 +105,7 @@ GNUNET_setup_transport_dv_checkbutton_realize_cb (GtkWidget
* widget,
void
-GNUNET_setup_transport_wlan_checkbutton_realize_cb (GtkWidget * widget,
+GNUNET_setup_transport_wlan_checkbutton_realize_cb (GtkWidget *widget,
gpointer user_data)
{
test_plugin (widget, "libgnunet_plugin_transport_wlan");
diff --git a/src/setup/gnunet-setup-transport-test.c
b/src/setup/gnunet-setup-transport-test.c
index e46b9ef4..fd08c633 100644
--- a/src/setup/gnunet-setup-transport-test.c
+++ b/src/setup/gnunet-setup-transport-test.c
@@ -64,7 +64,6 @@ struct TestContext
* Name of widget to show on failure.
*/
const char *failure_image;
-
};
@@ -99,11 +98,8 @@ stop_service (struct GNUNET_OS_Process *proc)
{
if (NULL == proc)
return;
- GNUNET_break (0 ==
- GNUNET_OS_process_kill (proc,
- SIGTERM));
- GNUNET_break (GNUNET_OK ==
- GNUNET_OS_process_wait (proc));
+ GNUNET_break (0 == GNUNET_OS_process_kill (proc, SIGTERM));
+ GNUNET_break (GNUNET_OK == GNUNET_OS_process_wait (proc));
GNUNET_OS_process_destroy (proc);
}
@@ -122,14 +118,9 @@ start_service (const char *name)
char *filename;
char *path;
- GNUNET_asprintf (&binary,
- "gnunet-service-%s",
- name);
+ GNUNET_asprintf (&binary, "gnunet-service-%s", name);
path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBEXECDIR);
- GNUNET_asprintf (&filename,
- "%s/%s",
- path,
- binary);
+ GNUNET_asprintf (&filename, "%s/%s", path, binary);
GNUNET_free (path);
proc = GNUNET_OS_start_process (GNUNET_NO,
GNUNET_OS_INHERIT_STD_ERR,
@@ -142,9 +133,7 @@ start_service (const char *name)
option_cfg_name,
NULL);
if (NULL == proc)
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
- "exec",
- filename);
+ GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "exec", filename);
GNUNET_free (binary);
GNUNET_free (filename);
return proc;
@@ -185,8 +174,7 @@ start_services ()
* @param result #GNUNET_YES on success
*/
static void
-display_test_result (struct TestContext *tc,
- int result)
+display_test_result (struct TestContext *tc, int result)
{
GObject *w;
@@ -233,8 +221,7 @@ timeout_task (void *cls)
tc->tt = NULL;
GNUNET_SCHEDULER_cancel (tc->st);
tc->st = NULL;
- display_test_result (tc,
- GNUNET_SYSERR);
+ display_test_result (tc, GNUNET_SYSERR);
}
@@ -266,8 +253,7 @@ shutdown_task (void *cls)
* @param result status code for the NAT test
*/
static void
-result_callback (void *cls,
- enum GNUNET_NAT_StatusCode result)
+result_callback (void *cls, enum GNUNET_NAT_StatusCode result)
{
struct TestContext *tc = cls;
@@ -276,9 +262,8 @@ result_callback (void *cls,
GNUNET_SCHEDULER_cancel (tc->st);
tc->st = NULL;
display_test_result (tc,
- (GNUNET_NAT_ERROR_SUCCESS == result)
- ? GNUNET_OK
- : GNUNET_SYSERR);
+ (GNUNET_NAT_ERROR_SUCCESS == result) ? GNUNET_OK
+ : GNUNET_SYSERR);
}
@@ -310,16 +295,10 @@ GNUNET_setup_transport_test (const char *section_name,
gtk_widget_hide (w);
GNUNET_assert (NULL != cfg);
GNUNET_RESOLVER_connect (cfg);
- tc->tt = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
- &timeout_task,
- tc);
- tc->st = GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
- tc);
- tc->tst = GNUNET_NAT_AUTO_test_start (cfg,
- proto,
- section_name,
- &result_callback,
- tc);
+ tc->tt = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &timeout_task, tc);
+ tc->st = GNUNET_SCHEDULER_add_shutdown (&shutdown_task, tc);
+ tc->tst =
+ GNUNET_NAT_AUTO_test_start (cfg, proto, section_name, &result_callback,
tc);
}
/* end of gnunet-setup-transport-test.c */
diff --git a/src/setup/gnunet-setup-transport-udp.c
b/src/setup/gnunet-setup-transport-udp.c
index 14bb546e..e89ebf94 100644
--- a/src/setup/gnunet-setup-transport-udp.c
+++ b/src/setup/gnunet-setup-transport-udp.c
@@ -38,7 +38,6 @@ GNUNET_setup_transport_udp_test_button_clicked_cb ()
IPPROTO_UDP,
"GNUNET_setup_transport_udp_test_success_image",
"GNUNET_setup_transport_udp_test_fail_image");
-
}
diff --git a/src/setup/gnunet-setup.c b/src/setup/gnunet-setup.c
index d60c3211..84e55aaa 100644
--- a/src/setup/gnunet-setup.c
+++ b/src/setup/gnunet-setup.c
@@ -84,7 +84,8 @@ GNUNET_SETUP_get_object (const char *name)
* @return FALSE (continue event handling)
*/
static gboolean
-help_click_callback (GtkWidget * widget, GdkEventButton * event,
+help_click_callback (GtkWidget *widget,
+ GdkEventButton *event,
gpointer user_data)
{
const struct GNUNET_SETUP_OptionSpecification *os = user_data;
@@ -105,9 +106,9 @@ help_click_callback (GtkWidget * widget, GdkEventButton *
event,
*/
void
GNUNET_setup_notebook_switch_page_cb (GtkNotebook *notebook,
- GtkWidget *page,
- guint page_num,
- gpointer user_data)
+ GtkWidget *page,
+ guint page_num,
+ gpointer user_data)
{
GtkWidget *help;
GtkWidget *gnu;
@@ -146,7 +147,8 @@ update_visibility (const struct
GNUNET_SETUP_OptionSpecification *os,
widget = GTK_WIDGET (GNUNET_SETUP_get_object (vs->widget_name));
if (NULL == widget)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Widget `%s' not found\n"),
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _ ("Widget `%s' not found\n"),
vs->widget_name);
}
if (NULL != vs->show_value)
@@ -155,7 +157,8 @@ update_visibility (const struct
GNUNET_SETUP_OptionSpecification *os,
regcomp (&r, vs->show_value, REG_EXTENDED | REG_ICASE | REG_NOSUB))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Invalid regular expression `%s'\n"), vs->show_value);
+ _ ("Invalid regular expression `%s'\n"),
+ vs->show_value);
i++;
continue;
}
@@ -170,7 +173,8 @@ update_visibility (const struct
GNUNET_SETUP_OptionSpecification *os,
if (0 != regcomp (&r, vs->hide_value, REG_ICASE | REG_NOSUB))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Invalid regular expression `%s'\n"), vs->show_value);
+ _ ("Invalid regular expression `%s'\n"),
+ vs->show_value);
i++;
continue;
}
@@ -198,27 +202,25 @@ widget_state_change_callback (const struct
GNUNET_SETUP_OptionSpecification *os)
widget = GNUNET_SETUP_get_object (os->widget_name);
GNUNET_assert (NULL != os->save_function);
- if (GNUNET_OK !=
- os->save_function (os->load_save_cls,
- os->section,
- os->option,
- widget,
- cfg))
+ if (GNUNET_OK != os->save_function (os->load_save_cls,
+ os->section,
+ os->option,
+ widget,
+ cfg))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Failed to obtain option value from widget `%s'\n"),
+ _ ("Failed to obtain option value from widget `%s'\n"),
os->widget_name);
return;
}
if (NULL != os->input_validation_function)
os->input_validation_function (os->input_validation_function_cls, widget);
- if ( (NULL != os->section) &&
- (NULL != os->option) )
+ if ((NULL != os->section) && (NULL != os->option))
{
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (cfg, os->section,
- os->option,
- &value))
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg,
+ os->section,
+ os->option,
+ &value))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
os->section,
@@ -245,7 +247,8 @@ load_options ()
char *value;
#ifndef LINUX
- gtk_widget_hide (GTK_WIDGET (GNUNET_SETUP_get_object
("GNUNET_setup_gns_hijack_checkbutton")));
+ gtk_widget_hide (GTK_WIDGET (
+ GNUNET_SETUP_get_object ("GNUNET_setup_gns_hijack_checkbutton")));
#endif
i = 0;
while (NULL != option_specifications[i].widget_name)
@@ -254,7 +257,8 @@ load_options ()
widget = GNUNET_SETUP_get_object (os->widget_name);
if (NULL == widget)
{
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Widget `%s' not found\n"),
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _ ("Widget `%s' not found\n"),
os->widget_name);
i++;
continue;
@@ -263,34 +267,45 @@ load_options ()
{
if ((NULL == os->section) || (NULL == os->option))
{
- if (GNUNET_OK !=
- os->load_function (os->load_save_cls, NULL, NULL, NULL, widget,
- cfg))
+ if (GNUNET_OK != os->load_function (os->load_save_cls,
+ NULL,
+ NULL,
+ NULL,
+ widget,
+ cfg))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Failed to initialize widget `%s'\n"),
os->widget_name);
+ _ ("Failed to initialize widget `%s'\n"),
+ os->widget_name);
}
}
else
{
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (cfg, os->section,
os->option,
- &value))
+ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg,
+ os->section,
+ os->option,
+ &value))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _
- ("No default value known for option `%s' in section
`%s'\n"),
- os->option, os->section);
+ _ (
+ "No default value known for option `%s' in section
`%s'\n"),
+ os->option,
+ os->section);
}
else
{
- if (GNUNET_OK !=
- os->load_function (os->load_save_cls, os->section, os->option,
- value, widget, cfg))
+ if (GNUNET_OK != os->load_function (os->load_save_cls,
+ os->section,
+ os->option,
+ value,
+ widget,
+ cfg))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Failed to initialize widget `%s' with value
`%s'\n"),
- os->widget_name, value);
+ _ (
+ "Failed to initialize widget `%s' with value
`%s'\n"),
+ os->widget_name,
+ value);
}
else
{
@@ -304,13 +319,16 @@ load_options ()
os->input_validation_function (os->input_validation_function_cls,
widget);
if (os->help_text != NULL)
{
- g_signal_connect (widget, "button-press-event",
- G_CALLBACK (&help_click_callback), (void *) os);
+ g_signal_connect (widget,
+ "button-press-event",
+ G_CALLBACK (&help_click_callback),
+ (void *) os);
}
if (NULL != os->change_signal)
{
GNUNET_assert (NULL != os->save_function);
- g_signal_connect_swapped (widget, os->change_signal,
+ g_signal_connect_swapped (widget,
+ os->change_signal,
G_CALLBACK (&widget_state_change_callback),
(void *) os);
}
@@ -331,10 +349,8 @@ write_configuration ()
int ret;
cfgDefault = GNUNET_CONFIGURATION_create ();
- (void) GNUNET_CONFIGURATION_load (cfgDefault, NULL); /* load defaults only
*/
- ret = GNUNET_CONFIGURATION_write_diffs (cfgDefault,
- cfg,
- option_cfg_name);
+ (void) GNUNET_CONFIGURATION_load (cfgDefault, NULL); /* load defaults only */
+ ret = GNUNET_CONFIGURATION_write_diffs (cfgDefault, cfg, option_cfg_name);
GNUNET_CONFIGURATION_destroy (cfgDefault);
return ret;
}
@@ -365,7 +381,7 @@ cleanup_task (void *cls)
* Callback invoked if the application is supposed to exit.
*/
void
-GNUNET_SETUP_quit_cb (GObject * object, gpointer user_data)
+GNUNET_SETUP_quit_cb (GObject *object, gpointer user_data)
{
GNUNET_SCHEDULER_shutdown ();
}
@@ -383,14 +399,22 @@ try_gksu (const char *username)
{
struct GNUNET_OS_Process *proc;
- proc = GNUNET_OS_start_process (GNUNET_NO,
- GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "gksu",
- "-u", username,
- "-m", _("Enter YOUR password to run
gnunet-setup as user 'gnunet' (assuming 'sudo' allows it)"),
- "-D", _("Enter YOUR password to run
gnunet-setup as user 'gnunet' (assuming 'sudo' allows it)"),
- NULL);
+ proc = GNUNET_OS_start_process (
+ GNUNET_NO,
+ GNUNET_OS_INHERIT_STD_ALL,
+ NULL,
+ NULL,
+ NULL,
+ "gksu",
+ "-u",
+ username,
+ "-m",
+ _ (
+ "Enter YOUR password to run gnunet-setup as user 'gnunet' (assuming
'sudo' allows it)"),
+ "-D",
+ _ (
+ "Enter YOUR password to run gnunet-setup as user 'gnunet' (assuming
'sudo' allows it)"),
+ NULL);
if (NULL == proc)
return GNUNET_SYSERR;
GNUNET_OS_process_wait (proc);
@@ -411,15 +435,18 @@ GNUNET_setup_launch_edit_friends_button_clicked_cb
(GtkButton *button,
struct GNUNET_OS_Process *proc;
proc = GNUNET_OS_start_process (GNUNET_NO,
- GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "gnunet-peerinfo-gtk",
- "-c", option_cfg_name,
+ GNUNET_OS_INHERIT_STD_ALL,
+ NULL,
+ NULL,
+ NULL,
+ "gnunet-peerinfo-gtk",
+ "-c",
+ option_cfg_name,
NULL);
if (NULL == proc)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to launch gnunet-peerinfo-gtk\n"));
+ _ ("Failed to launch gnunet-peerinfo-gtk\n"));
return;
}
/* simply yield control, let it run */
@@ -442,11 +469,8 @@ run (void *cls)
my_uid = getuid ();
gnunet_pw = getpwnam ("gnunet");
- if ( (0 != do_gksu) &&
- (0 != my_uid) &&
- (NULL != gnunet_pw) &&
- (my_uid != gnunet_pw->pw_uid) &&
- (GNUNET_OK == try_gksu ("gnunet")))
+ if ((0 != do_gksu) && (0 != my_uid) && (NULL != gnunet_pw) &&
+ (my_uid != gnunet_pw->pw_uid) && (GNUNET_OK == try_gksu ("gnunet")))
{
GNUNET_GTK_main_loop_quit (cls);
return;
@@ -459,13 +483,11 @@ run (void *cls)
option_cfg_name = GNUNET_GTK_main_loop_get_configuration_file (ml);
cfg = GNUNET_CONFIGURATION_create ();
- if (GNUNET_YES ==
- GNUNET_DISK_file_test (option_cfg_name))
+ if (GNUNET_YES == GNUNET_DISK_file_test (option_cfg_name))
(void) GNUNET_CONFIGURATION_load (cfg, option_cfg_name);
else
(void) GNUNET_CONFIGURATION_load (cfg, NULL);
- if (0 != ACCESS (option_cfg_name,
- W_OK))
+ if (0 != ACCESS (option_cfg_name, W_OK))
{
if (ENOENT == errno)
{
@@ -478,8 +500,7 @@ run (void *cls)
while ((len > 0) && (dirname[len] != DIR_SEPARATOR))
len--;
dirname[len] = '\0';
- if (0 != ACCESS (dirname,
- X_OK | W_OK | R_OK))
+ if (0 != ACCESS (dirname, X_OK | W_OK | R_OK))
{
if (ENOENT == errno)
errno = EACCES; /* really means somewhere access was denied */
@@ -489,17 +510,17 @@ run (void *cls)
}
if (ENOENT != errno)
{
- fprintf (stderr,
- "Refusing to start as I will be unable to write configuration
file `%s': %s\n",
- option_cfg_name,
- STRERROR (errno));
+ fprintf (
+ stderr,
+ "Refusing to start as I will be unable to write configuration file
`%s': %s\n",
+ option_cfg_name,
+ STRERROR (errno));
GNUNET_GTK_main_loop_quit (ml);
return;
}
}
main_window = GTK_WIDGET (GNUNET_SETUP_get_object ("GNUNET_setup_dialog"));
- main_window = GNUNET_GTK_plug_me ("GNUNET_FS_GTK_PLUG",
- main_window);
+ main_window = GNUNET_GTK_plug_me ("GNUNET_FS_GTK_PLUG", main_window);
load_options ();
GNUNET_SCHEDULER_add_shutdown (&cleanup_task, NULL);
gtk_widget_show (main_window);
@@ -519,22 +540,23 @@ main (int argc, char *const *argv)
{
struct GNUNET_GETOPT_CommandLineOption options[] = {
#ifndef MINGW
- GNUNET_GETOPT_option_flag ('e',
- "elevate-priviledges",
- gettext_noop ("run as user 'gnunet', if
necessary by executing gksu to elevate rights"),
- &do_gksu),
+ GNUNET_GETOPT_option_flag (
+ 'e',
+ "elevate-priviledges",
+ gettext_noop (
+ "run as user 'gnunet', if necessary by executing gksu to elevate
rights"),
+ &do_gksu),
#endif
- GNUNET_GETOPT_OPTION_END
- };
+ GNUNET_GETOPT_OPTION_END};
int ret;
- if (GNUNET_OK ==
- GNUNET_GTK_main_loop_start ("gnunet-setup",
- "gnunet-setup",
- argc, argv,
- options,
- "gnunet_setup_main_window.glade",
- &run))
+ if (GNUNET_OK == GNUNET_GTK_main_loop_start ("gnunet-setup",
+ "gnunet-setup",
+ argc,
+ argv,
+ options,
+
"gnunet_setup_main_window.glade",
+ &run))
ret = gret;
else
ret = 1;
diff --git a/src/setup/gnunet-setup.h b/src/setup/gnunet-setup.h
index 59682fc0..c4f54f1c 100644
--- a/src/setup/gnunet-setup.h
+++ b/src/setup/gnunet-setup.h
@@ -42,17 +42,17 @@ extern const char *option_cfg_name;
* Columns in the gns setup model.
*/
enum GNUNET_GTK_SETUP_HostlistUrlModelColumns
- {
- /**
+{
+ /**
* A gchararray
*/
- GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL = 0,
+ GNUNET_GTK_SETUP_HOSTLIST_URL_MC_URL = 0,
- /**
+ /**
* A gboolean
*/
- GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE = 1,
- };
+ GNUNET_GTK_SETUP_HOSTLIST_URL_MC_EDITABLE = 1,
+};
/**
diff --git a/src/statistics/functions.c b/src/statistics/functions.c
index 5d205589..f5149dd9 100644
--- a/src/statistics/functions.c
+++ b/src/statistics/functions.c
@@ -50,8 +50,11 @@ static struct GNUNET_GC_Configuration *cfg;
static struct GNUNET_CronManager *cron;
static int
-getStatValue (unsigned long long *value, unsigned long long *lvalue,
- GNUNET_CronTime * dtime, const char *optName, int monotone)
+getStatValue (unsigned long long *value,
+ unsigned long long *lvalue,
+ GNUNET_CronTime *dtime,
+ const char *optName,
+ int monotone)
{
unsigned int i;
@@ -68,14 +71,15 @@ getStatValue (unsigned long long *value, unsigned long long
*lvalue,
if (dtime != NULL)
*dtime = lastStatValues[i].delta;
if ((monotone == GNUNET_YES) && (lvalue != NULL) && (*lvalue > *value))
- return GNUNET_SYSERR; /* gnunetd restart? */
+ return GNUNET_SYSERR; /* gnunetd restart? */
return GNUNET_OK;
}
}
#if FUNCTIONS_DEBUG
GNUNET_GE_LOG (ectx,
GNUNET_GE_ERROR | GNUNET_GE_DEVELOPER | GNUNET_GE_ADMIN |
- GNUNET_GE_USER | GNUNET_GE_BULK, "Statistic not found:
`%s'\n",
+ GNUNET_GE_USER | GNUNET_GE_BULK,
+ "Statistic not found: `%s'\n",
optName);
#endif
return GNUNET_SYSERR;
@@ -89,14 +93,13 @@ updateConnectionGoal (void *unused)
char *availableUp;
GNUNET_mutex_lock (lock);
- cmh =
- GNUNET_get_daemon_configuration_value (sock, "gnunetd",
- "connection-max-hosts");
+ cmh = GNUNET_get_daemon_configuration_value (sock,
+ "gnunetd",
+ "connection-max-hosts");
availableDown =
- GNUNET_get_daemon_configuration_value (sock, "LOAD",
- "MAXNETDOWNBPSTOTAL");
+ GNUNET_get_daemon_configuration_value (sock, "LOAD", "MAXNETDOWNBPSTOTAL");
availableUp =
- GNUNET_get_daemon_configuration_value (sock, "LOAD", "MAXNETUPBPSTOTAL");
+ GNUNET_get_daemon_configuration_value (sock, "LOAD", "MAXNETUPBPSTOTAL");
GNUNET_mutex_unlock (lock);
if (cmh == NULL)
connectionGoal = 0;
@@ -117,7 +120,7 @@ updateConnectionGoal (void *unused)
}
static int
-getConnectedNodesStat (const void *closure, gfloat ** data)
+getConnectedNodesStat (const void *closure, gfloat **data)
{
unsigned long long val;
@@ -131,7 +134,7 @@ getConnectedNodesStat (const void *closure, gfloat ** data)
}
static int
-getLoadStat (const void *closure, gfloat ** data)
+getLoadStat (const void *closure, gfloat **data)
{
unsigned long long valc;
unsigned long long vali;
@@ -144,13 +147,17 @@ getLoadStat (const void *closure, gfloat ** data)
if (GNUNET_OK !=
getStatValue (&vali, NULL, NULL, "% of allowed io load", GNUNET_NO))
return GNUNET_SYSERR;
- if (GNUNET_OK !=
- getStatValue (&valu, NULL, NULL, "% of allowed network load (up)",
- GNUNET_NO))
+ if (GNUNET_OK != getStatValue (&valu,
+ NULL,
+ NULL,
+ "% of allowed network load (up)",
+ GNUNET_NO))
return GNUNET_SYSERR;
- if (GNUNET_OK !=
- getStatValue (&vald, NULL, NULL, "% of allowed network load (down)",
- GNUNET_NO))
+ if (GNUNET_OK != getStatValue (&vald,
+ NULL,
+ NULL,
+ "% of allowed network load (down)",
+ GNUNET_NO))
return GNUNET_SYSERR;
data[0][0] = (gfloat) valc / 100.0;
data[0][1] = (gfloat) vali / 100.0;
@@ -160,22 +167,28 @@ getLoadStat (const void *closure, gfloat ** data)
}
static int
-getQuotaStat (const void *closure, gfloat ** data)
+getQuotaStat (const void *closure, gfloat **data)
{
unsigned long long allowed;
unsigned long long have;
data[0][0] = 0;
data[0][1] = 0;
- if ((GNUNET_OK ==
- getStatValue (&allowed, NULL, NULL, "# bytes allowed in datastore",
- GNUNET_NO)) && (allowed != 0) &&
+ if ((GNUNET_OK == getStatValue (&allowed,
+ NULL,
+ NULL,
+ "# bytes allowed in datastore",
+ GNUNET_NO)) &&
+ (allowed != 0) &&
(GNUNET_OK ==
getStatValue (&have, NULL, NULL, "# bytes in datastore", GNUNET_NO)))
data[0][0] = ((gfloat) have) / allowed;
- if ((GNUNET_OK ==
- getStatValue (&allowed, NULL, NULL, "# max bytes allowed in dstore",
- GNUNET_NO)) && (allowed != 0) &&
+ if ((GNUNET_OK == getStatValue (&allowed,
+ NULL,
+ NULL,
+ "# max bytes allowed in dstore",
+ GNUNET_NO)) &&
+ (allowed != 0) &&
(GNUNET_OK ==
getStatValue (&have, NULL, NULL, "# bytes in dstore", GNUNET_NO)))
data[0][1] = ((gfloat) have) / allowed;
@@ -183,7 +196,7 @@ getQuotaStat (const void *closure, gfloat ** data)
}
static int
-getTrafficRecvStats (const void *closure, gfloat ** data)
+getTrafficRecvStats (const void *closure, gfloat **data)
{
unsigned long long total;
unsigned long long noise;
@@ -203,35 +216,45 @@ getTrafficRecvStats (const void *closure, gfloat ** data)
if (GNUNET_OK !=
getStatValue (&total, <otal, &dtime, "# bytes received", GNUNET_YES))
return GNUNET_SYSERR;
- if (GNUNET_OK !=
- getStatValue (&noise, &lnoise, NULL, "# bytes of noise received",
- GNUNET_YES))
+ if (GNUNET_OK != getStatValue (&noise,
+ &lnoise,
+ NULL,
+ "# bytes of noise received",
+ GNUNET_YES))
return GNUNET_SYSERR;
buffer = GNUNET_malloc (512);
- GNUNET_snprintf (buffer, 512, "# bytes received of type %d",
+ GNUNET_snprintf (buffer,
+ 512,
+ "# bytes received of type %d",
GNUNET_P2P_PROTO_GAP_RESULT);
if (GNUNET_OK != getStatValue (&content, &lcontent, NULL, buffer,
GNUNET_YES))
{
content = 0;
lcontent = 0;
}
- GNUNET_snprintf (buffer, 512, "# bytes received of type %d",
+ GNUNET_snprintf (buffer,
+ 512,
+ "# bytes received of type %d",
GNUNET_P2P_PROTO_HELLO);
if (GNUNET_OK != getStatValue (&hellos, &lhellos, NULL, buffer, GNUNET_YES))
{
hellos = 0;
lhellos = 0;
}
- GNUNET_snprintf (buffer, 512, "# bytes received of type %d",
+ GNUNET_snprintf (buffer,
+ 512,
+ "# bytes received of type %d",
GNUNET_P2P_PROTO_GAP_QUERY);
if (GNUNET_OK != getStatValue (&queries, &lqueries, NULL, buffer,
GNUNET_YES))
{
queries = 0;
lqueries = 0;
}
- if (GNUNET_OK !=
- getStatValue (&rlimit, &lrlimit, NULL,
- "# total bytes per second receive limit", GNUNET_NO))
+ if (GNUNET_OK != getStatValue (&rlimit,
+ &lrlimit,
+ NULL,
+ "# total bytes per second receive limit",
+ GNUNET_NO))
{
rlimit = 0;
lrlimit = 0;
@@ -255,12 +278,17 @@ getTrafficRecvStats (const void *closure, gfloat ** data)
data[0][5] = 0.0;
return GNUNET_OK;
}
- data[0][0] = ((gfloat) noise) / (banddown * dtime / GNUNET_CRON_SECONDS);
/* red */
- data[0][1] = ((gfloat) (content + noise)) / (banddown * dtime /
GNUNET_CRON_SECONDS); /* green */
- data[0][2] = ((gfloat) (queries + content + noise)) / (banddown * dtime /
GNUNET_CRON_SECONDS); /* yellow */
- data[0][3] = ((gfloat) (queries + content + noise + hellos)) / (banddown *
dtime / GNUNET_CRON_SECONDS); /* blue */
- data[0][4] = ((gfloat) total) / (banddown * dtime / GNUNET_CRON_SECONDS);
/* gray */
- data[0][5] = (gfloat) rlimit / banddown; /* magenta */
+ data[0][0] =
+ ((gfloat) noise) / (banddown * dtime / GNUNET_CRON_SECONDS); /* red */
+ data[0][1] = ((gfloat) (content + noise)) /
+ (banddown * dtime / GNUNET_CRON_SECONDS); /* green */
+ data[0][2] = ((gfloat) (queries + content + noise)) /
+ (banddown * dtime / GNUNET_CRON_SECONDS); /* yellow */
+ data[0][3] = ((gfloat) (queries + content + noise + hellos)) /
+ (banddown * dtime / GNUNET_CRON_SECONDS); /* blue */
+ data[0][4] =
+ ((gfloat) total) / (banddown * dtime / GNUNET_CRON_SECONDS); /* gray */
+ data[0][5] = (gfloat) rlimit / banddown; /* magenta */
#if 0
printf ("I: %f %f %f %f\n", data[0][0], data[0][1], data[0][2]);
#endif
@@ -268,7 +296,7 @@ getTrafficRecvStats (const void *closure, gfloat ** data)
}
static int
-getTrafficSendStats (const void *closure, gfloat ** data)
+getTrafficSendStats (const void *closure, gfloat **data)
{
unsigned long long total;
unsigned long long noise;
@@ -292,30 +320,38 @@ getTrafficSendStats (const void *closure, gfloat ** data)
getStatValue (&noise, &lnoise, NULL, "# bytes noise sent", GNUNET_YES))
return GNUNET_SYSERR;
buffer = GNUNET_malloc (512);
- GNUNET_snprintf (buffer, 512, "# bytes transmitted of type %d",
+ GNUNET_snprintf (buffer,
+ 512,
+ "# bytes transmitted of type %d",
GNUNET_P2P_PROTO_GAP_RESULT);
if (GNUNET_OK != getStatValue (&content, &lcontent, NULL, buffer,
GNUNET_YES))
{
content = 0;
lcontent = 0;
}
- GNUNET_snprintf (buffer, 512, "# bytes transmitted of type %d",
+ GNUNET_snprintf (buffer,
+ 512,
+ "# bytes transmitted of type %d",
GNUNET_P2P_PROTO_GAP_QUERY);
if (GNUNET_OK != getStatValue (&queries, &lqueries, NULL, buffer,
GNUNET_YES))
{
queries = 0;
lqueries = 0;
}
- GNUNET_snprintf (buffer, 512, "# bytes transmitted of type %d",
+ GNUNET_snprintf (buffer,
+ 512,
+ "# bytes transmitted of type %d",
GNUNET_P2P_PROTO_HELLO);
if (GNUNET_OK != getStatValue (&hellos, &lhellos, NULL, buffer, GNUNET_YES))
{
queries = 0;
lqueries = 0;
}
- if (GNUNET_OK !=
- getStatValue (&slimit, &lslimit, NULL,
- "# total bytes per second send limit", GNUNET_NO))
+ if (GNUNET_OK != getStatValue (&slimit,
+ &lslimit,
+ NULL,
+ "# total bytes per second send limit",
+ GNUNET_NO))
{
slimit = 0;
lslimit = 0;
@@ -338,12 +374,17 @@ getTrafficSendStats (const void *closure, gfloat ** data)
data[0][5] = 0.0;
return GNUNET_OK;
}
- data[0][0] = ((gfloat) noise) / (bandup * dtime / GNUNET_CRON_SECONDS);
/* red */
- data[0][1] = ((gfloat) (noise + content)) / (bandup * dtime /
GNUNET_CRON_SECONDS); /* green */
- data[0][2] = ((gfloat) (noise + content + queries)) / (bandup * dtime /
GNUNET_CRON_SECONDS); /* yellow */
- data[0][3] = ((gfloat) (noise + content + queries + hellos)) / (bandup *
dtime / GNUNET_CRON_SECONDS); /* blue */
- data[0][4] = ((gfloat) total) / (bandup * dtime / GNUNET_CRON_SECONDS);
/* grey */
- data[0][5] = ((gfloat) slimit) / bandup; /* magenta */
+ data[0][0] =
+ ((gfloat) noise) / (bandup * dtime / GNUNET_CRON_SECONDS); /* red */
+ data[0][1] = ((gfloat) (noise + content)) /
+ (bandup * dtime / GNUNET_CRON_SECONDS); /* green */
+ data[0][2] = ((gfloat) (noise + content + queries)) /
+ (bandup * dtime / GNUNET_CRON_SECONDS); /* yellow */
+ data[0][3] = ((gfloat) (noise + content + queries + hellos)) /
+ (bandup * dtime / GNUNET_CRON_SECONDS); /* blue */
+ data[0][4] =
+ ((gfloat) total) / (bandup * dtime / GNUNET_CRON_SECONDS); /* grey */
+ data[0][5] = ((gfloat) slimit) / bandup; /* magenta */
#if 0
printf ("O: %f %f %f %f\n", data[0][0], data[0][1], data[0][2], data[0][3]);
#endif
@@ -351,7 +392,7 @@ getTrafficSendStats (const void *closure, gfloat ** data)
}
static int
-getTrustStats (const void *closure, gfloat ** data)
+getTrustStats (const void *closure, gfloat **data)
{
unsigned long long spent;
unsigned long long earned;
@@ -367,9 +408,11 @@ getTrustStats (const void *closure, gfloat ** data)
if (GNUNET_OK !=
getStatValue (&earned, &learned, NULL, "# trust earned", GNUNET_YES))
return GNUNET_SYSERR;
- if (GNUNET_OK !=
- getStatValue (&awarded, &lawarded, NULL, "# gap total trust awarded",
- GNUNET_YES))
+ if (GNUNET_OK != getStatValue (&awarded,
+ &lawarded,
+ NULL,
+ "# gap total trust awarded",
+ GNUNET_YES))
return GNUNET_SYSERR;
max = spent;
if (earned > max)
@@ -393,20 +436,25 @@ getTrustStats (const void *closure, gfloat ** data)
}
static int
-getEffectivenessStats (const void *closure, gfloat ** data)
+getEffectivenessStats (const void *closure, gfloat **data)
{
- unsigned long long total; /* total number of queries passed on to remote
*/
- unsigned long long success; /* responses forwarded (including local and
remote) */
+ unsigned long long total; /* total number of queries passed on to remote */
+ unsigned long long
+ success; /* responses forwarded (including local and remote) */
unsigned long long ltotal;
unsigned long long lsuccess;
- if (GNUNET_OK !=
- getStatValue (&total, <otal, NULL, "# gap requests total sent",
- GNUNET_YES))
+ if (GNUNET_OK != getStatValue (&total,
+ <otal,
+ NULL,
+ "# gap requests total sent",
+ GNUNET_YES))
return GNUNET_SYSERR;
- if (GNUNET_OK !=
- getStatValue (&success, &lsuccess, NULL, "# gap routes succeeded",
- GNUNET_YES))
+ if (GNUNET_OK != getStatValue (&success,
+ &lsuccess,
+ NULL,
+ "# gap routes succeeded",
+ GNUNET_YES))
return GNUNET_SYSERR;
if (total > 0)
data[0][0] = 1.0 * success / total;
@@ -477,9 +525,11 @@ updateDaemonStatus (void *cls)
if (uc->is_running)
{
- if (GNUNET_OK !=
- getStatValue (&connected_peers, NULL, NULL, "# of connected peers",
- GNUNET_NO))
+ if (GNUNET_OK != getStatValue (&connected_peers,
+ NULL,
+ NULL,
+ "# of connected peers",
+ GNUNET_NO))
GNUNET_GTK_display_daemon_status (GNUNET_GTK_STATUS_UNKNOWN, 0);
else if (connected_peers > 0)
GNUNET_GTK_display_daemon_status (GNUNET_GTK_STATUS_CONNECTED,
@@ -516,80 +566,72 @@ updateStatValues (void *unused)
StatEntry stats[] = {
{
- gettext_noop ("Connectivity"),
- gettext_noop ("# connected nodes (100% = connection table size)"),
- &getConnectedNodesStat,
- NULL,
- 1,
- GNUNET_NO,
- }
- ,
+ gettext_noop ("Connectivity"),
+ gettext_noop ("# connected nodes (100% = connection table size)"),
+ &getConnectedNodesStat,
+ NULL,
+ 1,
+ GNUNET_NO,
+ },
{
- gettext_noop ("System load"),
- gettext_noop
- ("CPU load (red), IO load (green), Network upload (yellow), Network
download (blue)"),
- &getLoadStat,
- NULL,
- 4,
- GNUNET_NO,
- }
- ,
+ gettext_noop ("System load"),
+ gettext_noop (
+ "CPU load (red), IO load (green), Network upload (yellow), Network
download (blue)"),
+ &getLoadStat,
+ NULL,
+ 4,
+ GNUNET_NO,
+ },
{
- gettext_noop ("Datastore capacity"),
- gettext_noop ("Persistent file-sharing data (red) and DHT cache (green)"),
- &getQuotaStat,
- NULL,
- 2,
- GNUNET_NO,
- }
- ,
+ gettext_noop ("Datastore capacity"),
+ gettext_noop ("Persistent file-sharing data (red) and DHT cache (green)"),
+ &getQuotaStat,
+ NULL,
+ 2,
+ GNUNET_NO,
+ },
{
- gettext_noop ("Inbound Traffic"),
- gettext_noop
- ("Noise (red), Content (green), Queries (yellow), Hellos (blue), other
(gray), limit (magenta)"),
- &getTrafficRecvStats,
- NULL,
- 6,
- 5,
- }
- ,
+ gettext_noop ("Inbound Traffic"),
+ gettext_noop (
+ "Noise (red), Content (green), Queries (yellow), Hellos (blue), other
(gray), limit (magenta)"),
+ &getTrafficRecvStats,
+ NULL,
+ 6,
+ 5,
+ },
{
- gettext_noop ("Outbound Traffic"),
- gettext_noop
- ("Noise (red), Content (green), Queries (yellow), Hellos (blue), other
(gray), limit (magenta)"),
- &getTrafficSendStats,
- NULL,
- 6,
- 5,
- }
- ,
+ gettext_noop ("Outbound Traffic"),
+ gettext_noop (
+ "Noise (red), Content (green), Queries (yellow), Hellos (blue), other
(gray), limit (magenta)"),
+ &getTrafficSendStats,
+ NULL,
+ 6,
+ 5,
+ },
{
- gettext_noop ("Trust"),
- gettext_noop ("Spent (red), Earned (green) and Awarded (yellow)"),
- &getTrustStats,
- NULL,
- 3,
- GNUNET_NO,
- }
- ,
+ gettext_noop ("Trust"),
+ gettext_noop ("Spent (red), Earned (green) and Awarded (yellow)"),
+ &getTrustStats,
+ NULL,
+ 3,
+ GNUNET_NO,
+ },
{
- gettext_noop ("Routing Effectiveness"),
- gettext_noop ("Average (red) effectiveness (100% = perfect)"),
- &getEffectivenessStats,
- NULL,
- 1,
- GNUNET_NO,
- }
- ,
+ gettext_noop ("Routing Effectiveness"),
+ gettext_noop ("Average (red) effectiveness (100% = perfect)"),
+ &getEffectivenessStats,
+ NULL,
+ 1,
+ GNUNET_NO,
+ },
{
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- GNUNET_NO,
- }
- ,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ GNUNET_NO,
+ },
};
static unsigned long long UPDATE_INTERVAL;
@@ -599,17 +641,26 @@ init_functions (struct GNUNET_GE_Context *e, struct
GNUNET_GC_Configuration *c)
{
ectx = e;
cfg = c;
- GNUNET_GC_get_configuration_value_number (cfg, "GNUNET-GTK",
"STATS-INTERVAL",
- 1, 99 * GNUNET_CRON_YEARS,
+ GNUNET_GC_get_configuration_value_number (cfg,
+ "GNUNET-GTK",
+ "STATS-INTERVAL",
+ 1,
+ 99 * GNUNET_CRON_YEARS,
30 * GNUNET_CRON_SECONDS,
&UPDATE_INTERVAL);
sock = GNUNET_client_connection_create (ectx, cfg);
lock = GNUNET_mutex_create (GNUNET_NO);
cron = GNUNET_GTK_get_cron_manager ();
- GNUNET_cron_add_job (cron, &updateStatValues, UPDATE_INTERVAL,
- UPDATE_INTERVAL, NULL);
- GNUNET_cron_add_job (cron, &updateConnectionGoal, 5 * GNUNET_CRON_SECONDS,
- 5 * GNUNET_CRON_MINUTES, NULL);
+ GNUNET_cron_add_job (cron,
+ &updateStatValues,
+ UPDATE_INTERVAL,
+ UPDATE_INTERVAL,
+ NULL);
+ GNUNET_cron_add_job (cron,
+ &updateConnectionGoal,
+ 5 * GNUNET_CRON_SECONDS,
+ 5 * GNUNET_CRON_MINUTES,
+ NULL);
updateStatValues (NULL);
}
@@ -618,7 +669,9 @@ done_functions ()
{
unsigned int i;
- GNUNET_cron_del_job (cron, &updateConnectionGoal, 5 * GNUNET_CRON_MINUTES,
+ GNUNET_cron_del_job (cron,
+ &updateConnectionGoal,
+ 5 * GNUNET_CRON_MINUTES,
NULL);
GNUNET_cron_del_job (cron, &updateStatValues, UPDATE_INTERVAL, NULL);
GNUNET_mutex_destroy (lock);
diff --git a/src/statistics/functions.h b/src/statistics/functions.h
index 079f2f28..56919f5f 100644
--- a/src/statistics/functions.h
+++ b/src/statistics/functions.h
@@ -36,7 +36,7 @@ typedef struct
* Callback function to obtain the latest stats
* data for this stat display.
*/
-typedef int (*UpdateData) (const void *closure, gfloat ** data);
+typedef int (*UpdateData) (const void *closure, gfloat **data);
typedef struct SE_
@@ -46,7 +46,7 @@ typedef struct SE_
UpdateData getData;
void *get_closure;
unsigned int count;
- unsigned int fill; /* fill first "fill" entries */
+ unsigned int fill; /* fill first "fill" entries */
} StatEntry;
extern StatEntry stats[];
diff --git a/src/statistics/gnunet-statistics-gtk-about.c
b/src/statistics/gnunet-statistics-gtk-about.c
index 78954035..113e7f87 100644
--- a/src/statistics/gnunet-statistics-gtk-about.c
+++ b/src/statistics/gnunet-statistics-gtk-about.c
@@ -32,7 +32,7 @@
* This displays an about window
*/
void
-GNUNET_STATISTICS_GTK_main_menu_help_about_activate_cb (GtkWidget * dummy,
+GNUNET_STATISTICS_GTK_main_menu_help_about_activate_cb (GtkWidget *dummy,
gpointer data)
{
GNUNET_GTK_display_about ("gnunet_statistics_gtk_about_window.glade");
diff --git a/src/statistics/gnunet-statistics-gtk.c
b/src/statistics/gnunet-statistics-gtk.c
index a2b3a71c..303b53f1 100644
--- a/src/statistics/gnunet-statistics-gtk.c
+++ b/src/statistics/gnunet-statistics-gtk.c
@@ -57,50 +57,55 @@ struct PlotInfo
* Name of color to use when plotting.
*/
const char *color_name;
-
};
/**
* Selected statistics for the connection tab.
*/
-static const struct PlotInfo connection_data[] = {
- {"fs", "# peers connected", "file-sharing connections", "blue"},
- {"core", "# peers connected", "encrypted connections (core)", "green"},
- {"core", "# neighbour entries allocated", "transport connections (core)",
- "yellow"},
- {"transport", "# peers connected", "total connections (transport)",
"orange"},
- {"transport", "# TCP sessions active", "tcp connections", "red"},
- {"transport", "# UDP sessions active", "udp connections", "gray"},
- {"dht", "# peers connected", "DHT connections", "brown"},
- {"nse", "# nodes in the network (estimate)", "network size (estimate)",
- "purple"},
- {NULL, NULL, NULL}
-};
+static const struct PlotInfo connection_data[] =
+ {{"fs", "# peers connected", "file-sharing connections", "blue"},
+ {"core", "# peers connected", "encrypted connections (core)", "green"},
+ {"core",
+ "# neighbour entries allocated",
+ "transport connections (core)",
+ "yellow"},
+ {"transport",
+ "# peers connected",
+ "total connections (transport)",
+ "orange"},
+ {"transport", "# TCP sessions active", "tcp connections", "red"},
+ {"transport", "# UDP sessions active", "udp connections", "gray"},
+ {"dht", "# peers connected", "DHT connections", "brown"},
+ {"nse",
+ "# nodes in the network (estimate)",
+ "network size (estimate)",
+ "purple"},
+ {NULL, NULL, NULL}};
/**
* Selected statistics for the traffic tab.
*/
-static const struct PlotInfo traffic_data[] = {
- {"core", "# bytes encrypted", "bytes encrypted", "blue"},
- {"core", "# bytes decrypted", "bytes decrypted", "green"},
- {"transport", "# bytes received via TCP", "received via tcp", "yellow"},
- {"transport", "# bytes transmitted via TCP", "sent via tcp", "brown"},
- {NULL, NULL, NULL}
-};
+static const struct PlotInfo traffic_data[] =
+ {{"core", "# bytes encrypted", "bytes encrypted", "blue"},
+ {"core", "# bytes decrypted", "bytes decrypted", "green"},
+ {"transport", "# bytes received via TCP", "received via tcp", "yellow"},
+ {"transport", "# bytes transmitted via TCP", "sent via tcp", "brown"},
+ {NULL, NULL, NULL}};
/**
* Selected statistics for the storage tab.
*/
-static const struct PlotInfo storage_data[] = {
- {"datastore", "# quota", "datastore capacity", "blue"},
- {"datastore", "# utilization by current datastore", "datastore utilization",
- "yellow"},
- {"datastore", "# cache size", "reservation for datastore cache", "green"},
- {NULL, NULL, NULL}
-};
+static const struct PlotInfo storage_data[] =
+ {{"datastore", "# quota", "datastore capacity", "blue"},
+ {"datastore",
+ "# utilization by current datastore",
+ "datastore utilization",
+ "yellow"},
+ {"datastore", "# cache size", "reservation for datastore cache", "green"},
+ {NULL, NULL, NULL}};
/**
@@ -139,14 +144,12 @@ process_value_update (void *cls,
GtkStatistics *stats = cls;
char *id;
- GNUNET_asprintf (&id,
- "%s: %s",
- subsystem,
- name);
+ GNUNET_asprintf (&id, "%s: %s", subsystem, name);
gtk_statistics_update_value (stats,
id,
- GNUNET_TIME_absolute_get_duration
- (start_time).rel_value_us / 1000000LL,
+ GNUNET_TIME_absolute_get_duration (start_time)
+ .rel_value_us /
+ 1000000LL,
value);
GNUNET_free (id);
return GNUNET_OK;
@@ -173,8 +176,7 @@ get_object (const char *name)
* @param info what to draw
*/
static void
-create_plot (const char *box_name,
- const struct PlotInfo *info)
+create_plot (const char *box_name, const struct PlotInfo *info)
{
GtkBox *box;
GtkStatistics *ret;
@@ -185,14 +187,8 @@ create_plot (const char *box_name,
for (unsigned int i = 0; NULL != info[i].subsystem; i++)
{
- GNUNET_asprintf (&id,
- "%s: %s",
- info[i].subsystem,
- info[i].name);
- gtk_statistics_add_line (ret,
- id,
- info[i].label,
- info[i].color_name);
+ GNUNET_asprintf (&id, "%s: %s", info[i].subsystem, info[i].name);
+ gtk_statistics_add_line (ret, id, info[i].label, info[i].color_name);
GNUNET_free (id);
GNUNET_STATISTICS_watch (statistics,
info[i].subsystem,
@@ -201,11 +197,7 @@ create_plot (const char *box_name,
ret);
}
gtk_widget_show (GTK_WIDGET (ret));
- gtk_box_pack_start (box,
- GTK_WIDGET (ret),
- TRUE,
- TRUE,
- 0);
+ gtk_box_pack_start (box, GTK_WIDGET (ret), TRUE, TRUE, 0);
}
@@ -219,8 +211,7 @@ shutdown_task (void *cls)
{
GNUNET_GTK_main_loop_quit (ml);
ml = NULL;
- GNUNET_STATISTICS_destroy (statistics,
- GNUNET_NO);
+ GNUNET_STATISTICS_destroy (statistics, GNUNET_NO);
statistics = NULL;
}
@@ -229,8 +220,7 @@ shutdown_task (void *cls)
* Callback invoked if the application is supposed to exit.
*/
void
-GNUNET_STATISTICS_GTK_quit_cb (GObject *object,
- gpointer user_data)
+GNUNET_STATISTICS_GTK_quit_cb (GObject *object, gpointer user_data)
{
GNUNET_SCHEDULER_shutdown ();
}
@@ -247,20 +237,18 @@ run (void *cls)
ml = cls;
- if (GNUNET_OK !=
- GNUNET_GTK_main_loop_build_window (ml,
- NULL))
+ if (GNUNET_OK != GNUNET_GTK_main_loop_build_window (ml, NULL))
{
return;
}
- statistics
- = GNUNET_STATISTICS_create ("gnunet-statistics-gtk",
- GNUNET_GTK_main_loop_get_configuration (ml));
+ statistics =
+ GNUNET_STATISTICS_create ("gnunet-statistics-gtk",
+ GNUNET_GTK_main_loop_get_configuration (ml));
if (NULL == statistics)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Failed to initiate connection with statistics service\n"));
+ _ ("Failed to initiate connection with statistics service\n"));
return;
}
GNUNET_GTK_set_icon_search_path ();
@@ -268,31 +256,24 @@ run (void *cls)
/* setup main window */
main_window = GTK_WIDGET (get_object ("GNUNET_STATISTICS_GTK_main_window"));
- main_window = GNUNET_GTK_plug_me ("GNUNET_STATISTICS_GTK_PLUG",
- main_window);
+ main_window = GNUNET_GTK_plug_me ("GNUNET_STATISTICS_GTK_PLUG", main_window);
gtk_window_maximize (GTK_WINDOW (main_window));
- create_plot ("GNUNET_STATISTICS_GTK_connectivity_box",
- connection_data);
- create_plot ("GNUNET_STATISTICS_GTK_traffic_box",
- traffic_data);
- create_plot ("GNUNET_STATISTICS_GTK_storage_box",
- storage_data);
+ create_plot ("GNUNET_STATISTICS_GTK_connectivity_box", connection_data);
+ create_plot ("GNUNET_STATISTICS_GTK_traffic_box", traffic_data);
+ create_plot ("GNUNET_STATISTICS_GTK_storage_box", storage_data);
/* make GUI visible */
gtk_widget_show (main_window);
gtk_window_present (GTK_WINDOW (main_window));
- GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
- NULL);
+ GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
}
int
-main (int argc,
- char *const *argv)
+main (int argc, char *const *argv)
{
static struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
+ GNUNET_GETOPT_OPTION_END};
start_time = GNUNET_TIME_absolute_get ();
if (GNUNET_OK !=
diff --git a/src/statistics/gtk_statistics.c b/src/statistics/gtk_statistics.c
index d7259bfc..3a7aba8e 100644
--- a/src/statistics/gtk_statistics.c
+++ b/src/statistics/gtk_statistics.c
@@ -59,7 +59,6 @@ struct HistoricValue
* A value we recorded.
*/
uint64_t y;
-
};
/**
@@ -116,20 +115,22 @@ struct _GtkStatisticsPrivate
static gboolean
-gtk_statistics_draw (GtkWidget * widget, cairo_t * cr);
+gtk_statistics_draw (GtkWidget *widget, cairo_t *cr);
static void
-gtk_statistics_finalize (GObject * object);
+gtk_statistics_finalize (GObject *object);
-G_DEFINE_TYPE_EXTENDED (GtkStatistics, gtk_statistics, GTK_TYPE_WIDGET, 0,
+G_DEFINE_TYPE_EXTENDED (GtkStatistics,
+ gtk_statistics,
+ GTK_TYPE_WIDGET,
+ 0,
G_ADD_PRIVATE (GtkStatistics))
#if GTK_MAJOR_VERSION < 3
static gboolean
-statistics_expose (GtkWidget * statistics,
- GdkEventExpose * event)
+statistics_expose (GtkWidget *statistics, GdkEventExpose *event)
{
GtkAllocation alloc;
cairo_t *cr;
@@ -137,8 +138,12 @@ statistics_expose (GtkWidget * statistics,
gint y;
gtk_widget_translate_coordinates (statistics,
- GTK_WIDGET (gtk_widget_get_toplevel
- (statistics)), 0, 0, &x, &y);
+ GTK_WIDGET (
+ gtk_widget_get_toplevel (statistics)),
+ 0,
+ 0,
+ &x,
+ &y);
gtk_widget_get_allocation (statistics, &alloc);
cr = gdk_cairo_create (statistics->window);
cairo_translate (cr, x, y);
@@ -153,7 +158,7 @@ statistics_expose (GtkWidget * statistics,
static void
-gtk_statistics_class_init (GtkStatisticsClass * class)
+gtk_statistics_class_init (GtkStatisticsClass *class)
{
GObjectClass *gobject_class;
GtkWidgetClass *widget_class;
@@ -169,16 +174,18 @@ gtk_statistics_class_init (GtkStatisticsClass * class)
static void
-gtk_statistics_init (GtkStatistics * statistics)
+gtk_statistics_init (GtkStatistics *statistics)
{
GtkStatisticsPrivate *priv;
- statistics->priv =
- G_TYPE_INSTANCE_GET_PRIVATE (statistics, GTK_TYPE_STATISTICS,
- GtkStatisticsPrivate);
+ statistics->priv = G_TYPE_INSTANCE_GET_PRIVATE (statistics,
+ GTK_TYPE_STATISTICS,
+ GtkStatisticsPrivate);
priv = statistics->priv;
#if GTK_MAJOR_VERSION < 3
- g_signal_connect (statistics, "expose-event", G_CALLBACK (statistics_expose),
+ g_signal_connect (statistics,
+ "expose-event",
+ G_CALLBACK (statistics_expose),
statistics);
#endif
gtk_widget_set_has_window (GTK_WIDGET (statistics), FALSE);
@@ -219,10 +226,10 @@ gtk_statistics_new ()
* @param color_name name of the color to use
*/
void
-gtk_statistics_add_line (GtkStatistics * statistics,
- const char *id,
+gtk_statistics_add_line (GtkStatistics *statistics,
+ const char *id,
const char *label,
- const char *color_name)
+ const char *color_name)
{
GtkStatisticsPrivate *priv;
struct ValueHistory *vh;
@@ -232,10 +239,10 @@ gtk_statistics_add_line (GtkStatistics * statistics,
g_return_if_fail (gdk_rgba_parse (&c, color_name));
priv = statistics->priv;
priv->values =
- g_realloc (priv->values,
- sizeof (struct ValueHistory *) * (1 + priv->num_values));
+ g_realloc (priv->values,
+ sizeof (struct ValueHistory *) * (1 + priv->num_values));
priv->values[priv->num_values++] = vh =
- g_malloc (sizeof (struct ValueHistory));
+ g_malloc (sizeof (struct ValueHistory));
vh->id = strdup (id);
vh->label = strdup (label);
vh->red = c.red;
@@ -255,8 +262,10 @@ gtk_statistics_add_line (GtkStatistics * statistics,
* @param y new y-value
*/
void
-gtk_statistics_update_value (GtkStatistics * statistics, const char *id,
- uint64_t x, uint64_t y)
+gtk_statistics_update_value (GtkStatistics *statistics,
+ const char *id,
+ uint64_t x,
+ uint64_t y)
{
GtkStatisticsPrivate *priv;
GtkWidget *widget;
@@ -313,7 +322,7 @@ num_to_label (unsigned long long num, char *label)
* @param cr drawing context
*/
static gboolean
-gtk_statistics_draw (GtkWidget * widget, cairo_t * cr)
+gtk_statistics_draw (GtkWidget *widget, cairo_t *cr)
{
GtkStatistics *statistics = GTK_STATISTICS (widget);
GtkStatisticsPrivate *priv = statistics->priv;
@@ -344,8 +353,8 @@ gtk_statistics_draw (GtkWidget * widget, cairo_t * cr)
vh = priv->values[i];
for (j = 0; j < vh->history_size; j++)
{
- hv = &vh->history[(vh->last_history_offset - j + MAX_HISTORY) %
- MAX_HISTORY];
+ hv =
+ &vh->history[(vh->last_history_offset - j + MAX_HISTORY) %
MAX_HISTORY];
xmin = GNUNET_MIN (hv->x, xmin);
xmax = GNUNET_MAX (hv->x, xmax);
ymax = GNUNET_MAX (hv->y, ymax);
@@ -368,10 +377,12 @@ gtk_statistics_draw (GtkWidget * widget, cairo_t * cr)
cairo_paint (cr);
if ((0 == priv->num_values) || (ymax == 0))
- return FALSE; /* done */
+ return FALSE; /* done */
/* select font */
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
- cairo_select_font_face (cr, "Georgia", CAIRO_FONT_SLANT_NORMAL,
+ cairo_select_font_face (cr,
+ "Georgia",
+ CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_BOLD);
cairo_set_font_size (cr, GNUNET_MIN (20, height / (2 * XTICKS)));
@@ -380,9 +391,8 @@ gtk_statistics_draw (GtkWidget * widget, cairo_t * cr)
tex_max.height = 0;
for (i = 0; i < XTICKS; i++)
{
- num_to_label ((unsigned long long) (xmin +
- (xmax -
- xmin) * ((uint64_t) i) / (XTICKS -
1)),
+ num_to_label ((unsigned long long) (xmin + (xmax - xmin) * ((uint64_t) i) /
+ (XTICKS - 1)),
label);
cairo_text_extents (cr, label, &te);
tex_max.width = GNUNET_MAX (te.width, tex_max.width);
@@ -405,32 +415,30 @@ gtk_statistics_draw (GtkWidget * widget, cairo_t * cr)
num_to_label ((unsigned long long) ymax * ((uint64_t) i) / (YTICKS - 1),
label);
cairo_text_extents (cr, label, &te);
- cairo_move_to (cr, BORDER + tey_max.width - te.width,
- BORDER + tey_max.height + (YTICKS - i - 1) * (height -
- 2.0 * BORDER -
- tey_max.height
- -
-
tex_max.height)
- / (double) (YTICKS - 1));
+ cairo_move_to (cr,
+ BORDER + tey_max.width - te.width,
+ BORDER + tey_max.height +
+ (YTICKS - i - 1) *
+ (height - 2.0 * BORDER - tey_max.height -
+ tex_max.height) /
+ (double) (YTICKS - 1));
cairo_show_text (cr, label);
- cairo_move_to (cr, 2.0 * BORDER + tey_max.width,
- BORDER + tey_max.height / 2.0 + (YTICKS - i - 1) * (height -
- 2.0 *
- BORDER -
-
tex_max.height
- -
-
tey_max.height)
- / (double) (YTICKS - 1));
- cairo_line_to (cr, 2.0 * BORDER + tey_max.width + BORDER / 2.0,
- BORDER + tey_max.height / 2.0 + (YTICKS - i - 1) * (height -
- 2.0 *
- BORDER -
-
tex_max.height
- -
-
tey_max.height)
- / (double) (YTICKS - 1));
+ cairo_move_to (cr,
+ 2.0 * BORDER + tey_max.width,
+ BORDER + tey_max.height / 2.0 +
+ (YTICKS - i - 1) *
+ (height - 2.0 * BORDER - tex_max.height -
+ tey_max.height) /
+ (double) (YTICKS - 1));
+ cairo_line_to (cr,
+ 2.0 * BORDER + tey_max.width + BORDER / 2.0,
+ BORDER + tey_max.height / 2.0 +
+ (YTICKS - i - 1) *
+ (height - 2.0 * BORDER - tex_max.height -
+ tey_max.height) /
+ (double) (YTICKS - 1));
cairo_stroke (cr);
}
@@ -438,41 +446,42 @@ gtk_statistics_draw (GtkWidget * widget, cairo_t * cr)
/* draw x-axis labels */
for (i = 0; i < XTICKS; i++)
{
- num_to_label ((unsigned long long) (xmin +
- (xmax -
- xmin) * ((uint64_t) i) / (XTICKS -
1)),
+ num_to_label ((unsigned long long) (xmin + (xmax - xmin) * ((uint64_t) i) /
+ (XTICKS - 1)),
label);
cairo_text_extents (cr, label, &te);
if (i != 0)
{
cairo_move_to (cr,
- 2.0 * BORDER + tey_max.width + (width - tey_max.width -
- tex_max.width / 2.0 -
- 3.0 * BORDER) * i /
- (XTICKS - 1.0) - te.width / 2.0,
+ 2.0 * BORDER + tey_max.width +
+ (width - tey_max.width - tex_max.width / 2.0 -
+ 3.0 * BORDER) *
+ i / (XTICKS - 1.0) -
+ te.width / 2.0,
height - BORDER / 2.0 - tex_max.height / 2.0);
cairo_show_text (cr, label);
}
cairo_move_to (cr,
- 2.0 * BORDER + tey_max.width + (width - tey_max.width -
- tex_max.width / 2.0 -
- 3.0 * BORDER) * i / (XTICKS
-
- 1.0),
+ 2.0 * BORDER + tey_max.width +
+ (width - tey_max.width - tex_max.width / 2.0 -
+ 3.0 * BORDER) *
+ i / (XTICKS - 1.0),
height - BORDER - tey_max.height / 2.0 - tex_max.height);
cairo_line_to (cr,
- 2.0 * BORDER + tey_max.width + (width - tey_max.width -
- tex_max.width / 2.0 -
- 3.0 * BORDER) * i / (XTICKS
-
- 1.0),
+ 2.0 * BORDER + tey_max.width +
+ (width - tey_max.width - tex_max.width / 2.0 -
+ 3.0 * BORDER) *
+ i / (XTICKS - 1.0),
height - BORDER - tey_max.height / 2.0 - tex_max.height -
- BORDER / 2.0);
+ BORDER / 2.0);
cairo_stroke (cr);
}
/* plot border */
cairo_set_line_width (cr, 1.0);
- cairo_rectangle (cr, tey_max.width + BORDER * 2.0,
+ cairo_rectangle (cr,
+ tey_max.width + BORDER * 2.0,
BORDER + tey_max.height / 2.0,
width - BORDER * 3.0 - tey_max.width - tex_max.width / 2.0,
height - BORDER * 2.0 - tey_max.height - tex_max.height);
@@ -484,8 +493,8 @@ gtk_statistics_draw (GtkWidget * widget, cairo_t * cr)
cairo_set_font_size (cr,
GNUNET_MIN (20,
(height - 3.0 * BORDER - tex_max.height -
- tey_max.height / 2) / (priv->num_values +
- 1)));
+ tey_max.height / 2) /
+ (priv->num_values + 1)));
h = 2.0 * BORDER + tey_max.height / 2;
@@ -502,9 +511,9 @@ gtk_statistics_draw (GtkWidget * widget, cairo_t * cr)
{
hv = &vh->history[vh->last_history_offset % MAX_HISTORY];
ry = hv->y / (double) ymax;
- ry = BORDER + tex_max.height / 2.0 + (1.0 - ry) * (height - BORDER * 2.0
-
- tey_max.height -
- tex_max.height);
+ ry =
+ BORDER + tex_max.height / 2.0 +
+ (1.0 - ry) * (height - BORDER * 2.0 - tey_max.height - tex_max.height);
/* if y-values are small, offset y-values a bit to allow overlapping
curves to still show up */
if (ymax < height / (priv->num_values * 4))
ry += priv->num_values * 2 - (4 * i);
@@ -516,16 +525,16 @@ gtk_statistics_draw (GtkWidget * widget, cairo_t * cr)
for (j = 0; j < vh->history_size; j++)
{
- hv = &vh->history[(vh->last_history_offset - j + MAX_HISTORY) %
- MAX_HISTORY];
+ hv =
+ &vh->history[(vh->last_history_offset - j + MAX_HISTORY) %
MAX_HISTORY];
rx = (hv->x - xmin) / (double) (xmax - xmin);
ry = hv->y / (double) ymax;
rx = tey_max.width + BORDER * 2.0 +
- (rx * (width - BORDER * 3.0 - tey_max.width - tex_max.width / 2.0));
- ry = BORDER + tex_max.height / 2.0 + (1.0 - ry) * (height - BORDER * 2.0
-
- tey_max.height -
- tex_max.height);
+ (rx * (width - BORDER * 3.0 - tey_max.width - tex_max.width / 2.0));
+ ry =
+ BORDER + tex_max.height / 2.0 +
+ (1.0 - ry) * (height - BORDER * 2.0 - tey_max.height - tex_max.height);
/* if y-values are small, offset y-values a bit to allow overlapping
curves to still show up */
if (ymax < height / (priv->num_values * 4))
@@ -546,7 +555,7 @@ gtk_statistics_draw (GtkWidget * widget, cairo_t * cr)
* @param object object to release
*/
static void
-gtk_statistics_finalize (GObject * object)
+gtk_statistics_finalize (GObject *object)
{
GtkStatistics *label = GTK_STATISTICS (object);
GtkStatisticsPrivate *priv = label->priv;
diff --git a/src/statistics/gtk_statistics.h b/src/statistics/gtk_statistics.h
index 7d56175e..99d5c88a 100644
--- a/src/statistics/gtk_statistics.h
+++ b/src/statistics/gtk_statistics.h
@@ -31,12 +31,17 @@
#include <cairo.h>
G_BEGIN_DECLS
-#define GTK_TYPE_STATISTICS (gtk_statistics_get_type ())
-#define GTK_STATISTICS(obj) (G_TYPE_CHECK_INSTANCE_CAST
((obj), GTK_TYPE_STATISTICS, GtkStatistics))
-#define GTK_STATISTICS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST
((klass), GTK_TYPE_STATISTICS, GtkStatisticsClass))
-#define GTK_IS_STATISTICS(obj) (G_TYPE_CHECK_INSTANCE_TYPE
((obj), GTK_TYPE_STATISTICS))
-#define GTK_IS_STATISTICS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE
((klass), GTK_TYPE_STATISTICS))
-#define GTK_STATISTICS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS
((obj), GTK_TYPE_STATISTICS, GtkStatisticsClass))
+#define GTK_TYPE_STATISTICS (gtk_statistics_get_type ())
+#define GTK_STATISTICS(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_STATISTICS, GtkStatistics))
+#define GTK_STATISTICS_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_STATISTICS, GtkStatisticsClass))
+#define GTK_IS_STATISTICS(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_STATISTICS))
+#define GTK_IS_STATISTICS_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_STATISTICS))
+#define GTK_STATISTICS_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_STATISTICS, GtkStatisticsClass))
typedef struct _GtkStatistics GtkStatistics;
typedef struct _GtkStatisticsPrivate GtkStatisticsPrivate;
typedef struct _GtkStatisticsClass GtkStatisticsClass;
@@ -62,13 +67,19 @@ struct _GtkStatisticsClass
GType
-gtk_statistics_get_type (void)
- G_GNUC_CONST;
- GtkWidget *gtk_statistics_new (void);
- void gtk_statistics_add_line (GtkStatistics * statistics, const char *id,
- const char *label, const char *color_name);
- void gtk_statistics_update_value (GtkStatistics * statistics, const char *id,
- uint64_t x, uint64_t y);
+gtk_statistics_get_type (void) G_GNUC_CONST;
+GtkWidget *
+gtk_statistics_new (void);
+void
+gtk_statistics_add_line (GtkStatistics *statistics,
+ const char *id,
+ const char *label,
+ const char *color_name);
+void
+gtk_statistics_update_value (GtkStatistics *statistics,
+ const char *id,
+ uint64_t x,
+ uint64_t y);
G_END_DECLS
diff --git a/src/statistics/gtk_statistics_demo.c
b/src/statistics/gtk_statistics_demo.c
index efd98e07..58f017cb 100644
--- a/src/statistics/gtk_statistics_demo.c
+++ b/src/statistics/gtk_statistics_demo.c
@@ -7,14 +7,18 @@
* Update view (add more points).
*/
static gboolean
-update (GtkWidget * widget, GdkEvent * event, gpointer user_data)
+update (GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
static unsigned int i = 600;
struct GtkStatistics *statistics = user_data;
- gtk_statistics_update_value (GTK_STATISTICS (statistics), "sin", i,
+ gtk_statistics_update_value (GTK_STATISTICS (statistics),
+ "sin",
+ i,
(uint64_t) (500 * (1.0 + sin (i / 100.0))));
- gtk_statistics_update_value (GTK_STATISTICS (statistics), "cos", i * 2,
+ gtk_statistics_update_value (GTK_STATISTICS (statistics),
+ "cos",
+ i * 2,
(uint64_t) (i * (1.0 + cos (i / 100.0))));
i++;
return FALSE;
@@ -33,19 +37,27 @@ main (int argc, char **argv)
gtk_window_set_title (GTK_WINDOW (window), "STATISTICS widget");
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size (GTK_WINDOW (window), 400, 200);
- g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (gtk_main_quit),
+ g_signal_connect (G_OBJECT (window),
+ "destroy",
+ G_CALLBACK (gtk_main_quit),
NULL);
statistics = gtk_statistics_new ();
gtk_statistics_add_line (GTK_STATISTICS (statistics), "sin", "sin", "red");
for (i = 0; i < 600; i++)
- gtk_statistics_update_value (GTK_STATISTICS (statistics), "sin", i,
+ gtk_statistics_update_value (GTK_STATISTICS (statistics),
+ "sin",
+ i,
(uint64_t) (500 * (1.0 + sin (i / 100.0))));
gtk_statistics_add_line (GTK_STATISTICS (statistics), "cos", "cos", "blue");
for (i = 0; i < 600; i++)
- gtk_statistics_update_value (GTK_STATISTICS (statistics), "cos", i * 2,
+ gtk_statistics_update_value (GTK_STATISTICS (statistics),
+ "cos",
+ i * 2,
(uint64_t) (i * (1.0 + cos (i / 100.0))));
- g_signal_connect (G_OBJECT (window), "motion-notify-event",
- G_CALLBACK (update), statistics);
+ g_signal_connect (G_OBJECT (window),
+ "motion-notify-event",
+ G_CALLBACK (update),
+ statistics);
gtk_container_add (GTK_CONTAINER (window), statistics);
gtk_widget_add_events (GTK_WIDGET (window), GDK_POINTER_MOTION_MASK);
diff --git a/src/statistics/statistics.c b/src/statistics/statistics.c
index 63366fd5..ddab959f 100644
--- a/src/statistics/statistics.c
+++ b/src/statistics/statistics.c
@@ -68,7 +68,7 @@ static unsigned long long UPDATE_INTERVAL;
* Redraws the backing pixmap for the load graph and updates the window
*/
static void
-load_graph_draw (LoadGraph * g)
+load_graph_draw (LoadGraph *g)
{
guint i;
guint j;
@@ -77,26 +77,27 @@ load_graph_draw (LoadGraph * g)
float max;
GdkFont *font;
- if (!g->disp->window)
+ if (! g->disp->window)
return;
g->draw_width = g->disp->allocation.width;
g->draw_height = g->disp->allocation.height;
- if (!g->pixmap)
- g->pixmap =
- gdk_pixmap_new (g->disp->window, g->draw_width, g->draw_height,
- gtk_widget_get_visual (g->disp)->depth);
+ if (! g->pixmap)
+ g->pixmap = gdk_pixmap_new (g->disp->window,
+ g->draw_width,
+ g->draw_height,
+ gtk_widget_get_visual (g->disp)->depth);
/* Create GC if necessary. */
- if (!g->gc)
+ if (! g->gc)
{
g->gc = gdk_gc_new (g->disp->window);
gdk_gc_copy (g->gc, g->disp->style->white_gc);
}
/* Allocate colors. */
- if (!g->colors_allocated)
+ if (! g->colors_allocated)
{
GdkColormap *colormap;
@@ -108,22 +109,32 @@ load_graph_draw (LoadGraph * g)
}
/* Erase Rectangle */
gdk_gc_set_foreground (g->gc, &(g->colors[0]));
- gdk_draw_rectangle (g->pixmap, g->gc, TRUE, 0, 0, g->disp->allocation.width,
+ gdk_draw_rectangle (g->pixmap,
+ g->gc,
+ TRUE,
+ 0,
+ 0,
+ g->disp->allocation.width,
g->disp->allocation.height);
/* draw frame */
gdk_gc_set_foreground (g->gc, &(g->colors[1]));
- gdk_draw_rectangle (g->pixmap, g->gc, FALSE, 0, 0, g->draw_width,
+ gdk_draw_rectangle (g->pixmap,
+ g->gc,
+ FALSE,
+ 0,
+ 0,
+ g->draw_width,
g->disp->allocation.height);
- max = 0.26; /* force showing at least the 25% line */
+ max = 0.26; /* force showing at least the 25% line */
for (i = 0; i < g->num_points - 1; i++)
for (j = 0; j < g->count; j++)
if (g->data[i][j] > max)
max = g->data[i][j];
- max = max * 1.01; /* leave top 1% free */
+ max = max * 1.01; /* leave top 1% free */
- font = gdk_font_load ("fixed"); /* deprecated, but pango is far more
than
+ font = gdk_font_load ("fixed"); /* deprecated, but pango is far more than
* what we need here -- fix later? */
/* draw lines at 25%, 50%, 75% and 100% of max */
dely = g->draw_height / max / 4;
@@ -132,7 +143,7 @@ load_graph_draw (LoadGraph * g)
gint y1 = g->draw_height + 1 - i * dely;
if ((dely < 30) && (i != 4))
- continue; /* only print additional
+ continue; /* only print additional
* lines if there is enough space! */
if (y1 > 0)
{
@@ -150,11 +161,13 @@ load_graph_draw (LoadGraph * g)
/* extra-thick line at 100% */
gdk_draw_line (g->pixmap, g->gc, 0, y1 - 1, g->draw_width, y1 - 1);
gdk_draw_line (g->pixmap, g->gc, 0, y1 + 1, g->draw_width, y1 + 1);
-
}
}
}
- gdk_gc_set_line_attributes (g->gc, 2, GDK_LINE_SOLID, GDK_CAP_ROUND,
+ gdk_gc_set_line_attributes (g->gc,
+ 2,
+ GDK_LINE_SOLID,
+ GDK_CAP_ROUND,
GDK_JOIN_MITER);
delx = (float) g->draw_width / (g->num_points - 1);
@@ -172,8 +185,11 @@ load_graph_draw (LoadGraph * g)
{
if (stats[g->statIdx].fill <= j)
{
- gdk_draw_line (g->pixmap, g->gc, g->draw_width - x2,
- g->draw_height - y2, g->draw_width - x1,
+ gdk_draw_line (g->pixmap,
+ g->gc,
+ g->draw_width - x2,
+ g->draw_height - y2,
+ g->draw_width - x1,
g->draw_height - y1);
}
else
@@ -205,12 +221,20 @@ load_graph_draw (LoadGraph * g)
}
}
- gdk_gc_set_line_attributes (g->gc, 1, GDK_LINE_SOLID, GDK_CAP_ROUND,
+ gdk_gc_set_line_attributes (g->gc,
+ 1,
+ GDK_LINE_SOLID,
+ GDK_CAP_ROUND,
GDK_JOIN_MITER);
gdk_draw_pixmap (g->disp->window,
- g->disp->style->fg_gc[GTK_WIDGET_STATE (g->disp)],
g->pixmap,
- 0, 0, 0, 0, g->disp->allocation.width,
+ g->disp->style->fg_gc[GTK_WIDGET_STATE (g->disp)],
+ g->pixmap,
+ 0,
+ 0,
+ 0,
+ 0,
+ g->disp->allocation.width,
g->disp->allocation.height);
}
@@ -235,11 +259,11 @@ load_graph_update (gpointer ptr)
}
static void
-load_graph_unalloc (LoadGraph * g)
+load_graph_unalloc (LoadGraph *g)
{
unsigned int i;
- if (!g->allocated)
+ if (! g->allocated)
return;
for (i = 0; i < g->num_points; i++)
{
@@ -258,7 +282,7 @@ load_graph_unalloc (LoadGraph * g)
}
static void
-load_graph_alloc (LoadGraph * g)
+load_graph_alloc (LoadGraph *g)
{
unsigned int i;
unsigned int j;
@@ -281,7 +305,8 @@ load_graph_alloc (LoadGraph * g)
}
static gint
-load_graph_configure (GtkWidget * widget, GdkEventConfigure * event,
+load_graph_configure (GtkWidget *widget,
+ GdkEventConfigure *event,
gpointer data_ptr)
{
LoadGraph *c = (LoadGraph *) data_ptr;
@@ -292,16 +317,26 @@ load_graph_configure (GtkWidget * widget,
GdkEventConfigure * event,
c->pixmap = NULL;
}
- if (!c->pixmap)
- c->pixmap =
- gdk_pixmap_new (widget->window, widget->allocation.width,
- widget->allocation.height,
- gtk_widget_get_visual (c->disp)->depth);
- gdk_draw_rectangle (c->pixmap, widget->style->black_gc, TRUE, 0, 0,
- widget->allocation.width, widget->allocation.height);
+ if (! c->pixmap)
+ c->pixmap = gdk_pixmap_new (widget->window,
+ widget->allocation.width,
+ widget->allocation.height,
+ gtk_widget_get_visual (c->disp)->depth);
+ gdk_draw_rectangle (c->pixmap,
+ widget->style->black_gc,
+ TRUE,
+ 0,
+ 0,
+ widget->allocation.width,
+ widget->allocation.height);
gdk_draw_pixmap (widget->window,
- c->disp->style->fg_gc[GTK_WIDGET_STATE (widget)], c->pixmap,
- 0, 0, 0, 0, c->disp->allocation.width,
+ c->disp->style->fg_gc[GTK_WIDGET_STATE (widget)],
+ c->pixmap,
+ 0,
+ 0,
+ 0,
+ 0,
+ c->disp->allocation.width,
c->disp->allocation.height);
load_graph_draw (c);
@@ -309,22 +344,26 @@ load_graph_configure (GtkWidget * widget,
GdkEventConfigure * event,
}
static gint
-load_graph_expose (GtkWidget * widget, GdkEventExpose * event,
- gpointer data_ptr)
+load_graph_expose (GtkWidget *widget, GdkEventExpose *event, gpointer data_ptr)
{
LoadGraph *g = (LoadGraph *) data_ptr;
gdk_draw_pixmap (widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE (widget)], g->pixmap,
- event->area.x, event->area.y, event->area.x, event->area.y,
- event->area.width, event->area.height);
+ widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
+ g->pixmap,
+ event->area.x,
+ event->area.y,
+ event->area.x,
+ event->area.y,
+ event->area.width,
+ event->area.height);
return FALSE;
}
static void
-load_graph_stop (LoadGraph * g)
+load_graph_stop (LoadGraph *g)
{
- if (!g)
+ if (! g)
return;
if (g->timer_index != -1)
{
@@ -335,7 +374,7 @@ load_graph_stop (LoadGraph * g)
}
static void
-load_graph_destroy (GtkWidget * widget, gpointer data_ptr)
+load_graph_destroy (GtkWidget *widget, gpointer data_ptr)
{
LoadGraph *g = (LoadGraph *) data_ptr;
@@ -348,7 +387,7 @@ load_graph_destroy (GtkWidget * widget, gpointer data_ptr)
}
static LoadGraph *
-load_graph_new (int statIdx, const ProcConfig * config)
+load_graph_new (int statIdx, const ProcConfig *config)
{
LoadGraph *g;
unsigned int i;
@@ -375,12 +414,18 @@ load_graph_new (int statIdx, const ProcConfig * config)
gtk_widget_show (g->main_widget);
g->disp = gtk_drawing_area_new ();
gtk_widget_show (g->disp);
- gtk_signal_connect (GTK_OBJECT (g->disp), "expose_event",
- GTK_SIGNAL_FUNC (load_graph_expose), g);
- gtk_signal_connect (GTK_OBJECT (g->disp), "configure_event",
- GTK_SIGNAL_FUNC (load_graph_configure), g);
- gtk_signal_connect (GTK_OBJECT (g->disp), "destroy",
- GTK_SIGNAL_FUNC (load_graph_destroy), g);
+ gtk_signal_connect (GTK_OBJECT (g->disp),
+ "expose_event",
+ GTK_SIGNAL_FUNC (load_graph_expose),
+ g);
+ gtk_signal_connect (GTK_OBJECT (g->disp),
+ "configure_event",
+ GTK_SIGNAL_FUNC (load_graph_configure),
+ g);
+ gtk_signal_connect (GTK_OBJECT (g->disp),
+ "destroy",
+ GTK_SIGNAL_FUNC (load_graph_destroy),
+ g);
gtk_widget_add_events (g->disp, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
gtk_box_pack_start (GTK_BOX (g->main_widget), g->disp, TRUE, TRUE, 0);
load_graph_alloc (g);
@@ -391,15 +436,15 @@ load_graph_new (int statIdx, const ProcConfig * config)
}
static GtkWidget *
-create_sys_view (int statIdx, const ProcConfig * config)
+create_sys_view (int statIdx, const ProcConfig *config)
{
GtkWidget *mem_frame;
LoadGraph *mem_graph;
mem_graph = load_graph_new (statIdx, config);
if (mem_graph == NULL)
- return NULL; /* oops */
- mem_frame = gtk_frame_new (_(stats[statIdx].frameName));
+ return NULL; /* oops */
+ mem_frame = gtk_frame_new (_ (stats[statIdx].frameName));
gtk_container_add (GTK_CONTAINER (mem_frame), mem_graph->main_widget);
gtk_container_set_border_width (GTK_CONTAINER (mem_graph->main_widget),
GNOME_PAD_SMALL);
@@ -407,15 +452,12 @@ create_sys_view (int statIdx, const ProcConfig * config)
gtk_widget_show (mem_frame);
if (mem_graph->timer_index == -1)
mem_graph->timer_index =
- gtk_timeout_add (mem_graph->speed, &load_graph_update, mem_graph);
+ gtk_timeout_add (mem_graph->speed, &load_graph_update, mem_graph);
mem_graph->draw = TRUE;
return mem_frame;
}
-
-
-
void
init_stats (struct GNUNET_GE_Context *ectx, struct GNUNET_GC_Configuration
*cfg)
{
@@ -428,22 +470,24 @@ init_stats (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg)
int i;
statusConnexionsLabel =
- glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
- "statusConnexionsLabel");
+ glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+ "statusConnexionsLabel");
gtk_label_set_width_chars (GTK_LABEL (statusConnexionsLabel),
- g_utf8_strlen (_("Connected to %Lu peers"),
- 40) - 1);
- statusConnexionsBox =
- glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
- "statusConnexionsBox");
+ g_utf8_strlen (_ ("Connected to %Lu peers"), 40) -
+ 1);
+ statusConnexionsBox = glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+ "statusConnexionsBox");
gtk_widget_set_sensitive (statusConnexionsBox, TRUE);
- GNUNET_GC_get_configuration_value_number (cfg, "GNUNET-GTK",
"STATS-INTERVAL",
- 1, 99 * GNUNET_CRON_YEARS,
+ GNUNET_GC_get_configuration_value_number (cfg,
+ "GNUNET-GTK",
+ "STATS-INTERVAL",
+ 1,
+ 99 * GNUNET_CRON_YEARS,
30 * GNUNET_CRON_SECONDS,
&UPDATE_INTERVAL);
init_functions (ectx, cfg);
notebook =
- glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "statsNotebook");
+ glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (), "statsNotebook");
memset (&config, 0, sizeof (ProcConfig));
gdk_color_parse ("black", &config.bg_color);
gdk_color_parse ("gray", &config.frame_color);
@@ -459,7 +503,7 @@ init_stats (struct GNUNET_GE_Context *ectx, struct
GNUNET_GC_Configuration *cfg)
{
sys_box = create_sys_view (i, &config);
if (sys_box == NULL)
- continue; /* oops */
+ continue; /* oops */
label = gtk_label_new (gettext (stats[i].paneName));
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sys_box, label);
--
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 all C code. Add symlink of clang-format to bootstrap.,
gnunet <=