"Fossies" - the Fresh Open Source Software Archive 
Member "glibmm-2.76.0/untracked/gio/giomm/applaunchcontext.h" (12 Mar 2023, 7054 Bytes) of package /linux/misc/glibmm-2.76.0.tar.xz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "applaunchcontext.h" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
2.74.1_vs_2.76.0.
1 // Generated by gmmproc 2.76.0 -- DO NOT MODIFY!
2 #ifndef _GIOMM_APPLAUNCHCONTEXT_H
3 #define _GIOMM_APPLAUNCHCONTEXT_H
4
5
6 #include <glibmm/ustring.h>
7 #include <sigc++/sigc++.h>
8
9 /* Copyright (C) 2007 The gtkmm Development Team
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
23 */
24
25 #include <exception>
26
27 #include <string>
28
29 #include <glibmm/interface.h>
30 #include <glibmm/object.h>
31 //#include <giomm/file.h>
32 #include <giomm/icon.h>
33
34
35 #ifndef DOXYGEN_SHOULD_SKIP_THIS
36 using GAppLaunchContext = struct _GAppLaunchContext;
37 using GAppLaunchContextClass = struct _GAppLaunchContextClass;
38 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
39
40
41 #ifndef DOXYGEN_SHOULD_SKIP_THIS
42 namespace Gio
43 { class GIOMM_API AppLaunchContext_Class; } // namespace Gio
44 #endif //DOXYGEN_SHOULD_SKIP_THIS
45
46 namespace Gio
47 {
48
49 class GIOMM_API AppInfo;
50 class GIOMM_API File;
51
52 /** This is used to handle, for instance, startup notification and launching of the new application on the same screen as the launching window.
53 * See also AppInfo.
54 *
55 * @newin{2,16}
56 */
57
58 class GIOMM_API AppLaunchContext : public Glib::Object
59 {
60
61 #ifndef DOXYGEN_SHOULD_SKIP_THIS
62
63 public:
64 using CppObjectType = AppLaunchContext;
65 using CppClassType = AppLaunchContext_Class;
66 using BaseObjectType = GAppLaunchContext;
67 using BaseClassType = GAppLaunchContextClass;
68
69 // noncopyable
70 AppLaunchContext(const AppLaunchContext&) = delete;
71 AppLaunchContext& operator=(const AppLaunchContext&) = delete;
72
73 private: friend class AppLaunchContext_Class;
74 static CppClassType applaunchcontext_class_;
75
76 protected:
77 explicit AppLaunchContext(const Glib::ConstructParams& construct_params);
78 explicit AppLaunchContext(GAppLaunchContext* castitem);
79
80 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
81
82 public:
83
84 AppLaunchContext(AppLaunchContext&& src) noexcept;
85 AppLaunchContext& operator=(AppLaunchContext&& src) noexcept;
86
87 ~AppLaunchContext() noexcept override;
88
89 /** Get the GType for this class, for use with the underlying GObject type system.
90 */
91 static GType get_type() G_GNUC_CONST;
92
93 #ifndef DOXYGEN_SHOULD_SKIP_THIS
94
95
96 static GType get_base_type() G_GNUC_CONST;
97 #endif
98
99 ///Provides access to the underlying C GObject.
100 GAppLaunchContext* gobj() { return reinterpret_cast<GAppLaunchContext*>(gobject_); }
101
102 ///Provides access to the underlying C GObject.
103 const GAppLaunchContext* gobj() const { return reinterpret_cast<GAppLaunchContext*>(gobject_); }
104
105 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
106 GAppLaunchContext* gobj_copy();
107
108 private:
109
110
111 protected:
112 AppLaunchContext();
113
114 public:
115
116 static Glib::RefPtr<AppLaunchContext> create();
117
118
119 /** Arranges for @a variable to be set to @a value in the child's
120 * environment when @a context is used to launch an application.
121 *
122 * @newin{2,32}
123 *
124 * @param variable The environment variable to set.
125 * @param value The value for to set the variable to.
126 */
127 void setenv(const Glib::ustring& variable, const Glib::ustring& value);
128
129 /** Arranges for @a variable to be unset in the child's environment
130 * when @a context is used to launch an application.
131 *
132 * @newin{2,32}
133 *
134 * @param variable The environment variable to remove.
135 */
136 void unsetenv(const Glib::ustring& variable);
137
138
139 /** Gets the complete environment variable list to be passed to
140 * the child process when @a context is used to launch an application.
141 * This is a <tt>nullptr</tt>-terminated array of strings, where each string has
142 * the form `KEY=VALUE`.
143 *
144 * @newin{2,32}
145 *
146 * @return The child's environment.
147 */
148 std::vector<Glib::ustring> get_environment() const;
149
150
151 /** Gets the display string for the @a context. This is used to ensure new
152 * applications are started on the same display as the launching
153 * application, by setting the `DISPLAY` environment variable.
154 *
155 * @param info A AppInfo.
156 * @param files A List of File objects.
157 * @return A display string for the display.
158 */
159 std::string get_display(const Glib::RefPtr<AppInfo>& info, const std::vector<Glib::RefPtr<Gio::File>>& files);
160
161
162 /** Initiates startup notification for the application and returns the
163 * `XDG_ACTIVATION_TOKEN` or `DESKTOP_STARTUP_ID` for the launched operation,
164 * if supported.
165 *
166 * The returned token may be referred to equivalently as an ‘activation token’
167 * (using Wayland terminology) or a ‘startup sequence ID’ (using X11 terminology).
168 * The two [are interoperable](https://gitlab.freedesktop.org/wayland/wayland-protocols/-/blob/main/staging/xdg-activation/x11-interoperation.rst).
169 *
170 * Activation tokens are defined in the [XDG Activation Protocol](https://wayland.app/protocols/xdg-activation-v1),
171 * and startup notification IDs are defined in the
172 * [freedesktop.org Startup Notification Protocol](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt).
173 *
174 * Support for the XDG Activation Protocol was added in GLib 2.76.
175 *
176 * @param info A AppInfo.
177 * @param files A List of of File objects.
178 * @return A startup notification ID for the application, or <tt>nullptr</tt> if
179 * not supported.
180 */
181 std::string get_startup_notify_id(const Glib::RefPtr<AppInfo>& info, const std::vector<Glib::RefPtr<Gio::File>>& files);
182
183 /** Called when an application has failed to launch, so that it can cancel
184 * the application startup notification started in g_app_launch_context_get_startup_notify_id().
185 *
186 * @param startup_notify_id The startup notification id that was returned by g_app_launch_context_get_startup_notify_id().
187 */
188 void launch_failed(const std::string& startup_notify_id);
189
190
191 public:
192
193 public:
194 //C++ methods used to invoke GTK+ virtual functions:
195
196 protected:
197 //GTK+ Virtual Functions (override these to change behaviour):
198
199 //Default Signal Handlers::
200
201
202 };
203
204 } // namespace Gio
205
206
207 namespace Glib
208 {
209 /** A Glib::wrap() method for this object.
210 *
211 * @param object The C instance.
212 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
213 * @result A C++ instance that wraps this C instance.
214 *
215 * @relates Gio::AppLaunchContext
216 */
217 GIOMM_API
218 Glib::RefPtr<Gio::AppLaunchContext> wrap(GAppLaunchContext* object, bool take_copy = false);
219 }
220
221
222 #endif /* _GIOMM_APPLAUNCHCONTEXT_H */
223