diff options
author | Tor Lillqvist <tml@novell.com> | 2005-11-25 23:13:32 +0800 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2005-11-25 23:13:32 +0800 |
commit | e52ac86fca49e157eb21af1c68099301a7714998 (patch) | |
tree | 7a53e6d0f1866945511bfc4434b674fdcc578f2a /mail/em-composer-prefs.c | |
parent | f5b079e688fd0e644e2526aaf048b60f2f3a90fa (diff) | |
download | gsoc2013-evolution-e52ac86fca49e157eb21af1c68099301a7714998.tar.gz gsoc2013-evolution-e52ac86fca49e157eb21af1c68099301a7714998.tar.zst gsoc2013-evolution-e52ac86fca49e157eb21af1c68099301a7714998.zip |
Use gstdio wrappers. (url_requested): Use g_filename_from_uri() instead of
2005-11-25 Tor Lillqvist <tml@novell.com>
* em-composer-prefs.c (sig_add_script_response): Use gstdio
wrappers.
(url_requested): Use g_filename_from_uri()
instead of just stripping off the "file:" prefix.
(em_composer_prefs_construct): Construct glade file pathname at
run-time for Win32 install-anywhere.
svn path=/trunk/; revision=30672
Diffstat (limited to 'mail/em-composer-prefs.c')
-rw-r--r-- | mail/em-composer-prefs.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/mail/em-composer-prefs.c b/mail/em-composer-prefs.c index 7e80c38284..8f4df147a3 100644 --- a/mail/em-composer-prefs.c +++ b/mail/em-composer-prefs.c @@ -62,10 +62,12 @@ #include <gtkhtml/gtkhtml.h> +#include <glib/gstdio.h> + #include "misc/e-charset-picker.h" #include "e-util/e-error.h" - -#include <e-util/e-icon-factory.h> +#include "e-util/e-util-private.h" +#include "e-util/e-icon-factory.h" #include "mail-config.h" #include "mail-signature-editor.h" @@ -389,7 +391,7 @@ sig_add_script_response (GtkWidget *widget, int button, EMComposerPrefs *prefs) if (script && *script && g_shell_parse_argv (script, &argc, &argv, NULL)) { struct stat st; - if (stat (argv[0], &st) == 0 && S_ISREG (st.st_mode) && access (argv[0], X_OK) == 0) { + if (g_stat (argv[0], &st) == 0 && S_ISREG (st.st_mode) && g_access (argv[0], X_OK) == 0) { ESignature *sig; if ((sig = g_object_get_data ((GObject *) entry, "sig"))) { @@ -497,11 +499,15 @@ url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle) char buf[128]; ssize_t size; int fd; + char *filename; if (!strncmp (url, "file:", 5)) - url += 5; - - fd = open (url, O_RDONLY); + filename = g_filename_from_uri (url, NULL, NULL); + else + filename = g_strdup (url); + fd = g_open (filename, O_RDONLY | O_BINARY, 0); + g_free (filename); + status = GTK_HTML_STREAM_OK; if (fd != -1) { while ((size = read (fd, buf, sizeof (buf)))) { @@ -858,12 +864,17 @@ em_composer_prefs_construct (EMComposerPrefs *prefs) EMConfigTargetPrefs *target; GSList *l; int i; + char *gladefile; prefs->gconf = mail_config_get_gconf_client (); - gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "composer_toplevel", NULL); + gladefile = g_build_filename (EVOLUTION_GLADEDIR, + "mail-config.glade", + NULL); + gui = glade_xml_new (gladefile, "composer_toplevel", NULL); prefs->gui = gui; - prefs->sig_script_gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "vbox_add_script_signature", NULL); + prefs->sig_script_gui = glade_xml_new (gladefile, "vbox_add_script_signature", NULL); + g_free (gladefile); /** @HookPoint-EMConfig: Mail Composer Preferences * @Id: org.gnome.evolution.mail.composerPrefs |