/usr/include/d/gtkd-3/gio/AppLaunchContext.d is in libgtkd-3-dev 3.7.5-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | /*
* This file is part of gtkD.
*
* gtkD 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 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD 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 gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module gio.AppLaunchContext;
private import gio.AppInfoIF;
private import gio.FileIF;
private import gio.c.functions;
public import gio.c.types;
private import glib.ConstructionException;
private import glib.ListG;
private import glib.Str;
private import glib.Variant;
private import gobject.ObjectG;
private import gobject.Signals;
public import gtkc.giotypes;
private import std.algorithm;
/**
* Integrating the launch with the launching application. This is used to
* handle for instance startup notification and launching the new application
* on the same screen as the launching window.
*/
public class AppLaunchContext : ObjectG
{
/** the main Gtk struct */
protected GAppLaunchContext* gAppLaunchContext;
/** Get the main Gtk struct */
public GAppLaunchContext* getAppLaunchContextStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gAppLaunchContext;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gAppLaunchContext;
}
protected override void setStruct(GObject* obj)
{
gAppLaunchContext = cast(GAppLaunchContext*)obj;
super.setStruct(obj);
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GAppLaunchContext* gAppLaunchContext, bool ownedRef = false)
{
this.gAppLaunchContext = gAppLaunchContext;
super(cast(GObject*)gAppLaunchContext, ownedRef);
}
/** */
public static GType getType()
{
return g_app_launch_context_get_type();
}
/**
* Creates a new application launch context. This is not normally used,
* instead you instantiate a subclass of this, such as #GdkAppLaunchContext.
*
* Returns: a #GAppLaunchContext.
*
* Throws: ConstructionException GTK+ fails to create the object.
*/
public this()
{
auto p = g_app_launch_context_new();
if(p is null)
{
throw new ConstructionException("null returned by new");
}
this(cast(GAppLaunchContext*) p, true);
}
/**
* Gets the display string for the @context. This is used to ensure new
* applications are started on the same display as the launching
* application, by setting the `DISPLAY` environment variable.
*
* Params:
* info = a #GAppInfo
* files = a #GList of #GFile objects
*
* Returns: a display string for the display.
*/
public string getDisplay(AppInfoIF info, ListG files)
{
auto retStr = g_app_launch_context_get_display(gAppLaunchContext, (info is null) ? null : info.getAppInfoStruct(), (files is null) ? null : files.getListGStruct());
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Gets the complete environment variable list to be passed to
* the child process when @context is used to launch an application.
* This is a %NULL-terminated array of strings, where each string has
* the form `KEY=VALUE`.
*
* Returns: the
* child's environment
*
* Since: 2.32
*/
public string[] getEnvironment()
{
auto retStr = g_app_launch_context_get_environment(gAppLaunchContext);
scope(exit) Str.freeStringArray(retStr);
return Str.toStringArray(retStr);
}
/**
* Initiates startup notification for the application and returns the
* `DESKTOP_STARTUP_ID` for the launched operation, if supported.
*
* Startup notification IDs are defined in the
* [FreeDesktop.Org Startup Notifications standard](http://standards.freedesktop.org/startup-notification-spec/startup-notification-latest.txt").
*
* Params:
* info = a #GAppInfo
* files = a #GList of of #GFile objects
*
* Returns: a startup notification ID for the application, or %NULL if
* not supported.
*/
public string getStartupNotifyId(AppInfoIF info, ListG files)
{
auto retStr = g_app_launch_context_get_startup_notify_id(gAppLaunchContext, (info is null) ? null : info.getAppInfoStruct(), (files is null) ? null : files.getListGStruct());
scope(exit) Str.freeString(retStr);
return Str.toString(retStr);
}
/**
* Called when an application has failed to launch, so that it can cancel
* the application startup notification started in g_app_launch_context_get_startup_notify_id().
*
* Params:
* startupNotifyId = the startup notification id that was returned by g_app_launch_context_get_startup_notify_id().
*/
public void launchFailed(string startupNotifyId)
{
g_app_launch_context_launch_failed(gAppLaunchContext, Str.toStringz(startupNotifyId));
}
/**
* Arranges for @variable to be set to @value in the child's
* environment when @context is used to launch an application.
*
* Params:
* variable = the environment variable to set
* value = the value for to set the variable to.
*
* Since: 2.32
*/
public void setenv(string variable, string value)
{
g_app_launch_context_setenv(gAppLaunchContext, Str.toStringz(variable), Str.toStringz(value));
}
/**
* Arranges for @variable to be unset in the child's environment
* when @context is used to launch an application.
*
* Params:
* variable = the environment variable to remove
*
* Since: 2.32
*/
public void unsetenv(string variable)
{
g_app_launch_context_unsetenv(gAppLaunchContext, Str.toStringz(variable));
}
protected class OnLaunchFailedDelegateWrapper
{
void delegate(string, AppLaunchContext) dlg;
gulong handlerId;
this(void delegate(string, AppLaunchContext) dlg)
{
this.dlg = dlg;
onLaunchFailedListeners ~= this;
}
void remove(OnLaunchFailedDelegateWrapper source)
{
foreach(index, wrapper; onLaunchFailedListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onLaunchFailedListeners[index] = null;
onLaunchFailedListeners = std.algorithm.remove(onLaunchFailedListeners, index);
break;
}
}
}
}
OnLaunchFailedDelegateWrapper[] onLaunchFailedListeners;
/**
* The ::launch-failed signal is emitted when a #GAppInfo launch
* fails. The startup notification id is provided, so that the launcher
* can cancel the startup notification.
*
* Params:
* startupNotifyId = the startup notification id for the failed launch
*
* Since: 2.36
*/
gulong addOnLaunchFailed(void delegate(string, AppLaunchContext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnLaunchFailedDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"launch-failed",
cast(GCallback)&callBackLaunchFailed,
cast(void*)wrapper,
cast(GClosureNotify)&callBackLaunchFailedDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackLaunchFailed(GAppLaunchContext* applaunchcontextStruct, char* startupNotifyId, OnLaunchFailedDelegateWrapper wrapper)
{
wrapper.dlg(Str.toString(startupNotifyId), wrapper.outer);
}
extern(C) static void callBackLaunchFailedDestroy(OnLaunchFailedDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnLaunchedDelegateWrapper
{
void delegate(AppInfoIF, Variant, AppLaunchContext) dlg;
gulong handlerId;
this(void delegate(AppInfoIF, Variant, AppLaunchContext) dlg)
{
this.dlg = dlg;
onLaunchedListeners ~= this;
}
void remove(OnLaunchedDelegateWrapper source)
{
foreach(index, wrapper; onLaunchedListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onLaunchedListeners[index] = null;
onLaunchedListeners = std.algorithm.remove(onLaunchedListeners, index);
break;
}
}
}
}
OnLaunchedDelegateWrapper[] onLaunchedListeners;
/**
* The ::launched signal is emitted when a #GAppInfo is successfully
* launched. The @platform_data is an GVariant dictionary mapping
* strings to variants (ie a{sv}), which contains additional,
* platform-specific data about this launch. On UNIX, at least the
* "pid" and "startup-notification-id" keys will be present.
*
* Params:
* info = the #GAppInfo that was just launched
* platformData = additional platform-specific data for this launch
*
* Since: 2.36
*/
gulong addOnLaunched(void delegate(AppInfoIF, Variant, AppLaunchContext) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnLaunchedDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"launched",
cast(GCallback)&callBackLaunched,
cast(void*)wrapper,
cast(GClosureNotify)&callBackLaunchedDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackLaunched(GAppLaunchContext* applaunchcontextStruct, GAppInfo* info, GVariant* platformData, OnLaunchedDelegateWrapper wrapper)
{
wrapper.dlg(ObjectG.getDObject!(AppInfoIF)(info), new Variant(platformData), wrapper.outer);
}
extern(C) static void callBackLaunchedDestroy(OnLaunchedDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
}
|