[Gnome-print] The client-side configuration API



Well

I would like to start with standardized client-side configuration API.
It will be
extremely simple (client only needs to tinker settings that are really
meaningful
to it - paper size, number of copies etc.)

So I propose the following thing:

GnomePrintConfig - is an opaque GtkObject.
It encapsulates ALL data relevant to printer, spooler and driver.

conf = gnome_print_config_default ()
conf = gnome_print_config_get (const gchar *configstring)

pc = gnome_print_context_from_config (GnomePrintConfig *conf)

gnome_print_config_set_key (GnomePrintConfig *conf, const gchar *key,
const gchar *value)
const gchar *gnome_print_config_get_key (GnomePrintConfig *conf, const
gchar *key)

Emits signal:
"changed"
void changed (GnomePrintConfig * config, const gchar *key, const gchar
*value)

The logic:

App asks for default print config. Library provides it one.
Now, if App is interested in showing printer/paper/etc. dialogs, it
builds
corresponding widgets, either:
Using stock widgets, giving GnomePrintConfig as an argument
Builds custom widgets, binding "changed" signal, so they can update
themselves,
if config changes.
After showing and closing the dialog, printconfig contains up-to-date
data,
and app can get print context from it.

If you want to implement "select printer" widget in application:
conf = gnome_print_config_default ()
Build your own printer selection widget, binding it to "changed" signal
Later, you can build paper, resolution etc. configuration widget,
using the same conf object.

If you want to know paper size:
Build printer configuration widgets, using conf object.
gnome_print_config_get_key ("Paper/Size") - or something similar

Config can also generated from static string, allowing one to specify
print options on command line.

Keys are probably in form "Domain/Parameter"
All values are strings by default, although we can add convenience
wrappers
around them to get int/double/GnomePaper etc. values.

This can hopefully done without API breakage, deprecating functions like
gnome_print_context_new_with_paper_size in future.

That's all
Comments?

Lauris








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