mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-22 08:58:54 +02:00
Change the API a bit so that unhandled methods get reported via the reply,
2008-01-09 Alexander Larsson <alexl@redhat.com> * gio-marshal.list: * gmountoperation.[ch]: Change the API a bit so that unhandled methods get reported via the reply, rather than by the signal emission return value. This is because some handlers can't know this immediately without doing I/O, and this is an async operation that should not block. svn path=/trunk/; revision=6282
This commit is contained in:
committed by
Alexander Larsson
parent
91d7fdc186
commit
e6ca690694
@@ -1,3 +1,14 @@
|
|||||||
|
2008-01-09 Alexander Larsson <alexl@redhat.com>
|
||||||
|
|
||||||
|
* gio-marshal.list:
|
||||||
|
* gmountoperation.[ch]:
|
||||||
|
Change the API a bit so that unhandled methods
|
||||||
|
get reported via the reply, rather than by
|
||||||
|
the signal emission return value. This is because
|
||||||
|
some handlers can't know this immediately without
|
||||||
|
doing I/O, and this is an async operation that
|
||||||
|
should not block.
|
||||||
|
|
||||||
2008-01-09 Alexander Larsson <alexl@redhat.com>
|
2008-01-09 Alexander Larsson <alexl@redhat.com>
|
||||||
|
|
||||||
* fam/fam-helper.c:
|
* fam/fam-helper.c:
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
BOOLEAN:STRING,STRING,STRING,FLAGS
|
VOID:STRING,STRING,STRING,FLAGS
|
||||||
BOOLEAN:STRING,BOXED
|
VOID:STRING,BOXED
|
||||||
VOID:BOOLEAN,POINTER
|
VOID:BOOLEAN,POINTER
|
||||||
VOID:OBJECT,OBJECT,ENUM
|
VOID:OBJECT,OBJECT,ENUM
|
||||||
|
@@ -193,37 +193,36 @@ g_mount_operation_finalize (GObject *object)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
boolean_handled_accumulator (GSignalInvocationHint *ihint,
|
reply_non_handled_in_idle (gpointer data)
|
||||||
GValue *return_accu,
|
|
||||||
const GValue *handler_return,
|
|
||||||
gpointer dummy)
|
|
||||||
{
|
{
|
||||||
gboolean continue_emission;
|
GMountOperation *op = data;
|
||||||
gboolean signal_handled;
|
|
||||||
|
g_mount_operation_reply (op, G_MOUNT_OPERATION_UNHANDLED);
|
||||||
signal_handled = g_value_get_boolean (handler_return);
|
return FALSE;
|
||||||
g_value_set_boolean (return_accu, signal_handled);
|
|
||||||
continue_emission = !signal_handled;
|
|
||||||
|
|
||||||
return continue_emission;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
ask_password (GMountOperation *op,
|
ask_password (GMountOperation *op,
|
||||||
const char *message,
|
const char *message,
|
||||||
const char *default_user,
|
const char *default_user,
|
||||||
const char *default_domain,
|
const char *default_domain,
|
||||||
GAskPasswordFlags flags)
|
GAskPasswordFlags flags)
|
||||||
{
|
{
|
||||||
return FALSE;
|
g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
|
||||||
|
reply_non_handled_in_idle,
|
||||||
|
g_object_ref (op),
|
||||||
|
g_object_unref);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
ask_question (GMountOperation *op,
|
ask_question (GMountOperation *op,
|
||||||
const char *message,
|
const char *message,
|
||||||
const char *choices[])
|
const char *choices[])
|
||||||
{
|
{
|
||||||
return FALSE;
|
g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
|
||||||
|
reply_non_handled_in_idle,
|
||||||
|
g_object_ref (op),
|
||||||
|
g_object_unref);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -256,9 +255,9 @@ g_mount_operation_class_init (GMountOperationClass *klass)
|
|||||||
G_TYPE_FROM_CLASS (object_class),
|
G_TYPE_FROM_CLASS (object_class),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GMountOperationClass, ask_password),
|
G_STRUCT_OFFSET (GMountOperationClass, ask_password),
|
||||||
boolean_handled_accumulator, NULL,
|
NULL, NULL,
|
||||||
_gio_marshal_BOOLEAN__STRING_STRING_STRING_FLAGS,
|
_gio_marshal_VOID__STRING_STRING_STRING_FLAGS,
|
||||||
G_TYPE_BOOLEAN, 4,
|
G_TYPE_NONE, 4,
|
||||||
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_ASK_PASSWORD_FLAGS);
|
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_ASK_PASSWORD_FLAGS);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -275,9 +274,9 @@ g_mount_operation_class_init (GMountOperationClass *klass)
|
|||||||
G_TYPE_FROM_CLASS (object_class),
|
G_TYPE_FROM_CLASS (object_class),
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GMountOperationClass, ask_question),
|
G_STRUCT_OFFSET (GMountOperationClass, ask_question),
|
||||||
boolean_handled_accumulator, NULL,
|
NULL, NULL,
|
||||||
_gio_marshal_BOOLEAN__STRING_BOXED,
|
_gio_marshal_VOID__STRING_BOXED,
|
||||||
G_TYPE_BOOLEAN, 2,
|
G_TYPE_NONE, 2,
|
||||||
G_TYPE_STRING, G_TYPE_STRV);
|
G_TYPE_STRING, G_TYPE_STRV);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -293,9 +292,9 @@ g_mount_operation_class_init (GMountOperationClass *klass)
|
|||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
G_STRUCT_OFFSET (GMountOperationClass, reply),
|
G_STRUCT_OFFSET (GMountOperationClass, reply),
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
g_cclosure_marshal_VOID__BOOLEAN,
|
g_cclosure_marshal_VOID__ENUM,
|
||||||
G_TYPE_NONE, 1,
|
G_TYPE_NONE, 1,
|
||||||
G_TYPE_BOOLEAN);
|
G_TYPE_MOUNT_OPERATION_RESULT);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GMountOperation:username:
|
* GMountOperation:username:
|
||||||
@@ -628,10 +627,10 @@ g_mount_operation_set_choice (GMountOperation *op,
|
|||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
g_mount_operation_reply (GMountOperation *op,
|
g_mount_operation_reply (GMountOperation *op,
|
||||||
gboolean abort)
|
GMountOperationResult result)
|
||||||
{
|
{
|
||||||
g_return_if_fail (G_IS_MOUNT_OPERATION (op));
|
g_return_if_fail (G_IS_MOUNT_OPERATION (op));
|
||||||
g_signal_emit (op, signals[REPLY], 0, abort);
|
g_signal_emit (op, signals[REPLY], 0, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define __G_MOUNT_OPERATION_C__
|
#define __G_MOUNT_OPERATION_C__
|
||||||
|
@@ -92,24 +92,39 @@ typedef enum {
|
|||||||
G_PASSWORD_SAVE_PERMANENTLY
|
G_PASSWORD_SAVE_PERMANENTLY
|
||||||
} GPasswordSave;
|
} GPasswordSave;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GMountOperationResult:
|
||||||
|
* @G_MOUNT_OPERATION_HANDLED: The request was fulfilled and the user specified data is now availible
|
||||||
|
* @G_MOUNT_OPERATION_ABORTED: The user requested the mount operation to be aborted
|
||||||
|
* @G_MOUNT_OPERATION_UNHANDLED: The request was unhandled (i.e. not implemented)
|
||||||
|
*
|
||||||
|
* #GMountOperationResult is returned as a result when a request for information
|
||||||
|
* is send by the mounting operation.
|
||||||
|
**/
|
||||||
|
typedef enum {
|
||||||
|
G_MOUNT_OPERATION_HANDLED,
|
||||||
|
G_MOUNT_OPERATION_ABORTED,
|
||||||
|
G_MOUNT_OPERATION_UNHANDLED
|
||||||
|
} GMountOperationResult;
|
||||||
|
|
||||||
struct _GMountOperationClass
|
struct _GMountOperationClass
|
||||||
{
|
{
|
||||||
GObjectClass parent_class;
|
GObjectClass parent_class;
|
||||||
|
|
||||||
/* signals: */
|
/* signals: */
|
||||||
|
|
||||||
gboolean (* ask_password) (GMountOperation *op,
|
void (* ask_password) (GMountOperation *op,
|
||||||
const char *message,
|
const char *message,
|
||||||
const char *default_user,
|
const char *default_user,
|
||||||
const char *default_domain,
|
const char *default_domain,
|
||||||
GAskPasswordFlags flags);
|
GAskPasswordFlags flags);
|
||||||
|
|
||||||
gboolean (* ask_question) (GMountOperation *op,
|
void (* ask_question) (GMountOperation *op,
|
||||||
const char *message,
|
const char *message,
|
||||||
const char *choices[]);
|
const char *choices[]);
|
||||||
|
|
||||||
void (* reply) (GMountOperation *op,
|
void (* reply) (GMountOperation *op,
|
||||||
gboolean abort);
|
GMountOperationResult result);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
/* Padding for future expansion */
|
/* Padding for future expansion */
|
||||||
@@ -150,7 +165,7 @@ int g_mount_operation_get_choice (GMountOperation *op);
|
|||||||
void g_mount_operation_set_choice (GMountOperation *op,
|
void g_mount_operation_set_choice (GMountOperation *op,
|
||||||
int choice);
|
int choice);
|
||||||
void g_mount_operation_reply (GMountOperation *op,
|
void g_mount_operation_reply (GMountOperation *op,
|
||||||
gboolean abort);
|
GMountOperationResult result);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user