[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r30006 - in gnunet-gtk: contrib src/setup
From: |
gnunet |
Subject: |
[GNUnet-SVN] r30006 - in gnunet-gtk: contrib src/setup |
Date: |
Tue, 8 Oct 2013 20:05:38 +0200 |
Author: grothoff
Date: 2013-10-08 20:05:38 +0200 (Tue, 08 Oct 2013)
New Revision: 30006
Modified:
gnunet-gtk/contrib/gnunet_setup_main_window.glade
gnunet-gtk/src/setup/Makefile.am
gnunet-gtk/src/setup/gnunet-setup-exit-services.c
gnunet-gtk/src/setup/gnunet-setup-options.c
Log:
-towards integrating hosted services editor
Modified: gnunet-gtk/contrib/gnunet_setup_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_setup_main_window.glade 2013-10-08 18:05:13 UTC
(rev 30005)
+++ gnunet-gtk/contrib/gnunet_setup_main_window.glade 2013-10-08 18:05:38 UTC
(rev 30006)
@@ -16,13 +16,6 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
- <object class="GtkAdjustment"
id="GNUNET_setup_exit_interface_mask_adjustment">
- <property name="lower">1</property>
- <property name="upper">127</property>
- <property name="value">48</property>
- <property name="step_increment">1</property>
- <property name="page_increment">10</property>
- </object>
<object class="GtkDialog" id="GNUNET_setup_dialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
@@ -3952,8 +3945,8 @@
<property name="sort_indicator">True</property>
<property name="sort_column_id">2</property>
<child>
- <object class="GtkCellRendererSpin"
id="GNUNET_SETUP_hosted_service_port_cellrendererspin">
- <property name="digits">5</property>
+ <object class="GtkCellRendererText"
id="GNUNET_SETUP_hosted_service_port_cellrenderertext">
+ <property name="editable">True</property>
</object>
<attributes>
<attribute name="text">2</attribute>
@@ -3965,7 +3958,9 @@
<object class="GtkTreeViewColumn"
id="GNUNET_SETUP_hosted_service_destination_treeviewcolumn">
<property name="title"
translatable="yes">_Destination</property>
<child>
- <object class="GtkCellRendererText"
id="GNUNET_SETUP_hosted_service_destination_cellrenderertext"/>
+ <object class="GtkCellRendererText"
id="GNUNET_SETUP_hosted_service_destination_cellrenderertext">
+ <property name="editable">True</property>
+ </object>
<attributes>
<attribute name="text">3</attribute>
</attributes>
@@ -4366,6 +4361,13 @@
<action-widget response="-3">GNUNET_setup_save_button</action-widget>
</action-widgets>
</object>
+ <object class="GtkAdjustment"
id="GNUNET_setup_exit_interface_mask_adjustment">
+ <property name="lower">1</property>
+ <property name="upper">127</property>
+ <property name="value">48</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
<object class="GtkAdjustment"
id="GNUNET_setup_fs_datacache_mysql_port_adjustment">
<property name="lower">1</property>
<property name="upper">65535</property>
Modified: gnunet-gtk/src/setup/Makefile.am
===================================================================
--- gnunet-gtk/src/setup/Makefile.am 2013-10-08 18:05:13 UTC (rev 30005)
+++ gnunet-gtk/src/setup/Makefile.am 2013-10-08 18:05:38 UTC (rev 30006)
@@ -24,6 +24,7 @@
gnunet-setup-datastore-config.c \
gnunet-setup-datacache-plugins.c \
gnunet-setup-datacache-config.c \
+ gnunet-setup-exit-services.c gnunet-setup-exit-services.h \
gnunet-setup-namestore-plugins.c \
gnunet-setup-namestore-config.c \
gnunet-setup-hostlist-editing.c \
Modified: gnunet-gtk/src/setup/gnunet-setup-exit-services.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-exit-services.c 2013-10-08 18:05:13 UTC
(rev 30005)
+++ gnunet-gtk/src/setup/gnunet-setup-exit-services.c 2013-10-08 18:05:38 UTC
(rev 30006)
@@ -36,12 +36,12 @@
/**
* A gchararray
*/
- SERVICE_MC_HOSTNAME = 0,
+ SERVICE_MC_SERVICE_NAME = 0,
/**
* A gboolean
*/
- SERVICE_MC_ISUDP = 1
+ SERVICE_MC_ISUDP = 1,
/**
* A guint
@@ -79,7 +79,7 @@
if (NULL == section)
{
gtk_list_store_insert_with_values (ls, &iter, G_MAXINT,
- SERVICE_MC_HOSTNAME, "",
+ SERVICE_MC_SERVICE_NAME, "",
SERVICE_MC_ISUDP, FALSE,
SERVICE_MC_VISIBLE_PORT, (guint) 80,
SERVICE_MC_DESTINATION_ADDRESS,
"127.0.0.1:8080",
@@ -105,15 +105,15 @@
for (redirect = strtok (cpy, " "); NULL != redirect;
redirect = strtok (NULL, " "))
{
- if (NULL == (hostname = strstr (redirect, ":")))
+ if (NULL == (destination = strstr (redirect, ":")))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_("Option `%s' is not formatted correctly!\n"),
redirect);
continue;
}
- hostname[0] = '\0';
- hostname++;
+ destination[0] = '\0';
+ destination++;
local_port = atoi (redirect);
if (!((local_port > 0) && (local_port < 65536)))
@@ -124,10 +124,10 @@
continue;
}
gtk_list_store_insert_with_values (ls, &iter, 0,
- SERVICE_MC_HOSTNAME, sld,
+ SERVICE_MC_SERVICE_NAME, sld,
SERVICE_MC_ISUDP, udp,
SERVICE_MC_VISIBLE_PORT, local_port,
- SERVICE_MC_DESTINATION_ADDRESS,
hostname,
+ SERVICE_MC_DESTINATION_ADDRESS,
destination,
-1);
}
GNUNET_free (cpy);
@@ -150,7 +150,7 @@
* @param cfg configuration handle
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
-static int
+int
load_hosted_service_configuration (const void *cls,
const char *section,
const char *option,
@@ -263,7 +263,7 @@
gchar *name;
guint srcport;
gchar *targetaddress;
- gboolea is_udp;
+ gboolean is_udp;
char *tmp;
struct HostedServiceInfo *head;
struct HostedServiceInfo *pos;
@@ -276,7 +276,7 @@
do
{
gtk_tree_model_get (tm, &iter,
- SERVICE_MC_HOSTNAME, &name,
+ SERVICE_MC_SERVICE_NAME, &name,
SERVICE_MC_ISUDP, &is_udp,
SERVICE_MC_VISIBLE_PORT, &srcport,
SERVICE_MC_DESTINATION_ADDRESS, &targetaddress,
@@ -323,7 +323,7 @@
}
while (TRUE == gtk_tree_model_iter_next (tm, &iter));
GNUNET_CONFIGURATION_iterate_sections (cfg,
- &remove_dns_sections,
+ &remove_hosted_service_sections,
NULL);
while (NULL != head)
{
@@ -386,7 +386,7 @@
GNUNET_break (0);
return;
}
- gtk_tree_model_get (tm, &iter, SERVICE_MC_HOSTNAME, &old, -1);
+ gtk_tree_model_get (tm, &iter, SERVICE_MC_SERVICE_NAME, &old, -1);
if ((0 != strlen (old)) && (0 == strlen (new_text)))
{
/* deletion */
@@ -398,7 +398,7 @@
}
/* update model */
gtk_list_store_set (ls, &iter,
- SERVICE_MC_HOSTNAME, new_text, -1);
+ SERVICE_MC_SERVICE_NAME, new_text, -1);
/* update configuration */
update_hosted_service_configuration (tm);
if ((0 == strlen (old)) && (0 != strlen (new_text)))
@@ -420,7 +420,7 @@
* @param cfg configuration handle
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
-static int
+int
hosted_service_name_install_edited_handler (const void *cls,
const char *section,
const char *option,
@@ -436,7 +436,7 @@
if (0 != once++)
return GNUNET_OK;
g_signal_connect (rt, "edited",
- G_CALLBACK (&save_hosted_service_service_name),
+ G_CALLBACK (&save_hosted_service_name),
NULL);
return GNUNET_OK;
}
@@ -482,11 +482,11 @@
return;
}
/* update model */
- gtk_list_store_get (ls, &iter,
+ gtk_tree_model_get (tm, &iter,
SERVICE_MC_ISUDP, &is_udp,
-1);
gtk_list_store_set (ls, &iter,
- SERVICE_MC_ISUDP, ! is_upd,
+ SERVICE_MC_ISUDP, ! is_udp,
-1);
/* update configuration */
update_hosted_service_configuration (tm);
@@ -503,7 +503,7 @@
* @param cfg configuration handle
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
-static int
+int
hosted_service_is_udp_install_toggled_handler (const void *cls,
const char *section,
const char *option,
@@ -548,10 +548,15 @@
GtkTreeIter iter;
int port;
- port = atoi (new_text);
- if ((port < 1) || (port > UINT16_MAX))
+ if ( (1 != sscanf (new_text,
+ "%d",
+ &port) ) ||
+ (port < 1) ||
+ (port > UINT16_MAX) )
{
- GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("Illegal value `%s' for port\n"),
+ new_text);
return;
}
tm = GTK_TREE_MODEL (GNUNET_SETUP_get_object
("GNUNET_setup_hosted_service_liststore"));
@@ -573,7 +578,7 @@
}
/* update model */
gtk_list_store_set (ls, &iter,
- SERVICE_MC_VISIBLE_PORT, (guint) port,
+ SERVICE_MC_VISIBLE_PORT, port,
-1);
/* update configuration */
update_hosted_service_configuration (tm);
@@ -590,7 +595,7 @@
* @param cfg configuration handle
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
-static int
+int
hosted_service_visible_port_install_edited_handler (const void *cls,
const char *section,
const char *option,
@@ -605,7 +610,7 @@
return GNUNET_SYSERR;
if (0 != once++)
return GNUNET_OK;
- g_signal_connect (rt, "edited", G_CALLBACK
(&save_hosted_service_service_visible_port),
+ g_signal_connect (rt, "edited", G_CALLBACK
(&save_hosted_service_visible_port),
NULL);
return GNUNET_OK;
}
@@ -632,7 +637,22 @@
GtkTreeModel *tm;
GtkListStore *ls;
GtkTreeIter iter;
+ struct sockaddr_in v4;
+ struct sockaddr_in6 v6;
+ if ( (GNUNET_OK !=
+ GNUNET_STRINGS_to_address_ipv4 (new_text, strlen (new_text),
+ &v4)) &&
+ (GNUNET_OK !=
+ GNUNET_STRINGS_to_address_ipv6 (new_text, strlen (new_text),
+ &v6)) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("Illegal IP destination address `%s'\n"),
+ new_text);
+ return;
+ }
+
tm = GTK_TREE_MODEL (GNUNET_SETUP_get_object
("GNUNET_setup_hosted_service_liststore"));
if (NULL == tm)
{
@@ -669,7 +689,7 @@
* @param cfg configuration handle
* @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
-static int
+int
hosted_service_destination_install_edited_handler (const void *cls,
const char *section,
const char *option,
@@ -690,76 +710,4 @@
}
-#if 0
- {
- "GNUNET_setup_hosted_service_treeview",
- NULL,
- NULL,
- NULL,
- gettext_noop
- ("Specification of .gnunet hosted services"),
- "https://gnunet.org/configuration-dns",
- &load_hosted_service_configuration,
- NULL, NULL,
- NULL, NULL,
- NULL},
-
- {
- "GNUNET_SETUP_hosted_service_identifier_cellrenderertext",
- "editing-started",
- NULL,
- NULL,
- NULL,
- "https://gnunet.org/configuration-dns",
- NULL,
- &hosted_service_name_install_edited_handler,
- NULL,
- NULL,
- NULL,
- NULL},
-
- {
- "GNUNET_SETUP_hosted_service_is_udp_cellrenderertoggle",
- "editing-started",
- NULL,
- NULL,
- NULL,
- "https://gnunet.org/configuration-dns",
- NULL,
- &hosted_service_is_udp_install_toggled_handler,
- NULL,
- NULL,
- NULL,
- NULL},
-
- {
- "GNUNET_SETUP_hosted_service_port_cellrendererspin",
- "editing-started",
- NULL,
- NULL,
- NULL,
- "https://gnunet.org/configuration-dns",
- NULL,
- &hosted_service_visible_port_install_edited_handler,
- NULL,
- NULL,
- NULL,
- NULL},
-
- {
- "GNUNET_SETUP_hosted_service_destination_cellrenderertext",
- "editing-started",
- NULL,
- NULL,
- NULL,
- "https://gnunet.org/configuration-dns",
- NULL,
- &hosted_service_destination_install_edited_handler,
- NULL,
- NULL,
- NULL,
- NULL},
-
-#endif
-
/* end of gnunet-setup-dns-exit.c */
Modified: gnunet-gtk/src/setup/gnunet-setup-options.c
===================================================================
--- gnunet-gtk/src/setup/gnunet-setup-options.c 2013-10-08 18:05:13 UTC (rev
30005)
+++ gnunet-gtk/src/setup/gnunet-setup-options.c 2013-10-08 18:05:38 UTC (rev
30006)
@@ -25,6 +25,7 @@
*/
#include "gnunet-setup.h"
#include "gnunet-setup-options.h"
+#include "gnunet-setup-exit-services.h"
#include <gnunet/gnunet_util_lib.h>
#include <gdk/gdkkeysyms.h>
@@ -79,7 +80,7 @@
* @param value value as a string
* @param widget widget to initialize
* @param cfg configuration handle
- * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
load_yes_no (const void *cls, const char *section, const char *option,
@@ -106,7 +107,7 @@
* @param option option name
* @param widget widget to initialize
* @param cfg configuration handle to update
- * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
save_yes_no (const void *cls, const char *section, const char *option,
@@ -134,7 +135,7 @@
* @param value value as a string
* @param widget widget to initialize
* @param cfg configuration handle
- * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
load_filename (const void *cls, const char *section, const char *option,
@@ -159,17 +160,20 @@
* @param option option name
* @param widget widget to initialize
* @param cfg configuration handle to update
- * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
-save_filename (const void *cls, const char *section, const char *option,
- GObject * widget, struct GNUNET_CONFIGURATION_Handle *cfg)
+save_filename (const void *cls,
+ const char *section,
+ const char *option,
+ GObject * widget,
+ struct GNUNET_CONFIGURATION_Handle *cfg)
{
GtkFileChooser *chooser;
gchar *fn;
chooser = GTK_FILE_CHOOSER (widget);
- if (chooser == NULL)
+ if (NULL == chooser)
return GNUNET_SYSERR;
fn = gtk_file_chooser_get_filename (chooser);
if (fn == NULL)
@@ -199,7 +203,7 @@
GtkEntry *entry;
entry = GTK_ENTRY (widget);
- if (entry == NULL)
+ if (NULL == entry)
return GNUNET_SYSERR;
gtk_entry_set_text (entry, value);
return GNUNET_OK;
@@ -214,7 +218,7 @@
* @param option option name
* @param widget widget to initialize
* @param cfg configuration handle to update
- * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
save_text (const void *cls, const char *section, const char *option,
@@ -224,7 +228,7 @@
const gchar *txt;
entry = GTK_ENTRY (widget);
- if (entry == NULL)
+ if (NULL == entry)
return GNUNET_SYSERR;
txt = gtk_entry_get_text (entry);
GNUNET_CONFIGURATION_set_value_string (cfg, section, option, txt);
@@ -267,7 +271,7 @@
* @param option option name
* @param widget widget to initialize
* @param cfg configuration handle to update
- * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
save_combo_text (const void *cls, const char *section, const char *option,
@@ -296,7 +300,7 @@
* @param value value as a string
* @param widget widget to initialize
* @param cfg configuration handle
- * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
load_number (const void *cls, const char *section, const char *option,
@@ -324,7 +328,7 @@
* @param option option name
* @param widget widget to initialize
* @param cfg configuration handle to update
- * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
save_number (const void *cls, const char *section, const char *option,
@@ -505,7 +509,7 @@
* @param value value as a string
* @param widget widget to initialize
* @param cfg configuration handle
- * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
load_option_list (const void *cls, const char *section, const char *option,
@@ -547,7 +551,7 @@
* @param option option name
* @param widget widget to initialize
* @param cfg configuration handle to update
- * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
save_option_list (const void *cls, const char *section, const char *option,
@@ -627,7 +631,7 @@
* @param value value as a string
* @param widget widget to initialize
* @param cfg configuration handle
- * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
load_string_list_store (const void *cls, const char *section,
@@ -668,7 +672,7 @@
* @param option option name (NULL)
* @param widget the cell renderer
* @param cfg configuration handle to update
- * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if there was a problem
*/
static int
save_string_list_store (const void *cls, const char *section,
@@ -1992,6 +1996,79 @@
NULL, NULL,
NULL},
+ /* EXIT services */
+
+ {
+ "GNUNET_setup_hosted_service_treeview",
+ NULL,
+ NULL,
+ NULL,
+ gettext_noop
+ ("Specification of .gnunet hosted services"),
+ "https://gnunet.org/configuration-dns",
+ &load_hosted_service_configuration,
+ NULL, NULL,
+ NULL, NULL,
+ NULL},
+
+ {
+ "GNUNET_SETUP_hosted_service_identifier_cellrenderertext",
+ "editing-started",
+ NULL,
+ NULL,
+ NULL,
+ "https://gnunet.org/configuration-dns",
+ NULL,
+ &hosted_service_name_install_edited_handler,
+ NULL,
+ NULL,
+ NULL,
+ NULL},
+
+ {
+ "GNUNET_SETUP_hosted_service_is_udp_cellrenderertoggle",
+ "toggled",
+ NULL,
+ NULL,
+ NULL,
+ "https://gnunet.org/configuration-dns",
+ NULL,
+ &hosted_service_is_udp_install_toggled_handler,
+ NULL,
+ NULL,
+ NULL,
+ NULL},
+
+ {
+ "GNUNET_SETUP_hosted_service_port_cellrenderertext",
+ "editing-started",
+ NULL,
+ NULL,
+ NULL,
+ "https://gnunet.org/configuration-dns",
+ NULL,
+ &hosted_service_visible_port_install_edited_handler,
+ NULL,
+ NULL,
+ NULL,
+ NULL},
+
+ {
+ "GNUNET_SETUP_hosted_service_destination_cellrenderertext",
+ "editing-started",
+ NULL,
+ NULL,
+ NULL,
+ "https://gnunet.org/configuration-dns",
+ NULL,
+ &hosted_service_destination_install_edited_handler,
+ NULL,
+ NULL,
+ NULL,
+ NULL},
+
+
+
/* END of list */
{NULL, NULL, NULL, NULL, NULL,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r30006 - in gnunet-gtk: contrib src/setup,
gnunet <=