~ubuntu-branches/ubuntu/maverick/transmission/maverick

« back to all changes in this revision

Viewing changes to gtk/tr_torrent.h

  • Committer: Bazaar Package Importer
  • Author(s): Philipp Benner
  • Date: 2006-08-29 20:50:41 UTC
  • Revision ID: james.westby@ubuntu.com-20060829205041-mzhpiqksdf7pbk17
Tags: upstream-0.6.1.dfsg
ImportĀ upstreamĀ versionĀ 0.6.1.dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  $Id: tr_torrent.h 320 2006-06-10 06:53:20Z joshe $
 
3
 
 
4
  Copyright (c) 2006 Joshua Elsasser. All rights reserved.
 
5
   
 
6
  Redistribution and use in source and binary forms, with or without
 
7
  modification, are permitted provided that the following conditions
 
8
  are met:
 
9
   
 
10
   1. Redistributions of source code must retain the above copyright
 
11
      notice, this list of conditions and the following disclaimer.
 
12
   2. Redistributions in binary form must reproduce the above copyright
 
13
      notice, this list of conditions and the following disclaimer in the
 
14
      documentation and/or other materials provided with the distribution.
 
15
   
 
16
  THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS "AS IS" AND
 
17
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 
18
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 
19
  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 
20
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 
21
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 
22
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 
23
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 
24
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 
25
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 
26
  POSSIBILITY OF SUCH DAMAGE.
 
27
*/
 
28
 
 
29
#ifndef TR_TORRENT_H
 
30
#define TR_TORRENT_H
 
31
 
 
32
#include <glib-object.h>
 
33
 
 
34
#include "transmission.h"
 
35
#include "bencode.h"
 
36
 
 
37
#define TR_TORRENT_TYPE           (tr_torrent_get_type ())
 
38
#define TR_TORRENT(obj) \
 
39
  (G_TYPE_CHECK_INSTANCE_CAST ((obj), TR_TORRENT_TYPE, TrTorrent))
 
40
#define TR_TORRENT_CLASS(klass) \
 
41
  (G_TYPE_CHECK_CLASS_CAST ((klass), TR_TORRENT_TYPE, TrTorrentClass))
 
42
#define TR_IS_TORRENT(obj) \
 
43
  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TR_TORRENT_TYPE))
 
44
#define TR_IS_TORRENT_CLASS(klass) \
 
45
  (G_TYPE_CHECK_CLASS_TYPE ((klass), TR_TORRENT_TYPE))
 
46
#define TR_TORRENT_GET_CLASS(obj) \
 
47
  (G_TYPE_INSTANCE_GET_CLASS ((obj), TR_TORRENT_TYPE, TrTorrentClass))
 
48
 
 
49
typedef struct _TrTorrent TrTorrent;
 
50
typedef struct _TrTorrentClass TrTorrentClass;
 
51
 
 
52
/* treat the contents of this structure as private */
 
53
struct _TrTorrent {
 
54
  GObject parent;
 
55
  tr_torrent_t *handle;
 
56
  GObject *back;
 
57
  char *dir;
 
58
  gboolean closing;
 
59
  char *delfile;
 
60
  gboolean disposed;
 
61
};
 
62
 
 
63
struct _TrTorrentClass {
 
64
  GObjectClass parent;
 
65
  int paused_signal_id;
 
66
};
 
67
 
 
68
GType
 
69
tr_torrent_get_type(void);
 
70
 
 
71
tr_torrent_t *
 
72
tr_torrent_handle(TrTorrent *tor);
 
73
 
 
74
tr_stat_t *
 
75
tr_torrent_stat(TrTorrent *tor);
 
76
 
 
77
tr_info_t *
 
78
tr_torrent_info(TrTorrent *tor);
 
79
 
 
80
/* explicitly start the torrent running or paused */
 
81
#define TR_TORNEW_PAUSED        0x01
 
82
#define TR_TORNEW_RUNNING       0x02
 
83
/* load a saved torrent file, torrent param is hash instead of filename */
 
84
#define TR_TORNEW_LOAD_SAVED    0x04
 
85
/* save a private copy of the torrent file */
 
86
#define TR_TORNEW_SAVE_COPY     0x08
 
87
/* save a private copy of the torrent file and remove the original */
 
88
#define TR_TORNEW_SAVE_MOVE     0x10
 
89
 
 
90
TrTorrent *
 
91
tr_torrent_new(GObject *backend, const char *torrent, const char *dir,
 
92
               guint flags, char **err);
 
93
 
 
94
TrTorrent *
 
95
tr_torrent_new_with_state(GObject *backend, benc_val_t *state, char **err);
 
96
 
 
97
void
 
98
tr_torrent_stop_politely(TrTorrent *tor);
 
99
 
 
100
tr_stat_t *
 
101
tr_torrent_stat_polite(TrTorrent *tor);
 
102
 
 
103
#ifdef TR_WANT_TORRENT_PRIVATE
 
104
void
 
105
tr_torrent_get_state(TrTorrent *tor, benc_val_t *state);
 
106
void
 
107
tr_torrent_state_saved(TrTorrent *tor);
 
108
#endif
 
109
 
 
110
#endif