1 <?xml version="1.0" standalone="no"?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
5 <refentry id="class-giomountoperation">
7 <refname>gio.MountOperation</refname>
8 <refpurpose>Authentication methods for mountable locations.</refpurpose>
12 <title>Synopsis</title>
14 <classsynopsis language="python">
15 <ooclass><classname>gio.MountOperation</classname></ooclass>
16 <ooclass><classname><link linkend="class-gobject">gobject.GObject</link></classname></ooclass>
18 <constructorsynopsis language="python">
19 <methodname><link linkend="constructor-giomountoperation">gio.MountOperation</link></methodname>
20 <methodparam></methodparam>
21 </constructorsynopsis>
23 <methodsynopsis language="python">
24 <methodname><link linkend="method-giomountoperation--get-anonymous">get_anonymous</link></methodname>
25 <methodparam></methodparam>
27 <methodsynopsis language="python">
28 <methodname><link linkend="method-giomountoperation--get-choice">get_choice</link></methodname>
29 <methodparam></methodparam>
31 <methodsynopsis language="python">
32 <methodname><link linkend="method-giomountoperation--get-domain">get_domain</link></methodname>
33 <methodparam></methodparam>
35 <methodsynopsis language="python">
36 <methodname><link linkend="method-giomountoperation--get-password">get_password</link></methodname>
37 <methodparam></methodparam>
39 <methodsynopsis language="python">
40 <methodname><link linkend="method-giomountoperation--get-password-save">get_password_save</link></methodname>
41 <methodparam></methodparam>
43 <methodsynopsis language="python">
44 <methodname><link linkend="method-giomountoperation--get-username">get_username</link></methodname>
45 <methodparam></methodparam>
47 <methodsynopsis language="python">
48 <methodname><link linkend="method-giomountoperation--reply">replay</link></methodname>
49 <methodparam><parameter role="keyword">result</parameter></methodparam>
51 <methodsynopsis language="python">
52 <methodname><link linkend="method-giomountoperation--set-anonymous">set_anonymous</link></methodname>
53 <methodparam><parameter role="keyword">anonymous</parameter></methodparam>
55 <methodsynopsis language="python">
56 <methodname><link linkend="method-giomountoperation--set-choice">set_choice</link></methodname>
57 <methodparam><parameter role="keyword">choice</parameter></methodparam>
59 <methodsynopsis language="python">
60 <methodname><link linkend="method-giomountoperation--set-domain">set_domain</link></methodname>
61 <methodparam><parameter role="keyword">domain</parameter></methodparam>
63 <methodsynopsis language="python">
64 <methodname><link linkend="method-giomountoperation--set-password">set_password</link></methodname>
65 <methodparam><parameter role="keyword">password</parameter></methodparam>
67 <methodsynopsis language="python">
68 <methodname><link linkend="method-giomountoperation--set-password-save">set_password_save</link></methodname>
69 <methodparam><parameter role="keyword">save</parameter></methodparam>
71 <methodsynopsis language="python">
72 <methodname><link linkend="method-giomountoperation--set-username">set_username</link></methodname>
73 <methodparam><parameter role="keyword">username</parameter></methodparam>
80 <title>Ancestry</title>
82 <synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
83 +-- <link linkend="class-giomountoperation">gio.MountOperation</link>
88 <refsect1 id="properties-giomountoperation">
89 <title>gio.MountOperation Properties</title>
91 <blockquote role="properties">
92 <informaltable pgwide="1" frame="none">
94 <colspec column="1" colwidth="1in"/>
95 <colspec column="2" colwidth="1in"/>
96 <colspec column="3" colwidth="4in"/>
99 <entry>"anonymous"</entry>
100 <entry>Read/Write</entry>
102 Whether to use an anonymous user when authenticating.
103 Default value: <literal>False</literal>
107 <entry>"choice"</entry>
108 <entry>Read/Write</entry>
110 The index of the user's choice when a question is asked during
111 the mount operation. See the "ask-question" signal.
112 Allowed values: >= 0 Default value: 0
116 <entry>"domain"</entry>
117 <entry>Read/Write</entry>
119 The domain to use for the mount operation. Default value: <literal>None</literal>
123 <entry>"password"</entry>
124 <entry>Read/Write</entry>
126 The password that is used for authentication when carrying out the
127 mount operation. Default value: <literal>None</literal>
131 <entry>"password-save"</entry>
132 <entry>Read/Write</entry>
134 Determines if and how the password information should be saved.
135 Default value: gio.PASSWORD_SAVE_NEVER
139 <entry>"username"</entry>
140 <entry>Read/Write</entry>
142 The user name that is used for authentication when carrying out the
143 mount operation. Default value: <literal>None</literal>
153 <refsect1 id="signal-prototypes-giomountoperation">
154 <title>gio.MountOperation Signal Prototypes</title>
156 <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
160 <term><link linkend="signal-giomountoperation--aborted">"aborted"</link></term>
162 <methodsynopsis language="python"><methodname>callback</methodname>
163 <methodparam><parameter>mountoperation</parameter></methodparam>
164 <methodparam><parameter>user_param1</parameter></methodparam>
165 <methodparam><parameter>...</parameter></methodparam>
170 <term><link linkend="signal-giomountoperation--ask-password">"ask-password"</link></term>
172 <methodsynopsis language="python"><methodname>callback</methodname>
173 <methodparam><parameter>mountoperation</parameter></methodparam>
174 <methodparam><parameter>message</parameter></methodparam>
175 <methodparam><parameter>default_user</parameter></methodparam>
176 <methodparam><parameter>default_domain</parameter></methodparam>
177 <methodparam><parameter>flags</parameter></methodparam>
178 <methodparam><parameter>user_param1</parameter></methodparam>
179 <methodparam><parameter>...</parameter></methodparam>
184 <term><link linkend="signal-giomountoperation--ask-question">"ask-question"</link></term>
186 <methodsynopsis language="python"><methodname>callback</methodname>
187 <methodparam><parameter>mountoperation</parameter></methodparam>
188 <methodparam><parameter>message</parameter></methodparam>
189 <methodparam><parameter>choices</parameter></methodparam>
190 <methodparam><parameter>user_param1</parameter></methodparam>
191 <methodparam><parameter>...</parameter></methodparam>
196 <term><link linkend="signal-giomountoperation--reply">"reply"</link></term>
198 <methodsynopsis language="python"><methodname>callback</methodname>
199 <methodparam><parameter>mountoperation</parameter></methodparam>
200 <methodparam><parameter>result</parameter></methodparam>
201 <methodparam><parameter>user_param1</parameter></methodparam>
202 <methodparam><parameter>...</parameter></methodparam>
211 <title>Description</title>
214 The <link linkend="class-giomountoperation"><classname>gio.MountOperation</classname></link>
215 provides a mechanism for authenticating mountable operations, such as loop mounting files,
216 hard drive partitions or server locations.
219 Mounting operations are handed a
220 <link linkend="class-giomountoperation"><classname>gio.MountOperation</classname></link>
221 that then can use if they require any privileges or authentication for their volumes to be
222 mounted (e.g. a hard disk partition or an encrypted filesystem), or if they are implementing
223 a remote server protocol which requires user credentials such as FTP or WebDAV.
226 Users should instantiate a subclass of this that implements all the various callbacks
227 to show the required dialogs, such as
228 <link linkend="class-gtkmountoperation"><classname>gtk.MountOperation</classname></link>.
232 <refsect1 id="constructor-giomountoperation">
233 <title>Constructor</title>
235 <programlisting><constructorsynopsis language="python">
236 <methodname>gio.MountOperation</methodname>
237 <methodparam></methodparam>
238 </constructorsynopsis></programlisting>
241 <term><emphasis>Returns</emphasis> :</term>
242 <listitem><simpara>a new
243 <link linkend="class-giomountoperation"><classname>gio.MountOperation</classname></link>.
244 </simpara></listitem>
249 Creates a new mount operation.
255 <title>Methods</title>
257 <refsect2 id="method-giomountoperation--get-anonymous">
258 <title>gio.MountOperation.get_anonymous</title>
260 <programlisting><methodsynopsis language="python">
261 <methodname>get_anonymous</methodname>
262 <methodparam></methodparam>
263 </methodsynopsis></programlisting>
267 <term><emphasis>Returns</emphasis> :</term>
268 <listitem><simpara><literal>True</literal> if mount operation is anonymous.
269 </simpara></listitem>
274 The <methodname>get_anonymous</methodname>() method check to see whether
275 the mount operation is being used for an anonymous user
279 <refsect2 id="method-giomountoperation--get-choice">
280 <title>gio.MountOperation.get_choice</title>
282 <programlisting><methodsynopsis language="python">
283 <methodname>get_choice</methodname>
284 <methodparam></methodparam>
285 </methodsynopsis></programlisting>
289 <term><emphasis>Returns</emphasis> :</term>
290 <listitem><simpara>an integer containing an index of the user's
291 choice from the choice's list, or 0.
292 </simpara></listitem>
297 The <methodname>get_anonymous</methodname>() method gets a choice
298 from the mount operation.
302 <refsect2 id="method-giomountoperation--get-domain">
303 <title>gio.MountOperation.get_domain</title>
305 <programlisting><methodsynopsis language="python">
306 <methodname>get_domain</methodname>
307 <methodparam></methodparam>
308 </methodsynopsis></programlisting>
312 <term><emphasis>Returns</emphasis> :</term>
313 <listitem><simpara>a string set to the domain.
314 </simpara></listitem>
319 The <methodname>get_domain</methodname>() method gets the domain
320 of the mount operation.
324 <refsect2 id="method-giomountoperation--get-password">
325 <title>gio.MountOperation.get_password</title>
327 <programlisting><methodsynopsis language="python">
328 <methodname>get_password</methodname>
329 <methodparam></methodparam>
330 </methodsynopsis></programlisting>
334 <term><emphasis>Returns</emphasis> :</term>
335 <listitem><simpara>a string containing the password within
337 </simpara></listitem>
342 The <methodname>get_password</methodname>() method gets a password
343 from the mount operation.
347 <refsect2 id="method-giomountoperation--get-password-save">
348 <title>gio.MountOperation.get_password_save</title>
350 <programlisting><methodsynopsis language="python">
351 <methodname>get_password_save</methodname>
352 <methodparam></methodparam>
353 </methodsynopsis></programlisting>
357 <term><emphasis>Returns</emphasis> :</term>
359 <xref linkend="gio-password-save-constants" endterm="gio-password-save-constants-title"></xref>
361 </simpara></listitem>
366 The <methodname>get_password_save</methodname>() method gets the state
367 of saving passwords for the mount operation.
371 <refsect2 id="method-giomountoperation--get-username">
372 <title>gio.MountOperation.get_username</title>
374 <programlisting><methodsynopsis language="python">
375 <methodname>get_username</methodname>
376 <methodparam></methodparam>
377 </methodsynopsis></programlisting>
381 <term><emphasis>Returns</emphasis> :</term>
382 <listitem><simpara>a string containing the user name.
383 </simpara></listitem>
388 The <methodname>get_username</methodname>() method get the user
389 name from the mount operation.
393 <refsect2 id="method-giomountoperation--reply">
394 <title>gio.MountOperation.reply</title>
396 <programlisting><methodsynopsis language="python">
397 <methodname>reply</methodname>
398 <methodparam><parameter role="keyword">result</parameter></methodparam>
399 </methodsynopsis></programlisting>
403 <term><parameter>result</parameter> :</term>
405 <xref linkend="gio-mount-operation-result-constants" endterm="gio-mount-operation-result-constants-title"></xref>
406 </simpara></listitem>
411 The <methodname>reply</methodname>() method emits the "reply" signal.
415 <refsect2 id="method-giomountoperation--set-anonymous">
416 <title>gio.MountOperation.set_anonymous</title>
418 <programlisting><methodsynopsis language="python">
419 <methodname>set_anonymous</methodname>
420 <methodparam><parameter role="keyword">anonymous</parameter></methodparam>
421 </methodsynopsis></programlisting>
425 <term><parameter>anonymous</parameter> :</term>
426 <listitem><simpara>boolean value.
427 </simpara></listitem>
432 The <methodname>set_anonymous</methodname>() method sets the mount operation
433 to use an anonymous user if anonymous is <literal>True</literal>.
437 <refsect2 id="method-giomountoperation--set-choice">
438 <title>gio.MountOperation.set_choice</title>
440 <programlisting><methodsynopsis language="python">
441 <methodname>set_choice</methodname>
442 <methodparam><parameter role="keyword">choice</parameter></methodparam>
443 </methodsynopsis></programlisting>
447 <term><parameter>choice</parameter> :</term>
448 <listitem><simpara>an integer.
449 </simpara></listitem>
454 The <methodname>set_choice</methodname>() method sets a default choice for the mount operation.
458 <refsect2 id="method-giomountoperation--set-domain">
459 <title>gio.MountOperation.set_domain</title>
461 <programlisting><methodsynopsis language="python">
462 <methodname>set_domain</methodname>
463 <methodparam><parameter role="keyword">domain</parameter></methodparam>
464 </methodsynopsis></programlisting>
468 <term><parameter>domain</parameter> :</term>
469 <listitem><simpara>the domain to set.
470 </simpara></listitem>
475 The <methodname>set_domain</methodname>() method sets the mount operation's domain.
479 <refsect2 id="method-giomountoperation--set-password">
480 <title>gio.MountOperation.set_password</title>
482 <programlisting><methodsynopsis language="python">
483 <methodname>set_password</methodname>
484 <methodparam><parameter role="keyword">password</parameter></methodparam>
485 </methodsynopsis></programlisting>
489 <term><parameter>password</parameter> :</term>
490 <listitem><simpara>password to set.
491 </simpara></listitem>
496 The <methodname>set_password</methodname>() method sets the mount
497 operation's password to password.
501 <refsect2 id="method-giomountoperation--set-password-save">
502 <title>gio.MountOperation.set_password_save</title>
504 <programlisting><methodsynopsis language="python">
505 <methodname>set_password_save</methodname>
506 <methodparam><parameter role="keyword">save</parameter></methodparam>
507 </methodsynopsis></programlisting>
511 <term><parameter>save</parameter> :</term>
512 <listitem><simpara>a set of
513 <xref linkend="gio-password-save-constants" endterm="gio-password-save-constants-title"></xref>
514 </simpara></listitem>
519 The <methodname>set_password_save</methodname>() method sets the state
520 of saving passwords for the mount operation.
524 <refsect2 id="method-giomountoperation--set-username">
525 <title>gio.MountOperation.set_username</title>
527 <programlisting><methodsynopsis language="python">
528 <methodname>set_username</methodname>
529 <methodparam><parameter role="keyword">username</parameter></methodparam>
530 </methodsynopsis></programlisting>
534 <term><parameter>username</parameter> :</term>
535 <listitem><simpara>input username.
536 </simpara></listitem>
541 The <methodname>set_anonymous</methodname>() method sets the user
542 name within op to username.
548 <title>Signals</title>
550 <refsect2 id="signal-giomountoperation--aborted">
551 <title>The "aborted" gio.MountOperation Signal</title>
553 <programlisting><methodsynopsis language="python"><methodname>callback</methodname>
554 <methodparam><parameter>mountoperation</parameter></methodparam>
555 <methodparam><parameter>user_param1</parameter></methodparam>
556 <methodparam><parameter>...</parameter></methodparam>
557 </methodsynopsis></programlisting>
561 <term><parameter>mountoperation</parameter> :</term>
562 <listitem><simpara>the mountoperation</simpara></listitem>
565 <term><parameter>user_param1</parameter> :</term>
566 <listitem><simpara>the first user parameter (if any) specified
568 linkend="method-gobject--connect"><methodname>connect</methodname>()</link>
569 method</simpara></listitem>
572 <term><parameter>...</parameter> :</term>
573 <listitem><simpara>additional user parameters (if any)</simpara></listitem>
578 Emitted by the backend when e.g. a device becomes unavailable while a mount operation is in progress.
579 Implementations of <link linkend="class-giomountoperation"><classname>gio.MountOperation</classname></link>
580 should handle this signal by dismissing open password dialogs.
584 <refsect2 id="signal-giomountoperation--ask-password">
585 <title>The "ask-password" gio.MountOperation Signal</title>
587 <programlisting><methodsynopsis language="python"><methodname>callback</methodname>
588 <methodparam><parameter>mountoperation</parameter></methodparam>
589 <methodparam><parameter>message</parameter></methodparam>
590 <methodparam><parameter>default_user</parameter></methodparam>
591 <methodparam><parameter>default_domain</parameter></methodparam>
592 <methodparam><parameter>flags</parameter></methodparam>
593 <methodparam><parameter>user_param1</parameter></methodparam>
594 <methodparam><parameter>...</parameter></methodparam>
595 </methodsynopsis></programlisting>
599 <term><parameter>mountoperation</parameter> :</term>
600 <listitem><simpara>the mountoperation</simpara></listitem>
603 <term><parameter>message</parameter> :</term>
604 <listitem><simpara>string containing a message to display to the user.</simpara></listitem>
607 <term><parameter>default_user</parameter> :</term>
608 <listitem><simpara>string containing the default user name.</simpara></listitem>
611 <term><parameter>default_domain</parameter> :</term>
612 <listitem><simpara>string containing the default domain.</simpara></listitem>
615 <term><parameter>flags</parameter> :</term>
616 <listitem><simpara>a set of
617 <xref linkend="gio-ask-password-flags-constants" endterm="gio-ask-password-flags-constants-title"></xref>
618 </simpara></listitem>
621 <term><parameter>user_param1</parameter> :</term>
622 <listitem><simpara>the first user parameter (if any) specified
624 linkend="method-gobject--connect"><methodname>connect</methodname>()</link>
625 method</simpara></listitem>
628 <term><parameter>...</parameter> :</term>
629 <listitem><simpara>additional user parameters (if any)</simpara></listitem>
634 This signal is emitted when a mount operation asks the user for a password.
635 If the message contains a line break, the first line should be presented as a heading.
636 For example, it may be used as the primary text in a
637 <link linkend="class-gtkmessagedialog"><classname>gtk.MessageDialog</classname></link>.
641 <refsect2 id="signal-giomountoperation--ask-question">
642 <title>The "ask-question" gio.MountOperation Signal</title>
644 <programlisting><methodsynopsis language="python"><methodname>callback</methodname>
645 <methodparam><parameter>mountoperation</parameter></methodparam>
646 <methodparam><parameter>message</parameter></methodparam>
647 <methodparam><parameter>choices</parameter></methodparam>
648 <methodparam><parameter>user_param1</parameter></methodparam>
649 <methodparam><parameter>...</parameter></methodparam>
650 </methodsynopsis></programlisting>
654 <term><parameter>mountoperation</parameter> :</term>
655 <listitem><simpara>the mountoperation</simpara></listitem>
658 <term><parameter>message</parameter> :</term>
659 <listitem><simpara>string containing a message to display to the user.</simpara></listitem>
662 <term><parameter>choices</parameter> :</term>
663 <listitem><simpara>a list of strings for each possible choice.</simpara></listitem>
666 <term><parameter>user_param1</parameter> :</term>
667 <listitem><simpara>the first user parameter (if any) specified
669 linkend="method-gobject--connect"><methodname>connect</methodname>()</link>
670 method</simpara></listitem>
673 <term><parameter>...</parameter> :</term>
674 <listitem><simpara>additional user parameters (if any)</simpara></listitem>
679 This signal is emitted when asking the user a question and gives a list of choices
680 for the user to choose from. If the message contains a line break, the first line should be
681 presented as a heading. For example, it may be used as the primary text in a
682 <link linkend="class-gtkmessagedialog"><classname>gtk.MessageDialog</classname></link>.
686 <refsect2 id="signal-giomountoperation--reply">
687 <title>The "reply" gio.MountOperation Signal</title>
689 <programlisting><methodsynopsis language="python"><methodname>callback</methodname>
690 <methodparam><parameter>mountoperation</parameter></methodparam>
691 <methodparam><parameter>result</parameter></methodparam>
692 <methodparam><parameter>user_param1</parameter></methodparam>
693 <methodparam><parameter>...</parameter></methodparam>
694 </methodsynopsis></programlisting>
698 <term><parameter>mountoperation</parameter> :</term>
699 <listitem><simpara>the mountoperation</simpara></listitem>
702 <term><parameter>result</parameter> :</term>
704 <xref linkend="gio-mount-operation-result-constants" endterm="gio-mount-operation-result-constants-title"></xref>
705 indicating how the request was handled</simpara></listitem>
708 <term><parameter>user_param1</parameter> :</term>
709 <listitem><simpara>the first user parameter (if any) specified
711 linkend="method-gobject--connect"><methodname>connect</methodname>()</link>
712 method</simpara></listitem>
715 <term><parameter>...</parameter> :</term>
716 <listitem><simpara>additional user parameters (if any)</simpara></listitem>
721 This signal is emitted when the user has replied to the mount operation.