[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r15481 - in gnunet-setup: contrib src
From: |
gnunet |
Subject: |
[GNUnet-SVN] r15481 - in gnunet-setup: contrib src |
Date: |
Wed, 8 Jun 2011 23:37:07 +0200 |
Author: grothoff
Date: 2011-06-08 23:37:07 +0200 (Wed, 08 Jun 2011)
New Revision: 15481
Modified:
gnunet-setup/contrib/gnunet-setup.glade
gnunet-setup/src/gnunet-setup-options.c
Log:
more VPN configuring
Modified: gnunet-setup/contrib/gnunet-setup.glade
===================================================================
--- gnunet-setup/contrib/gnunet-setup.glade 2011-06-08 21:20:53 UTC (rev
15480)
+++ gnunet-setup/contrib/gnunet-setup.glade 2011-06-08 21:37:07 UTC (rev
15481)
@@ -15,7 +15,7 @@
<!-- column-name altnames -->
<column type="gchararray"/>
<!-- column-name isudp -->
- <column type="gboolean"/>
+ <column type="gchararray"/>
</columns>
</object>
<object class="GtkAdjustment" id="adjustment8">
@@ -3076,10 +3076,21 @@
<attribute
name="text">0</attribute>
</attributes>
</child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn"
id="GNUNET_setup_vpn_dns_service_tcpudp_treeviewcolumn">
+ <property
name="sizing">autosize</property>
+ <property name="title"
translatable="yes">Prot.</property>
+ <property
name="clickable">False</property>
+ <property
name="reorderable">False</property>
+ <property
name="sort_indicator">False</property>
<child>
- <object
class="GtkCellRendererToggle"
id="GNUNET_setup_vpn_dns_service_isudp_cellrenderertoggle"/>
+ <object class="GtkCellRendererText"
id="GNUNET_setup_vpn_dns_service_tcpudp_cellrenderertext">
+ <property
name="editable">True</property>
+ </object>
<attributes>
- <attribute
name="active">5</attribute>
+ <attribute
name="text">5</attribute>
</attributes>
</child>
</object>
@@ -3119,7 +3130,7 @@
</object>
</child>
<child>
- <object class="GtkCellRendererText"
id="GNUNET_setup_vpn_dns_service_targetport_cellrendererspin">
+ <object class="GtkCellRendererText"
id="GNUNET_setup_vpn_dns_service_targetport_cellrenderertext">
<property
name="editable">True</property>
</object>
<attributes>
Modified: gnunet-setup/src/gnunet-setup-options.c
===================================================================
--- gnunet-setup/src/gnunet-setup-options.c 2011-06-08 21:20:53 UTC (rev
15480)
+++ gnunet-setup/src/gnunet-setup-options.c 2011-06-08 21:37:07 UTC (rev
15481)
@@ -637,7 +637,7 @@
2, (guint) 8080,
3, "localhost",
4, "www",
- 5, FALSE,
+ 5, "tcp",
-1);
return;
}
@@ -707,7 +707,7 @@
2, (guint) host_port,
3, hostname,
4, altnames,
- 5, udp,
+ 5, (TRUE == udp) ? "udp" :
"tcp",
-1);
}
GNUNET_free (cpy);
@@ -914,7 +914,96 @@
* @param user_data NULL
*/
static void
-save_vpn_dns_service_targetname (GtkCellRendererText *renderer,
+save_vpn_dns_service_tcpudp (GtkCellRendererText *renderer,
+ gchar *path,
+ gchar *new_text,
+ gpointer user_data)
+{
+ GtkTreeModel *tm;
+ GtkListStore *ls;
+ GtkTreeIter iter;
+
+ if ( (0 != strcasecmp ("tcp", new_text)) &&
+ (0 != strcasecmp ("udp", new_text)) )
+ {
+ /* FIXME: warn... */
+ return;
+ }
+ tm = GTK_TREE_MODEL (gtk_builder_get_object (builder,
+ "vpn_dns_config_liststore"));
+ if (NULL == tm)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ ls = GTK_LIST_STORE (tm);
+ if (NULL == ls)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ if (TRUE != gtk_tree_model_get_iter_from_string (tm, &iter, path))
+ {
+ GNUNET_break (0);
+ return;
+ }
+ /* update model */
+ gtk_list_store_set (ls, &iter,
+ 5, new_text,
+ -1);
+ /* update configuration */
+ update_vpn_dns_configuration (tm);
+}
+
+
+/**
+ * Initialize the GtkListModel with the VPN's DNS service specification.
+ *
+ * @param cls NULL
+ * @param section section with the value (NULL)
+ * @param option option name (NULL)
+ * @param widget widget to initialize (the GtkTreeView)
+ * @param cfg configuration handle
+ * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ */
+static int
+vpn_dns_service_tcpudp_install_edited_handler (const void *cls,
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct
GNUNET_CONFIGURATION_Handle *cfg)
+{
+ static int once;
+ GtkCellRendererText *rt;
+
+ rt = GTK_CELL_RENDERER_TEXT(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),
+ NULL);
+ return GNUNET_OK;
+}
+
+
+/**
+ * The user has edited the DNS name of a service we're offering.
+ * Update the GtkTreeModel (at the given path) and update the
+ * respective service entry in the configuration file. Finally,
+ * if the edited path is for a "fresh" entry, create another empty
+ * 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 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_sourceport (GtkCellRendererText *renderer,
gchar *path,
gchar *new_text,
gpointer user_data)
@@ -922,7 +1011,14 @@
GtkTreeModel *tm;
GtkListStore *ls;
GtkTreeIter iter;
+ int port;
+ port = atoi (new_text);
+ if ( (port < 1) || (port > UINT16_MAX) )
+ {
+ /* invalid port, FIXME: warn */
+ return;
+ }
tm = GTK_TREE_MODEL (gtk_builder_get_object (builder,
"vpn_dns_config_liststore"));
if (NULL == tm)
@@ -943,6 +1039,89 @@
}
/* update model */
gtk_list_store_set (ls, &iter,
+ 1, (guint) port,
+ -1);
+ /* update configuration */
+ update_vpn_dns_configuration (tm);
+}
+
+
+/**
+ * Initialize the GtkListModel with the VPN's DNS service specification.
+ *
+ * @param cls NULL
+ * @param section section with the value (NULL)
+ * @param option option name (NULL)
+ * @param widget widget to initialize (the GtkTreeView)
+ * @param cfg configuration handle
+ * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ */
+static int
+vpn_dns_service_sourceport_install_edited_handler (const void *cls,
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct
GNUNET_CONFIGURATION_Handle *cfg)
+{
+ static int once;
+ GtkCellRendererText *rt;
+
+ rt = GTK_CELL_RENDERER_TEXT(widget);
+ if (NULL == rt)
+ return GNUNET_SYSERR;
+ if (0 != once++)
+ return GNUNET_OK;
+ g_signal_connect (rt,
+ "edited",
+ G_CALLBACK (&save_vpn_dns_service_sourceport),
+ NULL);
+ return GNUNET_OK;
+}
+
+
+/**
+ * The user has edited the DNS name of a service we're offering.
+ * Update the GtkTreeModel (at the given path) and update the
+ * respective service entry in the configuration file. Finally,
+ * if the edited path is for a "fresh" entry, create another empty
+ * 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 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_targethostname (GtkCellRendererText *renderer,
+ gchar *path,
+ gchar *new_text,
+ gpointer user_data)
+{
+ GtkTreeModel *tm;
+ GtkListStore *ls;
+ GtkTreeIter iter;
+
+ tm = GTK_TREE_MODEL (gtk_builder_get_object (builder,
+ "vpn_dns_config_liststore"));
+ if (NULL == tm)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ ls = GTK_LIST_STORE (tm);
+ if (NULL == ls)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ if (TRUE != gtk_tree_model_get_iter_from_string (tm, &iter, path))
+ {
+ GNUNET_break (0);
+ return;
+ }
+ /* update model */
+ gtk_list_store_set (ls, &iter,
3, new_text,
-1);
/* update configuration */
@@ -961,7 +1140,97 @@
* @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
*/
static int
-vpn_dns_service_targetname_install_edited_handler (const void *cls,
+vpn_dns_service_targethostname_install_edited_handler (const void *cls,
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct
GNUNET_CONFIGURATION_Handle *cfg)
+{
+ static int once;
+ GtkCellRendererText *rt;
+
+ rt = GTK_CELL_RENDERER_TEXT(widget);
+ if (NULL == rt)
+ return GNUNET_SYSERR;
+ if (0 != once++)
+ return GNUNET_OK;
+ g_signal_connect (rt,
+ "edited",
+ G_CALLBACK (&save_vpn_dns_service_targethostname),
+ NULL);
+ return GNUNET_OK;
+}
+
+
+/**
+ * The user has edited the DNS name of a service we're offering.
+ * Update the GtkTreeModel (at the given path) and update the
+ * respective service entry in the configuration file. Finally,
+ * if the edited path is for a "fresh" entry, create another empty
+ * 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 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_targetport (GtkCellRendererText *renderer,
+ gchar *path,
+ gchar *new_text,
+ gpointer user_data)
+{
+ GtkTreeModel *tm;
+ GtkListStore *ls;
+ GtkTreeIter iter;
+ int port;
+
+ port = atoi (new_text);
+ if ( (port < 1) || (port > UINT16_MAX) )
+ {
+ /* invalid port, FIXME: warn */
+ return;
+ }
+ tm = GTK_TREE_MODEL (gtk_builder_get_object (builder,
+ "vpn_dns_config_liststore"));
+ if (NULL == tm)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ ls = GTK_LIST_STORE (tm);
+ if (NULL == ls)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ if (TRUE != gtk_tree_model_get_iter_from_string (tm, &iter, path))
+ {
+ GNUNET_break (0);
+ return;
+ }
+ /* update model */
+ gtk_list_store_set (ls, &iter,
+ 3, (guint) port,
+ -1);
+ /* update configuration */
+ update_vpn_dns_configuration (tm);
+}
+
+
+/**
+ * Initialize the GtkListModel with the VPN's DNS service specification.
+ *
+ * @param cls NULL
+ * @param section section with the value (NULL)
+ * @param option option name (NULL)
+ * @param widget widget to initialize (the GtkTreeView)
+ * @param cfg configuration handle
+ * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ */
+static int
+vpn_dns_service_targetport_install_edited_handler (const void *cls,
const char *section,
const char *option,
GObject *widget,
@@ -977,16 +1246,96 @@
return GNUNET_OK;
g_signal_connect (rt,
"edited",
- G_CALLBACK (&save_vpn_dns_service_targetname),
+ G_CALLBACK (&save_vpn_dns_service_targetport),
NULL);
return GNUNET_OK;
}
+/**
+ * The user has edited the DNS name of a service we're offering.
+ * Update the GtkTreeModel (at the given path) and update the
+ * respective service entry in the configuration file. Finally,
+ * if the edited path is for a "fresh" entry, create another empty
+ * 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 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_altnames (GtkCellRendererText *renderer,
+ gchar *path,
+ gchar *new_text,
+ gpointer user_data)
+{
+ GtkTreeModel *tm;
+ GtkListStore *ls;
+ GtkTreeIter iter;
+ tm = GTK_TREE_MODEL (gtk_builder_get_object (builder,
+ "vpn_dns_config_liststore"));
+ if (NULL == tm)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ ls = GTK_LIST_STORE (tm);
+ if (NULL == ls)
+ {
+ GNUNET_break (0);
+ return;
+ }
+ if (TRUE != gtk_tree_model_get_iter_from_string (tm, &iter, path))
+ {
+ GNUNET_break (0);
+ return;
+ }
+ /* update model */
+ gtk_list_store_set (ls, &iter,
+ 4, new_text,
+ -1);
+ /* update configuration */
+ update_vpn_dns_configuration (tm);
+}
+/**
+ * Initialize the GtkListModel with the VPN's DNS service specification.
+ *
+ * @param cls NULL
+ * @param section section with the value (NULL)
+ * @param option option name (NULL)
+ * @param widget widget to initialize (the GtkTreeView)
+ * @param cfg configuration handle
+ * @return GNUNET_OK on success, GNUNET_SYSERR if there was a problem
+ */
+static int
+vpn_dns_service_altnames_install_edited_handler (const void *cls,
+ const char *section,
+ const char *option,
+ GObject *widget,
+ struct
GNUNET_CONFIGURATION_Handle *cfg)
+{
+ static int once;
+ GtkCellRendererText *rt;
+ rt = GTK_CELL_RENDERER_TEXT(widget);
+ if (NULL == rt)
+ return GNUNET_SYSERR;
+ if (0 != once++)
+ return GNUNET_OK;
+ g_signal_connect (rt,
+ "edited",
+ G_CALLBACK (&save_vpn_dns_service_altnames),
+ NULL);
+ return GNUNET_OK;
+}
+
+
+
/**
* Hide "min connected friends" option if in F2F-only mode.
*/
@@ -2134,6 +2483,32 @@
&vpn_dns_service_dnsname_install_edited_handler,
NULL,
NULL
+ },
+
+ {
+ "GNUNET_setup_vpn_dns_service_tcpudp_cellrenderertext",
+ "editing-started",
+ NULL,
+ NULL,
+ NULL,
+ "https://gnunet.org/configuration-dns",
+ NULL,
+ &vpn_dns_service_tcpudp_install_edited_handler,
+ NULL,
+ NULL
+ },
+
+ {
+ "GNUNET_setup_vpn_dns_service_sourceport_cellrenderertext",
+ "editing-started",
+ NULL,
+ NULL,
+ NULL,
+ "https://gnunet.org/configuration-dns",
+ NULL,
+ &vpn_dns_service_sourceport_install_edited_handler,
+ NULL,
+ NULL
},
{
@@ -2144,17 +2519,36 @@
NULL,
"https://gnunet.org/configuration-dns",
NULL,
- &vpn_dns_service_targetname_install_edited_handler,
+ &vpn_dns_service_targethostname_install_edited_handler,
NULL,
NULL
},
+
+ {
+ "GNUNET_setup_vpn_dns_service_targetport_cellrenderertext",
+ "editing-started",
+ NULL,
+ NULL,
+ NULL,
+ "https://gnunet.org/configuration-dns",
+ NULL,
+ &vpn_dns_service_targetport_install_edited_handler,
+ NULL,
+ NULL
+ },
+ {
+ "GNUNET_setup_vpn_dns_service_altnames_cellrenderertext",
+ "editing-started",
+ NULL,
+ NULL,
+ NULL,
+ "https://gnunet.org/configuration-dns",
+ NULL,
+ &vpn_dns_service_altnames_install_edited_handler,
+ NULL,
+ NULL
+ },
- /* FIXME: create 'edited_handlers' and their
- respective 'save_vpn' handlers for the other cell renderer's;
- largely similar to 'targetname', except sometimes with
- conversion of string to integer; I still need to look into
- how to do the 'isudp' case, which may be different again. */
-
/* END of list */
{ NULL, NULL, NULL, NULL, NULL,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r15481 - in gnunet-setup: contrib src,
gnunet <=