[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r21978 - in gnunet-gtk: contrib src/fs
From: |
gnunet |
Subject: |
[GNUnet-SVN] r21978 - in gnunet-gtk: contrib src/fs |
Date: |
Wed, 13 Jun 2012 18:14:04 +0200 |
Author: grothoff
Date: 2012-06-13 18:14:04 +0200 (Wed, 13 Jun 2012)
New Revision: 21978
Modified:
gnunet-gtk/contrib/gnunet_fs_gtk_create_namespace_dialog.glade
gnunet-gtk/src/fs/gnunet-fs-gtk_create-pseudonym.c
Log:
-restrict pseudonym names to alnum plus underscore and minus, fixing #2416
Modified: gnunet-gtk/contrib/gnunet_fs_gtk_create_namespace_dialog.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_fs_gtk_create_namespace_dialog.glade
2012-06-13 16:00:33 UTC (rev 21977)
+++ gnunet-gtk/contrib/gnunet_fs_gtk_create_namespace_dialog.glade
2012-06-13 16:14:04 UTC (rev 21978)
@@ -48,6 +48,7 @@
<property name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
+ <signal name="insert-text"
handler="GNUNET_FS_GTK_create_namespace_insert_text_cb" swapped="no"/>
</object>
<packing>
<property name="expand">True</property>
Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_create-pseudonym.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_create-pseudonym.c 2012-06-13 16:00:33 UTC
(rev 21977)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_create-pseudonym.c 2012-06-13 16:14:04 UTC
(rev 21978)
@@ -28,6 +28,34 @@
/**
+ * Function called whenever text is added to the GtkEntry
+ * with the name of the namespace. Here, we check that only
+ * "valid" characters are used (as the result must be a valid
+ * filename on most OSes).
+ *
+ * @param entry GtkEntry being edited
+ * @param text the text
+ * @param length length of the text
+ * @param position where the text is being inserted
+ * @param data the builder of the dialog (unused)
+ */
+void
+GNUNET_FS_GTK_create_namespace_insert_text_cb (GtkEntry *entry,
+ const gchar *text,
+ gint length,
+ gint *position,
+ gpointer data)
+{
+ GtkEditable *editable = GTK_EDITABLE(entry);
+ gint i;
+
+ for (i=0; i < length; i++)
+ if ( (! isalnum((int) text[i])) && (text[i] != '_') && (test[i] != "-") )
+ g_signal_stop_emission_by_name (G_OBJECT (editable), "insert_text");
+}
+
+
+/**
* User completed the 'create pseudonym' dialog. Run the desired action.
*
* @param dialog the dialog
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r21978 - in gnunet-gtk: contrib src/fs,
gnunet <=