From 1ae257d00a2921f903048777664f1f171ff24c9b Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 7 Jun 2010 16:44:58 -0400 Subject: Add GtkApplication This is a work in progress to stub out an application class. The primary goal is to provide a mechanism for applications to export GtkActions, and there is a standard "Quit" action. This is based on GApplication. Future work: * Add a way to say "This is my application menubar", which gets put into all toplevel windows on non-OS-X, and into the top on OS X. * Support session management. * Support application settings. https://bugzilla.gnome.org/show_bug.cgi?id=127958 --- gtk/gtkapplication.h | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 gtk/gtkapplication.h (limited to 'gtk/gtkapplication.h') diff --git a/gtk/gtkapplication.h b/gtk/gtkapplication.h new file mode 100644 index 0000000000..6581bcd923 --- /dev/null +++ b/gtk/gtkapplication.h @@ -0,0 +1,100 @@ +/* GTK - The GIMP Toolkit + * + * Copyright (C) 2010 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Colin Walters + */ + +/* + * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS + * file for a list of people on the GTK+ Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GTK+ at ftp://ftp.gtk.org/pub/gtk/. + */ + +#if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __GTK_APPLICATION_H__ +#define __GTK_APPLICATION_H__ + +#include +#include +#include +#include + +G_BEGIN_DECLS + +#define GTK_TYPE_APPLICATION (gtk_application_get_type ()) +#define GTK_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_APPLICATION, GtkApplication)) +#define GTK_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_APPLICATION, GtkApplicationClass)) +#define GTK_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_APPLICATION)) +#define GTK_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_APPLICATION)) +#define GTK_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_APPLICATION, GtkApplicationClass)) + +typedef struct _GtkApplication GtkApplication; +typedef struct _GtkApplicationClass GtkApplicationClass; +typedef struct _GtkApplicationPrivate GtkApplicationPrivate; + +struct _GtkApplication +{ + GApplication parent; + + /*< private >*/ + + GtkApplicationPrivate *priv; +}; + +struct _GtkApplicationClass +{ + GApplicationClass parent_class; + + /*< vfuncs >*/ + void (* activated) (GApplication *application, + GVariant *args); + + /* Padding for future expansion */ + void (*_gtk_reserved1) (void); + void (*_gtk_reserved2) (void); + void (*_gtk_reserved3) (void); + void (*_gtk_reserved4) (void); + void (*_gtk_reserved5) (void); + void (*_gtk_reserved6) (void); + void (*_gtk_reserved7) (void); + void (*_gtk_reserved8) (void); + void (*_gtk_reserved9) (void); + void (*_gtk_reserved10) (void); +}; + +GType gtk_application_get_type (void) G_GNUC_CONST; +GtkApplication* gtk_application_new (gint *argc, + gchar ***argv, + const gchar *appid); +void gtk_application_set_action_group (GtkApplication *app, + GtkActionGroup *group); +GtkWindow * gtk_application_get_window (GtkApplication *app); +void gtk_application_add_window (GtkApplication *app, + GtkWindow *window); +void gtk_application_run (GtkApplication *app); +void gtk_application_quit (GtkApplication *app); + +G_END_DECLS + +#endif /* __GTK_APPLICATION_H__ */ + -- cgit v1.2.1