aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/fs/fs.h
blob: 39ff7c1df5245bc9d4b035b283bea240d8903052 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
/*
     This file is part of GNUnet.
     (C) 2005 Christian Grothoff (and other contributing authors)

     GNUnet is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published
     by the Free Software Foundation; either version 2, or (at your
     option) any later version.

     GNUnet is distributed in the hope that it will be useful, but
     WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with GNUnet; see the file COPYING.  If not, write to the
     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
     Boston, MA 02111-1307, USA.
*/

/**
 * @file src/plugins/fs/fs.h
 * @brief file-sharing globals of gnunet-gtk
 * @author Christian Grothoff
 */

#ifndef GTK_FS_H
#define GTK_FS_H

#include <GNUnet/gnunet_ecrs_lib.h>
#include <GNUnet/gnunet_fsui_lib.h>
#include "gnunetgtk_common.h"

/**
 * On search box, for namespace selection
 * (for input of search URI; lists known namespaces).
 */
enum {
  NS_SEARCH_DESCRIPTION = 0,
  NS_SEARCH_ENCNAME,
  NS_SEARCH_METADATA,
  NS_SEARCH_FSUI,
  NS_SEARCH_RATING,
  NS_SEARCH_NUM,
};

/**
 * For listing of search results for main search.
 * Represents a search result.
 */
enum {
  SEARCH_NAME = 0,
  SEARCH_SIZE,
  SEARCH_HSIZE,
  SEARCH_MIME,
  SEARCH_DESC,
  SEARCH_PIXBUF,
  SEARCH_URI,
  SEARCH_META,
  SEARCH_INTERNAL,
  SEARCH_INTERNAL_PARENT,
  SEARCH_NUM,
};

/**
 * Search entry in search summary list.
 * Represents a search process.
 */
enum {
  SEARCH_SUMMARY_NAME = 0,
  SEARCH_SUMMARY_RESULT_COUNT,
  SEARCH_SUMMARY_INTERNAL,
  SEARCH_SUMMARY_NUM
};

/**
 * Entry in download summary.
 */
enum {
  DOWNLOAD_FILENAME = 0,
  DOWNLOAD_SHORTNAME,
  DOWNLOAD_SIZE,
  DOWNLOAD_HSIZE,
  DOWNLOAD_PROGRESS,
  DOWNLOAD_URISTRING,
  DOWNLOAD_INTERNAL, /* struct DL */
  DOWNLOAD_NUM
};

enum {
  NAMESPACE_FILENAME = 0,
  NAMESPACE_SIZE,
  NAMESPACE_HSIZE,
  NAMESPACE_URISTRING,
  NAMESPACE_URI,
  NAMESPACE_META,
  NAMESPACE_NUM
};

enum {
  IN_NAMESPACE_FILENAME = 0,
  IN_NAMESPACE_SIZE,
  IN_NAMESPACE_HSIZE,
  IN_NAMESPACE_DESCRIPTION,
  IN_NAMESPACE_MIMETYPE,
  IN_NAMESPACE_LAST_STRING,
  IN_NAMESPACE_NEXT_STRING,
  IN_NAMESPACE_PUB_FREQ_STRING,
  IN_NAMESPACE_PUB_DATE_STRING,
  IN_NAMESPACE_URI,
  IN_NAMESPACE_META,
  IN_NAMESPACE_NUM
};

/**
 * Entry in upload summary.
 */
enum {
  UPLOAD_FILENAME = 0,
  UPLOAD_PROGRESS,
  UPLOAD_URISTRING,
  UPLOAD_INTERNAL,
  UPLOAD_NUM
};

enum {
  META_TYPE = 0,
  META_STYPE,
  META_VALUE,
  META_NUM,
};

enum {
  KTYPE_STRING = 0,
  KTYPE_TYPE,
  KTYPE_NUM,
};


/**
 * @brief linked list of pages in the search notebook
 */
typedef struct SL {
  struct SL * next;
  /**
   * Reference to the glade XML context that was
   * used to create the search page.
   */
  GladeXML * searchXML;

  /**
   * Reference to the glade XML context that was
   * used to create the search label.
   */
  GladeXML * labelXML;

  /**
   * Tree view widget that is used to display the
   * search results.
   */
  GtkTreeView * treeview;

  /**
   * Model of the tree view.
   */
  GtkTreeStore * tree;

  /**
   * The label used in the notebook page.
   */
  GtkWidget * tab_label;

  /**
   * The notebook page that is associated with this
   * search.
   */
  GtkWidget * searchpage;

  /**
   * Path to the entry in the summary list
   * for this search.
   */
  GtkTreeRowReference * summaryViewRowReference;

  /**
   * URI for this search.
   */
  struct ECRS_URI * uri;

  /**
   * String describing the search.
   */
  char * searchString;

  /**
   * Number of results received so far.
   */
  unsigned int resultsReceived;

  /**
   * FSUI search handle.
   */
  struct FSUI_SearchList * fsui_list; 
} SearchList;


typedef struct DL {
  struct DL * next;

  /**
   * URI of the download.
   */
  struct ECRS_URI * uri;

  /**
   * Where is the download being saved to?
   */
  char * filename;

  /**
   * Path in the summary view for this download.
   */
  GtkTreeRowReference * summaryViewRowReference;

  /**
   * Search that this download belongs to.
   * Maybe NULL.
   */
  struct SL * searchList;

  /**
   * Path in the search view that this
   * download is represented by.  Maybe NULL
   * if search has been closed or if download
   * was initiated from URI without search.
   */
  GtkTreeRowReference * searchViewRowReference;

  /**
   * FSUI reference for the download.
   */
  struct FSUI_DownloadList * fsui_list;

  /**
   * Total size of the download.
   */
  unsigned long long total;

  /**
   * Is this a GNUnet directory? (by mime-type)
   */
  int is_directory;

  int has_terminated;

} DownloadList;

typedef struct UL {
  struct UL * next;

  /**
   * Which file or directory are we uploading?
   */
  char * filename;

  /**
   * Path in the summary view for this download.
   */
  GtkTreeRowReference * summaryViewRowReference;

  struct FSUI_UploadList * fsui_list;

  /**
   * Set to final URI upon successful completion.
   */
  struct ECRS_URI * uri;

  /**
   * Total size of the upload.
   */
  unsigned long long total;

  int has_terminated;

} UploadList;

extern struct FSUI_Context * ctx;

extern struct GE_Context * ectx;

extern struct GC_Configuration * cfg;

extern SearchList * search_head;

extern DownloadList * download_head;

extern UploadList * upload_head;

extern GtkListStore * search_summary;

extern GtkTreeStore * download_summary;

extern GtkTreeStore * upload_summary;

#endif