Re: gtk-app-devel-list Digest, Vol 81, Issue 20

2011-01-20 Thread craigbakalian
Hi,

I did some hacking into this.  If you want a simple form of completion
you can use the following implementation-

#include gtksourceview/gtksourcecompletion.h
#include gtksourceview/gtksourcecompletioninfo.h
#include gtksourceview/gtksourcecompletionitem.h
#include
gtksourceview/completion-providers/words/gtksourcecompletionwords.h

GtkSourceCompletionWords *prov_words;

comp = gtk_source_view_get_completion (GTK_SOURCE_VIEW (textview));

prov_words = gtk_source_completion_words_new (NULL, NULL);

gtk_source_completion_words_register (prov_words,
  gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview)));

gtk_source_completion_add_provider (comp,
  GTK_SOURCE_COMPLETION_PROVIDER (prov_words)NULL);

I added more than needed #includes above for safety. You may want to
test the code and remove some of them. If you want to make a more
complex you have to build your own provider from scratch with a
structure, create it as an object and pass it into
gtk_source_completion_add_provider, because GtkSourceCompletionProvider
has no constructor, which is weird.

Craig Bakalian


On Wed, 2011-01-19 at 12:00 +, gtk-app-devel-list-requ...@gnome.org
wrote:
 As far as I can see GtkSourceCompletion is not obsolete, it has just
 become
 part of the GtkSourceView library.
 See here: http://library.gnome.org/devel/gtksourceview/stable/
 
 I also started looking for the examples of its usage.
 You can find an example in GtkSourceView code itself and in Anjuta
 code.
 But I agree, there is no good example out there.
 
 Documentation is also quite terse, and it is not clear on what needs
 to be 
 done
 to have your custom implementation, passing your own word list for
 example.
 GtkSourceView provides sample completion provider named 
 gtksourcecompletionwords,
 but it is undocumented, so it seems it will need effort to use this.
 
 Regards,
   Miroslav 

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: gtk-app-devel-list Digest, Vol 81, Issue 20

2011-01-20 Thread Miroslav Rajcic
It appears that GtkSourceCompletionWords provider grabs the words that exist 
in your text view
and offers one of those as completion suggestion once you type a similar 
word.
Correct me if I am wrong, but this is my experience with almost exact code 
as the one you are using.
And the fact that GtkSourceCompletionWords is completely undocumented 
doesn't help either :)


Basically, this makes it unusable as a provider of a predefined list of 
works.


Regards,
 Miroslav

- Original Message - 
From: craigbakalian craigbakal...@verizon.net

To: gtk-app-devel-list@gnome.org
Sent: Thursday, January 20, 2011 9:45 AM
Subject: Re: gtk-app-devel-list Digest, Vol 81, Issue 20



Hi,

I did some hacking into this.  If you want a simple form of completion
you can use the following implementation-

#include gtksourceview/gtksourcecompletion.h
#include gtksourceview/gtksourcecompletioninfo.h
#include gtksourceview/gtksourcecompletionitem.h
#include
gtksourceview/completion-providers/words/gtksourcecompletionwords.h

GtkSourceCompletionWords *prov_words;

comp = gtk_source_view_get_completion (GTK_SOURCE_VIEW (textview));

prov_words = gtk_source_completion_words_new (NULL, NULL);

gtk_source_completion_words_register (prov_words,
 gtk_text_view_get_buffer (GTK_TEXT_VIEW (textview)));

gtk_source_completion_add_provider (comp,
 GTK_SOURCE_COMPLETION_PROVIDER (prov_words)NULL);

I added more than needed #includes above for safety. You may want to
test the code and remove some of them. If you want to make a more
complex you have to build your own provider from scratch with a
structure, create it as an object and pass it into
gtk_source_completion_add_provider, because GtkSourceCompletionProvider
has no constructor, which is weird.

Craig Bakalian


On Wed, 2011-01-19 at 12:00 +, gtk-app-devel-list-requ...@gnome.org
wrote:

As far as I can see GtkSourceCompletion is not obsolete, it has just
become
part of the GtkSourceView library.
See here: http://library.gnome.org/devel/gtksourceview/stable/

I also started looking for the examples of its usage.
You can find an example in GtkSourceView code itself and in Anjuta
code.
But I agree, there is no good example out there.

Documentation is also quite terse, and it is not clear on what needs
to be
done
to have your custom implementation, passing your own word list for
example.
GtkSourceView provides sample completion provider named
gtksourcecompletionwords,
but it is undocumented, so it seems it will need effort to use this.

Regards,
  Miroslav


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

__ Information from ESET NOD32 Antivirus, version of virus 
signature database 5801 (20110119) __


The message was checked by ESET NOD32 Antivirus.

http://www.eset.com





___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Problem in gtk_combo_box_append_text()

2011-01-20 Thread Karthikeyan Krishnamurthi
Hi group,

   I try to append text to combo box using gtk_combo_box_append_text () i
got the following error...

gtk_combo_box_append_text: assertion `GTK_IS_LIST_STORE
(combo_box-priv-model)' failed

 how to solve this..

I am using anjuta 2.32.0



-- 
Thanks  Regards
K. Karthikeyan,
9245530270.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Problem in gtk_combo_box_append_text()

2011-01-20 Thread Murray Cumming
On Thu, 2011-01-20 at 16:37 +0530, Karthikeyan Krishnamurthi wrote:
 Hi group,
 
I try to append text to combo box using gtk_combo_box_append_text () i
 got the following error...
 
 gtk_combo_box_append_text: assertion `GTK_IS_LIST_STORE
 (combo_box-priv-model)' failed
 
  how to solve this..
 
 I am using anjuta 2.32.0

Maybe you did not create the GtkComboBox with gtk_combo_box_new_text():
http://library.gnome.org/devel/gtk/stable/GtkComboBox.html#gtk-combo-box-append-text

(This will be simpler in GTK+ 3.)

-- 
murr...@murrayc.com
www.murrayc.com
www.openismus.com

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list