summaryrefslogtreecommitdiff
path: root/gio/src/mountoperation.hg
blob: 6c424029535d06cc14dfe9efb29352dd61176c65 (plain)
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
// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-

/* Copyright (C) 2007 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <glibmm/object.h>

_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
_PINCLUDE(gio/gio.h)

namespace Gio
{

_WRAP_ENUM(AskPasswordFlags, GAskPasswordFlags, NO_GTYPE)
_WRAP_ENUM(PasswordSave, GPasswordSave, NO_GTYPE)
_WRAP_ENUM(MountOperationResult, GMountOperationResult, NO_GTYPE)

/** Authentication methods for mountable locations.
 *
 * MountOperation provides a mechanism for authenticating mountable operations, such as loop mounting files, hard drive partitions or server locations.
 * 
 * Mounting operations are handed a MountOperation that they can use if they require any privileges or authentication for their volumes to be mounted (e.g. 
 * a hard disk partition or an encrypted filesystem), or if they are implementing a remote server protocol which requires user credentials such as FTP or 
 * WebDAV.
 *
 * Developers should instantiate a subclass of this that implements all the various callbacks to show the required dialogs.
 *
 * @newin2p16
 */
class MountOperation : public Glib::Object
{
  _CLASS_GOBJECT(MountOperation, GMountOperation, G_MOUNT_OPERATION, Glib::Object, GObject)

protected:
  _CTOR_DEFAULT

public:
  _WRAP_CREATE()

  _WRAP_METHOD(Glib::ustring get_username() const,
               g_mount_operation_get_username)
  _WRAP_METHOD(void set_username(const Glib::ustring& username),
               g_mount_operation_set_username)
  _WRAP_METHOD(Glib::ustring get_password() const,
               g_mount_operation_get_password)
  _WRAP_METHOD(void set_password(const Glib::ustring& password),
               g_mount_operation_set_password)
  _WRAP_METHOD(bool get_anonymous() const,
               g_mount_operation_get_anonymous)
  _WRAP_METHOD(void set_anonymous(bool anonymous = true),
               g_mount_operation_set_anonymous)
  _WRAP_METHOD(Glib::ustring get_domain() const,
               g_mount_operation_get_domain)
  _WRAP_METHOD(void set_domain(const Glib::ustring& domain),
               g_mount_operation_set_domain)
  _WRAP_METHOD(PasswordSave get_password_save() const,
               g_mount_operation_get_password_save)
  _WRAP_METHOD(void set_password_save(PasswordSave password_save),
               g_mount_operation_set_password_save)
  _WRAP_METHOD(int get_choice() const, g_mount_operation_get_choice)
  _WRAP_METHOD(void set_choice(int choice), g_mount_operation_set_choice)
  _WRAP_METHOD(void reply(MountOperationResult result), g_mount_operation_reply)

#m4 _CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING)
  _WRAP_SIGNAL(void ask_password(const Glib::ustring& message, const Glib::ustring& default_user, const Glib::ustring& default_domain, AskPasswordFlags flags), ask_password)
#m4 _CONVERSION(`const Glib::StringArrayHandle&',`GStrv*',`const_cast<GStrv*>(($3).data())')
#m4 _CONVERSION(`GStrv*',`const Glib::StringArrayHandle&',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_DEEP)')
  // TODO: The signal def is wrong - it states that choices are GStrv* (gchar***)
  // but actually they are const char*[]
  //  _WRAP_SIGNAL(void ask_question(const Glib::ustring& message, const Glib::StringArrayHandle& choices), ask_question)
  _WRAP_SIGNAL(void reply(MountOperationResult result), reply)


  _WRAP_PROPERTY("username", Glib::ustring)
  _WRAP_PROPERTY("password", Glib::ustring)
  _WRAP_PROPERTY("anonymous", bool)
  _WRAP_PROPERTY("domain", Glib::ustring)
  _WRAP_PROPERTY("password-save", PasswordSave)
  _WRAP_PROPERTY("choice", int)

  //TODO: vfuncs

};

} // namespace Gio