| 1 | /* |
| 2 | * Copyright © 2010 Codethink Limited |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Lesser General Public |
| 6 | * License as published by the Free Software Foundation; either |
| 7 | * version 2 of the licence, or (at your option) any later version. |
| 8 | * |
| 9 | * This library is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | * Lesser General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Lesser General Public |
| 15 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 16 | * |
| 17 | * Author: Ryan Lortie <desrt@desrt.ca> |
| 18 | */ |
| 19 | |
| 20 | #ifndef __GTK_APPLICATION_H__ |
| 21 | #define __GTK_APPLICATION_H__ |
| 22 | |
| 23 | #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) |
| 24 | #error "Only <gtk/gtk.h> can be included directly." |
| 25 | #endif |
| 26 | |
| 27 | #include <gtk/gtkwidget.h> |
| 28 | #include <gio/gio.h> |
| 29 | |
| 30 | G_BEGIN_DECLS |
| 31 | |
| 32 | #define GTK_TYPE_APPLICATION (gtk_application_get_type ()) |
| 33 | #define GTK_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_APPLICATION, GtkApplication)) |
| 34 | #define GTK_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_APPLICATION, GtkApplicationClass)) |
| 35 | #define GTK_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_APPLICATION)) |
| 36 | #define GTK_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_APPLICATION)) |
| 37 | #define GTK_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_APPLICATION, GtkApplicationClass)) |
| 38 | |
| 39 | typedef struct _GtkApplication GtkApplication; |
| 40 | typedef struct _GtkApplicationClass GtkApplicationClass; |
| 41 | typedef struct _GtkApplicationPrivate GtkApplicationPrivate; |
| 42 | |
| 43 | struct _GtkApplication |
| 44 | { |
| 45 | GApplication parent; |
| 46 | |
| 47 | /*< private >*/ |
| 48 | GtkApplicationPrivate *priv; |
| 49 | }; |
| 50 | |
| 51 | /** |
| 52 | * GtkApplicationClass: |
| 53 | * @parent_class: The parent class. |
| 54 | * @window_added: Signal emitted when a #GtkWindow is added to |
| 55 | * application through gtk_application_add_window(). |
| 56 | * @window_removed: Signal emitted when a #GtkWindow is removed from |
| 57 | * application, either as a side-effect of being destroyed or |
| 58 | * explicitly through gtk_application_remove_window(). |
| 59 | */ |
| 60 | struct _GtkApplicationClass |
| 61 | { |
| 62 | GApplicationClass parent_class; |
| 63 | |
| 64 | /*< public >*/ |
| 65 | |
| 66 | void (*window_added) (GtkApplication *application, |
| 67 | GtkWindow *window); |
| 68 | void (*window_removed) (GtkApplication *application, |
| 69 | GtkWindow *window); |
| 70 | |
| 71 | /*< private >*/ |
| 72 | gpointer padding[12]; |
| 73 | }; |
| 74 | |
| 75 | GDK_AVAILABLE_IN_ALL |
| 76 | GType gtk_application_get_type (void) G_GNUC_CONST; |
| 77 | |
| 78 | GDK_AVAILABLE_IN_ALL |
| 79 | GtkApplication * gtk_application_new (const gchar *application_id, |
| 80 | GApplicationFlags flags); |
| 81 | |
| 82 | GDK_AVAILABLE_IN_ALL |
| 83 | void gtk_application_add_window (GtkApplication *application, |
| 84 | GtkWindow *window); |
| 85 | |
| 86 | GDK_AVAILABLE_IN_ALL |
| 87 | void gtk_application_remove_window (GtkApplication *application, |
| 88 | GtkWindow *window); |
| 89 | GDK_AVAILABLE_IN_ALL |
| 90 | GList * gtk_application_get_windows (GtkApplication *application); |
| 91 | |
| 92 | GDK_AVAILABLE_IN_3_4 |
| 93 | GMenuModel * (GtkApplication *application); |
| 94 | GDK_AVAILABLE_IN_3_4 |
| 95 | void (GtkApplication *application, |
| 96 | GMenuModel *); |
| 97 | |
| 98 | GDK_AVAILABLE_IN_3_4 |
| 99 | GMenuModel * (GtkApplication *application); |
| 100 | GDK_AVAILABLE_IN_3_4 |
| 101 | void (GtkApplication *application, |
| 102 | GMenuModel *); |
| 103 | |
| 104 | GDK_DEPRECATED_IN_3_14_FOR(gtk_application_set_accels_for_action) |
| 105 | void gtk_application_add_accelerator (GtkApplication *application, |
| 106 | const gchar *accelerator, |
| 107 | const gchar *action_name, |
| 108 | GVariant *parameter); |
| 109 | |
| 110 | GDK_DEPRECATED_IN_3_14_FOR(gtk_application_set_accels_for_action) |
| 111 | void gtk_application_remove_accelerator (GtkApplication *application, |
| 112 | const gchar *action_name, |
| 113 | GVariant *parameter); |
| 114 | |
| 115 | typedef enum |
| 116 | { |
| 117 | GTK_APPLICATION_INHIBIT_LOGOUT = (1 << 0), |
| 118 | GTK_APPLICATION_INHIBIT_SWITCH = (1 << 1), |
| 119 | GTK_APPLICATION_INHIBIT_SUSPEND = (1 << 2), |
| 120 | GTK_APPLICATION_INHIBIT_IDLE = (1 << 3) |
| 121 | } GtkApplicationInhibitFlags; |
| 122 | |
| 123 | GDK_AVAILABLE_IN_3_4 |
| 124 | guint gtk_application_inhibit (GtkApplication *application, |
| 125 | GtkWindow *window, |
| 126 | GtkApplicationInhibitFlags flags, |
| 127 | const gchar *reason); |
| 128 | GDK_AVAILABLE_IN_3_4 |
| 129 | void gtk_application_uninhibit (GtkApplication *application, |
| 130 | guint cookie); |
| 131 | GDK_AVAILABLE_IN_3_4 |
| 132 | gboolean gtk_application_is_inhibited (GtkApplication *application, |
| 133 | GtkApplicationInhibitFlags flags); |
| 134 | |
| 135 | GDK_AVAILABLE_IN_3_6 |
| 136 | GtkWindow * gtk_application_get_window_by_id (GtkApplication *application, |
| 137 | guint id); |
| 138 | |
| 139 | GDK_AVAILABLE_IN_3_6 |
| 140 | GtkWindow * gtk_application_get_active_window (GtkApplication *application); |
| 141 | |
| 142 | GDK_AVAILABLE_IN_3_12 |
| 143 | gchar ** gtk_application_list_action_descriptions (GtkApplication *application); |
| 144 | |
| 145 | GDK_AVAILABLE_IN_3_12 |
| 146 | gchar ** gtk_application_get_accels_for_action (GtkApplication *application, |
| 147 | const gchar *detailed_action_name); |
| 148 | GDK_AVAILABLE_IN_3_14 |
| 149 | gchar ** gtk_application_get_actions_for_accel (GtkApplication *application, |
| 150 | const gchar *accel); |
| 151 | |
| 152 | |
| 153 | GDK_AVAILABLE_IN_3_12 |
| 154 | void gtk_application_set_accels_for_action (GtkApplication *application, |
| 155 | const gchar *detailed_action_name, |
| 156 | const gchar * const *accels); |
| 157 | |
| 158 | GDK_AVAILABLE_IN_3_14 |
| 159 | gboolean (GtkApplication *application); |
| 160 | |
| 161 | GDK_AVAILABLE_IN_3_14 |
| 162 | GMenu * (GtkApplication *application, |
| 163 | const gchar *id); |
| 164 | |
| 165 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkApplication, g_object_unref) |
| 166 | |
| 167 | G_END_DECLS |
| 168 | |
| 169 | #endif /* __GTK_APPLICATION_H__ */ |
| 170 | |