EntryCompletion work

View: New views
12 Messages — Rating Filter:   Alert me  

EntryCompletion work

by Andrew Cowie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Guillaume sent me an large piece of work going a long way to exposing
EntryCompletion for us.

I gave it a first pass and found it surprisingly meaty. I haven't done a
detailed review the API being presented, per se, but what I saw looked
reasonable. Other experienced java-gnome hackers might care to offer
their views.

My branch from his work is at
bzr://research.operationaldynamics.com/bzr/java-gnome/hackers/andrew/entry-completion/

I've used EntryCompletion from pygtk, so this weekend I'll try porting
that example to java-gnome and see how it goes.

AfC
Sydney



------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
java-gnome-hackers mailing list
java-gnome-hackers@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers

signature.asc (205 bytes) Download Attachment

Re: EntryCompletion work

by Serkan Kaba-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

First of all, I should say that this is *great* work.

gtk_entry_completion_set_match_func can be implemented with custom
signal just as gtk_tree_model_filter_set_visible_func is implemented.

You can examine TreeModelFilter and GtkTreeModelFilterOverride to see
how its implemented.

Handler for cursor-on-match is also missing, I think you know how to
handle the TreeIter by now, so that can also be covered for completeness.

By the way the example works on the whole content of the entry. Is it
possible to hint for multiple words breaking the text with whitespece
characters?

- --
Sincerely,
Serkan KABA
Gentoo Developer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAko32FsACgkQRh6X64ivZaIKFgCdEFCggjgPJ+9tw+B2hNKnrDBD
Y2oAnRutpB9S3fa++JmHxBKnACwWmYr3
=fJgw
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
java-gnome-hackers mailing list
java-gnome-hackers@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers

Re: EntryCompletion work

by Serkan Kaba-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

One more issue I found out, the example doesn't terminate upon closure.
- --
Sincerely,
Serkan KABA
Gentoo Developer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAko32a4ACgkQRh6X64ivZaKx4QCcDfCwOH44Wa/4WI191BY4W4G8
wYgAn1UCoJ29LdV+kOgaqutyJmEcp9Z0
=dAIt
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
java-gnome-hackers mailing list
java-gnome-hackers@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers

Parent Message unknown Re: EntryCompletion work

by Serkan Kaba-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It was forgotton because the signal was introduced in 2.12 and our defs
file was outdated.

- --
Sincerely,
Serkan KABA
Gentoo Developer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAko4YMIACgkQRh6X64ivZaI3sgCfVUx9NJ0U3DBcMCA6OjuUdvh3
uVIAn0bog7Zc7HQYpgttBJbxFW3StAoo
=C9TQ
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
java-gnome-hackers mailing list
java-gnome-hackers@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers

Parent Message unknown EntryCompletion work

by Guillaume Mazoyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm currently working on an implementation of the gtk_entry_completion_set_match_func() function but it still doesn't work. I got a warning during the code compilation and an error about a TreeIter assertion.

Here is the compilation warning:

GCC    src/bindings/org/gnome/gtk/GtkEntryCompletionOverride.c
src/bindings/org/gnome/gtk/GtkEntryCompletionOverride.c: In function ‘Java_org_gnome_gtk_GtkEntryCompletionOverride_gtk_1entry_1completion_1set_1match_1func’:
src/bindings/org/gnome/gtk/GtkEntryCompletionOverride.c:76: attention : passing argument 2 of ‘gtk_entry_completion_set_match_func’ from incompatible pointer type

And now the error when I try to use the implemented signal and methods:

