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
|
/*
* 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 secret.Prompt;
private import gio.AsyncInitableIF;
private import gio.AsyncInitableT;
private import gio.AsyncResultIF;
private import gio.Cancellable;
private import gio.DBusInterfaceIF;
private import gio.DBusInterfaceT;
private import gio.DBusProxy;
private import gio.InitableIF;
private import gio.InitableT;
private import glib.ErrorG;
private import glib.GException;
private import glib.Str;
private import glib.Variant;
private import glib.VariantType;
private import secretc.secret;
public import secretc.secrettypes;
/**
* A proxy object representing a prompt that the Secret Service will display
* to the user.
*/
public class Prompt : DBusProxy
{
/** the main Gtk struct */
protected SecretPrompt* secretPrompt;
/** Get the main Gtk struct */
public SecretPrompt* getPromptStruct()
{
return secretPrompt;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)secretPrompt;
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (SecretPrompt* secretPrompt, bool ownedRef = false)
{
this.secretPrompt = secretPrompt;
super(cast(GDBusProxy*)secretPrompt, ownedRef);
}
/** */
public static GType getType()
{
return secret_prompt_get_type();
}
/**
* Runs a prompt and performs the prompting. Returns %TRUE if the prompt
* was completed and not dismissed.
*
* If @window_id is non-null then it is used as an XWindow id on Linux. The API
* expects this id to be converted to a string using the <literal>%d</literal>
* printf format. The Secret Service can make its prompt transient for the window
* with this id. In some Secret Service implementations this is not possible, so
* the behavior depending on this should degrade gracefully.
*
* This method will return immediately and complete asynchronously.
*
* Params:
* windowId = string form of XWindow id for parent window to be transient for
* returnType = the variant type of the prompt result
* cancellable = optional cancellation object
* callback = called when the operation completes
* userData = data to be passed to the callback
*/
public void perform(string windowId, VariantType returnType, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
{
secret_prompt_perform(secretPrompt, Str.toStringz(windowId), (returnType is null) ? null : returnType.getVariantTypeStruct(), (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
}
/**
* Complete asynchronous operation to run a prompt and perform the prompting.
*
* Returns a variant result if the prompt was completed and not dismissed. The
* type of result depends on the action the prompt is completing, and is
* defined in the Secret Service DBus API specification.
*
* Params:
* result = the asynchronous result passed to the callback
*
* Return: %NULL if the prompt was dismissed or an error occurred,
* a variant result if the prompt was successful
*
* Throws: GException on failure.
*/
public Variant performFinish(AsyncResultIF result)
{
GError* err = null;
auto p = secret_prompt_perform_finish(secretPrompt, (result is null) ? null : result.getAsyncResultStruct(), &err);
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
if(p is null)
{
return null;
}
return new Variant(cast(GVariant*) p, true);
}
/**
* Runs a prompt and performs the prompting. Returns a variant result if the
* prompt was completed and not dismissed. The type of result depends on the
* action the prompt is completing, and is defined in the Secret Service DBus
* API specification.
*
* If @window_id is non-null then it is used as an XWindow id on Linux. The API
* expects this id to be converted to a string using the <literal>%d</literal>
* printf format. The Secret Service can make its prompt transient for the window
* with this id. In some Secret Service implementations this is not possible,
* so the behavior depending on this should degrade gracefully.
*
* This method may block indefinitely and should not be used in user interface
* threads.
*
* Params:
* windowId = string form of XWindow id for parent window to be transient for
* cancellable = optional cancellation object
* returnType = the variant type of the prompt result
*
* Return: %NULL if the prompt was dismissed or an error occurred
*
* Throws: GException on failure.
*/
public Variant performSync(string windowId, Cancellable cancellable, VariantType returnType)
{
GError* err = null;
auto p = secret_prompt_perform_sync(secretPrompt, Str.toStringz(windowId), (cancellable is null) ? null : cancellable.getCancellableStruct(), (returnType is null) ? null : returnType.getVariantTypeStruct(), &err);
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
if(p is null)
{
return null;
}
return new Variant(cast(GVariant*) p, true);
}
/**
* Runs a prompt and performs the prompting. Returns a variant result if the
* prompt was completed and not dismissed. The type of result depends on the
* action the prompt is completing, and is defined in the Secret Service DBus
* API specification.
*
* If @window_id is non-null then it is used as an XWindow id on Linux. The API
* expects this id to be converted to a string using the <literal>%d</literal>
* printf format. The Secret Service can make its prompt transient for the window
* with this id. In some Secret Service implementations this is not possible, so
* the behavior depending on this should degrade gracefully.
*
* This runs the dialog in a recursive mainloop. When run from a user interface
* thread, this means the user interface will remain responsive. Care should be
* taken that appropriate user interface actions are disabled while running the
* prompt.
*
* Params:
* windowId = string form of XWindow id for parent window to be transient for
* cancellable = optional cancellation object
* returnType = the variant type of the prompt result
*
* Return: %NULL if the prompt was dismissed or an error occurred
*
* Throws: GException on failure.
*/
public Variant run(string windowId, Cancellable cancellable, VariantType returnType)
{
GError* err = null;
auto p = secret_prompt_run(secretPrompt, Str.toStringz(windowId), (cancellable is null) ? null : cancellable.getCancellableStruct(), (returnType is null) ? null : returnType.getVariantTypeStruct(), &err);
if (err !is null)
{
throw new GException( new ErrorG(err) );
}
if(p is null)
{
return null;
}
return new Variant(cast(GVariant*) p, true);
}
}
|