After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 724347 - Inheritance from Gtk.FileFilter
Inheritance from Gtk.FileFilter
Status: RESOLVED OBSOLETE
Product: vala
Classification: Core
Component: Bindings: GTK+ GStreamer WebKitGTK+
0.16.x
Other Linux
: Normal minor
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on: 669541
Blocks:
 
 
Reported: 2014-02-14 09:02 UTC by Ondřej Tůma
Modified: 2018-05-22 15:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Example code (283 bytes, application/octet-stream)
2014-02-14 09:02 UTC, Ondřej Tůma
Details

Description Ondřej Tůma 2014-02-14 09:02:50 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.
Comment 1 Luca Bruno 2014-02-14 09:11:09 UTC
Ok, assuming that it won't be possible to inherit from FileFilter, why do you want to inherit from it?
Comment 2 Jürg Billeter 2014-02-14 09:17:04 UTC
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.
Comment 3 Ondřej Tůma 2014-02-14 13:28:54 UTC
(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...
Comment 4 Luca Bruno 2014-02-14 13:42:46 UTC
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
   }
}
Comment 5 Ondřej Tůma 2014-02-14 15:09:23 UTC
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 :(
Comment 6 GNOME Infrastructure Team 2018-05-22 15:04:27 UTC
-- 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.