summaryrefslogtreecommitdiffstats
path: root/src/extension/implementation/script.cpp
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2007-06-27 06:29:59 +0000
committergouldtj <gouldtj@users.sourceforge.net>2007-06-27 06:29:59 +0000
commit6b391a6f9b25d0a367463cd28ee2df425b4b2717 (patch)
tree0968e933f78a7e5448ff8b33e62e6ec95a0ae191 /src/extension/implementation/script.cpp
parentr15630@tres: ted | 2007-06-26 22:27:01 -0700 (diff)
downloadinkscape-6b391a6f9b25d0a367463cd28ee2df425b4b2717.tar.gz
inkscape-6b391a6f9b25d0a367463cd28ee2df425b4b2717.zip
r15631@tres: ted | 2007-06-26 22:34:54 -0700
Cleaning up the ::effect function to use more Glib:: (bzr r3141)
Diffstat (limited to '')
-rw-r--r--src/extension/implementation/script.cpp54
1 files changed, 14 insertions, 40 deletions
diff --git a/src/extension/implementation/script.cpp b/src/extension/implementation/script.cpp
index 898391e84..c877a827f 100644
--- a/src/extension/implementation/script.cpp
+++ b/src/extension/implementation/script.cpp
@@ -752,50 +752,24 @@ Script::effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *do
return;
}
- gchar *tmpname;
- // FIXME: process the GError instead of passing NULL
- gint tempfd_in = g_file_open_tmp("ink_ext_XXXXXX", &tmpname, NULL);
- if (tempfd_in == -1) {
- /* Error, couldn't create temporary filename */
- if (errno == EINVAL) {
- /* The last six characters of template were not XXXXXX. Now template is unchanged. */
- perror("Extension::Script: template for filenames is misconfigured.\n");
- exit(-1);
- } else if (errno == EEXIST) {
- /* Now the contents of template are undefined. */
- perror("Extension::Script: Could not create a unique temporary filename\n");
- return;
- } else {
- perror("Extension::Script: Unknown error creating temporary filename\n");
- exit(-1);
- }
+ std::string tempfilename_in;
+ int tempfd_in = 0;
+ try {
+ tempfd_in = Glib::file_open_tmp(tempfilename_in, "ink_ext_XXXXXX.svg");
+ } catch (...) {
+ /// \todo Popup dialog here
+ return;
}
- Glib::ustring tempfilename_in = tmpname;
- g_free(tmpname);
-
-
- // FIXME: process the GError instead of passing NULL
- gint tempfd_out = g_file_open_tmp("ink_ext_XXXXXX", &tmpname, NULL);
- if (tempfd_out == -1) {
- /* Error, couldn't create temporary filename */
- if (errno == EINVAL) {
- /* The last six characters of template were not XXXXXX. Now template is unchanged. */
- perror("Extension::Script: template for filenames is misconfigured.\n");
- exit(-1);
- } else if (errno == EEXIST) {
- /* Now the contents of template are undefined. */
- perror("Extension::Script: Could not create a unique temporary filename\n");
- return;
- } else {
- perror("Extension::Script: Unknown error creating temporary filename\n");
- exit(-1);
- }
+ std::string tempfilename_out;
+ int tempfd_out = 0;
+ try {
+ tempfd_out = Glib::file_open_tmp(tempfilename_out, "ink_ext_XXXXXX.svg");
+ } catch (...) {
+ /// \todo Popup dialog here
+ return;
}
- Glib::ustring tempfilename_out= tmpname;
- g_free(tmpname);
-
SPDesktop *desktop = (SPDesktop *) doc;
sp_namedview_document_from_window(desktop);