GNOME Bugzilla – Bug 724347
Inheritance from Gtk.FileFilter
Last modified: 2018-05-22 15:04:27 UTC
Created attachment 269099 [details] Example code It is not possible to create own class which inherits from Gtk.FileFilter. That is because there is no defining of GtkFileFilterClass structure in gtk headers file :( I test this error with both gtk+2.0 and gtk+3.0 package on debian wheezy (Vala 0.16.1) and on debian Jessie (Vala 0.20.1) too.
Ok, assuming that it won't be possible to inherit from FileFilter, why do you want to inherit from it?
As GtkFileFilterClass is hidden, GtkFileFilter is not meant to be subclassed according to GTK+. However, this should be annotated in the bindings such that the Vala compiler can produce a proper error message. See bug 669541.
(In reply to comment #1) > Ok, assuming that it won't be possible to inherit from FileFilter, why do you > want to inherit from it? Because i need add functionality to GtkFileFilter. Identification of it, get / set first or default suffix to auto-adding to filename in GtkFileChooserDialog in SAVE mode, smart constructor etc. At this moment FileFilter and GtkFileChooserDialog is stupid, that never mind for many using. But in SAVE mode, i need do some magic thinks according to which filter is set. Now, i need to store all patterns separately, and check which filter is used to do some post-processing. See to my code, as better example: https://sourceforge.net/p/mmarchitect/code/ci/master/tree/src/export_dialog.vala Now, I'm understand, that is more complex problem with core GTK+ classe, and FileChooser widgets :( So may be, this bug could be set to GTK project...
then I suggest: class YourCustomFilter { ... public FileFilter create_file_filter () { var ff = new FileFilter (); ff.set_data<YourCustomFilter> ("myfilter", this); ... use add_custom or such } }
Thanks a lot, that's nice example, what can i do with GObject in vala. Cool, but it's only hack how can i do better wrapper around class which i can't inherit. May be, I will use this for my solution, but it still like scratching with right hand in left ear around head :(
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/vala/issues/431.