Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » GTK+
  • » GtkRecentFilter and GtkFileFilter [RSS Feed]

#1 Dec. 11, 2010 05:25:21

Erick P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

GtkRecentFilter and GtkFileFilter


Hi:I was using GtkRecentChooser interface a little a few days ago and I realizeyou can add filters to the list of recent files and realize theGtkRecentFilter class could easily inherit from GtkFileFilterWhy is this not like this ?And more as a suggestion I would add to GtkFileChooser and GtkRecentChooserthe option to apply all filters at once, I mean, when setting to filters one"*.c" and other "*.js" I would like the to view both at the same timewithout the need to build a new filter containing both restrictions.Erick_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#2 Dec. 11, 2010 12:14:52

Emmanuele B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

GtkRecentFilter and GtkFileFilter


On Sat, 2010-12-11 at 00:22 -0300, Erick Pérez Castellanos wrote:
> Hi:
>
> I was using GtkRecentChooser interface a little a few days ago and I realize
> you can add filters to the list of recent files and realize the
> GtkRecentFilter class could easily inherit from GtkFileFilter
> Why is this not like this ?

because the filtering machinery is not available to FileFilter
sub-classes, and it would have to be re-implemented anyway.

> And more as a suggestion I would add to GtkFileChooser and GtkRecentChooser
> the option to apply all filters at once, I mean, when setting to filters one
> "*.c" and other "*.js" I would like the to view both at the same time
> without the need to build a new filter containing both restrictions.

feel free to file a bug.

ciao,
Emmanuele.

--
W:http://www.emmanuelebassi.nameB:http://blogs.gnome.org/ebassi_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#3 Dec. 13, 2010 07:35:44

Erick P.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

GtkRecentFilter and GtkFileFilter


> Hi:
>> I was using GtkRecentChooser interface a little a few days ago and I> realize> you can add filters to the list of recent files and realize the
> GtkRecentFilter class could easily inherit from GtkFileFilter
> Why is this not like this ?

because the filtering machinery is not available to FileFilter
sub-classes, and it would have to be re-implemented anyway.I don't understand what you mean with this._______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

#4 Dec. 13, 2010 09:06:23

Emmanuele B.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

GtkRecentFilter and GtkFileFilter


On Mon, 2010-12-13 at 02:26 -0300, Erick Pérez Castellanos wrote:

> > > I was using GtkRecentChooser interface a little a few days ago and I
> > > realize
> > > you can add filters to the list of recent files and realize the
> > > GtkRecentFilter class could easily inherit from GtkFileFilter
> > > Why is this not like this ?
> >
> > because the filtering machinery is not available to FileFilter
> > sub-classes, and it would have to be re-implemented anyway.
>
> I don't understand what you mean with this.

FileFilter is an opaque object: the instance and class structures are
not public, hence nobody can actually sub-class this type.

though this can be circumvented (at least with some hackery), this would
provide an obstacle when it comes to implementing sub-classes that add
new filter rules and expect them to run along with the ones provided by
the super-class - i.e. I could not simply add a rule to filter recently
used resources described by a GtkRecentInfo to the other rules present
in FileFilter.

one way to fix this would be to make the GtkFileFilter class public,
move the filter function implementation inside an overridable virtual
function, and allow sub-classing.

it could be doable for gtk3, and it would be a minor API deprecation.

the real question is, though, what would happen if I used a sub-class
like GtkRecentFilter inside a GtkFileChooser; obviously it should work,
but it wouldn't make much sense.

+++

sub-classing is not always the good design practice; in this case, the
FileChooser and RecentChooser interfaces delegate the filtering
functionality to a separate class; since a FileChooser and a
RecentChooser have no direct relationship sub-classing their filters
might not be a good idea.

something that could be done if we really wanted a flexible *Chooser
filter would be redesigning the Filter object into a more generic class,
e.g. a GtkResourceFilter, which can filter using a regular expression
(instead of a pattern), a content-type from GIO and maybe a URI scheme;
it would need to be public to allow sub-classes to chain their own
behavior on top of the base one, this way it could be used for all the
*Chooser implementations - including the GtkAppChooser widget that
recently landed in master.

obviously, we're late for gtk+ 3.0 for such a re-design, but I'm pretty
positive that this could be implemented in a backward compatible way for
gtk+ 3.2.

ciao,
Emmanuele.

--
W:http://www.emmanuelebassi.nameB:http://blogs.gnome.org/ebassi_______________________________________________
gtk-list mailing list
gtk-list@gnome.orghttp://mail.gnome.org/mailman/listinfo/gtk-list

Offline

  • Root
  • » GTK+
  • » GtkRecentFilter and GtkFileFilter [RSS Feed]

Board footer

Moderator control

Enjoy the 12th of December
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support