Mercurial > pidgin.yaz
annotate finch/gntft.c @ 18312:adcb44a07a2d
This is a more flexible way of getting random settings from .gntrc.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Wed, 27 Jun 2007 18:21:02 +0000 |
parents | 16f3919b78f5 |
children | 2d4df5ef0090 |
rev | line source |
---|---|
15818 | 1 /** |
2 * @file gntft.c GNT File Transfer UI | |
16194
0f0832c13fcb
Rename the Doxygen group from gntui to finch and define the finch group
Richard Laager <rlaager@wiktel.com>
parents:
15964
diff
changeset
|
3 * @ingroup finch |
15818 | 4 * |
15871
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15823
diff
changeset
|
5 * finch |
15818 | 6 * |
15871
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15823
diff
changeset
|
7 * Finch is the legal property of its developers, whose names are too numerous |
15818 | 8 * to list here. Please refer to the COPYRIGHT file distributed with this |
9 * source distribution. | |
10 * | |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
25 #include <gnt.h> | |
26 #include <gntbox.h> | |
27 #include <gntbutton.h> | |
28 #include <gntcheckbox.h> | |
29 #include <gntlabel.h> | |
30 #include <gnttree.h> | |
31 #include "internal.h" | |
32 | |
33 #include "debug.h" | |
34 #include "notify.h" | |
35 #include "ft.h" | |
36 #include "prpl.h" | |
37 #include "util.h" | |
38 | |
39 #include "gntft.h" | |
40 #include "prefs.h" | |
41 | |
15823 | 42 #define FINCHXFER(xfer) \ |
43 (PurpleGntXferUiData *)(xfer)->ui_data | |
15818 | 44 |
45 typedef struct | |
46 { | |
47 gboolean keep_open; | |
48 gboolean auto_clear; | |
49 gint num_transfers; | |
50 | |
51 GntWidget *window; | |
52 GntWidget *tree; | |
53 | |
54 GntWidget *remove_button; | |
55 GntWidget *stop_button; | |
56 GntWidget *close_button; | |
15823 | 57 } PurpleGntXferDialog; |
15818 | 58 |
15823 | 59 static PurpleGntXferDialog *xfer_dialog = NULL; |
15818 | 60 |
61 typedef struct | |
62 { | |
63 time_t last_updated_time; | |
64 gboolean in_list; | |
65 | |
66 char *name; | |
67 | |
15823 | 68 } PurpleGntXferUiData; |
15818 | 69 |
70 enum | |
71 { | |
72 COLUMN_PROGRESS = 0, | |
73 COLUMN_FILENAME, | |
74 COLUMN_SIZE, | |
75 COLUMN_SPEED, | |
76 COLUMN_REMAINING, | |
77 COLUMN_STATUS, | |
78 NUM_COLUMNS | |
79 }; | |
80 | |
81 | |
82 /************************************************************************** | |
83 * Utility Functions | |
84 **************************************************************************/ | |
85 | |
86 static void | |
87 update_title_progress() | |
88 { | |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
16677
diff
changeset
|
89 GList *list; |
15818 | 90 int num_active_xfers = 0; |
91 guint64 total_bytes_xferred = 0; | |
92 guint64 total_file_size = 0; | |
93 | |
94 if (xfer_dialog == NULL || xfer_dialog->window == NULL) | |
95 return; | |
96 | |
97 /* Find all active transfers */ | |
98 for (list = gnt_tree_get_rows(GNT_TREE(xfer_dialog->tree)); list; list = list->next) { | |
15823 | 99 PurpleXfer *xfer = (PurpleXfer *)list->data; |
15818 | 100 |
15823 | 101 if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_STARTED) { |
15818 | 102 num_active_xfers++; |
15823 | 103 total_bytes_xferred += purple_xfer_get_bytes_sent(xfer); |
104 total_file_size += purple_xfer_get_size(xfer); | |
15818 | 105 } |
106 } | |
107 | |
108 /* Update the title */ | |
109 if (num_active_xfers > 0) { | |
110 gchar *title; | |
111 int total_pct = 0; | |
112 | |
113 if (total_file_size > 0) { | |
114 total_pct = 100 * total_bytes_xferred / total_file_size; | |
115 } | |
116 | |
117 title = g_strdup_printf(_("File Transfers - %d%% of %d files"), | |
118 total_pct, num_active_xfers); | |
119 gnt_screen_rename_widget((xfer_dialog->window), title); | |
120 g_free(title); | |
121 } else { | |
122 gnt_screen_rename_widget((xfer_dialog->window), _("File Transfers")); | |
123 } | |
124 } | |
125 | |
126 | |
127 /************************************************************************** | |
128 * Callbacks | |
129 **************************************************************************/ | |
130 static void | |
131 toggle_keep_open_cb(GntWidget *w) | |
132 { | |
133 xfer_dialog->keep_open = !xfer_dialog->keep_open; | |
16427
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
16194
diff
changeset
|
134 purple_prefs_set_bool("/finch/filetransfer/keep_open", |
15818 | 135 xfer_dialog->keep_open); |
136 } | |
137 | |
138 static void | |
139 toggle_clear_finished_cb(GntWidget *w) | |
140 { | |
141 xfer_dialog->auto_clear = !xfer_dialog->auto_clear; | |
16427
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
16194
diff
changeset
|
142 purple_prefs_set_bool("/finch/filetransfer/clear_finished", |
15818 | 143 xfer_dialog->auto_clear); |
144 } | |
145 | |
146 static void | |
147 remove_button_cb(GntButton *button) | |
148 { | |
15823 | 149 PurpleXfer *selected_xfer = gnt_tree_get_selection_data(GNT_TREE(xfer_dialog->tree)); |
150 if (selected_xfer && (selected_xfer->status == PURPLE_XFER_STATUS_CANCEL_LOCAL || | |
151 selected_xfer->status == PURPLE_XFER_STATUS_CANCEL_REMOTE || | |
152 selected_xfer->status == PURPLE_XFER_STATUS_DONE)) { | |
15818 | 153 finch_xfer_dialog_remove_xfer(selected_xfer); |
154 } | |
155 } | |
156 | |
157 static void | |
158 stop_button_cb(GntButton *button) | |
159 { | |
15823 | 160 PurpleXfer *selected_xfer = gnt_tree_get_selection_data(GNT_TREE(xfer_dialog->tree)); |
15942
ee397e53d9ce
allow cancellation of transfers waiting to be accepted
Richard Nelson <wabz@pidgin.im>
parents:
15871
diff
changeset
|
161 if (selected_xfer && selected_xfer->status != PURPLE_XFER_STATUS_CANCEL_LOCAL && |
ee397e53d9ce
allow cancellation of transfers waiting to be accepted
Richard Nelson <wabz@pidgin.im>
parents:
15871
diff
changeset
|
162 selected_xfer->status != PURPLE_XFER_STATUS_CANCEL_REMOTE && |
ee397e53d9ce
allow cancellation of transfers waiting to be accepted
Richard Nelson <wabz@pidgin.im>
parents:
15871
diff
changeset
|
163 selected_xfer->status != PURPLE_XFER_STATUS_DONE) |
15823 | 164 purple_xfer_cancel_local(selected_xfer); |
15818 | 165 } |
166 | |
167 /************************************************************************** | |
168 * Dialog Building Functions | |
169 **************************************************************************/ | |
170 | |
171 | |
172 void | |
173 finch_xfer_dialog_new(void) | |
174 { | |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
16677
diff
changeset
|
175 GList *iter; |
15818 | 176 GntWidget *window; |
177 GntWidget *bbox; | |
178 GntWidget *button; | |
179 GntWidget *checkbox; | |
180 GntWidget *tree; | |
181 | |
182 if (!xfer_dialog) | |
15823 | 183 xfer_dialog = g_new0(PurpleGntXferDialog, 1); |
15818 | 184 |
185 xfer_dialog->keep_open = | |
16427
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
16194
diff
changeset
|
186 purple_prefs_get_bool("/finch/filetransfer/keep_open"); |
15818 | 187 xfer_dialog->auto_clear = |
16427
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
16194
diff
changeset
|
188 purple_prefs_get_bool("/finch/filetransfer/clear_finished"); |
15818 | 189 |
190 /* Create the window. */ | |
191 xfer_dialog->window = window = gnt_vbox_new(FALSE); | |
192 g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(finch_xfer_dialog_destroy), NULL); | |
193 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
194 gnt_box_set_title(GNT_BOX(window), _("File Transfers")); | |
195 | |
196 xfer_dialog->tree = tree = gnt_tree_new_with_columns(NUM_COLUMNS); | |
197 gnt_tree_set_column_titles(GNT_TREE(tree), _("Progress"), _("Filename"), _("Size"), _("Speed"), _("Remaining"), _("Status")); | |
198 gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_PROGRESS, 8); | |
199 gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_FILENAME, 8); | |
200 gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_SIZE, 10); | |
201 gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_SPEED, 10); | |
202 gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_REMAINING, 10); | |
203 gnt_tree_set_col_width(GNT_TREE(tree), COLUMN_STATUS, 10); | |
204 gnt_tree_set_show_title(GNT_TREE(tree), TRUE); | |
205 gnt_box_add_widget(GNT_BOX(window), tree); | |
15942
ee397e53d9ce
allow cancellation of transfers waiting to be accepted
Richard Nelson <wabz@pidgin.im>
parents:
15871
diff
changeset
|
206 |
15818 | 207 checkbox = gnt_check_box_new( _("Close this window when all transfers finish")); |
208 gnt_check_box_set_checked(GNT_CHECK_BOX(checkbox), | |
209 !xfer_dialog->keep_open); | |
210 g_signal_connect(G_OBJECT(checkbox), "toggled", | |
211 G_CALLBACK(toggle_keep_open_cb), NULL); | |
212 gnt_box_add_widget(GNT_BOX(window), checkbox); | |
213 | |
214 checkbox = gnt_check_box_new(_("Clear finished transfers")); | |
215 gnt_check_box_set_checked(GNT_CHECK_BOX(checkbox), | |
216 xfer_dialog->auto_clear); | |
217 g_signal_connect(G_OBJECT(checkbox), "toggled", | |
218 G_CALLBACK(toggle_clear_finished_cb), NULL); | |
219 gnt_box_add_widget(GNT_BOX(window), checkbox); | |
220 | |
221 bbox = gnt_hbox_new(TRUE); | |
222 | |
223 xfer_dialog->remove_button = button = gnt_button_new(_("Remove")); | |
224 g_signal_connect(G_OBJECT(button), "activate", | |
225 G_CALLBACK(remove_button_cb), NULL); | |
226 gnt_box_add_widget(GNT_BOX(bbox), button); | |
227 | |
228 xfer_dialog->stop_button = button = gnt_button_new(_("Stop")); | |
229 g_signal_connect(G_OBJECT(button), "activate", | |
230 G_CALLBACK(stop_button_cb), NULL); | |
231 gnt_box_add_widget(GNT_BOX(bbox), button); | |
232 | |
233 xfer_dialog->close_button = button = gnt_button_new(_("Close")); | |
234 g_signal_connect(G_OBJECT(button), "activate", | |
235 G_CALLBACK(finch_xfer_dialog_destroy), NULL); | |
236 gnt_box_add_widget(GNT_BOX(bbox), button); | |
237 | |
238 gnt_box_add_widget(GNT_BOX(window), bbox); | |
239 | |
15823 | 240 for (iter = purple_xfers_get_all(); iter; iter = iter->next) { |
241 PurpleXfer *xfer = (PurpleXfer *)iter->data; | |
242 PurpleGntXferUiData *data = FINCHXFER(xfer); | |
15818 | 243 if (data->in_list) { |
244 finch_xfer_dialog_add_xfer(xfer); | |
245 finch_xfer_dialog_update_xfer(xfer); | |
246 gnt_tree_set_selected(GNT_TREE(tree), xfer); | |
247 } | |
248 } | |
249 gnt_widget_show(xfer_dialog->window); | |
250 } | |
251 | |
252 void | |
253 finch_xfer_dialog_destroy() | |
254 { | |
255 gnt_widget_destroy(xfer_dialog->window); | |
256 g_free(xfer_dialog); | |
257 xfer_dialog = NULL; | |
258 } | |
259 | |
260 void | |
261 finch_xfer_dialog_show() | |
262 { | |
263 if (xfer_dialog == NULL) | |
264 finch_xfer_dialog_new(); | |
265 } | |
266 | |
267 void | |
15823 | 268 finch_xfer_dialog_add_xfer(PurpleXfer *xfer) |
15818 | 269 { |
15823 | 270 PurpleGntXferUiData *data; |
271 PurpleXferType type; | |
15818 | 272 char *size_str, *remaining_str; |
273 char *lfilename, *utf8; | |
274 | |
275 g_return_if_fail(xfer_dialog != NULL); | |
276 g_return_if_fail(xfer != NULL); | |
277 | |
15823 | 278 purple_xfer_ref(xfer); |
15818 | 279 |
15823 | 280 data = FINCHXFER(xfer); |
15818 | 281 data->in_list = TRUE; |
282 | |
283 finch_xfer_dialog_show(); | |
284 | |
285 data->last_updated_time = 0; | |
286 | |
15823 | 287 type = purple_xfer_get_type(xfer); |
15818 | 288 |
15823 | 289 size_str = purple_str_size_to_units(purple_xfer_get_size(xfer)); |
290 remaining_str = purple_str_size_to_units(purple_xfer_get_bytes_remaining(xfer)); | |
15818 | 291 |
15823 | 292 lfilename = g_path_get_basename(purple_xfer_get_local_filename(xfer)); |
15818 | 293 utf8 = g_filename_to_utf8(lfilename, -1, NULL, NULL, NULL); |
294 g_free(lfilename); | |
295 lfilename = utf8; | |
296 gnt_tree_add_row_last(GNT_TREE(xfer_dialog->tree), xfer, | |
297 gnt_tree_create_row(GNT_TREE(xfer_dialog->tree), | |
15823 | 298 "0.0", (type == PURPLE_XFER_RECEIVE) ? purple_xfer_get_filename(xfer) : lfilename, |
15818 | 299 size_str, "0.0", "",_("Waiting for transfer to begin")), NULL); |
300 g_free(lfilename); | |
301 | |
302 g_free(size_str); | |
303 g_free(remaining_str); | |
304 | |
305 xfer_dialog->num_transfers++; | |
306 | |
307 update_title_progress(); | |
308 } | |
309 | |
310 void | |
15823 | 311 finch_xfer_dialog_remove_xfer(PurpleXfer *xfer) |
15818 | 312 { |
15823 | 313 PurpleGntXferUiData *data; |
15818 | 314 |
315 g_return_if_fail(xfer_dialog != NULL); | |
316 g_return_if_fail(xfer != NULL); | |
317 | |
15823 | 318 data = FINCHXFER(xfer); |
15818 | 319 |
320 if (data == NULL) | |
321 return; | |
322 | |
323 if (!data->in_list) | |
324 return; | |
325 | |
326 data->in_list = FALSE; | |
327 | |
328 gnt_tree_remove(GNT_TREE(xfer_dialog->tree), xfer); | |
329 | |
330 xfer_dialog->num_transfers--; | |
331 | |
332 if (xfer_dialog->num_transfers == 0 && !xfer_dialog->keep_open) | |
333 finch_xfer_dialog_destroy(); | |
334 else | |
335 update_title_progress(); | |
15823 | 336 purple_xfer_unref(xfer); |
15818 | 337 } |
338 | |
339 void | |
15823 | 340 finch_xfer_dialog_cancel_xfer(PurpleXfer *xfer) |
15818 | 341 { |
15823 | 342 PurpleGntXferUiData *data; |
15818 | 343 const gchar *status; |
344 | |
345 g_return_if_fail(xfer_dialog != NULL); | |
346 g_return_if_fail(xfer != NULL); | |
347 | |
15823 | 348 data = FINCHXFER(xfer); |
15818 | 349 |
350 if (data == NULL) | |
351 return; | |
352 | |
353 if (!data->in_list) | |
354 return; | |
355 | |
15823 | 356 if ((purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL) && (xfer_dialog->auto_clear)) { |
15818 | 357 finch_xfer_dialog_remove_xfer(xfer); |
358 return; | |
359 } | |
360 | |
15823 | 361 data = FINCHXFER(xfer); |
15818 | 362 |
363 update_title_progress(); | |
364 | |
15823 | 365 if (purple_xfer_is_canceled(xfer)) |
15818 | 366 status = _("Canceled"); |
367 else | |
368 status = _("Failed"); | |
369 | |
370 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_STATUS, status); | |
371 } | |
372 | |
373 void | |
15823 | 374 finch_xfer_dialog_update_xfer(PurpleXfer *xfer) |
15818 | 375 { |
15823 | 376 PurpleGntXferUiData *data; |
15818 | 377 char *size_str, *remaining_str; |
378 time_t current_time; | |
379 char prog_str[5]; | |
380 double kb_sent, kb_rem; | |
381 double kbps = 0.0; | |
382 time_t elapsed, now; | |
383 char *kbsec; | |
384 | |
385 if (xfer->end_time != 0) | |
386 now = xfer->end_time; | |
387 else | |
388 now = time(NULL); | |
389 | |
15823 | 390 kb_sent = purple_xfer_get_bytes_sent(xfer) / 1024.0; |
391 kb_rem = purple_xfer_get_bytes_remaining(xfer) / 1024.0; | |
15818 | 392 elapsed = (xfer->start_time > 0 ? now - xfer->start_time : 0); |
393 kbps = (elapsed > 0 ? (kb_sent / elapsed) : 0); | |
394 | |
395 g_return_if_fail(xfer_dialog != NULL); | |
396 g_return_if_fail(xfer != NULL); | |
397 | |
15823 | 398 if ((data = FINCHXFER(xfer)) == NULL) |
15818 | 399 return; |
400 | |
401 if (data->in_list == FALSE) | |
402 return; | |
403 | |
404 current_time = time(NULL); | |
405 if (((current_time - data->last_updated_time) == 0) && | |
15823 | 406 (!purple_xfer_is_completed(xfer))) { |
15818 | 407 /* Don't update the window more than once per second */ |
408 return; | |
409 } | |
410 data->last_updated_time = current_time; | |
411 | |
15823 | 412 size_str = purple_str_size_to_units(purple_xfer_get_size(xfer)); |
413 remaining_str = purple_str_size_to_units(purple_xfer_get_bytes_remaining(xfer)); | |
18129
16f3919b78f5
Use the IEC binary units to match our math.
Richard Laager <rlaager@wiktel.com>
parents:
18118
diff
changeset
|
414 kbsec = g_strdup_printf(_("%.2f KiB/s"), kbps); |
15818 | 415 |
416 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_PROGRESS, | |
15823 | 417 g_ascii_dtostr(prog_str, sizeof(prog_str), purple_xfer_get_progress(xfer) * 100.)); |
15818 | 418 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_SIZE, size_str); |
419 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_REMAINING, remaining_str); | |
420 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_SPEED, kbsec); | |
421 g_free(size_str); | |
422 g_free(remaining_str); | |
15964 | 423 g_free(kbsec); |
15823 | 424 if (purple_xfer_is_completed(xfer)) { |
15818 | 425 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_STATUS, _("Finished")); |
15942
ee397e53d9ce
allow cancellation of transfers waiting to be accepted
Richard Nelson <wabz@pidgin.im>
parents:
15871
diff
changeset
|
426 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_REMAINING, _("Finished")); |
15818 | 427 } else { |
428 gnt_tree_change_text(GNT_TREE(xfer_dialog->tree), xfer, COLUMN_STATUS, _("Transferring")); | |
429 } | |
430 | |
431 update_title_progress(); | |
432 | |
15823 | 433 if (purple_xfer_is_completed(xfer) && xfer_dialog->auto_clear) |
15818 | 434 finch_xfer_dialog_remove_xfer(xfer); |
435 } | |
436 | |
437 /************************************************************************** | |
438 * File Transfer UI Ops | |
439 **************************************************************************/ | |
440 static void | |
15823 | 441 finch_xfer_new_xfer(PurpleXfer *xfer) |
15818 | 442 { |
15823 | 443 PurpleGntXferUiData *data; |
15818 | 444 |
445 /* This is where we're setting xfer->ui_data for the first time. */ | |
15823 | 446 data = g_new0(PurpleGntXferUiData, 1); |
15818 | 447 xfer->ui_data = data; |
448 } | |
449 | |
450 static void | |
15823 | 451 finch_xfer_destroy(PurpleXfer *xfer) |
15818 | 452 { |
15823 | 453 PurpleGntXferUiData *data; |
15818 | 454 |
15823 | 455 data = FINCHXFER(xfer); |
15818 | 456 if (data) { |
457 g_free(data->name); | |
458 g_free(data); | |
459 xfer->ui_data = NULL; | |
460 } | |
461 } | |
462 | |
463 static void | |
15823 | 464 finch_xfer_add_xfer(PurpleXfer *xfer) |
15818 | 465 { |
466 if (!xfer_dialog) | |
467 finch_xfer_dialog_new(); | |
468 | |
469 finch_xfer_dialog_add_xfer(xfer); | |
470 gnt_tree_set_selected(GNT_TREE(xfer_dialog->tree), xfer); | |
471 } | |
472 | |
473 static void | |
15823 | 474 finch_xfer_update_progress(PurpleXfer *xfer, double percent) |
15818 | 475 { |
476 if (xfer_dialog) | |
477 finch_xfer_dialog_update_xfer(xfer); | |
478 } | |
479 | |
480 static void | |
15823 | 481 finch_xfer_cancel_local(PurpleXfer *xfer) |
15818 | 482 { |
483 if (xfer_dialog) | |
484 finch_xfer_dialog_cancel_xfer(xfer); | |
485 } | |
486 | |
487 static void | |
15823 | 488 finch_xfer_cancel_remote(PurpleXfer *xfer) |
15818 | 489 { |
490 if (xfer_dialog) | |
491 finch_xfer_dialog_cancel_xfer(xfer); | |
492 } | |
493 | |
15823 | 494 static PurpleXferUiOps ops = |
15818 | 495 { |
496 finch_xfer_new_xfer, | |
497 finch_xfer_destroy, | |
498 finch_xfer_add_xfer, | |
499 finch_xfer_update_progress, | |
500 finch_xfer_cancel_local, | |
16677
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16427
diff
changeset
|
501 finch_xfer_cancel_remote, |
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16427
diff
changeset
|
502 |
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16427
diff
changeset
|
503 /* padding */ |
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16427
diff
changeset
|
504 NULL, |
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16427
diff
changeset
|
505 NULL, |
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16427
diff
changeset
|
506 NULL, |
30829e806dae
And finch is up to date
Gary Kramlich <grim@reaperworld.com>
parents:
16427
diff
changeset
|
507 NULL |
15818 | 508 }; |
509 | |
510 /************************************************************************** | |
511 * GNT File Transfer API | |
512 **************************************************************************/ | |
513 void | |
514 finch_xfers_init(void) | |
515 { | |
16427
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
16194
diff
changeset
|
516 purple_prefs_add_none("/finch/filetransfer"); |
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
16194
diff
changeset
|
517 purple_prefs_add_bool("/finch/filetransfer/clear_finished", TRUE); |
4999bbc52881
Works for me! Renames prefs: /core to /purple, /gaim/gtk to /pidgin, /gaim/gnt to /finch
Sean Egan <seanegan@gmail.com>
parents:
16194
diff
changeset
|
518 purple_prefs_add_bool("/finch/filetransfer/keep_open", FALSE); |
15818 | 519 } |
520 | |
521 void | |
522 finch_xfers_uninit(void) | |
523 { | |
524 if (xfer_dialog != NULL) | |
525 finch_xfer_dialog_destroy(); | |
526 } | |
527 | |
15823 | 528 PurpleXferUiOps * |
15818 | 529 finch_xfers_get_ui_ops(void) |
530 { | |
531 return &ops; | |
532 } |