comparison pidgin/gtkcertmgr.c @ 21300:abbf74f4732b

propagate from branch 'im.pidgin.pidgin' (head e3fd21e6dabb99e5604e8337380353fcbe1a7279) to branch 'im.pidgin.elb.make' (head 7422b9a549f752c05cc75f0c8e56fdd2bced034a)
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 10 Nov 2007 16:17:54 +0000
parents 6de09629f091
children 665e04562de0
comparison
equal deleted inserted replaced
21132:f2dcad9572b2 21300:abbf74f4732b
182 default_hostname = purple_certificate_get_subject_name(crt); 182 default_hostname = purple_certificate_get_subject_name(crt);
183 /* TODO: Find a way to make sure that crt gets destroyed 183 /* TODO: Find a way to make sure that crt gets destroyed
184 if the window gets closed unusually, such as by handle 184 if the window gets closed unusually, such as by handle
185 deletion */ 185 deletion */
186 /* TODO: Display some more information on the certificate? */ 186 /* TODO: Display some more information on the certificate? */
187 purple_request_input(tpm_dat, 187 purple_request_input_with_hint(tpm_dat,
188 _("Certificate Import"), 188 _("Certificate Import"),
189 _("Specify a hostname"), 189 _("Specify a hostname"),
190 _("Type the host name this certificate is for."), 190 _("Type the host name this certificate is for."),
191 default_hostname, 191 default_hostname,
192 FALSE, /* Not multiline */ 192 FALSE, /* Not multiline */
195 _("OK"), 195 _("OK"),
196 G_CALLBACK(tls_peers_mgmt_import_ok2_cb), 196 G_CALLBACK(tls_peers_mgmt_import_ok2_cb),
197 _("Cancel"), 197 _("Cancel"),
198 G_CALLBACK(tls_peers_mgmt_import_cancel2_cb), 198 G_CALLBACK(tls_peers_mgmt_import_cancel2_cb),
199 NULL, NULL, NULL, /* No account/who/conv*/ 199 NULL, NULL, NULL, /* No account/who/conv*/
200 crt /* Pass cert instance to callback*/ 200 PURPLE_REQUEST_UI_HINT_CERTMGR, crt /* Pass cert instance to callback*/
201 ); 201 );
202 202
203 g_free(default_hostname); 203 g_free(default_hostname);
204 } else { 204 } else {
205 /* Errors! Oh no! */ 205 /* Errors! Oh no! */
218 218
219 static void 219 static void
220 tls_peers_mgmt_import_cb(GtkWidget *button, gpointer data) 220 tls_peers_mgmt_import_cb(GtkWidget *button, gpointer data)
221 { 221 {
222 /* TODO: need to tell the user that we want a .PEM file! */ 222 /* TODO: need to tell the user that we want a .PEM file! */
223 purple_request_file(tpm_dat, 223 purple_request_file_with_hint(tpm_dat,
224 _("Select a PEM certificate"), 224 _("Select a PEM certificate"),
225 "certificate.pem", 225 "certificate.pem",
226 FALSE, /* Not a save dialog */ 226 FALSE, /* Not a save dialog */
227 G_CALLBACK(tls_peers_mgmt_import_ok_cb), 227 G_CALLBACK(tls_peers_mgmt_import_ok_cb),
228 NULL, /* Do nothing if cancelled */ 228 NULL, /* Do nothing if cancelled */
229 NULL, NULL, NULL, NULL );/* No account,conv,etc. */ 229 NULL, NULL, NULL, PURPLE_REQUEST_UI_HINT_CERTMGR, NULL );/* No account,conv,etc. */
230 } 230 }
231 231
232 static void 232 static void
233 tls_peers_mgmt_export_ok_cb(gpointer data, const char *filename) 233 tls_peers_mgmt_export_ok_cb(gpointer data, const char *filename)
234 { 234 {
293 } 293 }
294 g_free(id); 294 g_free(id);
295 295
296 296
297 /* TODO: inform user that it will be a PEM? */ 297 /* TODO: inform user that it will be a PEM? */
298 purple_request_file(tpm_dat, 298 purple_request_file_with_hint(tpm_dat,
299 _("PEM X.509 Certificate Export"), 299 _("PEM X.509 Certificate Export"),
300 "certificate.pem", 300 "certificate.pem",
301 TRUE, /* Is a save dialog */ 301 TRUE, /* Is a save dialog */
302 G_CALLBACK(tls_peers_mgmt_export_ok_cb), 302 G_CALLBACK(tls_peers_mgmt_export_ok_cb),
303 G_CALLBACK(tls_peers_mgmt_export_cancel_cb), 303 G_CALLBACK(tls_peers_mgmt_export_cancel_cb),
304 NULL, NULL, NULL, /* No account,conv,etc. */ 304 NULL, NULL, NULL, /* No account,conv,etc. */
305 crt); /* Pass the certificate on to the callback */ 305 PURPLE_REQUEST_UI_HINT_CERTMGR, crt); /* Pass the certificate on to the callback */
306 } 306 }
307 307
308 static void 308 static void
309 tls_peers_mgmt_info_cb(GtkWidget *button, gpointer data) 309 tls_peers_mgmt_info_cb(GtkWidget *button, gpointer data)
310 { 310 {
369 369
370 /* Prompt to confirm deletion */ 370 /* Prompt to confirm deletion */
371 primary = g_strdup_printf( 371 primary = g_strdup_printf(
372 _("Really delete certificate for %s?"), id ); 372 _("Really delete certificate for %s?"), id );
373 373
374 purple_request_yes_no(tpm_dat, _("Confirm certificate delete"), 374 purple_request_yes_no_with_hint(tpm_dat, _("Confirm certificate delete"),
375 primary, NULL, /* Can this be NULL? */ 375 primary, NULL, /* Can this be NULL? */
376 2, /* NO is default action */ 376 2, /* NO is default action */
377 NULL, NULL, NULL, 377 NULL, NULL, NULL,
378 PURPLE_REQUEST_UI_HINT_CERTMGR,
378 id, /* id ownership passed to callback */ 379 id, /* id ownership passed to callback */
379 tls_peers_mgmt_delete_confirm_cb, 380 tls_peers_mgmt_delete_confirm_cb,
380 tls_peers_mgmt_delete_confirm_cb ); 381 tls_peers_mgmt_delete_confirm_cb );
381 382
382 g_free(primary); 383 g_free(primary);