Ejemplo n.º 1
0
static VALUE
rg_initialize(VALUE self)
{
        G_INITIALIZE(self, g_mount_operation_new());

        return Qnil;
}
Ejemplo n.º 2
0
/**
 * Start mount operation and wait in loop until it is finished. This method is 
 * called from thread which is trying to read from location.
 */
nsresult
nsGIOInputStream::MountVolume() {
  GMountOperation* mount_op = g_mount_operation_new();
  g_signal_connect (mount_op, "ask-password",
                    G_CALLBACK (mount_operation_ask_password), mChannel);
  mMountRes = MOUNT_OPERATION_IN_PROGRESS;
  /* g_file_mount_enclosing_volume uses a dbus request to mount the volume.
     Callback mount_enclosing_volume_finished is called in main thread 
     (not this thread on which this method is called). */
  g_file_mount_enclosing_volume(mHandle,
                                G_MOUNT_MOUNT_NONE,
                                mount_op,
                                nullptr,
                                mount_enclosing_volume_finished,
                                this);
  mozilla::MonitorAutoLock mon(mMonitorMountInProgress);
  /* Waiting for finish of mount operation thread */  
  while (mMountRes == MOUNT_OPERATION_IN_PROGRESS)
    mon.Wait();
  
  g_object_unref(mount_op);

  if (mMountRes == MOUNT_OPERATION_FAILED) {
    return MapGIOResult(mMountErrorCode);
  } else {
    return NS_OK;
  }
}
Ejemplo n.º 3
0
GMountOperation *
_gtk_source_file_create_mount_operation (GtkSourceFile *file)
{
	return (file != NULL && file->priv->mount_operation_factory != NULL) ?
		file->priv->mount_operation_factory (file, file->priv->mount_operation_userdata) :
		g_mount_operation_new ();
}
Ejemplo n.º 4
0
static GMountOperation *
new_mount_op (void)
{
  GMountOperation *op;
  
  op = g_mount_operation_new ();

  g_signal_connect (op, "ask_password", (GCallback)ask_password_cb, NULL);

  return op;
}
Ejemplo n.º 5
0
GMountOperation *
gimp_get_mount_operation (Gimp         *gimp,
                          GimpProgress *progress)
{
  g_return_val_if_fail (GIMP_IS_GIMP (gimp), FALSE);
  g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), FALSE);

  if (gimp->gui.get_mount_operation)
    return gimp->gui.get_mount_operation (gimp, progress);

  return g_mount_operation_new ();
}
Ejemplo n.º 6
0
static GMountOperation *
new_mount_op (void)
{
  GMountOperation *op;

  op = g_mount_operation_new ();

  g_signal_connect (op, "ask_password", G_CALLBACK (ask_password_cb), NULL);

  /* TODO: we *should* also connect to the "aborted" signal but since we the
   *       main thread is blocked handling input we won't get that signal
   *       anyway...
   */

  return op;
}
Ejemplo n.º 7
0
static GMountOperation *
new_mount_op (void)
{
  GMountOperation *op;

  op = g_mount_operation_new ();

  g_object_set_data (G_OBJECT (op), "state", GINT_TO_POINTER (MOUNT_OP_NONE));

  g_signal_connect (op, "ask_password", G_CALLBACK (ask_password_cb), NULL);
  g_signal_connect (op, "ask_question", G_CALLBACK (ask_question_cb), NULL);

  /* TODO: we *should* also connect to the "aborted" signal but since the
   * main thread is blocked handling input we won't get that signal anyway...
   */

  return op;
}
Ejemplo n.º 8
0
static void on_find_enclosing_mount_ready (GObject * object, GAsyncResult * res, gpointer data)
{
	GError *error = NULL;
	GDownloadable *download = G_DOWNLOADABLE (data);
	GMount *mount = g_file_find_enclosing_mount_finish (G_FILE(object), res, &error); 
	g_assert (download != NULL);
	
	if (mount) {
		handle_error (error);
		
		GMountOperation * operation = g_mount_operation_new ();
		g_mount_operation_set_anonymous (operation, TRUE); 
		g_file_mount_enclosing_volume (download->priv->remote_file, 0, operation, NULL, on_mount_enclosing_ready, data);

		// TODO: ask username & password
		g_object_unref (operation);
		g_object_unref (mount);		
	} else {
		after_mount_enclosing_volume (download);
	} 
}