Exception in thread "main" org.gnome.glib.FatalError: Gtk-CRITICAL
gtk_list_store_get_value: assertion `VALID_ITER (iter, list_store)' failed

It appends when it tries to build the completion list so when the match_func is called.
I attach a diff file to make you able to view my change. Maybe someone will find a way to fix the problem.

2009/6/17 Serkan Kaba <serkan@...>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It was forgotton because the signal was introduced in 2.12 and our defs
file was outdated.

- --
Sincerely,
Serkan KABA
Gentoo Developer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAko4YMIACgkQRh6X64ivZaI3sgCfVUx9NJ0U3DBcMCA6OjuUdvh3
uVIAn0bog7Zc7HQYpgttBJbxFW3StAoo
=C9TQ
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
java-gnome-hackers mailing list
java-gnome-hackers@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers



--
Guillaume Mazoyer (Respawner) - http://www.respawner.fr/



--
Guillaume Mazoyer (Respawner) - http://www.respawner.fr/

[completion-match-func.diff]

=== modified file 'src/bindings/org/gnome/gtk/EntryCompletion.java'
--- src/bindings/org/gnome/gtk/EntryCompletion.java 2009-06-19 14:54:25 +0000
+++ src/bindings/org/gnome/gtk/EntryCompletion.java 2009-06-22 17:48:12 +0000
@@ -299,7 +299,6 @@
 
         public boolean onMatchSelected(EntryCompletion source, TreeModel model, TreeIter iter) {
             iter.setModel(model);
-
             return handler.onMatchSelected(source, model, iter);
         }
     }
@@ -460,7 +459,6 @@
 
         public boolean onCursorOnMatch(EntryCompletion source, TreeModel model, TreeIter iter) {
             iter.setModel(model);
-
             return handler.onCursorOnMatch(source, model, iter);
         }
     }
@@ -515,4 +513,85 @@
     public void connect(EntryCompletion.CursorOnMatch handler) {
         GtkEntryCompletion.connect(this, new CursorOnMatchHandler(handler), false);
     }
+
+    /*
+     * This internal class is needed because the TreeIter passed to the
+     * handler does not have the model field properly set, so we need to set
+     * it before passing the TreeIter to the user.
+     */
+    private static class MatchHandler implements GtkEntryCompletion.MatchSignal
+    {
+        private final Match handler;
+
+        private MatchHandler(Match handler) {
+            this.handler = handler;
+        }
+
+        public boolean onMatch(EntryCompletion source, String key, TreeIter iter) {
+            iter.setModel(source.getModel());
+            return handler.onMatch(source, key, iter);
+        }
+    }
+
+    /**
+     * The callback invoked when a EntryCompletion wants to ask if a given row
+     * in the TreeModel should be in the completion list.
+     *
+     * Generally, when you will receive the callback you will reach into the
+     * source's {@link #getModel() model} and query a column by which you will
+     * determine whether or not to include this row. It allows you to a create
+     * a more complex completion behavior into the
+     * <code>EntryCompletion.Match</code> callback. The behavior of a default
+     * EntryCompletion can be written like that:
+     *
+     * <pre>
+     * final DataColumnString column;
+     * final EntryCompletion completion;
+     *
+     * ...
+     *
+     * completion.setMatchCallback(new EntryCompletion.Match() {
+     *     public boolean onMatch(EntryCompletion source, String key, TreeIter iter) {
+     *         final TreeModel model;
+     *         final String text;
+     *
+     *         model = source.getModel();
+     *         text = model.getValue(iter, column);
+     *
+     *         return text.startsWith(key);
+     *     }
+     * });
+     * </pre>
+     *
+     * <p>
+     * <i>If you are researching the GTK API documentation, see
+     * <code>(*GtkEntryCompletionMatchFunc)</code>. Creating and invoking this
+     * "match" signal is how java-gnome has implemented the function pointer
+     * expected by <code>gtk_entry_completion_set_match_func()</code>.</i>
+     *
+     * @since 4.0.12
+     */
+    public interface Match
+    {
+        /**
+         * Tell if a row should be in the completion list or not. Return
+         * <code>true</code> for the row to be included in the list, or
+         * <code>false</code> for the row to be excluded.
+         *
+         * @since 4.0.12
+         */
+        public boolean onMatch(EntryCompletion source, String key, TreeIter iter);
+    }
+
+    /**
+     * Hookup the <code>EntryCompletion.Match</code> callback that will be
+     * used to determine if a row of the associated TreeModel should be in the
+     * completion list.
+     *
+     * @since 4.0.12
+     */
+    public void setMatchCallback(EntryCompletion.Match callback) {
+        GtkEntryCompletionOverride.setMatchFunc(this);
+        GtkEntryCompletion.connect(this, new MatchHandler(callback), false);
+    }
 }

=== added file 'src/bindings/org/gnome/gtk/GtkEntryCompletionOverride.c'
--- src/bindings/org/gnome/gtk/GtkEntryCompletionOverride.c 1970-01-01 00:00:00 +0000
+++ src/bindings/org/gnome/gtk/GtkEntryCompletionOverride.c 2009-06-23 16:10:28 +0000
@@ -0,0 +1,77 @@
+/*
+ * GtkEntryCompletionOverride.c
+ *
+ * Copyright (c) 2009 Operational Dynamics Consulting Pty Ltd
+ *
+ * The code in this file, and the library it is a part of, are made available
+ * to you by the authors under the terms of the "GNU General Public Licence,
+ * version 2" plus the "Classpath Exception" (you may link to this code as a
+ * library into other programs provided you don't make a derivation of it).
+ * See the LICENCE file for the terms governing usage and redistribution.
+ */
+
+#include <jni.h>
+#include <gtk/gtk.h>
+#include "bindings_java.h"
+#include "org_gnome_gtk_GtkEntryCompletionOverride.h"
+#include <gtk/gtkmarshal.h>
+
+static guint signalID = 0;
+
+/*
+ * Meets the signature requirement of (*GtkEntryCompletionMatchFunc) in
+ * order to be the second parameter to the call to
+ * gtk_entry_completion_set_match_func() below.
+ */
+static gboolean
+emit_match
+(
+ GtkEntryCompletion *source,
+ gchar *key,
+ GtkTreeIter *iter,
+ gpointer instance
+)
+{
+ gboolean result;
+
+ g_signal_emit_by_name(GTK_ENTRY_COMPLETION(instance), "match", source, key, iter, &result);
+
+ return result;
+}
+
+/**
+ * called from
+ *   org.gnome.gtk.GtkEntryCompletionOverride.setMatchFunc()
+ * called from
+ *   org.gnome.gtk.EntryCompletion.setMatchCallback()
+ */
+JNIEXPORT void JNICALL
+Java_org_gnome_gtk_GtkEntryCompletionOverride_gtk_1entry_1completion_1set_1match_1func
+(
+ JNIEnv* env,
+ jclass cls,
+ jlong _self
+)
+{
+ GtkEntryCompletion* self;
+
+ // convert parameter self
+ self = (GtkEntryCompletion*) _self;
+
+ if (signalID == 0) {
+ signalID = g_signal_new("match",
+ GTK_TYPE_ENTRY_COMPLETION,
+ G_SIGNAL_ACTION,
+ 0,
+ NULL,
+ NULL,
+ NULL, // note 1
+ G_TYPE_BOOLEAN,
+ 2,    // note 2
+ GTK_TYPE_STRING,
+ GTK_TYPE_TREE_ITER);
+ }
+
+ // call function
+ gtk_entry_completion_set_match_func(self, emit_match, self, NULL);
+}

=== added file 'src/bindings/org/gnome/gtk/GtkEntryCompletionOverride.java'
--- src/bindings/org/gnome/gtk/GtkEntryCompletionOverride.java 1970-01-01 00:00:00 +0000
+++ src/bindings/org/gnome/gtk/GtkEntryCompletionOverride.java 2009-06-22 13:52:17 +0000
@@ -0,0 +1,30 @@
+/*
+ * GtkEntryCompletionOverride.java
+ *
+ * Copyright (c) 2009 Operational Dynamics Consulting Pty Ltd
+ *
+ * The code in this file, and the library it is a part of, are made available
+ * to you by the authors under the terms of the "GNU General Public Licence,
+ * version 2" plus the "Classpath Exception" (you may link to this code as a
+ * library into other programs provided you don't make a derivation of it).
+ * See the LICENCE file for the terms governing usage and redistribution.
+ */
+package org.gnome.gtk;
+
+/**
+ * Manual code allowing us to hookup the EntryCompletion callback function as
+ * if it were a signal.
+ *
+ * @author Guillaume Mazoyer
+ */
+final class GtkEntryCompletionOverride extends Plumbing
+{
+    /**
+     * Manually hookup the function that will emit our custom visible signal.
+     */
+    static final void setMatchFunc(EntryCompletion self) {
+        gtk_entry_completion_set_match_func(pointerOf(self));
+    }
+
+    private static native final void gtk_entry_completion_set_match_func(long self);
+}

=== modified file 'src/defs/GtkEntryCompletion.defs'
--- src/defs/GtkEntryCompletion.defs 2009-06-16 18:43:48 +0000
+++ src/defs/GtkEntryCompletion.defs 2009-06-22 13:50:14 +0000
@@ -231,3 +231,12 @@
   )
 )
 
+(define-virtual match
+  (of-object "GtkEntryCompletion")
+  (return-type "gboolean")
+  (parameters
+    '("const-gchar*" "key")
+    '("GtkTreeIter*" "iter")
+  )
+)
+



------------------------------------------------------------------------------

_______________________________________________
java-gnome-hackers mailing list
java-gnome-hackers@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers

Re: EntryCompletion work

by Serkan Kaba-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Did you try what we have discussed yesterday
a) Defining the signal as having 3 params (I suppose iter is starving at
the end of the parameter list)
b) Dropping the second Entry param in the signal.

- --
Sincerely,
Serkan KABA
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkpCjAkACgkQRh6X64ivZaKDMACcDeUJnsYodZ/jsLSJWu/bHYvS
mHoAn3qvtK+sEpkRLGBcaOfYf07nmgOC
=BX24
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
_______________________________________________
java-gnome-hackers mailing list
java-gnome-hackers@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers

Re: EntryCompletion work

by Andrew Cowie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2009-06-24 at 21:22 +0200, Guillaume Mazoyer wrote:
> I attach a diff

Could you send a patch bundle? [then other people (like me :))] can
merge your branch into their own branches and try and duplicate the
problem — and maybe even contribute a fix.

While you're at it, please make sure to include the unit test that
you're using to exhibit this problem.

++

The type for NULL terminated strings in GLib is G_TYPE_STRING.

++

> src/bindings/org/gnome/gtk/GtkEntryCompletionOverride.c: In function
> ‘Java_org_gnome_gtk_GtkEntryCompletionOverride_gtk_1entry_1completion_1set_1match_1func’:
> src/bindings/org/gnome/gtk/GtkEntryCompletionOverride.c:76:
> attention : passing argument 2 of
> ‘gtk_entry_completion_set_match_func’ from incompatible pointer type

I'm guessing this is coming from

> +       // call function
> +       gtk_entry_completion_set_match_func(self, emit_match, self, NULL);

if so, that means that you've got the signature of emit_match() wrong.
It needs to be (*GtkEntryCompletionMatchFunc) which is

gboolean
something(
        GtkEntryCompletion *completion,
        const gchar *key,
        GtkTreeIter *iter,
        gpointer user_data)
{
}

and you have

+gboolean
+emit_match
+(
+       GtkEntryCompletion *source,
+       gchar *key,
+       GtkTreeIter *iter,
+       gpointer instance
+)

So I'd guess that the missing const qualifier is the reason you're
getting a warning.

++

> + gtk_entry_completion_set_match_func(self, emit_match, self, NULL);

Why are passing "self" as the user_data parameter?

I'm guessing the answer to that is that copy & paste has bit you. The
comment "note 2" in GtkTreeModelFilterOverride.c does not apply here.

So you probably want:

        gtk_entry_completion_set_match_func(self, emit_match, NULL, NULL);

and then I'm guessing:

        g_signal_emit_by_name(source, "match", key, iter, &result);

up above in emit_match(). You will note that what you have now has one
more parameter.

        g_signal_emit_by_name(GTK_ENTRY_COMPLETION(instance), "match", source, key, iter, &result);

which would most certainly cause things to break if wrong.

++

It's things like this that make you begin to appreciate just how
amazingly helpful a static strongly-typed language like Java is. We Java
developers tend not to think about it. But when I try to do the "same"
stuff in C, and you realize what one had to put up with trying to get
signatures and function call arguments right, I really start to
appreciate java-gnome proxying all this crap for me.

As I said on IRC, you didn't pick an easy one. This is probably the most
complicated hand-written override we have. That said, you are probably
now getting a glimmer of why I'm so insistent in reusing the signal
handling code path - imagine going through this parameter nonsense by
hand every time you want to callback from C to Java. No thanks.

AfC
Sydney




------------------------------------------------------------------------------

_______________________________________________
java-gnome-hackers mailing list
java-gnome-hackers@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers

signature.asc (205 bytes) Download Attachment

Re: EntryCompletion work

by Guillaume Mazoyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm still stuck with another problem now. A NULL value is killing the example when I try to select a completion possibility.

Exception in thread "main" org.gnome.glib.FatalError: GLib-GObject-WARNING
invalid (NULL) pointer instance
    at org.gnome.gtk.GtkMain.gtk_main(Native Method)
    at org.gnome.gtk.GtkMain.main(GtkMain.java:57)
    at org.gnome.gtk.Gtk.main(Gtk.java:95)
    at ExampleEntryCompletion.main(ExampleEntryCompletion.java:205)

By the way, just by curiosity, I add a "printf("Key: %s\n", key);" in emit_match() method and I noticed that the signal is emitted (2 * size_of_completion_list). Does someone know why?

The unit-test class is in progress but I do not know how to use the complete() method. I try it also with pygtk and it doesn't seem to work. Did somebody use this method with another GTK library/binding?

2009/6/25 Andrew Cowie <andrew@...>
On Wed, 2009-06-24 at 21:22 +0200, Guillaume Mazoyer wrote:
> I attach a diff

Could you send a patch bundle? [then other people (like me :))] can
merge your branch into their own branches and try and duplicate the
problem — and maybe even contribute a fix.

While you're at it, please make sure to include the unit test that
you're using to exhibit this problem.

++

The type for NULL terminated strings in GLib is G_TYPE_STRING.

++

> src/bindings/org/gnome/gtk/GtkEntryCompletionOverride.c: In function
> ‘Java_org_gnome_gtk_GtkEntryCompletionOverride_gtk_1entry_1completion_1set_1match_1func’:
> src/bindings/org/gnome/gtk/GtkEntryCompletionOverride.c:76:
> attention : passing argument 2 of
> ‘gtk_entry_completion_set_match_func’ from incompatible pointer type

I'm guessing this is coming from

> +       // call function
> +       gtk_entry_completion_set_match_func(self, emit_match, self, NULL);

if so, that means that you've got the signature of emit_match() wrong.
It needs to be (*GtkEntryCompletionMatchFunc) which is

gboolean
something(
       GtkEntryCompletion *completion,
       const gchar *key,
       GtkTreeIter *iter,
       gpointer user_data)
{
}

and you have

+gboolean
+emit_match
+(
+       GtkEntryCompletion *source,
+       gchar *key,
+       GtkTreeIter *iter,
+       gpointer instance
+)

So I'd guess that the missing const qualifier is the reason you're
getting a warning.

++

> + gtk_entry_completion_set_match_func(self, emit_match, self, NULL);

Why are passing "self" as the user_data parameter?

I'm guessing the answer to that is that copy & paste has bit you. The
comment "note 2" in GtkTreeModelFilterOverride.c does not apply here.

So you probably want:

       gtk_entry_completion_set_match_func(self, emit_match, NULL, NULL);

and then I'm guessing:

       g_signal_emit_by_name(source, "match", key, iter, &result);

up above in emit_match(). You will note that what you have now has one
more parameter.

       g_signal_emit_by_name(GTK_ENTRY_COMPLETION(instance), "match", source, key, iter, &result);

which would most certainly cause things to break if wrong.

++

It's things like this that make you begin to appreciate just how
amazingly helpful a static strongly-typed language like Java is. We Java
developers tend not to think about it. But when I try to do the "same"
stuff in C, and you realize what one had to put up with trying to get
signatures and function call arguments right, I really start to
appreciate java-gnome proxying all this crap for me.

As I said on IRC, you didn't pick an easy one. This is probably the most
complicated hand-written override we have. That said, you are probably
now getting a glimmer of why I'm so insistent in reusing the signal
handling code path - imagine going through this parameter nonsense by
hand every time you want to callback from C to Java. No thanks.

AfC
Sydney



------------------------------------------------------------------------------

_______________________________________________
java-gnome-hackers mailing list
java-gnome-hackers@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers




--
Guillaume Mazoyer (Respawner) - http://www.respawner.fr/


------------------------------------------------------------------------------

_______________________________________________
java-gnome-hackers mailing list
java-gnome-hackers@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers

signature.asc (278 bytes) Download Attachment

Re: EntryCompletion work

by Andrew Cowie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Guillaume,

On Thu, 2009-06-25 at 18:21 +0200, Guillaume Mazoyer wrote:

> The unit-test class is in progress but I do not know how to use the
> complete() method. I try it also with pygtk and it doesn't seem to
> work. Did somebody use this method with another GTK library/binding?

I hacked on your test case a bit, and managed to make it pass by chaning
a number of the properties from their defaults and then using
EntryCompletion's insertPrefix().

The interactions aren't clear. Nor is that method. So I don't know _why_
it worked. That's pretty sad, but I thought I'd be honest :)

Can you take what I did and see if you can figure it out? My work
building on yours is (again) on branch 'hackers/andrew/entry-completion'

AfC
Sydney



------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
java-gnome-hackers mailing list
java-gnome-hackers@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers

signature.asc (205 bytes) Download Attachment

Re: EntryCompletion work

by Guillaume Mazoyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey Andrew,

I think I understand how does that "completion" using "complete()" and "insertPrefix()" method works. Actually, I thought that it was the "complete()" method that will complete the entry. But the fact is that, "complete()" just "refresh" the completion list and "insertPrefix()" *do* the completion. I think it's a little bit weird but this is the way it works (tried with pygtk too).

I merged your branch into mine. The only known problem now is the "setMatchCallback()". Completion list is shown correctly but when you choose one of the completion strings the program crashes. Moreover, the custom MatchSignal doesn't not seem to be emitted but "static gboolean emit_match()" is used few times. I'm now lost because of that.


--
Guillaume Mazoyer (Respawner) - http://www.respawner.fr/


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
java-gnome-hackers mailing list
java-gnome-hackers@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers

signature.asc (278 bytes) Download Attachment

Parent Message unknown Re: EntryCompletion work

by Guillaume Mazoyer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I finally know more about insert_prefix() and complete() method of gtk_entry_completion. These methods do *not* allow us to complete the GtkEntry object as we expected. Actuallly, complete() just refresh the completion list, inert_prefix() will just insert the prefix (for Albert and Alice, the prefix will be "Al") and to force the entry to be completed we must send the match_selected signal by hand. So now, the emitMatchSelected(TreeIter) method will do that in the EntryCompletion class. By the way, it fixes the test case. I pushed it into my entry-completion branch which should be ready to be merged now.


--
Guillaume Mazoyer (Respawner) - http://www.respawner.fr/


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
java-gnome-hackers mailing list
java-gnome-hackers@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers

signature.asc (278 bytes) Download Attachment

Re: EntryCompletion work

by Andrew Cowie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 2009-07-20 at 15:03 +0200, Guillaume Mazoyer wrote:
> I pushed it into my entry-completion branch

Merged to 'mainline'.

It was a probably mistake to hold the release up for this, but Guillaume
worked hard on his branch and I wanted to see his work accepted if we
could get it finished. So well done!

This branch was fairly big so I've uploaded a third and final 4.0.12
release candidate. If anyone has any problems, please speak up.

AfC
Sydney


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
java-gnome-hackers mailing list
java-gnome-hackers@...
https://lists.sourceforge.net/lists/listinfo/java-gnome-hackers

signature.asc (205 bytes) Download Attachment