Mercurial > pidgin
annotate src/gtkft.c @ 9891:67dbf65e76cf
[gaim-migrate @ 10779]
Make this accelerator you knee qua
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 27 Aug 2004 22:23:31 +0000 |
parents | 4a15962c344a |
children | 8974a8544279 |
rev | line source |
---|---|
4514 | 1 /** |
7820 | 2 * @file gtkft.c GTK+ File Transfer UI |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
3 * @ingroup gtkui |
4514 | 4 * |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
10 * |
4514 | 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 */ | |
9791 | 25 #include "internal.h" |
26 #include "gtkgaim.h" | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
27 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
28 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
29 #include "notify.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
30 #include "ft.h" |
4514 | 31 #include "prpl.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
32 #include "util.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
33 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
34 #include "gaim-disclosure.h" |
4514 | 35 #include "gtkcellrendererprogress.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
36 #include "gtkft.h" |
5974 | 37 #include "prefs.h" |
5966 | 38 #include "gtkutils.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
39 #include "stock.h" |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
40 |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
41 #define GAIM_GTKXFER(xfer) \ |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
42 (GaimGtkXferUiData *)(xfer)->ui_data |
4514 | 43 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
44 struct _GaimGtkXferDialog |
4514 | 45 { |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
46 gboolean keep_open; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
47 gboolean auto_clear; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
48 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
49 gint num_transfers; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
50 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
51 GaimXfer *selected_xfer; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
52 |
4514 | 53 GtkWidget *window; |
54 GtkWidget *tree; | |
55 GtkListStore *model; | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
56 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
57 GtkWidget *disclosure; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
58 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
59 GtkWidget *table; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
60 |
9785 | 61 GtkWidget *local_user_desc_label; |
62 GtkWidget *local_user_label; | |
63 GtkWidget *remote_user_desc_label; | |
64 GtkWidget *remote_user_label; | |
65 GtkWidget *protocol_label; | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
66 GtkWidget *filename_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
67 GtkWidget *status_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
68 GtkWidget *speed_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
69 GtkWidget *time_elapsed_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
70 GtkWidget *time_remaining_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
71 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
72 GtkWidget *progress; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
73 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
74 /* Buttons */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
75 GtkWidget *open_button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
76 GtkWidget *pause_button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
77 GtkWidget *resume_button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
78 GtkWidget *remove_button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
79 GtkWidget *stop_button; |
5608 | 80 GtkWidget *close_button; |
4514 | 81 }; |
82 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
83 typedef struct |
4514 | 84 { |
85 GtkTreeIter iter; | |
86 time_t start_time; | |
9017 | 87 time_t end_time; |
7805 | 88 gboolean in_list; |
4514 | 89 |
90 char *name; | |
91 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
92 } GaimGtkXferUiData; |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
93 |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
94 static GaimGtkXferDialog *xfer_dialog = NULL; |
4514 | 95 |
96 enum | |
97 { | |
98 COLUMN_STATUS = 0, | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
99 COLUMN_PROGRESS, |
4514 | 100 COLUMN_FILENAME, |
101 COLUMN_SIZE, | |
102 COLUMN_REMAINING, | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
103 COLUMN_DATA, |
4514 | 104 NUM_COLUMNS |
105 }; | |
106 | |
7805 | 107 |
108 /************************************************************************** | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
109 * Utility Functions |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
110 **************************************************************************/ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
111 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
112 get_xfer_info_strings(GaimXfer *xfer, char **kbsec, char **time_elapsed, |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
113 char **time_remaining) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
114 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
115 GaimGtkXferUiData *data; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
116 double kb_sent, kb_rem; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
117 double kbps = 0.0; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
118 time_t elapsed, now; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
119 |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
120 data = GAIM_GTKXFER(xfer); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
121 |
9017 | 122 if (data->end_time == -1 && |
123 (gaim_xfer_is_canceled(xfer) || gaim_xfer_is_completed(xfer))) | |
124 data->end_time = time(NULL); | |
125 | |
126 if (data->end_time != -1) | |
127 now = data->end_time; | |
128 else | |
129 now = time(NULL); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
130 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
131 kb_sent = gaim_xfer_get_bytes_sent(xfer) / 1024.0; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
132 kb_rem = gaim_xfer_get_bytes_remaining(xfer) / 1024.0; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
133 elapsed = (now - data->start_time); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
134 kbps = (elapsed > 0 ? (kb_sent / elapsed) : 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
135 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
136 if (kbsec != NULL) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
137 if (gaim_xfer_is_completed(xfer)) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
138 *kbsec = g_strdup(""); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
139 else |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
140 *kbsec = g_strdup_printf(_("%.2f KB/s"), kbps); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
141 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
142 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
143 if (time_elapsed != NULL) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
144 int h, m, s; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
145 int secs_elapsed; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
146 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
147 secs_elapsed = now - data->start_time; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
148 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
149 h = secs_elapsed / 3600; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
150 m = (secs_elapsed % 3600) / 60; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
151 s = secs_elapsed % 60; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
152 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
153 *time_elapsed = g_strdup_printf("%d:%02d:%02d", h, m, s); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
154 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
155 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
156 if (time_remaining != NULL) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
157 if (gaim_xfer_get_size(xfer) == 0) { |
8351 | 158 *time_remaining = g_strdup(_("Unknown")); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
159 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
160 else if (gaim_xfer_is_completed(xfer)) { |
8351 | 161 *time_remaining = g_strdup(_("Finished")); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
162 } |
9017 | 163 else if (gaim_xfer_is_canceled(xfer)) { |
164 *time_remaining = g_strdup(_("Canceled")); | |
165 } | |
166 else if (kb_sent <= 0) { | |
167 *time_remaining = g_strdup(_("Waiting for transfer to begin")); | |
168 } | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
169 else { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
170 int h, m, s; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
171 int secs_remaining; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
172 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
173 secs_remaining = (int)(kb_rem / kbps); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
174 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
175 h = secs_remaining / 3600; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
176 m = (secs_remaining % 3600) / 60; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
177 s = secs_remaining % 60; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
178 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
179 *time_remaining = g_strdup_printf("%d:%02d:%02d", h, m, s); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
180 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
181 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
182 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
183 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
184 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
185 update_detailed_info(GaimGtkXferDialog *dialog, GaimXfer *xfer) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
186 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
187 GaimGtkXferUiData *data; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
188 char *kbsec, *time_elapsed, *time_remaining; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
189 char *status; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
190 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
191 if (dialog == NULL || xfer == NULL) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
192 return; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
193 |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
194 data = GAIM_GTKXFER(xfer); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
195 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
196 get_xfer_info_strings(xfer, &kbsec, &time_elapsed, &time_remaining); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
197 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
198 status = g_strdup_printf("%ld of %ld", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
199 (unsigned long)gaim_xfer_get_bytes_sent(xfer), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
200 (unsigned long)gaim_xfer_get_size(xfer)); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
201 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
202 if (gaim_xfer_get_size(xfer) >= 0 && |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
203 gaim_xfer_is_completed(xfer)) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
204 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
205 GdkPixbuf *pixbuf = NULL; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
206 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
207 pixbuf = gtk_widget_render_icon(xfer_dialog->window, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
208 GAIM_STOCK_FILE_DONE, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
209 GTK_ICON_SIZE_MENU, NULL); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
210 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
211 gtk_list_store_set(GTK_LIST_STORE(xfer_dialog->model), &data->iter, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
212 COLUMN_STATUS, pixbuf, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
213 -1); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
214 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
215 g_object_unref(pixbuf); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
216 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
217 |
9785 | 218 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
219 gtk_label_set_markup(GTK_LABEL(dialog->local_user_desc_label), | |
220 _("<b>Receiving As:</b>")); | |
221 gtk_label_set_markup(GTK_LABEL(dialog->remote_user_desc_label), | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
222 _("<b>Receiving From:</b>")); |
9785 | 223 } |
224 else { | |
225 gtk_label_set_markup(GTK_LABEL(dialog->remote_user_desc_label), | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
226 _("<b>Sending To:</b>")); |
9785 | 227 gtk_label_set_markup(GTK_LABEL(dialog->local_user_desc_label), |
228 _("<b>Sending As:</b>")); | |
229 } | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
230 |
9785 | 231 gtk_label_set_text(GTK_LABEL(dialog->local_user_label), |
232 gaim_account_get_username(xfer->account)); | |
233 gtk_label_set_text(GTK_LABEL(dialog->remote_user_label), xfer->who); | |
234 gtk_label_set_text(GTK_LABEL(dialog->protocol_label), | |
235 gaim_account_get_protocol_name(xfer->account)); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
236 |
7738 | 237 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
238 gtk_label_set_text(GTK_LABEL(dialog->filename_label), | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
239 gaim_xfer_get_filename(xfer)); |
7738 | 240 } else { |
241 char *tmp; | |
242 tmp = g_path_get_basename(gaim_xfer_get_local_filename(xfer)); | |
243 gtk_label_set_text(GTK_LABEL(dialog->filename_label), tmp); | |
244 g_free(tmp); | |
245 } | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
246 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
247 gtk_label_set_text(GTK_LABEL(dialog->status_label), status); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
248 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
249 gtk_label_set_text(GTK_LABEL(dialog->speed_label), kbsec); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
250 gtk_label_set_text(GTK_LABEL(dialog->time_elapsed_label), time_elapsed); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
251 gtk_label_set_text(GTK_LABEL(dialog->time_remaining_label), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
252 time_remaining); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
253 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
254 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(dialog->progress), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
255 gaim_xfer_get_progress(xfer)); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
256 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
257 g_free(kbsec); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
258 g_free(time_elapsed); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
259 g_free(time_remaining); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
260 g_free(status); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
261 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
262 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
263 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
264 update_buttons(GaimGtkXferDialog *dialog, GaimXfer *xfer) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
265 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
266 if (dialog->selected_xfer == NULL) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
267 gtk_widget_set_sensitive(dialog->disclosure, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
268 gtk_widget_set_sensitive(dialog->open_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
269 gtk_widget_set_sensitive(dialog->pause_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
270 gtk_widget_set_sensitive(dialog->resume_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
271 gtk_widget_set_sensitive(dialog->stop_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
272 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
273 gtk_widget_show(dialog->stop_button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
274 gtk_widget_hide(dialog->remove_button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
275 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
276 return; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
277 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
278 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
279 if (dialog->selected_xfer != xfer) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
280 return; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
281 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
282 if (gaim_xfer_is_completed(xfer)) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
283 gtk_widget_hide(dialog->stop_button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
284 gtk_widget_show(dialog->remove_button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
285 |
8366
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
286 #ifdef _WIN32 /* Only supported in Win32 right now */ |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
287 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
288 gtk_widget_set_sensitive(dialog->open_button, TRUE); |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
289 } else { |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
290 gtk_widget_set_sensitive(dialog->open_button, FALSE); |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
291 } |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
292 #endif |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
293 gtk_widget_set_sensitive(dialog->pause_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
294 gtk_widget_set_sensitive(dialog->resume_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
295 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
296 gtk_widget_set_sensitive(dialog->remove_button, TRUE); |
7738 | 297 } else if (gaim_xfer_is_canceled(xfer)) { |
298 gtk_widget_hide(dialog->stop_button); | |
299 gtk_widget_show(dialog->remove_button); | |
300 | |
301 gtk_widget_set_sensitive(dialog->open_button, FALSE); | |
302 gtk_widget_set_sensitive(dialog->pause_button, FALSE); | |
303 gtk_widget_set_sensitive(dialog->resume_button, FALSE); | |
304 | |
305 gtk_widget_set_sensitive(dialog->remove_button, TRUE); | |
306 } else { | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
307 gtk_widget_show(dialog->stop_button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
308 gtk_widget_hide(dialog->remove_button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
309 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
310 gtk_widget_set_sensitive(dialog->open_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
311 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
312 /* TODO: If the transfer can pause, blah blah */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
313 gtk_widget_set_sensitive(dialog->pause_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
314 gtk_widget_set_sensitive(dialog->resume_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
315 gtk_widget_set_sensitive(dialog->stop_button, TRUE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
316 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
317 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
318 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
319 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
320 ensure_row_selected(GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
321 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
322 GtkTreeIter iter; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
323 GtkTreeSelection *selection; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
324 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
325 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->tree)); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
326 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
327 if (gtk_tree_selection_get_selected(selection, NULL, &iter)) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
328 return; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
329 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
330 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(dialog->model), &iter)) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
331 gtk_tree_selection_select_iter(selection, &iter); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
332 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
333 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
334 /************************************************************************** |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
335 * Callbacks |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
336 **************************************************************************/ |
4514 | 337 static gint |
338 delete_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
339 { | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
340 GaimGtkXferDialog *dialog; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
341 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
342 dialog = (GaimGtkXferDialog *)d; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
343 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
344 gaim_gtkxfer_dialog_hide(dialog); |
4514 | 345 |
346 return TRUE; | |
347 } | |
348 | |
349 static void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
350 toggle_keep_open_cb(GtkWidget *w, GaimGtkXferDialog *dialog) |
4514 | 351 { |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
352 dialog->keep_open = !dialog->keep_open; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
353 gaim_prefs_set_bool("/gaim/gtk/filetransfer/keep_open", |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
354 dialog->keep_open); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
355 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
356 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
357 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
358 toggle_clear_finished_cb(GtkWidget *w, GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
359 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
360 dialog->auto_clear = !dialog->auto_clear; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
361 gaim_prefs_set_bool("/gaim/gtk/filetransfer/clear_finished", |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
362 dialog->auto_clear); |
4514 | 363 } |
364 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
365 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
366 selection_changed_cb(GtkTreeSelection *selection, GaimGtkXferDialog *dialog) |
4514 | 367 { |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
368 GtkTreeIter iter; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
369 GaimXfer *xfer = NULL; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
370 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
371 if (gtk_tree_selection_get_selected(selection, NULL, &iter)) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
372 GValue val = {0, }; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
373 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
374 gtk_widget_set_sensitive(dialog->disclosure, TRUE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
375 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
376 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
377 &iter, COLUMN_DATA, &val); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
378 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
379 xfer = g_value_get_pointer(&val); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
380 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
381 update_detailed_info(dialog, xfer); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
382 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
383 dialog->selected_xfer = xfer; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
384 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
385 else { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
386 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->disclosure), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
387 FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
388 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
389 gtk_widget_set_sensitive(dialog->disclosure, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
390 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
391 dialog->selected_xfer = NULL; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
392 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
393 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
394 update_buttons(dialog, xfer); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
395 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
396 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
397 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
398 open_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
399 { |
8366
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
400 #ifdef _WIN32 /* Only supported in Win32 right now */ |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
401 int code = (int)ShellExecute(NULL, NULL, |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
402 gaim_xfer_get_local_filename(dialog->selected_xfer), |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
403 NULL, NULL, SW_SHOW); |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
404 if (code == SE_ERR_ASSOCINCOMPLETE || code == SE_ERR_NOASSOC) |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
405 { |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
406 gaim_notify_error(NULL, NULL, |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
407 _("There is no application configured to open this type of file."), NULL); |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
408 } |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
409 else if (code < 32) |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
410 { |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
411 gaim_notify_error(NULL, NULL, |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
412 _("An error occurred while opening the file."), NULL); |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
413 gaim_debug_warning("ft", "filename: %s; code: %d\n", gaim_xfer_get_local_filename(dialog->selected_xfer), code); |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
414 } |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
415 #endif |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
416 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
417 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
418 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
419 pause_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
420 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
421 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
422 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
423 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
424 resume_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
425 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
426 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
427 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
428 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
429 remove_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
430 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
431 gaim_gtkxfer_dialog_remove_xfer(dialog, dialog->selected_xfer); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
432 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
433 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
434 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
435 stop_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
436 { |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4661
diff
changeset
|
437 gaim_xfer_cancel_local(dialog->selected_xfer); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
438 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
439 |
5608 | 440 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
441 close_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
5608 | 442 { |
443 gaim_gtkxfer_dialog_hide(dialog); | |
444 } | |
445 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
446 /************************************************************************** |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
447 * Dialog Building Functions |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
448 **************************************************************************/ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
449 static GtkWidget * |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
450 setup_tree(GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
451 { |
4514 | 452 GtkWidget *sw; |
453 GtkWidget *tree; | |
454 GtkListStore *model; | |
455 GtkCellRenderer *renderer; | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
456 GtkTreeViewColumn *column; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
457 GtkTreeSelection *selection; |
4514 | 458 |
459 /* Create the scrolled window. */ | |
460 sw = gtk_scrolled_window_new(0, 0); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
461 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
462 GTK_SHADOW_IN); |
4514 | 463 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
464 GTK_POLICY_AUTOMATIC, | |
465 GTK_POLICY_ALWAYS); | |
466 gtk_widget_show(sw); | |
467 | |
468 /* Build the tree model */ | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
469 /* Transfer type, Progress Bar, Filename, Size, Remaining */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
470 model = gtk_list_store_new(NUM_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_DOUBLE, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
471 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
472 G_TYPE_POINTER); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
473 dialog->model = model; |
4514 | 474 |
475 /* Create the treeview */ | |
476 dialog->tree = tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); | |
477 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tree), TRUE); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
478 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
479 /* gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
480 |
4514 | 481 gtk_widget_show(tree); |
482 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
483 g_signal_connect(G_OBJECT(selection), "changed", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
484 G_CALLBACK(selection_changed_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
485 |
4514 | 486 g_object_unref(G_OBJECT(model)); |
487 | |
488 | |
489 /* Columns */ | |
490 | |
491 /* Transfer Type column */ | |
492 renderer = gtk_cell_renderer_pixbuf_new(); | |
493 column = gtk_tree_view_column_new_with_attributes(NULL, renderer, | |
494 "pixbuf", COLUMN_STATUS, NULL); | |
495 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column), | |
496 GTK_TREE_VIEW_COLUMN_FIXED); | |
497 gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(column), 25); | |
498 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); | |
499 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); | |
500 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
501 /* Progress bar column */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
502 renderer = gtk_cell_renderer_progress_new(); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
503 column = gtk_tree_view_column_new_with_attributes(_("Progress"), renderer, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
504 "percentage", COLUMN_PROGRESS, NULL); |
4514 | 505 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); |
506 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); | |
507 | |
508 /* Filename column */ | |
509 renderer = gtk_cell_renderer_text_new(); | |
510 column = gtk_tree_view_column_new_with_attributes(_("Filename"), renderer, | |
511 "text", COLUMN_FILENAME, NULL); | |
512 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); | |
513 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); | |
514 | |
515 /* File Size column */ | |
516 renderer = gtk_cell_renderer_text_new(); | |
517 column = gtk_tree_view_column_new_with_attributes(_("Size"), renderer, | |
518 "text", COLUMN_SIZE, NULL); | |
519 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); | |
520 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); | |
521 | |
522 /* Bytes Remaining column */ | |
523 renderer = gtk_cell_renderer_text_new(); | |
524 column = gtk_tree_view_column_new_with_attributes(_("Remaining"), | |
525 renderer, "text", COLUMN_REMAINING, NULL); | |
526 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); | |
527 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); | |
528 | |
529 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(tree)); | |
530 | |
531 gtk_container_add(GTK_CONTAINER(sw), tree); | |
532 gtk_widget_show(tree); | |
533 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
534 return sw; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
535 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
536 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
537 static GtkWidget * |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
538 make_info_table(GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
539 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
540 GtkWidget *table; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
541 GtkWidget *label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
542 GtkWidget *sep; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
543 int i; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
544 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
545 struct |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
546 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
547 GtkWidget **desc_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
548 GtkWidget **val_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
549 const char *desc; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
550 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
551 } labels[] = |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
552 { |
9785 | 553 { &dialog->local_user_desc_label, &dialog->local_user_label, NULL }, |
554 { &dialog->remote_user_desc_label, &dialog->remote_user_label, NULL }, | |
555 { &label, &dialog->protocol_label, _("Protocol:") }, | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
556 { &label, &dialog->filename_label, _("Filename:") }, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
557 { &label, &dialog->status_label, _("Status:") }, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
558 { &label, &dialog->speed_label, _("Speed:") }, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
559 { &label, &dialog->time_elapsed_label, _("Time Elapsed:") }, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
560 { &label, &dialog->time_remaining_label, _("Time Remaining:") } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
561 }; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
562 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
563 /* Setup the initial table */ |
9785 | 564 dialog->table = table = gtk_table_new(10, 2, FALSE); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
565 gtk_table_set_row_spacings(GTK_TABLE(table), 6); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
566 gtk_table_set_col_spacings(GTK_TABLE(table), 6); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
567 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
568 /* Setup the labels */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
569 for (i = 0; i < sizeof(labels) / sizeof(*labels); i++) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
570 GtkWidget *label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
571 char buf[256]; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
572 |
4894 | 573 g_snprintf(buf, sizeof(buf), "<b>%s</b>", |
574 labels[i].desc != NULL ? labels[i].desc : ""); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
575 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
576 *labels[i].desc_label = label = gtk_label_new(NULL); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
577 gtk_label_set_markup(GTK_LABEL(label), buf); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
578 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
579 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
580 gtk_table_attach(GTK_TABLE(table), label, 0, 1, i, i + 1, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
581 GTK_FILL, 0, 0, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
582 gtk_widget_show(label); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
583 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
584 *labels[i].val_label = label = gtk_label_new(NULL); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
585 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
586 gtk_table_attach(GTK_TABLE(table), label, 1, 2, i, i + 1, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
587 GTK_FILL | GTK_EXPAND, 0, 0, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
588 gtk_widget_show(label); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
589 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
590 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
591 /* Setup the progress bar */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
592 dialog->progress = gtk_progress_bar_new(); |
9785 | 593 gtk_table_attach(GTK_TABLE(table), dialog->progress, 0, 2, 8, 9, |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
594 GTK_FILL, GTK_FILL, 0, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
595 gtk_widget_show(dialog->progress); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
596 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
597 sep = gtk_hseparator_new(); |
9785 | 598 gtk_table_attach(GTK_TABLE(table), sep, 0, 2, 9, 10, |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
599 GTK_FILL, GTK_FILL, 0, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
600 gtk_widget_show(sep); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
601 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
602 return table; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
603 } |
4514 | 604 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
605 GaimGtkXferDialog * |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
606 gaim_gtkxfer_dialog_new(void) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
607 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
608 GaimGtkXferDialog *dialog; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
609 GtkWidget *window; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
610 GtkWidget *vbox1, *vbox2; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
611 GtkWidget *bbox; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
612 GtkWidget *sw; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
613 GtkWidget *sep; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
614 GtkWidget *button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
615 GtkWidget *disclosure; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
616 GtkWidget *table; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
617 GtkWidget *checkbox; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
618 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
619 dialog = g_new0(GaimGtkXferDialog, 1); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
620 dialog->keep_open = |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
621 gaim_prefs_get_bool("/gaim/gtk/filetransfer/keep_open"); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
622 dialog->auto_clear = |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
623 gaim_prefs_get_bool("/gaim/gtk/filetransfer/clear_finished"); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
624 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
625 /* Create the window. */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
626 dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
627 gtk_window_set_role(GTK_WINDOW(window), "file transfer"); |
4570
67a373071933
[gaim-migrate @ 4851]
Christian Hammond <chipx86@chipx86.com>
parents:
4566
diff
changeset
|
628 gtk_window_set_title(GTK_WINDOW(window), _("File Transfers")); |
4719 | 629 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); |
4570
67a373071933
[gaim-migrate @ 4851]
Christian Hammond <chipx86@chipx86.com>
parents:
4566
diff
changeset
|
630 gtk_container_set_border_width(GTK_CONTAINER(window), 12); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
631 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
632 g_signal_connect(G_OBJECT(window), "delete_event", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
633 G_CALLBACK(delete_win_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
634 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
635 /* Create the parent vbox for everything. */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
636 vbox1 = gtk_vbox_new(FALSE, 12); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
637 gtk_container_add(GTK_CONTAINER(window), vbox1); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
638 gtk_widget_show(vbox1); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
639 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
640 /* Create the main vbox for top half of the window. */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
641 vbox2 = gtk_vbox_new(FALSE, 6); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
642 gtk_box_pack_start(GTK_BOX(vbox1), vbox2, TRUE, TRUE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
643 gtk_widget_show(vbox2); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
644 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
645 /* Setup the listbox */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
646 sw = setup_tree(dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
647 gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); |
4719 | 648 gtk_widget_set_size_request(sw,-1, 140); |
7272
02f697df677b
[gaim-migrate @ 7849]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
649 |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
650 /* "Keep the dialog open" */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
651 checkbox = gtk_check_button_new_with_mnemonic( |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
652 _("_Keep the dialog open")); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
653 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
654 dialog->keep_open); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
655 g_signal_connect(G_OBJECT(checkbox), "toggled", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
656 G_CALLBACK(toggle_keep_open_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
657 gtk_box_pack_start(GTK_BOX(vbox2), checkbox, FALSE, FALSE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
658 gtk_widget_show(checkbox); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
659 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
660 /* "Clear finished transfers" */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
661 checkbox = gtk_check_button_new_with_mnemonic( |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
662 _("_Clear finished transfers")); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
663 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
664 dialog->auto_clear); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
665 g_signal_connect(G_OBJECT(checkbox), "toggled", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
666 G_CALLBACK(toggle_clear_finished_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
667 gtk_box_pack_start(GTK_BOX(vbox2), checkbox, FALSE, FALSE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
668 gtk_widget_show(checkbox); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
669 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
670 /* "Download Details" arrow */ |
7738 | 671 disclosure = gaim_disclosure_new(_("Show transfer details"), |
672 _("Hide transfer details")); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
673 dialog->disclosure = disclosure; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
674 gtk_box_pack_start(GTK_BOX(vbox2), disclosure, FALSE, FALSE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
675 gtk_widget_show(disclosure); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
676 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
677 gtk_widget_set_sensitive(disclosure, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
678 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
679 #if 0 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
680 g_signal_connect(G_OBJECT(disclosure), "toggled", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
681 G_CALLBACK(toggle_details_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
682 #endif |
4514 | 683 |
684 /* Separator */ | |
685 sep = gtk_hseparator_new(); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
686 gtk_box_pack_start(GTK_BOX(vbox2), sep, FALSE, FALSE, 0); |
4514 | 687 gtk_widget_show(sep); |
688 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
689 /* The table of information. */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
690 table = make_info_table(dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
691 gtk_box_pack_start(GTK_BOX(vbox2), table, TRUE, TRUE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
692 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
693 /* Setup the disclosure for the table. */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
694 gaim_disclosure_set_container(GAIM_DISCLOSURE(disclosure), table); |
4514 | 695 |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
696 /* Now the button box for the buttons */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
697 bbox = gtk_hbutton_box_new(); |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
698 gtk_box_set_spacing(GTK_BOX(bbox), 6); |
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
699 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
700 gtk_box_pack_end(GTK_BOX(vbox1), bbox, FALSE, TRUE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
701 gtk_widget_show(bbox); |
4514 | 702 |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
703 /* Open button */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
704 button = gtk_button_new_from_stock(GTK_STOCK_OPEN); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
705 gtk_widget_set_sensitive(button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
706 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
707 gtk_widget_show(button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
708 dialog->open_button = button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
709 |
4514 | 710 g_signal_connect(G_OBJECT(button), "clicked", |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
711 G_CALLBACK(open_button_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
712 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
713 /* Pause button */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
714 button = gtk_button_new_with_mnemonic(_("_Pause")); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
715 gtk_widget_set_sensitive(button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
716 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4514 | 717 gtk_widget_show(button); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
718 dialog->pause_button = button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
719 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
720 g_signal_connect(G_OBJECT(button), "clicked", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
721 G_CALLBACK(pause_button_cb), dialog); |
7272
02f697df677b
[gaim-migrate @ 7849]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
722 |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
723 /* Resume button */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
724 button = gtk_button_new_with_mnemonic(_("_Resume")); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
725 gtk_widget_set_sensitive(button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
726 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
727 gtk_widget_show(button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
728 dialog->resume_button = button; |
4514 | 729 |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
730 g_signal_connect(G_OBJECT(button), "clicked", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
731 G_CALLBACK(resume_button_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
732 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
733 /* Remove button */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
734 button = gtk_button_new_from_stock(GTK_STOCK_REMOVE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
735 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
736 gtk_widget_hide(button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
737 dialog->remove_button = button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
738 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
739 g_signal_connect(G_OBJECT(button), "clicked", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
740 G_CALLBACK(remove_button_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
741 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
742 /* Stop button */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
743 button = gtk_button_new_from_stock(GTK_STOCK_STOP); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
744 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4514 | 745 gtk_widget_show(button); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
746 gtk_widget_set_sensitive(button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
747 dialog->stop_button = button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
748 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
749 g_signal_connect(G_OBJECT(button), "clicked", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
750 G_CALLBACK(stop_button_cb), dialog); |
4514 | 751 |
5608 | 752 /* Close button */ |
753 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
754 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
755 gtk_widget_show(button); | |
756 dialog->close_button = button; | |
757 | |
758 g_signal_connect(G_OBJECT(button), "clicked", | |
759 G_CALLBACK(close_button_cb), dialog); | |
760 | |
4514 | 761 return dialog; |
762 } | |
763 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
764 void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
765 gaim_gtkxfer_dialog_destroy(GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
766 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
767 g_return_if_fail(dialog != NULL); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
768 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
769 gtk_widget_destroy(dialog->window); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
770 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
771 g_free(dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
772 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
773 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
774 void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
775 gaim_gtkxfer_dialog_show(GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
776 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
777 g_return_if_fail(dialog != NULL); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
778 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
779 gtk_widget_show(dialog->window); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
780 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
781 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
782 void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
783 gaim_gtkxfer_dialog_hide(GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
784 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
785 g_return_if_fail(dialog != NULL); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
786 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
787 gtk_widget_hide(dialog->window); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
788 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
789 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
790 void |
4698 | 791 gaim_show_xfer_dialog() |
792 { | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
793 GaimGtkXferDialog *dialog; |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
794 |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
795 dialog = gaim_get_gtkxfer_dialog(); |
4698 | 796 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
797 if (dialog == NULL) { |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
798 dialog = gaim_gtkxfer_dialog_new(); |
4698 | 799 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
800 gaim_set_gtkxfer_dialog(dialog); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
801 } |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
802 |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
803 gaim_gtkxfer_dialog_show(dialog); |
4698 | 804 } |
805 | |
806 void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
807 gaim_gtkxfer_dialog_add_xfer(GaimGtkXferDialog *dialog, GaimXfer *xfer) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
808 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
809 GaimGtkXferUiData *data; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
810 GaimXferType type; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
811 GdkPixbuf *pixbuf; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
812 char *size_str, *remaining_str; |
7738 | 813 char *lfilename; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
814 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
815 g_return_if_fail(dialog != NULL); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
816 g_return_if_fail(xfer != NULL); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
817 |
7805 | 818 gaim_xfer_ref(xfer); |
819 | |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
820 data = GAIM_GTKXFER(xfer); |
7805 | 821 data->in_list = TRUE; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
822 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
823 gaim_gtkxfer_dialog_show(dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
824 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
825 data->start_time = time(NULL); |
9017 | 826 data->end_time = -1; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
827 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
828 type = gaim_xfer_get_type(xfer); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
829 |
7107
9220c7490cd1
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
830 size_str = gaim_str_size_to_units(gaim_xfer_get_size(xfer)); |
9220c7490cd1
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
831 remaining_str = gaim_str_size_to_units(gaim_xfer_get_bytes_remaining(xfer)); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
832 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
833 pixbuf = gtk_widget_render_icon(dialog->window, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
834 (type == GAIM_XFER_RECEIVE |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
835 ? GAIM_STOCK_DOWNLOAD |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
836 : GAIM_STOCK_UPLOAD), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
837 GTK_ICON_SIZE_MENU, NULL); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
838 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
839 gtk_list_store_append(dialog->model, &data->iter); |
7738 | 840 lfilename = g_path_get_basename(gaim_xfer_get_local_filename(xfer)); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
841 gtk_list_store_set(dialog->model, &data->iter, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
842 COLUMN_STATUS, pixbuf, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
843 COLUMN_PROGRESS, 0.0, |
7738 | 844 COLUMN_FILENAME, (type == GAIM_XFER_RECEIVE) |
845 ? gaim_xfer_get_filename(xfer) | |
846 : lfilename, | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
847 COLUMN_SIZE, size_str, |
9785 | 848 COLUMN_REMAINING, _("Waiting for transfer to begin"), |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
849 COLUMN_DATA, xfer, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
850 -1); |
7738 | 851 g_free(lfilename); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
852 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
853 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(dialog->tree)); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
854 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
855 g_object_unref(pixbuf); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
856 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
857 g_free(size_str); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
858 g_free(remaining_str); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
859 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
860 dialog->num_transfers++; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
861 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
862 ensure_row_selected(dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
863 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
864 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
865 void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
866 gaim_gtkxfer_dialog_remove_xfer(GaimGtkXferDialog *dialog, |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
867 GaimXfer *xfer) |
4514 | 868 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
869 GaimGtkXferUiData *data; |
4514 | 870 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
871 g_return_if_fail(dialog != NULL); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
872 g_return_if_fail(xfer != NULL); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
873 |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
874 data = GAIM_GTKXFER(xfer); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
875 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
876 if (data == NULL) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
877 return; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
878 |
7805 | 879 if (!data->in_list) |
880 return; | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
881 |
7805 | 882 data->in_list = FALSE; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
883 |
7805 | 884 gtk_list_store_remove(GTK_LIST_STORE(dialog->model), &data->iter); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
885 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
886 dialog->num_transfers--; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
887 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
888 if (dialog->num_transfers == 0 && !dialog->keep_open) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
889 gaim_gtkxfer_dialog_hide(dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
890 else |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
891 ensure_row_selected(dialog); |
7805 | 892 |
893 gaim_xfer_unref(xfer); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
894 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
895 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
896 void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
897 gaim_gtkxfer_dialog_cancel_xfer(GaimGtkXferDialog *dialog, |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
898 GaimXfer *xfer) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
899 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
900 GaimGtkXferUiData *data; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
901 GdkPixbuf *pixbuf; |
7738 | 902 gchar *status; |
903 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
904 g_return_if_fail(dialog != NULL); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
905 g_return_if_fail(xfer != NULL); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
906 |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
907 data = GAIM_GTKXFER(xfer); |
4514 | 908 |
909 if (data == NULL) | |
910 return; | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
911 |
8282 | 912 if (!data->in_list) |
913 return; | |
7738 | 914 |
7805 | 915 if ((gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL) && (dialog->auto_clear)) { |
916 gaim_gtkxfer_dialog_remove_xfer(dialog, xfer); | |
7738 | 917 return; |
918 } | |
919 | |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
920 data = GAIM_GTKXFER(xfer); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
921 |
9017 | 922 update_detailed_info(dialog, xfer); |
923 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
924 pixbuf = gtk_widget_render_icon(dialog->window, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
925 GAIM_STOCK_FILE_CANCELED, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
926 GTK_ICON_SIZE_MENU, NULL); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
927 |
7805 | 928 if (gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL) |
7738 | 929 status = _("Canceled"); |
930 else | |
931 status = _("Failed"); | |
932 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
933 gtk_list_store_set(dialog->model, &data->iter, |
7738 | 934 COLUMN_STATUS, pixbuf, |
935 COLUMN_REMAINING, status, | |
936 -1); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
937 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
938 g_object_unref(pixbuf); |
7738 | 939 |
940 update_buttons(dialog, xfer); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
941 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
942 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
943 void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
944 gaim_gtkxfer_dialog_update_xfer(GaimGtkXferDialog *dialog, |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
945 GaimXfer *xfer) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
946 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
947 GaimGtkXferUiData *data; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
948 char *size_str, *remaining_str; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
949 GtkTreeSelection *selection; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
950 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
951 g_return_if_fail(dialog != NULL); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
952 g_return_if_fail(xfer != NULL); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
953 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
954 if ((data = GAIM_GTKXFER(xfer)) == NULL) |
4656 | 955 return; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
956 |
7805 | 957 if (data->in_list == FALSE) |
958 return; | |
959 | |
7107
9220c7490cd1
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
960 size_str = gaim_str_size_to_units(gaim_xfer_get_size(xfer)); |
9220c7490cd1
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
961 remaining_str = gaim_str_size_to_units(gaim_xfer_get_bytes_remaining(xfer)); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
962 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
963 gtk_list_store_set(xfer_dialog->model, &data->iter, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
964 COLUMN_PROGRESS, gaim_xfer_get_progress(xfer), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
965 COLUMN_SIZE, size_str, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
966 COLUMN_REMAINING, remaining_str, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
967 -1); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
968 |
4607 | 969 if (gaim_xfer_is_completed(xfer)) { |
970 GdkPixbuf *pixbuf; | |
971 | |
972 pixbuf = gtk_widget_render_icon(dialog->window, | |
973 GAIM_STOCK_FILE_DONE, | |
974 GTK_ICON_SIZE_MENU, NULL); | |
975 | |
976 gtk_list_store_set(GTK_LIST_STORE(xfer_dialog->model), &data->iter, | |
977 COLUMN_STATUS, pixbuf, | |
8351 | 978 COLUMN_REMAINING, _("Finished"), |
4607 | 979 -1); |
980 | |
981 g_object_unref(pixbuf); | |
9785 | 982 } |
4607 | 983 |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
984 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(xfer_dialog->tree)); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
985 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
986 if (xfer == dialog->selected_xfer) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
987 update_detailed_info(xfer_dialog, xfer); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
988 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
989 if (gaim_xfer_is_completed(xfer) && dialog->auto_clear) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
990 gaim_gtkxfer_dialog_remove_xfer(dialog, xfer); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
991 else |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
992 update_buttons(dialog, xfer); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
993 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
994 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
995 /************************************************************************** |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
996 * File Transfer UI Ops |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
997 **************************************************************************/ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
998 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
999 gaim_gtkxfer_new_xfer(GaimXfer *xfer) |
5169 | 1000 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1001 GaimGtkXferUiData *data; |
5169 | 1002 |
1003 /* This is where we're setting xfer->ui_data for the first time. */ | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1004 data = g_new0(GaimGtkXferUiData, 1); |
5169 | 1005 xfer->ui_data = data; |
1006 } | |
1007 | |
1008 static void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1009 gaim_gtkxfer_destroy(GaimXfer *xfer) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1010 { |
7805 | 1011 GaimGtkXferUiData *data; |
1012 | |
1013 data = GAIM_GTKXFER(xfer); | |
1014 if (data) { | |
1015 if (data->name) | |
1016 g_free(data->name); | |
1017 g_free(data); | |
1018 xfer->ui_data = NULL; | |
1019 } | |
4514 | 1020 } |
1021 | |
1022 static void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1023 gaim_gtkxfer_add_xfer(GaimXfer *xfer) |
4514 | 1024 { |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1025 if (xfer_dialog == NULL) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1026 xfer_dialog = gaim_gtkxfer_dialog_new(); |
4514 | 1027 |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1028 gaim_gtkxfer_dialog_add_xfer(xfer_dialog, xfer); |
4514 | 1029 } |
1030 | |
1031 static void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1032 gaim_gtkxfer_update_progress(GaimXfer *xfer, double percent) |
4514 | 1033 { |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1034 gaim_gtkxfer_dialog_update_xfer(xfer_dialog, xfer); |
4514 | 1035 } |
1036 | |
1037 static void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1038 gaim_gtkxfer_cancel_local(GaimXfer *xfer) |
4514 | 1039 { |
7805 | 1040 if (xfer_dialog) |
1041 gaim_gtkxfer_dialog_cancel_xfer(xfer_dialog, xfer); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4661
diff
changeset
|
1042 } |
4514 | 1043 |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4661
diff
changeset
|
1044 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1045 gaim_gtkxfer_cancel_remote(GaimXfer *xfer) |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4661
diff
changeset
|
1046 { |
7805 | 1047 if (xfer_dialog) |
1048 gaim_gtkxfer_dialog_cancel_xfer(xfer_dialog, xfer); | |
4514 | 1049 } |
1050 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1051 static GaimXferUiOps ops = |
4514 | 1052 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1053 gaim_gtkxfer_new_xfer, |
4514 | 1054 gaim_gtkxfer_destroy, |
1055 gaim_gtkxfer_add_xfer, | |
1056 gaim_gtkxfer_update_progress, | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4661
diff
changeset
|
1057 gaim_gtkxfer_cancel_local, |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4661
diff
changeset
|
1058 gaim_gtkxfer_cancel_remote |
4514 | 1059 }; |
1060 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1061 /************************************************************************** |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1062 * GTK+ File Transfer API |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1063 **************************************************************************/ |
4514 | 1064 void |
6267
36b80ce02a51
[gaim-migrate @ 6764]
Christian Hammond <chipx86@chipx86.com>
parents:
6240
diff
changeset
|
1065 gaim_gtk_xfers_init(void) |
5974 | 1066 { |
1067 gaim_prefs_add_none("/gaim/gtk/filetransfer"); | |
1068 gaim_prefs_add_bool("/gaim/gtk/filetransfer/clear_finished", TRUE); | |
1069 gaim_prefs_add_bool("/gaim/gtk/filetransfer/keep_open", FALSE); | |
1070 } | |
1071 | |
1072 void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1073 gaim_set_gtkxfer_dialog(GaimGtkXferDialog *dialog) |
4514 | 1074 { |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1075 xfer_dialog = dialog; |
4514 | 1076 } |
1077 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1078 GaimGtkXferDialog * |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1079 gaim_get_gtkxfer_dialog(void) |
4514 | 1080 { |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1081 return xfer_dialog; |
4514 | 1082 } |
1083 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1084 GaimXferUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
1085 gaim_gtk_xfers_get_ui_ops(void) |
4514 | 1086 { |
1087 return &ops; | |
1088 } |