diff options
author | Emmanuele Bassi <ebassi@linux.intel.com> | 2010-06-17 15:41:12 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2010-06-17 15:41:12 +0100 |
commit | 4f357dbf956d2be0249e7f5aec7050ed05ba1b7b (patch) | |
tree | 9618b2d3530f4ae825f8d89b336a92eaab8bb55a /gtk/gtkapplication.h | |
parent | b74fb44c115c61745d691fc2da7aef5505f6eccd (diff) | |
download | gtk+-4f357dbf956d2be0249e7f5aec7050ed05ba1b7b.tar.gz |
application: Allow sub-classes to override the Window creation
Sub-classes of GtkApplication might want to override the way an
application window is created - for instance, to hook into GtkBuilder
or to set up some basic UI or state.
A new GtkApplication::create_window() virtual function is added to the
GtkApplicationClass vtable, which returns the newly created GtkWindow.
The gtk_application_create_window() function calls the vfunc and adds
the returned window to the list of windows managed by the application
instance.
Calling gtk_application_add_window() will also set the default window,
if one is not already set.
This commit also removes a spurious g_object_ref_sink() on the newly
created GtkWindow.
Diffstat (limited to 'gtk/gtkapplication.h')
-rw-r--r-- | gtk/gtkapplication.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gtk/gtkapplication.h b/gtk/gtkapplication.h index dc01b422d9..2a808d77c6 100644 --- a/gtk/gtkapplication.h +++ b/gtk/gtkapplication.h @@ -66,11 +66,12 @@ struct _GtkApplicationClass GApplicationClass parent_class; /*< vfuncs >*/ - void (* activated) (GtkApplication *application, - GVariant *args); - void (* action) (GtkApplication *application, - const gchar *action_name); - gboolean (* quit) (GtkApplication *application); + GtkWindow *(* create_window) (GtkApplication *application); + void (* activated) (GtkApplication *application, + GVariant *args); + void (* action) (GtkApplication *application, + const gchar *action_name); + gboolean (* quit) (GtkApplication *application); /* Padding for future expansion */ @@ -92,6 +93,7 @@ GtkApplication* gtk_application_new (const gchar *appid, gchar ***argv); void gtk_application_set_action_group (GtkApplication *app, GtkActionGroup *group); +GtkWindow * gtk_application_create_window (GtkApplication *app); GtkWindow * gtk_application_get_window (GtkApplication *app); void gtk_application_add_window (GtkApplication *app, GtkWindow *window); |