Re: GTK+ Application class
- From: Rodrigo Moya <rodrigo gnome-db org>
- To: Emmanuele Bassi <ebassi gmail com>
- Cc: GTK Development List <gtk-devel-list gnome org>
- Subject: Re: GTK+ Application class
- Date: Wed, 25 Oct 2006 16:03:06 +0200
On Mon, 2006-10-23 at 14:39 +0100, Emmanuele Bassi wrote:
> Hi everyone;
...
> * API Overview
> ==============
>
> The base cass is GtkApplication - an abstract G_TYPE_OBJECT with a bunch
> of methods to be overridden:
>
> struct _GtkApplicationClass
> {
> GObjectClass parent_class;
> ...
>
> We have a document-based API using these five vfuncs:
>
> ...
> gchar * (*new_document) (GtkApplication *application);
> gboolean (*save_document) (GtkApplication *application,
> const gchar *document_name,
> const gchar *document_uri,
> gboolean save_backup,
> gboolean overwrite,
> GError **error);
> gboolean (*open_document) (GtkApplication *application,
> const gchar *document_uri,
> gboolean read_only,
> GError **error);
> gboolean (*close_document) (GtkApplication *application,
> const gchar *document_name,
> GError **error);
> GSList * (*list_documents) (GtkApplication *application);
> ...
>
> The vfunc signatures should be self-explanatory.
>
> Each document is addressed by a unique id, using a string; newly created
> documents might have a "document-<timestamp>" id string, or a
> "document-<monotonic_counter>" id string; opened documents might use the
> MD5 hash of the document URI. Documents have an unique id because there
> can be multiple views of the same document and we need to keep a list of
> documents as well as windows (and windows for documents) of the
> GtkApplication.
>
> Subclasses of GtkApplication *must* override the new_document,
> save_document and open_document vfuncs; close_document and list_document
> can offer a default implementation (close_document calls save_document
> and if successful will remove the document id from the list of known
> documents, and list_documents returns the list of known document ids).
>
so, who would be calling those vfuncs? Gtkapplication internals? If so,
how? Since below you say the app is responsible for creating the UI, how
does Gtkapplication know Open/Close/Save have been selected?
I would really like to have a more generic GtkApplication object, not
really tied to a window (even though it could perfectly have ways for
binding it to a Window). That way, any app (think GUI daemons, like
power manager, for instance) could use it as a central point of access
to the session management, unique apps, main windows, etc.
--
Rodrigo Moya <rodrigo gnome-db org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]