1/*
2 * Copyright © 2011, 2013 Canonical 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
21#ifndef __GTK_APPLICATION_PRIVATE_H__
22#define __GTK_APPLICATION_PRIVATE_H__
23
24#include "gtkapplicationwindow.h"
25#include "gtkwindowprivate.h"
26
27#include "gtkactionmuxerprivate.h"
28#include "gtkapplicationaccelsprivate.h"
29
30G_BEGIN_DECLS
31
32void gtk_application_window_set_id (GtkApplicationWindow *window,
33 guint id);
34GActionGroup * gtk_application_window_get_action_group (GtkApplicationWindow *window);
35void gtk_application_handle_window_realize (GtkApplication *application,
36 GtkWindow *window);
37void gtk_application_handle_window_map (GtkApplication *application,
38 GtkWindow *window);
39GtkActionMuxer * gtk_application_get_parent_muxer_for_window (GtkWindow *window);
40
41GtkActionMuxer * gtk_application_get_action_muxer (GtkApplication *application);
42void gtk_application_insert_action_group (GtkApplication *application,
43 const char *name,
44 GActionGroup *action_group);
45
46GtkApplicationAccels * gtk_application_get_application_accels (GtkApplication *application);
47
48void gtk_application_set_screensaver_active (GtkApplication *application,
49 gboolean active);
50
51#define GTK_TYPE_APPLICATION_IMPL (gtk_application_impl_get_type ())
52#define GTK_APPLICATION_IMPL_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
53 GTK_TYPE_APPLICATION_IMPL, \
54 GtkApplicationImplClass))
55#define GTK_APPLICATION_IMPL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
56 GTK_TYPE_APPLICATION_IMPL, \
57 GtkApplicationImplClass))
58
59typedef struct
60{
61 GObject parent_instance;
62 GtkApplication *application;
63 GdkDisplay *display;
64} GtkApplicationImpl;
65
66typedef struct
67{
68 GObjectClass parent_class;
69
70 void (* startup) (GtkApplicationImpl *impl,
71 gboolean register_session);
72 void (* shutdown) (GtkApplicationImpl *impl);
73
74 void (* before_emit) (GtkApplicationImpl *impl,
75 GVariant *platform_data);
76
77 void (* window_added) (GtkApplicationImpl *impl,
78 GtkWindow *window);
79 void (* window_removed) (GtkApplicationImpl *impl,
80 GtkWindow *window);
81 void (* active_window_changed) (GtkApplicationImpl *impl,
82 GtkWindow *window);
83 void (* handle_window_realize) (GtkApplicationImpl *impl,
84 GtkWindow *window);
85 void (* handle_window_map) (GtkApplicationImpl *impl,
86 GtkWindow *window);
87
88 void (* set_app_menu) (GtkApplicationImpl *impl,
89 GMenuModel *app_menu);
90 void (* set_menubar) (GtkApplicationImpl *impl,
91 GMenuModel *menubar);
92
93 guint (* inhibit) (GtkApplicationImpl *impl,
94 GtkWindow *window,
95 GtkApplicationInhibitFlags flags,
96 const char *reason);
97 void (* uninhibit) (GtkApplicationImpl *impl,
98 guint cookie);
99 gboolean (* is_inhibited) (GtkApplicationImpl *impl,
100 GtkApplicationInhibitFlags flags);
101
102 gboolean (* prefers_app_menu) (GtkApplicationImpl *impl);
103
104
105} GtkApplicationImplClass;
106
107#define GTK_TYPE_APPLICATION_IMPL_DBUS (gtk_application_impl_dbus_get_type ())
108#define GTK_APPLICATION_IMPL_DBUS_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
109 GTK_TYPE_APPLICATION_IMPL_DBUS, \
110 GtkApplicationImplDBusClass))
111#define GTK_APPLICATION_IMPL_DBUS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
112 GTK_TYPE_APPLICATION_IMPL_DBUS, \
113 GtkApplicationImplDBusClass))
114
115typedef struct
116{
117 GtkApplicationImpl impl;
118
119 GDBusConnection *session;
120
121 const char *application_id;
122 const char *unique_name;
123 const char *object_path;
124
125 char *app_menu_path;
126 guint app_menu_id;
127
128 char *menubar_path;
129 guint menubar_id;
130
131 /* Session management... */
132 GDBusProxy *sm_proxy;
133 GDBusProxy *client_proxy;
134 char *client_path;
135 GDBusProxy *ss_proxy;
136
137 /* Portal support */
138 GDBusProxy *inhibit_proxy;
139 GSList *inhibit_handles;
140 guint state_changed_handler;
141 char * session_id;
142 guint session_state;
143} GtkApplicationImplDBus;
144
145typedef struct
146{
147 GtkApplicationImplClass parent_class;
148
149 /* returns floating */
150 GVariant * (* get_window_system_id) (GtkApplicationImplDBus *dbus,
151 GtkWindow *window);
152} GtkApplicationImplDBusClass;
153
154GType gtk_application_impl_get_type (void);
155GType gtk_application_impl_dbus_get_type (void);
156GType gtk_application_impl_x11_get_type (void);
157GType gtk_application_impl_wayland_get_type (void);
158GType gtk_application_impl_quartz_get_type (void);
159
160GtkApplicationImpl * gtk_application_impl_new (GtkApplication *application,
161 GdkDisplay *display);
162void gtk_application_impl_startup (GtkApplicationImpl *impl,
163 gboolean register_sesion);
164void gtk_application_impl_shutdown (GtkApplicationImpl *impl);
165void gtk_application_impl_before_emit (GtkApplicationImpl *impl,
166 GVariant *platform_data);
167void gtk_application_impl_window_added (GtkApplicationImpl *impl,
168 GtkWindow *window);
169void gtk_application_impl_window_removed (GtkApplicationImpl *impl,
170 GtkWindow *window);
171void gtk_application_impl_active_window_changed (GtkApplicationImpl *impl,
172 GtkWindow *window);
173void gtk_application_impl_handle_window_realize (GtkApplicationImpl *impl,
174 GtkWindow *window);
175void gtk_application_impl_handle_window_map (GtkApplicationImpl *impl,
176 GtkWindow *window);
177void gtk_application_impl_set_app_menu (GtkApplicationImpl *impl,
178 GMenuModel *app_menu);
179void gtk_application_impl_set_menubar (GtkApplicationImpl *impl,
180 GMenuModel *menubar);
181guint gtk_application_impl_inhibit (GtkApplicationImpl *impl,
182 GtkWindow *window,
183 GtkApplicationInhibitFlags flags,
184 const char *reason);
185void gtk_application_impl_uninhibit (GtkApplicationImpl *impl,
186 guint cookie);
187gboolean gtk_application_impl_is_inhibited (GtkApplicationImpl *impl,
188 GtkApplicationInhibitFlags flags);
189
190char * gtk_application_impl_dbus_get_window_path (GtkApplicationImplDBus *dbus,
191 GtkWindow *window);
192gboolean gtk_application_impl_prefers_app_menu (GtkApplicationImpl *impl);
193
194
195void gtk_application_impl_quartz_setup_menu (GMenuModel *model,
196 GtkActionMuxer *muxer);
197
198G_END_DECLS
199
200#endif /* __GTK_APPLICATION_PRIVATE_H__ */
201

source code of gtk/gtk/gtkapplicationprivate.h