[mlview-list] patch for bug 152629



Hello,

I created bug 152629 and also has made some little patch for it.
I do not want to put this patch on bugzilla because I think it is
not good enough.

No I only check when the user presses a space and if it is, ignore this
key. I think the approach is good (?) but I am looking for a different
way of checking the different invalid keys.


regards,

Bart 


--- orig/src/mlview-editor.c
+++ mod/src/mlview-editor.c
@@ -194,6 +194,7 @@
 
 static void mlview_editor_dispose (GObject *a_this) ;
 
+static gint strange_characters( GtkWidget *widget,GdkEventKey * event, gpointer data);
 
 
 static GtkVBoxClass *gv_parent_class = NULL;
@@ -1874,6 +1875,9 @@
         entry = gtk_entry_new ();
         gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
 
+	gtk_signal_connect(GTK_OBJECT(entry), "key_press_event",
+             (GtkSignalFunc) strange_characters, entry);
+
         gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
         gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
         gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
@@ -3033,3 +3037,17 @@
 
         return mlview_xml_document_can_redo_mutation (mlview_xml_doc) ;
 }
+
+static gint strange_characters( GtkWidget *widget,GdkEventKey * event, gpointer data)
+{
+	gchar *t=NULL;
+	
+	if (event && event->string){
+		/* Try to use a different method to check for valid 
+		   characters */
+		if (g_ascii_strncasecmp(event->string," ",1) == 0){
+			return TRUE;
+		}
+	}
+	return FALSE;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]