diff options
author | Carlos Garnacho Parro <carlosg@gnome.org> | 2004-08-13 04:37:27 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-08-13 04:37:27 +0800 |
commit | b2b85e860d113fcd981797a93afb9ff21dd0be4f (patch) | |
tree | d8c663cd564e7dac72a9d328d29d9ad22a044450 /smime | |
parent | 4cc6322a8c0345709d196022a0c87d15c5f93580 (diff) | |
download | gsoc2013-evolution-b2b85e860d113fcd981797a93afb9ff21dd0be4f.tar.gz gsoc2013-evolution-b2b85e860d113fcd981797a93afb9ff21dd0be4f.tar.zst gsoc2013-evolution-b2b85e860d113fcd981797a93afb9ff21dd0be4f.zip |
Optionally use GtkFileChooser if compiled against Gtk+ >= 2.4.0
2004-08-12 Carlos Garnacho Parro <carlosg@gnome.org>
* gui/certificate-manager.c: Optionally use GtkFileChooser if
compiled against Gtk+ >= 2.4.0
svn path=/trunk/; revision=26895
Diffstat (limited to 'smime')
-rw-r--r-- | smime/ChangeLog | 5 | ||||
-rw-r--r-- | smime/gui/certificate-manager.c | 64 |
2 files changed, 63 insertions, 6 deletions
diff --git a/smime/ChangeLog b/smime/ChangeLog index c515159914..2837a597ec 100644 --- a/smime/ChangeLog +++ b/smime/ChangeLog @@ -1,3 +1,8 @@ +2004-08-12 Carlos Garnacho Parro <carlosg@gnome.org> + + * gui/certificate-manager.c: Optionally use GtkFileChooser if + compiled against Gtk+ >= 2.4.0 + 2004-08-10 Not Zed <NotZed@Ximian.com> * gui/component.c (smime_pk11_passwd, smime_pk11_change_passwd): diff --git a/smime/gui/certificate-manager.c b/smime/gui/certificate-manager.c index d43fab31fd..16bb261bfc 100644 --- a/smime/gui/certificate-manager.c +++ b/smime/gui/certificate-manager.c @@ -127,10 +127,28 @@ handle_selection_changed (GtkTreeSelection *selection, static void import_your (GtkWidget *widget, CertificateManagerData *cfm) { - GtkWidget *filesel = gtk_file_selection_new (_("Select a cert to import...")); + GtkWidget *filesel; + const char *filename; + +#ifdef USE_GTKFILECHOOSER + filesel = gtk_file_chooser_dialog_new (_("Select a cert to import..."), + NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_OK, + NULL); + gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK); +#else + filesel = gtk_file_selection_new (_("Select a cert to import...")); +#endif if (GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (filesel))) { - const char *filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel)); +#ifdef USE_GTKFILECHOOSER + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel)); +#else + filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel)); +#endif + if (e_cert_db_import_pkcs12_file (e_cert_db_peek (), filename, NULL /* XXX */)) { /* there's no telling how many certificates were added during the import, @@ -350,10 +368,27 @@ edit_contact (GtkWidget *widget, CertificateManagerData *cfm) static void import_contact (GtkWidget *widget, CertificateManagerData *cfm) { - GtkWidget *filesel = gtk_file_selection_new (_("Select a cert to import...")); + GtkWidget *filesel; + const char *filename; + +#ifdef USE_GTKFILECHOOSER + filesel = gtk_file_chooser_dialog_new (_("Select a cert to import..."), + NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_OK, + NULL); + gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK); +#else + filesel = gtk_file_selection_new (_("Select a cert to import...")); +#endif if (GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (filesel))) { - const char *filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel)); +#ifdef USE_GTKFILECHOOSER + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel)); +#else + filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel)); +#endif if (e_cert_db_import_certs_from_file (e_cert_db_peek (), filename, @@ -553,10 +588,27 @@ edit_ca (GtkWidget *widget, CertificateManagerData *cfm) static void import_ca (GtkWidget *widget, CertificateManagerData *cfm) { - GtkWidget *filesel = gtk_file_selection_new (_("Select a cert to import...")); + GtkWidget *filesel; + const char *filename; + +#ifdef USE_GTKFILECHOOSER + filesel = gtk_file_chooser_dialog_new (_("Select a cert to import..."), + NULL, + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_OK, + NULL); + gtk_dialog_set_default_response (GTK_DIALOG (filesel), GTK_RESPONSE_OK); +#else + filesel = gtk_file_selection_new (_("Select a cert to import...")); +#endif if (GTK_RESPONSE_OK == gtk_dialog_run (GTK_DIALOG (filesel))) { - const char *filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel)); +#ifdef USE_GTKFILECHOOSER + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filesel)); +#else + filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel)); +#endif if (e_cert_db_import_certs_from_file (e_cert_db_peek (), filename, |