X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gio%2Fgmountoperation.c;h=d0ede5d7e3af19cd7b145a31d3a2073b615931f1;hb=174ebaefcc2b1b94f4a628e60f150b7209230dbf;hp=35927d410236f84be1ea9c25bd4acee54ce48c93;hpb=a4e38786750d538b334b8a7a7cc9f5a3ff48bc33;p=platform%2Fupstream%2Fglib.git
diff --git a/gio/gmountoperation.c b/gio/gmountoperation.c
index 35927d4..d0ede5d 100644
--- a/gio/gmountoperation.c
+++ b/gio/gmountoperation.c
@@ -13,9 +13,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Public License along with this library; if not, see .
*
* Author: Alexander Larsson
*/
@@ -26,10 +24,8 @@
#include "gmountoperation.h"
#include "gioenumtypes.h"
-#include "gio-marshal.h"
#include "glibintl.h"
-#include "gioalias.h"
/**
* SECTION:gmountoperation
@@ -53,14 +49,13 @@
* passed, see each method taking a #GMountOperation for details.
*/
-G_DEFINE_TYPE (GMountOperation, g_mount_operation, G_TYPE_OBJECT);
-
enum {
ASK_PASSWORD,
ASK_QUESTION,
REPLY,
ABORTED,
SHOW_PROCESSES,
+ SHOW_UNMOUNT_PROGRESS,
LAST_SIGNAL
};
@@ -85,6 +80,8 @@ enum {
PROP_CHOICE
};
+G_DEFINE_TYPE_WITH_PRIVATE (GMountOperation, g_mount_operation, G_TYPE_OBJECT)
+
static void
g_mount_operation_set_property (GObject *object,
guint prop_id,
@@ -202,7 +199,7 @@ reply_non_handled_in_idle (gpointer data)
GMountOperation *op = data;
g_mount_operation_reply (op, G_MOUNT_OPERATION_UNHANDLED);
- return FALSE;
+ return G_SOURCE_REMOVE;
}
static void
@@ -242,11 +239,18 @@ show_processes (GMountOperation *op,
}
static void
+show_unmount_progress (GMountOperation *op,
+ const gchar *message,
+ gint64 time_left,
+ gint64 bytes_left)
+{
+ /* nothing to do */
+}
+
+static void
g_mount_operation_class_init (GMountOperationClass *klass)
{
GObjectClass *object_class;
-
- g_type_class_add_private (klass, sizeof (GMountOperationPrivate));
object_class = G_OBJECT_CLASS (klass);
object_class->finalize = g_mount_operation_finalize;
@@ -256,6 +260,7 @@ g_mount_operation_class_init (GMountOperationClass *klass)
klass->ask_password = ask_password;
klass->ask_question = ask_question;
klass->show_processes = show_processes;
+ klass->show_unmount_progress = show_unmount_progress;
/**
* GMountOperation::ask-password:
@@ -277,7 +282,7 @@ g_mount_operation_class_init (GMountOperationClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GMountOperationClass, ask_password),
NULL, NULL,
- _gio_marshal_VOID__STRING_STRING_STRING_FLAGS,
+ NULL,
G_TYPE_NONE, 4,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_ASK_PASSWORD_FLAGS);
@@ -300,7 +305,7 @@ g_mount_operation_class_init (GMountOperationClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GMountOperationClass, ask_question),
NULL, NULL,
- _gio_marshal_VOID__STRING_BOXED,
+ NULL,
G_TYPE_NONE, 2,
G_TYPE_STRING, G_TYPE_STRV);
@@ -345,7 +350,8 @@ g_mount_operation_class_init (GMountOperationClass *klass)
* GMountOperation::show-processes:
* @op: a #GMountOperation.
* @message: string containing a message to display to the user.
- * @processes: an array of #GPid for processes blocking the operation.
+ * @processes: (element-type GPid): an array of #GPid for processes
+ * blocking the operation.
* @choices: an array of strings for each possible choice.
*
* Emitted when one or more processes are blocking an operation
@@ -369,11 +375,49 @@ g_mount_operation_class_init (GMountOperationClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GMountOperationClass, show_processes),
NULL, NULL,
- _gio_marshal_VOID__STRING_BOXED_BOXED,
+ NULL,
G_TYPE_NONE, 3,
G_TYPE_STRING, G_TYPE_ARRAY, G_TYPE_STRV);
/**
+ * GMountOperation::show-unmount-progress:
+ * @op: a #GMountOperation:
+ * @message: string containing a mesage to display to the user
+ * @time_left: the estimated time left before the operation completes,
+ * in microseconds, or -1
+ * @bytes_left: the amount of bytes to be written before the operation
+ * completes (or -1 if such amount is not known), or zero if the operation
+ * is completed
+ *
+ * Emitted when an unmount operation has been busy for more than some time
+ * (typically 1.5 seconds).
+ *
+ * When unmounting or ejecting a volume, the kernel might need to flush
+ * pending data in its buffers to the volume stable storage, and this operation
+ * can take a considerable amount of time. This signal may be emitted several
+ * times as long as the unmount operation is outstanding, and then one
+ * last time when the operation is completed, with @bytes_left set to zero.
+ *
+ * Implementations of GMountOperation should handle this signal by
+ * showing an UI notification, and then dismiss it, or show another notification
+ * of completion, when @bytes_left reaches zero.
+ *
+ * If the message contains a line break, the first line should be
+ * presented as a heading. For example, it may be used as the
+ * primary text in a #GtkMessageDialog.
+ *
+ * Since: 2.34
+ */
+ signals[SHOW_UNMOUNT_PROGRESS] =
+ g_signal_new (I_("show-unmount-progress"),
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GMountOperationClass, show_unmount_progress),
+ NULL, NULL, NULL,
+ G_TYPE_NONE, 3,
+ G_TYPE_STRING, G_TYPE_INT64, G_TYPE_INT64);
+
+ /**
* GMountOperation:username:
*
* The user name that is used for authentication when carrying out
@@ -465,9 +509,7 @@ g_mount_operation_class_init (GMountOperationClass *klass)
static void
g_mount_operation_init (GMountOperation *operation)
{
- operation->priv = G_TYPE_INSTANCE_GET_PRIVATE (operation,
- G_TYPE_MOUNT_OPERATION,
- GMountOperationPrivate);
+ operation->priv = g_mount_operation_get_instance_private (operation);
}
/**
@@ -484,7 +526,7 @@ g_mount_operation_new (void)
}
/**
- * g_mount_operation_get_username
+ * g_mount_operation_get_username:
* @op: a #GMountOperation.
*
* Get the user name from the mount operation.
@@ -708,6 +750,3 @@ g_mount_operation_reply (GMountOperation *op,
g_return_if_fail (G_IS_MOUNT_OPERATION (op));
g_signal_emit (op, signals[REPLY], 0, result);
}
-
-#define __G_MOUNT_OPERATION_C__
-#include "gioaliasdef.c"