[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30000 - in gnunet-gtk: contrib src/setup
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30000 - in gnunet-gtk: contrib src/setup |
Date: |
Tue, 8 Oct 2013 18:45:21 +0200 |
Author: grothoff
Date: 2013-10-08 18:45:21 +0200 (Tue, 08 Oct 2013)
New Revision: 30000
Modified:
gnunet-gtk/contrib/gnunet_setup_main_window.glade
gnunet-gtk/src/setup/gnunet-setup-exit-services.c
Log:
-more work towards enabling editing hosted service configuration in gnunet-setup
Modified: gnunet-gtk/contrib/gnunet_setup_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_setup_main_window.glade 2013-10-08 16:37:47 UTC
(rev 29999)
+++ gnunet-gtk/contrib/gnunet_setup_main_window.glade 2013-10-08 16:45:21 UTC
(rev 30000)
@@ -3929,14 +3929,14 @@
</object>
</child>
<child>
- <object class="GtkTreeViewColumn"
id="GNUNET_SETUP_hosted_service_is_udp_treeviewcolumn1">
+ <object class="GtkTreeViewColumn"
id="GNUNET_SETUP_hosted_service_is_udp_treeviewcolumn">
<property name="sizing">autosize</property>
<property name="title"
translatable="yes">_UDP</property>
<property name="clickable">True</property>
<property name="sort_indicator">True</property>
<property name="sort_column_id">1</property>
<child>
- <object class="GtkCellRendererToggle"
id="GNUNET_SETUP_hosted_service_is_udp_treeviewcolumn"/>
+ <object class="GtkCellRendererToggle"
id="GNUNET_SETUP_hosted_service_is_udp_cellrenderertoggle"/>
<attributes>
<attribute name="active">1</attribute>
</attributes>
Modified: gnunet-gtk/src/setup/gnunet-setup-exit-services.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-exit-services.c 2013-10-08 16:37:47 UTC
(rev 29999)
+++ gnunet-gtk/src/setup/gnunet-setup-exit-services.c 2013-10-08 16:45:21 UTC
(rev 30000)
@@ -64,8 +64,8 @@
* @param section name of the section
*/
static void
-add_dns_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;
@@ -74,6 +74,7 @@
char *redirect;
char *cpy;
gboolean udp;
+ guint local_port;
if (NULL == section)
{
@@ -107,17 +108,19 @@
if (NULL == (hostname = strstr (redirect, ":")))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("Option `%s' is not formatted correctly!\n"),
redirect);
+ _("Option `%s' is not formatted correctly!\n"),
+ redirect);
continue;
}
hostname[0] = '\0';
hostname++;
- guint local_port = atoi (redirect);
+ local_port = atoi (redirect);
if (!((local_port > 0) && (local_port < 65536)))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- _("`%s' is not a valid port number!\n"), redirect);
+ _("`%s' is not a valid port number!\n"),
+ redirect);
continue;
}
gtk_list_store_insert_with_values (ls, &iter, 0,
@@ -166,10 +169,10 @@
}
ls = GTK_LIST_STORE (gtk_tree_view_get_model (tv));
GNUNET_CONFIGURATION_iterate_sections (cfg,
- &add_dns_entry_to_list_store,
+ &add_name_entry_to_list_store,
ls);
/* finally, add empty entry */
- add_dns_entry_to_list_store (ls, NULL);
+ add_name_entry_to_list_store (ls, NULL);
return GNUNET_OK;
}
@@ -177,12 +180,12 @@
/**
* Records we use to build DNS information lists.
*/
-struct DnsInfo
+struct HostedServiceInfo
{
/**
* We keep these in a singly-linked list.
*/
- struct DnsInfo *next;
+ struct HostedServiceInfo *next;
/**
* Name of the section in the configuration (must end in ".gnunet.").
@@ -206,21 +209,21 @@
* Function called for each section in the configuration.
* Gather existing ttl, section names and altnames.
*
- * @param cls 'struct DnsInfo**' to create
+ * @param cls 'struct HostedServiceInfo**' to create
* @param section name of a section in the configuration
*/
static void
-collect_dns_sections (void *cls,
- const char *section)
+collect_hosted_service_sections (void *cls,
+ const char *section)
{
- struct DnsInfo **base = cls;
- struct DnsInfo *pos;
+ struct HostedServiceInfo **base = cls;
+ struct HostedServiceInfo *pos;
if ((8 > strlen (section)) ||
(0 != strcmp (".gnunet.",
section + ((strlen (section) - 8)))))
return;
- pos = GNUNET_new (struct DnsInfo);
+ pos = GNUNET_new (struct HostedServiceInfo);
pos->section = GNUNET_strdup (section);
pos->tcpred = GNUNET_strdup ("");
pos->udpred = GNUNET_strdup ("");
@@ -237,8 +240,8 @@
* @param section name of a section in the configuration
*/
static void
-remove_dns_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)))))
@@ -254,7 +257,7 @@
* @param tm model to use
*/
static void
-update_vpn_dns_configuration (GtkTreeModel * tm)
+update_hosted_service_configuration (GtkTreeModel * tm)
{
GtkTreeIter iter;
gchar *name;
@@ -262,12 +265,12 @@
gchar *targetaddress;
gboolea is_udp;
char *tmp;
- struct DnsInfo *head;
- struct DnsInfo *pos;
+ struct HostedServiceInfo *head;
+ struct HostedServiceInfo *pos;
head = NULL;
GNUNET_CONFIGURATION_iterate_sections (cfg,
- &collect_dns_sections,
+ &collect_hosted_service_sections,
&head);
if (gtk_tree_model_get_iter_first (tm, &iter))
do
@@ -286,7 +289,7 @@
pos = pos->next;
if (NULL == pos)
{
- pos = GNUNET_new (struct DnsInfo);
+ pos = GNUNET_new (struct HostedServiceInfo);
pos->section = tmp;
pos->tcpred = GNUNET_strdup ("");
pos->udpred = GNUNET_strdup ("");
@@ -356,17 +359,17 @@
* @param user_data NULL
*/
static void
-save_vpn_dns_service_dnsname (GtkCellRendererText * renderer,
- gchar * path,
- gchar * new_text,
- gpointer user_data)
+save_hosted_service_name (GtkCellRendererText * renderer,
+ gchar * path,
+ gchar * new_text,
+ gpointer user_data)
{
GtkTreeModel *tm;
GtkListStore *ls;
GtkTreeIter iter;
gchar *old;
- tm = GTK_TREE_MODEL (GNUNET_SETUP_get_object ("GNUNET_setup_gns_liststore"));
+ tm = GTK_TREE_MODEL (GNUNET_SETUP_get_object
("GNUNET_setup_hosted_service_liststore"));
if (NULL == tm)
{
GNUNET_break (0);
@@ -390,18 +393,18 @@
gtk_list_store_remove (ls, &iter);
g_free (old);
/* update configuration */
- update_vpn_dns_configuration (tm);
+ update_hosted_service_configuration (tm);
return;
}
/* update model */
gtk_list_store_set (ls, &iter,
SERVICE_MC_HOSTNAME, new_text, -1);
/* update configuration */
- update_vpn_dns_configuration (tm);
+ update_hosted_service_configuration (tm);
if ((0 == strlen (old)) && (0 != strlen (new_text)))
{
/* need another empty entry at the end for future expansion */
- add_dns_entry_to_list_store (GTK_LIST_STORE (tm), NULL);
+ add_name_entry_to_list_store (GTK_LIST_STORE (tm), NULL);
}
g_free (old);
}
@@ -418,11 +421,11 @@
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
-gns_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;
@@ -433,7 +436,7 @@
if (0 != once++)
return GNUNET_OK;
g_signal_connect (rt, "edited",
- G_CALLBACK (&save_vpn_dns_service_dnsname),
+ G_CALLBACK (&save_hosted_service_service_name),
NULL);
return GNUNET_OK;
}
@@ -447,28 +450,21 @@
* one at the bottom. If the hostname was set to empty, remove
* the entire entry from the configuration and the model.
*
- * @param renderer GtkCellRendererText that changed
+ * @param renderer GtkCellRendererToggle that changed
* @param path GtkTreePath identifying where in the Model the change is
- * @param new_text the new text that was stored in the line
* @param user_data NULL
*/
static void
-save_vpn_dns_service_tcpudp (GtkCellRendererText * renderer,
- gchar * path,
- gchar * new_text,
- gpointer user_data)
+save_hosted_service_is_udp (GtkCellRendererToggle * renderer,
+ gchar * path,
+ gpointer user_data)
{
GtkTreeModel *tm;
GtkListStore *ls;
GtkTreeIter iter;
+ gboolean is_udp;
- if ((0 != strcasecmp ("tcp", new_text)) &&
- (0 != strcasecmp ("udp", new_text)))
- {
- /* FIXME: warn... */
- return;
- }
- tm = GTK_TREE_MODEL (GNUNET_SETUP_get_object ("GNUNET_setup_gns_liststore"));
+ tm = GTK_TREE_MODEL (GNUNET_SETUP_get_object
("GNUNET_setup_hosted_service_liststore"));
if (NULL == tm)
{
GNUNET_break (0);
@@ -486,9 +482,14 @@
return;
}
/* update model */
- gtk_list_store_set (ls, &iter, SERVICE_MC_ISUDP, new_text, -1);
+ gtk_list_store_get (ls, &iter,
+ SERVICE_MC_ISUDP, &is_udp,
+ -1);
+ gtk_list_store_set (ls, &iter,
+ SERVICE_MC_ISUDP, ! is_upd,
+ -1);
/* update configuration */
- update_vpn_dns_configuration (tm);
+ update_hosted_service_configuration (tm);
}
@@ -503,21 +504,21 @@
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
-gns_type_install_edited_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;
- GtkCellRendererText *rt;
+ GtkCellRendererToggle *rt;
- rt = GTK_CELL_RENDERER_TEXT (widget);
+ rt = GTK_CELL_RENDERER_TOGGLE (widget);
if (NULL == rt)
return GNUNET_SYSERR;
if (0 != once++)
return GNUNET_OK;
- g_signal_connect (rt, "edited", G_CALLBACK (&save_vpn_dns_service_tcpudp),
+ g_signal_connect (rt, "toggled", G_CALLBACK (&save_hosted_service_is_udp),
NULL);
return GNUNET_OK;
}
@@ -537,10 +538,10 @@
* @param user_data NULL
*/
static void
-save_vpn_dns_service_sourceport (GtkCellRendererText * renderer,
- gchar * path,
- gchar * new_text,
- gpointer user_data)
+save_hosted_service_visible_port (GtkCellRendererText * renderer,
+ gchar * path,
+ gchar * new_text,
+ gpointer user_data)
{
GtkTreeModel *tm;
GtkListStore *ls;
@@ -550,10 +551,10 @@
port = atoi (new_text);
if ((port < 1) || (port > UINT16_MAX))
{
- /* invalid port, FIXME: warn */
+ GNUNET_break (0);
return;
}
- tm = GTK_TREE_MODEL (GNUNET_SETUP_get_object ("GNUNET_setup_gns_liststore"));
+ tm = GTK_TREE_MODEL (GNUNET_SETUP_get_object
("GNUNET_setup_hosted_service_liststore"));
if (NULL == tm)
{
GNUNET_break (0);
@@ -572,9 +573,10 @@
}
/* update model */
gtk_list_store_set (ls, &iter,
- SERVICE_MC_SOURCEPORT, (guint) port, -1);
+ SERVICE_MC_VISIBLE_PORT, (guint) port,
+ -1);
/* update configuration */
- update_vpn_dns_configuration (tm);
+ update_hosted_service_configuration (tm);
}
@@ -589,11 +591,11 @@
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
-gns_ttl_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;
@@ -603,7 +605,7 @@
return GNUNET_SYSERR;
if (0 != once++)
return GNUNET_OK;
- g_signal_connect (rt, "edited", G_CALLBACK
(&save_vpn_dns_service_sourceport),
+ g_signal_connect (rt, "edited", G_CALLBACK
(&save_hosted_service_service_visible_port),
NULL);
return GNUNET_OK;
}
@@ -623,15 +625,15 @@
* @param user_data NULL
*/
static void
-save_vpn_dns_service_targethostname (GtkCellRendererText * renderer,
- gchar * path, gchar * new_text,
- gpointer user_data)
+save_hosted_service_destination (GtkCellRendererText * renderer,
+ gchar * path, gchar * new_text,
+ gpointer user_data)
{
GtkTreeModel *tm;
GtkListStore *ls;
GtkTreeIter iter;
- tm = GTK_TREE_MODEL (GNUNET_SETUP_get_object ("GNUNET_setup_gns_liststore"));
+ tm = GTK_TREE_MODEL (GNUNET_SETUP_get_object
("GNUNET_setup_hosted_service_liststore"));
if (NULL == tm)
{
GNUNET_break (0);
@@ -650,9 +652,10 @@
}
/* update model */
gtk_list_store_set (ls, &iter,
- SERVICE_MC_TARGETHOSTNAME, new_text, -1);
+ SERVICE_MC_DESTINATION_ADDRESS, new_text,
+ -1);
/* update configuration */
- update_vpn_dns_configuration (tm);
+ update_hosted_service_configuration (tm);
}
@@ -667,11 +670,11 @@
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
-gns_value_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;
@@ -682,76 +685,76 @@
if (0 != once++)
return GNUNET_OK;
g_signal_connect (rt, "edited",
- G_CALLBACK (&save_vpn_dns_service_targethostname), NULL);
+ G_CALLBACK (&save_hosted_service_destination), NULL);
return GNUNET_OK;
}
#if 0
{
- "GNUNET_setup_gns_treeview",
+ "GNUNET_setup_hosted_service_treeview",
NULL,
NULL,
NULL,
gettext_noop
- ("Specification of .gnunet TLD"),
+ ("Specification of .gnunet hosted services"),
"https://gnunet.org/configuration-dns",
- &load_vpn_dns_configuration,
+ &load_hosted_service_configuration,
NULL, NULL,
NULL, NULL,
NULL},
{
- "GNUNET_setup_gns_name_cellrenderertext",
+ "GNUNET_SETUP_hosted_service_identifier_cellrenderertext",
"editing-started",
NULL,
NULL,
NULL,
"https://gnunet.org/configuration-dns",
NULL,
- &gns_name_install_edited_handler,
+ &hosted_service_name_install_edited_handler,
NULL,
NULL,
NULL,
NULL},
{
- "GNUNET_setup_gns_type_cellrenderertext",
+ "GNUNET_SETUP_hosted_service_is_udp_cellrenderertoggle",
"editing-started",
NULL,
NULL,
NULL,
"https://gnunet.org/configuration-dns",
NULL,
- &gns_type_install_edited_handler,
+ &hosted_service_is_udp_install_toggled_handler,
NULL,
NULL,
NULL,
NULL},
{
- "GNUNET_setup_gns_ttl_cellrenderertext",
+ "GNUNET_SETUP_hosted_service_port_cellrendererspin",
"editing-started",
NULL,
NULL,
NULL,
"https://gnunet.org/configuration-dns",
NULL,
- &gns_ttl_install_edited_handler,
+ &hosted_service_visible_port_install_edited_handler,
NULL,
NULL,
NULL,
NULL},
{
- "GNUNET_setup_gns_value_cellrenderertext",
+ "GNUNET_SETUP_hosted_service_destination_cellrenderertext",
"editing-started",
NULL,
NULL,
NULL,
"https://gnunet.org/configuration-dns",
NULL,
- &gns_value_install_edited_handler,
+ &hosted_service_destination_install_edited_handler,
NULL,
NULL,
NULL,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30000 - in gnunet-gtk: contrib src/setup,
gnunet <=