Mercurial > pidgin.yaz
annotate src/gtkft.c @ 9428:796f510a6e19
[gaim-migrate @ 10247]
Arun A Tharuvai writes:
Slash commands with "w" (and "W") ignore space
between it and the next command. This causes the
trailing space to either: get treated as the first
character of of an immediately following "s" (or "S")
argument, or get treated as the entire contents of any
following "w" (or "W") arguments.
This patch of his, #982083, fixes those issues.
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Tue, 29 Jun 2004 21:34:07 +0000 |
parents | 72c88ac84afa |
children | aecabbe495db |
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 */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6267
diff
changeset
|
25 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
26 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
27 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
28 #include "notify.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
29 #include "ft.h" |
4514 | 30 #include "prpl.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5826
diff
changeset
|
31 #include "request.h" |
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 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
61 GtkWidget *user_desc_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
62 GtkWidget *user_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
63 GtkWidget *filename_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
64 GtkWidget *status_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
65 GtkWidget *speed_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
66 GtkWidget *time_elapsed_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
67 GtkWidget *time_remaining_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
68 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
69 GtkWidget *progress; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
70 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
71 /* Buttons */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
72 GtkWidget *open_button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
73 GtkWidget *pause_button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
74 GtkWidget *resume_button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
75 GtkWidget *remove_button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
76 GtkWidget *stop_button; |
5608 | 77 GtkWidget *close_button; |
4514 | 78 }; |
79 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
80 typedef struct |
4514 | 81 { |
82 GtkWidget *filesel; | |
83 GtkTreeIter iter; | |
84 time_t start_time; | |
9017 | 85 time_t end_time; |
7805 | 86 gboolean in_list; |
4514 | 87 |
88 char *name; | |
89 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
90 } GaimGtkXferUiData; |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
91 |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
92 static GaimGtkXferDialog *xfer_dialog = NULL; |
4514 | 93 |
94 enum | |
95 { | |
96 COLUMN_STATUS = 0, | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
97 COLUMN_PROGRESS, |
4514 | 98 COLUMN_FILENAME, |
99 COLUMN_SIZE, | |
100 COLUMN_REMAINING, | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
101 COLUMN_DATA, |
4514 | 102 NUM_COLUMNS |
103 }; | |
104 | |
7805 | 105 |
106 /************************************************************************** | |
107 * Prototype(s) | |
108 **************************************************************************/ | |
109 static int choose_file(GaimXfer *xfer); | |
110 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
111 /************************************************************************** |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
112 * Utility Functions |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
113 **************************************************************************/ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
114 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
115 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
|
116 char **time_remaining) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
117 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
118 GaimGtkXferUiData *data; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
119 double kb_sent, kb_rem; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
120 double kbps = 0.0; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
121 time_t elapsed, now; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
122 |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
123 data = GAIM_GTKXFER(xfer); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
124 |
9017 | 125 if (data->end_time == -1 && |
126 (gaim_xfer_is_canceled(xfer) || gaim_xfer_is_completed(xfer))) | |
127 data->end_time = time(NULL); | |
128 | |
129 if (data->end_time != -1) | |
130 now = data->end_time; | |
131 else | |
132 now = time(NULL); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
133 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
134 kb_sent = gaim_xfer_get_bytes_sent(xfer) / 1024.0; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
135 kb_rem = gaim_xfer_get_bytes_remaining(xfer) / 1024.0; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
136 elapsed = (now - data->start_time); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
137 kbps = (elapsed > 0 ? (kb_sent / elapsed) : 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
138 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
139 if (kbsec != NULL) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
140 if (gaim_xfer_is_completed(xfer)) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
141 *kbsec = g_strdup(""); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
142 else |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
143 *kbsec = g_strdup_printf(_("%.2f KB/s"), kbps); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
144 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
145 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
146 if (time_elapsed != NULL) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
147 int h, m, s; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
148 int secs_elapsed; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
149 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
150 secs_elapsed = now - data->start_time; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
151 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
152 h = secs_elapsed / 3600; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
153 m = (secs_elapsed % 3600) / 60; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
154 s = secs_elapsed % 60; |
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 *time_elapsed = g_strdup_printf("%d:%02d:%02d", h, m, s); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
157 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
158 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
159 if (time_remaining != NULL) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
160 if (gaim_xfer_get_size(xfer) == 0) { |
8351 | 161 *time_remaining = g_strdup(_("Unknown")); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
162 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
163 else if (gaim_xfer_is_completed(xfer)) { |
8351 | 164 *time_remaining = g_strdup(_("Finished")); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
165 } |
9017 | 166 else if (gaim_xfer_is_canceled(xfer)) { |
167 *time_remaining = g_strdup(_("Canceled")); | |
168 } | |
169 else if (kb_sent <= 0) { | |
170 *time_remaining = g_strdup(_("Waiting for transfer to begin")); | |
171 } | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
172 else { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
173 int h, m, s; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
174 int secs_remaining; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
175 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
176 secs_remaining = (int)(kb_rem / kbps); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
177 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
178 h = secs_remaining / 3600; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
179 m = (secs_remaining % 3600) / 60; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
180 s = secs_remaining % 60; |
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 *time_remaining = g_strdup_printf("%d:%02d:%02d", h, m, s); |
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 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
185 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
186 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
187 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
188 update_detailed_info(GaimGtkXferDialog *dialog, GaimXfer *xfer) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
189 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
190 GaimGtkXferUiData *data; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
191 char *kbsec, *time_elapsed, *time_remaining; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
192 char *status; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
193 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
194 if (dialog == NULL || xfer == NULL) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
195 return; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
196 |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
197 data = GAIM_GTKXFER(xfer); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
198 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
199 get_xfer_info_strings(xfer, &kbsec, &time_elapsed, &time_remaining); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
200 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
201 status = g_strdup_printf("%ld of %ld", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
202 (unsigned long)gaim_xfer_get_bytes_sent(xfer), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
203 (unsigned long)gaim_xfer_get_size(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 if (gaim_xfer_get_size(xfer) >= 0 && |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
206 gaim_xfer_is_completed(xfer)) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
207 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
208 GdkPixbuf *pixbuf = NULL; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
209 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
210 pixbuf = gtk_widget_render_icon(xfer_dialog->window, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
211 GAIM_STOCK_FILE_DONE, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
212 GTK_ICON_SIZE_MENU, NULL); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
213 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
214 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
|
215 COLUMN_STATUS, pixbuf, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
216 -1); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
217 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
218 g_object_unref(pixbuf); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
219 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
220 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
221 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
222 gtk_label_set_markup(GTK_LABEL(dialog->user_desc_label), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
223 _("<b>Receiving From:</b>")); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
224 else |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
225 gtk_label_set_markup(GTK_LABEL(dialog->user_desc_label), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
226 _("<b>Sending To:</b>")); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
227 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
228 gtk_label_set_text(GTK_LABEL(dialog->user_label), xfer->who); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
229 |
7738 | 230 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
231 gtk_label_set_text(GTK_LABEL(dialog->filename_label), | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
232 gaim_xfer_get_filename(xfer)); |
7738 | 233 } else { |
234 char *tmp; | |
235 tmp = g_path_get_basename(gaim_xfer_get_local_filename(xfer)); | |
236 gtk_label_set_text(GTK_LABEL(dialog->filename_label), tmp); | |
237 g_free(tmp); | |
238 } | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
239 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
240 gtk_label_set_text(GTK_LABEL(dialog->status_label), status); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
241 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
242 gtk_label_set_text(GTK_LABEL(dialog->speed_label), kbsec); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
243 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
|
244 gtk_label_set_text(GTK_LABEL(dialog->time_remaining_label), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
245 time_remaining); |
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_progress_bar_set_fraction(GTK_PROGRESS_BAR(dialog->progress), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
248 gaim_xfer_get_progress(xfer)); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
249 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
250 g_free(kbsec); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
251 g_free(time_elapsed); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
252 g_free(time_remaining); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
253 g_free(status); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
254 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
255 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
256 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
257 update_buttons(GaimGtkXferDialog *dialog, GaimXfer *xfer) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
258 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
259 if (dialog->selected_xfer == NULL) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
260 gtk_widget_set_sensitive(dialog->disclosure, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
261 gtk_widget_set_sensitive(dialog->open_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
262 gtk_widget_set_sensitive(dialog->pause_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
263 gtk_widget_set_sensitive(dialog->resume_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
264 gtk_widget_set_sensitive(dialog->stop_button, FALSE); |
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 gtk_widget_show(dialog->stop_button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
267 gtk_widget_hide(dialog->remove_button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
268 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
269 return; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
270 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
271 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
272 if (dialog->selected_xfer != xfer) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
273 return; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
274 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
275 if (gaim_xfer_is_completed(xfer)) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
276 gtk_widget_hide(dialog->stop_button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
277 gtk_widget_show(dialog->remove_button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
278 |
8366
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
279 #ifdef _WIN32 /* Only supported in Win32 right now */ |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
280 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
281 gtk_widget_set_sensitive(dialog->open_button, TRUE); |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
282 } else { |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
283 gtk_widget_set_sensitive(dialog->open_button, FALSE); |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
284 } |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
285 #endif |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
286 gtk_widget_set_sensitive(dialog->pause_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
287 gtk_widget_set_sensitive(dialog->resume_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
288 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
289 gtk_widget_set_sensitive(dialog->remove_button, TRUE); |
7738 | 290 } else if (gaim_xfer_is_canceled(xfer)) { |
291 gtk_widget_hide(dialog->stop_button); | |
292 gtk_widget_show(dialog->remove_button); | |
293 | |
294 gtk_widget_set_sensitive(dialog->open_button, FALSE); | |
295 gtk_widget_set_sensitive(dialog->pause_button, FALSE); | |
296 gtk_widget_set_sensitive(dialog->resume_button, FALSE); | |
297 | |
298 gtk_widget_set_sensitive(dialog->remove_button, TRUE); | |
299 } else { | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
300 gtk_widget_show(dialog->stop_button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
301 gtk_widget_hide(dialog->remove_button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
302 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
303 gtk_widget_set_sensitive(dialog->open_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
304 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
305 /* TODO: If the transfer can pause, blah blah */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
306 gtk_widget_set_sensitive(dialog->pause_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
307 gtk_widget_set_sensitive(dialog->resume_button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
308 gtk_widget_set_sensitive(dialog->stop_button, TRUE); |
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 } |
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 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
313 ensure_row_selected(GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
314 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
315 GtkTreeIter iter; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
316 GtkTreeSelection *selection; |
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 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->tree)); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
319 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
320 if (gtk_tree_selection_get_selected(selection, NULL, &iter)) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
321 return; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
322 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
323 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
|
324 gtk_tree_selection_select_iter(selection, &iter); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
325 } |
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 /************************************************************************** |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
328 * Callbacks |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
329 **************************************************************************/ |
4514 | 330 static gint |
331 delete_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) | |
332 { | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
333 GaimGtkXferDialog *dialog; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
334 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
335 dialog = (GaimGtkXferDialog *)d; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
336 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
337 gaim_gtkxfer_dialog_hide(dialog); |
4514 | 338 |
339 return TRUE; | |
340 } | |
341 | |
342 static void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
343 toggle_keep_open_cb(GtkWidget *w, GaimGtkXferDialog *dialog) |
4514 | 344 { |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
345 dialog->keep_open = !dialog->keep_open; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
346 gaim_prefs_set_bool("/gaim/gtk/filetransfer/keep_open", |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
347 dialog->keep_open); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
348 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
349 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
350 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
351 toggle_clear_finished_cb(GtkWidget *w, GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
352 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
353 dialog->auto_clear = !dialog->auto_clear; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
354 gaim_prefs_set_bool("/gaim/gtk/filetransfer/clear_finished", |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
355 dialog->auto_clear); |
4514 | 356 } |
357 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
358 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
359 selection_changed_cb(GtkTreeSelection *selection, GaimGtkXferDialog *dialog) |
4514 | 360 { |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
361 GtkTreeIter iter; |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
362 GaimXfer *xfer = NULL; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
363 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
364 if (gtk_tree_selection_get_selected(selection, NULL, &iter)) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
365 GValue val = {0, }; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
366 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
367 gtk_widget_set_sensitive(dialog->disclosure, TRUE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
368 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
369 gtk_tree_model_get_value(GTK_TREE_MODEL(dialog->model), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
370 &iter, COLUMN_DATA, &val); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
371 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
372 xfer = g_value_get_pointer(&val); |
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 update_detailed_info(dialog, xfer); |
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 dialog->selected_xfer = xfer; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
377 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
378 else { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
379 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->disclosure), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
380 FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
381 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
382 gtk_widget_set_sensitive(dialog->disclosure, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
383 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
384 dialog->selected_xfer = NULL; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
385 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
386 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
387 update_buttons(dialog, xfer); |
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 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
390 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
391 open_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
392 { |
8366
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
393 #ifdef _WIN32 /* Only supported in Win32 right now */ |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
394 int code = (int)ShellExecute(NULL, NULL, |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
395 gaim_xfer_get_local_filename(dialog->selected_xfer), |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
396 NULL, NULL, SW_SHOW); |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
397 if (code == SE_ERR_ASSOCINCOMPLETE || code == SE_ERR_NOASSOC) |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
398 { |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
399 gaim_notify_error(NULL, NULL, |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
400 _("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
|
401 } |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
402 else if (code < 32) |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
403 { |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
404 gaim_notify_error(NULL, NULL, |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
405 _("An error occurred while opening the file."), NULL); |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
406 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
|
407 } |
5956297c6bcc
[gaim-migrate @ 9091]
Christian Hammond <chipx86@chipx86.com>
parents:
8351
diff
changeset
|
408 #endif |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
409 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
410 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
411 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
412 pause_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
413 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
414 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
415 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
416 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
417 resume_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
418 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
419 } |
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 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
422 remove_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
423 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
424 gaim_gtkxfer_dialog_remove_xfer(dialog, dialog->selected_xfer); |
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 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
428 stop_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
429 { |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4661
diff
changeset
|
430 gaim_xfer_cancel_local(dialog->selected_xfer); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
431 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
432 |
5608 | 433 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
434 close_button_cb(GtkButton *button, GaimGtkXferDialog *dialog) |
5608 | 435 { |
436 gaim_gtkxfer_dialog_hide(dialog); | |
437 } | |
438 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
439 /************************************************************************** |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
440 * Dialog Building Functions |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
441 **************************************************************************/ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
442 static GtkWidget * |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
443 setup_tree(GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
444 { |
4514 | 445 GtkWidget *sw; |
446 GtkWidget *tree; | |
447 GtkListStore *model; | |
448 GtkCellRenderer *renderer; | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
449 GtkTreeViewColumn *column; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
450 GtkTreeSelection *selection; |
4514 | 451 |
452 /* Create the scrolled window. */ | |
453 sw = gtk_scrolled_window_new(0, 0); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
454 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
455 GTK_SHADOW_IN); |
4514 | 456 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
457 GTK_POLICY_AUTOMATIC, | |
458 GTK_POLICY_ALWAYS); | |
459 gtk_widget_show(sw); | |
460 | |
461 /* Build the tree model */ | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
462 /* Transfer type, Progress Bar, Filename, Size, Remaining */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
463 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
|
464 G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
465 G_TYPE_POINTER); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
466 dialog->model = model; |
4514 | 467 |
468 /* Create the treeview */ | |
469 dialog->tree = tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model)); | |
470 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
|
471 selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree)); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
472 /* gtk_tree_selection_set_mode(selection, GTK_SELECTION_MULTIPLE); */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
473 |
4514 | 474 gtk_widget_show(tree); |
475 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
476 g_signal_connect(G_OBJECT(selection), "changed", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
477 G_CALLBACK(selection_changed_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
478 |
4514 | 479 g_object_unref(G_OBJECT(model)); |
480 | |
481 | |
482 /* Columns */ | |
483 | |
484 /* Transfer Type column */ | |
485 renderer = gtk_cell_renderer_pixbuf_new(); | |
486 column = gtk_tree_view_column_new_with_attributes(NULL, renderer, | |
487 "pixbuf", COLUMN_STATUS, NULL); | |
488 gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column), | |
489 GTK_TREE_VIEW_COLUMN_FIXED); | |
490 gtk_tree_view_column_set_fixed_width(GTK_TREE_VIEW_COLUMN(column), 25); | |
491 gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE); | |
492 gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); | |
493 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
494 /* Progress bar column */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
495 renderer = gtk_cell_renderer_progress_new(); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
496 column = gtk_tree_view_column_new_with_attributes(_("Progress"), renderer, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
497 "percentage", COLUMN_PROGRESS, NULL); |
4514 | 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 | |
501 /* Filename column */ | |
502 renderer = gtk_cell_renderer_text_new(); | |
503 column = gtk_tree_view_column_new_with_attributes(_("Filename"), renderer, | |
504 "text", COLUMN_FILENAME, NULL); | |
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 /* File Size column */ | |
509 renderer = gtk_cell_renderer_text_new(); | |
510 column = gtk_tree_view_column_new_with_attributes(_("Size"), renderer, | |
511 "text", COLUMN_SIZE, 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 /* Bytes Remaining column */ | |
516 renderer = gtk_cell_renderer_text_new(); | |
517 column = gtk_tree_view_column_new_with_attributes(_("Remaining"), | |
518 renderer, "text", COLUMN_REMAINING, 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 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(tree)); | |
523 | |
524 gtk_container_add(GTK_CONTAINER(sw), tree); | |
525 gtk_widget_show(tree); | |
526 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
527 return sw; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
528 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
529 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
530 static GtkWidget * |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
531 make_info_table(GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
532 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
533 GtkWidget *table; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
534 GtkWidget *label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
535 GtkWidget *sep; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
536 int i; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
537 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
538 struct |
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 **desc_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
541 GtkWidget **val_label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
542 const char *desc; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
543 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
544 } labels[] = |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
545 { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
546 { &dialog->user_desc_label, &dialog->user_label, NULL }, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
547 { &label, &dialog->filename_label, _("Filename:") }, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
548 { &label, &dialog->status_label, _("Status:") }, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
549 { &label, &dialog->speed_label, _("Speed:") }, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
550 { &label, &dialog->time_elapsed_label, _("Time Elapsed:") }, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
551 { &label, &dialog->time_remaining_label, _("Time Remaining:") } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
552 }; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
553 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
554 /* Setup the initial table */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
555 dialog->table = table = gtk_table_new(8, 2, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
556 gtk_table_set_row_spacings(GTK_TABLE(table), 6); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
557 gtk_table_set_col_spacings(GTK_TABLE(table), 6); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
558 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
559 /* Setup the labels */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
560 for (i = 0; i < sizeof(labels) / sizeof(*labels); i++) { |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
561 GtkWidget *label; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
562 char buf[256]; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
563 |
4894 | 564 g_snprintf(buf, sizeof(buf), "<b>%s</b>", |
565 labels[i].desc != NULL ? labels[i].desc : ""); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
566 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
567 *labels[i].desc_label = label = gtk_label_new(NULL); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
568 gtk_label_set_markup(GTK_LABEL(label), buf); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
569 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
570 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
571 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
|
572 GTK_FILL, 0, 0, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
573 gtk_widget_show(label); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
574 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
575 *labels[i].val_label = label = gtk_label_new(NULL); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
576 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
577 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
|
578 GTK_FILL | GTK_EXPAND, 0, 0, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
579 gtk_widget_show(label); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
580 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
581 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
582 /* Setup the progress bar */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
583 dialog->progress = gtk_progress_bar_new(); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
584 gtk_table_attach(GTK_TABLE(table), dialog->progress, 0, 2, 6, 7, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
585 GTK_FILL, GTK_FILL, 0, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
586 gtk_widget_show(dialog->progress); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
587 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
588 sep = gtk_hseparator_new(); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
589 gtk_table_attach(GTK_TABLE(table), sep, 0, 2, 7, 8, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
590 GTK_FILL, GTK_FILL, 0, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
591 gtk_widget_show(sep); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
592 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
593 return table; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
594 } |
4514 | 595 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
596 GaimGtkXferDialog * |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
597 gaim_gtkxfer_dialog_new(void) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
598 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
599 GaimGtkXferDialog *dialog; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
600 GtkWidget *window; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
601 GtkWidget *vbox1, *vbox2; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
602 GtkWidget *bbox; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
603 GtkWidget *sw; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
604 GtkWidget *sep; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
605 GtkWidget *button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
606 GtkWidget *disclosure; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
607 GtkWidget *table; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
608 GtkWidget *checkbox; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
609 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
610 dialog = g_new0(GaimGtkXferDialog, 1); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
611 dialog->keep_open = |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
612 gaim_prefs_get_bool("/gaim/gtk/filetransfer/keep_open"); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
613 dialog->auto_clear = |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
614 gaim_prefs_get_bool("/gaim/gtk/filetransfer/clear_finished"); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
615 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
616 /* Create the window. */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
617 dialog->window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
618 gtk_window_set_role(GTK_WINDOW(window), "file transfer"); |
4570
67a373071933
[gaim-migrate @ 4851]
Christian Hammond <chipx86@chipx86.com>
parents:
4566
diff
changeset
|
619 gtk_window_set_title(GTK_WINDOW(window), _("File Transfers")); |
67a373071933
[gaim-migrate @ 4851]
Christian Hammond <chipx86@chipx86.com>
parents:
4566
diff
changeset
|
620 #if 0 |
67a373071933
[gaim-migrate @ 4851]
Christian Hammond <chipx86@chipx86.com>
parents:
4566
diff
changeset
|
621 gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, TRUE); |
67a373071933
[gaim-migrate @ 4851]
Christian Hammond <chipx86@chipx86.com>
parents:
4566
diff
changeset
|
622 gtk_window_set_default_size(GTK_WINDOW(window), 390, 400); |
67a373071933
[gaim-migrate @ 4851]
Christian Hammond <chipx86@chipx86.com>
parents:
4566
diff
changeset
|
623 #endif |
4719 | 624 gtk_window_set_resizable(GTK_WINDOW(window), FALSE); |
4570
67a373071933
[gaim-migrate @ 4851]
Christian Hammond <chipx86@chipx86.com>
parents:
4566
diff
changeset
|
625 gtk_container_set_border_width(GTK_CONTAINER(window), 12); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
626 gtk_widget_realize(window); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
627 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
628 g_signal_connect(G_OBJECT(window), "delete_event", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
629 G_CALLBACK(delete_win_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
630 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
631 /* Create the parent vbox for everything. */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
632 vbox1 = gtk_vbox_new(FALSE, 12); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
633 gtk_container_add(GTK_CONTAINER(window), vbox1); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
634 gtk_widget_show(vbox1); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
635 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
636 /* Create the main vbox for top half of the window. */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
637 vbox2 = gtk_vbox_new(FALSE, 6); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
638 gtk_box_pack_start(GTK_BOX(vbox1), vbox2, TRUE, TRUE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
639 gtk_widget_show(vbox2); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
640 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
641 /* Setup the listbox */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
642 sw = setup_tree(dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
643 gtk_box_pack_start(GTK_BOX(vbox2), sw, TRUE, TRUE, 0); |
4719 | 644 gtk_widget_set_size_request(sw,-1, 140); |
7272
02f697df677b
[gaim-migrate @ 7849]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
645 |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
646 /* "Keep the dialog open" */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
647 checkbox = gtk_check_button_new_with_mnemonic( |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
648 _("_Keep the dialog open")); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
649 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
650 dialog->keep_open); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
651 g_signal_connect(G_OBJECT(checkbox), "toggled", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
652 G_CALLBACK(toggle_keep_open_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
653 gtk_box_pack_start(GTK_BOX(vbox2), checkbox, FALSE, FALSE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
654 gtk_widget_show(checkbox); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
655 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
656 /* "Clear finished transfers" */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
657 checkbox = gtk_check_button_new_with_mnemonic( |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
658 _("_Clear finished transfers")); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
659 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
660 dialog->auto_clear); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
661 g_signal_connect(G_OBJECT(checkbox), "toggled", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
662 G_CALLBACK(toggle_clear_finished_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
663 gtk_box_pack_start(GTK_BOX(vbox2), checkbox, FALSE, FALSE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
664 gtk_widget_show(checkbox); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
665 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
666 /* "Download Details" arrow */ |
7738 | 667 disclosure = gaim_disclosure_new(_("Show transfer details"), |
668 _("Hide transfer details")); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
669 dialog->disclosure = disclosure; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
670 gtk_box_pack_start(GTK_BOX(vbox2), disclosure, FALSE, FALSE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
671 gtk_widget_show(disclosure); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
672 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
673 gtk_widget_set_sensitive(disclosure, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
674 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
675 #if 0 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
676 g_signal_connect(G_OBJECT(disclosure), "toggled", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
677 G_CALLBACK(toggle_details_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
678 #endif |
4514 | 679 |
680 /* Separator */ | |
681 sep = gtk_hseparator_new(); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
682 gtk_box_pack_start(GTK_BOX(vbox2), sep, FALSE, FALSE, 0); |
4514 | 683 gtk_widget_show(sep); |
684 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
685 /* The table of information. */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
686 table = make_info_table(dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
687 gtk_box_pack_start(GTK_BOX(vbox2), table, TRUE, TRUE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
688 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
689 /* Setup the disclosure for the table. */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
690 gaim_disclosure_set_container(GAIM_DISCLOSURE(disclosure), table); |
4514 | 691 |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
692 /* Now the button box for the buttons */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
693 bbox = gtk_hbutton_box_new(); |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
694 gtk_box_set_spacing(GTK_BOX(bbox), 6); |
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
695 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
|
696 gtk_box_pack_end(GTK_BOX(vbox1), bbox, FALSE, TRUE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
697 gtk_widget_show(bbox); |
4514 | 698 |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
699 /* Open button */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
700 button = gtk_button_new_from_stock(GTK_STOCK_OPEN); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
701 gtk_widget_set_sensitive(button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
702 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
703 gtk_widget_show(button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
704 dialog->open_button = button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
705 |
4514 | 706 g_signal_connect(G_OBJECT(button), "clicked", |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
707 G_CALLBACK(open_button_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
708 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
709 /* Pause button */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
710 button = gtk_button_new_with_mnemonic(_("_Pause")); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
711 gtk_widget_set_sensitive(button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
712 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4514 | 713 gtk_widget_show(button); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
714 dialog->pause_button = button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
715 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
716 g_signal_connect(G_OBJECT(button), "clicked", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
717 G_CALLBACK(pause_button_cb), dialog); |
7272
02f697df677b
[gaim-migrate @ 7849]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
718 |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
719 /* Resume button */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
720 button = gtk_button_new_with_mnemonic(_("_Resume")); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
721 gtk_widget_set_sensitive(button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
722 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
723 gtk_widget_show(button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
724 dialog->resume_button = button; |
4514 | 725 |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
726 g_signal_connect(G_OBJECT(button), "clicked", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
727 G_CALLBACK(resume_button_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
728 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
729 /* Remove button */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
730 button = gtk_button_new_from_stock(GTK_STOCK_REMOVE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
731 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
732 gtk_widget_hide(button); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
733 dialog->remove_button = button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
734 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
735 g_signal_connect(G_OBJECT(button), "clicked", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
736 G_CALLBACK(remove_button_cb), dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
737 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
738 /* Stop button */ |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
739 button = gtk_button_new_from_stock(GTK_STOCK_STOP); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
740 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
4514 | 741 gtk_widget_show(button); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
742 gtk_widget_set_sensitive(button, FALSE); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
743 dialog->stop_button = button; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
744 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
745 g_signal_connect(G_OBJECT(button), "clicked", |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
746 G_CALLBACK(stop_button_cb), dialog); |
4514 | 747 |
5608 | 748 /* Close button */ |
749 button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); | |
750 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); | |
751 gtk_widget_show(button); | |
752 dialog->close_button = button; | |
753 | |
754 g_signal_connect(G_OBJECT(button), "clicked", | |
755 G_CALLBACK(close_button_cb), dialog); | |
756 | |
4514 | 757 return dialog; |
758 } | |
759 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
760 void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
761 gaim_gtkxfer_dialog_destroy(GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
762 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
763 g_return_if_fail(dialog != NULL); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
764 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
765 gtk_widget_destroy(dialog->window); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
766 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
767 g_free(dialog); |
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 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
770 void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
771 gaim_gtkxfer_dialog_show(GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
772 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
773 g_return_if_fail(dialog != NULL); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
774 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
775 gtk_widget_show(dialog->window); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
776 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
777 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
778 void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
779 gaim_gtkxfer_dialog_hide(GaimGtkXferDialog *dialog) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
780 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
781 g_return_if_fail(dialog != NULL); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
782 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
783 gtk_widget_hide(dialog->window); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
784 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
785 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
786 void |
4698 | 787 gaim_show_xfer_dialog() |
788 { | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
789 GaimGtkXferDialog *dialog; |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
790 |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
791 dialog = gaim_get_gtkxfer_dialog(); |
4698 | 792 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
793 if (dialog == NULL) { |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
794 dialog = gaim_gtkxfer_dialog_new(); |
4698 | 795 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
796 gaim_set_gtkxfer_dialog(dialog); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
797 } |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
798 |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
799 gaim_gtkxfer_dialog_show(dialog); |
4698 | 800 } |
801 | |
802 void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
803 gaim_gtkxfer_dialog_add_xfer(GaimGtkXferDialog *dialog, GaimXfer *xfer) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
804 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
805 GaimGtkXferUiData *data; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
806 GaimXferType type; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
807 GdkPixbuf *pixbuf; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
808 char *size_str, *remaining_str; |
7738 | 809 char *lfilename; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
810 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
811 g_return_if_fail(dialog != NULL); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
812 g_return_if_fail(xfer != NULL); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
813 |
7805 | 814 gaim_xfer_ref(xfer); |
815 | |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
816 data = GAIM_GTKXFER(xfer); |
7805 | 817 data->in_list = TRUE; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
818 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
819 gaim_gtkxfer_dialog_show(dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
820 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
821 data->start_time = time(NULL); |
9017 | 822 data->end_time = -1; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
823 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
824 type = gaim_xfer_get_type(xfer); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
825 |
7107
9220c7490cd1
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
826 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
|
827 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
|
828 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
829 pixbuf = gtk_widget_render_icon(dialog->window, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
830 (type == GAIM_XFER_RECEIVE |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
831 ? GAIM_STOCK_DOWNLOAD |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
832 : GAIM_STOCK_UPLOAD), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
833 GTK_ICON_SIZE_MENU, NULL); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
834 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
835 gtk_list_store_append(dialog->model, &data->iter); |
7738 | 836 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
|
837 gtk_list_store_set(dialog->model, &data->iter, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
838 COLUMN_STATUS, pixbuf, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
839 COLUMN_PROGRESS, 0.0, |
7738 | 840 COLUMN_FILENAME, (type == GAIM_XFER_RECEIVE) |
841 ? gaim_xfer_get_filename(xfer) | |
842 : lfilename, | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
843 COLUMN_SIZE, size_str, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
844 COLUMN_REMAINING, remaining_str, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
845 COLUMN_DATA, xfer, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
846 -1); |
7738 | 847 g_free(lfilename); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
848 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
849 gtk_tree_view_columns_autosize(GTK_TREE_VIEW(dialog->tree)); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
850 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
851 g_object_unref(pixbuf); |
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 g_free(size_str); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
854 g_free(remaining_str); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
855 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
856 dialog->num_transfers++; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
857 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
858 ensure_row_selected(dialog); |
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 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
861 void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
862 gaim_gtkxfer_dialog_remove_xfer(GaimGtkXferDialog *dialog, |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
863 GaimXfer *xfer) |
4514 | 864 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
865 GaimGtkXferUiData *data; |
4514 | 866 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
867 g_return_if_fail(dialog != NULL); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
868 g_return_if_fail(xfer != NULL); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
869 |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
870 data = GAIM_GTKXFER(xfer); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
871 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
872 if (data == NULL) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
873 return; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
874 |
7805 | 875 if (!data->in_list) |
876 return; | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
877 |
7805 | 878 data->in_list = FALSE; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
879 |
7805 | 880 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
|
881 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
882 dialog->num_transfers--; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
883 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
884 if (dialog->num_transfers == 0 && !dialog->keep_open) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
885 gaim_gtkxfer_dialog_hide(dialog); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
886 else |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
887 ensure_row_selected(dialog); |
7805 | 888 |
889 gaim_xfer_unref(xfer); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
890 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
891 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
892 void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
893 gaim_gtkxfer_dialog_cancel_xfer(GaimGtkXferDialog *dialog, |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
894 GaimXfer *xfer) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
895 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
896 GaimGtkXferUiData *data; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
897 GdkPixbuf *pixbuf; |
7738 | 898 gchar *status; |
899 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
900 g_return_if_fail(dialog != NULL); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
901 g_return_if_fail(xfer != NULL); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
902 |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
903 data = GAIM_GTKXFER(xfer); |
4514 | 904 |
905 if (data == NULL) | |
906 return; | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
907 |
8282 | 908 if (!data->in_list) |
909 return; | |
7738 | 910 |
7805 | 911 if ((gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL) && (dialog->auto_clear)) { |
912 gaim_gtkxfer_dialog_remove_xfer(dialog, xfer); | |
7738 | 913 return; |
914 } | |
915 | |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
916 data = GAIM_GTKXFER(xfer); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
917 |
9017 | 918 update_detailed_info(dialog, xfer); |
919 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
920 pixbuf = gtk_widget_render_icon(dialog->window, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
921 GAIM_STOCK_FILE_CANCELED, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
922 GTK_ICON_SIZE_MENU, NULL); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
923 |
7805 | 924 if (gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL) |
7738 | 925 status = _("Canceled"); |
926 else | |
927 status = _("Failed"); | |
928 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
929 gtk_list_store_set(dialog->model, &data->iter, |
7738 | 930 COLUMN_STATUS, pixbuf, |
931 COLUMN_REMAINING, status, | |
932 -1); | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
933 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
934 g_object_unref(pixbuf); |
7738 | 935 |
936 update_buttons(dialog, xfer); | |
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 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
939 void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
940 gaim_gtkxfer_dialog_update_xfer(GaimGtkXferDialog *dialog, |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
941 GaimXfer *xfer) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
942 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
943 GaimGtkXferUiData *data; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
944 char *size_str, *remaining_str; |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
945 GtkTreeSelection *selection; |
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 g_return_if_fail(dialog != NULL); |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
948 g_return_if_fail(xfer != NULL); |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
949 |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
950 if ((data = GAIM_GTKXFER(xfer)) == NULL) |
4656 | 951 return; |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
952 |
7805 | 953 if (data->in_list == FALSE) |
954 return; | |
955 | |
7107
9220c7490cd1
[gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
956 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
|
957 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
|
958 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
959 gtk_list_store_set(xfer_dialog->model, &data->iter, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
960 COLUMN_PROGRESS, gaim_xfer_get_progress(xfer), |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
961 COLUMN_SIZE, size_str, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
962 COLUMN_REMAINING, remaining_str, |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
963 -1); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
964 |
4607 | 965 if (gaim_xfer_is_completed(xfer)) { |
966 GdkPixbuf *pixbuf; | |
967 | |
968 pixbuf = gtk_widget_render_icon(dialog->window, | |
969 GAIM_STOCK_FILE_DONE, | |
970 GTK_ICON_SIZE_MENU, NULL); | |
971 | |
972 gtk_list_store_set(GTK_LIST_STORE(xfer_dialog->model), &data->iter, | |
973 COLUMN_STATUS, pixbuf, | |
8351 | 974 COLUMN_REMAINING, _("Finished"), |
4607 | 975 -1); |
976 | |
977 g_object_unref(pixbuf); | |
978 } | |
979 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
980 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
|
981 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
982 if (xfer == dialog->selected_xfer) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
983 update_detailed_info(xfer_dialog, xfer); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
984 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
985 if (gaim_xfer_is_completed(xfer) && dialog->auto_clear) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
986 gaim_gtkxfer_dialog_remove_xfer(dialog, xfer); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
987 else |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
988 update_buttons(dialog, xfer); |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
989 } |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
990 |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
991 /************************************************************************** |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
992 * File Transfer UI Ops |
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 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
995 gaim_gtkxfer_new_xfer(GaimXfer *xfer) |
5169 | 996 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
997 GaimGtkXferUiData *data; |
5169 | 998 |
999 /* 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
|
1000 data = g_new0(GaimGtkXferUiData, 1); |
5169 | 1001 xfer->ui_data = data; |
1002 } | |
1003 | |
1004 static void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1005 gaim_gtkxfer_destroy(GaimXfer *xfer) |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1006 { |
7805 | 1007 GaimGtkXferUiData *data; |
1008 | |
1009 data = GAIM_GTKXFER(xfer); | |
1010 if (data) { | |
1011 if (data->name) | |
1012 g_free(data->name); | |
1013 g_free(data); | |
1014 xfer->ui_data = NULL; | |
1015 } | |
4514 | 1016 } |
1017 | |
1018 static gboolean | |
1019 choose_file_close_cb(GtkWidget *widget, GdkEvent *event, gpointer user_data) | |
1020 { | |
7805 | 1021 GaimXfer *xfer = (GaimXfer *)user_data; |
1022 GaimGtkXferUiData *data; | |
1023 | |
1024 data = GAIM_GTKXFER(xfer); | |
1025 data->filesel = NULL; | |
1026 gaim_xfer_request_denied(xfer); | |
4514 | 1027 |
1028 return FALSE; | |
1029 } | |
1030 | |
1031 static void | |
1032 choose_file_cancel_cb(GtkButton *button, gpointer user_data) | |
1033 { | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1034 GaimXfer *xfer = (GaimXfer *)user_data; |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1035 GaimGtkXferUiData *data; |
4514 | 1036 |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
1037 data = GAIM_GTKXFER(xfer); |
4514 | 1038 gtk_widget_destroy(data->filesel); |
1039 data->filesel = NULL; | |
7805 | 1040 gaim_xfer_request_denied(xfer); |
4514 | 1041 } |
1042 | |
1043 static int | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1044 do_overwrite_cb(GaimXfer *xfer) |
4514 | 1045 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1046 GaimGtkXferUiData *data; |
7272
02f697df677b
[gaim-migrate @ 7849]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
1047 |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
1048 data = GAIM_GTKXFER(xfer); |
4514 | 1049 |
1050 gaim_xfer_request_accepted(xfer, data->name); | |
1051 | |
7805 | 1052 g_free(data->name); |
4514 | 1053 data->name = NULL; |
1054 | |
8282 | 1055 gaim_xfer_unref(xfer); |
4514 | 1056 return 0; |
1057 } | |
1058 | |
1059 static int | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1060 dont_overwrite_cb(GaimXfer *xfer) |
4514 | 1061 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1062 GaimGtkXferUiData *data; |
7272
02f697df677b
[gaim-migrate @ 7849]
Christian Hammond <chipx86@chipx86.com>
parents:
7107
diff
changeset
|
1063 |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
1064 data = GAIM_GTKXFER(xfer); |
4514 | 1065 |
1066 g_free(data->name); | |
1067 data->name = NULL; | |
1068 | |
7805 | 1069 choose_file(xfer); |
4514 | 1070 |
1071 return 0; | |
1072 } | |
1073 | |
1074 static void | |
1075 choose_file_ok_cb(GtkButton *button, gpointer user_data) | |
1076 { | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1077 GaimXfer *xfer; |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1078 GaimGtkXferUiData *data; |
4514 | 1079 struct stat st; |
1080 const char *name; | |
1081 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1082 xfer = (GaimXfer *)user_data; |
4573
82a4a5cd9a61
[gaim-migrate @ 4854]
Christian Hammond <chipx86@chipx86.com>
parents:
4570
diff
changeset
|
1083 data = GAIM_GTKXFER(xfer); |
4514 | 1084 |
1085 name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(data->filesel)); | |
1086 | |
8282 | 1087 if (gaim_gtk_check_if_dir(name, GTK_FILE_SELECTION(data->filesel))) { |
5959 | 1088 return; |
8282 | 1089 } |
5959 | 1090 |
5131 | 1091 if (stat(name, &st) != 0) { |
1092 /* File not found. */ | |
1093 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
1094 gaim_xfer_request_accepted(xfer, g_strdup(name)); | |
1095 } | |
1096 else { | |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5169
diff
changeset
|
1097 gaim_notify_error(NULL, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5169
diff
changeset
|
1098 _("That file does not exist."), NULL); |
5131 | 1099 |
1100 gaim_xfer_request_denied(xfer); | |
1101 } | |
1102 } | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1103 else if ((gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) && |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1104 (st.st_size == 0)) { |
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1105 |
5436
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5169
diff
changeset
|
1106 gaim_notify_error(NULL, NULL, |
ad445074d239
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5169
diff
changeset
|
1107 _("Cannot send a file of 0 bytes."), NULL); |
5131 | 1108 |
1109 gaim_xfer_request_denied(xfer); | |
1110 } | |
1111 else { | |
4514 | 1112 if (S_ISDIR(st.st_mode)) { |
1113 /* XXX */ | |
1114 gaim_xfer_request_denied(xfer); | |
1115 } | |
1116 else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { | |
1117 data->name = g_strdup(name); | |
8282 | 1118 gaim_xfer_ref(xfer); |
4514 | 1119 |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1120 gaim_request_yes_no(NULL, NULL, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1121 _("That file already exists."), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1122 _("Would you like to overwrite it?"), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1123 1, xfer, |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1124 G_CALLBACK(do_overwrite_cb), |
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
1125 G_CALLBACK(dont_overwrite_cb)); |
4514 | 1126 } |
1127 else { | |
7805 | 1128 gaim_xfer_request_accepted(xfer, name); |
4514 | 1129 } |
1130 } | |
1131 | |
1132 gtk_widget_destroy(data->filesel); | |
1133 data->filesel = NULL; | |
8282 | 1134 gaim_xfer_unref(xfer); |
4514 | 1135 } |
1136 | |
1137 static int | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1138 choose_file(GaimXfer *xfer) |
4514 | 1139 { |
1140 char *cur_dir, *init_str; | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1141 GaimGtkXferUiData *data; |
4514 | 1142 |
5169 | 1143 data = GAIM_GTKXFER(xfer); |
4514 | 1144 cur_dir = g_get_current_dir(); |
1145 | |
1146 if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) | |
7859 | 1147 data->filesel = gtk_file_selection_new(_("Open...")); |
4514 | 1148 else |
7859 | 1149 data->filesel = gtk_file_selection_new(_("Save As...")); |
4514 | 1150 |
1151 if (gaim_xfer_get_filename(xfer) == NULL) | |
4661 | 1152 init_str = g_strdup_printf("%s" G_DIR_SEPARATOR_S, cur_dir); |
4514 | 1153 else |
1154 init_str = g_build_filename(cur_dir, gaim_xfer_get_filename(xfer), | |
1155 NULL); | |
1156 | |
1157 g_free(cur_dir); | |
1158 | |
1159 gtk_file_selection_set_filename(GTK_FILE_SELECTION(data->filesel), | |
1160 init_str); | |
1161 | |
1162 g_free(init_str); | |
1163 | |
1164 g_signal_connect(G_OBJECT(data->filesel), "delete_event", | |
1165 G_CALLBACK(choose_file_close_cb), xfer); | |
1166 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(data->filesel)->cancel_button), | |
1167 "clicked", | |
1168 G_CALLBACK(choose_file_cancel_cb), xfer); | |
1169 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(data->filesel)->ok_button), | |
1170 "clicked", | |
1171 G_CALLBACK(choose_file_ok_cb), xfer); | |
1172 | |
1173 gtk_widget_show(data->filesel); | |
1174 | |
1175 return 0; | |
1176 } | |
1177 | |
1178 static int | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1179 cancel_recv_cb(GaimXfer *xfer) |
4514 | 1180 { |
1181 gaim_xfer_request_denied(xfer); | |
8282 | 1182 gaim_xfer_unref(xfer); |
4514 | 1183 |
1184 return 0; | |
1185 } | |
1186 | |
1187 static void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1188 gaim_gtkxfer_ask_recv(GaimXfer *xfer) |
4514 | 1189 { |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1190 char *buf, *size_buf; |
4514 | 1191 size_t size; |
1192 | |
8585 | 1193 /* If we have already accepted the request, ask the destination file |
1194 name directly */ | |
1195 if (gaim_xfer_get_status(xfer) != GAIM_XFER_STATUS_ACCEPTED) { | |
1196 size = gaim_xfer_get_size(xfer); | |
1197 size_buf = gaim_str_size_to_units(size); | |
1198 | |
1199 buf = g_strdup_printf(_("%s wants to send you %s (%s)"), | |
1200 xfer->who, gaim_xfer_get_filename(xfer), | |
1201 size_buf); | |
1202 g_free(size_buf); | |
4514 | 1203 |
8585 | 1204 gaim_request_accept_cancel(NULL, NULL, buf, NULL, 0, xfer, |
1205 G_CALLBACK(choose_file), | |
1206 G_CALLBACK(cancel_recv_cb)); | |
1207 g_free(buf); | |
1208 } else | |
1209 choose_file(xfer); | |
1210 } | |
4514 | 1211 |
8585 | 1212 static int |
1213 ask_accept_ok(GaimXfer *xfer) | |
1214 { | |
1215 gaim_xfer_request_accepted(xfer, NULL); | |
1216 return 0; | |
1217 } | |
4514 | 1218 |
8585 | 1219 static int |
1220 ask_accept_cancel(GaimXfer *xfer) | |
1221 { | |
1222 gaim_xfer_request_denied(xfer); | |
1223 gaim_xfer_unref(xfer); | |
1224 return 0; | |
1225 } | |
1226 | |
1227 static void | |
1228 gaim_gtkxfer_ask_accept(GaimXfer *xfer) | |
1229 { | |
1230 char *buf, *buf2 = NULL; | |
4514 | 1231 |
8585 | 1232 buf = g_strdup_printf(_("Accept file transfer request from %s?"), |
1233 xfer->who); | |
1234 if (gaim_xfer_get_remote_ip(xfer) && | |
1235 gaim_xfer_get_remote_port(xfer)) | |
1236 buf2 = g_strdup_printf(_("A file is available for download from:\n" | |
1237 "Remote host: %s\nRemote port: %d"), | |
1238 gaim_xfer_get_remote_ip(xfer), | |
1239 gaim_xfer_get_remote_port(xfer)); | |
1240 gaim_request_accept_cancel(NULL, NULL, buf, buf2, 0, xfer, | |
1241 G_CALLBACK(ask_accept_ok), | |
1242 G_CALLBACK(ask_accept_cancel)); | |
4514 | 1243 g_free(buf); |
8585 | 1244 g_free(buf2); |
4514 | 1245 } |
1246 | |
1247 static void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1248 gaim_gtkxfer_request_file(GaimXfer *xfer) |
4514 | 1249 { |
8282 | 1250 gaim_xfer_ref(xfer); |
8585 | 1251 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { |
1252 if (gaim_xfer_get_filename(xfer) || | |
1253 gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_ACCEPTED) | |
1254 gaim_gtkxfer_ask_recv(xfer); | |
1255 else | |
1256 gaim_gtkxfer_ask_accept(xfer); | |
1257 } else | |
4514 | 1258 choose_file(xfer); |
1259 } | |
1260 | |
1261 static void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1262 gaim_gtkxfer_ask_cancel(GaimXfer *xfer) |
4514 | 1263 { |
1264 } | |
1265 | |
1266 static void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1267 gaim_gtkxfer_add_xfer(GaimXfer *xfer) |
4514 | 1268 { |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1269 if (xfer_dialog == NULL) |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1270 xfer_dialog = gaim_gtkxfer_dialog_new(); |
4514 | 1271 |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1272 gaim_gtkxfer_dialog_add_xfer(xfer_dialog, xfer); |
4514 | 1273 } |
1274 | |
1275 static void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1276 gaim_gtkxfer_update_progress(GaimXfer *xfer, double percent) |
4514 | 1277 { |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1278 gaim_gtkxfer_dialog_update_xfer(xfer_dialog, xfer); |
4514 | 1279 } |
1280 | |
1281 static void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1282 gaim_gtkxfer_cancel_local(GaimXfer *xfer) |
4514 | 1283 { |
7805 | 1284 if (xfer_dialog) |
1285 gaim_gtkxfer_dialog_cancel_xfer(xfer_dialog, xfer); | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4661
diff
changeset
|
1286 } |
4514 | 1287 |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4661
diff
changeset
|
1288 static void |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1289 gaim_gtkxfer_cancel_remote(GaimXfer *xfer) |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4661
diff
changeset
|
1290 { |
7805 | 1291 if (xfer_dialog) |
1292 gaim_gtkxfer_dialog_cancel_xfer(xfer_dialog, xfer); | |
4514 | 1293 } |
1294 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1295 static GaimXferUiOps ops = |
4514 | 1296 { |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1297 gaim_gtkxfer_new_xfer, |
4514 | 1298 gaim_gtkxfer_destroy, |
1299 gaim_gtkxfer_request_file, | |
1300 gaim_gtkxfer_ask_cancel, | |
1301 gaim_gtkxfer_add_xfer, | |
1302 gaim_gtkxfer_update_progress, | |
4675
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4661
diff
changeset
|
1303 gaim_gtkxfer_cancel_local, |
3145c5c45877
[gaim-migrate @ 4986]
Christian Hammond <chipx86@chipx86.com>
parents:
4661
diff
changeset
|
1304 gaim_gtkxfer_cancel_remote |
4514 | 1305 }; |
1306 | |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1307 /************************************************************************** |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1308 * GTK+ File Transfer API |
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1309 **************************************************************************/ |
4514 | 1310 void |
6267
36b80ce02a51
[gaim-migrate @ 6764]
Christian Hammond <chipx86@chipx86.com>
parents:
6240
diff
changeset
|
1311 gaim_gtk_xfers_init(void) |
5974 | 1312 { |
1313 gaim_prefs_add_none("/gaim/gtk/filetransfer"); | |
1314 gaim_prefs_add_bool("/gaim/gtk/filetransfer/clear_finished", TRUE); | |
1315 gaim_prefs_add_bool("/gaim/gtk/filetransfer/keep_open", FALSE); | |
1316 } | |
1317 | |
1318 void | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1319 gaim_set_gtkxfer_dialog(GaimGtkXferDialog *dialog) |
4514 | 1320 { |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1321 xfer_dialog = dialog; |
4514 | 1322 } |
1323 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1324 GaimGtkXferDialog * |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1325 gaim_get_gtkxfer_dialog(void) |
4514 | 1326 { |
4553
d03fcb3f4be2
[gaim-migrate @ 4833]
Christian Hammond <chipx86@chipx86.com>
parents:
4541
diff
changeset
|
1327 return xfer_dialog; |
4514 | 1328 } |
1329 | |
6240
ac191233b816
[gaim-migrate @ 6734]
Christian Hammond <chipx86@chipx86.com>
parents:
5974
diff
changeset
|
1330 GaimXferUiOps * |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
1331 gaim_gtk_xfers_get_ui_ops(void) |
4514 | 1332 { |
1333 return &ops; | |
1334 } |