[Gnome-print] Re: GnomePrintSettings

> ........
> > > layouts for this widgets. One can set a Paper Size that includes a Visual
> > > representation of the  paper, or the orientation in a GtkOptionMenu or
> > > GtkRadio buttons etc..
> > 
> > Hmmm...
> > Why not to use gtktypes here.
> > I.e. gnome_print_settings_new (GtkType type, gps);
> > And every _settings widget should simply implement
> > ::build (GPSWidget * w, GnomePrintSettings * gps)
> > class method for initialization.
> > This would compact API a lot - we will have on single public
> > get_type () method per widget class and very common few base methods.
> > Everything else can be private.
> I am not sure what you mean by this.
> Because the GnomePrintSettings object, is NOT
> a Widget at all. One thing is the GnomePrintSettings object
> and another one the GnomePrintSettingsWidget (which goes
> on the dialog). Apps may use the GnomePrintSettings without
> having to use their widgets, (the widgets will be created
> by gnome-print-admin).

Ah, Understood. But speaking of widgets:
You propoesed to have enumerated types for specifying, which layout you
want. My proposal was, to use derived GtkObjects (GObjects) for each
different layout, and consequentially to use corresponding GtkType for
specifying requested widget (layout).
Cons: More objects, more code
Pros: Cleaner structure, easier extensibility
The actual code snippet would be:
w = gps_widget_new (gps_xxx_get_type, gps)
And it generates specific (type xxx) widget for controlling given
PrintSettings object (gps). xxx is GtkType - can be however specific
or general - and user can implement it's own widgets, if he has acess
to certain set of gps private api.

> > I would instead use:
> > ArtDRect pgrect, vrect;
> > gnome_print_settings_get (gps, "page-size", &pgrect, "printable-size",
> >   &vrect, NULL);
> > gdouble affine[6];
> Hmm. I am not sure we want to get settings like this.
> I would prefer having specific functions for gettting
> info from the GnomePrintSettings. 
> I would go more for something like :
> gnome_print_settings_get_page_size (gps, &pgrect);
> gnome_print_settings_get_printable_size (gps, &vrect);
> gnome_print_settings_get_raster_transform (gps, affine);

Here again we have pro-s and cons. Using GtkArgs have one nice feature
- as arguments are created runtime, we have much smaller API (== shorter
comopilation time).
I think, the best soultion is:
Add methods for widely-used things (page size, resolution, etc...)
Make rarely used (and device specific) things accessible via string keys
(raster affine, device-specific color settings etc.)
So average program can nicely do with convenience methods, but still the
full story is there, if somebody cares.
Othewise I am afraid the number of methods will be very long...  


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]