~ubuntu-branches/ubuntu/karmic/glib2.0/karmic-updates

« back to all changes in this revision

Viewing changes to gio/gmountoperation.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-07 08:55:47 UTC
  • mfrom: (1.2.49 upstream)
  • Revision ID: james.westby@ubuntu.com-20090707085547-oma0yur1uaq4zmop
Tags: 2.21.3-0ubuntu1
* New upstream version:
  - GMappedFile is refcounted now
  - Mainloop: It is now possible to set per-thread default contexts,
    with g_main_context_push_thread_default.
  - glib-mkenums supports a @basename@ substitution, in addition
    to @filename@.
  - GIO:
    + Vfs implementations can support storing of per-file metadata.
    + GCancellable can now be subclassed.
    + Unmount and eject methods now optionally allow interaction, via
      variants that take a GMountOperation object.
  - Bugs fixed:
   556706 Inconsistent help arguments -h, -?
   579449 FileChoosers no longer work if an idle handler is active
   579933 mainloop FD_CLOEXEC has a race condition
   579984 alternate GMainContext support
   585937 gio/gsocket.c (glib 2.21.2) does not compile (Windows/mingw)
   586675 Runtime library location
   586797 Add GCancellables to GSocket ops
   586868 g_filename_complete_get_completions doesn't always return...
   587415 g_resolver_lookup_by_name_finish returns a freed list
   587434 regression tests fail, at least on x86_64
   586928 Avoid g++ warning in g_error()
  - Updated translations: Estonian, Hebrew
* Drop 00git_file_attr_stringv.patch, in upstream release now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
 
32
32
#include "gioalias.h"
33
33
 
34
 
/** 
 
34
/**
35
35
 * SECTION:gmountoperation
36
 
 * @short_description: Authentication methods for mountable locations
 
36
 * @short_description: Object used for authentication and user interaction
37
37
 * @include: gio/gio.h
38
38
 *
39
 
 * #GMountOperation provides a mechanism for authenticating mountable 
40
 
 * operations, such as loop mounting files, hard drive partitions or 
41
 
 * server locations. 
42
 
 *
43
 
 * Mounting operations are handed a #GMountOperation that then can use 
44
 
 * if they require any privileges or authentication for their volumes 
45
 
 * to be mounted (e.g. a hard disk partition or an encrypted filesystem), 
46
 
 * or if they are implementing a remote server protocol which requires 
47
 
 * user credentials such as FTP or WebDAV.
48
 
 *
49
 
 * Users should instantiate a subclass of this that implements all
50
 
 * the various callbacks to show the required dialogs, such as 
51
 
 * #GtkMountOperation.
52
 
 **/
 
39
 * #GMountOperation provides a mechanism for interacting with the user.
 
40
 * It can be used for authenticating mountable operations, such as loop
 
41
 * mounting files, hard drive partitions or server locations. It can
 
42
 * also be used to ask the user questions or show a list of applications
 
43
 * preventing unmount or eject operations from completing.
 
44
 *
 
45
 * Note that #GMountOperation is used for more than just #GMount
 
46
 * objects – for example it is also used in g_drive_start() and
 
47
 * g_drive_stop().
 
48
 *
 
49
 * Users should instantiate a subclass of this that implements all the
 
50
 * various callbacks to show the required dialogs, such as
 
51
 * #GtkMountOperation. If no user interaction is desired (for example
 
52
 * when automounting filesystems at login time), usually %NULL can be
 
53
 * passed, see each method taking a #GMountOperation for details.
 
54
 */
53
55
 
54
56
G_DEFINE_TYPE (GMountOperation, g_mount_operation, G_TYPE_OBJECT);
55
57
 
58
60
  ASK_QUESTION,
59
61
  REPLY,
60
62
  ABORTED,
 
63
  SHOW_PROCESSES,
61
64
  LAST_SIGNAL
62
65
};
63
66
 
227
230
}
228
231
 
229
232
static void
 
233
show_processes (GMountOperation      *op,
 
234
                const gchar          *message,
 
235
                GArray               *processes,
 
236
                const gchar          *choices[])
 
237
{
 
238
  g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
 
239
                   reply_non_handled_in_idle,
 
240
                   g_object_ref (op),
 
241
                   g_object_unref);
 
242
}
 
243
 
 
244
static void
230
245
g_mount_operation_class_init (GMountOperationClass *klass)
231
246
{
232
247
  GObjectClass *object_class;
240
255
  
241
256
  klass->ask_password = ask_password;
242
257
  klass->ask_question = ask_question;
 
258
  klass->show_processes = show_processes;
243
259
  
244
260
  /**
245
261
   * GMountOperation::ask-password:
326
342
                  G_TYPE_NONE, 0);
327
343
 
328
344
  /**
 
345
   * GMountOperation::show-processes:
 
346
   * @op: a #GMountOperation.
 
347
   * @message: string containing a message to display to the user.
 
348
   * @processes: an array of #GPid for processes blocking the operation.
 
349
   * @choices: an array of strings for each possible choice.
 
350
   *
 
351
   * Emitted when one or more processes are blocking an operation
 
352
   * e.g. unmounting/ejecting a #GMount or stopping a #GDrive.
 
353
   *
 
354
   * Note that this signal may be emitted several times to update the
 
355
   * list of blocking processes as processes close files. The
 
356
   * application should only respond with g_mount_operation_reply() to
 
357
   * the latest signal (setting #GMountOperation:choice to the choice
 
358
   * the user made).
 
359
   *
 
360
   * If the message contains a line break, the first line should be
 
361
   * presented as a heading. For example, it may be used as the
 
362
   * primary text in a #GtkMessageDialog.
 
363
   *
 
364
   * Since: 2.22
 
365
   */
 
366
  signals[SHOW_PROCESSES] =
 
367
    g_signal_new (I_("show-processes"),
 
368
                  G_TYPE_FROM_CLASS (object_class),
 
369
                  G_SIGNAL_RUN_LAST,
 
370
                  G_STRUCT_OFFSET (GMountOperationClass, show_processes),
 
371
                  NULL, NULL,
 
372
                  _gio_marshal_VOID__STRING_BOXED_BOXED,
 
373
                  G_TYPE_NONE, 3,
 
374
                  G_TYPE_STRING, G_TYPE_ARRAY, G_TYPE_STRV);
 
375
 
 
376
  /**
329
377
   * GMountOperation:username:
330
378
   *
331
379
   * The user name that is used for authentication when carrying out